0026747: Some constructors of gp_Parab2d class contain redundant parameters
[occt.git] / src / gp / gp_Parab2d.hxx
CommitLineData
42cf5bc1 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_Parab2d_HeaderFile
16#define _gp_Parab2d_HeaderFile
17
18#include <Standard.hxx>
19#include <Standard_DefineAlloc.hxx>
20#include <Standard_Handle.hxx>
21
22#include <gp_Ax22d.hxx>
23#include <Standard_Real.hxx>
24#include <Standard_Boolean.hxx>
25#include <gp_Ax2d.hxx>
26#include <gp_Pnt2d.hxx>
27class Standard_ConstructionError;
28class gp_Ax2d;
29class gp_Ax22d;
30class gp_Pnt2d;
31class gp_Trsf2d;
32class gp_Vec2d;
33
34
35//! Describes a parabola in the plane (2D space).
36//! A parabola is defined by its focal length (that is, the
37//! distance between its focus and apex) and positioned in
38//! the plane with a coordinate system (a gp_Ax22d object) where:
39//! - the origin of the coordinate system is on the apex of
40//! the parabola, and
41//! - the "X Axis" of the coordinate system is the axis of
42//! symmetry; the parabola is on the positive side of this axis.
43//! This coordinate system is the "local coordinate system"
44//! of the parabola. Its orientation (direct or indirect sense)
45//! gives an implicit orientation to the parabola.
46//! In this coordinate system, the equation for the parabola is:
47//! Y**2 = (2*P) * X.
48//! where P, referred to as the parameter of the parabola, is
49//! the distance between the focus and the directrix (P is
50//! twice the focal length).
51//! See Also
52//! GCE2d_MakeParab2d which provides functions for
53//! more complex parabola constructions
54//! Geom2d_Parabola which provides additional functions
55//! for constructing parabolas and works, in particular, with
56//! the parametric equations of parabolas
57class gp_Parab2d
58{
59public:
60
61 DEFINE_STANDARD_ALLOC
62
63
64 //! Creates an indefinite parabola.
c1609fbe 65 gp_Parab2d();
42cf5bc1 66
67
68 //! Creates a parabola with its vertex point, its axis of symmetry
69 //! ("XAxis") and its focal length.
c1609fbe 70 //! The sense of parametrization is given by theSense. If theSense == TRUE
71 //! (by default) then right-handed coordinate system is used,
72 //! otherwise - left-handed.
73 //! Warnings : It is possible to have FocalLength = 0. In this case,
74 //! the parabola looks like a line, which is parallel to the symmetry-axis.
75 //! Raises ConstructionError if FocalLength < 0.0
76 gp_Parab2d(const gp_Ax2d& theMirrorAxis,
77 const Standard_Real theFocalLength,
78 const Standard_Boolean theSense = Standard_True);
42cf5bc1 79
80
81 //! Creates a parabola with its vertex point, its axis of symmetry
c1609fbe 82 //! ("XAxis"), correspond Y-axis and its focal length.
83 //! Warnings : It is possible to have FocalLength = 0. In this case,
84 //! the parabola looks like a line, which is parallel to the symmetry-axis.
42cf5bc1 85 //! Raises ConstructionError if Focal < 0.0
c1609fbe 86 gp_Parab2d(const gp_Ax22d& theAxes, const Standard_Real theFocalLength);
42cf5bc1 87
88
89 //! Creates a parabola with the directrix and the focus point.
c1609fbe 90 //! Y-axis of the parabola (in User Coordinate System - UCS) is
91 //! the direction of theDirectrix. X-axis always directs from theDirectrix
92 //! to theFocus point and always comes through theFocus.
93 //! Apex of the parabola is a middle point between the theFocus and the
94 //! intersection point of theDirectrix and the X-axis.
95 //! Warnings : It is possible to have FocalLength = 0 (when theFocus lies
96 //! in theDirectrix). In this case, X-direction of the parabola is defined
97 //! by theSense parameter. If theSense == TRUE (by default) then right-handed
98 //! coordinate system is used, otherwise - left-handed. Result parabola will look
99 //! like a line, which is perpendicular to the directrix.
100 Standard_EXPORT gp_Parab2d(const gp_Ax2d& theDirectrix,
101 const gp_Pnt2d& theFocus,
102 const Standard_Boolean theSense = Standard_True);
42cf5bc1 103
42cf5bc1 104 //! Changes the focal distance of the parabola
105 //! Warnings : It is possible to have Focal = 0.
106 //! Raises ConstructionError if Focal < 0.0
107 void SetFocal (const Standard_Real Focal);
108
109
110 //! Changes the "Location" point of the parabola. It is the
111 //! vertex of the parabola.
112 void SetLocation (const gp_Pnt2d& P);
113
114 //! Modifies this parabola, by redefining its local coordinate system so that
115 //! its origin and "X Direction" become those of the axis
116 //! MA. The "Y Direction" of the local coordinate system is
117 //! then recomputed. The orientation of the local
118 //! coordinate system is not modified.
119 void SetMirrorAxis (const gp_Ax2d& A);
120
121
122 //! Changes the local coordinate system of the parabola.
123 //! The "Location" point of A becomes the vertex of the parabola.
124 void SetAxis (const gp_Ax22d& A);
125
126
c1609fbe 127 //! Computes the coefficients of the implicit equation of the parabola
128 //! (in WCS - World Coordinate System).
42cf5bc1 129 //! A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
c1609fbe 130 Standard_EXPORT void Coefficients (Standard_Real& A, Standard_Real& B,
131 Standard_Real& C, Standard_Real& D,
132 Standard_Real& E, Standard_Real& F) const;
42cf5bc1 133
134
135 //! Computes the directrix of the parabola.
136 //! The directrix is:
137 //! - a line parallel to the "Y Direction" of the local
138 //! coordinate system of this parabola, and
139 //! - located on the negative side of the axis of symmetry,
140 //! at a distance from the apex which is equal to the focal length of this parabola.
141 //! The directrix is returned as an axis (a gp_Ax2d object),
142 //! the origin of which is situated on the "X Axis" of this parabola.
143 gp_Ax2d Directrix() const;
144
145
146 //! Returns the distance between the vertex and the focus
147 //! of the parabola.
148 Standard_Real Focal() const;
149
150 //! Returns the focus of the parabola.
151 gp_Pnt2d Focus() const;
152
153 //! Returns the vertex of the parabola.
154 gp_Pnt2d Location() const;
155
156
157 //! Returns the symmetry axis of the parabola.
158 //! The "Location" point of this axis is the vertex of the parabola.
159 gp_Ax2d MirrorAxis() const;
160
161
162 //! Returns the local coordinate system of the parabola.
163 //! The "Location" point of this axis is the vertex of the parabola.
164 gp_Ax22d Axis() const;
165
166
167 //! Returns the distance between the focus and the
168 //! directrix of the parabola.
169 Standard_Real Parameter() const;
170
171 void Reverse();
172
173
174 //! Reverses the orientation of the local coordinate system
175 //! of this parabola (the "Y Direction" is reversed).
176 //! Therefore, the implicit orientation of this parabola is reversed.
177 //! Note:
178 //! - Reverse assigns the result to this parabola, while
179 //! - Reversed creates a new one.
180 gp_Parab2d Reversed() const;
181
182 //! Returns true if the local coordinate system is direct
183 //! and false in the other case.
184 Standard_Boolean IsDirect() const;
185
186 Standard_EXPORT void Mirror (const gp_Pnt2d& P);
187
188
189 //! Performs the symmetrical transformation of a parabola with respect
190 //! to the point P which is the center of the symmetry
191 Standard_EXPORT gp_Parab2d Mirrored (const gp_Pnt2d& P) const;
192
193 Standard_EXPORT void Mirror (const gp_Ax2d& A);
194
195
196 //! Performs the symmetrical transformation of a parabola with respect
197 //! to an axis placement which is the axis of the symmetry.
198 Standard_EXPORT gp_Parab2d Mirrored (const gp_Ax2d& A) const;
199
200 void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
201
202
203 //! Rotates a parabola. P is the center of the rotation.
204 //! Ang is the angular value of the rotation in radians.
205 gp_Parab2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
206
207 void Scale (const gp_Pnt2d& P, const Standard_Real S);
208
209
210 //! Scales a parabola. S is the scaling value.
211 //! If S is negative the direction of the symmetry axis
212 //! "XAxis" is reversed and the direction of the "YAxis" too.
213 gp_Parab2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
214
215 void Transform (const gp_Trsf2d& T);
216
217
218 //! Transforms an parabola with the transformation T from class Trsf2d.
219 gp_Parab2d Transformed (const gp_Trsf2d& T) const;
220
221 void Translate (const gp_Vec2d& V);
222
223
224 //! Translates a parabola in the direction of the vector V.
225 //! The magnitude of the translation is the vector's magnitude.
226 gp_Parab2d Translated (const gp_Vec2d& V) const;
227
228 void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
229
230
231 //! Translates a parabola from the point P1 to the point P2.
232 gp_Parab2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
233
234
235
236
237protected:
238
239
240
241
242
243private:
244
245
246
247 gp_Ax22d pos;
248 Standard_Real focalLength;
249
250
251};
252
253
254#include <gp_Parab2d.lxx>
255
256
257
258
259
260#endif // _gp_Parab2d_HeaderFile