1 -- Created on: 1993-03-24
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.
27 class TrimmedCurve from Geom2d inherits BoundedCurve from Geom2d
30 -- Defines a portion of a curve limited by two values of
31 -- parameters inside the parametric domain of the curve.
32 -- The trimmed curve is defined by:
33 -- - the basis curve, and
34 -- - the two parameter values which limit it.
35 -- The trimmed curve can either have the same
36 -- orientation as the basis curve or the opposite orientation.
47 raises ConstructionError from Standard,
48 RangeError from Standard,
49 NoSuchObject from Standard,
50 UndefinedDerivative from Geom2d,
51 UndefinedValue from Geom2d
56 Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True)
57 returns mutable TrimmedCurve
59 -- Creates a trimmed curve from the basis curve C limited between
62 -- . U1 can be greater or lower than U2.
63 -- . The returned curve is oriented from U1 to U2.
64 -- . If the basis curve C is periodic there is an ambiguity
65 -- because two parts are available. In this case by default
66 -- the trimmed curve has the same orientation as the basis
67 -- curve (Sense = True). If Sense = False then the orientation
68 -- of the trimmed curve is opposite to the orientation of the
70 -- If the curve is closed but not periodic it is not possible
71 -- to keep the part of the curve including the junction point
72 -- (except if the junction point is at the beginning or
73 -- at the end of the trimmed curve) because you could lose the
74 -- fundamental characteristics of the basis curve which are
75 -- used for example to compute the derivatives of the trimmed
76 -- curve. So for a closed curve the rules are the same as for
79 -- In this package the entities are not shared. The TrimmedCurve is
80 -- built with a copy of the curve C. So when C is modified the
81 -- TrimmedCurve is not modified
83 -- If <C> is periodic, parametrics bounds of the TrimmedCurve,
84 -- can be different to [<U1>;<U2>}, if <U1> or <U2> are not in the
87 -- For more explanation see the scheme given with this class.
88 -- Raises ConstructionError the C is not periodic and U1 or U2 are out of
91 raises ConstructionError;
96 Reverse (me : mutable);
98 -- Changes the direction of parametrization of <me>. The first and
99 -- the last parametric values are modified. The "StartPoint"
100 -- of the initial curve becomes the "EndPoint" of the reversed
101 -- curve and the "EndPoint" of the initial curve becomes the
102 -- "StartPoint" of the reversed curve.
103 -- Example - If the trimmed curve is defined by:
104 -- - a basis curve whose parameter range is [ 0.,1. ], and
105 -- - the two trim values U1 (first parameter) and U2 (last parameter),
106 -- the reversed trimmed curve is defined by:
107 -- - the reversed basis curve, whose parameter range is still [ 0.,1. ], and
108 -- - the two trim values 1. - U2 (first parameter)
109 -- and 1. - U1 (last parameter).
111 ReversedParameter(me; U : Real) returns Real;
112 ---Purpose: Returns the parameter on the reversed curve for
113 -- the point of parameter U on <me>.
115 -- returns UFirst + ULast - U
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
128 -- of 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 global continuity of the basis curve of this trimmed 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
159 -- Returns True if the order of continuity of the
160 -- trimmed curve is N. A trimmed 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 Pnt2d;
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
189 IsPeriodic (me) returns Boolean;
190 --- Purpose : Returns true if the basis curve of this trimmed curve is periodic.
193 Period (me) returns Real from Standard
194 ---Purpose: Returns the period of the basis curve of this trimmed curve.
196 -- Standard_NoSuchObject if the basis curve is not periodic.
198 NoSuchObject from Standard
202 LastParameter (me) returns Real;
204 -- Returns the value of the last parameter of <me>.
205 -- The last parameter is the parameter of the "EndPoint" of the
209 StartPoint (me) returns Pnt2d;
211 -- Returns the start point of <me>.
212 -- This point is the evaluation of the curve from the
215 --- Purpose : value and derivatives
217 -- The returned derivatives have the same orientation as the
218 -- derivatives of the basis curve.
221 D0 (me; U : Real; P : out Pnt2d)
222 raises UndefinedValue;
224 -- If the basis curve is an OffsetCurve sometimes it is not
225 -- possible to do the evaluation of the curve at the parameter
226 -- U (see class OffsetCurve).
229 D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d)
230 raises UndefinedDerivative;
231 --- Purpose : Raised if the continuity of the curve is not C1.
234 D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d)
235 raises UndefinedDerivative;
236 --- Purpose : Raised if the continuity of the curve is not C2.
239 D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d)
240 raises UndefinedDerivative;
241 --- Purpose : Raised if the continuity of the curve is not C3.
244 DN (me; U : Real; N : Integer) returns Vec2d
245 --- Purpose : For the point of parameter U of this trimmed curve,
246 -- computes the vector corresponding to the Nth derivative.
248 -- The returned derivative vector has the same
249 -- orientation as the derivative vector of the basis curve,
250 -- even if the trimmed curve does not have the same
251 -- orientation as the basis curve.
253 -- Standard_RangeError if N is less than 1.
254 raises UndefinedDerivative,
258 --- Purpose : geometric transformations
260 Transform (me : mutable; T : Trsf2d);
261 --- Purpose : Applies the transformation T to this trimmed curve.
262 -- Warning The basis curve is also modified.
264 TransformedParameter(me; U : Real; T : Trsf2d from gp) returns Real
265 ---Purpose: Returns the parameter on the transformed curve for
266 -- the transform of the point of parameter U on <me>.
268 -- me->Transformed(T)->Value(me->TransformedParameter(U,T))
270 -- is the same point as
272 -- me->Value(U).Transformed(T)
274 -- This methods calls the basis curve method.
277 ParametricTransformation(me; T : Trsf2d from gp) returns Real
278 ---Purpose: Returns a coefficient to compute the parameter on
279 -- the transformed curve for the transform of the
282 -- Transformed(T)->Value(U * ParametricTransformation(T))
284 -- is the same point as
286 -- Value(U).Transformed(T)
288 -- This methods calls the basis curve method.
293 Copy (me) returns mutable like me;
295 -- Creates a new object, which is a copy of this trimmed curve.
299 basisCurve : Curve from Geom2d;