b311480e |
1 | -- Created on: 1993-03-24 |
2 | -- Created by: JCV |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Hyperbola from Geom2d inherits Conic from Geom2d |
18 | |
19 | --- Purpose : Describes a branch of a hyperbola in the plane (2D space). |
20 | -- A hyperbola is defined by its major and minor radii |
21 | -- and, as with any conic curve, is positioned in the |
22 | -- plane with a coordinate system (gp_Ax22d object) where: |
23 | -- - the origin is the center of the hyperbola, |
24 | -- - the "X Direction" defines the major axis, and |
25 | -- - the "Y Direction" defines the minor axis. |
26 | -- This coordinate system is the local coordinate |
27 | -- system of the hyperbola. |
28 | -- The branch of the hyperbola described is the one |
29 | -- located on the positive side of the major axis. |
30 | -- The orientation (direct or indirect) of the local |
31 | -- coordinate system gives an explicit orientation to the |
32 | -- hyperbola, determining the direction in which the |
33 | -- parameter increases along the hyperbola. |
34 | -- The Geom2d_Hyperbola hyperbola is parameterized as follows: |
35 | -- P(U) = O + MajRad*Cosh(U)*XDir + MinRad*Sinh(U)*YDir |
36 | -- where: |
37 | -- - P is the point of parameter U, |
38 | -- - O, XDir and YDir are respectively the origin, "X |
39 | -- Direction" and "Y Direction" of its local coordinate system, |
40 | -- - MajRad and MinRad are the major and minor radii of the hyperbola. |
41 | -- The "X Axis" of the local coordinate system therefore |
42 | -- defines the origin of the parameter of the hyperbola. |
43 | -- The parameter range is ] -infinite,+infinite [. |
44 | -- The following diagram illustrates the respective |
45 | -- positions, in the plane of the hyperbola, of the three |
46 | -- branches of hyperbolas constructed using the |
47 | -- functions OtherBranch, ConjugateBranch1 and |
48 | -- ConjugateBranch2: |
49 | -- ^YAxis |
50 | -- | |
51 | -- FirstConjugateBranch |
52 | -- | |
53 | -- Other | Main |
54 | -- --------------------- C |
55 | -- --------------------->XAxis |
56 | -- Branch | |
57 | -- Branch |
58 | -- | |
59 | -- SecondConjugateBranch |
60 | -- | |
61 | -- Warning |
62 | -- The value of the major radius (on the major axis) can |
63 | -- be less than the value of the minor radius (on the minor axis). |
64 | -- See Also |
65 | -- GCE2d_MakeHyperbola which provides functions for |
66 | -- more complex hyperbola constructions |
67 | -- gp_Ax22d |
68 | -- gp_Hypr2d for an equivalent, non-parameterized data structure |
69 | |
70 | |
71 | uses Ax2d from gp, |
72 | Ax22d from gp, |
73 | Hypr2d from gp, |
74 | Pnt2d from gp, |
75 | Trsf2d from gp, |
76 | Vec2d from gp, |
77 | Geometry from Geom2d |
78 | |
79 | |
80 | raises ConstructionError from Standard, |
81 | DomainError from Standard, |
82 | RangeError from Standard |
83 | |
84 | |
85 | is |
86 | |
6e33d3ce |
87 | Create (H : Hypr2d) returns Hyperbola; |
7fd59977 |
88 | --- Purpose : Creates an Hyperbola from a non persistent one from package gp |
89 | |
90 | |
91 | Create (MajorAxis : Ax2d; MajorRadius, MinorRadius : Real; |
92 | Sense: Boolean from Standard = Standard_True) |
6e33d3ce |
93 | returns Hyperbola |
7fd59977 |
94 | --- Purpose : |
95 | -- MajorAxis is the "XAxis" of the hyperbola. |
96 | -- The YAxis is in the direct sense if "Sense" is True; |
97 | -- The major radius of the hyperbola is on this "XAxis" and |
98 | -- the minor radius is on the "YAxis" of the hyperbola. |
99 | raises ConstructionError; |
100 | --- Purpose : Raised if MajorRadius < 0.0 or if MinorRadius < 0.0 |
101 | |
102 | Create (Axis : Ax22d; MajorRadius, MinorRadius : Real) |
6e33d3ce |
103 | returns Hyperbola |
7fd59977 |
104 | --- Purpose : |
105 | -- The XDirection of "Axis" is the "XAxis" of the hyperbola and |
106 | -- the YDirection of "Axis" is the "YAxis". |
107 | -- The major radius of the hyperbola is on this "XAxis" and |
108 | -- the minor radius is on the "YAxis" of the hyperbola. |
109 | raises ConstructionError; |
110 | --- Purpose : Raised if MajorRadius < 0.0 or if MinorRadius < 0.0 |
111 | |
112 | |
113 | |
114 | SetHypr2d (me : mutable; H : Hypr2d); |
115 | --- Purpose: Converts the gp_Hypr2d hyperbola H into this hyperbola. |
116 | |
117 | |
118 | |
119 | SetMajorRadius (me : mutable; MajorRadius : Real) |
120 | raises ConstructionError; |
121 | ---Purpose : Assigns a value to the major or minor radius of this hyperbola. |
122 | -- Exceptions |
123 | -- Standard_ConstructionError if: |
124 | -- - MajorRadius is less than 0.0, |
125 | -- - MinorRadius is less than 0.0. |
126 | |
127 | SetMinorRadius (me : mutable; MinorRadius : Real) |
128 | raises ConstructionError; |
129 | --- Purpose : Assigns a value to the major or minor radius of this hyperbola. |
130 | -- Exceptions |
131 | -- Standard_ConstructionError if: |
132 | -- - MajorRadius is less than 0.0, |
133 | -- - MinorRadius is less than 0.0. |
134 | |
135 | Hypr2d (me) returns Hypr2d; |
136 | --- Purpose : Converts this hyperbola into a gp_Hypr2d one. |
137 | |
138 | |
139 | |
140 | ReversedParameter(me; U : Real) returns Real is redefined static; |
141 | ---Purpose: Computes the parameter on the reversed hyperbola, |
142 | -- for the point of parameter U on this hyperbola. |
143 | -- For a hyperbola, the returned value is -U. |
144 | |
145 | |
146 | FirstParameter (me) returns Real is redefined static; |
147 | --- Purpose : Returns RealFirst from Standard. |
148 | |
149 | |
150 | LastParameter (me) returns Real is redefined static; |
151 | --- Purpose : returns RealLast from Standard. |
152 | |
153 | |
154 | IsClosed (me) returns Boolean is redefined static; |
155 | --- Purpose : Returns False. |
156 | |
157 | |
158 | IsPeriodic (me) returns Boolean is redefined static; |
159 | --- Purpose : return False for an hyperbola. |
160 | |
161 | |
162 | Asymptote1 (me) returns Ax2d |
163 | --- Purpose : |
164 | -- In the local coordinate system of the hyperbola the |
165 | -- equation of the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 |
166 | -- and the equation of the first asymptote is Y = (B/A)*X |
167 | -- where A is the major radius of the hyperbola and B is the |
168 | -- minor radius of the hyperbola. |
169 | raises ConstructionError; |
170 | --- Purpose : Raised if MajorRadius = 0.0 |
171 | |
172 | |
173 | Asymptote2 (me) returns Ax2d |
174 | --- Purpose : |
175 | -- In the local coordinate system of the hyperbola the |
176 | -- equation of the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 |
177 | -- and the equation of the first asymptote is Y = -(B/A)*X. |
178 | -- where A is the major radius of the hyperbola and B is the |
179 | -- minor radius of the hyperbola. |
180 | raises ConstructionError; |
181 | --- Purpose : raised if MajorRadius = 0.0 |
182 | |
183 | |
184 | ConjugateBranch1 (me) returns Hypr2d; |
185 | --- Purpose : Computes the first conjugate branch relative to this hyperbola. |
186 | -- Note: The diagram given under the class purpose |
187 | -- indicates where these two branches of hyperbola are |
188 | -- positioned in relation to this branch of hyperbola. |
189 | |
190 | ConjugateBranch2 (me) returns Hypr2d; |
191 | --- Purpose : Computes the second conjugate branch relative to this hyperbola. |
192 | -- Note: The diagram given under the class purpose |
193 | -- indicates where these two branches of hyperbola are |
194 | -- positioned in relation to this branch of hyperbola. |
195 | |
196 | |
197 | Directrix1 (me) returns Ax2d; |
198 | --- Purpose : |
199 | -- This directrix is the line normal to the XAxis of the hyperbola |
200 | -- in the local plane (Z = 0) at a distance d = MajorRadius / e |
201 | -- from the center of the hyperbola, where e is the eccentricity of |
202 | -- the hyperbola. |
203 | -- This line is parallel to the "YAxis". The intersection point |
204 | -- between directrix1 and the "XAxis" is the location point of the |
205 | -- directrix1. This point is on the positive side of the "XAxis". |
206 | |
207 | |
208 | Directrix2 (me) returns Ax2d; |
209 | --- Purpose : |
210 | -- This line is obtained by the symmetrical transformation |
211 | -- of "Directrix1" with respect to the "YAxis" of the hyperbola. |
212 | |
213 | |
214 | Eccentricity (me) returns Real |
215 | --- Purpose : |
216 | -- Returns the excentricity of the hyperbola (e > 1). |
217 | -- If f is the distance between the location of the hyperbola |
218 | -- and the Focus1 then the eccentricity e = f / MajorRadius. |
219 | raises DomainError is redefined static; |
220 | --- Purpose : raised if MajorRadius = 0.0 |
221 | |
222 | |
223 | Focal (me) returns Real; |
224 | --- Purpose : |
225 | -- Computes the focal distance. It is the distance between the |
226 | -- two focus of the hyperbola. |
227 | |
228 | |
229 | Focus1 (me) returns Pnt2d; |
230 | --- Purpose : |
231 | -- Returns the first focus of the hyperbola. This focus is on the |
232 | -- positive side of the "XAxis" of the hyperbola. |
233 | |
234 | |
235 | Focus2 (me) returns Pnt2d; |
236 | --- Purpose : |
237 | -- Returns the second focus of the hyperbola. This focus is on the |
238 | -- negative side of the "XAxis" of the hyperbola. |
239 | |
240 | |
241 | MajorRadius (me) returns Real; |
242 | ---Purpose: Returns the major or minor radius of this hyperbola. |
243 | -- The major radius is also the distance between the |
244 | -- center of the hyperbola and the apex of the main |
245 | -- branch (located on the "X Axis" of the hyperbola). |
246 | |
247 | |
248 | MinorRadius (me) returns Real; |
249 | ---Purpose: Returns the major or minor radius of this hyperbola. |
250 | -- The minor radius is also the distance between the |
251 | -- center of the hyperbola and the apex of a conjugate |
252 | -- branch (located on the "Y Axis" of the hyperbola). |
253 | |
254 | OtherBranch (me) returns Hypr2d; |
255 | --- Purpose : |
256 | -- Computes the "other" branch of this hyperbola. This |
257 | -- is a symmetrical branch with respect to the center of this hyperbola. |
258 | -- Note: The diagram given under the class purpose |
259 | -- indicates where the "other" branch is positioned in |
260 | -- relation to this branch of the hyperbola. |
261 | -- ^ YAxis |
262 | -- | |
263 | -- FirstConjugateBranch |
264 | -- | |
265 | -- Other | Main |
266 | -- ---------------------------- C |
267 | -- ------------------------------------------>XAxis |
268 | -- Branch | Branch |
269 | -- | |
270 | -- | |
271 | -- SecondConjugateBranch |
272 | -- | |
273 | -- Warning |
274 | -- The major radius can be less than the minor radius. |
275 | |
276 | Parameter (me) returns Real |
277 | --- Purpose : Computes the parameter of this hyperbola. |
278 | -- The parameter is: |
279 | -- p = (e*e - 1) * MajorRadius |
280 | -- where e is the eccentricity of this hyperbola and |
281 | -- MajorRadius its major radius. |
282 | -- Exceptions |
283 | -- Standard_DomainError if the major radius of this |
284 | -- hyperbola is null. |
285 | raises DomainError; |
286 | |
287 | |
288 | D0(me; U : Real; P : out Pnt2d) is redefined static; |
289 | ---Purpose: Returns in P the point of parameter U. |
290 | -- P = C + MajorRadius * Cosh (U) * XDir + |
291 | -- MinorRadius * Sinh (U) * YDir |
292 | -- where C is the center of the hyperbola , XDir the XDirection and |
293 | -- YDir the YDirection of the hyperbola's local coordinate system. |
294 | |
295 | |
296 | D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d) is redefined static; |
297 | --- Purpose : |
298 | -- Returns the point P of parameter U and the first derivative V1. |
299 | |
300 | |
301 | D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d) is redefined static; |
302 | --- Purpose : |
303 | -- Returns the point P of parameter U, the first and second |
304 | -- derivatives V1 and V2. |
305 | |
306 | |
307 | D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d) is redefined static; |
308 | --- Purpose : |
309 | -- Returns the point P of parameter U, the first second and |
310 | -- third derivatives V1 V2 and V3. |
311 | |
312 | |
313 | |
314 | DN (me; U : Real; N : Integer) returns Vec2d |
315 | --- Purpose : For the point of parameter U of this hyperbola, |
316 | -- computes the vector corresponding to the Nth derivative. |
317 | -- Exceptions Standard_RangeError if N is less than 1. |
318 | raises RangeError is redefined static; |
319 | |
320 | |
321 | |
322 | Transform (me : mutable; T : Trsf2d) is redefined static; |
323 | |
324 | ---Purpose: Applies the transformation T to this hyperbola. |
325 | |
6e33d3ce |
326 | Copy (me) returns like me is redefined static; |
7fd59977 |
327 | ---Purpose: Creates a new object which is a copy of this hyperbola. |
328 | |
329 | fields |
330 | |
331 | majorRadius : Real; |
332 | minorRadius : Real; |
333 | |
334 | end; |
335 | |