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 class RectangularTrimmedSurface from Geom inherits BoundedSurface from Geom
19 ---Purpose : Describes a portion of a surface (a patch) limited
20 -- by two values of the u parameter in the u
21 -- parametric direction, and two values of the v
22 -- parameter in the v parametric direction. The
23 -- domain of the trimmed surface must be within the
24 -- domain of the surface being trimmed.
25 -- The trimmed surface is defined by:
26 -- - the basis surface, and
27 -- - the values (umin, umax) and (vmin, vmax)
28 -- which limit it in the u and v parametric directions.
29 -- The trimmed surface is built from a copy of the basis
30 -- surface. Therefore, when the basis surface is
31 -- modified the trimmed surface is not changed.
32 -- Consequently, the trimmed surface does not
33 -- necessarily have the same orientation as the basis surface.
34 -- Warning: The case of surface being trimmed is periodic and
35 -- parametrics values are outside the domain is possible.
36 -- But, domain of the trimmed surface can be translated
37 -- by (n X) the period.
50 raises ConstructionError from Standard,
51 RangeError from Standard,
52 NoSuchObject from Standard,
53 UndefinedDerivative from Geom,
54 UndefinedValue from Geom
59 Create (S : Surface from Geom;
60 U1, U2, V1, V2 : Real;
61 USense, VSense : Boolean = Standard_True)
62 returns RectangularTrimmedSurface
64 -- The U parametric direction of the surface is oriented from U1
65 -- to U2. The V parametric direction of the surface is oriented
67 -- These two directions define the orientation of the surface
68 -- (normal). If the surface is not periodic USense and VSense are
69 -- not used for the construction. If the surface S is periodic in
70 -- one direction USense and VSense give the available part of the
71 -- surface. By default in this case the surface has the same
72 -- orientation as the basis surface S.
73 -- The returned surface is not closed and not periodic.
74 -- ConstructionError Raised if
75 -- S is not periodic in the UDirection and U1 or U2 are out of the
77 -- S is not periodic in the VDirection and V1 or V2 are out of the
81 raises ConstructionError;
84 Create (S : Surface from Geom;
85 Param1, Param2 : Real;
87 Sense : Boolean = Standard_True)
88 returns RectangularTrimmedSurface
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
107 raises ConstructionError;
108 ---Purpose : Raised if
109 -- S is not periodic in the considered parametric direction and
110 -- Param1 or Param2 are out of the bounds of S.
114 SetTrim (me : mutable;
115 U1, U2, V1, V2 : Real;
116 USense, VSense : Boolean = Standard_True)
117 ---Purpose : Modifies this patch by changing the trim values
118 -- applied to the original surface
119 -- The u parametric direction of
120 -- this patch is oriented from U1 to U2. The v
121 -- parametric direction of this patch is oriented
122 -- from V1 to V2. USense and VSense are used
123 -- for the construction only if the surface is periodic
124 -- in the corresponding parametric direction, and
125 -- define the available part of the surface; by default
126 -- in this case, this patch has the same orientation
127 -- as the basis surface.
128 raises ConstructionError;
129 ---Purpose : Raised if
130 -- The BasisSurface is not periodic in the UDirection and U1 or U2
131 -- are out of the bounds of the BasisSurface.
132 -- The BasisSurface is not periodic in the VDirection and V1 or V2
133 -- are out of the bounds of the BasisSurface.
134 -- U1 = U2 or V1 = V2
137 SetTrim (me : mutable;
138 Param1, Param2 : Real;
140 Sense : Boolean = Standard_True)
141 ---Purpose : Modifies this patch by changing the trim values
142 -- applied to the original surface
143 -- The basis surface is trimmed only in one parametric direction: if UTrim
144 -- is true, the surface is trimmed in the u parametric
145 -- direction; if it is false, it is trimmed in the v
146 -- parametric direction. In the "trimmed" direction,
147 -- this patch is oriented from Param1 to Param2. If
148 -- the basis surface is periodic in the "trimmed"
149 -- direction, Sense defines its available part. By
150 -- default in this case, this patch has the same
151 -- orientation as the basis surface in this parametric
152 -- direction. If the basis surface is closed or periodic
153 -- in the other parametric direction (i.e. not the
154 -- "trimmed" direction), this patch has the same
155 -- characteristics as the basis surface in that parametric direction.
156 raises ConstructionError;
157 ---Purpose : Raised if
158 -- The BasisSurface is not periodic in the considered direction and
159 -- Param1 or Param2 are out of the bounds of the BasisSurface.
163 SetTrim (me : mutable;
164 U1, U2, V1, V2 : Real;
165 UTrim, VTrim : Boolean;
166 USense, VSense : Boolean)
167 ---Purpose : General set trim, to implement constructors and
169 raises ConstructionError
173 BasisSurface (me) returns Surface from Geom;
174 ---Purpose : Returns the Basis surface of <me>.
177 UReverse (me : mutable);
178 ---Purpose : Changes the orientation of this patch in the u
179 -- parametric direction. The bounds of the surface are
180 -- not changed, but the given parametric direction is
181 -- reversed. Hence the orientation of the surface is reversed.
184 UReversedParameter (me; U : Real) returns Real;
185 ---Purpose: Computes the u parameter on the modified
186 -- surface, produced by when reversing its u
187 -- parametric direction, for any point of u parameter U on this patch.
189 VReverse (me : mutable);
190 ---Purpose : Changes the orientation of this patch in the v
191 -- parametric direction. The bounds of the surface are
192 -- not changed, but the given parametric direction is
193 -- reversed. Hence the orientation of the surface is reversed.
197 VReversedParameter (me; V : Real) returns Real;
198 ---Purpose: Computes the v parameter on the modified
199 -- surface, produced by when reversing its v
200 -- parametric direction, for any point of v parameter V on this patch.
202 Bounds (me; U1, U2, V1, V2 : out Real);
203 ---Purpose : Returns the parametric bounds U1, U2, V1 and V2 of this patch.
206 Continuity (me) returns Shape from GeomAbs;
208 -- Returns the continuity of the surface :
209 -- C0 : only geometric continuity,
210 -- C1 : continuity of the first derivative all along the Surface,
211 -- C2 : continuity of the second derivative all along the Surface,
212 -- C3 : continuity of the third derivative all along the Surface,
213 -- CN : the order of continuity is infinite.
216 IsUClosed (me) returns Boolean;
217 ---Purpose: Returns true if this patch is closed in the given parametric direction.
219 IsVClosed (me) returns Boolean;
220 ---Purpose: Returns true if this patch is closed in the given parametric direction.
222 IsCNu (me; N : Integer) returns Boolean
224 -- Returns true if the order of derivation in the U parametric
227 ---Purpose : Raised if N < 0.
230 IsCNv (me; N : Integer) returns Boolean
232 -- Returns true if the order of derivation in the V parametric
235 ---Purpose : Raised if N < 0.
238 IsUPeriodic (me) returns Boolean;
239 ---Purpose: Returns true if this patch is periodic in the given
240 -- parametric direction.
242 UPeriod (me) returns Real from Standard
243 ---Purpose: Returns the period of this patch in the u
244 -- parametric direction.
246 NoSuchObject from Standard
247 ---Purpose: raises if the surface is not uperiodic.
251 IsVPeriodic (me) returns Boolean;
253 -- Returns true if this patch is periodic in the given
254 -- parametric direction.
256 VPeriod (me) returns Real from Standard
257 ---Purpose: Returns the period of this patch in the v
258 -- parametric direction.
260 NoSuchObject from Standard
261 ---Purpose: raises if the surface is not vperiodic.
266 ---Purpose : value and derivatives
269 UIso (me; U : Real) returns Curve;
270 ---Purpose : computes the U isoparametric curve.
273 VIso (me; V : Real) returns Curve;
274 ---Purpose : Computes the V isoparametric curve.
277 D0 (me; U, V : Real; P : out Pnt)
278 raises UndefinedValue;
280 -- Can be raised if the basis surface is an OffsetSurface.
283 D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec)
285 -- The returned derivatives have the same orientation as the
286 -- derivatives of the basis surface even if the trimmed surface
287 -- has not the same parametric orientation.
288 -- Warning! UndefinedDerivative raised if the continuity of the surface is not C1.
289 raises UndefinedDerivative;
292 D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec)
294 -- The returned derivatives have the same orientation as the
295 -- derivatives of the basis surface even if the trimmed surface
296 -- has not the same parametric orientation.
297 -- Warning! UndefinedDerivative raised if the continuity of the surface is not C2.
298 raises UndefinedDerivative;
301 D3 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV,
302 D3U, D3V, D3UUV, D3UVV : out Vec)
303 --- Purposes : The returned derivatives have the same orientation as the
304 -- derivatives of the basis surface even if the trimmed surface
305 -- has not the same parametric orientation.
306 -- Warning UndefinedDerivative raised if the continuity of the surface is not C3.
307 raises UndefinedDerivative;
310 DN (me; U, V : Real; Nu, Nv : Integer) returns Vec
311 ---Purpose : The returned derivative has the same orientation as the
312 -- derivative of the basis surface even if the trimmed surface
313 -- has not the same parametric orientation.
314 -- Warning! UndefinedDerivative raised if the continuity of the surface is not CNu in the U
315 -- parametric direction and CNv in the V parametric direction.
316 -- RangeError Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
317 raises UndefinedDerivative,
322 Transform (me : mutable; T : Trsf);
323 ---Purpose: Applies the transformation T to this patch.
325 -- As a consequence, the basis surface included in the
326 -- data structure of this patch is also modified.
328 TransformParameters(me; U,V : in out Real; T : Trsf from gp)
329 ---Purpose: Computes the parameters on the transformed surface for
330 -- the transform of the point of parameters U,V on <me>.
332 -- me->Transformed(T)->Value(U',V')
334 -- is the same point as
336 -- me->Value(U,V).Transformed(T)
338 -- Where U',V' are the new values of U,V after calling
340 -- me->TranformParameters(U,V,T)
342 -- This methods calls the basis surface method.
345 ParametricTransformation(me; T : Trsf from gp) returns GTrsf2d from gp
346 ---Purpose: Returns a 2d transformation used to find the new
347 -- parameters of a point on the transformed surface.
349 -- me->Transformed(T)->Value(U',V')
351 -- is the same point as
353 -- me->Value(U,V).Transformed(T)
355 -- Where U',V' are obtained by transforming U,V with
356 -- th 2d transformation returned by
358 -- me->ParametricTransformation(T)
360 -- This methods calls the basis surface method.
363 Copy (me) returns like me;
364 ---Purpose: Creates a new object which is a copy of this patch.
367 basisSurf : Surface from Geom;
372 isutrimmed : Boolean;
373 isvtrimmed : Boolean;