7fd59977 |
1 | -- File: Geom2d_Parabola.cdl |
2 | -- Created: Wed Mar 24 18:22:05 1993 |
3 | -- Author: JCV |
4 | -- <fid@sdsun2> |
5 | -- Copyright: Matra Datavision 1993 |
6 | |
7 | ---Copyright: Matra Datavision 1991, 1992 |
8 | |
9 | |
10 | class Parabola from Geom2d inherits Conic from Geom2d |
11 | |
12 | |
13 | --- Purpose : Describes a parabola in the plane (2D space). |
14 | -- A parabola is defined by its focal length (i.e. the |
15 | -- distance between its focus and its apex) and is |
16 | -- positioned in the plane with a coordinate system |
17 | -- (gp_Ax22d object) where: |
18 | -- - the origin is the apex of the parabola, and |
19 | -- - the "X Axis" defines the axis of symmetry; the |
20 | -- parabola is on the positive side of this axis. |
21 | -- This coordinate system is the local coordinate |
22 | -- system of the parabola. |
23 | -- The orientation (direct or indirect) of the local |
24 | -- coordinate system gives an explicit orientation to the |
25 | -- parabola, determining the direction in which the |
26 | -- parameter increases along the parabola. |
27 | -- The Geom_Parabola parabola is parameterized as follows: |
28 | -- P(U) = O + U*U/(4.*F)*XDir + U*YDir, where: |
29 | -- - P is the point of parameter U, |
30 | -- - O, XDir and YDir are respectively the origin, "X |
31 | -- Direction" and "Y Direction" of its local coordinate system, |
32 | -- - F is the focal length of the parabola. |
33 | -- The parameter of the parabola is therefore its Y |
34 | -- coordinate in the local coordinate system, with the "X |
35 | -- Axis" of the local coordinate system defining the |
36 | -- origin of the parameter. |
37 | -- The parameter range is ] -infinite,+infinite [. |
38 | |
39 | uses Ax2d from gp, |
40 | Ax22d from gp, |
41 | Parab2d from gp, |
42 | Pnt2d from gp, |
43 | Trsf2d from gp, |
44 | Vec2d from gp, |
45 | Geometry from Geom2d |
46 | |
47 | raises ConstructionError from Standard, |
48 | RangeError from Standard |
49 | |
50 | |
51 | is |
52 | |
53 | |
54 | |
55 | |
56 | Create (Prb : Parab2d) returns mutable Parabola; |
57 | --- Purpose : Creates a parabola from a non persistent one. |
58 | |
59 | |
60 | Create (MirrorAxis : Ax2d; Focal : Real; |
61 | Sense: Boolean from Standard = Standard_True) |
62 | returns mutable Parabola |
63 | --- Purpose : |
64 | -- Creates a parabola with its "MirrorAxis" and it's focal |
65 | -- length "Focal". |
66 | -- MirrorAxis is the axis of symmetry of the curve, it is the |
67 | -- "XAxis". The "YAxis" is parallel to the directrix of the |
68 | -- parabola and is in the direct sense if Sense is True. |
69 | -- The "Location" point of "MirrorAxis" is the vertex of the parabola |
70 | raises ConstructionError; |
71 | --- Purpose : Raised if Focal < 0.0 |
72 | |
73 | Create (Axis : Ax22d; Focal : Real) returns mutable Parabola |
74 | --- Purpose : |
75 | -- Creates a parabola with its Axis and it's focal |
76 | -- length "Focal". |
77 | -- The XDirection of Axis is the axis of symmetry of the curve, |
78 | -- it is the "XAxis". The "YAxis" is parallel to the directrix of the |
79 | -- parabola. The "Location" point of "Axis" is the vertex |
80 | -- of the parabola. |
81 | raises ConstructionError; |
82 | --- Purpose : Raised if Focal < 0.0 |
83 | |
84 | |
85 | Create (D : Ax2d; F : Pnt2d) returns mutable Parabola; |
86 | --- Purpose : |
87 | -- D is the directrix of the parabola and F the focus point. |
88 | -- The symmetry axis "XAxis" of the parabola is normal to the |
89 | -- directrix and pass through the focus point F, but its |
90 | -- "Location" point is the vertex of the parabola. |
91 | -- The "YAxis" of the parabola is parallel to D and its "Location" |
92 | -- point is the vertex of the parabola. |
93 | |
94 | |
95 | SetFocal (me : mutable; Focal : Real) |
96 | --- Purpose : Assigns the value Focal to the focal length of this parabola. |
97 | -- Exceptions Standard_ConstructionError if Focal is negative. |
98 | raises ConstructionError; |
99 | |
100 | |
101 | SetParab2d (me : mutable; Prb : Parab2d); |
102 | --- Purpose: Converts the gp_Parab2d parabola Prb into this parabola. |
103 | |
104 | Parab2d (me) returns Parab2d; |
105 | --- Purpose : |
106 | -- Returns the non persistent parabola from gp with the same |
107 | -- geometric properties as <me>. |
108 | |
109 | |
110 | ReversedParameter(me; U : Real) returns Real is redefined static; |
111 | ---Purpose: Computes the parameter on the reversed parabola |
112 | -- for the point of parameter U on this parabola. |
113 | -- For a parabola, the returned value is -U. |
114 | |
115 | |
116 | FirstParameter (me) returns Real is redefined static; |
117 | --- Purpose : Returns RealFirst from Standard. |
118 | |
119 | |
120 | LastParameter (me) returns Real is redefined static; |
121 | --- Purpose : Returns RealLast from Standard. |
122 | |
123 | |
124 | IsClosed (me) returns Boolean is redefined static; |
125 | --- Purpose : Returns False |
126 | |
127 | |
128 | IsPeriodic (me) returns Boolean is redefined static; |
129 | --- Purpose : Returns False |
130 | |
131 | |
132 | Directrix (me) returns Ax2d; |
133 | --- Purpose : The directrix is parallel to the "YAxis" of the parabola. |
134 | -- The "Location" point of the directrix is the intersection |
135 | -- point between the directrix and the symmetry axis ("XAxis") of the parabola. |
136 | |
137 | |
138 | Eccentricity (me) returns Real is redefined static; |
139 | --- Purpose : Returns the eccentricity e = 1.0 |
140 | |
141 | |
142 | Focus (me) returns Pnt2d; |
143 | ---Purpose: Computes the focus of this parabola The focus is on the |
144 | -- positive side of the "X Axis" of the local coordinate system of the parabola. |
145 | |
146 | Focal (me) returns Real; |
147 | --- Purpose : Computes the focal length of this parabola. |
148 | -- The focal length is the distance between the apex and the focus of the parabola. |
149 | |
150 | |
151 | |
152 | Parameter (me) returns Real; |
153 | --- Purpose : Computes the parameter of this parabola, which is |
154 | -- the distance between its focus and its directrix. This |
155 | -- distance is twice the focal length. |
156 | -- If P is the parameter of the parabola, the equation of |
157 | -- the parabola in its local coordinate system is: Y**2 = 2.*P*X. |
158 | |
159 | |
160 | D0(me; U : Real; P : out Pnt2d) is redefined static; |
161 | ---Purpose: Returns in P the point of parameter U. |
162 | -- If U = 0 the returned point is the origin of the XAxis and |
163 | -- the YAxis of the parabola and it is the vertex of the parabola. |
164 | -- P = S + F * (U * U * XDir + * U * YDir) |
165 | -- where S is the vertex of the parabola, XDir the XDirection and |
166 | -- YDir the YDirection of the parabola's local coordinate system. |
167 | |
168 | |
169 | D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d) is redefined static; |
170 | --- Purpose : |
171 | -- Returns the point P of parameter U and the first derivative V1. |
172 | |
173 | |
174 | D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d) is redefined static; |
175 | --- Purpose : |
176 | -- Returns the point P of parameter U, the first and second |
177 | -- derivatives V1 and V2. |
178 | |
179 | |
180 | D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d) is redefined static; |
181 | --- Purpose : |
182 | -- Returns the point P of parameter U, the first second and third |
183 | -- derivatives V1 V2 and V3. |
184 | |
185 | |
186 | DN (me; U : Real; N : Integer) returns Vec2d |
187 | --- Purpose : For the point of parameter U of this parabola, |
188 | -- computes the vector corresponding to the Nth derivative. |
189 | -- Exceptions Standard_RangeError if N is less than 1. |
190 | raises RangeError |
191 | is redefined static; |
192 | |
193 | Transform (me : mutable; T : Trsf2d) is redefined static; |
194 | ---Purpose: Applies the transformation T to this parabola. |
195 | |
196 | TransformedParameter(me; U : Real; T : Trsf2d from gp) returns Real |
197 | ---Purpose: Computes the parameter on the transformed |
198 | -- parabola, for the point of parameter U on this parabola. |
199 | -- For a parabola, the returned value is equal to U |
200 | -- multiplied by the scale factor of transformation T. |
201 | is redefined static; |
202 | |
203 | ParametricTransformation(me; T : Trsf2d from gp) returns Real |
204 | ---Purpose: Returns a coefficient to compute the parameter on |
205 | -- the transformed curve for the transform of the |
206 | -- point on <me>. |
207 | -- |
208 | -- Transformed(T)->Value(U * ParametricTransformation(T)) |
209 | -- |
210 | -- is the same point as |
211 | -- |
212 | -- Value(U).Transformed(T) |
213 | -- |
214 | -- This methods returns T.ScaleFactor() |
215 | is redefined static; |
216 | |
217 | |
218 | Copy (me) returns mutable like me |
219 | is redefined static; |
220 | ---Purpose: Creates a new object, which is a copy of this parabola. |
221 | fields |
222 | |
223 | focalLength : Real; |
224 | |
225 | end; |