1 -- Created on: 1993-03-24
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 TrimmedCurve from Geom2d inherits BoundedCurve from Geom2d
20 -- Defines a portion of a curve limited by two values of
21 -- parameters inside the parametric domain of the curve.
22 -- The trimmed curve is defined by:
23 -- - the basis curve, and
24 -- - the two parameter values which limit it.
25 -- The trimmed curve can either have the same
26 -- orientation as the basis curve or the opposite orientation.
37 raises ConstructionError from Standard,
38 RangeError from Standard,
39 NoSuchObject from Standard,
40 UndefinedDerivative from Geom2d,
41 UndefinedValue from Geom2d
46 Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True;
47 theAdjustPeriodic : Boolean = Standard_True)
50 -- Creates a trimmed curve from the basis curve C limited between
53 -- . U1 can be greater or lower than U2.
54 -- . The returned curve is oriented from U1 to U2.
55 -- . If the basis curve C is periodic there is an ambiguity
56 -- because two parts are available. In this case by default
57 -- the trimmed curve has the same orientation as the basis
58 -- curve (Sense = True). If Sense = False then the orientation
59 -- of the trimmed curve is opposite to the orientation of the
61 -- If the curve is closed but not periodic it is not possible
62 -- to keep the part of the curve including the junction point
63 -- (except if the junction point is at the beginning or
64 -- at the end of the trimmed curve) because you could lose the
65 -- fundamental characteristics of the basis curve which are
66 -- used for example to compute the derivatives of the trimmed
67 -- curve. So for a closed curve the rules are the same as for
70 -- In this package the entities are not shared. The TrimmedCurve is
71 -- built with a copy of the curve C. So when C is modified the
72 -- TrimmedCurve is not modified
74 -- If <C> is periodic and <theAdjustPeriodic> is True, parametrics
75 -- bounds of the TrimmedCurve, can be different to [<U1>;<U2>},
76 -- if <U1> or <U2> are not in the principal period.
78 -- For more explanation see the scheme given with this class.
79 -- Raises ConstructionError the C is not periodic and U1 or U2 are out of
82 raises ConstructionError;
87 Reverse (me : mutable);
89 -- Changes the direction of parametrization of <me>. The first and
90 -- the last parametric values are modified. The "StartPoint"
91 -- of the initial curve becomes the "EndPoint" of the reversed
92 -- curve and the "EndPoint" of the initial curve becomes the
93 -- "StartPoint" of the reversed curve.
94 -- Example - If the trimmed curve is defined by:
95 -- - a basis curve whose parameter range is [ 0.,1. ], and
96 -- - the two trim values U1 (first parameter) and U2 (last parameter),
97 -- the reversed trimmed curve is defined by:
98 -- - the reversed basis curve, whose parameter range is still [ 0.,1. ], and
99 -- - the two trim values 1. - U2 (first parameter)
100 -- and 1. - U1 (last parameter).
102 ReversedParameter(me; U : Real) returns Real;
103 ---Purpose: Returns the parameter on the reversed curve for
104 -- the point of parameter U on <me>.
106 -- returns UFirst + ULast - U
109 SetTrim (me : mutable; U1, U2 : Real; Sense : Boolean = Standard_True;
110 theAdjustPeriodic : Boolean = Standard_True)
111 --- Purpose : Changes this trimmed curve, by redefining the
112 -- parameter values U1 and U2, which limit its basis curve.
113 -- Note: If the basis curve is periodic, the trimmed curve
114 -- has the same orientation as the basis curve if Sense
115 -- is true (default value) or the opposite orientation if Sense is false.
117 -- If the basis curve is periodic and theAdjustPeriodic is True,
118 -- the bounds of the trimmed curve may be different from U1 and U2 if the
119 -- parametric origin of the basis curve is within the arc
120 -- of the trimmed curve. In this case, the modified
121 -- parameter will be equal to U1 or U2 plus or minus the period.
122 -- If theAdjustPeriodic is False, parameters U1 and U2 will stay unchanged.
124 -- Standard_ConstructionError if:
125 -- - the basis curve is not periodic, and either U1 or U2
126 -- are outside the bounds of the basis curve, or
127 -- - U1 is equal to U2.
128 raises ConstructionError;
132 BasisCurve (me) returns Curve;
133 --- Purpose : Returns the basis curve.
135 -- This function does not return a constant reference.
136 -- Consequently, any modification of the returned value
137 -- directly modifies the trimmed curve.
140 Continuity (me) returns Shape from GeomAbs;
142 -- Returns the global continuity of the basis curve of this trimmed curve.
143 -- C0 : only geometric continuity,
144 -- C1 : continuity of the first derivative all along the Curve,
145 -- C2 : continuity of the second derivative all along the Curve,
146 -- C3 : continuity of the third derivative all along the Curve,
147 -- CN : the order of continuity is infinite.
150 IsCN (me; N : Integer) returns Boolean
152 -- Returns True if the order of continuity of the
153 -- trimmed curve is N. A trimmed curve is at least "C0" continuous.
155 -- The continuity of the trimmed curve can be greater than
156 -- the continuity of the basis curve because you consider
157 -- only a part of the basis curve.
159 --- Purpose : Raised if N < 0.
162 EndPoint (me) returns Pnt2d;
164 -- Returns the end point of <me>. This point is the
165 -- evaluation of the curve for the "LastParameter".
168 FirstParameter (me) returns Real;
170 -- Returns the value of the first parameter of <me>.
171 -- The first parameter is the parameter of the "StartPoint"
172 -- of the trimmed curve.
175 IsClosed (me) returns Boolean;
177 -- Returns True if the distance between the StartPoint and
178 -- the EndPoint is lower or equal to Resolution from package
182 IsPeriodic (me) returns Boolean;
183 --- Purpose : Returns true if the basis curve of this trimmed curve is periodic.
186 Period (me) returns Real from Standard
187 ---Purpose: Returns the period of the basis curve of this trimmed curve.
189 -- Standard_NoSuchObject if the basis curve is not periodic.
191 NoSuchObject from Standard
195 LastParameter (me) returns Real;
197 -- Returns the value of the last parameter of <me>.
198 -- The last parameter is the parameter of the "EndPoint" of the
202 StartPoint (me) returns Pnt2d;
204 -- Returns the start point of <me>.
205 -- This point is the evaluation of the curve from the
208 --- Purpose : value and derivatives
210 -- The returned derivatives have the same orientation as the
211 -- derivatives of the basis curve.
214 D0 (me; U : Real; P : out Pnt2d)
215 raises UndefinedValue;
217 -- If the basis curve is an OffsetCurve sometimes it is not
218 -- possible to do the evaluation of the curve at the parameter
219 -- U (see class OffsetCurve).
222 D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d)
223 raises UndefinedDerivative;
224 --- Purpose : Raised if the continuity of the curve is not C1.
227 D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d)
228 raises UndefinedDerivative;
229 --- Purpose : Raised if the continuity of the curve is not C2.
232 D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d)
233 raises UndefinedDerivative;
234 --- Purpose : Raised if the continuity of the curve is not C3.
237 DN (me; U : Real; N : Integer) returns Vec2d
238 --- Purpose : For the point of parameter U of this trimmed curve,
239 -- computes the vector corresponding to the Nth derivative.
241 -- The returned derivative vector has the same
242 -- orientation as the derivative vector of the basis curve,
243 -- even if the trimmed curve does not have the same
244 -- orientation as the basis curve.
246 -- Standard_RangeError if N is less than 1.
247 raises UndefinedDerivative,
251 --- Purpose : geometric transformations
253 Transform (me : mutable; T : Trsf2d);
254 --- Purpose : Applies the transformation T to this trimmed curve.
255 -- Warning The basis curve is also modified.
257 TransformedParameter(me; U : Real; T : Trsf2d from gp) returns Real
258 ---Purpose: Returns the parameter on the transformed curve for
259 -- the transform of the point of parameter U on <me>.
261 -- me->Transformed(T)->Value(me->TransformedParameter(U,T))
263 -- is the same point as
265 -- me->Value(U).Transformed(T)
267 -- This methods calls the basis curve method.
270 ParametricTransformation(me; T : Trsf2d from gp) returns Real
271 ---Purpose: Returns a coefficient to compute the parameter on
272 -- the transformed curve for the transform of the
275 -- Transformed(T)->Value(U * ParametricTransformation(T))
277 -- is the same point as
279 -- Value(U).Transformed(T)
281 -- This methods calls the basis curve method.
286 Copy (me) returns like me;
288 -- Creates a new object, which is a copy of this trimmed curve.
292 basisCurve : Curve from Geom2d;