0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / gp / gp_Parab.hxx
1 // Copyright (c) 1991-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _gp_Parab_HeaderFile
16 #define _gp_Parab_HeaderFile
17
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
21
22 #include <gp_Ax2.hxx>
23 #include <Standard_Real.hxx>
24 #include <gp_Ax1.hxx>
25 #include <gp_Pnt.hxx>
26 class Standard_ConstructionError;
27 class gp_Ax2;
28 class gp_Ax1;
29 class gp_Pnt;
30 class gp_Trsf;
31 class gp_Vec;
32
33
34
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)
39 //! where:
40 //! -   the origin of the coordinate system is on the apex of
41 //! the parabola,
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:
48 //! Y**2 = (2*P) * X.
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.
54 //! See Also
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
60 class gp_Parab 
61 {
62 public:
63
64   DEFINE_STANDARD_ALLOC
65
66   
67   //! Creates an indefinite Parabola.
68     gp_Parab();
69   
70
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
76   //! the parabola
77   //! Raises ConstructionError if Focal < 0.0
78   //! Raised if Focal < 0.0
79     gp_Parab(const gp_Ax2& A2, const Standard_Real Focal);
80   
81
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
89   //! YAxis.
90     gp_Parab(const gp_Ax1& D, const gp_Pnt& F);
91   
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);
99   
100   //! Changes the focal distance of the parabola.
101   //! Raises ConstructionError if Focal < 0.0
102     void SetFocal (const Standard_Real Focal);
103   
104
105   //! Changes the location of the parabola. It is the vertex of
106   //! the parabola.
107     void SetLocation (const gp_Pnt& P);
108   
109   //! Changes the local coordinate system of the parabola.
110   Standard_EXPORT void SetPosition (const gp_Ax2& A2);
111   
112
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;
117   
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;
128   
129
130   //! Returns the distance between the vertex and the focus
131   //! of the parabola.
132     Standard_Real Focal() const;
133   
134   //! -   Computes the focus of the parabola.
135     gp_Pnt Focus() const;
136   
137
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;
141   
142
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;
147   
148
149   //! Returns the local coordinate system of the parabola.
150     const gp_Ax2& Position() const;
151   
152
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;
156   
157
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;
161   
162   Standard_EXPORT void Mirror (const gp_Pnt& P);
163   
164
165   //! Performs the symmetrical transformation of a parabola
166   //! with respect to the point P which is the center of the
167   //! symmetry.
168   Standard_EXPORT gp_Parab Mirrored (const gp_Pnt& P) const;
169   
170   Standard_EXPORT void Mirror (const gp_Ax1& A1);
171   
172
173   //! Performs the symmetrical transformation of a parabola
174   //! with respect to an axis placement which is the axis of
175   //! the symmetry.
176   Standard_EXPORT gp_Parab Mirrored (const gp_Ax1& A1) const;
177   
178   Standard_EXPORT void Mirror (const gp_Ax2& A2);
179   
180
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_EXPORT gp_Parab Mirrored (const gp_Ax2& A2) const;
185   
186     void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
187   
188
189   //! Rotates a parabola. A1 is the axis of the rotation.
190   //! Ang is the angular value of the rotation in radians.
191     gp_Parab Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
192   
193     void Scale (const gp_Pnt& P, const Standard_Real S);
194   
195
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     gp_Parab Scaled (const gp_Pnt& P, const Standard_Real S) const;
200   
201     void Transform (const gp_Trsf& T);
202   
203
204   //! Transforms a parabola with the transformation T from class Trsf.
205     gp_Parab Transformed (const gp_Trsf& T) const;
206   
207     void Translate (const gp_Vec& V);
208   
209
210   //! Translates a parabola in the direction of the vector V.
211   //! The magnitude of the translation is the vector's magnitude.
212     gp_Parab Translated (const gp_Vec& V) const;
213   
214     void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
215   
216
217   //! Translates a parabola from the point P1 to the point P2.
218     gp_Parab Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
219
220
221
222
223 protected:
224
225
226
227
228
229 private:
230
231
232
233   gp_Ax2 pos;
234   Standard_Real focalLength;
235
236
237 };
238
239
240 #include <gp_Parab.lxx>
241
242
243
244
245
246 #endif // _gp_Parab_HeaderFile