Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:36

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