42cf5bc1 |
1 | // Created on: 1993-03-24 |
2 | // Created by: Philippe DAUTRY |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Geom2d_Circle_HeaderFile |
18 | #define _Geom2d_Circle_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <Geom2d_Conic.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | class Standard_ConstructionError; |
28 | class Standard_RangeError; |
29 | class gp_Circ2d; |
30 | class gp_Ax2d; |
31 | class gp_Ax22d; |
32 | class gp_Pnt2d; |
33 | class gp_Vec2d; |
34 | class gp_Trsf2d; |
35 | class Geom2d_Geometry; |
36 | |
37 | |
38 | class Geom2d_Circle; |
39 | DEFINE_STANDARD_HANDLE(Geom2d_Circle, Geom2d_Conic) |
40 | |
41 | //! Describes a circle in the plane (2D space). |
42 | //! A circle is defined by its radius and, as with any conic |
43 | //! curve, is positioned in the plane with a coordinate |
44 | //! system (gp_Ax22d object) where the origin is the |
45 | //! center of the circle. |
46 | //! The coordinate system is the local coordinate |
47 | //! system of the circle. |
48 | //! The orientation (direct or indirect) of the local |
49 | //! coordinate system gives an explicit orientation to the |
50 | //! circle, determining the direction in which the |
51 | //! parameter increases along the circle. |
52 | //! The Geom2d_Circle circle is parameterized by an angle: |
53 | //! P(U) = O + R*Cos(U)*XDir + R*Sin(U)*YDir |
54 | //! where: |
55 | //! - P is the point of parameter U, |
56 | //! - O, XDir and YDir are respectively the origin, "X |
57 | //! Direction" and "Y Direction" of its local coordinate system, |
58 | //! - R is the radius of the circle. |
59 | //! The "X Axis" of the local coordinate system therefore |
60 | //! defines the origin of the parameter of the circle. The |
61 | //! parameter is the angle with this "X Direction". |
62 | //! A circle is a closed and periodic curve. The period is |
63 | //! 2.*Pi and the parameter range is [ 0,2.*Pi [. |
64 | //! See Also |
65 | //! GCE2d_MakeCircle which provides functions for |
66 | //! more complex circle constructions |
67 | //! gp_Ax22d and gp_Circ2d for an equivalent, non-parameterized data structure. |
68 | class Geom2d_Circle : public Geom2d_Conic |
69 | { |
70 | |
71 | public: |
72 | |
73 | |
74 | //! Constructs a circle by conversion of the gp_Circ2d circle C. |
75 | Standard_EXPORT Geom2d_Circle(const gp_Circ2d& C); |
76 | |
77 | //! Constructs a circle of radius Radius, whose center is the origin of axis |
78 | //! A; A is the "X Axis" of the local coordinate system |
79 | //! of the circle; this coordinate system is direct if |
80 | //! Sense is true (default value) or indirect if Sense is false. |
81 | //! Note: It is possible to create a circle where Radius is equal to 0.0. |
82 | //! Exceptions Standard_ConstructionError if Radius is negative. |
83 | Standard_EXPORT Geom2d_Circle(const gp_Ax2d& A, const Standard_Real Radius, const Standard_Boolean Sense = Standard_True); |
84 | |
85 | //! Constructs a circle |
86 | //! of radius Radius, where the coordinate system A |
87 | //! locates the circle and defines its orientation in the plane such that: |
88 | //! - the center of the circle is the origin of A, |
89 | //! - the orientation (direct or indirect) of A gives the |
90 | //! orientation of the circle. |
91 | Standard_EXPORT Geom2d_Circle(const gp_Ax22d& A, const Standard_Real Radius); |
92 | |
93 | |
94 | //! Converts the gp_Circ2d circle C into this circle. |
95 | Standard_EXPORT void SetCirc2d (const gp_Circ2d& C); |
96 | |
97 | Standard_EXPORT void SetRadius (const Standard_Real R); |
98 | |
99 | |
100 | //! Returns the non persistent circle from gp with the same |
101 | //! geometric properties as <me>. |
102 | Standard_EXPORT gp_Circ2d Circ2d() const; |
103 | |
104 | //! Returns the radius of this circle. |
105 | Standard_EXPORT Standard_Real Radius() const; |
106 | |
107 | //! Computes the parameter on the reversed circle for |
108 | //! the point of parameter U on this circle. |
109 | //! For a circle, the returned value is: 2.*Pi - U. |
110 | Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
111 | |
112 | //! Returns 0., which is the eccentricity of any circle. |
113 | Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE; |
114 | |
115 | //! Returns 0.0 |
116 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
117 | |
118 | //! Returns 2*PI. |
119 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
120 | |
121 | //! returns True. |
122 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
123 | |
124 | //! returns True. The period of a circle is 2.*Pi. |
125 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
126 | |
127 | //! Returns in P the point of parameter U. |
128 | //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir |
129 | //! where C is the center of the circle , XDir the XDirection and |
130 | //! YDir the YDirection of the circle's local coordinate system. |
131 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; |
132 | |
133 | |
134 | //! Returns the point P of parameter U and the first derivative V1. |
135 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE; |
136 | |
137 | |
138 | //! Returns the point P of parameter U, the first and second |
139 | //! derivatives V1 and V2. |
140 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE; |
141 | |
142 | |
143 | //! Returns the point P of parameter u, the first second and third |
144 | //! derivatives V1 V2 and V3. |
145 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE; |
146 | |
147 | //! For the point of parameter U of this circle, computes |
148 | //! the vector corresponding to the Nth derivative. |
149 | //! Exceptions: Standard_RangeError if N is less than 1. |
150 | Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
151 | |
152 | //! Applies the transformation T to this circle. |
153 | Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE; |
154 | |
155 | //! Creates a new object which is a copy of this circle. |
156 | Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE; |
157 | |
158 | |
159 | |
160 | |
92efcf78 |
161 | DEFINE_STANDARD_RTTIEXT(Geom2d_Circle,Geom2d_Conic) |
42cf5bc1 |
162 | |
163 | protected: |
164 | |
165 | |
166 | |
167 | |
168 | private: |
169 | |
170 | |
171 | Standard_Real radius; |
172 | |
173 | |
174 | }; |
175 | |
176 | |
177 | |
178 | |
179 | |
180 | |
181 | |
182 | #endif // _Geom2d_Circle_HeaderFile |