1 // Created on: 1993-03-10
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom_RectangularTrimmedSurface_HeaderFile
18 #define _Geom_RectangularTrimmedSurface_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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>
29 class Standard_ConstructionError;
30 class Standard_RangeError;
31 class Standard_NoSuchObject;
32 class Geom_UndefinedDerivative;
33 class Geom_UndefinedValue;
42 class Geom_RectangularTrimmedSurface;
43 DEFINE_STANDARD_HANDLE(Geom_RectangularTrimmedSurface, Geom_BoundedSurface)
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
71 //! The U parametric direction of the surface is oriented from U1
72 //! to U2. The V parametric direction of the surface is oriented
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
84 //! S is not periodic in the VDirection and V1 or V2 are out of the
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);
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
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.
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
108 //! S is not periodic in the considered parametric direction and
109 //! Param1 or Param2 are out of the bounds of S.
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);
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.
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);
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.
148 //! The BasisSurface is not periodic in the considered direction and
149 //! Param1 or Param2 are out of the bounds of the BasisSurface.
151 Standard_EXPORT void SetTrim (const Standard_Real Param1, const Standard_Real Param2, const Standard_Boolean UTrim, const Standard_Boolean Sense = Standard_True);
153 //! Returns the Basis surface of <me>.
154 Standard_EXPORT Handle(Geom_Surface) BasisSurface() const;
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.
160 Standard_EXPORT void UReverse() Standard_OVERRIDE;
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.
165 Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
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.
171 Standard_EXPORT void VReverse() Standard_OVERRIDE;
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.
176 Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
178 //! Returns the parametric bounds U1, U2, V1 and V2 of this patch.
179 Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
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.
188 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
190 //! Returns true if this patch is closed in the given parametric direction.
191 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
193 //! Returns true if this patch is closed in the given parametric direction.
194 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
197 //! Returns true if the order of derivation in the U parametric
200 Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
203 //! Returns true if the order of derivation in the V parametric
206 Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
208 //! Returns true if this patch is periodic in the given
209 //! parametric direction.
210 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
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;
218 //! Returns true if this patch is periodic in the given
219 //! parametric direction.
220 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
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;
228 //! computes the U isoparametric curve.
229 Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
231 //! Computes the V isoparametric curve.
232 Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
235 //! Can be raised if the basis surface is an OffsetSurface.
236 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
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.
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;
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.
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;
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.
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;
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.
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;
266 //! Applies the transformation T to this patch.
268 //! As a consequence, the basis surface included in the
269 //! data structure of this patch is also modified.
270 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
272 //! Computes the parameters on the transformed surface for
273 //! the transform of the point of parameters U,V on <me>.
275 //! me->Transformed(T)->Value(U',V')
277 //! is the same point as
279 //! me->Value(U,V).Transformed(T)
281 //! Where U',V' are the new values of U,V after calling
283 //! me->TranformParameters(U,V,T)
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;
288 //! Returns a 2d transformation used to find the new
289 //! parameters of a point on the transformed surface.
291 //! me->Transformed(T)->Value(U',V')
293 //! is the same point as
295 //! me->Value(U,V).Transformed(T)
297 //! Where U',V' are obtained by transforming U,V with
298 //! th 2d transformation returned by
300 //! me->ParametricTransformation(T)
302 //! This methods calls the basis surface method.
303 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
305 //! Creates a new object which is a copy of this patch.
306 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
311 DEFINE_STANDARD_RTTI(Geom_RectangularTrimmedSurface,Geom_BoundedSurface)
321 //! General set trim, to implement constructors and
323 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);
325 Handle(Geom_Surface) basisSurf;
326 Standard_Real utrim1;
327 Standard_Real vtrim1;
328 Standard_Real utrim2;
329 Standard_Real vtrim2;
330 Standard_Boolean isutrimmed;
331 Standard_Boolean isvtrimmed;
342 #endif // _Geom_RectangularTrimmedSurface_HeaderFile