7fd59977 |
1 | -- File: MakeEllipse.cdl |
2 | -- Created: Mon Sep 28 11:49:44 1992 |
3 | -- Author: Remi GILET |
4 | -- <reg@sdsun2> |
5 | ---Copyright: Matra Datavision 1992 |
6 | |
7 | class MakeEllipse from GC inherits Root from GC |
8 | |
9 | ---Purpose :This class implements construction algorithms for an ellipse in |
10 | -- 3D space. The result is a Geom_Ellipse ellipse. |
11 | -- A MakeEllipse object provides a framework for: |
12 | -- - defining the construction of the ellipse, |
13 | -- - implementing the construction algorithm, and |
14 | -- - consulting the results. In particular, the Value |
15 | -- function returns the constructed ellipse. |
16 | |
17 | uses Pnt from gp, |
18 | Ax2 from gp, |
19 | Hypr from gp, |
20 | Ellipse from Geom, |
21 | Elips from gp |
22 | |
23 | raises NotDone from StdFail |
24 | |
25 | is |
26 | |
27 | Create (E : Elips from gp) returns MakeEllipse; |
28 | --- Purpose : |
29 | -- Creates an ellipse from a non persistent ellipse E from package gp by its conversion. |
30 | |
31 | Create (A2 : Ax2 from gp ; |
32 | MajorRadius, MinorRadius : Real from Standard) returns MakeEllipse; |
33 | --- Purpose : Constructs an ellipse with major and minor radii MajorRadius and |
34 | -- MinorRadius, and located in the plane defined by |
35 | -- the "X Axis" and "Y Axis" of the coordinate system A2, where: |
36 | -- - its center is the origin of A2, and |
37 | -- - its major axis is the "X Axis" of A2; |
38 | -- Warnings : |
39 | -- The MakeEllipse class does not prevent the |
40 | -- construction of an ellipse where MajorRadius is equal to MinorRadius. |
41 | -- If an error occurs (that is, when IsDone returns |
42 | -- false), the Status function returns: |
43 | -- - gce_InvertRadius if MajorRadius is less than MinorRadius; |
44 | -- - gce_NegativeRadius if MinorRadius is less than 0.0; |
45 | -- - gce_NullAxis if the points S1 and Center are coincident; or |
46 | -- - gce_InvertAxis if: |
47 | -- - the major radius computed with Center and S1 |
48 | -- is less than the minor radius computed with Center, S1 and S2, or |
49 | -- - Center, S1 and S2 are collinear. |
50 | |
51 | Create(S1,S2 : Pnt from gp; |
52 | Center : Pnt from gp) returns MakeEllipse; |
53 | ---Purpose: Constructs an ellipse centered on the point Center, where |
54 | -- - the plane of the ellipse is defined by Center, S1 and S2, |
55 | -- - its major axis is defined by Center and S1, |
56 | -- - its major radius is the distance between Center and S1, and |
57 | -- - its minor radius is the distance between S2 and the major axis. |
58 | |
59 | Value(me) returns Ellipse from Geom |
60 | raises NotDone |
61 | is static; |
62 | ---Purpose: Returns the constructed ellipse. |
63 | -- Exceptions StdFail_NotDone if no ellipse is constructed. |
64 | ---C++: return const& |
65 | |
66 | Operator(me) returns Ellipse from Geom |
67 | is static; |
68 | ---C++: return const& |
69 | ---C++: alias "Standard_EXPORT operator Handle_Geom_Ellipse() const;" |
70 | |
71 | fields |
72 | |
73 | TheEllipse : Ellipse from Geom; |
74 | --The solution from Geom. |
75 | |
76 | end MakeEllipse; |