42cf5bc1 |
1 | // Created on: 1993-03-10 |
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 _Geom_SurfaceOfLinearExtrusion_HeaderFile |
18 | #define _Geom_SurfaceOfLinearExtrusion_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Geom_SweptSurface.hxx> |
6b84c3f7 |
24 | #include <GeomEvaluator_SurfaceOfExtrusion.hxx> |
42cf5bc1 |
25 | #include <Standard_Real.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | class Standard_RangeError; |
29 | class Geom_UndefinedDerivative; |
30 | class Geom_Curve; |
31 | class gp_Dir; |
32 | class gp_Pnt; |
33 | class gp_Vec; |
34 | class gp_Trsf; |
35 | class gp_GTrsf2d; |
36 | class Geom_Geometry; |
37 | |
38 | |
39 | class Geom_SurfaceOfLinearExtrusion; |
40 | DEFINE_STANDARD_HANDLE(Geom_SurfaceOfLinearExtrusion, Geom_SweptSurface) |
41 | |
42 | //! Describes a surface of linear extrusion ("extruded |
43 | //! surface"), e.g. a generalized cylinder. Such a surface |
44 | //! is obtained by sweeping a curve (called the "extruded |
45 | //! curve" or "basis") in a given direction (referred to as |
46 | //! the "direction of extrusion" and defined by a unit vector). |
47 | //! The u parameter is along the extruded curve. The v |
48 | //! parameter is along the direction of extrusion. |
49 | //! The parameter range for the u parameter is defined |
50 | //! by the reference curve. |
51 | //! The parameter range for the v parameter is ] - |
52 | //! infinity, + infinity [. |
53 | //! The position of the curve gives the origin of the v parameter. |
54 | //! The surface is "CN" in the v parametric direction. |
55 | //! The form of a surface of linear extrusion is generally a |
56 | //! ruled surface (GeomAbs_RuledForm). It can be: |
57 | //! - a cylindrical surface, if the extruded curve is a circle, |
58 | //! or a trimmed circle, with an axis parallel to the |
59 | //! direction of extrusion (GeomAbs_CylindricalForm), or |
60 | //! - a planar surface, if the extruded curve is a line |
61 | //! (GeomAbs_PlanarForm). |
62 | //! Note: The surface of extrusion is built from a copy of |
63 | //! the original basis curve, so the original curve is not |
64 | //! modified when the surface is modified. |
65 | //! Warning |
66 | //! Degenerate surfaces are not detected. A degenerate |
67 | //! surface is obtained, for example, when the extruded |
68 | //! curve is a line and the direction of extrusion is parallel |
69 | //! to that line. |
70 | class Geom_SurfaceOfLinearExtrusion : public Geom_SweptSurface |
71 | { |
72 | |
73 | public: |
74 | |
75 | |
76 | |
77 | //! V is the direction of extrusion. |
78 | //! C is the extruded curve. |
79 | //! The form of a SurfaceOfLinearExtrusion can be : |
80 | //! . ruled surface (RuledForm), |
81 | //! . a cylindrical surface if the extruded curve is a circle or |
82 | //! a trimmed circle (CylindricalForm), |
83 | //! . a plane surface if the extruded curve is a Line (PlanarForm). |
84 | //! Warnings : |
85 | //! Degenerated surface cases are not detected. For example if the |
86 | //! curve C is a line and V is parallel to the direction of this |
87 | //! line. |
88 | Standard_EXPORT Geom_SurfaceOfLinearExtrusion(const Handle(Geom_Curve)& C, const gp_Dir& V); |
89 | |
90 | //! Assigns V as the "direction of extrusion" for this |
91 | //! surface of linear extrusion. |
92 | Standard_EXPORT void SetDirection (const gp_Dir& V); |
93 | |
94 | //! Modifies this surface of linear extrusion by redefining |
95 | //! its "basis curve" (the "extruded curve"). |
96 | Standard_EXPORT void SetBasisCurve (const Handle(Geom_Curve)& C); |
97 | |
98 | //! Changes the orientation of this surface of linear |
99 | //! extrusion in the u parametric direction. The |
100 | //! bounds of the surface are not changed, but the given |
101 | //! parametric direction is reversed. Hence the |
102 | //! orientation of the surface is reversed. |
103 | //! In the case of a surface of linear extrusion: |
104 | //! - UReverse reverses the basis curve, and |
105 | //! - VReverse reverses the direction of linear extrusion. |
79104795 |
106 | Standard_EXPORT void UReverse() Standard_OVERRIDE; |
42cf5bc1 |
107 | |
108 | //! Computes the u parameter on the modified |
109 | //! surface, produced by reversing its u parametric |
110 | //! direction, for any point of u parameter U on this surface of linear extrusion. |
111 | //! In the case of an extruded surface: |
112 | //! - UReverseParameter returns the reversed |
113 | //! parameter given by the function |
114 | //! ReversedParameter called with U on the basis curve, |
79104795 |
115 | Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
116 | |
117 | //! Changes the orientation of this surface of linear |
118 | //! extrusion in the v parametric direction. The |
119 | //! bounds of the surface are not changed, but the given |
120 | //! parametric direction is reversed. Hence the |
121 | //! orientation of the surface is reversed. |
122 | //! In the case of a surface of linear extrusion: |
123 | //! - UReverse reverses the basis curve, and |
124 | //! - VReverse reverses the direction of linear extrusion. |
79104795 |
125 | Standard_EXPORT void VReverse() Standard_OVERRIDE; |
42cf5bc1 |
126 | |
127 | //! Computes the v parameter on the modified |
128 | //! surface, produced by reversing its u v parametric |
129 | //! direction, for any point of v parameter V on this surface of linear extrusion. |
130 | //! In the case of an extruded surface VReverse returns -V. |
79104795 |
131 | Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE; |
42cf5bc1 |
132 | |
133 | //! Returns the parametric bounds U1, U2, V1 and V2 of |
134 | //! this surface of linear extrusion. |
135 | //! A surface of linear extrusion is infinite in the v |
136 | //! parametric direction, so: |
137 | //! - V1 = Standard_Real::RealFirst() |
138 | //! - V2 = Standard_Real::RealLast(). |
79104795 |
139 | Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE; |
42cf5bc1 |
140 | |
141 | //! IsUClosed returns true if the "basis curve" of this |
142 | //! surface of linear extrusion is closed. |
79104795 |
143 | Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE; |
42cf5bc1 |
144 | |
145 | //! IsVClosed always returns false. |
79104795 |
146 | Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; |
42cf5bc1 |
147 | |
148 | //! IsCNu returns true if the degree of continuity for the |
149 | //! "basis curve" of this surface of linear extrusion is at least N. |
150 | //! Raises RangeError if N < 0. |
79104795 |
151 | Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
152 | |
153 | //! IsCNv always returns true. |
79104795 |
154 | Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
155 | |
156 | //! IsUPeriodic returns true if the "basis curve" of this |
157 | //! surface of linear extrusion is periodic. |
79104795 |
158 | Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
159 | |
160 | //! IsVPeriodic always returns false. |
79104795 |
161 | Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
162 | |
163 | //! Computes the U isoparametric curve of this surface |
164 | //! of linear extrusion. This is the line parallel to the |
165 | //! direction of extrusion, passing through the point of |
166 | //! parameter U of the basis curve. |
79104795 |
167 | Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
168 | |
169 | //! Computes the V isoparametric curve of this surface |
170 | //! of linear extrusion. This curve is obtained by |
171 | //! translating the extruded curve in the direction of |
172 | //! extrusion, with the magnitude V. |
79104795 |
173 | Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE; |
42cf5bc1 |
174 | |
175 | |
176 | //! Computes the point P (U, V) on the surface. |
177 | //! The parameter U is the parameter on the extruded curve. |
178 | //! The parametrization V is a linear parametrization, and |
179 | //! the direction of parametrization is the direction of |
180 | //! extrusion. If the point is on the extruded curve, V = 0.0 |
79104795 |
181 | Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE; |
42cf5bc1 |
182 | |
183 | |
184 | //! Computes the current point and the first derivatives in the |
185 | //! directions U and V. |
186 | //! Raises UndefinedDerivative if the continuity of the surface is not C1. |
79104795 |
187 | Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE; |
42cf5bc1 |
188 | |
189 | //! --- Purpose ; |
190 | //! Computes the current point, the first and the second derivatives |
191 | //! in the directions U and V. |
192 | //! Raises UndefinedDerivative if the continuity of the surface is not C2. |
79104795 |
193 | Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE; |
42cf5bc1 |
194 | |
195 | |
196 | //! Computes the current point, the first,the second and the third |
197 | //! derivatives in the directions U and V. |
198 | //! Raises UndefinedDerivative if the continuity of the surface is not C3. |
79104795 |
199 | Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE; |
42cf5bc1 |
200 | |
201 | |
202 | //! Computes the derivative of order Nu in the direction u |
203 | //! and Nv in the direction v. |
204 | //! Raises UndefinedDerivative if the continuity of the surface is not CNu in the u |
205 | //! direction and CNv in the v direction. |
206 | //! Raises RangeError if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
79104795 |
207 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE; |
6b84c3f7 |
208 | |
42cf5bc1 |
209 | //! Applies the transformation T to this surface of linear extrusion. |
79104795 |
210 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
42cf5bc1 |
211 | |
212 | //! Computes the parameters on the transformed surface for |
213 | //! the transform of the point of parameters U,V on <me>. |
214 | //! |
215 | //! me->Transformed(T)->Value(U',V') |
216 | //! |
217 | //! is the same point as |
218 | //! |
219 | //! me->Value(U,V).Transformed(T) |
220 | //! |
221 | //! Where U',V' are the new values of U,V after calling |
222 | //! |
223 | //! me->TranformParameters(U,V,T) |
224 | //! |
225 | //! This methods multiplies : |
226 | //! U by BasisCurve()->ParametricTransformation(T) |
227 | //! V by T.ScaleFactor() |
228 | Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE; |
229 | |
230 | //! Returns a 2d transformation used to find the new |
231 | //! parameters of a point on the transformed surface. |
232 | //! |
233 | //! me->Transformed(T)->Value(U',V') |
234 | //! |
235 | //! is the same point as |
236 | //! |
237 | //! me->Value(U,V).Transformed(T) |
238 | //! |
239 | //! Where U',V' are obtained by transforming U,V with |
240 | //! th 2d transformation returned by |
241 | //! |
242 | //! me->ParametricTransformation(T) |
243 | //! |
244 | //! This methods returns a scale |
245 | //! U by BasisCurve()->ParametricTransformation(T) |
246 | //! V by T.ScaleFactor() |
247 | Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE; |
248 | |
249 | //! Creates a new object which is a copy of this surface of linear extrusion. |
79104795 |
250 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
251 | |
bc73b006 |
252 | //! Dumps the content of me into the stream |
253 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; |
254 | |
42cf5bc1 |
255 | |
256 | |
257 | |
92efcf78 |
258 | DEFINE_STANDARD_RTTIEXT(Geom_SurfaceOfLinearExtrusion,Geom_SweptSurface) |
42cf5bc1 |
259 | |
260 | protected: |
261 | |
262 | |
263 | |
264 | |
265 | private: |
6b84c3f7 |
266 | Handle(GeomEvaluator_SurfaceOfExtrusion) myEvaluator; |
42cf5bc1 |
267 | |
268 | |
269 | |
270 | }; |
271 | |
272 | |
273 | |
274 | |
275 | |
276 | |
277 | |
278 | #endif // _Geom_SurfaceOfLinearExtrusion_HeaderFile |