1 // Created on: 1993-03-24
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom2d_Conic_HeaderFile
18 #define _Geom2d_Conic_HeaderFile
20 #include <gp_Ax22d.hxx>
21 #include <Geom2d_Curve.hxx>
24 DEFINE_STANDARD_HANDLE(Geom2d_Conic, Geom2d_Curve)
26 //! The abstract class Conic describes the common
27 //! behavior of conic curves in 2D space and, in
28 //! particular, their general characteristics. The Geom2d
29 //! package provides four specific classes of conics:
30 //! Geom2d_Circle, Geom2d_Ellipse,
31 //! Geom2d_Hyperbola and Geom2d_Parabola.
32 //! A conic is positioned in the plane with a coordinate
33 //! system (gp_Ax22d object), where the origin is the
34 //! center of the conic (or the apex in case of a parabola).
35 //! This coordinate system is the local coordinate
36 //! system of the conic. It gives the conic an explicit
37 //! orientation, determining the direction in which the
38 //! parameter increases along the conic. The "X Axis" of
39 //! the local coordinate system also defines the origin of
40 //! the parameter of the conic.
41 class Geom2d_Conic : public Geom2d_Curve
45 //! Modifies this conic, redefining its local coordinate system
46 //! partially, by assigning theA as its axis
47 void SetAxis (const gp_Ax22d& theA) { pos.SetAxis(theA); }
49 //! Assigns the origin and unit vector of axis theA to the
50 //! origin of the local coordinate system of this conic and X Direction.
51 //! The other unit vector of the local coordinate system
52 //! of this conic is recomputed normal to theA, without
53 //! changing the orientation of the local coordinate
54 //! system (right-handed or left-handed).
55 void SetXAxis (const gp_Ax2d& theAX) { pos.SetXAxis(theAX); }
57 //! Assigns the origin and unit vector of axis theA to the
58 //! origin of the local coordinate system of this conic and Y Direction.
59 //! The other unit vector of the local coordinate system
60 //! of this conic is recomputed normal to theA, without
61 //! changing the orientation of the local coordinate
62 //! system (right-handed or left-handed).
63 void SetYAxis (const gp_Ax2d& theAY) { pos.SetXAxis(theAY); }
65 //! Modifies this conic, redefining its local coordinate
66 //! system partially, by assigning theP as its origin.
67 void SetLocation (const gp_Pnt2d& theP) { pos.SetLocation(theP); }
69 //! Returns the "XAxis" of the conic.
70 //! This axis defines the origin of parametrization of the conic.
71 //! This axis and the "Yaxis" define the local coordinate system
73 //! -C++: return const&
74 Standard_EXPORT gp_Ax2d XAxis() const;
77 //! Returns the "YAxis" of the conic.
78 //! The "YAxis" is perpendicular to the "Xaxis".
79 Standard_EXPORT gp_Ax2d YAxis() const;
82 //! returns the eccentricity value of the conic e.
83 //! e = 0 for a circle
84 //! 0 < e < 1 for an ellipse (e = 0 if MajorRadius = MinorRadius)
85 //! e > 1 for a hyperbola
86 //! e = 1 for a parabola
87 Standard_EXPORT virtual Standard_Real Eccentricity() const = 0;
90 //! Returns the location point of the conic.
91 //! For the circle, the ellipse and the hyperbola it is the center of
92 //! the conic. For the parabola it is the vertex of the parabola.
93 const gp_Pnt2d& Location() const { return pos.Location(); }
95 //! Returns the local coordinates system of the conic.
96 const gp_Ax22d& Position() const { return pos; }
98 //! Reverses the direction of parameterization of <me>.
99 //! The local coordinate system of the conic is modified.
100 Standard_EXPORT void Reverse() Standard_OVERRIDE;
102 //! Returns the parameter on the reversed curve for
103 //! the point of parameter U on <me>.
104 Standard_EXPORT virtual Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE = 0;
106 //! Returns GeomAbs_CN which is the global continuity of any conic.
107 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
109 //! Returns True, the order of continuity of a conic is infinite.
110 Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
112 DEFINE_STANDARD_RTTIEXT(Geom2d_Conic,Geom2d_Curve)
118 #endif // _Geom2d_Conic_HeaderFile