1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
4 -- This file is part of Open CASCADE Technology software library.
6 -- This library is free software; you can redistribute it and/or modify it under
7 -- the terms of the GNU Lesser General Public License version 2.1 as published
8 -- by the Free Software Foundation, with special exception defined in the file
9 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 -- distribution for complete text of the license and disclaimer of any warranty.
12 -- Alternatively, this file may be used under the terms of Open CASCADE
13 -- commercial license or contractual agreement.
15 class Elips2d from gp inherits Storable
18 -- Describes an ellipse in the plane (2D space).
19 -- An ellipse is defined by its major and minor radii and
20 -- positioned in the plane with a coordinate system (a
21 -- gp_Ax22d object) as follows:
22 -- - the origin of the coordinate system is the center of the ellipse,
23 -- - its "X Direction" defines the major axis of the ellipse, and
24 -- - its "Y Direction" defines the minor axis of the ellipse.
25 -- This coordinate system is the "local coordinate system"
26 -- of the ellipse. Its orientation (direct or indirect) gives an
27 -- implicit orientation to the ellipse. In this coordinate
28 -- system, the equation of the ellipse is:
29 -- X*X / (MajorRadius**2) + Y*Y / (MinorRadius**2) = 1.0
31 -- gce_MakeElips2d which provides functions for more
32 -- complex ellipse constructions
33 -- Geom2d_Ellipse which provides additional functions for
34 -- constructing ellipses and works, in particular, with the
35 -- parametric equations of ellipses
43 raises ConstructionError from Standard
47 Create returns Elips2d;
49 --- Purpose : Creates an indefinite ellipse.
52 Create (MajorAxis : Ax2d;
53 MajorRadius, MinorRadius : Real;
54 Sense : Boolean from Standard = Standard_True)
58 -- Creates an ellipse with the major axis, the major and the
59 -- minor radius. The location of the MajorAxis is the center
61 -- The sense of parametrization is given by Sense.
63 -- It is possible to create an ellipse with
64 -- MajorRadius = MinorRadius.
65 -- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
66 raises ConstructionError;
69 Create (A : Ax22d; MajorRadius, MinorRadius : Real)
71 --- Purpose : Creates an ellipse with radii MajorRadius and
72 -- MinorRadius, positioned in the plane by coordinate system A where:
73 -- - the origin of A is the center of the ellipse,
74 -- - the "X Direction" of A defines the major axis of
75 -- the ellipse, that is, the major radius MajorRadius
76 -- is measured along this axis, and
77 -- - the "Y Direction" of A defines the minor axis of
78 -- the ellipse, that is, the minor radius MinorRadius
79 -- is measured along this axis, and
80 -- - the orientation (direct or indirect sense) of A
81 -- gives the orientation of the ellipse.
83 -- It is possible to create an ellipse with
84 -- MajorRadius = MinorRadius.
85 -- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
87 raises ConstructionError;
90 SetLocation (me : in out; P : Pnt2d) is static;
91 --- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
92 -- - its origin becomes P.
95 SetMajorRadius (me : in out; MajorRadius : Real)
96 --- Purpose : Changes the value of the major radius.
97 -- Raises ConstructionError if MajorRadius < MinorRadius.
98 raises ConstructionError
102 SetMinorRadius (me : in out; MinorRadius : Real)
103 --- Purpose : Changes the value of the minor radius.
104 -- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
105 raises ConstructionError
110 SetAxis (me : in out; A : Ax22d) is static;
111 --- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
115 SetXAxis (me : in out; A : Ax2d) is static;
116 --- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
117 -- its origin and its "X Direction" become those
118 -- of the axis A. The "Y Direction" is then
119 -- recomputed. The orientation of the local coordinate
120 -- system is not modified.
123 SetYAxis (me : in out; A : Ax2d) is static;
124 --- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
125 -- its origin and its "Y Direction" become those
126 -- of the axis A. The "X Direction" is then
127 -- recomputed. The orientation of the local coordinate
128 -- system is not modified.
131 Area (me) returns Real is static;
132 --- Purpose : Computes the area of the ellipse.
136 Coefficients (me; A, B, C, D, E, F : out Real) is static;
138 -- Returns the coefficients of the implicit equation of the ellipse.
139 -- A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
142 Directrix1 (me) returns Ax2d
145 -- This directrix is the line normal to the XAxis of the ellipse
146 -- in the local plane (Z = 0) at a distance d = MajorRadius / e
147 -- from the center of the ellipse, where e is the eccentricity of
149 -- This line is parallel to the "YAxis". The intersection point
150 -- between directrix1 and the "XAxis" is the location point of the
151 -- directrix1. This point is on the positive side of the "XAxis".
152 raises ConstructionError
154 -- Raised if Eccentricity = 0.0. (The ellipse degenerates into a
159 Directrix2 (me) returns Ax2d
162 -- This line is obtained by the symmetrical transformation
163 -- of "Directrix1" with respect to the minor axis of the ellipse.
164 raises ConstructionError
166 -- Raised if Eccentricity = 0.0. (The ellipse degenerates into a
171 Eccentricity (me) returns Real is static;
174 -- Returns the eccentricity of the ellipse between 0.0 and 1.0
175 -- If f is the distance between the center of the ellipse and
176 -- the Focus1 then the eccentricity e = f / MajorRadius.
177 -- Returns 0 if MajorRadius = 0.
180 Focal (me) returns Real is static;
183 -- Returns the distance between the center of the ellipse
184 -- and focus1 or focus2.
187 Focus1 (me) returns Pnt2d is static;
190 -- Returns the first focus of the ellipse. This focus is on the
191 -- positive side of the major axis of the ellipse.
194 Focus2 (me) returns Pnt2d is static;
197 -- Returns the second focus of the ellipse. This focus is on the
198 -- negative side of the major axis of the ellipse.
201 Location (me) returns Pnt2d is static;
203 --- Purpose : Returns the center of the ellipse.
204 ---C++: return const&
207 MajorRadius (me) returns Real is static;
208 --- Purpose : Returns the major radius of the Ellipse.
212 MinorRadius (me) returns Real is static;
213 --- Purpose : Returns the minor radius of the Ellipse.
217 Parameter (me) returns Real is static;
220 -- Returns p = (1 - e * e) * MajorRadius where e is the eccentricity
222 -- Returns 0 if MajorRadius = 0
225 Axis (me) returns Ax22d is static;
226 --- Purpose : Returns the major axis of the ellipse.
228 ---C++: return const&
231 XAxis (me) returns Ax2d is static;
233 --- Purpose : Returns the major axis of the ellipse.
236 YAxis (me) returns Ax2d is static;
238 --- Purpose : Returns the minor axis of the ellipse.
241 --- Purpose : Reverses the direction of the circle.
243 Reverse (me : in out) is static;
246 Reversed (me) returns Elips2d is static;
249 IsDirect (me) returns Boolean is static;
251 --- Purpose : Returns true if the local coordinate system is direct
252 -- and false in the other case.
256 Mirror (me : in out; P : Pnt2d)
259 Mirrored (me; P : Pnt2d) returns Elips2d is static;
262 -- Performs the symmetrical transformation of a ellipse with respect
263 -- to the point P which is the center of the symmetry
266 Mirror (me : in out; A : Ax2d)
269 Mirrored (me; A : Ax2d) returns Elips2d is static;
273 -- Performs the symmetrical transformation of a ellipse with respect
274 -- to an axis placement which is the axis of the symmetry.
276 Rotate (me : in out; P : Pnt2d; Ang : Real)
279 Rotated (me; P : Pnt2d; Ang : Real) returns Elips2d is static;
283 Scale (me : in out; P : Pnt2d; S : Real) is static;
285 Scaled (me; P : Pnt2d; S : Real) returns Elips2d is static;
287 -- Scales a ellipse. S is the scaling value.
290 Transform (me : in out; T : Trsf2d)
293 Transformed (me; T : Trsf2d) returns Elips2d is static;
295 -- Transforms an ellipse with the transformation T from class Trsf2d.
300 Translate (me : in out; V : Vec2d) is static;
302 Translated (me; V : Vec2d) returns Elips2d is static;
305 -- Translates a ellipse in the direction of the vector V.
306 -- The magnitude of the translation is the vector's magnitude.
309 Translate (me : in out; P1, P2 : Pnt2d ) is static;
311 Translated (me; P1, P2 : Pnt2d) returns Elips2d is static;
314 -- Translates a ellipse from the point P1 to the point P2.