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_RectangularTrimmedSurface_HeaderFile |
18 | #define _Geom_RectangularTrimmedSurface_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Geom_BoundedSurface.hxx> |
26 | #include <GeomAbs_Shape.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | class Geom_Surface; |
29 | class Standard_ConstructionError; |
30 | class Standard_RangeError; |
31 | class Standard_NoSuchObject; |
32 | class Geom_UndefinedDerivative; |
33 | class Geom_UndefinedValue; |
34 | class Geom_Curve; |
35 | class gp_Pnt; |
36 | class gp_Vec; |
37 | class gp_Trsf; |
38 | class gp_GTrsf2d; |
39 | class Geom_Geometry; |
40 | |
41 | |
42 | class Geom_RectangularTrimmedSurface; |
43 | DEFINE_STANDARD_HANDLE(Geom_RectangularTrimmedSurface, Geom_BoundedSurface) |
44 | |
45 | //! Describes a portion of a surface (a patch) limited |
46 | //! by two values of the u parameter in the u |
47 | //! parametric direction, and two values of the v |
48 | //! parameter in the v parametric direction. The |
49 | //! domain of the trimmed surface must be within the |
50 | //! domain of the surface being trimmed. |
51 | //! The trimmed surface is defined by: |
52 | //! - the basis surface, and |
53 | //! - the values (umin, umax) and (vmin, vmax) |
54 | //! which limit it in the u and v parametric directions. |
55 | //! The trimmed surface is built from a copy of the basis |
56 | //! surface. Therefore, when the basis surface is |
57 | //! modified the trimmed surface is not changed. |
58 | //! Consequently, the trimmed surface does not |
59 | //! necessarily have the same orientation as the basis surface. |
60 | //! Warning: The case of surface being trimmed is periodic and |
61 | //! parametrics values are outside the domain is possible. |
62 | //! But, domain of the trimmed surface can be translated |
63 | //! by (n X) the period. |
64 | class Geom_RectangularTrimmedSurface : public Geom_BoundedSurface |
65 | { |
66 | |
67 | public: |
68 | |
69 | |
70 | |
71 | //! The U parametric direction of the surface is oriented from U1 |
72 | //! to U2. The V parametric direction of the surface is oriented |
73 | //! from V1 to V2. |
74 | //! These two directions define the orientation of the surface |
75 | //! (normal). If the surface is not periodic USense and VSense are |
76 | //! not used for the construction. If the surface S is periodic in |
77 | //! one direction USense and VSense give the available part of the |
78 | //! surface. By default in this case the surface has the same |
79 | //! orientation as the basis surface S. |
80 | //! The returned surface is not closed and not periodic. |
81 | //! ConstructionError Raised if |
82 | //! S is not periodic in the UDirection and U1 or U2 are out of the |
83 | //! bounds of S. |
84 | //! S is not periodic in the VDirection and V1 or V2 are out of the |
85 | //! bounds of S. |
86 | //! U1 = U2 or V1 = V2 |
87 | Standard_EXPORT Geom_RectangularTrimmedSurface(const Handle(Geom_Surface)& S, const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Boolean USense = Standard_True, const Standard_Boolean VSense = Standard_True); |
88 | |
89 | |
90 | //! The basis surface S is only trim in one parametric direction. |
91 | //! If UTrim = True the surface is trimmed in the U parametric |
92 | //! direction else the surface is trimmed in the V parametric |
93 | //! direction. |
94 | //! In the considered parametric direction the resulting surface is |
95 | //! oriented from Param1 to Param2. If S is periodic Sense gives the |
96 | //! available part of the surface. By default the trimmed surface has |
97 | //! the same orientation as the basis surface S in the considered |
98 | //! parametric direction (Sense = True). |
99 | //! If the basis surface S is closed or periodic in the parametric |
100 | //! direction opposite to the trimming direction the trimmed surface |
101 | //! has the same characteristics as the surface S in this direction. |
102 | //! Warnings : |
103 | //! In this package the entities are not shared. |
104 | //! The RectangularTrimmedSurface is built with a copy of the |
105 | //! surface S. So when S is modified the RectangularTrimmedSurface |
106 | //! is not modified |
107 | //! Raised if |
108 | //! S is not periodic in the considered parametric direction and |
109 | //! Param1 or Param2 are out of the bounds of S. |
110 | //! Param1 = Param2 |
111 | Standard_EXPORT Geom_RectangularTrimmedSurface(const Handle(Geom_Surface)& S, const Standard_Real Param1, const Standard_Real Param2, const Standard_Boolean UTrim, const Standard_Boolean Sense = Standard_True); |
112 | |
113 | //! Modifies this patch by changing the trim values |
114 | //! applied to the original surface |
115 | //! The u parametric direction of |
116 | //! this patch is oriented from U1 to U2. The v |
117 | //! parametric direction of this patch is oriented |
118 | //! from V1 to V2. USense and VSense are used |
119 | //! for the construction only if the surface is periodic |
120 | //! in the corresponding parametric direction, and |
121 | //! define the available part of the surface; by default |
122 | //! in this case, this patch has the same orientation |
123 | //! as the basis surface. |
124 | //! Raised if |
125 | //! The BasisSurface is not periodic in the UDirection and U1 or U2 |
126 | //! are out of the bounds of the BasisSurface. |
127 | //! The BasisSurface is not periodic in the VDirection and V1 or V2 |
128 | //! are out of the bounds of the BasisSurface. |
129 | //! U1 = U2 or V1 = V2 |
130 | Standard_EXPORT void SetTrim (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Boolean USense = Standard_True, const Standard_Boolean VSense = Standard_True); |
131 | |
132 | //! Modifies this patch by changing the trim values |
133 | //! applied to the original surface |
134 | //! The basis surface is trimmed only in one parametric direction: if UTrim |
135 | //! is true, the surface is trimmed in the u parametric |
136 | //! direction; if it is false, it is trimmed in the v |
137 | //! parametric direction. In the "trimmed" direction, |
138 | //! this patch is oriented from Param1 to Param2. If |
139 | //! the basis surface is periodic in the "trimmed" |
140 | //! direction, Sense defines its available part. By |
141 | //! default in this case, this patch has the same |
142 | //! orientation as the basis surface in this parametric |
143 | //! direction. If the basis surface is closed or periodic |
144 | //! in the other parametric direction (i.e. not the |
145 | //! "trimmed" direction), this patch has the same |
146 | //! characteristics as the basis surface in that parametric direction. |
147 | //! Raised if |
148 | //! The BasisSurface is not periodic in the considered direction and |
149 | //! Param1 or Param2 are out of the bounds of the BasisSurface. |
150 | //! Param1 = Param2 |
151 | Standard_EXPORT void SetTrim (const Standard_Real Param1, const Standard_Real Param2, const Standard_Boolean UTrim, const Standard_Boolean Sense = Standard_True); |
152 | |
153 | //! Returns the Basis surface of <me>. |
154 | Standard_EXPORT Handle(Geom_Surface) BasisSurface() const; |
155 | |
156 | //! Changes the orientation of this patch in the u |
157 | //! parametric direction. The bounds of the surface are |
158 | //! not changed, but the given parametric direction is |
159 | //! reversed. Hence the orientation of the surface is reversed. |
79104795 |
160 | Standard_EXPORT void UReverse() Standard_OVERRIDE; |
42cf5bc1 |
161 | |
162 | //! Computes the u parameter on the modified |
163 | //! surface, produced by when reversing its u |
164 | //! parametric direction, for any point of u parameter U on this patch. |
79104795 |
165 | Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
166 | |
167 | //! Changes the orientation of this patch in the v |
168 | //! parametric direction. The bounds of the surface are |
169 | //! not changed, but the given parametric direction is |
170 | //! reversed. Hence the orientation of the surface is reversed. |
79104795 |
171 | Standard_EXPORT void VReverse() Standard_OVERRIDE; |
42cf5bc1 |
172 | |
173 | //! Computes the v parameter on the modified |
174 | //! surface, produced by when reversing its v |
175 | //! parametric direction, for any point of v parameter V on this patch. |
79104795 |
176 | Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE; |
42cf5bc1 |
177 | |
178 | //! Returns the parametric bounds U1, U2, V1 and V2 of this patch. |
79104795 |
179 | Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE; |
42cf5bc1 |
180 | |
181 | |
182 | //! Returns the continuity of the surface : |
183 | //! C0 : only geometric continuity, |
184 | //! C1 : continuity of the first derivative all along the Surface, |
185 | //! C2 : continuity of the second derivative all along the Surface, |
186 | //! C3 : continuity of the third derivative all along the Surface, |
187 | //! CN : the order of continuity is infinite. |
79104795 |
188 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; |
42cf5bc1 |
189 | |
190 | //! Returns true if this patch is closed in the given parametric direction. |
79104795 |
191 | Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE; |
42cf5bc1 |
192 | |
193 | //! Returns true if this patch is closed in the given parametric direction. |
79104795 |
194 | Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; |
42cf5bc1 |
195 | |
196 | |
197 | //! Returns true if the order of derivation in the U parametric |
198 | //! direction is N. |
199 | //! Raised if N < 0. |
79104795 |
200 | Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
201 | |
202 | |
203 | //! Returns true if the order of derivation in the V parametric |
204 | //! direction is N. |
205 | //! Raised if N < 0. |
79104795 |
206 | Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
207 | |
ff3f0387 |
208 | //! Returns true if this patch is periodic and not trimmed in the given |
42cf5bc1 |
209 | //! parametric direction. |
79104795 |
210 | Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
211 | |
212 | //! Returns the period of this patch in the u |
213 | //! parametric direction. |
214 | //! raises if the surface is not uperiodic. |
215 | Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE; |
216 | |
217 | |
ff3f0387 |
218 | //! Returns true if this patch is periodic and not trimmed in the given |
42cf5bc1 |
219 | //! parametric direction. |
79104795 |
220 | Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
221 | |
222 | //! Returns the period of this patch in the v |
223 | //! parametric direction. |
224 | //! raises if the surface is not vperiodic. |
225 | //! value and derivatives |
226 | Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE; |
227 | |
228 | //! computes the U isoparametric curve. |
79104795 |
229 | Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
230 | |
231 | //! Computes the V isoparametric curve. |
79104795 |
232 | Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE; |
42cf5bc1 |
233 | |
234 | |
235 | //! Can be raised if the basis surface is an OffsetSurface. |
79104795 |
236 | Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE; |
42cf5bc1 |
237 | |
238 | |
239 | //! The returned derivatives have the same orientation as the |
240 | //! derivatives of the basis surface even if the trimmed surface |
241 | //! has not the same parametric orientation. |
242 | //! Warning! UndefinedDerivative raised if the continuity of the surface is not C1. |
79104795 |
243 | 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 |
244 | |
245 | |
246 | //! The returned derivatives have the same orientation as the |
247 | //! derivatives of the basis surface even if the trimmed surface |
248 | //! has not the same parametric orientation. |
249 | //! Warning! UndefinedDerivative raised if the continuity of the surface is not C2. |
79104795 |
250 | 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 |
251 | |
252 | //! The returned derivatives have the same orientation as the |
253 | //! derivatives of the basis surface even if the trimmed surface |
254 | //! has not the same parametric orientation. |
255 | //! Warning UndefinedDerivative raised if the continuity of the surface is not C3. |
79104795 |
256 | 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 |
257 | |
258 | //! The returned derivative has the same orientation as the |
259 | //! derivative of the basis surface even if the trimmed surface |
260 | //! has not the same parametric orientation. |
261 | //! Warning! UndefinedDerivative raised if the continuity of the surface is not CNu in the U |
262 | //! parametric direction and CNv in the V parametric direction. |
263 | //! RangeError Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
79104795 |
264 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE; |
42cf5bc1 |
265 | |
266 | //! Applies the transformation T to this patch. |
267 | //! Warning |
268 | //! As a consequence, the basis surface included in the |
269 | //! data structure of this patch is also modified. |
79104795 |
270 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
42cf5bc1 |
271 | |
272 | //! Computes the parameters on the transformed surface for |
273 | //! the transform of the point of parameters U,V on <me>. |
274 | //! |
275 | //! me->Transformed(T)->Value(U',V') |
276 | //! |
277 | //! is the same point as |
278 | //! |
279 | //! me->Value(U,V).Transformed(T) |
280 | //! |
281 | //! Where U',V' are the new values of U,V after calling |
282 | //! |
283 | //! me->TranformParameters(U,V,T) |
284 | //! |
285 | //! This methods calls the basis surface method. |
286 | Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE; |
287 | |
288 | //! Returns a 2d transformation used to find the new |
289 | //! parameters of a point on the transformed surface. |
290 | //! |
291 | //! me->Transformed(T)->Value(U',V') |
292 | //! |
293 | //! is the same point as |
294 | //! |
295 | //! me->Value(U,V).Transformed(T) |
296 | //! |
297 | //! Where U',V' are obtained by transforming U,V with |
298 | //! th 2d transformation returned by |
299 | //! |
300 | //! me->ParametricTransformation(T) |
301 | //! |
302 | //! This methods calls the basis surface method. |
303 | Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE; |
304 | |
305 | //! Creates a new object which is a copy of this patch. |
79104795 |
306 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
307 | |
bc73b006 |
308 | //! Dumps the content of me into the stream |
309 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; |
310 | |
42cf5bc1 |
311 | |
312 | |
313 | |
92efcf78 |
314 | DEFINE_STANDARD_RTTIEXT(Geom_RectangularTrimmedSurface,Geom_BoundedSurface) |
42cf5bc1 |
315 | |
316 | protected: |
317 | |
318 | |
319 | |
320 | |
321 | private: |
322 | |
323 | |
324 | //! General set trim, to implement constructors and |
325 | //! others set trim. |
326 | Standard_EXPORT void SetTrim (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Boolean UTrim, const Standard_Boolean VTrim, const Standard_Boolean USense, const Standard_Boolean VSense); |
327 | |
328 | Handle(Geom_Surface) basisSurf; |
329 | Standard_Real utrim1; |
330 | Standard_Real vtrim1; |
331 | Standard_Real utrim2; |
332 | Standard_Real vtrim2; |
333 | Standard_Boolean isutrimmed; |
334 | Standard_Boolean isvtrimmed; |
335 | |
336 | |
337 | }; |
338 | |
339 | |
340 | |
341 | |
342 | |
343 | |
344 | |
345 | #endif // _Geom_RectangularTrimmedSurface_HeaderFile |