b311480e |
1 | -- Created on: 1993-03-24 |
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 | |
7fd59977 |
21 | |
7fd59977 |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | class TrimmedCurve from Geom2d inherits BoundedCurve from Geom2d |
28 | |
29 | --- Purpose : |
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. |
37 | |
38 | uses Ax2d from gp, |
39 | Pnt2d from gp, |
40 | Trsf2d from gp, |
41 | Vec2d from gp, |
42 | Curve from Geom2d, |
43 | Geometry from Geom2d, |
44 | Shape from GeomAbs |
45 | |
46 | |
47 | raises ConstructionError from Standard, |
48 | RangeError from Standard, |
49 | NoSuchObject from Standard, |
50 | UndefinedDerivative from Geom2d, |
51 | UndefinedValue from Geom2d |
52 | |
53 | |
54 | is |
55 | |
56 | Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True) |
57 | returns mutable TrimmedCurve |
58 | --- Purpose : |
59 | -- Creates a trimmed curve from the basis curve C limited between |
60 | -- U1 and U2. |
61 | -- |
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 |
69 | -- basis curve C. |
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 |
77 | -- a open curve. |
78 | -- Warnings : |
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 |
82 | -- Warnings : |
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 |
85 | -- principal period. |
86 | -- Include : |
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 |
89 | -- the bounds of C. |
90 | -- Raised if U1 = U2. |
91 | raises ConstructionError; |
92 | |
93 | |
94 | |
95 | |
96 | Reverse (me : mutable); |
97 | --- Purpose : |
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). |
110 | |
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>. |
114 | -- |
115 | -- returns UFirst + ULast - U |
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 |
128 | -- of 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 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. |
155 | |
156 | |
157 | IsCN (me; N : Integer) returns Boolean |
158 | --- Purpose |
159 | -- Returns True if the order of continuity of the |
160 | -- trimmed curve is N. A trimmed 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 Pnt2d; |
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 |
186 | -- gp. |
187 | |
188 | |
189 | IsPeriodic (me) returns Boolean; |
190 | --- Purpose : Returns true if the basis curve of this trimmed curve is periodic. |
191 | |
192 | |
193 | Period (me) returns Real from Standard |
194 | ---Purpose: Returns the period of the basis curve of this trimmed curve. |
195 | -- Exceptions |
196 | -- Standard_NoSuchObject if the basis curve is not periodic. |
197 | raises |
198 | NoSuchObject from Standard |
199 | is redefined; |
200 | |
201 | |
202 | LastParameter (me) returns Real; |
203 | --- Purpose : |
204 | -- Returns the value of the last parameter of <me>. |
205 | -- The last parameter is the parameter of the "EndPoint" of the |
206 | -- trimmed curve. |
207 | |
208 | |
209 | StartPoint (me) returns Pnt2d; |
210 | --- Purpose : |
211 | -- Returns the start point of <me>. |
212 | -- This point is the evaluation of the curve from the |
213 | -- "FirstParameter". |
214 | |
215 | --- Purpose : value and derivatives |
216 | --- Warnings : |
217 | -- The returned derivatives have the same orientation as the |
218 | -- derivatives of the basis curve. |
219 | |
220 | |
221 | D0 (me; U : Real; P : out Pnt2d) |
222 | raises UndefinedValue; |
223 | --- Purpose: |
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). |
227 | |
228 | |
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. |
232 | |
233 | |
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. |
237 | |
238 | |
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. |
242 | |
243 | |
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. |
247 | -- Warning |
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. |
252 | -- Exceptions |
253 | -- Standard_RangeError if N is less than 1. |
254 | raises UndefinedDerivative, |
255 | RangeError; |
256 | |
257 | |
258 | --- Purpose : geometric transformations |
259 | |
260 | Transform (me : mutable; T : Trsf2d); |
261 | --- Purpose : Applies the transformation T to this trimmed curve. |
262 | -- Warning The basis curve is also modified. |
263 | |
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>. |
267 | -- |
268 | -- me->Transformed(T)->Value(me->TransformedParameter(U,T)) |
269 | -- |
270 | -- is the same point as |
271 | -- |
272 | -- me->Value(U).Transformed(T) |
273 | -- |
274 | -- This methods calls the basis curve method. |
275 | is redefined; |
276 | |
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 |
280 | -- point on <me>. |
281 | -- |
282 | -- Transformed(T)->Value(U * ParametricTransformation(T)) |
283 | -- |
284 | -- is the same point as |
285 | -- |
286 | -- Value(U).Transformed(T) |
287 | -- |
288 | -- This methods calls the basis curve method. |
289 | is redefined; |
290 | |
291 | |
292 | |
293 | Copy (me) returns mutable like me; |
294 | ---Purpose: |
295 | -- Creates a new object, which is a copy of this trimmed curve. |
296 | |
297 | fields |
298 | |
299 | basisCurve : Curve from Geom2d; |
300 | uTrim1 : Real; |
301 | uTrim2 : Real; |
302 | |
303 | end; |