42cf5bc1 |
1 | // Created on: 1993-03-24 |
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 _Geom2d_Parabola_HeaderFile |
18 | #define _Geom2d_Parabola_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <Geom2d_Conic.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | class Standard_ConstructionError; |
28 | class Standard_RangeError; |
29 | class gp_Parab2d; |
30 | class gp_Ax2d; |
31 | class gp_Ax22d; |
32 | class gp_Pnt2d; |
33 | class gp_Vec2d; |
34 | class gp_Trsf2d; |
35 | class Geom2d_Geometry; |
36 | |
37 | |
38 | class Geom2d_Parabola; |
39 | DEFINE_STANDARD_HANDLE(Geom2d_Parabola, Geom2d_Conic) |
40 | |
41 | //! Describes a parabola in the plane (2D 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 the plane with a coordinate system |
45 | //! (gp_Ax22d object) where: |
46 | //! - the origin is the apex of the parabola, and |
47 | //! - the "X Axis" defines the axis of symmetry; the |
48 | //! parabola is on the positive side of this axis. |
49 | //! This coordinate system is the local coordinate |
50 | //! system of the parabola. |
51 | //! The orientation (direct or indirect) of the local |
52 | //! coordinate system gives an explicit orientation to the |
53 | //! parabola, determining the direction in which the |
54 | //! parameter increases along the parabola. |
55 | //! The Geom_Parabola parabola is parameterized as follows: |
56 | //! P(U) = O + U*U/(4.*F)*XDir + U*YDir, where: |
57 | //! - P is the point of parameter U, |
58 | //! - O, XDir and YDir are respectively the origin, "X |
59 | //! Direction" and "Y Direction" of its local coordinate system, |
60 | //! - F is the focal length of the parabola. |
61 | //! The parameter of the parabola is therefore its Y |
62 | //! coordinate in the local coordinate system, with the "X |
63 | //! Axis" of the local coordinate system defining the |
64 | //! origin of the parameter. |
65 | //! The parameter range is ] -infinite,+infinite [. |
66 | class Geom2d_Parabola : public Geom2d_Conic |
67 | { |
68 | |
69 | public: |
70 | |
71 | |
72 | //! Creates a parabola from a non persistent one. |
73 | Standard_EXPORT Geom2d_Parabola(const gp_Parab2d& Prb); |
74 | |
75 | |
76 | //! Creates a parabola with its "MirrorAxis" and it's focal |
77 | //! length "Focal". |
78 | //! MirrorAxis is the axis of symmetry of the curve, it is the |
79 | //! "XAxis". The "YAxis" is parallel to the directrix of the |
80 | //! parabola and is in the direct sense if Sense is True. |
81 | //! The "Location" point of "MirrorAxis" is the vertex of the parabola |
82 | //! Raised if Focal < 0.0 |
83 | Standard_EXPORT Geom2d_Parabola(const gp_Ax2d& MirrorAxis, const Standard_Real Focal, const Standard_Boolean Sense = Standard_True); |
84 | |
85 | |
86 | //! Creates a parabola with its Axis and it's focal |
87 | //! length "Focal". |
88 | //! The XDirection of Axis is the axis of symmetry of the curve, |
89 | //! it is the "XAxis". The "YAxis" is parallel to the directrix of the |
90 | //! parabola. The "Location" point of "Axis" is the vertex |
91 | //! of the parabola. |
92 | //! Raised if Focal < 0.0 |
93 | Standard_EXPORT Geom2d_Parabola(const gp_Ax22d& Axis, const Standard_Real Focal); |
94 | |
95 | |
96 | //! D is the directrix of the parabola and F the focus point. |
97 | //! The symmetry axis "XAxis" of the parabola is normal to the |
98 | //! directrix and pass through the focus point F, but its |
99 | //! "Location" point is the vertex of the parabola. |
100 | //! The "YAxis" of the parabola is parallel to D and its "Location" |
101 | //! point is the vertex of the parabola. |
102 | Standard_EXPORT Geom2d_Parabola(const gp_Ax2d& D, const gp_Pnt2d& F); |
103 | |
104 | //! Assigns the value Focal to the focal length of this parabola. |
105 | //! Exceptions Standard_ConstructionError if Focal is negative. |
106 | Standard_EXPORT void SetFocal (const Standard_Real Focal); |
107 | |
108 | //! Converts the gp_Parab2d parabola Prb into this parabola. |
109 | Standard_EXPORT void SetParab2d (const gp_Parab2d& Prb); |
110 | |
111 | |
112 | //! Returns the non persistent parabola from gp with the same |
113 | //! geometric properties as <me>. |
114 | Standard_EXPORT gp_Parab2d Parab2d() const; |
115 | |
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; |
120 | |
121 | //! Returns RealFirst from Standard. |
122 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
123 | |
124 | //! Returns RealLast from Standard. |
125 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
126 | |
127 | //! Returns False |
128 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
129 | |
130 | //! Returns False |
131 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
132 | |
133 | //! The directrix is parallel to the "YAxis" of the parabola. |
134 | //! The "Location" point of the directrix is the intersection |
135 | //! point between the directrix and the symmetry axis ("XAxis") of the parabola. |
136 | Standard_EXPORT gp_Ax2d Directrix() const; |
137 | |
138 | //! Returns the eccentricity e = 1.0 |
139 | Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE; |
140 | |
141 | //! Computes the focus of this parabola The focus is on the |
142 | //! positive side of the "X Axis" of the local coordinate system of the parabola. |
143 | Standard_EXPORT gp_Pnt2d Focus() const; |
144 | |
145 | //! Computes the focal length of this parabola. |
146 | //! The focal length is the distance between the apex and the focus of the parabola. |
147 | Standard_EXPORT Standard_Real Focal() const; |
148 | |
149 | //! Computes the parameter of this parabola, which is |
150 | //! the distance between its focus and its directrix. This |
151 | //! distance is twice the focal length. |
152 | //! If P is the parameter of the parabola, the equation of |
153 | //! the parabola in its local coordinate system is: Y**2 = 2.*P*X. |
154 | Standard_EXPORT Standard_Real Parameter() const; |
155 | |
156 | //! Returns in P the point of parameter U. |
157 | //! If U = 0 the returned point is the origin of the XAxis and |
158 | //! the YAxis of the parabola and it is the vertex of the parabola. |
159 | //! P = S + F * (U * U * XDir + * U * YDir) |
160 | //! where S is the vertex of the parabola, XDir the XDirection and |
161 | //! YDir the YDirection of the parabola's local coordinate system. |
162 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; |
163 | |
164 | |
165 | //! Returns the point P of parameter U and the first derivative V1. |
166 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE; |
167 | |
168 | |
169 | //! Returns the point P of parameter U, the first and second |
170 | //! derivatives V1 and V2. |
171 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE; |
172 | |
173 | |
174 | //! Returns the point P of parameter U, the first second and third |
175 | //! derivatives V1 V2 and V3. |
176 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE; |
177 | |
178 | //! For the point of parameter U of this parabola, |
179 | //! computes the vector corresponding to the Nth derivative. |
180 | //! Exceptions Standard_RangeError if N is less than 1. |
181 | Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
182 | |
183 | //! Applies the transformation T to this parabola. |
184 | Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE; |
185 | |
186 | //! Computes the parameter on the transformed |
187 | //! parabola, for the point of parameter U on this parabola. |
188 | //! For a parabola, the returned value is equal to U |
189 | //! multiplied by the scale factor of transformation T. |
190 | Standard_EXPORT Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf2d& T) const Standard_OVERRIDE; |
191 | |
192 | //! Returns a coefficient to compute the parameter on |
193 | //! the transformed curve for the transform of the |
194 | //! point on <me>. |
195 | //! |
196 | //! Transformed(T)->Value(U * ParametricTransformation(T)) |
197 | //! |
198 | //! is the same point as |
199 | //! |
200 | //! Value(U).Transformed(T) |
201 | //! |
202 | //! This methods returns T.ScaleFactor() |
203 | Standard_EXPORT Standard_Real ParametricTransformation (const gp_Trsf2d& T) const Standard_OVERRIDE; |
204 | |
205 | //! Creates a new object, which is a copy of this parabola. |
206 | Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE; |
207 | |
208 | |
209 | |
210 | |
92efcf78 |
211 | DEFINE_STANDARD_RTTIEXT(Geom2d_Parabola,Geom2d_Conic) |
42cf5bc1 |
212 | |
213 | protected: |
214 | |
215 | |
216 | |
217 | |
218 | private: |
219 | |
220 | |
221 | Standard_Real focalLength; |
222 | |
223 | |
224 | }; |
225 | |
226 | |
227 | |
228 | |
229 | |
230 | |
231 | |
232 | #endif // _Geom2d_Parabola_HeaderFile |