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