Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:03:06

0001 // Created on: 1992-08-26
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-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 _gce_MakeHypr2d_HeaderFile
0018 #define _gce_MakeHypr2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Hypr2d.hxx>
0025 #include <gce_Root.hxx>
0026 class gp_Pnt2d;
0027 class gp_Ax2d;
0028 class gp_Ax22d;
0029 
0030 //! This class implements construction algorithms for `gp_Hypr2d`.
0031 //! Supported constructions include:
0032 //! - hyperbola from center and two points (one on major axis);
0033 //! - hyperbola from major axis and radii;
0034 //! - hyperbola from local coordinate system and radii.
0035 //!
0036 //! ^YAxis
0037 //! |
0038 //! FirstConjugateBranch
0039 //! |
0040 //! Other            |                Main
0041 //! --------------------- C ------------------------------>XAxis
0042 //! Branch           |                Branch
0043 //! |
0044 //! |
0045 //! SecondConjugateBranch
0046 //! |
0047 //!
0048 //! An axis placement (one axis) is associated with the hyperbola.
0049 //! This axis is the "XAxis" or major axis of the hyperbola.
0050 //! It is the symmetry axis of the main branch.
0051 //! The "YAxis" is normal to this axis and passes through its location point.
0052 //! It is the minor axis.
0053 //!
0054 //! The major radius is the distance between the Location point
0055 //! of the hyperbola C and the vertex of the Main Branch (or the
0056 //! Other branch). The minor radius is the distance between the
0057 //! Location point of the hyperbola C and the vertex of the First
0058 //! (or Second) Conjugate branch.
0059 //! The major radius can be lower than the minor radius.
0060 class gce_MakeHypr2d : public gce_Root
0061 {
0062 public:
0063   DEFINE_STANDARD_ALLOC
0064 
0065   //! Creates a hyperbola from center and two points.
0066   //! @note `Center` is the hyperbola center, `Center`-`S1` defines major axis,
0067   //!       major radius is `Distance(Center, S1)`, and minor radius is distance
0068   //!       from `S2` to this major axis.
0069   //! @note Construction fails with `gce_ConfusedPoints` if any two of `S1`, `S2`,
0070   //!       and `Center` are coincident.
0071   //! @note Construction fails with `gce_ColinearPoints` if `S1`, `S2`, and `Center`
0072   //!       are collinear.
0073   //! @param[in] S1 first point
0074   //! @param[in] S2 second point
0075   //! @param[in] Center center point
0076   Standard_EXPORT gce_MakeHypr2d(const gp_Pnt2d& S1, const gp_Pnt2d& S2, const gp_Pnt2d& Center);
0077 
0078   //! Creates a hyperbola from major axis and radii.
0079   //! @note Center is located at `MajorAxis.Location()`.
0080   //! @note If `Sense` is `false`, the opposite direction of `MajorAxis` is used.
0081   //! @note Construction fails with `gce_NegativeRadius` if
0082   //!       `MajorRadius < 0.0` or `MinorRadius < 0.0`.
0083   //! @param[in] MajorAxis major axis placement
0084   //! @param[in] MajorRadius major radius value
0085   //! @param[in] MinorRadius minor radius value
0086   //! @param[in] Sense orientation flag
0087   Standard_EXPORT gce_MakeHypr2d(const gp_Ax2d& MajorAxis,
0088                                  const double   MajorRadius,
0089                                  const double   MinorRadius,
0090                                  const bool     Sense);
0091 
0092   //! Creates a hyperbola from local coordinate system and radii.
0093   //! @note The result is centered at `A.Location()`, and its major axis follows
0094   //!       the X axis direction of `A`.
0095   //! @note Construction fails with `gce_NegativeRadius` if
0096   //!       `MajorRadius < 0.0` or `MinorRadius < 0.0`.
0097   //! @param[in] A local coordinate system
0098   //! @param[in] MajorRadius major radius value
0099   //! @param[in] MinorRadius minor radius value
0100   Standard_EXPORT gce_MakeHypr2d(const gp_Ax22d& A,
0101                                  const double    MajorRadius,
0102                                  const double    MinorRadius);
0103 
0104   //! Returns the constructed hyperbola.
0105   //! Exceptions StdFail_NotDone if no hyperbola is constructed.
0106   //! @return resulting hyperbola
0107   Standard_EXPORT const gp_Hypr2d& Value() const;
0108 
0109   //! Alias for Value() returning a copy.
0110   //! @return resulting object
0111   gp_Hypr2d Operator() const { return Value(); }
0112 
0113   //! Conversion operator returning the constructed object.
0114   //! @return resulting object
0115   operator gp_Hypr2d() const { return Operator(); }
0116 
0117 private:
0118   gp_Hypr2d TheHypr2d;
0119 };
0120 
0121 #endif // _gce_MakeHypr2d_HeaderFile