1 // Copyright (c) 1991-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _gp_Parab_HeaderFile
16 #define _gp_Parab_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
23 #include <Standard_Real.hxx>
26 class Standard_ConstructionError;
35 //! Describes a parabola in 3D space.
36 //! A parabola is defined by its focal length (that is, the
37 //! distance between its focus and apex) and positioned in
38 //! space with a coordinate system (a gp_Ax2 object)
40 //! - the origin of the coordinate system is on the apex of
42 //! - the "X Axis" of the coordinate system is the axis of
43 //! symmetry; the parabola is on the positive side of this axis, and
44 //! - the origin, "X Direction" and "Y Direction" of the
45 //! coordinate system define the plane of the parabola.
46 //! The equation of the parabola in this coordinate system,
47 //! which is the "local coordinate system" of the parabola, is:
49 //! where P, referred to as the parameter of the parabola, is
50 //! the distance between the focus and the directrix (P is
51 //! twice the focal length).
52 //! The "main Direction" of the local coordinate system gives
53 //! the normal vector to the plane of the parabola.
55 //! gce_MakeParab which provides functions for more
56 //! complex parabola constructions
57 //! Geom_Parabola which provides additional functions for
58 //! constructing parabolas and works, in particular, with the
59 //! parametric equations of parabolas
67 //! Creates an indefinite Parabola.
71 //! Creates a parabola with its local coordinate system "A2"
72 //! and it's focal length "Focal".
73 //! The XDirection of A2 defines the axis of symmetry of the
74 //! parabola. The YDirection of A2 is parallel to the directrix
75 //! of the parabola. The Location point of A2 is the vertex of
77 //! Raises ConstructionError if Focal < 0.0
78 //! Raised if Focal < 0.0
79 gp_Parab(const gp_Ax2& A2, const Standard_Real Focal);
82 //! D is the directrix of the parabola and F the focus point.
83 //! The symmetry axis (XAxis) of the parabola is normal to the
84 //! directrix and pass through the focus point F, but its
85 //! location point is the vertex of the parabola.
86 //! The YAxis of the parabola is parallel to D and its location
87 //! point is the vertex of the parabola. The normal to the plane
88 //! of the parabola is the cross product between the XAxis and the
90 gp_Parab(const gp_Ax1& D, const gp_Pnt& F);
92 //! Modifies this parabola by redefining its local coordinate system so that
93 //! - its origin and "main Direction" become those of the
94 //! axis A1 (the "X Direction" and "Y Direction" are then
95 //! recomputed in the same way as for any gp_Ax2)
96 //! Raises ConstructionError if the direction of A1 is parallel to the previous
97 //! XAxis of the parabola.
98 void SetAxis (const gp_Ax1& A1);
100 //! Changes the focal distance of the parabola.
101 //! Raises ConstructionError if Focal < 0.0
102 void SetFocal (const Standard_Real Focal);
105 //! Changes the location of the parabola. It is the vertex of
107 void SetLocation (const gp_Pnt& P);
109 //! Changes the local coordinate system of the parabola.
110 void SetPosition (const gp_Ax2& A2);
113 //! Returns the main axis of the parabola.
114 //! It is the axis normal to the plane of the parabola passing
115 //! through the vertex of the parabola.
116 const gp_Ax1& Axis() const;
118 //! Computes the directrix of this parabola.
119 //! The directrix is:
120 //! - a line parallel to the "Y Direction" of the local
121 //! coordinate system of this parabola, and
122 //! - located on the negative side of the axis of symmetry,
123 //! at a distance from the apex which is equal to the focal
124 //! length of this parabola.
125 //! The directrix is returned as an axis (a gp_Ax1 object),
126 //! the origin of which is situated on the "X Axis" of this parabola.
127 gp_Ax1 Directrix() const;
130 //! Returns the distance between the vertex and the focus
132 Standard_Real Focal() const;
134 //! - Computes the focus of the parabola.
135 gp_Pnt Focus() const;
138 //! Returns the vertex of the parabola. It is the "Location"
139 //! point of the coordinate system of the parabola.
140 const gp_Pnt& Location() const;
143 //! Computes the parameter of the parabola.
144 //! It is the distance between the focus and the directrix of
145 //! the parabola. This distance is twice the focal length.
146 Standard_Real Parameter() const;
149 //! Returns the local coordinate system of the parabola.
150 const gp_Ax2& Position() const;
153 //! Returns the symmetry axis of the parabola. The location point
154 //! of the axis is the vertex of the parabola.
155 gp_Ax1 XAxis() const;
158 //! It is an axis parallel to the directrix of the parabola.
159 //! The location point of this axis is the vertex of the parabola.
160 gp_Ax1 YAxis() const;
162 Standard_EXPORT void Mirror (const gp_Pnt& P);
165 //! Performs the symmetrical transformation of a parabola
166 //! with respect to the point P which is the center of the
168 Standard_NODISCARD Standard_EXPORT gp_Parab Mirrored (const gp_Pnt& P) const;
170 Standard_EXPORT void Mirror (const gp_Ax1& A1);
173 //! Performs the symmetrical transformation of a parabola
174 //! with respect to an axis placement which is the axis of
176 Standard_NODISCARD Standard_EXPORT gp_Parab Mirrored (const gp_Ax1& A1) const;
178 Standard_EXPORT void Mirror (const gp_Ax2& A2);
181 //! Performs the symmetrical transformation of a parabola
182 //! with respect to a plane. The axis placement A2 locates
183 //! the plane of the symmetry (Location, XDirection, YDirection).
184 Standard_NODISCARD Standard_EXPORT gp_Parab Mirrored (const gp_Ax2& A2) const;
186 void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
189 //! Rotates a parabola. A1 is the axis of the rotation.
190 //! Ang is the angular value of the rotation in radians.
191 Standard_NODISCARD gp_Parab Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
193 void Scale (const gp_Pnt& P, const Standard_Real S);
196 //! Scales a parabola. S is the scaling value.
197 //! If S is negative the direction of the symmetry axis
198 //! XAxis is reversed and the direction of the YAxis too.
199 Standard_NODISCARD gp_Parab Scaled (const gp_Pnt& P, const Standard_Real S) const;
201 void Transform (const gp_Trsf& T);
204 //! Transforms a parabola with the transformation T from class Trsf.
205 Standard_NODISCARD gp_Parab Transformed (const gp_Trsf& T) const;
207 void Translate (const gp_Vec& V);
210 //! Translates a parabola in the direction of the vector V.
211 //! The magnitude of the translation is the vector's magnitude.
212 Standard_NODISCARD gp_Parab Translated (const gp_Vec& V) const;
214 void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
217 //! Translates a parabola from the point P1 to the point P2.
218 Standard_NODISCARD gp_Parab Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
234 Standard_Real focalLength;
240 #include <gp_Parab.lxx>
246 #endif // _gp_Parab_HeaderFile