0022939: Make B-Spline internal cache thread-safe to be used in multy-threaded mode
[occt.git] / src / Geom / Geom_TrimmedCurve.cdl
1 -- Created on: 1993-03-10
2 -- Created by: JCV
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21
22
23 class TrimmedCurve from Geom inherits BoundedCurve from Geom
24
25
26         ---Purpose : Describes a portion of a curve (termed the "basis
27         -- curve") limited by two parameter values inside the
28         -- parametric domain of the basis curve.
29         -- The trimmed curve is defined by:
30         -- - the basis curve, and
31         -- - the two parameter values which limit it.
32         -- The trimmed curve can either have the same
33         -- orientation as the basis curve or the opposite orientation.
34
35 uses Ax1      from gp,
36      Ax2      from gp,
37      Pnt      from gp, 
38      Trsf     from gp,
39      Vec      from gp,
40      Curve    from Geom,
41      Geometry from Geom,
42      Shape    from GeomAbs
43
44
45 raises ConstructionError   from Standard,
46        RangeError          from Standard,
47        NoSuchObject        from Standard,
48        UndefinedDerivative from Geom,
49        UndefinedValue      from Geom
50
51
52 is
53
54
55   Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True)
56      returns mutable TrimmedCurve
57         ---Purpose : Constructs a trimmed curve from the basis curve C
58         -- which is limited between parameter values U1 and U2.
59         -- Note: - U1 can be greater or less than U2; in both cases,
60         --   the returned curve is oriented from U1 to U2.
61         -- - If the basis curve C is periodic, there is an
62         --   ambiguity because two parts are available. In this
63         --   case, the trimmed curve has the same orientation
64         --   as the basis curve if Sense is true (default value)
65         --   or the opposite orientation if Sense is false.
66         -- - If the curve is closed but not periodic, it is not
67         --   possible to keep the part of the curve which
68         --   includes the junction point (except if the junction
69         --   point is at the beginning or at the end of the
70         --   trimmed curve). If you tried to do this, you could
71         --   alter the fundamental characteristics of the basis
72         --   curve, which are used, for example, to compute
73         --   the derivatives of the trimmed curve. The rules
74         --   for a closed curve are therefore the same as
75         --   those for an open curve.
76         -- Warning: The trimmed curve is built from a copy of curve C.
77         --   Therefore, when C is modified, the trimmed curve
78         --   is not modified.
79         -- - If the basis curve is periodic, the bounds of the
80         --   trimmed curve may be different from U1 and U2
81         --   if the parametric origin of the basis curve is within
82         --   the arc of the trimmed curve. In this case, the
83         --   modified parameter will be equal to U1 or U2
84         --   plus or minus the period.
85         --   Exceptions
86         -- Standard_ConstructionError if:
87         -- - C is not periodic and U1 or U2 is outside the
88         --   bounds of C, or
89         -- - U1 is equal to U2.
90      raises ConstructionError;
91     
92
93
94
95   Reverse (me : mutable);
96         ---Purpose : Changes the orientation of this trimmed curve.
97         -- As a result:
98         -- - the basis curve is reversed,
99         -- - the start point of the initial curve becomes the
100         --   end point of the reversed curve,
101         -- - the end point of the initial curve becomes the
102         --   start point of the reversed curve,
103         -- - the first and last parameters are recomputed.
104         --   If the trimmed curve was defined by:
105         -- - a basis curve whose parameter range is [ 0., 1. ],
106         -- - the two trim values U1 (first parameter) and U2 (last parameter),
107         --   the reversed trimmed curve is defined by:
108         -- - the reversed basis curve, whose parameter range is still [ 0., 1. ],
109         -- - the two trim values 1. - U2 (first parameter) and 1. - U1 (last parameter).
110      
111
112
113   ReversedParameter(me; U : Real) returns Real;
114         ---Purpose: Computes the parameter on the reversed curve for
115         -- the point of parameter U on this trimmed curve.
116
117
118   SetTrim (me : mutable; U1, U2 : Real; Sense : Boolean = Standard_True)
119         ---Purpose :  Changes this trimmed curve, by redefining the
120         -- parameter values U1 and U2 which limit its basis curve.
121         -- Note: If the basis curve is periodic, the trimmed curve
122         -- has the same orientation as the basis curve if Sense
123         -- is true (default value) or the opposite orientation if Sense is false.
124         -- Warning
125         -- If the basis curve is periodic, the bounds of the
126         -- trimmed curve may be different from U1 and U2 if the
127         -- parametric origin of the basis curve is within the arc of
128         -- the trimmed curve. In this case, the modified
129         -- parameter will be equal to U1 or U2 plus or minus the period.
130         -- Exceptions
131         -- Standard_ConstructionError if:
132         -- - the basis curve is not periodic, and either U1 or U2
133         --   are outside the bounds of the basis curve, or
134         -- - U1 is equal to U2.
135      raises ConstructionError;
136       
137
138
139   BasisCurve (me)    returns Curve;
140         ---Purpose : Returns the basis curve. 
141         --   Warning
142         -- This function does not return a constant reference.
143         -- Consequently, any modification of the returned value
144         -- directly modifies the trimmed curve.
145
146
147   Continuity (me)  returns Shape from GeomAbs;
148         ---Purpose :
149         --  Returns the continuity of the curve :
150         -- C0 : only geometric continuity,
151         -- C1 : continuity of the first derivative all along the Curve,
152         -- C2 : continuity of the second derivative all along the Curve,
153         -- C3 : continuity of the third derivative all along the Curve,
154         -- CN : the order of continuity is infinite.
155
156
157   IsCN (me; N : Integer)   returns Boolean
158         ---Purpose : Returns true if the degree of continuity of the basis
159         -- curve of this trimmed curve is at least N. A trimmed
160         -- curve is at least "C0" continuous.
161         --  Warnings :
162         --  The continuity of the trimmed curve can be greater than
163         --  the continuity of the basis curve because you consider
164         --  only a part of the basis curve.
165      raises RangeError;
166         ---Purpose : Raised if N < 0.
167
168
169   EndPoint (me)   returns Pnt;
170         ---Purpose :
171         --  Returns the end point of <me>. This point is the
172         --  evaluation of the curve for the "LastParameter".
173
174
175   FirstParameter (me)   returns Real;
176         ---Purpose :
177         --  Returns the value of the first parameter of <me>. 
178         --  The first parameter is the parameter of the "StartPoint"
179         --  of the trimmed curve.
180
181
182   IsClosed (me)  returns Boolean;
183         ---Purpose :
184         --  Returns True if the distance between the StartPoint and
185         --  the EndPoint is lower or equal to Resolution from package gp.
186
187
188   IsPeriodic (me)   returns Boolean;
189         ---Purpose : Returns true if the basis curve of this trimmed curve is periodic.
190
191
192   Period (me) returns Real from Standard 
193         ---Purpose: Returns the period of the basis curve of this trimmed curve.
194         -- Exceptions
195         -- Standard_NoSuchObject if the basis curve is not periodic.
196   raises
197         NoSuchObject from Standard
198   is redefined;
199
200
201   LastParameter (me)  returns Real;
202         ---Purpose :
203         --  Returns the value of the last parameter of <me>.
204         --  The last parameter is the parameter of the "EndPoint" of the
205         --  trimmed curve.
206
207
208   StartPoint (me)  returns Pnt;
209         ---Purpose :
210         --  Returns the start point of <me>.
211         --  This point is the evaluation of the curve from the 
212         --  "FirstParameter".
213
214
215
216
217
218
219         ---Purpose  : value and derivatives
220         --- Warnings :
221         --  The returned derivatives have the same orientation as the
222         --  derivatives of the basis curve even if the trimmed curve 
223         --  has not the same orientation as the basis curve.
224
225
226   D0(me; U : Real; P : out Pnt);
227         ---Purpose: Returns in P the point of parameter U.
228         --          
229         --  If the basis curve is an OffsetCurve sometimes it is not 
230         --  possible to do the evaluation of the curve at the parameter
231         --  U (see class OffsetCurve).
232
233
234   D1 (me; U : Real; P : out Pnt; V1 : out Vec)
235      raises UndefinedDerivative;
236         ---Purpose : Raised if the continuity of the curve is not C1.
237
238
239   D2 (me; U : Real; P : out Pnt; V1, V2 : out Vec)
240      raises UndefinedDerivative;
241         ---Purpose : Raised if the continuity of the curve is not C2.
242
243
244   D3 (me; U : Real; P : out Pnt; V1, V2, V3 : out Vec)
245      raises UndefinedDerivative;
246         ---Purpose : Raised if the continuity of the curve is not C3.
247         
248
249   DN (me; U : Real; N : Integer)  returns Vec
250         ---Purpose  : N is the order of derivation.
251      raises  UndefinedDerivative,
252         ---Purpose : Raised if the continuity of the curve is not CN.
253              RangeError;
254         ---Purpose : Raised if N < 1.            
255
256
257
258
259
260         ---Purpose : geometric transformations
261
262   Transform (me : mutable; T : Trsf);
263         --- Purpose: Applies the transformation T to this trimmed curve.
264         -- Warning The basis curve is also modified.
265
266   TransformedParameter(me; U : Real; T : Trsf from gp) returns Real
267         ---Purpose: Returns the  parameter on the  transformed  curve for
268         --          the transform of the point of parameter U on <me>.
269         --          
270         --          me->Transformed(T)->Value(me->TransformedParameter(U,T))
271         --          
272         --          is the same point as
273         --          
274         --          me->Value(U).Transformed(T)
275         --          
276         --          This methods calls the basis curve method.
277      is redefined;  
278
279   ParametricTransformation(me; T : Trsf from gp) returns Real
280         ---Purpose: Returns a  coefficient to compute the parameter on
281         --          the transformed  curve  for  the transform  of the
282         --          point on <me>.
283         --          
284         --          Transformed(T)->Value(U * ParametricTransformation(T))
285         --          
286         --          is the same point as
287         --          
288         --          Value(U).Transformed(T)
289         --          
290         --          This methods calls the basis curve method.
291      is redefined;  
292
293   Copy (me)  returns mutable like me;
294         ---Purpose: Creates a new object which is a copy of this trimmed curve.
295     
296 fields
297
298     basisCurve : Curve;
299     uTrim1     : Real;
300     uTrim2     : Real;
301
302 end;
303
304
305
306
307