Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:15:27

0001 // Created on: 1993-03-10
0002 // Created by: JCV
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Geom_Hyperbola_HeaderFile
0018 #define _Geom_Hyperbola_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom_Conic.hxx>
0024 #include <Standard_Integer.hxx>
0025 class gp_Hypr;
0026 class gp_Ax2;
0027 class gp_Ax1;
0028 class gp_Pnt;
0029 class gp_Vec;
0030 class gp_Trsf;
0031 class Geom_Geometry;
0032 
0033 class Geom_Hyperbola;
0034 DEFINE_STANDARD_HANDLE(Geom_Hyperbola, Geom_Conic)
0035 
0036 //! Describes a branch of a hyperbola in 3D space.
0037 //! A hyperbola is defined by its major and minor radii
0038 //! and, as with any conic curve, is positioned in space
0039 //! with a right-handed coordinate system (gp_Ax2 object) where:
0040 //! - the origin is the center of the hyperbola,
0041 //! - the "X Direction" defines the major axis, and
0042 //! - the "Y Direction" defines the minor axis.
0043 //! The origin, "X Direction" and "Y Direction" of this
0044 //! coordinate system define the plane of the hyperbola.
0045 //! The coordinate system is the local coordinate
0046 //! system of the hyperbola.
0047 //! The branch of the hyperbola described is the one
0048 //! located on the positive side of the major axis.
0049 //! The "main Direction" of the local coordinate system is
0050 //! a vector normal to the plane of the hyperbola. The
0051 //! axis, of which the origin and unit vector are
0052 //! respectively the origin and "main Direction" of the
0053 //! local coordinate system, is termed the "Axis" or "main
0054 //! Axis" of the hyperbola.
0055 //! The "main Direction" of the local coordinate system
0056 //! gives an explicit orientation to the hyperbola,
0057 //! determining the direction in which the parameter
0058 //! increases along the hyperbola.
0059 //! The Geom_Hyperbola hyperbola is parameterized as follows:
0060 //! P(U) = O + MajRad*Cosh(U)*XDir + MinRad*Sinh(U)*YDir, where:
0061 //! - P is the point of parameter U,
0062 //! - O, XDir and YDir are respectively the origin, "X
0063 //! Direction" and "Y Direction" of its local coordinate system,
0064 //! - MajRad and MinRad are the major and minor radii of the hyperbola.
0065 //! The "X Axis" of the local coordinate system therefore
0066 //! defines the origin of the parameter of the hyperbola.
0067 //! The parameter range is ] -infinite, +infinite [.
0068 //! The following diagram illustrates the respective
0069 //! positions, in the plane of the hyperbola, of the three
0070 //! branches of hyperbolas constructed using the
0071 //! functions OtherBranch, ConjugateBranch1 and
0072 //! ConjugateBranch2: Defines the main branch of an hyperbola.
0073 //! ^YAxis
0074 //! |
0075 //! FirstConjugateBranch
0076 //! |
0077 //! Other            |                Main
0078 //! --------------------- C ------------------------------>XAxis
0079 //! Branch           |                Branch
0080 //! |
0081 //! SecondConjugateBranch
0082 //! |
0083 //! Warning
0084 //! The value of the major radius (on the major axis) can
0085 //! be less than the value of the minor radius (on the minor axis).
0086 class Geom_Hyperbola : public Geom_Conic
0087 {
0088 
0089 public:
0090   //! Constructs a hyperbola by conversion of the gp_Hypr hyperbola H.
0091   Standard_EXPORT Geom_Hyperbola(const gp_Hypr& H);
0092 
0093   //! Constructs a hyperbola defined by its major and
0094   //! minor radii, MajorRadius and MinorRadius, where A2 locates the
0095   //! hyperbola and defines its orientation in 3D space such that:
0096   //! - the center of the hyperbola is the origin of A2,
0097   //! - the "X Direction" of A2 defines the major axis
0098   //! of the hyperbola, i.e. the major radius
0099   //! MajorRadius is measured along this axis,
0100   //! - the "Y Direction" of A2 defines the minor axis
0101   //! of the hyperbola, i.e. the minor radius
0102   //! MinorRadius is measured along this axis,
0103   //! - A2 is the local coordinate system of the   hyperbola.
0104   //! Exceptions
0105   //! Standard_ConstructionError if:
0106   //! - MajorRadius is less than 0.0,
0107   //! - MinorRadius is less than 0.0.
0108   Standard_EXPORT Geom_Hyperbola(const gp_Ax2&       A2,
0109                                  const Standard_Real MajorRadius,
0110                                  const Standard_Real MinorRadius);
0111 
0112   //! Converts the gp_Hypr hyperbola H into this hyperbola.
0113   Standard_EXPORT void SetHypr(const gp_Hypr& H);
0114 
0115   //! Assigns a value to the major radius of this hyperbola.
0116   //! Exceptions
0117   //! Standard_ConstructionError if:
0118   //! - MajorRadius is less than 0.0, or
0119   //! - MinorRadius is less than 0.0.Raised if MajorRadius < 0.0
0120   Standard_EXPORT void SetMajorRadius(const Standard_Real MajorRadius);
0121 
0122   //! Assigns a value to the minor radius of this hyperbola.
0123   //! Exceptions
0124   //! Standard_ConstructionError if:
0125   //! - MajorRadius is less than 0.0, or
0126   //! - MinorRadius is less than 0.0.Raised if MajorRadius < 0.0
0127   Standard_EXPORT void SetMinorRadius(const Standard_Real MinorRadius);
0128 
0129   //! returns the non transient parabola from gp with the same
0130   //! geometric properties as <me>.
0131   Standard_EXPORT gp_Hypr Hypr() const;
0132 
0133   //! Computes the parameter on the reversed hyperbola,
0134   //! for the point of parameter U on this hyperbola.
0135   //! For a hyperbola, the returned value is: -U.
0136   Standard_EXPORT Standard_Real ReversedParameter(const Standard_Real U) const Standard_OVERRIDE;
0137 
0138   //! Returns RealFirst from Standard.
0139   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0140 
0141   //! returns RealLast from Standard.
0142   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0143 
0144   //! Returns False.
0145   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0146 
0147   //! return False for an hyperbola.
0148   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0149 
0150   //! In the local coordinate system of the hyperbola the equation of
0151   //! the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
0152   //! equation of the first asymptote is Y = (B/A)*X.
0153   //! Raises ConstructionError if MajorRadius = 0.0
0154   Standard_EXPORT gp_Ax1 Asymptote1() const;
0155 
0156   //! In the local coordinate system of the hyperbola the equation of
0157   //! the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
0158   //! equation of the first asymptote is Y = -(B/A)*X.
0159   //! Raises ConstructionError if MajorRadius = 0.0
0160   Standard_EXPORT gp_Ax1 Asymptote2() const;
0161 
0162   //! This branch of hyperbola is on the positive side of the
0163   //! YAxis of <me>.
0164   Standard_EXPORT gp_Hypr ConjugateBranch1() const;
0165 
0166   //! This branch of hyperbola is on the negative side of the
0167   //! YAxis of <me>.
0168   //! Note: The diagram given under the class purpose
0169   //! indicates where these two branches of hyperbola are
0170   //! positioned in relation to this branch of hyperbola.
0171   Standard_EXPORT gp_Hypr ConjugateBranch2() const;
0172 
0173   //! This directrix is the line normal to the XAxis of the hyperbola
0174   //! in the local plane (Z = 0) at a distance d = MajorRadius / e
0175   //! from the center of the hyperbola, where e is the eccentricity of
0176   //! the hyperbola.
0177   //! This line is parallel to the YAxis. The intersection point between
0178   //! directrix1 and the XAxis is the location point of the directrix1.
0179   //! This point is on the positive side of the XAxis.
0180   Standard_EXPORT gp_Ax1 Directrix1() const;
0181 
0182   //! This line is obtained by the symmetrical transformation
0183   //! of "directrix1" with respect to the YAxis of the hyperbola.
0184   Standard_EXPORT gp_Ax1 Directrix2() const;
0185 
0186   //! Returns the eccentricity of the hyperbola (e > 1).
0187   //! If f is the distance between the location of the hyperbola
0188   //! and the Focus1 then the eccentricity e = f / MajorRadius.
0189   //! raised if MajorRadius = 0.0
0190   Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
0191 
0192   //! Computes the focal distance. It is the distance between the
0193   //! two focus of the hyperbola.
0194   Standard_EXPORT Standard_Real Focal() const;
0195 
0196   //! Returns the first focus of the hyperbola. This focus is on the
0197   //! positive side of the XAxis of the hyperbola.
0198   Standard_EXPORT gp_Pnt Focus1() const;
0199 
0200   //! Returns the second focus of the hyperbola. This focus is on the
0201   //! negative side of the XAxis of the hyperbola.
0202   Standard_EXPORT gp_Pnt Focus2() const;
0203 
0204   //! Returns the major or minor radius of this hyperbola.
0205   //! The major radius is also the distance between the
0206   //! center of the hyperbola and the apex of the main
0207   //! branch (located on the "X Axis" of the hyperbola).
0208   Standard_EXPORT Standard_Real MajorRadius() const;
0209 
0210   //! Returns the major or minor radius of this hyperbola.
0211   //! The minor radius is also the distance between the
0212   //! center of the hyperbola and the apex of a conjugate
0213   //! branch (located on the "Y Axis" of the hyperbola).
0214   Standard_EXPORT Standard_Real MinorRadius() const;
0215 
0216   //! Computes the "other" branch of this hyperbola. This
0217   //! is the symmetrical branch with respect to the center of this hyperbola.
0218   //! Note: The diagram given under the class purpose
0219   //! indicates where the "other" branch is positioned in
0220   //! relation to this branch of the hyperbola.
0221   Standard_EXPORT gp_Hypr OtherBranch() const;
0222 
0223   //! Returns p = (e * e - 1) * MajorRadius where e is the
0224   //! eccentricity of the hyperbola.
0225   //! raised if MajorRadius = 0.0
0226   Standard_EXPORT Standard_Real Parameter() const;
0227 
0228   //! Returns in P the point of parameter U.
0229   //! P = C + MajorRadius * Cosh (U) * XDir +
0230   //! MinorRadius * Sinh (U) * YDir
0231   //! where C is the center of the hyperbola , XDir the XDirection and
0232   //! YDir the YDirection of the hyperbola's local coordinate system.
0233   Standard_EXPORT void D0(const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
0234 
0235   //! Returns the point P of parameter U and the first derivative V1.
0236   Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE;
0237 
0238   //! Returns the point P of parameter U, the first and second
0239   //! derivatives V1 and V2.
0240   Standard_EXPORT void D2(const Standard_Real U,
0241                           gp_Pnt&             P,
0242                           gp_Vec&             V1,
0243                           gp_Vec&             V2) const Standard_OVERRIDE;
0244 
0245   //! Returns the point P of parameter U, the first second and
0246   //! third derivatives V1 V2 and V3.
0247   Standard_EXPORT void D3(const Standard_Real U,
0248                           gp_Pnt&             P,
0249                           gp_Vec&             V1,
0250                           gp_Vec&             V2,
0251                           gp_Vec&             V3) const Standard_OVERRIDE;
0252 
0253   //! The returned vector gives the value of the derivative for the
0254   //! order of derivation N.
0255   //! Raised if N < 1.
0256   Standard_EXPORT gp_Vec DN(const Standard_Real    U,
0257                             const Standard_Integer N) const Standard_OVERRIDE;
0258 
0259   //! Applies the transformation T to this hyperbola.
0260   Standard_EXPORT void Transform(const gp_Trsf& T) Standard_OVERRIDE;
0261 
0262   //! Creates a new object which is a copy of this hyperbola.
0263   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0264 
0265   //! Dumps the content of me into the stream
0266   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0267                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0268 
0269   DEFINE_STANDARD_RTTIEXT(Geom_Hyperbola, Geom_Conic)
0270 
0271 protected:
0272 private:
0273   Standard_Real majorRadius;
0274   Standard_Real minorRadius;
0275 };
0276 
0277 #endif // _Geom_Hyperbola_HeaderFile