b311480e |
1 | -- Created on: 1993-03-09 |
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 | -- RBD : 15/10/98 ; Suppression de la methode privee coefficientsOK |
7fd59977 |
22 | |
23 | |
24 | class BezierSurface from Geom inherits BoundedSurface from Geom |
25 | |
26 | ---Purpose : Describes a rational or non-rational Bezier surface. |
27 | -- - A non-rational Bezier surface is defined by a table |
28 | -- of poles (also known as control points). |
29 | -- - A rational Bezier surface is defined by a table of |
30 | -- poles with varying associated weights. |
31 | -- This data is manipulated using two associative 2D arrays: |
32 | -- - the poles table, which is a 2D array of gp_Pnt, and |
33 | -- - the weights table, which is a 2D array of reals. |
34 | -- The bounds of these arrays are: |
35 | -- - 1 and NbUPoles for the row bounds, where |
36 | -- NbUPoles is the number of poles of the surface |
37 | -- in the u parametric direction, and |
38 | -- - 1 and NbVPoles for the column bounds, where |
39 | -- NbVPoles is the number of poles of the surface |
40 | -- in the v parametric direction. |
41 | -- The poles of the surface, the "control points", are the |
42 | -- points used to shape and reshape the surface. They |
43 | -- comprise a rectangular network of points: |
44 | -- - The points (1, 1), (NbUPoles, 1), (1, |
45 | -- NbVPoles) and (NbUPoles, NbVPoles) |
46 | -- are the four parametric "corners" of the surface. |
47 | -- - The first column of poles and the last column of |
48 | -- poles define two Bezier curves which delimit the |
49 | -- surface in the v parametric direction. These are |
50 | -- the v isoparametric curves corresponding to |
51 | -- values 0 and 1 of the v parameter. |
52 | -- - The first row of poles and the last row of poles |
53 | -- define two Bezier curves which delimit the surface |
54 | -- in the u parametric direction. These are the u |
55 | -- isoparametric curves corresponding to values 0 |
56 | -- and 1 of the u parameter. |
57 | -- It is more difficult to define a geometrical significance |
58 | -- for the weights. However they are useful for |
59 | -- representing a quadric surface precisely. Moreover, if |
60 | -- the weights of all the poles are equal, the surface has |
61 | -- a polynomial equation, and hence is a "non-rational surface". |
62 | -- The non-rational surface is a special, but frequently |
63 | -- used, case, where all poles have identical weights. |
64 | -- The weights are defined and used only in the case of |
65 | -- a rational surface. This rational characteristic is |
66 | -- defined in each parametric direction. Hence, a |
67 | -- surface can be rational in the u parametric direction, |
68 | -- and non-rational in the v parametric direction. |
69 | -- Likewise, the degree of a surface is defined in each |
70 | -- parametric direction. The degree of a Bezier surface |
71 | -- in a given parametric direction is equal to the number |
72 | -- of poles of the surface in that parametric direction, |
73 | -- minus 1. This must be greater than or equal to 1. |
74 | -- However, the degree for a Geom_BezierSurface is |
75 | -- limited to a value of (25) which is defined and |
76 | -- controlled by the system. This value is returned by the |
77 | -- function MaxDegree. |
78 | -- The parameter range for a Bezier surface is [ 0, 1 ] |
79 | -- in the two parametric directions. |
80 | -- A Bezier surface can also be closed, or open, in each |
81 | -- parametric direction. If the first row of poles is |
82 | -- identical to the last row of poles, the surface is closed |
83 | -- in the u parametric direction. If the first column of |
84 | -- poles is identical to the last column of poles, the |
85 | -- surface is closed in the v parametric direction. |
86 | -- The continuity of a Bezier surface is infinite in the u |
87 | -- parametric direction and the in v parametric direction. |
88 | -- Note: It is not possible to build a Bezier surface with |
89 | -- negative weights. Any weight value that is less than, |
90 | -- or equal to, gp::Resolution() is considered |
91 | -- to be zero. Two weight values, W1 and W2, are |
92 | -- considered equal if: |W2-W1| <= gp::Resolution() |
93 | |
94 | |
95 | uses Array1OfReal from TColStd, |
96 | Array2OfReal from TColStd, |
97 | HArray2OfReal from TColStd, |
98 | Array1OfPnt from TColgp, |
99 | Array2OfPnt from TColgp, |
100 | Ax1 from gp, |
101 | Ax2 from gp, |
102 | HArray2OfPnt from TColgp, |
103 | Pnt from gp, |
104 | Trsf from gp, |
105 | Vec from gp, |
106 | Curve from Geom, |
107 | Geometry from Geom, |
108 | Shape from GeomAbs |
109 | |
110 | |
111 | raises ConstructionError from Standard, |
112 | DimensionError from Standard, |
113 | RangeError from Standard, |
114 | OutOfRange from Standard |
115 | |
116 | is |
117 | |
118 | Create (SurfacePoles : Array2OfPnt from TColgp) |
119 | returns mutable BezierSurface |
120 | ---Purpose : |
121 | -- Creates a non-rational Bezier surface with a set of poles. |
122 | -- Control points representation : |
123 | -- SPoles(Uorigin,Vorigin) ...................SPoles(Uorigin,Vend) |
124 | -- . . |
125 | -- . . |
126 | -- SPoles(Uend, Vorigin) .....................SPoles(Uend, Vend) |
127 | -- For the double array the row indice corresponds to the parametric |
128 | -- U direction and the columns indice corresponds to the parametric |
129 | -- V direction. |
130 | -- The weights are defaulted to all being 1. |
131 | raises ConstructionError; |
132 | ---Purpose : |
133 | -- Raised if the number of poles of the surface is lower than 2 |
134 | -- or greater than MaxDegree + 1 in one of the two directions |
135 | -- U or V. |
136 | |
137 | |
138 | Create (SurfacePoles : Array2OfPnt from TColgp; |
139 | PoleWeights : Array2OfReal from TColStd) |
140 | returns mutable BezierSurface |
141 | ---Purpose |
142 | -- Creates a rational Bezier surface with a set of poles and a |
143 | -- set of weights. |
144 | -- For the double array the row indice corresponds to the parametric |
145 | -- U direction and the columns indice corresponds to the parametric |
146 | -- V direction. |
147 | -- If all the weights are identical the surface is considered as |
148 | -- non-rational (the tolerance criterion is Resolution from package |
149 | -- gp). |
150 | raises ConstructionError; |
151 | ---Purpose : |
152 | -- Raised if SurfacePoles and PoleWeights have not the same |
153 | -- Rowlength or have not the same ColLength. |
154 | -- Raised if PoleWeights (i, j) <= Resolution from gp; |
155 | -- Raised if the number of poles of the surface is lower than 2 |
156 | -- or greater than MaxDegree + 1 in one of the two directions U or V. |
157 | |
158 | |
159 | ExchangeUV (me : mutable); |
160 | ---Purpose : Exchanges the direction U and V on a Bezier surface |
161 | -- As a consequence: |
162 | -- - the poles and weights tables are transposed, |
163 | -- - degrees, rational characteristics and so on are |
164 | -- exchanged between the two parametric directions, and |
165 | -- - the orientation of the surface is reversed. |
166 | |
167 | Increase (me : mutable; UDeg, VDeg : Integer) |
168 | ---Purpose : Increases the degree of this Bezier surface in the two parametric directions. |
169 | raises ConstructionError; |
170 | ---Purpose : |
171 | -- Raised if UDegree < UDegree <me> or VDegree < VDegree <me> |
172 | -- Raised if the degree of the surface is greater than MaxDegree |
173 | -- in one of the two directions U or V. |
174 | |
175 | |
176 | InsertPoleColAfter (me : mutable; VIndex : Integer; |
177 | CPoles : Array1OfPnt from TColgp) |
178 | ---Purpose: |
179 | -- Inserts a column of poles. If the surface is rational the weights |
180 | -- values associated with CPoles are equal defaulted to 1. |
181 | raises OutOfRange, |
182 | ---Purpose: |
183 | -- Raised if Vindex < 1 or VIndex > NbVPoles. |
184 | ConstructionError; |
185 | ---Purpose: |
186 | -- raises if VDegree is greater than MaxDegree. |
187 | -- raises if the Length of CPoles is not equal to NbUPoles |
188 | |
189 | |
190 | InsertPoleColAfter (me : mutable; VIndex : Integer; |
191 | CPoles : Array1OfPnt from TColgp; |
192 | CPoleWeights : Array1OfReal from TColStd) |
193 | ---Purpose : |
194 | -- Inserts a column of poles and weights. |
195 | -- If the surface was non-rational it can become rational. |
196 | raises OutOfRange, |
197 | ---Purpose: |
198 | -- Raised if Vindex < 1 or VIndex > NbVPoles. |
199 | ConstructionError; |
200 | ---Purpose : Raised if |
201 | -- . VDegree is greater than MaxDegree. |
202 | -- . the Length of CPoles is not equal to NbUPoles |
203 | -- . a weight value is lower or equal to Resolution from |
204 | -- package gp |
205 | |
206 | |
207 | InsertPoleColBefore (me : mutable; VIndex : Integer; |
208 | CPoles : Array1OfPnt from TColgp) |
209 | ---Purpose: |
210 | -- Inserts a column of poles. If the surface is rational the weights |
211 | -- values associated with CPoles are equal defaulted to 1. |
212 | raises OutOfRange, |
213 | ---Purpose: |
214 | -- Raised if Vindex < 1 or VIndex > NbVPoles. |
215 | ConstructionError; |
216 | ---Purpose: |
217 | -- Raised if VDegree is greater than MaxDegree. |
218 | -- Raised if the Length of CPoles is not equal to NbUPoles |
219 | |
220 | |
221 | |
222 | InsertPoleColBefore (me : mutable; VIndex : Integer; |
223 | CPoles : Array1OfPnt from TColgp; |
224 | CPoleWeights : Array1OfReal from TColStd) |
225 | ---Purpose : |
226 | -- Inserts a column of poles and weights. |
227 | -- If the surface was non-rational it can become rational. |
228 | raises OutOfRange, |
229 | ---Purpose: |
230 | -- Raised if Vindex < 1 or VIndex > NbVPoles. |
231 | ConstructionError; |
232 | ---Purpose : Raised if : |
233 | -- . VDegree is greater than MaxDegree. |
234 | -- . the Length of CPoles is not equal to NbUPoles |
235 | -- . a weight value is lower or equal to Resolution from |
236 | -- package gp |
237 | |
238 | |
239 | InsertPoleRowAfter (me : mutable; UIndex : Integer; |
240 | CPoles : Array1OfPnt from TColgp) |
241 | ---Purpose: |
242 | -- Inserts a row of poles. If the surface is rational the weights |
243 | -- values associated with CPoles are equal defaulted to 1. |
244 | raises OutOfRange, |
245 | ---Purpose: |
246 | -- Raised if Uindex < 1 or UIndex > NbUPoles. |
247 | ConstructionError; |
248 | ---Purpose: |
249 | -- Raised if UDegree is greater than MaxDegree. |
250 | -- Raised if the Length of CPoles is not equal to NbVPoles |
251 | |
252 | |
253 | InsertPoleRowAfter (me : mutable; UIndex : Integer; |
254 | CPoles : Array1OfPnt from TColgp; |
255 | CPoleWeights : Array1OfReal from TColStd) |
256 | ---Purpose : |
257 | -- Inserts a row of poles and weights. |
258 | -- If the surface was non-rational it can become rational. |
259 | raises OutOfRange, |
260 | ---Purpose: |
261 | -- Raised if Uindex < 1 or UIndex > NbUPoles. |
262 | ConstructionError; |
263 | ---Purpose : Raised if : |
264 | -- . UDegree is greater than MaxDegree. |
265 | -- . the Length of CPoles is not equal to NbVPoles |
266 | -- . a weight value is lower or equal to Resolution from |
267 | -- package gp |
268 | |
269 | |
270 | InsertPoleRowBefore (me : mutable; UIndex : Integer; |
271 | CPoles : Array1OfPnt from TColgp) |
272 | ---Purpose: |
273 | -- Inserts a row of poles. If the surface is rational the weights |
274 | -- values associated with CPoles are equal defaulted to 1. |
275 | raises OutOfRange, |
276 | ---Purpose: |
277 | -- Raised if Uindex < 1 or UIndex > NbUPoles. |
278 | ConstructionError; |
279 | ---Purpose: |
280 | -- Raised if UDegree is greater than MaxDegree. |
281 | -- Raised if the Length of CPoles is not equal to NbVPoles |
282 | |
283 | |
284 | InsertPoleRowBefore (me : mutable; UIndex : Integer; |
285 | CPoles : Array1OfPnt from TColgp; |
286 | CPoleWeights : Array1OfReal from TColStd) |
287 | ---Purpose : |
288 | -- Inserts a row of poles and weights. |
289 | -- If the surface was non-rational it can become rational. |
290 | raises OutOfRange, |
291 | ---Purpose: |
292 | -- Raised if Uindex < 1 or UIndex > NbUPoles. |
293 | ConstructionError; |
294 | ---Purpose : Raised if : |
295 | -- . UDegree is greater than MaxDegree. |
296 | -- . the Length of CPoles is not equal to NbVPoles |
297 | -- . a weight value is lower or equal to Resolution from |
298 | -- pacakage gp |
299 | |
300 | |
301 | RemovePoleCol (me : mutable; VIndex : Integer) |
302 | ---Purpose : Removes a column of poles. |
303 | -- If the surface was rational it can become non-rational. |
304 | raises ConstructionError, |
305 | ---Purpose : |
306 | -- Raised if NbVPoles <= 2 after removing, a Bezier surface |
307 | -- must have at least two columns of poles. |
308 | OutOfRange; |
309 | ---Purpose : Raised if Vindex < 1 or VIndex > NbVPoles |
310 | |
311 | |
312 | RemovePoleRow (me : mutable; UIndex : Integer) |
313 | ---Purpose : Removes a row of poles. |
314 | -- If the surface was rational it can become non-rational. |
315 | raises ConstructionError, |
316 | ---Purpose : |
317 | -- Raised if NbUPoles <= 2 after removing, a Bezier surface |
318 | -- must have at least two rows of poles. |
319 | OutOfRange; |
320 | ---Purpose : Raised if Uindex < 1 or UIndex > NbUPoles |
321 | |
322 | |
323 | Segment (me : mutable; U1, U2, V1, V2 : Real); |
324 | ---Purpose : Modifies this Bezier surface by segmenting it |
325 | -- between U1 and U2 in the u parametric direction, |
326 | -- and between V1 and V2 in the v parametric |
327 | -- direction. U1, U2, V1, and V2 can be outside the |
328 | -- bounds of this surface. |
329 | -- - U1 and U2 isoparametric Bezier curves, |
330 | -- segmented between V1 and V2, become the two |
331 | -- bounds of the surface in the v parametric |
332 | -- direction (0. and 1. u isoparametric curves). |
333 | -- - V1 and V2 isoparametric Bezier curves, |
334 | -- segmented between U1 and U2, become the two |
335 | -- bounds of the surface in the u parametric |
336 | -- direction (0. and 1. v isoparametric curves). |
337 | -- The poles and weights tables are modified, but the |
338 | -- degree of this surface in the u and v parametric |
339 | -- directions does not change. |
340 | -- U1 can be greater than U2, and V1 can be greater |
341 | -- than V2. In these cases, the corresponding |
342 | -- parametric direction is inverted. The orientation of |
343 | -- the surface is inverted if one (and only one) |
344 | -- parametric direction is inverted. |
345 | |
346 | |
347 | SetPole (me : mutable; UIndex, VIndex : Integer; P : Pnt) |
348 | ---Purpose : Modifies a pole value. |
349 | -- If the surface is rational the weight of range (UIndex, VIndex) |
350 | -- is not modified. |
351 | raises OutOfRange; |
352 | ---Purpose : |
353 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 |
354 | -- or VIndex > NbVPoles. |
355 | |
356 | |
357 | SetPole (me : mutable; UIndex, VIndex : Integer; P : Pnt; Weight : Real) |
358 | ---Purpose : |
359 | -- Substitutes the pole and the weight of range UIndex, VIndex. |
360 | -- If the surface <me> is not rational it can become rational. |
361 | -- if the surface was rational it can become non-rational. |
362 | raises OutOfRange, |
363 | ---Purpose : |
364 | -- raises if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 |
365 | -- or VIndex > NbVPoles. |
366 | ConstructionError; |
367 | ---Purpose : Raised if Weight <= Resolution from package gp. |
368 | |
369 | |
370 | SetPoleCol (me : mutable; VIndex : Integer; |
371 | CPoles : Array1OfPnt from TColgp) |
372 | ---Purpose : Modifies a column of poles. |
373 | -- The length of CPoles can be lower but not greater than NbUPoles |
374 | -- so you can modify just a part of the column. |
375 | raises OutOfRange, |
376 | ---Purpose : Raised if VIndex < 1 or VIndex > NbVPoles |
377 | ConstructionError; |
378 | ---Purpose : |
379 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles |
380 | |
381 | |
382 | SetPoleCol (me : mutable; VIndex : Integer; |
383 | CPoles : Array1OfPnt from TColgp; |
384 | CPoleWeights : Array1OfReal from TColStd) |
385 | ---Purpose : Modifies a column of poles. |
386 | -- If the surface was rational it can become non-rational |
387 | -- If the surface was non-rational it can become rational. |
388 | -- The length of CPoles can be lower but not greater than NbUPoles |
389 | -- so you can modify just a part of the column. |
390 | raises OutOfRange, |
391 | ---Purpose : Raised if VIndex < 1 or VIndex > NbVPoles |
392 | ConstructionError; |
393 | ---Purpose : |
394 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles |
395 | -- Raised if CPoleWeights and CPoles have not the same bounds. |
396 | -- Raised if one of the weight value CPoleWeights (i) is lower |
397 | -- or equal to Resolution from package gp. |
398 | |
399 | |
400 | SetPoleRow (me : mutable; UIndex : Integer; |
401 | CPoles : Array1OfPnt from TColgp) |
402 | ---Purpose : Modifies a row of poles. |
403 | -- The length of CPoles can be lower but not greater than NbVPoles |
404 | -- so you can modify just a part of the row. |
405 | raises OutOfRange, |
406 | ---Purpose : Raised if UIndex < 1 or UIndex > NbUPoles |
407 | ConstructionError; |
408 | ---Purpose : |
409 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles |
410 | |
411 | |
412 | |
413 | SetPoleRow (me : mutable; UIndex : Integer; |
414 | CPoles : Array1OfPnt from TColgp; |
415 | CPoleWeights : Array1OfReal from TColStd) |
416 | ---Purpose : Modifies a row of poles and weights. |
417 | -- If the surface was rational it can become non-rational. |
418 | -- If the surface was non-rational it can become rational. |
419 | -- The length of CPoles can be lower but not greater than NbVPoles |
420 | -- so you can modify just a part of the row. |
421 | raises OutOfRange, |
422 | ---Purpose : Raised if UIndex < 1 or UIndex > NbUPoles |
423 | ConstructionError; |
424 | ---Purpose : |
425 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles |
426 | -- Raised if CPoleWeights and CPoles have not the same bounds. |
427 | -- Raised if one of the weight value CPoleWeights (i) is lower |
428 | -- or equal to Resolution from gp. |
429 | |
430 | |
431 | SetWeight (me : mutable; UIndex, VIndex : Integer; Weight : Real) |
432 | ---Purpose : |
433 | -- Modifies the weight of the pole of range UIndex, VIndex. |
434 | -- If the surface was non-rational it can become rational. |
435 | -- If the surface was rational it can become non-rational. |
436 | raises OutOfRange, |
437 | ---Purpose : |
438 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
439 | -- VIndex > NbVPoles. |
440 | ConstructionError; |
441 | ---Purpose : Raised if Weight <= Resolution from package gp. |
442 | |
443 | |
444 | SetWeightCol (me : mutable; VIndex : Integer; |
445 | CPoleWeights : Array1OfReal from TColStd) |
446 | ---Purpose : Modifies a column of weights. |
447 | -- If the surface was rational it can become non-rational. |
448 | -- If the surface was non-rational it can become rational. |
449 | -- The length of CPoleWeights can be lower but not greater than |
450 | -- NbUPoles. |
451 | raises OutOfRange, |
452 | ---Purpose : Raised if VIndex < 1 or VIndex > NbVPoles |
453 | ConstructionError; |
454 | ---Purpose : |
455 | -- Raised if CPoleWeights.Lower() < 1 or CPoleWeights.Upper() > |
456 | -- NbUPoles |
457 | -- Raised if one of the weight value CPoleWeights (i) is lower |
458 | -- or equal to Resolution from package gp. |
459 | |
460 | |
461 | SetWeightRow (me : mutable; UIndex : Integer; |
462 | CPoleWeights : Array1OfReal from TColStd) |
463 | ---Purpose : Modifies a row of weights. |
464 | -- If the surface was rational it can become non-rational. |
465 | -- If the surface was non-rational it can become rational. |
466 | -- The length of CPoleWeights can be lower but not greater than |
467 | -- NbVPoles. |
468 | raises OutOfRange, |
469 | ---Purpose : Raised if UIndex < 1 or UIndex > NbUPoles |
470 | ConstructionError; |
471 | ---Purpose : |
472 | -- Raised if CPoleWeights.Lower() < 1 or CPoleWeights.Upper() > |
473 | -- NbVPoles |
474 | -- Raised if one of the weight value CPoleWeights (i) is lower |
475 | -- or equal to Resolution from package gp. |
476 | |
477 | |
478 | UReverse (me : mutable); |
479 | ---Purpose : Changes the orientation of this Bezier surface in the |
480 | -- u parametric direction. The bounds of the |
481 | -- surface are not changed, but the given parametric |
482 | -- direction is reversed. Hence, the orientation of the surface is reversed. |
483 | |
484 | |
485 | UReversedParameter (me; U : Real) returns Real; |
486 | ---Purpose: Computes the u (or v) parameter on the modified |
487 | -- surface, produced by reversing its u (or v) parametric |
488 | -- direction, for any point of u parameter U (or of v |
489 | -- parameter V) on this Bezier surface. |
490 | -- In the case of a Bezier surface, these functions return respectively: |
491 | -- - 1.-U, or 1.-V. |
492 | |
493 | |
494 | VReverse (me : mutable); |
495 | ---Purpose : Changes the orientation of this Bezier surface in the |
496 | -- v parametric direction. The bounds of the |
497 | -- surface are not changed, but the given parametric |
498 | -- direction is reversed. Hence, the orientation of the |
499 | -- surface is reversed. |
500 | |
501 | |
502 | VReversedParameter (me; V : Real) returns Real; |
503 | ---Purpose: Computes the u (or v) parameter on the modified |
504 | -- surface, produced by reversing its u (or v) parametric |
505 | -- direction, for any point of u parameter U (or of v |
506 | -- parameter V) on this Bezier surface. |
507 | -- In the case of a Bezier surface, these functions return respectively: |
508 | -- - 1.-U, or 1.-V. |
509 | |
510 | |
511 | Bounds (me; U1, U2, V1, V2 : out Real); |
512 | ---Purpose : Returns the parametric bounds U1, U2, V1 and V2 of |
513 | -- this Bezier surface. |
514 | -- In the case of a Bezier surface, this function returns |
515 | -- U1 = 0, V1 = 0, U2 = 1, V2 = 1. |
516 | |
517 | |
518 | Continuity (me) returns Shape from GeomAbs; |
519 | ---Purpose : |
520 | -- Returns the continuity of the surface CN : the order of |
521 | -- continuity is infinite. |
522 | |
523 | D0 (me; U, V : Real; P : out Pnt); |
524 | |
525 | D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec); |
526 | |
527 | D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec); |
528 | |
529 | D3 (me; U, V : Real; P : out Pnt; |
530 | D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : out Vec); |
531 | ---Purpose: Computes P, the point of parameters (U, V) of this Bezier surface, and |
532 | -- - one or more of the following sets of vectors: |
533 | -- - D1U and D1V, the first derivative vectors at this point, |
534 | -- - D2U, D2V and D2UV, the second derivative |
535 | -- vectors at this point, |
536 | -- - D3U, D3V, D3UUV and D3UVV, the third |
537 | -- derivative vectors at this point. |
538 | -- Note: The parameters U and V can be outside the bounds of the surface. |
539 | |
540 | DN (me; U, V : Real; Nu, Nv : Integer) returns Vec |
541 | ---Purpose : Computes the derivative of order Nu in the u |
542 | -- parametric direction, and Nv in the v parametric |
543 | -- direction, at the point of parameters (U, V) of this Bezier surface. |
544 | -- Note: The parameters U and V can be outside the bounds of the surface. |
545 | -- Exceptions |
546 | -- Standard_RangeError if: |
547 | -- - Nu + Nv is less than 1, or Nu or Nv is negative. |
548 | raises RangeError; |
549 | |
550 | NbUPoles (me) returns Integer; |
551 | ---Purpose : Returns the number of poles in the U direction. |
552 | |
553 | NbVPoles (me) returns Integer; |
554 | ---Purpose : Returns the number of poles in the V direction. |
555 | |
556 | |
557 | Pole (me; UIndex, VIndex : Integer) returns Pnt |
558 | ---Purpose : Returns the pole of range UIndex, VIndex |
559 | raises OutOfRange; |
560 | ---Purpose : Raised if UIndex < 1 or UIndex > NbUPoles, or |
561 | -- VIndex < 1 or VIndex > NbVPoles. |
562 | |
563 | |
564 | Poles (me; P : out Array2OfPnt from TColgp) |
565 | ---Purpose : Returns the poles of the Bezier surface. |
566 | raises DimensionError; |
567 | ---Purpose : |
568 | -- Raised if the length of P in the U an V direction is not equal to |
569 | -- NbUPoles and NbVPoles. |
570 | |
571 | |
572 | UDegree (me) returns Integer; |
573 | ---Purpose : |
574 | -- Returns the degree of the surface in the U direction it is |
575 | -- NbUPoles - 1 |
576 | |
577 | |
578 | UIso (me; U : Real) returns mutable Curve; |
579 | ---Purpose : |
580 | -- Computes the U isoparametric curve. For a Bezier surface the |
581 | -- UIso curve is a Bezier curve. |
582 | |
583 | |
584 | VDegree (me) returns Integer; |
585 | ---Purpose : |
586 | -- Returns the degree of the surface in the V direction it is |
587 | -- NbVPoles - 1 |
588 | |
589 | |
590 | VIso (me; V : Real) returns mutable Curve; |
591 | ---Purpose : |
592 | -- Computes the V isoparametric curve. For a Bezier surface the |
593 | -- VIso curve is a Bezier curve. |
594 | |
595 | |
596 | Weight (me; UIndex, VIndex : Integer) returns Real |
597 | ---Purpose : Returns the weight of range UIndex, VIndex |
598 | raises OutOfRange; |
599 | ---Purpose : |
600 | -- Raised if UIndex < 1 or UIndex > NbUPoles, or |
601 | -- VIndex < 1 or VIndex > NbVPoles. |
602 | |
603 | |
604 | Weights (me; W : out Array2OfReal from TColStd) |
605 | ---Purpose : Returns the weights of the Bezier surface. |
606 | raises DimensionError; |
607 | ---Purpose : |
608 | -- Raised if the length of W in the U an V direction is not |
609 | -- equal to NbUPoles and NbVPoles. |
610 | |
611 | |
612 | IsUClosed (me) returns Boolean; |
613 | ---Purpose : |
614 | -- Returns True if the first control points row and the |
615 | -- last control points row are identical. The tolerance |
616 | -- criterion is Resolution from package gp. |
617 | |
618 | |
619 | IsVClosed (me) returns Boolean; |
620 | ---Purpose : |
621 | -- Returns True if the first control points column |
622 | -- and the last control points column are identical. |
623 | -- The tolerance criterion is Resolution from package gp. |
624 | |
625 | |
626 | IsCNu (me; N : Integer) returns Boolean; |
627 | ---Purpose : Returns True, a Bezier surface is always CN |
628 | |
629 | |
630 | IsCNv (me; N : Integer) returns Boolean; |
631 | ---Purpose : Returns True, a BezierSurface is always CN |
632 | |
633 | |
634 | IsUPeriodic (me) returns Boolean; |
635 | ---Purpose : Returns False. |
636 | |
637 | |
638 | IsVPeriodic (me) returns Boolean; |
639 | ---Purpose : Returns False. |
640 | |
641 | |
642 | IsURational (me) returns Boolean; |
643 | ---Purpose : |
644 | -- Returns False if the weights are identical in the U direction, |
645 | -- The tolerance criterion is Resolution from package gp. |
646 | --- Example : |
647 | -- |1.0, 1.0, 1.0| |
648 | -- if Weights = |0.5, 0.5, 0.5| returns False |
649 | -- |2.0, 2.0, 2.0| |
650 | |
651 | |
652 | IsVRational (me) returns Boolean; |
653 | ---Purpose : |
654 | -- Returns False if the weights are identical in the V direction, |
655 | -- The tolerance criterion is Resolution from package gp. |
656 | --- Example : |
657 | -- |1.0, 2.0, 0.5| |
658 | -- if Weights = |1.0, 2.0, 0.5| returns False |
659 | -- |1.0, 2.0, 0.5| |
660 | |
661 | |
662 | Transform (me : mutable; T : Trsf); |
663 | ---Purpose: Applies the transformation T to this Bezier surface. |
664 | |
665 | MaxDegree (myclass) returns Integer; |
666 | ---Purpose: |
667 | -- Returns the value of the maximum polynomial degree of a |
668 | -- Bezier surface. This value is 25. |
669 | |
670 | |
671 | Create (SurfacePoles, SurfaceCoefficients : HArray2OfPnt from TColgp; |
672 | PoleWeights, CoefficientWeights : HArray2OfReal from TColStd; |
673 | IsURational, IsVRational : Boolean) |
674 | returns mutable BezierSurface |
675 | is private; |
676 | |
677 | |
678 | Resolution(me : mutable; |
679 | Tolerance3D : Real ; |
680 | UTolerance : out Real ; |
681 | VTolerance : out Real) ; |
682 | ---Purpose: Computes two tolerance values for this Bezier |
683 | -- surface, based on the given tolerance in 3D space |
684 | -- Tolerance3D. The tolerances computed are: |
685 | -- - UTolerance in the u parametric direction, and |
686 | -- - VTolerance in the v parametric direction. |
687 | -- If f(u,v) is the equation of this Bezier surface, |
688 | -- UTolerance and VTolerance guarantee that: |
689 | -- | u1 - u0 | < UTolerance and |
690 | -- | v1 - v0 | < VTolerance |
691 | -- ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D |
692 | |
693 | |
694 | Copy (me) returns mutable like me; |
695 | ---Purpose: Creates a new object which is a copy of this Bezier surface. |
696 | |
697 | Init (me : mutable; Poles : HArray2OfPnt from TColgp; |
698 | Weights : HArray2OfReal from TColStd) |
699 | |
700 | ---Purpose : Set poles to Poles, weights to Weights (not |
701 | -- copied). |
702 | -- Create the arrays of coefficients. Poles |
703 | -- and Weights are assumed to have the first |
704 | -- coefficient 1. |
705 | -- |
706 | raises ConstructionError -- if nbpoles < 2 or nbpoles > MaDegree |
707 | |
708 | is static private; |
709 | |
710 | |
711 | UpdateCoefficients(me : mutable; |
712 | U : Real from Standard = 0.0; |
713 | V : Real from Standard = 0.0) |
714 | ---Purpose: Recompute the coeficients. |
715 | is static private; |
716 | |
717 | |
718 | |
719 | fields |
720 | |
721 | urational : Boolean; |
722 | vrational : Boolean; |
723 | poles : HArray2OfPnt from TColgp; |
724 | weights : HArray2OfReal from TColStd; |
725 | |
726 | coeffs : HArray2OfPnt from TColgp; |
727 | wcoeffs : HArray2OfReal from TColStd; |
728 | |
729 | ucacheparameter : Real ; |
730 | vcacheparameter : Real ; |
731 | -- Parameters at which the Taylor expension is stored in |
732 | -- the cache |
733 | ucachespanlenght : Real ; |
734 | vcachespanlenght : Real ; |
735 | -- Always 1. for the moment. |
736 | ucachespanindex : Integer ; |
737 | vcachespanindex : Integer ; |
738 | -- the span for which the cache is valid if |
739 | -- validcache is 1 |
740 | validcache : Integer ; |
741 | |
742 | -- usefull to evaluate the parametric resolutions |
743 | umaxderivinv : Real from Standard; |
744 | vmaxderivinv : Real from Standard; |
745 | maxderivinvok : Boolean from Standard; |
746 | |
747 | end; |