1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
4 -- The content of this file is subject to the Open CASCADE Technology Public
5 -- License Version 6.5 (the "License"). You may not use the content of this file
6 -- except in compliance with the License. Please obtain a copy of the License
7 -- at http://www.opencascade.org and read it completely before using this file.
9 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 -- The Original Code and all software distributed under the License is
13 -- distributed on an "AS IS" basis, without warranty of any kind, and the
14 -- Initial Developer hereby disclaims all such warranties, including without
15 -- limitation, any warranties of merchantability, fitness for a particular
16 -- purpose or non-infringement. Please see the License for the specific terms
17 -- and conditions governing the rights and limitations under the License.
23 class Hypr from gp inherits Storable
25 --- Purpose : Describes a branch of a hyperbola in 3D space.
26 -- A hyperbola is defined by its major and minor radii and
27 -- positioned in space with a coordinate system (a gp_Ax2
29 -- - the origin is the center of the hyperbola,
30 -- - the "X Direction" defines the major axis of the
32 -- - the "Y Direction" defines the minor axis of the hyperbola.
33 -- The origin, "X Direction" and "Y Direction" of this
34 -- coordinate system together define the plane of the
35 -- hyperbola. This coordinate system is the "local
36 -- coordinate system" of the hyperbola. In this coordinate
37 -- system, the equation of the hyperbola is:
38 -- X*X/(MajorRadius**2)-Y*Y/(MinorRadius**2) = 1.0
39 -- The branch of the hyperbola described is the one located
40 -- on the positive side of the major axis.
41 -- The "main Direction" of the local coordinate system is a
42 -- normal vector to the plane of the hyperbola. This vector
43 -- gives an implicit orientation to the hyperbola. We refer to
44 -- the "main Axis" of the local coordinate system as the
45 -- "Axis" of the hyperbola.
46 -- The following schema shows the plane of the hyperbola,
47 -- and in it, the respective positions of the three branches of
48 -- hyperbolas constructed with the functions OtherBranch,
49 -- ConjugateBranch1, and ConjugateBranch2:
53 -- FirstConjugateBranch
56 -- --------------------- C ------------------------------>XAxis
60 -- SecondConjugateBranch
63 -- The major radius can be less than the minor radius.
65 -- gce_MakeHypr which provides functions for more
66 -- complex hyperbola constructions
67 -- Geom_Hyperbola which provides additional functions for
68 -- constructing hyperbolas and works, in particular, with the
69 -- parametric equations of hyperbolas
78 raises ConstructionError from Standard,
79 DomainError from Standard
87 --- Purpose : Creates of an indefinite hyperbola.
90 Create (A2 : Ax2; MajorRadius, MinorRadius : Real) returns Hypr
92 --- Purpose : Creates a hyperbola with radii MajorRadius and
93 -- MinorRadius, positioned in the space by the
94 -- coordinate system A2 such that:
95 -- - the origin of A2 is the center of the hyperbola,
96 -- - the "X Direction" of A2 defines the major axis of
97 -- the hyperbola, that is, the major radius
98 -- MajorRadius is measured along this axis, and
99 -- - the "Y Direction" of A2 defines the minor axis of
100 -- the hyperbola, that is, the minor radius
101 -- MinorRadius is measured along this axis.
102 -- Note: This class does not prevent the creation of a
104 -- - MajorAxis is equal to MinorAxis, or
105 -- - MajorAxis is less than MinorAxis.
107 -- Standard_ConstructionError if MajorAxis or MinorAxis is negative.
108 -- Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
110 raises ConstructionError;
111 --- Purpose : Raised if MajorRadius < 0.0 or MinorRadius < 0.0
114 SetAxis (me : in out; A1 : Ax1)
116 --- Purpose : Modifies this hyperbola, by redefining its local coordinate
118 -- - its origin and "main Direction" become those of the
119 -- axis A1 (the "X Direction" and "Y Direction" are then
120 -- recomputed in the same way as for any gp_Ax2).
121 -- Raises ConstructionError if the direction of A1 is parallel to the direction of
122 -- the "XAxis" of the hyperbola.
123 raises ConstructionError
128 SetLocation (me : in out; P : Pnt) is static;
130 --- Purpose : Modifies this hyperbola, by redefining its local coordinate
131 -- system so that its origin becomes P.
135 SetMajorRadius (me : in out; MajorRadius : Real)
138 -- Modifies the major radius of this hyperbola.
140 -- Standard_ConstructionError if MajorRadius is negative.
141 raises ConstructionError
145 SetMinorRadius (me : in out; MinorRadius : Real)
148 -- Modifies the minor radius of this hyperbola.
150 -- Standard_ConstructionError if MinorRadius is negative.
151 raises ConstructionError
155 SetPosition (me : in out; A2 : Ax2) is static;
157 --- Purpose : Modifies this hyperbola, by redefining its local coordinate
158 -- system so that it becomes A2.
161 Asymptote1 (me) returns Ax1
164 -- In the local coordinate system of the hyperbola the equation of
165 -- the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
166 -- equation of the first asymptote is Y = (B/A)*X
167 -- where A is the major radius and B is the minor radius. Raises ConstructionError if MajorRadius = 0.0
168 raises ConstructionError
172 Asymptote2 (me) returns Ax1
175 -- In the local coordinate system of the hyperbola the equation of
176 -- the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
177 -- equation of the first asymptote is Y = -(B/A)*X.
178 -- where A is the major radius and B is the minor radius. Raises ConstructionError if MajorRadius = 0.0
179 raises ConstructionError
183 Axis (me) returns Ax1 is static;
185 --- Purpose : Returns the axis passing through the center,
186 -- and normal to the plane of this hyperbola.
187 ---C++: return const&
189 ConjugateBranch1 (me) returns Hypr is static;
192 -- Computes the branch of hyperbola which is on the positive side of the
196 ConjugateBranch2 (me) returns Hypr is static;
199 -- Computes the branch of hyperbola which is on the negative side of the
203 Directrix1 (me) returns Ax1 is static;
206 -- This directrix is the line normal to the XAxis of the hyperbola
207 -- in the local plane (Z = 0) at a distance d = MajorRadius / e
208 -- from the center of the hyperbola, where e is the eccentricity of
210 -- This line is parallel to the "YAxis". The intersection point
211 -- between the directrix1 and the "XAxis" is the "Location" point
212 -- of the directrix1. This point is on the positive side of the
216 Directrix2 (me) returns Ax1 is static;
219 -- This line is obtained by the symmetrical transformation
220 -- of "Directrix1" with respect to the "YAxis" of the hyperbola.
223 Eccentricity (me) returns Real
226 -- Returns the excentricity of the hyperbola (e > 1).
227 -- If f is the distance between the location of the hyperbola
228 -- and the Focus1 then the eccentricity e = f / MajorRadius. Raises DomainError if MajorRadius = 0.0
233 Focal (me) returns Real is static;
236 -- Computes the focal distance. It is the distance between the
237 -- the two focus of the hyperbola.
240 Focus1 (me) returns Pnt is static;
243 -- Returns the first focus of the hyperbola. This focus is on the
244 -- positive side of the "XAxis" of the hyperbola.
247 Focus2 (me) returns Pnt is static;
250 -- Returns the second focus of the hyperbola. This focus is on the
251 -- negative side of the "XAxis" of the hyperbola.
254 Location (me) returns Pnt is static;
257 -- Returns the location point of the hyperbola. It is the
258 -- intersection point between the "XAxis" and the "YAxis".
259 ---C++: return const&
262 MajorRadius (me) returns Real is static;
265 -- Returns the major radius of the hyperbola. It is the radius
266 -- on the "XAxis" of the hyperbola.
269 MinorRadius (me) returns Real is static;
272 -- Returns the minor radius of the hyperbola. It is the radius
273 -- on the "YAxis" of the hyperbola.
276 OtherBranch (me) returns Hypr is static;
279 -- Returns the branch of hyperbola obtained by doing the
280 -- symmetrical transformation of <me> with respect to the
284 Parameter (me) returns Real
287 -- Returns p = (e * e - 1) * MajorRadius where e is the
288 -- eccentricity of the hyperbola.
289 --- Raises DomainError if MajorRadius = 0.0
294 Position (me) returns Ax2 is static;
295 --- Purpose : Returns the coordinate system of the hyperbola.
297 ---C++: return const&
300 XAxis (me) returns Ax1 is static;
302 --- Purpose : Computes an axis, whose
303 -- - the origin is the center of this hyperbola, and
304 -- - the unit vector is the "X Direction"
305 -- of the local coordinate system of this hyperbola.
306 -- These axes are, the major axis (the "X
307 -- Axis") and of this hyperboReturns the "XAxis" of the hyperbola.
310 YAxis (me) returns Ax1 is static;
312 --- Purpose : Computes an axis, whose
313 -- - the origin is the center of this hyperbola, and
314 -- - the unit vector is the "Y Direction"
315 -- of the local coordinate system of this hyperbola.
316 -- These axes are the minor axis (the "Y Axis") of this hyperbola
320 Mirror (me : in out; P : Pnt) is static;
322 Mirrored (me; P : Pnt) returns Hypr is static;
324 -- Performs the symmetrical transformation of an hyperbola with
325 -- respect to the point P which is the center of the symmetry.
327 Mirror (me : in out; A1 : Ax1) is static;
329 Mirrored (me; A1 : Ax1) returns Hypr is static;
333 -- Performs the symmetrical transformation of an hyperbola with
334 -- respect to an axis placement which is the axis of the symmetry.
337 Mirror (me : in out; A2 : Ax2) is static;
339 Mirrored (me; A2 : Ax2) returns Hypr is static;
341 -- Performs the symmetrical transformation of an hyperbola with
342 -- respect to a plane. The axis placement A2 locates the plane
343 -- of the symmetry (Location, XDirection, YDirection).
346 Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
348 Rotated (me; A1 : Ax1; Ang : Real) returns Hypr is static;
351 -- Rotates an hyperbola. A1 is the axis of the rotation.
352 -- Ang is the angular value of the rotation in radians.
356 Scale (me : in out; P : Pnt; S : Real) is static;
359 Scaled (me; P : Pnt; S : Real) returns Hypr is static;
362 -- Scales an hyperbola. S is the scaling value.
366 Transform (me : in out; T : Trsf) is static;
369 Transformed (me; T : Trsf) returns Hypr is static;
372 -- Transforms an hyperbola with the transformation T from
377 Translate (me : in out; V : Vec) is static;
380 Translated (me; V : Vec) returns Hypr is static;
383 -- Translates an hyperbola in the direction of the vector V.
384 -- The magnitude of the translation is the vector's magnitude.
387 Translate(me : in out; P1, P2 : Pnt) is static;
390 Translated (me; P1, P2 : Pnt) returns Hypr is static;
393 -- Translates an hyperbola from the point P1 to the point P2.