1 -- Created on: 1993-03-10
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 class TrimmedCurve from Geom inherits BoundedCurve from Geom
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.
45 raises ConstructionError from Standard,
46 RangeError from Standard,
47 NoSuchObject from Standard,
48 UndefinedDerivative from Geom,
49 UndefinedValue from Geom
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
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.
86 -- Standard_ConstructionError if:
87 -- - C is not periodic and U1 or U2 is outside the
89 -- - U1 is equal to U2.
90 raises ConstructionError;
95 Reverse (me : mutable);
96 ---Purpose : Changes the orientation of this trimmed curve.
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).
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.
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.
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.
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;
139 BasisCurve (me) returns Curve;
140 ---Purpose : Returns the basis curve.
142 -- This function does not return a constant reference.
143 -- Consequently, any modification of the returned value
144 -- directly modifies the trimmed curve.
147 Continuity (me) returns Shape from GeomAbs;
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.
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.
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.
166 ---Purpose : Raised if N < 0.
169 EndPoint (me) returns Pnt;
171 -- Returns the end point of <me>. This point is the
172 -- evaluation of the curve for the "LastParameter".
175 FirstParameter (me) returns Real;
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.
182 IsClosed (me) returns Boolean;
184 -- Returns True if the distance between the StartPoint and
185 -- the EndPoint is lower or equal to Resolution from package gp.
188 IsPeriodic (me) returns Boolean;
189 ---Purpose : Returns true if the basis curve of this trimmed curve is periodic.
192 Period (me) returns Real from Standard
193 ---Purpose: Returns the period of the basis curve of this trimmed curve.
195 -- Standard_NoSuchObject if the basis curve is not periodic.
197 NoSuchObject from Standard
201 LastParameter (me) returns Real;
203 -- Returns the value of the last parameter of <me>.
204 -- The last parameter is the parameter of the "EndPoint" of the
208 StartPoint (me) returns Pnt;
210 -- Returns the start point of <me>.
211 -- This point is the evaluation of the curve from the
219 ---Purpose : value and derivatives
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.
226 D0(me; U : Real; P : out Pnt);
227 ---Purpose: Returns in P the point of parameter U.
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).
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.
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.
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.
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.
254 ---Purpose : Raised if N < 1.
260 ---Purpose : geometric transformations
262 Transform (me : mutable; T : Trsf);
263 --- Purpose: Applies the transformation T to this trimmed curve.
264 -- Warning The basis curve is also modified.
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>.
270 -- me->Transformed(T)->Value(me->TransformedParameter(U,T))
272 -- is the same point as
274 -- me->Value(U).Transformed(T)
276 -- This methods calls the basis curve method.
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
284 -- Transformed(T)->Value(U * ParametricTransformation(T))
286 -- is the same point as
288 -- Value(U).Transformed(T)
290 -- This methods calls the basis curve method.
293 Copy (me) returns mutable like me;
294 ---Purpose: Creates a new object which is a copy of this trimmed curve.