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