Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-03-24
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 _Geom2d_Hyperbola_HeaderFile
0018 #define _Geom2d_Hyperbola_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom2d_Conic.hxx>
0024 #include <Standard_Integer.hxx>
0025 class gp_Hypr2d;
0026 class gp_Ax2d;
0027 class gp_Ax22d;
0028 class gp_Pnt2d;
0029 class gp_Vec2d;
0030 class gp_Trsf2d;
0031 class Geom2d_Geometry;
0032 
0033 
0034 class Geom2d_Hyperbola;
0035 DEFINE_STANDARD_HANDLE(Geom2d_Hyperbola, Geom2d_Conic)
0036 
0037 //! Describes a branch of a hyperbola in the plane (2D space).
0038 //! A hyperbola is defined by its major and minor radii
0039 //! and, as with any conic curve, is positioned in the
0040 //! plane with a coordinate system (gp_Ax22d 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 //! This coordinate system is the local coordinate
0045 //! system of the hyperbola.
0046 //! The branch of the hyperbola described is the one
0047 //! located on the positive side of the major axis.
0048 //! The orientation (direct or indirect) of the local
0049 //! coordinate system gives an explicit orientation to the
0050 //! hyperbola, determining the direction in which the
0051 //! parameter increases along the hyperbola.
0052 //! The Geom2d_Hyperbola hyperbola is parameterized as follows:
0053 //! P(U) = O + MajRad*Cosh(U)*XDir + MinRad*Sinh(U)*YDir
0054 //! where:
0055 //! - P is the point of parameter U,
0056 //! - O, XDir and YDir are respectively the origin, "X
0057 //! Direction" and "Y Direction" of its local coordinate system,
0058 //! - MajRad and MinRad are the major and minor radii of the hyperbola.
0059 //! The "X Axis" of the local coordinate system therefore
0060 //! defines the origin of the parameter of the hyperbola.
0061 //! The parameter range is ] -infinite,+infinite [.
0062 //! The following diagram illustrates the respective
0063 //! positions, in the plane of the hyperbola, of the three
0064 //! branches of hyperbolas constructed using the
0065 //! functions OtherBranch, ConjugateBranch1 and
0066 //! ConjugateBranch2:
0067 //! ^YAxis
0068 //! |
0069 //! FirstConjugateBranch
0070 //! |
0071 //! Other         |          Main
0072 //! --------------------- C
0073 //! --------------------->XAxis
0074 //! Branch       |
0075 //! Branch
0076 //! |
0077 //! SecondConjugateBranch
0078 //! |
0079 //! Warning
0080 //! The value of the major radius (on the major axis) can
0081 //! be less than the value of the minor radius (on the minor axis).
0082 //! See Also
0083 //! GCE2d_MakeHyperbola which provides functions for
0084 //! more complex hyperbola constructions
0085 //! gp_Ax22d
0086 //! gp_Hypr2d for an equivalent, non-parameterized data structure
0087 class Geom2d_Hyperbola : public Geom2d_Conic
0088 {
0089 
0090 public:
0091 
0092   
0093   //! Creates  an Hyperbola from a non persistent one from package gp
0094   Standard_EXPORT Geom2d_Hyperbola(const gp_Hypr2d& H);
0095   
0096 
0097   //! MajorAxis is the "XAxis" of the hyperbola.
0098   //! The YAxis is in the direct sense if "Sense" is True;
0099   //! The major radius of the hyperbola is on this "XAxis" and
0100   //! the minor radius is on the "YAxis" of the hyperbola.
0101   //! Raised if MajorRadius < 0.0 or if MinorRadius < 0.0
0102   Standard_EXPORT Geom2d_Hyperbola(const gp_Ax2d& MajorAxis, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Boolean Sense = Standard_True);
0103   
0104 
0105   //! The XDirection of "Axis" is the "XAxis" of the hyperbola and
0106   //! the YDirection of "Axis" is the "YAxis".
0107   //! The major radius of the hyperbola is on this "XAxis" and
0108   //! the minor radius is on the "YAxis" of the hyperbola.
0109   //! Raised if MajorRadius < 0.0 or if MinorRadius < 0.0
0110   Standard_EXPORT Geom2d_Hyperbola(const gp_Ax22d& Axis, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
0111   
0112   //! Converts the gp_Hypr2d hyperbola H into this hyperbola.
0113   Standard_EXPORT void SetHypr2d (const gp_Hypr2d& H);
0114   
0115   //! Assigns a value to the major or minor radius of this hyperbola.
0116   //! Exceptions
0117   //! Standard_ConstructionError if:
0118   //! - MajorRadius is less than 0.0,
0119   //! - MinorRadius is less than 0.0.
0120   Standard_EXPORT void SetMajorRadius (const Standard_Real MajorRadius);
0121   
0122   //! Assigns a value to the major or minor radius of this hyperbola.
0123   //! Exceptions
0124   //! Standard_ConstructionError if:
0125   //! - MajorRadius is less than 0.0,
0126   //! - MinorRadius is less than 0.0.
0127   Standard_EXPORT void SetMinorRadius (const Standard_Real MinorRadius);
0128   
0129   //! Converts this hyperbola into a gp_Hypr2d one.
0130   Standard_EXPORT gp_Hypr2d Hypr2d() const;
0131   
0132   //! Computes the parameter on the reversed hyperbola,
0133   //! for the point of parameter U on this hyperbola.
0134   //! For a hyperbola, the returned value is -U.
0135   Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0136   
0137   //! Returns RealFirst from Standard.
0138   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0139   
0140   //! returns RealLast from Standard.
0141   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0142   
0143   //! Returns False.
0144   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0145   
0146   //! return False for an hyperbola.
0147   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0148   
0149 
0150   //! In the local coordinate system of the hyperbola the
0151   //! equation of the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0
0152   //! and the equation of the first asymptote is Y = (B/A)*X
0153   //! where A is the major radius of the hyperbola and B is the
0154   //! minor radius of the hyperbola.
0155   //! Raised if MajorRadius = 0.0
0156   Standard_EXPORT gp_Ax2d Asymptote1() const;
0157   
0158 
0159   //! In the local coordinate system of the hyperbola the
0160   //! equation of the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0
0161   //! and the equation of the first asymptote is Y = -(B/A)*X.
0162   //! where A is the major radius of the hyperbola and B is the
0163   //! minor radius of the hyperbola.
0164   //! raised if MajorRadius = 0.0
0165   Standard_EXPORT gp_Ax2d Asymptote2() const;
0166   
0167   //! Computes the first conjugate branch relative to this hyperbola.
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_Hypr2d ConjugateBranch1() const;
0172   
0173   //! Computes the second conjugate branch relative to this hyperbola.
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_Hypr2d 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
0185   //! between directrix1 and the "XAxis" is the location point of the
0186   //! directrix1. This point is on the positive side of the "XAxis".
0187   Standard_EXPORT gp_Ax2d 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_Ax2d 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_Pnt2d 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_Pnt2d 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 
0229   //! Computes the "other" branch of this hyperbola. This
0230   //! is a symmetrical branch with respect to the center of this hyperbola.
0231   //! Note: The diagram given under the class purpose
0232   //! indicates where the "other" branch is positioned in
0233   //! relation to this branch of the hyperbola.
0234   //! ^ YAxis
0235   //! |
0236   //! FirstConjugateBranch
0237   //! |
0238   //! Other   | Main
0239   //! ---------------------------- C
0240   //! ------------------------------------------&gtXAxis
0241   //! Branch |  Branch
0242   //! |
0243   //! |
0244   //! SecondConjugateBranch
0245   //! |
0246   //! Warning
0247   //! The major radius can be less than the minor radius.
0248   Standard_EXPORT gp_Hypr2d OtherBranch() const;
0249   
0250   //! Computes the parameter of this hyperbola.
0251   //! The parameter is:
0252   //! p = (e*e - 1) * MajorRadius
0253   //! where e is the eccentricity of this hyperbola and
0254   //! MajorRadius its major radius.
0255   //! Exceptions
0256   //! Standard_DomainError if the major radius of this
0257   //! hyperbola is null.
0258   Standard_EXPORT Standard_Real Parameter() const;
0259   
0260   //! Returns in P the point of parameter U.
0261   //! P = C + MajorRadius * Cosh (U) * XDir +
0262   //! MinorRadius * Sinh (U) * YDir
0263   //! where C is the center of the hyperbola , XDir the XDirection and
0264   //! YDir the YDirection of the hyperbola's local coordinate system.
0265   Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
0266   
0267 
0268   //! Returns the point P of parameter U and the first derivative V1.
0269   Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE;
0270   
0271 
0272   //! Returns the point P of parameter U, the first and second
0273   //! derivatives V1 and V2.
0274   Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE;
0275   
0276 
0277   //! Returns the point P of parameter U, the first second and
0278   //! third derivatives V1 V2 and V3.
0279   Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE;
0280   
0281   //! For the point of parameter U of this hyperbola,
0282   //! computes the vector corresponding to the Nth derivative.
0283   //! Exceptions Standard_RangeError if N is less than 1.
0284   Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
0285   
0286   //! Applies the transformation T to this hyperbola.
0287   Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE;
0288   
0289   //! Creates a new object which is a copy of this hyperbola.
0290   Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
0291 
0292   //! Dumps the content of me into the stream
0293   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0294 
0295 
0296 
0297 
0298   DEFINE_STANDARD_RTTIEXT(Geom2d_Hyperbola,Geom2d_Conic)
0299 
0300 protected:
0301 
0302 
0303 
0304 
0305 private:
0306 
0307 
0308   Standard_Real majorRadius;
0309   Standard_Real minorRadius;
0310 
0311 
0312 };
0313 
0314 
0315 
0316 
0317 
0318 
0319 
0320 #endif // _Geom2d_Hyperbola_HeaderFile