Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-24 09:13:44

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_Conic_HeaderFile
0018 #define _Geom2d_Conic_HeaderFile
0019 
0020 #include <gp_Ax22d.hxx>
0021 #include <Geom2d_Curve.hxx>
0022 
0023 //! The abstract class Conic describes the common
0024 //! behavior of conic curves in 2D space and, in
0025 //! particular, their general characteristics. The Geom2d
0026 //! package provides four specific classes of conics:
0027 //! Geom2d_Circle, Geom2d_Ellipse,
0028 //! Geom2d_Hyperbola and Geom2d_Parabola.
0029 //! A conic is positioned in the plane with a coordinate
0030 //! system (gp_Ax22d object), where the origin is the
0031 //! center of the conic (or the apex in case of a parabola).
0032 //! This coordinate system is the local coordinate
0033 //! system of the conic. It gives the conic an explicit
0034 //! orientation, determining the direction in which the
0035 //! parameter increases along the conic. The "X Axis" of
0036 //! the local coordinate system also defines the origin of
0037 //! the parameter of the conic.
0038 class Geom2d_Conic : public Geom2d_Curve
0039 {
0040 public:
0041   //! Modifies this conic, redefining its local coordinate system
0042   //! partially, by assigning theA as its axis
0043   void SetAxis(const gp_Ax22d& theA) { pos.SetAxis(theA); }
0044 
0045   //! Assigns the origin and unit vector of axis theA to the
0046   //! origin of the local coordinate system of this conic and X Direction.
0047   //! The other unit vector of the local coordinate system
0048   //! of this conic is recomputed normal to theA, without
0049   //! changing the orientation of the local coordinate
0050   //! system (right-handed or left-handed).
0051   void SetXAxis(const gp_Ax2d& theAX) { pos.SetXAxis(theAX); }
0052 
0053   //! Assigns the origin and unit vector of axis theA to the
0054   //! origin of the local coordinate system of this conic and Y Direction.
0055   //! The other unit vector of the local coordinate system
0056   //! of this conic is recomputed normal to theA, without
0057   //! changing the orientation of the local coordinate
0058   //! system (right-handed or left-handed).
0059   void SetYAxis(const gp_Ax2d& theAY) { pos.SetYAxis(theAY); }
0060 
0061   //! Modifies this conic, redefining its local coordinate
0062   //! system partially, by assigning theP as its origin.
0063   void SetLocation(const gp_Pnt2d& theP) { pos.SetLocation(theP); }
0064 
0065   //! Returns the "XAxis" of the conic.
0066   //! This axis defines the origin of parametrization of the conic.
0067   //! This axis and the "Yaxis" define the local coordinate system
0068   //! of the conic.
0069   //! -C++: return const&
0070   Standard_EXPORT gp_Ax2d XAxis() const;
0071 
0072   //! Returns the "YAxis" of the conic.
0073   //! The "YAxis" is perpendicular to the "Xaxis".
0074   Standard_EXPORT gp_Ax2d YAxis() const;
0075 
0076   //! returns the eccentricity value of the conic e.
0077   //! e = 0 for a circle
0078   //! 0 < e < 1 for an ellipse (e = 0 if MajorRadius = MinorRadius)
0079   //! e > 1 for a hyperbola
0080   //! e = 1 for a parabola
0081   Standard_EXPORT virtual double Eccentricity() const = 0;
0082 
0083   //! Returns the location point of the conic.
0084   //! For the circle, the ellipse and the hyperbola it is the center of
0085   //! the conic. For the parabola it is the vertex of the parabola.
0086   const gp_Pnt2d& Location() const { return pos.Location(); }
0087 
0088   //! Returns the local coordinates system of the conic.
0089   const gp_Ax22d& Position() const { return pos; }
0090 
0091   //! Reverses the direction of parameterization of <me>.
0092   //! The local coordinate system of the conic is modified.
0093   Standard_EXPORT void Reverse() override;
0094 
0095   //! Returns the parameter on the reversed curve for
0096   //! the point of parameter U on <me>.
0097   Standard_EXPORT double ReversedParameter(const double U) const override = 0;
0098 
0099   //! Returns GeomAbs_CN which is the global continuity of any conic.
0100   Standard_EXPORT GeomAbs_Shape Continuity() const override;
0101 
0102   //! Returns True, the order of continuity of a conic is infinite.
0103   Standard_EXPORT bool IsCN(const int N) const override;
0104 
0105   //! Dumps the content of me into the stream
0106   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0107 
0108   DEFINE_STANDARD_RTTIEXT(Geom2d_Conic, Geom2d_Curve)
0109 
0110 protected:
0111   gp_Ax22d pos;
0112 };
0113 
0114 #endif // _Geom2d_Conic_HeaderFile