0031034: Visualization - stack-use-after-scope reported by Clang address sanitizer...
[occt.git] / src / Geom / Geom_Conic.hxx
1 // Created on: 1993-03-10
2 // Created by: JCV
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Geom_Conic_HeaderFile
18 #define _Geom_Conic_HeaderFile
19
20 #include <gp_Ax2.hxx>
21 #include <Geom_Curve.hxx>
22
23 class Geom_Conic;
24 DEFINE_STANDARD_HANDLE(Geom_Conic, Geom_Curve)
25
26 //! The abstract class Conic describes the common
27 //! behavior of conic curves in 3D space and, in
28 //! particular, their general characteristics. The Geom
29 //! package provides four concrete classes of conics:
30 //! Geom_Circle, Geom_Ellipse, Geom_Hyperbola and Geom_Parabola.
31 //! A conic is positioned in space with a right-handed
32 //! coordinate system (gp_Ax2 object), where:
33 //! - the origin is the center of the conic (or the apex in
34 //! the case of a parabola),
35 //! - the origin, "X Direction" and "Y Direction" define the
36 //! plane of the conic.
37 //! This coordinate system is the local coordinate
38 //! system of the conic.
39 //! The "main Direction" of this coordinate system is the
40 //! vector normal to the plane of the conic. The axis, of
41 //! which the origin and unit vector are respectively the
42 //! origin and "main Direction" of the local coordinate
43 //! system, is termed the "Axis" or "main Axis" of the conic.
44 //! The "main Direction" of the local coordinate system
45 //! gives an explicit orientation to the conic, determining
46 //! the direction in which the parameter increases along
47 //! the conic. The "X Axis" of the local coordinate system
48 //! also defines the origin of the parameter of the conic.
49 class Geom_Conic : public Geom_Curve
50 {
51 public:
52   
53   //! Changes the orientation of the conic's plane. The normal
54   //! axis to the plane is A1. The XAxis and the YAxis are recomputed.
55   //!
56   //! raised if the A1 is parallel to the XAxis of the conic.
57   void SetAxis (const gp_Ax1& theA1) { pos.SetAxis(theA1); }
58   
59   //! changes the location point of the conic.
60   void SetLocation (const gp_Pnt& theP) { pos.SetLocation(theP); }
61   
62   //! changes the local coordinate system of the conic.
63   void SetPosition (const gp_Ax2& theA2) { pos = theA2; }
64   
65   //! Returns the "main Axis" of this conic. This axis is
66   //! normal to the plane of the conic.
67   const gp_Ax1& Axis() const { return pos.Axis(); }  
68
69   //! Returns the location point of the conic.
70   //! For the circle, the ellipse and the hyperbola it is the center of
71   //! the conic. For the parabola it is the Apex of the parabola.
72   const gp_Pnt& Location() const { return pos.Location(); }
73   
74   //! Returns the local coordinates system of the conic.
75   //! The main direction of the Axis2Placement is normal to the
76   //! plane of the conic. The X direction of the Axis2placement
77   //! is in the plane of the conic and corresponds to the origin
78   //! for the conic's parametric value u.
79   const gp_Ax2& Position() const { return pos; }
80   
81   //! Returns the eccentricity value of the conic e.
82   //! e = 0 for a circle
83   //! 0 < e < 1 for an ellipse  (e = 0 if MajorRadius = MinorRadius)
84   //! e > 1 for a hyperbola
85   //! e = 1 for a parabola
86   //! Exceptions
87   //! Standard_DomainError in the case of a hyperbola if
88   //! its major radius is null.
89   virtual Standard_Real Eccentricity() const = 0;
90
91   //! Returns the XAxis of the conic.
92   //! This axis defines the origin of parametrization of the conic.
93   //! This axis is perpendicular to the Axis of the conic.
94   //! This axis and the Yaxis define the plane of the conic.
95   Standard_EXPORT gp_Ax1 XAxis() const;
96   
97
98   //! Returns the YAxis of the conic.
99   //! The YAxis is perpendicular to the Xaxis.
100   //! This axis and the Xaxis define the plane of the conic.
101   Standard_EXPORT gp_Ax1 YAxis() const;
102   
103
104   //! Reverses the direction of parameterization of <me>.
105   //! The local coordinate system of the conic is modified.
106   Standard_EXPORT void Reverse() Standard_OVERRIDE;
107   
108   //! Returns the  parameter on the  reversed  curve for
109   //! the point of parameter U on <me>.
110   Standard_EXPORT virtual Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE = 0;
111   
112   //! The continuity of the conic is Cn.
113   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
114   
115   //! Returns True.
116   //! Raised if N < 0.
117   Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
118
119   DEFINE_STANDARD_RTTIEXT(Geom_Conic,Geom_Curve)
120
121 protected:
122   gp_Ax2 pos;
123 };
124
125 #endif // _Geom_Conic_HeaderFile