CFx SDK Documentation  2022 SP0
FMBulgeSeg2D.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2015, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2015 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 #ifndef __FM_BULGESEG2D_H__
24 #define __FM_BULGESEG2D_H__
25 
27 
28 namespace FacetModeler
29 {
30 
32 //
33 // BulgeSeg2D is a convex 2-D curve given by 2 points and a bulge value
34 // If the 2 points coincide, the segment has estCoincident type
35 // Otherwise, if bulge==0, the segment is a straight line segment
36 // otherwise it is a circular arc, and bulge=tan(Angle/4)
37 //
38 
39 class FMGEOMETRY_API BulgeSeg2D : public CommonSeg2DImpl
40 {
41 public:
43  // Constructors ...
44 
45  // default constructor
46  BulgeSeg2D() : m_dBulge(0) { };
47 
48  // constructor: 2 endpoints and a bulge value ( tan(a/4) )
49  BulgeSeg2D( const OdGePoint2d & ptA, const OdGePoint2d & ptB, double dBulge=0.0 )
50  : m_ptStart(ptA)
51  , m_ptEnd(ptB)
52  , m_dBulge(dBulge)
53  { };
54 
55  BulgeSeg2D( const OdGePoint2d & ptA, const OdGePoint2d & ptB, double dBulge, const Attributes2D& rAttr )
56  : m_ptStart(ptA)
57  , m_ptEnd(ptB)
58  , m_dBulge(dBulge)
59  , m_Attr(rAttr)
60  { };
61 
62  // constructor: 2 endpoints and an intermediate point
63  BulgeSeg2D( const OdGePoint2d & ptA, const OdGePoint2d & ptB, const OdGePoint2d & ptIntermediate );
64 
65  // fast copy constructor
66  BulgeSeg2D( const BulgeSeg2D & rSeg )
67  : m_ptStart( rSeg.m_ptStart )
68  , m_ptEnd( rSeg.m_ptEnd )
69  , m_dBulge( rSeg.m_dBulge )
70  , m_Attr( rSeg.m_Attr )
71  { };
72 
73  // slower copy constructor
74  BulgeSeg2D( const IBulgeSeg2D & rAnySeg );
75 
76 
77  // type info: returns esicBulgeSeg2D
78  virtual SegmentImplClass implClass( ) const;
79 
81  // Implementation of data getters, not implemented in CommonSeg2DImpl
82 
83  // returns reference to the starting point
84  virtual const OdGePoint2d & startPt() const;
85 
86  // returns reference to the ending point
87  virtual const OdGePoint2d & endPt () const;
88 
89  // returns bulge value
90  virtual double bulge () const;
91 
92 
94  // Implementation of non-const methods, not implemented in CommonSeg2DImpl
95 
97 
98  // Update ends and bulge
99  virtual Result set( const OdGePoint2d & ptA, const OdGePoint2d & ptB, double dBulge, const Attributes2D& rAttr );
100 
101  // VC6 compatibility
102  virtual Result set( const OdGePoint2d & ptA, const OdGePoint2d & ptB, double dBulge=0.0 )
103  {
104  return CommonSeg2DImpl::set( ptA, ptB, dBulge );
105  }
106 
107  virtual Result set( const OdGePoint2d & ptA, const OdGePoint2d & ptB, const OdGePoint2d & ptIntermediate )
108  {
109  return CommonSeg2DImpl::set( ptA, ptB, ptIntermediate );
110  }
111 
112  virtual Result set( const IBulgeSeg2D& rSeg )
113  {
114  return CommonSeg2DImpl::set( rSeg );
115  }
116 
117  virtual Result set( const OdGeLineSeg2d& geLine )
118  {
119  return CommonSeg2DImpl::set( geLine );
120  }
121 
122  virtual Result set( const OdGeCircArc2d& geArc )
123  {
124  return CommonSeg2DImpl::set( geArc );
125  }
126 
127  // Get attributes (including metadata)
128  virtual const Attributes2D& attributes() const;
129 
130  // Get attributes (including metadata) for update
132 
134  // overrides ( a faster implementation of some methods )
135 
136 
137  // returns the type of this segment
138  virtual SegmentType type() const;
139 
140 
141 
142  // To Do ...
143 
144 
145 protected:
146 
148  // necessary data members
149 
150  OdGePoint2d m_ptStart; // Starting point
151 
152  OdGePoint2d m_ptEnd; // Ending point
153 
154  double m_dBulge; // Bulge value = tan(angle/4)
155 
157 };
158 
159 
160 
161 }; // namespace AECContours
162 
163 
164 #endif //__FM_BULGESEG2D_H__
virtual Result set(const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge, const Attributes2D &rAttr)
virtual const OdGePoint2d & startPt() const
virtual Result set(const IBulgeSeg2D &rSeg)
Definition: FMBulgeSeg2D.h:112
BulgeSeg2D(const IBulgeSeg2D &rAnySeg)
BulgeSeg2D(const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge=0.0)
Definition: FMBulgeSeg2D.h:49
virtual Result set(const OdGeLineSeg2d &geLine)
Definition: FMBulgeSeg2D.h:117
virtual SegmentType type() const
BulgeSeg2D(const OdGePoint2d &ptA, const OdGePoint2d &ptB, const OdGePoint2d &ptIntermediate)
BulgeSeg2D(const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge, const Attributes2D &rAttr)
Definition: FMBulgeSeg2D.h:55
virtual SegmentImplClass implClass() const
virtual double bulge() const
virtual Attributes2D & attributes4U()
virtual Result set(const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge=0.0)
Definition: FMBulgeSeg2D.h:102
BulgeSeg2D(const BulgeSeg2D &rSeg)
Definition: FMBulgeSeg2D.h:66
virtual Result set(const OdGePoint2d &ptA, const OdGePoint2d &ptB, const OdGePoint2d &ptIntermediate)
Definition: FMBulgeSeg2D.h:107
virtual const Attributes2D & attributes() const
virtual Result set(const OdGeCircArc2d &geArc)
Definition: FMBulgeSeg2D.h:122
virtual const OdGePoint2d & endPt() const
virtual Result set(const OdGePoint2d &ptA, const OdGePoint2d &ptB, double dBulge, const Attributes2D &rAttr)=0