1 // Created on: 1993-03-10
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 _Geom_Parabola_HeaderFile
18 #define _Geom_Parabola_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
24 #include <Geom_Conic.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Integer.hxx>
27 class Standard_ConstructionError;
28 class Standard_RangeError;
39 DEFINE_STANDARD_HANDLE(Geom_Parabola, Geom_Conic)
41 //! Describes a parabola in 3D space.
42 //! A parabola is defined by its focal length (i.e. the
43 //! distance between its focus and its apex) and is
44 //! positioned in space with a coordinate system
45 //! (gp_Ax2 object) where:
46 //! - the origin is the apex of the parabola,
47 //! - the "X Axis" defines the axis of symmetry; the
48 //! parabola is on the positive side of this axis,
49 //! - the origin, "X Direction" and "Y Direction" define the
50 //! plane of the parabola.
51 //! This coordinate system is the local coordinate
52 //! system of the parabola.
53 //! The "main Direction" of this coordinate system is a
54 //! vector normal to the plane of the parabola. The axis,
55 //! of which the origin and unit vector are respectively the
56 //! origin and "main Direction" of the local coordinate
57 //! system, is termed the "Axis" or "main Axis" of the parabola.
58 //! The "main Direction" of the local coordinate system
59 //! gives an explicit orientation to the parabola,
60 //! determining the direction in which the parameter
61 //! increases along the parabola.
62 //! The Geom_Parabola parabola is parameterized as follows:
63 //! P(U) = O + U*U/(4.*F)*XDir + U*YDir
65 //! - P is the point of parameter U,
66 //! - O, XDir and YDir are respectively the origin, "X
67 //! Direction" and "Y Direction" of its local coordinate system,
68 //! - F is the focal length of the parabola.
69 //! The parameter of the parabola is therefore its Y
70 //! coordinate in the local coordinate system, with the "X
71 //! Axis" of the local coordinate system defining the origin
73 //! The parameter range is ] -infinite, +infinite [.
74 class Geom_Parabola : public Geom_Conic
80 //! Creates a parabola from a non transient one.
81 Standard_EXPORT Geom_Parabola(const gp_Parab& Prb);
84 //! Creates a parabola with its local coordinate system "A2"
85 //! and it's focal length "Focal".
86 //! The XDirection of A2 defines the axis of symmetry of the
87 //! parabola. The YDirection of A2 is parallel to the directrix
88 //! of the parabola. The Location point of A2 is the vertex of
90 //! Raised if Focal < 0.0
91 Standard_EXPORT Geom_Parabola(const gp_Ax2& A2, const Standard_Real Focal);
94 //! D is the directrix of the parabola and F the focus point.
95 //! The symmetry axis (XAxis) of the parabola is normal to the
96 //! directrix and pass through the focus point F, but its
97 //! location point is the vertex of the parabola.
98 //! The YAxis of the parabola is parallel to D and its location
99 //! point is the vertex of the parabola. The normal to the plane
100 //! of the parabola is the cross product between the XAxis and the
102 Standard_EXPORT Geom_Parabola(const gp_Ax1& D, const gp_Pnt& F);
104 //! Assigns the value Focal to the focal distance of this parabola.
105 //! Exceptions Standard_ConstructionError if Focal is negative.
106 Standard_EXPORT void SetFocal (const Standard_Real Focal);
108 //! Converts the gp_Parab parabola Prb into this parabola.
109 Standard_EXPORT void SetParab (const gp_Parab& Prb);
112 //! Returns the non transient parabola from gp with the same
113 //! geometric properties as <me>.
114 Standard_EXPORT gp_Parab Parab() const;
116 //! Computes the parameter on the reversed parabola,
117 //! for the point of parameter U on this parabola.
118 //! For a parabola, the returned value is: -U.
119 Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
121 //! Returns the value of the first or last parameter of this
122 //! parabola. This is, respectively:
123 //! - Standard_Real::RealFirst(), or
124 //! - Standard_Real::RealLast().
125 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
127 //! Returns the value of the first or last parameter of this
128 //! parabola. This is, respectively:
129 //! - Standard_Real::RealFirst(), or
130 //! - Standard_Real::RealLast().
131 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
134 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
137 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
139 //! Computes the directrix of this parabola.
140 //! This is a line normal to the axis of symmetry, in the
141 //! plane of this parabola, located on the negative side
142 //! of its axis of symmetry, at a distance from the apex
143 //! equal to the focal length.
144 //! The directrix is returned as an axis (gp_Ax1 object),
145 //! where the origin is located on the "X Axis" of this parabola.
146 Standard_EXPORT gp_Ax1 Directrix() const;
148 //! Returns 1. (which is the eccentricity of any parabola).
149 Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
151 //! Computes the focus of this parabola. The focus is on the
152 //! positive side of the "X Axis" of the local coordinate
153 //! system of the parabola.
154 Standard_EXPORT gp_Pnt Focus() const;
156 //! Computes the focal distance of this parabola
157 //! The focal distance is the distance between the apex
158 //! and the focus of the parabola.
159 Standard_EXPORT Standard_Real Focal() const;
161 //! Computes the parameter of this parabola which is the
162 //! distance between its focus and its directrix. This
163 //! distance is twice the focal length.
164 //! If P is the parameter of the parabola, the equation of
165 //! the parabola in its local coordinate system is: Y**2 = 2.*P*X.
166 Standard_EXPORT Standard_Real Parameter() const;
168 //! Returns in P the point of parameter U.
169 //! If U = 0 the returned point is the origin of the XAxis and
170 //! the YAxis of the parabola and it is the vertex of the parabola.
171 //! P = S + F * (U * U * XDir + * U * YDir)
172 //! where S is the vertex of the parabola, XDir the XDirection and
173 //! YDir the YDirection of the parabola's local coordinate system.
174 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
177 //! Returns the point P of parameter U and the first derivative V1.
178 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE;
181 //! Returns the point P of parameter U, the first and second
182 //! derivatives V1 and V2.
183 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
186 //! Returns the point P of parameter U, the first second and third
187 //! derivatives V1 V2 and V3.
188 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
190 //! For the point of parameter U of this parabola,
191 //! computes the vector corresponding to the Nth derivative.
192 //! Exceptions Standard_RangeError if N is less than 1.
193 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
195 //! Applies the transformation T to this parabola.
196 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
198 //! Returns the parameter on the transformed curve for
199 //! the transform of the point of parameter U on <me>.
201 //! me->Transformed(T)->Value(me->TransformedParameter(U,T))
203 //! is the same point as
205 //! me->Value(U).Transformed(T)
207 //! This methods returns <U> * T.ScaleFactor()
208 Standard_EXPORT Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf& T) const Standard_OVERRIDE;
210 //! Returns a coefficient to compute the parameter on
211 //! the transformed curve for the transform of the
214 //! Transformed(T)->Value(U * ParametricTransformation(T))
216 //! is the same point as
218 //! Value(U).Transformed(T)
220 //! This methods returns T.ScaleFactor()
221 Standard_EXPORT Standard_Real ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
223 //! Creates a new object which is a copy of this parabola.
224 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
226 //! Dumps the content of me into the stream
227 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
232 DEFINE_STANDARD_RTTIEXT(Geom_Parabola,Geom_Conic)
242 Standard_Real focalLength;
253 #endif // _Geom_Parabola_HeaderFile