42cf5bc1 |
1 | // Created on: 1991-09-10 |
2 | // Created by: Michel Chauvat |
3 | // Copyright (c) 1991-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 _ElCLib_HeaderFile |
18 | #define _ElCLib_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
25 | #include <gp_Pnt.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <gp_Vec.hxx> |
28 | #include <gp_Pnt2d.hxx> |
29 | #include <gp_Vec2d.hxx> |
30 | class gp_Pnt; |
31 | class gp_Lin; |
32 | class gp_Circ; |
33 | class gp_Elips; |
34 | class gp_Hypr; |
35 | class gp_Parab; |
36 | class gp_Vec; |
37 | class gp_Lin2d; |
38 | class gp_Circ2d; |
39 | class gp_Elips2d; |
40 | class gp_Hypr2d; |
41 | class gp_Parab2d; |
42 | class gp_Pnt2d; |
43 | class gp_Vec2d; |
44 | class gp_Ax1; |
45 | class gp_Ax2; |
46 | class gp_Ax2d; |
47 | class gp_Ax22d; |
48 | class gp_Dir; |
49 | class gp_Dir2d; |
50 | |
51 | |
52 | //! Provides functions for basic geometric computations on |
53 | //! elementary curves such as conics and lines in 2D and 3D space. |
54 | //! This includes: |
55 | //! - calculation of a point or derived vector on a 2D or |
56 | //! 3D curve where: |
57 | //! - the curve is provided by the gp package, or |
58 | //! defined in reference form (as in the gp package), |
59 | //! and |
60 | //! - the point is defined by a parameter, |
61 | //! - evaluation of the parameter corresponding to a point |
62 | //! on a 2D or 3D curve from gp, |
63 | //! - various elementary computations which allow you to |
64 | //! position parameterized values within the period of a curve. |
65 | //! Notes: |
66 | //! - ElCLib stands for Elementary Curves Library. |
67 | //! - If the curves provided by the gp package are not |
68 | //! explicitly parameterized, they still have an implicit |
69 | //! parameterization, analogous to that which they infer |
70 | //! for the equivalent Geom or Geom2d curves. |
71 | class ElCLib |
72 | { |
73 | public: |
74 | |
75 | DEFINE_STANDARD_ALLOC |
76 | |
77 | |
78 | //! Return a value in the range <UFirst, ULast> by |
79 | //! adding or removing the period <ULast - UFirst> to |
80 | //! <U>. |
81 | Standard_EXPORT static Standard_Real InPeriod (const Standard_Real U, const Standard_Real UFirst, const Standard_Real ULast); |
82 | |
83 | //! Adjust U1 and U2 in the parametric range UFirst |
84 | //! Ulast of a periodic curve, where ULast - |
85 | //! UFirst is its period. To do this, this function: |
86 | //! - sets U1 in the range [ UFirst, ULast ] by |
87 | //! adding/removing the period to/from the value U1, then |
88 | //! - sets U2 in the range [ U1, U1 + period ] by |
89 | //! adding/removing the period to/from the value U2. |
90 | //! Precision is used to test the equalities. |
91 | Standard_EXPORT static void AdjustPeriodic (const Standard_Real UFirst, const Standard_Real ULast, const Standard_Real Precision, Standard_Real& U1, Standard_Real& U2); |
92 | |
93 | //! For elementary curves (lines, circles and conics) from |
94 | //! the gp package, computes the point of parameter U. |
95 | //! The result is either: |
96 | //! - a gp_Pnt point for a curve in 3D space, or |
97 | //! - a gp_Pnt2d point for a curve in 2D space. |
98 | Standard_EXPORT static gp_Pnt Value (const Standard_Real U, const gp_Lin& L); |
99 | |
100 | static gp_Pnt Value (const Standard_Real U, const gp_Circ& C); |
101 | |
102 | static gp_Pnt Value (const Standard_Real U, const gp_Elips& E); |
103 | |
104 | static gp_Pnt Value (const Standard_Real U, const gp_Hypr& H); |
105 | |
106 | static gp_Pnt Value (const Standard_Real U, const gp_Parab& Prb); |
107 | |
108 | |
109 | //! For elementary curves (lines, circles and conics) from the |
110 | //! gp package, computes: |
111 | //! - the point P of parameter U, and |
112 | //! - the first derivative vector V1 at this point. |
113 | //! The results P and V1 are either: |
114 | //! - a gp_Pnt point and a gp_Vec vector, for a curve in 3D space, or |
115 | //! - a gp_Pnt2d point and a gp_Vec2d vector, for a curve in 2D space. |
116 | Standard_EXPORT static void D1 (const Standard_Real U, const gp_Lin& L, gp_Pnt& P, gp_Vec& V1); |
117 | |
118 | static void D1 (const Standard_Real U, const gp_Circ& C, gp_Pnt& P, gp_Vec& V1); |
119 | |
120 | static void D1 (const Standard_Real U, const gp_Elips& E, gp_Pnt& P, gp_Vec& V1); |
121 | |
122 | static void D1 (const Standard_Real U, const gp_Hypr& H, gp_Pnt& P, gp_Vec& V1); |
123 | |
124 | static void D1 (const Standard_Real U, const gp_Parab& Prb, gp_Pnt& P, gp_Vec& V1); |
125 | |
126 | //! For elementary curves (circles and conics) from the gp |
127 | //! package, computes: |
128 | //! - the point P of parameter U, and |
129 | //! - the first and second derivative vectors V1 and V2 at this point. |
130 | //! The results, P, V1 and V2, are either: |
131 | //! - a gp_Pnt point and two gp_Vec vectors, for a curve in 3D space, or |
132 | //! - a gp_Pnt2d point and two gp_Vec2d vectors, for a curve in 2D space. |
133 | Standard_EXPORT static void D2 (const Standard_Real U, const gp_Circ& C, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
134 | |
135 | static void D2 (const Standard_Real U, const gp_Elips& E, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
136 | |
137 | static void D2 (const Standard_Real U, const gp_Hypr& H, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
138 | |
139 | static void D2 (const Standard_Real U, const gp_Parab& Prb, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
140 | |
141 | //! For elementary curves (circles, ellipses and hyperbolae) |
142 | //! from the gp package, computes: |
143 | //! - the point P of parameter U, and |
144 | //! - the first, second and third derivative vectors V1, V2 |
145 | //! and V3 at this point. |
146 | //! The results, P, V1, V2 and V3, are either: |
147 | //! - a gp_Pnt point and three gp_Vec vectors, for a curve in 3D space, or |
148 | //! - a gp_Pnt2d point and three gp_Vec2d vectors, for a curve in 2D space. |
149 | Standard_EXPORT static void D3 (const Standard_Real U, const gp_Circ& C, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
150 | |
151 | static void D3 (const Standard_Real U, const gp_Elips& E, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
152 | |
153 | Standard_EXPORT static void D3 (const Standard_Real U, const gp_Hypr& H, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
154 | |
155 | |
156 | //! For elementary curves (lines, circles and conics) from |
157 | //! the gp package, computes the vector corresponding to |
158 | //! the Nth derivative at the point of parameter U. The result is either: |
159 | //! - a gp_Vec vector for a curve in 3D space, or |
160 | //! - a gp_Vec2d vector for a curve in 2D space. |
161 | //! In the following functions N is the order of derivation |
162 | //! and should be greater than 0 |
163 | Standard_EXPORT static gp_Vec DN (const Standard_Real U, const gp_Lin& L, const Standard_Integer N); |
164 | |
165 | static gp_Vec DN (const Standard_Real U, const gp_Circ& C, const Standard_Integer N); |
166 | |
167 | static gp_Vec DN (const Standard_Real U, const gp_Elips& E, const Standard_Integer N); |
168 | |
169 | static gp_Vec DN (const Standard_Real U, const gp_Hypr& H, const Standard_Integer N); |
170 | |
171 | static gp_Vec DN (const Standard_Real U, const gp_Parab& Prb, const Standard_Integer N); |
172 | |
173 | static gp_Pnt2d Value (const Standard_Real U, const gp_Lin2d& L); |
174 | |
175 | static gp_Pnt2d Value (const Standard_Real U, const gp_Circ2d& C); |
176 | |
177 | static gp_Pnt2d Value (const Standard_Real U, const gp_Elips2d& E); |
178 | |
179 | static gp_Pnt2d Value (const Standard_Real U, const gp_Hypr2d& H); |
180 | |
181 | static gp_Pnt2d Value (const Standard_Real U, const gp_Parab2d& Prb); |
182 | |
183 | static void D1 (const Standard_Real U, const gp_Lin2d& L, gp_Pnt2d& P, gp_Vec2d& V1); |
184 | |
185 | static void D1 (const Standard_Real U, const gp_Circ2d& C, gp_Pnt2d& P, gp_Vec2d& V1); |
186 | |
187 | static void D1 (const Standard_Real U, const gp_Elips2d& E, gp_Pnt2d& P, gp_Vec2d& V1); |
188 | |
189 | static void D1 (const Standard_Real U, const gp_Hypr2d& H, gp_Pnt2d& P, gp_Vec2d& V1); |
190 | |
191 | static void D1 (const Standard_Real U, const gp_Parab2d& Prb, gp_Pnt2d& P, gp_Vec2d& V1); |
192 | |
193 | static void D2 (const Standard_Real U, const gp_Circ2d& C, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
194 | |
195 | static void D2 (const Standard_Real U, const gp_Elips2d& E, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
196 | |
197 | static void D2 (const Standard_Real U, const gp_Hypr2d& H, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
198 | |
199 | static void D2 (const Standard_Real U, const gp_Parab2d& Prb, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
200 | |
201 | static void D3 (const Standard_Real U, const gp_Circ2d& C, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
202 | |
203 | static void D3 (const Standard_Real U, const gp_Elips2d& E, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
204 | |
205 | |
206 | //! In the following functions N is the order of derivation |
207 | //! and should be greater than 0 |
208 | static void D3 (const Standard_Real U, const gp_Hypr2d& H, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
209 | |
210 | static gp_Vec2d DN (const Standard_Real U, const gp_Lin2d& L, const Standard_Integer N); |
211 | |
212 | static gp_Vec2d DN (const Standard_Real U, const gp_Circ2d& C, const Standard_Integer N); |
213 | |
214 | static gp_Vec2d DN (const Standard_Real U, const gp_Elips2d& E, const Standard_Integer N); |
215 | |
216 | static gp_Vec2d DN (const Standard_Real U, const gp_Hypr2d& H, const Standard_Integer N); |
217 | |
218 | static gp_Vec2d DN (const Standard_Real U, const gp_Parab2d& Prb, const Standard_Integer N); |
219 | |
220 | //! Curve evaluation |
221 | //! The following basis functions compute the derivatives on |
222 | //! elementary curves defined by their geometric characteristics. |
223 | //! These functions can be called without constructing a conic |
224 | //! from package gp. They are called by the previous functions. |
225 | //! Example : |
226 | //! A circle is defined by its position and its radius. |
227 | Standard_EXPORT static gp_Pnt LineValue (const Standard_Real U, const gp_Ax1& Pos); |
228 | |
229 | Standard_EXPORT static gp_Pnt CircleValue (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Radius); |
230 | |
231 | Standard_EXPORT static gp_Pnt EllipseValue (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
232 | |
233 | Standard_EXPORT static gp_Pnt HyperbolaValue (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
234 | |
235 | Standard_EXPORT static gp_Pnt ParabolaValue (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Focal); |
236 | |
237 | Standard_EXPORT static void LineD1 (const Standard_Real U, const gp_Ax1& Pos, gp_Pnt& P, gp_Vec& V1); |
238 | |
239 | Standard_EXPORT static void CircleD1 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Radius, gp_Pnt& P, gp_Vec& V1); |
240 | |
241 | Standard_EXPORT static void EllipseD1 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt& P, gp_Vec& V1); |
242 | |
243 | Standard_EXPORT static void HyperbolaD1 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt& P, gp_Vec& V1); |
244 | |
245 | Standard_EXPORT static void ParabolaD1 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Focal, gp_Pnt& P, gp_Vec& V1); |
246 | |
247 | Standard_EXPORT static void CircleD2 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Radius, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
248 | |
249 | Standard_EXPORT static void EllipseD2 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
250 | |
251 | Standard_EXPORT static void HyperbolaD2 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
252 | |
253 | Standard_EXPORT static void ParabolaD2 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Focal, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
254 | |
255 | Standard_EXPORT static void CircleD3 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Radius, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
256 | |
257 | Standard_EXPORT static void EllipseD3 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
258 | |
259 | Standard_EXPORT static void HyperbolaD3 (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3); |
260 | |
261 | |
262 | //! In the following functions N is the order of derivation |
263 | //! and should be greater than 0 |
264 | Standard_EXPORT static gp_Vec LineDN (const Standard_Real U, const gp_Ax1& Pos, const Standard_Integer N); |
265 | |
266 | Standard_EXPORT static gp_Vec CircleDN (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Radius, const Standard_Integer N); |
267 | |
268 | Standard_EXPORT static gp_Vec EllipseDN (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Integer N); |
269 | |
270 | Standard_EXPORT static gp_Vec HyperbolaDN (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Integer N); |
271 | |
272 | Standard_EXPORT static gp_Vec ParabolaDN (const Standard_Real U, const gp_Ax2& Pos, const Standard_Real Focal, const Standard_Integer N); |
273 | |
274 | Standard_EXPORT static gp_Pnt2d LineValue (const Standard_Real U, const gp_Ax2d& Pos); |
275 | |
276 | Standard_EXPORT static gp_Pnt2d CircleValue (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Radius); |
277 | |
278 | Standard_EXPORT static gp_Pnt2d EllipseValue (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
279 | |
280 | Standard_EXPORT static gp_Pnt2d HyperbolaValue (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius); |
281 | |
282 | Standard_EXPORT static gp_Pnt2d ParabolaValue (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Focal); |
283 | |
284 | Standard_EXPORT static void LineD1 (const Standard_Real U, const gp_Ax2d& Pos, gp_Pnt2d& P, gp_Vec2d& V1); |
285 | |
286 | Standard_EXPORT static void CircleD1 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Radius, gp_Pnt2d& P, gp_Vec2d& V1); |
287 | |
288 | Standard_EXPORT static void EllipseD1 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt2d& P, gp_Vec2d& V1); |
289 | |
290 | Standard_EXPORT static void HyperbolaD1 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt2d& P, gp_Vec2d& V1); |
291 | |
292 | Standard_EXPORT static void ParabolaD1 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Focal, gp_Pnt2d& P, gp_Vec2d& V1); |
293 | |
294 | Standard_EXPORT static void CircleD2 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Radius, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
295 | |
296 | Standard_EXPORT static void EllipseD2 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
297 | |
298 | Standard_EXPORT static void HyperbolaD2 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
299 | |
300 | Standard_EXPORT static void ParabolaD2 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Focal, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
301 | |
302 | Standard_EXPORT static void CircleD3 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Radius, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
303 | |
304 | Standard_EXPORT static void EllipseD3 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
305 | |
306 | |
307 | //! In the following functions N is the order of derivation |
308 | //! and should be greater than 0 |
309 | Standard_EXPORT static void HyperbolaD3 (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
310 | |
311 | Standard_EXPORT static gp_Vec2d LineDN (const Standard_Real U, const gp_Ax2d& Pos, const Standard_Integer N); |
312 | |
313 | Standard_EXPORT static gp_Vec2d CircleDN (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Radius, const Standard_Integer N); |
314 | |
315 | Standard_EXPORT static gp_Vec2d EllipseDN (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Integer N); |
316 | |
317 | Standard_EXPORT static gp_Vec2d HyperbolaDN (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Integer N); |
318 | |
319 | |
320 | //! The following functions compute the parametric value corresponding |
321 | //! to a given point on a elementary curve. The point should be on the |
322 | //! curve. |
323 | Standard_EXPORT static gp_Vec2d ParabolaDN (const Standard_Real U, const gp_Ax22d& Pos, const Standard_Real Focal, const Standard_Integer N); |
324 | |
325 | |
326 | //! Computes the parameter value of the point P on the given curve. |
327 | //! Note: In its local coordinate system, the parametric |
328 | //! equation of the curve is given by the following: |
329 | //! - for the line L: P(U) = Po + U*Vo |
330 | //! where Po is the origin and Vo the unit vector of its positioning axis. |
331 | //! - for the circle C: X(U) = Radius*Cos(U), Y(U) = Radius*Sin(U) |
332 | //! - for the ellipse E: X(U) = MajorRadius*Cos(U). Y(U) = MinorRadius*Sin(U) |
333 | //! - for the hyperbola H: X(U) = MajorRadius*Ch(U), Y(U) = MinorRadius*Sh(U) |
334 | //! - for the parabola Prb: |
335 | //! X(U) = U**2 / (2*p) |
336 | //! Y(U) = U |
337 | //! where p is the distance between the focus and the directrix. |
338 | //! Warning |
339 | //! The point P must be on the curve. These functions are |
340 | //! not protected, however, and if point P is not on the |
341 | //! curve, an exception may be raised. |
342 | Standard_EXPORT static Standard_Real Parameter (const gp_Lin& L, const gp_Pnt& P); |
343 | |
344 | //! parametrization |
345 | //! P (U) = L.Location() + U * L.Direction() |
346 | static Standard_Real Parameter (const gp_Lin2d& L, const gp_Pnt2d& P); |
347 | |
348 | static Standard_Real Parameter (const gp_Circ& C, const gp_Pnt& P); |
349 | |
350 | //! parametrization |
351 | //! In the local coordinate system of the circle |
352 | //! X (U) = Radius * Cos (U) |
353 | //! Y (U) = Radius * Sin (U) |
354 | static Standard_Real Parameter (const gp_Circ2d& C, const gp_Pnt2d& P); |
355 | |
356 | static Standard_Real Parameter (const gp_Elips& E, const gp_Pnt& P); |
357 | |
358 | //! parametrization |
359 | //! In the local coordinate system of the Ellipse |
360 | //! X (U) = MajorRadius * Cos (U) |
361 | //! Y (U) = MinorRadius * Sin (U) |
362 | static Standard_Real Parameter (const gp_Elips2d& E, const gp_Pnt2d& P); |
363 | |
364 | static Standard_Real Parameter (const gp_Hypr& H, const gp_Pnt& P); |
365 | |
366 | //! parametrization |
367 | //! In the local coordinate system of the Hyperbola |
368 | //! X (U) = MajorRadius * Ch (U) |
369 | //! Y (U) = MinorRadius * Sh (U) |
370 | static Standard_Real Parameter (const gp_Hypr2d& H, const gp_Pnt2d& P); |
371 | |
372 | static Standard_Real Parameter (const gp_Parab& Prb, const gp_Pnt& P); |
373 | |
374 | //! parametrization |
375 | //! In the local coordinate system of the parabola |
376 | //! Y**2 = (2*P) * X where P is the distance between the focus |
377 | //! and the directrix. |
378 | static Standard_Real Parameter (const gp_Parab2d& Prb, const gp_Pnt2d& P); |
379 | |
380 | Standard_EXPORT static Standard_Real LineParameter (const gp_Ax1& Pos, const gp_Pnt& P); |
381 | |
382 | //! parametrization |
383 | //! P (U) = L.Location() + U * L.Direction() |
384 | Standard_EXPORT static Standard_Real LineParameter (const gp_Ax2d& Pos, const gp_Pnt2d& P); |
385 | |
386 | Standard_EXPORT static Standard_Real CircleParameter (const gp_Ax2& Pos, const gp_Pnt& P); |
387 | |
388 | //! Pos is the Axis of the Circle |
389 | //! parametrization |
390 | //! In the local coordinate system of the circle |
391 | //! X (U) = Radius * Cos (U) |
392 | //! Y (U) = Radius * Sin (U) |
393 | Standard_EXPORT static Standard_Real CircleParameter (const gp_Ax22d& Pos, const gp_Pnt2d& P); |
394 | |
395 | Standard_EXPORT static Standard_Real EllipseParameter (const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const gp_Pnt& P); |
396 | |
397 | //! Pos is the Axis of the Ellipse |
398 | //! parametrization |
399 | //! In the local coordinate system of the Ellipse |
400 | //! X (U) = MajorRadius * Cos (U) |
401 | //! Y (U) = MinorRadius * Sin (U) |
402 | Standard_EXPORT static Standard_Real EllipseParameter (const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const gp_Pnt2d& P); |
403 | |
404 | Standard_EXPORT static Standard_Real HyperbolaParameter (const gp_Ax2& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const gp_Pnt& P); |
405 | |
406 | //! Pos is the Axis of the Hyperbola |
407 | //! parametrization |
408 | //! In the local coordinate system of the Hyperbola |
409 | //! X (U) = MajorRadius * Ch (U) |
410 | //! Y (U) = MinorRadius * Sh (U) |
411 | Standard_EXPORT static Standard_Real HyperbolaParameter (const gp_Ax22d& Pos, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const gp_Pnt2d& P); |
412 | |
413 | Standard_EXPORT static Standard_Real ParabolaParameter (const gp_Ax2& Pos, const gp_Pnt& P); |
414 | |
415 | //! Pos is the mirror axis of the parabola |
416 | //! parametrization |
417 | //! In the local coordinate system of the parabola |
418 | //! Y**2 = (2*P) * X where P is the distance between the focus |
419 | //! and the directrix. |
420 | //! The following functions build a 3d curve from a |
421 | //! 2d curve at a given position defined with an Ax2. |
422 | Standard_EXPORT static Standard_Real ParabolaParameter (const gp_Ax22d& Pos, const gp_Pnt2d& P); |
423 | |
424 | Standard_EXPORT static gp_Pnt To3d (const gp_Ax2& Pos, const gp_Pnt2d& P); |
425 | |
426 | Standard_EXPORT static gp_Vec To3d (const gp_Ax2& Pos, const gp_Vec2d& V); |
427 | |
428 | Standard_EXPORT static gp_Dir To3d (const gp_Ax2& Pos, const gp_Dir2d& V); |
429 | |
430 | Standard_EXPORT static gp_Ax1 To3d (const gp_Ax2& Pos, const gp_Ax2d& A); |
431 | |
432 | Standard_EXPORT static gp_Ax2 To3d (const gp_Ax2& Pos, const gp_Ax22d& A); |
433 | |
434 | Standard_EXPORT static gp_Lin To3d (const gp_Ax2& Pos, const gp_Lin2d& L); |
435 | |
436 | Standard_EXPORT static gp_Circ To3d (const gp_Ax2& Pos, const gp_Circ2d& C); |
437 | |
438 | Standard_EXPORT static gp_Elips To3d (const gp_Ax2& Pos, const gp_Elips2d& E); |
439 | |
440 | Standard_EXPORT static gp_Hypr To3d (const gp_Ax2& Pos, const gp_Hypr2d& H); |
441 | |
442 | |
443 | //! These functions build a 3D geometric entity from a 2D geometric entity. |
444 | //! The "X Axis" and the "Y Axis" of the global coordinate |
445 | //! system (i.e. 2D space) are lined up respectively with the |
446 | //! "X Axis" and "Y Axis" of the 3D coordinate system, Pos. |
447 | Standard_EXPORT static gp_Parab To3d (const gp_Ax2& Pos, const gp_Parab2d& Prb); |
448 | |
449 | |
450 | |
451 | |
452 | protected: |
453 | |
454 | |
455 | |
456 | |
457 | |
458 | private: |
459 | |
460 | |
461 | |
462 | |
463 | |
464 | }; |
465 | |
466 | |
467 | #include <ElCLib.lxx> |
468 | |
469 | |
470 | |
471 | |
472 | |
473 | #endif // _ElCLib_HeaderFile |