84cd6d312ed3679b2fa8fbe2d740df3c4f94bf26
[occt.git] / src / gp / gp_Elips2d.cdl
1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
3 --
4 -- This file is part of Open CASCADE Technology software library.
5 --
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.
11 --
12 -- Alternatively, this file may be used under the terms of Open CASCADE
13 -- commercial license or contractual agreement.
14
15 class Elips2d   from gp  inherits Storable
16
17         --- Purpose :
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
30         -- See Also
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 
36
37 uses Ax2d   from gp, 
38      Ax22d  from gp, 
39      Pnt2d  from gp, 
40      Trsf2d from gp, 
41      Vec2d  from gp
42
43 raises ConstructionError from Standard
44
45
46 is
47   Create   returns Elips2d;
48         ---C++:inline
49         --- Purpose : Creates an indefinite ellipse.
50
51
52   Create (MajorAxis : Ax2d; 
53           MajorRadius, MinorRadius : Real;
54           Sense : Boolean from Standard = Standard_True)
55      returns Elips2d
56         ---C++:inline
57         --- Purpose :
58         --  Creates an ellipse with the major axis, the major and the
59         --  minor radius. The location of the MajorAxis is the center
60         --  of the  ellipse.
61         --  The sense of parametrization is given by Sense.
62         --  Warnings :
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;
67         
68
69   Create (A : Ax22d; MajorRadius, MinorRadius : Real)
70      returns Elips2d
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.
82         --  Warnings :
83         --  It is possible to create an ellipse with 
84         --  MajorRadius = MinorRadius.  
85         -- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
86
87      raises ConstructionError;
88         
89
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. 
93
94
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
99      is static;
100
101
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
106         
107      is static;
108
109
110   SetAxis (me : in out; A : Ax22d)  is static;
111         --- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
112         --    it becomes A.
113
114
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.
121
122
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.
129
130
131   Area (me)  returns Real  is static;
132         --- Purpose : Computes the area of the ellipse.
133         ---C++: inline
134
135
136   Coefficients (me; A, B, C, D, E, F : out Real)  is static;
137         --- Purpose :
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.
140
141
142   Directrix1 (me)   returns Ax2d
143         ---C++: inline
144         --- Purpose :
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
148         --  the ellipse.
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
153         --- Purpose : 
154         --  Raised if Eccentricity = 0.0. (The ellipse degenerates into a
155         --  circle)
156      is static;
157
158
159   Directrix2 (me)   returns Ax2d
160         ---C++: inline
161         --- Purpose :
162         --  This line is obtained by the symmetrical transformation 
163         --  of "Directrix1" with respect to the minor axis of the ellipse.
164      raises ConstructionError
165         --- Purpose :
166         --  Raised if Eccentricity = 0.0. (The ellipse degenerates into a
167         --  circle).
168      is static;
169
170
171   Eccentricity (me)  returns Real   is static;
172         ---C++: inline
173         --- Purpose :
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.
178
179
180   Focal (me)  returns Real is static;
181         ---C++: inline
182         --- Purpose :
183         --  Returns the distance between the center of the ellipse
184         --  and focus1 or focus2.
185
186
187   Focus1 (me)   returns Pnt2d   is static;
188         ---C++: inline
189         --- Purpose :
190         --  Returns the first focus of the ellipse. This focus is on the
191         --  positive side of the major axis of the ellipse.
192
193
194   Focus2 (me)   returns Pnt2d   is static;
195         ---C++: inline
196         --- Purpose :
197         --  Returns the second focus of the ellipse. This focus is on the
198         --  negative side of the major axis of the ellipse.
199
200
201   Location (me)   returns Pnt2d  is static;
202         ---C++:inline
203         --- Purpose : Returns the center of the ellipse.
204         ---C++: return const&
205   
206
207   MajorRadius (me)  returns Real    is static;
208         --- Purpose : Returns the major radius of the Ellipse.
209         ---C++: inline
210
211
212   MinorRadius (me)   returns Real   is static;
213         --- Purpose : Returns the minor radius of the Ellipse.
214         ---C++: inline
215
216
217   Parameter (me)  returns Real   is static;
218         ---C++: inline
219         --- Purpose :
220         --  Returns p = (1 - e * e) * MajorRadius where e is the eccentricity 
221         --  of the ellipse.
222         --  Returns 0 if MajorRadius = 0
223
224
225   Axis (me)  returns Ax22d  is static;
226         --- Purpose : Returns the major axis of the ellipse.
227         ---C++: inline
228         ---C++: return const&
229
230
231   XAxis (me)  returns Ax2d  is static;
232         ---C++:inline
233         --- Purpose : Returns the major axis of the ellipse.
234
235
236   YAxis (me)  returns Ax2d  is static;
237         ---C++:inline
238         --- Purpose : Returns the minor axis of the ellipse.
239        
240
241         --- Purpose : Reverses the direction of the circle.
242
243   Reverse (me : in out)         is static;
244         ---C++:inline
245
246   Reversed (me)  returns Elips2d  is static;
247         ---C++:inline
248
249   IsDirect (me)  returns Boolean  is static;
250         ---C++:inline
251         --- Purpose : Returns true if the local coordinate system is direct
252         --            and false in the other case.
253
254
255      
256   Mirror (me : in out; P : Pnt2d)   
257          is static;
258
259   Mirrored (me; P : Pnt2d)  returns Elips2d  is static;
260
261    --- Purpose :
262         --  Performs the symmetrical transformation of a ellipse with respect 
263         --  to the point P which is the center of the symmetry
264
265
266   Mirror (me : in out; A : Ax2d)   
267          is static;
268
269   Mirrored (me; A : Ax2d)  returns Elips2d  is static;
270
271
272         --- Purpose :
273         --  Performs the symmetrical transformation of a ellipse with respect 
274         --  to an axis placement which is the axis of the symmetry.
275
276   Rotate (me : in out; P : Pnt2d; Ang : Real)  
277          is static;
278
279   Rotated (me; P : Pnt2d; Ang : Real)  returns Elips2d  is static;
280
281
282
283   Scale (me : in out; P : Pnt2d; S : Real)          is static;
284
285   Scaled (me; P : Pnt2d; S : Real)  returns Elips2d  is static;
286         --- Purpose : 
287         --  Scales a ellipse. S is the scaling value.
288
289      
290   Transform (me : in out; T : Trsf2d) 
291             is static;
292
293   Transformed (me; T : Trsf2d)  returns Elips2d   is static;
294    --- Purpose :
295         --  Transforms an ellipse with the transformation T from class Trsf2d.
296
297
298
299
300   Translate (me : in out; V : Vec2d)            is static;
301
302   Translated (me; V : Vec2d)   returns Elips2d  is static;
303
304         --- Purpose :
305         --  Translates a ellipse in the direction of the vector V.
306         --  The magnitude of the translation is the vector's magnitude.
307
308
309   Translate (me : in out; P1, P2 : Pnt2d )           is static;
310
311   Translated (me; P1, P2 : Pnt2d)   returns Elips2d  is static;
312
313         --- Purpose :
314         --  Translates a ellipse from the point P1 to the point P2.
315
316
317
318 fields
319
320      pos         : Ax22d;
321      majorRadius : Real;
322      minorRadius : Real;
323
324 end;
325