b311480e |
1 | -- Created on: 1993-03-09 |
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 | -- |
d5f74e42 |
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 |
973c2be1 |
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 BSplineSurface from Geom inherits BoundedSurface from Geom |
18 | |
19 | ---Purpose : Describes a BSpline surface. |
20 | -- In each parametric direction, a BSpline surface can be: |
21 | -- - uniform or non-uniform, |
22 | -- - rational or non-rational, |
23 | -- - periodic or non-periodic. |
24 | -- A BSpline surface is defined by: |
25 | -- - its degrees, in the u and v parametric directions, |
26 | -- - its periodic characteristic, in the u and v parametric directions, |
27 | -- - a table of poles, also called control points (together |
28 | -- with the associated weights if the surface is rational), and |
29 | -- - a table of knots, together with the associated multiplicities. |
30 | -- The degree of a Geom_BSplineSurface is limited to |
31 | -- a value (25) which is defined and controlled by the |
32 | -- system. This value is returned by the function MaxDegree. |
33 | -- Poles and Weights |
34 | -- Poles and Weights are manipulated using two associative double arrays: |
35 | -- - the poles table, which is a double array of gp_Pnt points, and |
36 | -- - the weights table, which is a double array of reals. |
37 | -- The bounds of the poles and weights arrays are: |
38 | -- - 1 and NbUPoles for the row bounds (provided |
39 | -- that the BSpline surface is not periodic in the u |
40 | -- parametric direction), where NbUPoles is the |
41 | -- number of poles of the surface in the u parametric direction, and |
42 | -- - 1 and NbVPoles for the column bounds (provided |
43 | -- that the BSpline surface is not periodic in the v |
44 | -- parametric direction), where NbVPoles is the |
45 | -- number of poles of the surface in the v parametric direction. |
46 | -- The poles of the surface are the points used to shape |
47 | -- and reshape the surface. They comprise a rectangular network. |
48 | -- If the surface is not periodic: |
49 | -- - The points (1, 1), (NbUPoles, 1), (1, |
50 | -- NbVPoles), and (NbUPoles, NbVPoles) |
51 | -- are the four parametric "corners" of the surface. |
52 | -- - The first column of poles and the last column of |
53 | -- poles define two BSpline curves which delimit the |
54 | -- surface in the v parametric direction. These are the |
55 | -- v isoparametric curves corresponding to the two |
56 | -- bounds of the v parameter. |
57 | -- - The first row of poles and the last row of poles |
58 | -- define two BSpline curves which delimit the surface |
59 | -- in the u parametric direction. These are the u |
60 | -- isoparametric curves corresponding to the two bounds of the u parameter. |
61 | -- If the surface is periodic, these geometric properties are not verified. |
62 | -- It is more difficult to define a geometrical significance |
63 | -- for the weights. However they are useful for |
64 | -- representing a quadric surface precisely. Moreover, if |
65 | -- the weights of all the poles are equal, the surface has |
66 | -- a polynomial equation, and hence is a "non-rational surface". |
67 | -- The non-rational surface is a special, but frequently |
68 | -- used, case, where all poles have identical weights. |
69 | -- The weights are defined and used only in the case of |
70 | -- a rational surface. The rational characteristic is |
71 | -- defined in each parametric direction. A surface can be |
72 | -- rational in the u parametric direction, and |
73 | -- non-rational in the v parametric direction. |
74 | -- Knots and Multiplicities |
75 | -- For a Geom_BSplineSurface the table of knots is |
76 | -- made up of two increasing sequences of reals, without |
77 | -- repetition, one for each parametric direction. The |
78 | -- multiplicities define the repetition of the knots. |
79 | -- A BSpline surface comprises multiple contiguous |
80 | -- patches, which are themselves polynomial or rational |
81 | -- surfaces. The knots are the parameters of the |
82 | -- isoparametric curves which limit these contiguous |
83 | -- patches. The multiplicity of a knot on a BSpline |
84 | -- surface (in a given parametric direction) is related to |
85 | -- the degree of continuity of the surface at that knot in |
86 | -- that parametric direction: |
87 | -- Degree of continuity at knot(i) = Degree - Multi(i) where: |
88 | -- - Degree is the degree of the BSpline surface in |
89 | -- the given parametric direction, and |
90 | -- - Multi(i) is the multiplicity of knot number i in |
91 | -- the given parametric direction. |
92 | -- There are some special cases, where the knots are |
93 | -- regularly spaced in one parametric direction (i.e. the |
94 | -- difference between two consecutive knots is a constant). |
95 | -- - "Uniform": all the multiplicities are equal to 1. |
96 | -- - "Quasi-uniform": all the multiplicities are equal to 1, |
97 | -- except for the first and last knots in this parametric |
98 | -- direction, and these are equal to Degree + 1. |
99 | -- - "Piecewise Bezier": all the multiplicities are equal to |
100 | -- Degree except for the first and last knots, which |
101 | -- are equal to Degree + 1. This surface is a |
102 | -- concatenation of Bezier patches in the given |
103 | -- parametric direction. |
104 | -- If the BSpline surface is not periodic in a given |
105 | -- parametric direction, the bounds of the knots and |
106 | -- multiplicities tables are 1 and NbKnots, where |
107 | -- NbKnots is the number of knots of the BSpline |
108 | -- surface in that parametric direction. |
109 | -- If the BSpline surface is periodic in a given parametric |
110 | -- direction, and there are k periodic knots and p |
111 | -- periodic poles in that parametric direction: |
112 | -- - the period is such that: |
113 | -- period = Knot(k+1) - Knot(1), and |
114 | -- - the poles and knots tables in that parametric |
115 | -- direction can be considered as infinite tables, such that: |
116 | -- Knot(i+k) = Knot(i) + period, and |
117 | -- Pole(i+p) = Pole(i) |
118 | -- Note: The data structure tables for a periodic BSpline |
119 | -- surface are more complex than those of a non-periodic one. |
120 | -- References : |
121 | -- . A survey of curve and surface methods in CADG Wolfgang BOHM |
122 | -- CAGD 1 (1984) |
123 | -- . On de Boor-like algorithms and blossoming Wolfgang BOEHM |
124 | -- cagd 5 (1988) |
125 | -- . Blossoming and knot insertion algorithms for B-spline curves |
126 | -- Ronald N. GOLDMAN |
127 | -- . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA |
128 | -- . Curves and Surfaces for Computer Aided Geometric Design, |
129 | -- a practical guide Gerald Farin |
130 | |
131 | |
132 | |
133 | uses Array1OfInteger from TColStd, |
134 | Array1OfReal from TColStd, |
135 | Array2OfReal from TColStd, |
136 | HArray1OfInteger from TColStd, |
137 | HArray1OfReal from TColStd, |
138 | HArray2OfReal from TColStd, |
139 | Array1OfPnt from TColgp, |
140 | Array2OfPnt from TColgp, |
141 | Ax1 from gp, |
142 | Ax2 from gp, |
143 | HArray2OfPnt from TColgp, |
144 | Pnt from gp, |
145 | Trsf from gp, |
146 | Vec from gp, |
147 | BSplKnotDistribution from GeomAbs, |
148 | Curve from Geom, |
149 | Geometry from Geom, |
83ada95b |
150 | Shape from GeomAbs, |
151 | Mutex from Standard |
7fd59977 |
152 | |
153 | raises ConstructionError from Standard, |
154 | DimensionError from Standard, |
155 | DomainError from Standard, |
156 | OutOfRange from Standard, |
157 | NoSuchObject from Standard, |
158 | RangeError from Standard, |
159 | UndefinedDerivative from Geom |
160 | |
161 | |
162 | |
163 | is |
164 | |
165 | |
166 | |
167 | Create (Poles : Array2OfPnt from TColgp; |
168 | UKnots, VKnots : Array1OfReal from TColStd; |
169 | UMults, VMults : Array1OfInteger from TColStd; |
170 | UDegree, VDegree : Integer; |
171 | UPeriodic : Boolean = Standard_False; |
172 | VPeriodic : Boolean = Standard_False) |
6e33d3ce |
173 | returns BSplineSurface |
7fd59977 |
174 | |
175 | ---Purpose : Creates a non-rational b-spline surface (weights |
176 | -- default value is 1.). |
177 | raises ConstructionError; |
178 | ---Purpose: The following conditions must be verified. |
179 | -- 0 < UDegree <= MaxDegree. |
180 | -- UKnots.Length() == UMults.Length() >= 2 |
181 | -- UKnots(i) < UKnots(i+1) (Knots are increasing) |
182 | -- 1 <= UMults(i) <= UDegree |
183 | -- On a non uperiodic surface the first and last |
184 | -- umultiplicities may be UDegree+1 (this is even |
185 | -- recommanded if you want the curve to start and finish on |
186 | -- the first and last pole). |
187 | -- On a uperiodic surface the first and the last |
188 | -- umultiplicities must be the same. |
189 | -- on non-uperiodic surfaces |
190 | -- Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2 |
191 | -- on uperiodic surfaces |
192 | -- Poles.ColLength() == Sum(UMults(i)) except the first or last |
193 | -- The previous conditions for U holds also for V, with the |
194 | -- RowLength of the poles. |
195 | |
196 | |
197 | |
198 | |
199 | Create (Poles : Array2OfPnt from TColgp; |
200 | Weights : Array2OfReal from TColStd; |
201 | UKnots, VKnots : Array1OfReal from TColStd; |
202 | UMults, VMults : Array1OfInteger from TColStd; |
203 | UDegree, VDegree : Integer; |
204 | UPeriodic : Boolean = Standard_False; |
205 | VPeriodic : Boolean = Standard_False) |
6e33d3ce |
206 | returns BSplineSurface |
7fd59977 |
207 | |
208 | ---Purpose : Creates a non-rational b-spline surface (weights |
209 | -- default value is 1.). |
210 | -- |
211 | raises ConstructionError; |
212 | ---Purpose: The following conditions must be verified. |
213 | -- 0 < UDegree <= MaxDegree. |
214 | -- |
215 | -- UKnots.Length() == UMults.Length() >= 2 |
216 | -- |
217 | -- UKnots(i) < UKnots(i+1) (Knots are increasing) |
218 | -- 1 <= UMults(i) <= UDegree |
219 | -- |
220 | -- On a non uperiodic surface the first and last |
221 | -- umultiplicities may be UDegree+1 (this is even |
222 | -- recommanded if you want the curve to start and finish on |
223 | -- the first and last pole). |
224 | -- |
225 | -- On a uperiodic surface the first and the last |
226 | -- umultiplicities must be the same. |
227 | -- |
228 | -- on non-uperiodic surfaces |
229 | -- |
230 | -- Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2 |
231 | -- |
232 | -- on uperiodic surfaces |
233 | -- |
234 | -- Poles.ColLength() == Sum(UMults(i)) except the first or |
235 | -- last |
236 | -- |
237 | -- |
238 | -- The previous conditions for U holds also for V, with the |
239 | -- RowLength of the poles. |
240 | |
241 | |
242 | |
243 | ExchangeUV (me : mutable); |
244 | ---Purpose: Exchanges the u and v parametric directions on |
245 | -- this BSpline surface. |
246 | -- As a consequence: |
247 | -- - the poles and weights tables are transposed, |
248 | -- - the knots and multiplicities tables are exchanged, |
249 | -- - degrees of continuity, and rational, periodic and |
250 | -- uniform characteristics are exchanged, and |
251 | -- - the orientation of the surface is inverted. |
252 | |
253 | SetUPeriodic (me : mutable); |
254 | ---Purpose: Sets the surface U periodic. |
255 | |
256 | SetVPeriodic (me : mutable); |
257 | ---Purpose: Modifies this surface to be periodic in the u (or v) |
258 | -- parametric direction. |
259 | -- To become periodic in a given parametric direction a |
260 | -- surface must be closed in that parametric direction, |
261 | -- and the knot sequence relative to that direction must be periodic. |
262 | -- To generate this periodic sequence of knots, the |
263 | -- functions FirstUKnotIndex and LastUKnotIndex (or |
264 | -- FirstVKnotIndex and LastVKnotIndex) are used to |
265 | -- compute I1 and I2. These are the indexes, in the |
266 | -- knot array associated with the given parametric |
267 | -- direction, of the knots that correspond to the first and |
268 | -- last parameters of this BSpline surface in the given |
269 | -- parametric direction. Hence the period is: |
270 | -- Knots(I1) - Knots(I2) |
271 | -- As a result, the knots and poles tables are modified. |
272 | -- Exceptions |
273 | -- Standard_ConstructionError if the surface is not |
274 | -- closed in the given parametric direction. |
275 | |
276 | |
277 | |
278 | |
279 | PeriodicNormalization(me ; U,V : in out Real) ; |
280 | |
281 | ---Purpose : returns the parameter normalized within |
282 | -- the period if the surface is periodic : otherwise |
283 | -- does not do anything |
284 | |
285 | SetUOrigin (me : mutable; Index : Integer) |
286 | ---Purpose: Assigns the knot of index Index in the knots table in |
287 | -- the corresponding parametric direction to be the |
288 | -- origin of this periodic BSpline surface. As a |
289 | -- consequence, the knots and poles tables are modified. |
290 | -- Exceptions |
291 | -- Standard_NoSuchObject if this BSpline surface is |
292 | -- not periodic in the given parametric direction. |
293 | -- Standard_DomainError if Index is outside the |
294 | -- bounds of the knots table in the given parametric direction. |
295 | raises NoSuchObject, |
296 | DomainError; |
297 | |
298 | SetVOrigin (me : mutable; Index : Integer) |
299 | ---Purpose: Assigns the knot of index Index in the knots table in |
300 | -- the corresponding parametric direction to be the |
301 | -- origin of this periodic BSpline surface. As a |
302 | -- consequence, the knots and poles tables are modified. |
303 | -- Exceptions |
304 | -- Standard_NoSuchObject if this BSpline surface is |
305 | -- not periodic in the given parametric direction. |
306 | -- Standard_DomainError if Index is outside the |
307 | -- bounds of the knots table in the given parametric direction. |
308 | raises NoSuchObject, |
309 | DomainError; |
310 | |
311 | |
312 | SetUNotPeriodic (me : mutable); |
313 | |
314 | SetVNotPeriodic (me : mutable); |
315 | ---Purpose: Modifies this surface to be periodic in the u (or v) parametric direction. |
316 | -- To become periodic in a given parametric direction a |
317 | -- surface must be closed in that parametric direction, |
318 | -- and the knot sequence relative to that direction must be periodic. |
319 | -- To generate this periodic sequence of knots, the |
320 | -- functions FirstUKnotIndex and LastUKnotIndex (or |
321 | -- FirstVKnotIndex and LastVKnotIndex) are used to |
322 | -- compute I1 and I2. These are the indexes, in the |
323 | -- knot array associated with the given parametric |
324 | -- direction, of the knots that correspond to the first and |
325 | -- last parameters of this BSpline surface in the given |
326 | -- parametric direction. Hence the period is: |
327 | -- Knots(I1) - Knots(I2) |
328 | -- As a result, the knots and poles tables are modified. |
329 | -- Exceptions |
330 | -- Standard_ConstructionError if the surface is not |
331 | -- closed in the given parametric direction. |
332 | |
333 | UReverse (me : mutable); |
334 | |
335 | VReverse (me : mutable); |
336 | ---Purpose: Changes the orientation of this BSpline surface in the |
337 | -- u (or v) parametric direction. The bounds of the |
338 | -- surface are not changed but the given parametric |
339 | -- direction is reversed. Hence the orientation of the |
340 | -- surface is reversed. |
341 | -- The knots and poles tables are modified. |
342 | |
343 | UReversedParameter (me; U : Real) returns Real; |
344 | |
345 | VReversedParameter (me; V : Real) returns Real; |
346 | ---Purpose: Computes the u (or v) parameter on the modified |
347 | -- surface, produced by reversing its u (or v) parametric |
348 | -- direction, for the point of u parameter U, (or of v |
349 | -- parameter V) on this BSpline surface. |
350 | -- For a BSpline surface, these functions return respectively: |
351 | -- - UFirst + ULast - U, or |
352 | -- - VFirst + VLast - V, |
353 | -- where UFirst, ULast, VFirst and VLast are |
354 | -- the values of the first and last parameters of this |
355 | -- BSpline surface, in the u and v parametric directions. |
356 | |
357 | |
358 | IncreaseDegree (me : mutable; UDegree, VDegree : Integer); |
359 | ---Purpose : Increases the degrees of this BSpline surface to |
360 | -- UDegree and VDegree in the u and v parametric |
361 | -- directions respectively. As a result, the tables of poles, |
362 | -- weights and multiplicities are modified. The tables of |
363 | -- knots is not changed. |
364 | -- Note: Nothing is done if the given degree is less than |
365 | -- or equal to the current degree in the corresponding |
366 | -- parametric direction. |
367 | -- Exceptions |
368 | -- Standard_ConstructionError if UDegree or |
369 | -- VDegree is greater than |
370 | -- Geom_BSplineSurface::MaxDegree(). |
371 | |
372 | |
373 | InsertUKnots (me : mutable; Knots : Array1OfReal from TColStd; |
374 | Mults : Array1OfInteger from TColStd; |
375 | ParametricTolerance : Real = 0.0; |
376 | Add : Boolean = Standard_True); |
377 | |
378 | InsertVKnots (me : mutable; Knots : Array1OfReal from TColStd; |
379 | Mults : Array1OfInteger from TColStd; |
380 | ParametricTolerance : Real = 0.0; |
381 | Add : Boolean = Standard_True); |
382 | |
383 | ---Purpose: Inserts into the knots table for the corresponding |
384 | -- parametric direction of this BSpline surface: |
385 | -- - the value U, or V, with the multiplicity M (defaulted to 1), or |
386 | -- - the values of the array Knots, with their respective |
387 | -- multiplicities, Mults. |
388 | -- If the knot value to insert already exists in the table, its multiplicity is: |
389 | -- - increased by M, if Add is true (the default), or |
390 | -- - increased to M, if Add is false. |
391 | -- The tolerance criterion used to check the equality of |
392 | -- the knots is the larger of the values ParametricTolerance and |
393 | -- Standard_Real::Epsilon(val), where val is the knot value to be inserted. |
394 | -- Warning |
395 | -- - If a given multiplicity coefficient is null, or negative, nothing is done. |
396 | -- - The new multiplicity of a knot is limited to the degree of this BSpline surface in the |
397 | -- corresponding parametric direction. |
398 | -- Exceptions |
399 | -- Standard_ConstructionError if a knot value to |
400 | -- insert is outside the bounds of this BSpline surface in |
401 | -- the specified parametric direction. The comparison |
402 | -- uses the precision criterion ParametricTolerance. |
403 | |
404 | |
405 | RemoveUKnot(me : mutable; Index : Integer; |
406 | M : Integer; |
407 | Tolerance : Real) returns Boolean |
408 | raises OutOfRange; |
409 | |
410 | RemoveVKnot(me : mutable; Index : Integer; |
411 | M : Integer; |
412 | Tolerance : Real) returns Boolean |
413 | raises OutOfRange; |
414 | |
415 | ---Purpose : Reduces to M the multiplicity of the knot of index |
416 | -- Index in the given parametric direction. If M is 0, the knot is removed. |
417 | -- With a modification of this type, the table of poles is also modified. |
418 | -- Two different algorithms are used systematically to |
419 | -- compute the new poles of the surface. For each |
420 | -- pole, the distance between the pole calculated |
421 | -- using the first algorithm and the same pole |
422 | -- calculated using the second algorithm, is checked. If |
423 | -- this distance is less than Tolerance it ensures that |
424 | -- the surface is not modified by more than Tolerance. |
425 | -- Under these conditions, the function returns true; |
426 | -- otherwise, it returns false. |
427 | -- A low tolerance prevents modification of the |
428 | -- surface. A high tolerance "smoothes" the surface. |
429 | -- Exceptions |
430 | -- Standard_OutOfRange if Index is outside the |
431 | -- bounds of the knots table of this BSpline surface. |
432 | |
433 | |
434 | IncreaseUMultiplicity (me : mutable; UIndex : Integer; M : Integer) |
435 | ---Purpose : |
436 | -- Increases the multiplicity of the knot of range UIndex |
437 | -- in the UKnots sequence. |
438 | -- M is the new multiplicity. M must be greater than the |
439 | -- previous multiplicity and lower or equal to the degree |
440 | -- of the surface in the U parametric direction. |
441 | raises ConstructionError, |
442 | ---Purpose : Raised if M is not in the range [1, UDegree] |
443 | OutOfRange; |
444 | ---Purpose : |
445 | -- Raised if UIndex is not in the range [FirstUKnotIndex, |
446 | -- LastUKnotIndex] given by the methods with the same name. |
447 | |
448 | |
449 | IncreaseUMultiplicity (me : mutable; FromI1, ToI2 : Integer; M : Integer) |
450 | ---Purpose : |
451 | -- Increases until order M the multiplicity of the set of knots |
452 | -- FromI1,...., ToI2 in the U direction. This method can be used |
453 | -- to make a B_spline surface into a PiecewiseBezier B_spline |
454 | -- surface. |
455 | -- If <me> was uniform, it can become non uniform. |
456 | raises OutOfRange, |
457 | ---Purpose : |
458 | -- Raised if FromI1 or ToI2 is out of the range [FirstUKnotIndex, |
459 | -- LastUKnotIndex]. |
460 | ConstructionError; |
461 | ---Purpose : |
462 | -- M should be greater than the previous multiplicity of the |
463 | -- all the knots FromI1,..., ToI2 and lower or equal to the |
464 | -- Degree of the surface in the U parametric direction. |
465 | |
466 | |
467 | IncrementUMultiplicity (me : mutable; FromI1, ToI2 : Integer; Step : Integer) |
468 | ---Purpose : |
469 | -- Increments the multiplicity of the consecutives uknots FromI1..ToI2 |
470 | -- by step. The multiplicity of each knot FromI1,.....,ToI2 must be |
471 | -- lower or equal to the UDegree of the B_spline. |
472 | raises OutOfRange, |
473 | ---Purpose : |
474 | -- Raised if FromI1 or ToI2 is not in the range |
475 | -- [FirstUKnotIndex, LastUKnotIndex] |
476 | ConstructionError; |
477 | ---Purpose : |
478 | -- Raised if one knot has a multiplicity greater than UDegree. |
479 | |
480 | |
481 | IncreaseVMultiplicity (me : mutable; VIndex : Integer; M : Integer) |
482 | ---Purpose : |
483 | -- Increases the multiplicity of a knot in the V direction. |
484 | -- M is the new multiplicity. |
485 | raises ConstructionError, |
486 | ---Purpose : |
487 | -- M should be greater than the previous multiplicity and lower |
488 | -- than the degree of the surface in the V parametric direction. |
489 | OutOfRange; |
490 | ---Purpose : |
491 | -- Raised if VIndex is not in the range [FirstVKnotIndex, |
492 | -- LastVKnotIndex] given by the methods with the same name. |
493 | |
494 | |
495 | IncreaseVMultiplicity (me : mutable; FromI1, ToI2 : Integer; M : Integer) |
496 | ---Purpose : |
497 | -- Increases until order M the multiplicity of the set of knots |
498 | -- FromI1,...., ToI2 in the V direction. This method can be used to |
499 | -- make a BSplineSurface into a PiecewiseBezier B_spline |
500 | -- surface. If <me> was uniform, it can become non-uniform. |
501 | raises OutOfRange, |
502 | ---Purpose : |
503 | -- Raised if FromI1 or ToI2 is out of the range [FirstVKnotIndex, |
504 | -- LastVKnotIndex] given by the methods with the same name. |
505 | ConstructionError; |
506 | ---Purpose : |
507 | -- M should be greater than the previous multiplicity of the |
508 | -- all the knots FromI1,..., ToI2 and lower or equal to the |
509 | -- Degree of the surface in the V parametric direction. |
510 | |
511 | |
512 | IncrementVMultiplicity (me : mutable; FromI1, ToI2 : Integer; Step : Integer) |
513 | ---Purpose : |
514 | -- Increments the multiplicity of the consecutives vknots FromI1..ToI2 |
515 | -- by step. The multiplicity of each knot FromI1,.....,ToI2 must be |
516 | -- lower or equal to the VDegree of the B_spline. |
517 | raises OutOfRange, |
518 | ---Purpose : |
519 | -- Raised if FromI1 or ToI2 is not in the range |
520 | -- [FirstVKnotIndex, LastVKnotIndex] |
521 | ConstructionError; |
522 | ---Purpose : |
523 | -- Raised if one knot has a multiplicity greater than VDegree. |
524 | |
525 | |
526 | InsertUKnot (me : mutable; U : Real; M : Integer; ParametricTolerance : Real; |
527 | Add : Boolean = Standard_True) |
528 | ---Purpose: |
529 | -- Inserts a knot value in the sequence of UKnots. If U is a knot |
530 | -- value this method increases the multiplicity of the knot if the |
531 | -- previous multiplicity was lower than M else it does nothing. The |
532 | -- tolerance criterion is ParametricTolerance. ParametricTolerance |
533 | -- should be greater or equal than Resolution from package gp. |
534 | raises ConstructionError; |
535 | ---Purpose : |
536 | -- Raised if U is out of the bounds [U1, U2] given by the methods |
537 | -- Bounds, the criterion ParametricTolerance is used. |
538 | -- Raised if M is not in the range [1, UDegree]. |
539 | |
540 | |
541 | InsertVKnot (me : mutable; V : Real; M : Integer; ParametricTolerance : Real; |
542 | Add : Boolean = Standard_True) |
543 | ---Purpose : |
544 | -- Inserts a knot value in the sequence of VKnots. If V is a knot |
545 | -- value this method increases the multiplicity of the knot if the |
546 | -- previous multiplicity was lower than M otherwise it does nothing. |
547 | -- The tolerance criterion is ParametricTolerance. |
548 | -- ParametricTolerance should be greater or equal than Resolution |
549 | -- from package gp. |
550 | raises ConstructionError; |
551 | ---Purpose : |
552 | -- raises if V is out of the Bounds [V1, V2] given by the methods |
553 | -- Bounds, the criterion ParametricTolerance is used. |
554 | -- raises if M is not in the range [1, VDegree]. |
555 | |
556 | |
557 | Segment (me : mutable; U1, U2, V1, V2 : Real) |
558 | ---Purpose : |
559 | -- Segments the surface between U1 and U2 in the U-Direction. |
560 | -- between V1 and V2 in the V-Direction. |
561 | -- The control points are modified, the first and the last point |
562 | -- are not the same. |
563 | -- Warnings : |
564 | -- Even if <me> is not closed it can become closed after the |
565 | -- segmentation for example if U1 or U2 are out of the bounds |
566 | -- of the surface <me> or if the surface makes loop. |
567 | raises DomainError from Standard; |
568 | ---Purpose: raises if U2 < U1 or V2 < V1 |
569 | |
570 | |
571 | CheckAndSegment (me : mutable; U1, U2, V1, V2 : Real) |
572 | ---Purpose : |
573 | -- Segments the surface between U1 and U2 in the U-Direction. |
574 | -- between V1 and V2 in the V-Direction. |
575 | -- |
576 | -- same as Segment but do nothing if U1 and U2 (resp. V1 and V2) are |
577 | -- equal to the bounds in U (resp. in V) of <me>. |
578 | -- For example, if <me> is periodic in V, it will be always periodic |
579 | -- in V after the segmentation if the bounds in V are unchanged |
580 | -- |
581 | -- Warnings : |
582 | -- Even if <me> is not closed it can become closed after the |
583 | -- segmentation for example if U1 or U2 are out of the bounds |
584 | -- of the surface <me> or if the surface makes loop. |
585 | raises DomainError from Standard; |
586 | ---Purpose: raises if U2 < U1 or V2 < V1 |
587 | |
588 | |
589 | SetUKnot (me : mutable; UIndex : Integer; K : Real) |
590 | ---Purpose : Substitutes the UKnots of range UIndex with K. |
591 | raises OutOfRange, |
592 | ---Purpose : |
593 | -- Raised if UIndex < 1 or UIndex > NbUKnots |
594 | ConstructionError; |
595 | ---Purpose : |
596 | -- Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1) |
597 | |
598 | |
599 | SetUKnots (me : mutable; UK : Array1OfReal from TColStd) |
600 | ---Purpose : Changes all the U-knots of the surface. |
601 | -- The multiplicity of the knots are not modified. |
602 | raises ConstructionError, |
603 | ---Purpose : |
604 | -- Raised if there is an index such that UK (Index+1) <= UK (Index). |
605 | OutOfRange; |
606 | ---Purpose : |
607 | -- Raised if UK.Lower() < 1 or UK.Upper() > NbUKnots |
608 | |
609 | |
610 | SetUKnot (me : mutable; UIndex : Integer; K : Real; M : Integer) |
611 | ---Purpose : |
612 | -- Changes the value of the UKnots of range UIndex and |
613 | -- increases its multiplicity. |
614 | raises OutOfRange, |
615 | ---Purpose : |
616 | -- Raised if UIndex is not in the range [FirstUKnotIndex, |
617 | -- LastUKnotIndex] given by the methods with the same name. |
618 | ConstructionError; |
619 | ---Purpose : |
620 | -- Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1) |
621 | -- M must be lower than UDegree and greater than the previous |
622 | -- multiplicity of the knot of range UIndex. |
623 | |
624 | |
625 | SetVKnot (me : mutable; VIndex : Integer; K : Real) |
626 | ---Purpose : Substitutes the VKnots of range VIndex with K. |
627 | raises OutOfRange, |
628 | ---Purpose : |
629 | -- Raised if VIndex < 1 or VIndex > NbVKnots |
630 | ConstructionError; |
631 | ---Purpose : |
632 | -- Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1) |
633 | |
634 | |
635 | SetVKnots (me : mutable; VK : Array1OfReal from TColStd) |
636 | ---Purpose : Changes all the V-knots of the surface. |
637 | -- The multiplicity of the knots are not modified. |
638 | raises ConstructionError, |
639 | ---Purpose : |
640 | -- Raised if there is an index such that VK (Index+1) <= VK (Index). |
641 | OutOfRange; |
642 | ---Purpose : |
643 | -- Raised if VK.Lower() < 1 or VK.Upper() > NbVKnots |
644 | |
645 | |
646 | |
647 | SetVKnot (me : mutable; VIndex : Integer; K : Real; M : Integer) |
648 | ---Purpose : |
649 | -- Changes the value of the VKnots of range VIndex and increases |
650 | -- its multiplicity. |
651 | raises OutOfRange, |
652 | ---Purpose : |
653 | -- Raised if VIndex is not in the range [FirstVKnotIndex, |
654 | -- LastVKnotIndex] given by the methods with the same name. |
655 | ConstructionError; |
656 | ---Purpose : |
657 | -- Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1) |
658 | -- M must be lower than VDegree and greater than the previous |
659 | -- multiplicity of the knot of range VIndex. |
660 | |
661 | |
662 | LocateU (me; |
663 | U : Real; |
664 | ParametricTolerance : Real; |
665 | I1, I2 : in out Integer; |
666 | WithKnotRepetition : Boolean = Standard_False); |
667 | ---Purpose : |
668 | -- Locates the parametric value U in the sequence of UKnots. |
669 | -- If "WithKnotRepetition" is True we consider the knot's |
670 | -- representation with repetition of multiple knot value, |
671 | -- otherwise we consider the knot's representation with |
672 | -- no repetition of multiple knot values. |
673 | -- UKnots (I1) <= U <= UKnots (I2) |
674 | -- . if I1 = I2 U is a knot value (the tolerance criterion |
675 | -- ParametricTolerance is used). |
676 | -- . if I1 < 1 => U < UKnots(1) - Abs(ParametricTolerance) |
677 | -- . if I2 > NbUKnots => U > UKnots(NbUKnots)+Abs(ParametricTolerance) |
678 | |
679 | |
680 | LocateV (me; |
681 | V : Real; |
682 | ParametricTolerance : Real; |
683 | I1, I2 : in out Integer; |
684 | WithKnotRepetition : Boolean = Standard_False); |
685 | ---Purpose : |
686 | -- Locates the parametric value U in the sequence of knots. |
687 | -- If "WithKnotRepetition" is True we consider the knot's |
688 | -- representation with repetition of multiple knot value, |
689 | -- otherwise we consider the knot's representation with |
690 | -- no repetition of multiple knot values. |
691 | -- VKnots (I1) <= V <= VKnots (I2) |
692 | -- . if I1 = I2 V is a knot value (the tolerance criterion |
693 | -- ParametricTolerance is used). |
694 | -- . if I1 < 1 => V < VKnots(1) - Abs(ParametricTolerance) |
695 | -- . if I2 > NbVKnots => V > VKnots(NbVKnots)+Abs(ParametricTolerance) |
696 | |
697 | |
698 | |
699 | |
700 | |
701 | |
702 | |
703 | ---Purpose : poles insertion and removing |
704 | -- The following methods are available only if the surface |
705 | -- is Uniform or QuasiUniform in the considered direction |
706 | -- The knot repartition is modified. |
707 | |
708 | |
709 | |
710 | |
711 | ----Purpose : poles and weights modifications |
712 | |
713 | SetPole (me : mutable; UIndex, VIndex : Integer; P : Pnt) |
714 | ---Purpose : |
715 | -- Substitutes the pole of range (UIndex, VIndex) with P. |
716 | -- If the surface is rational the weight of range (UIndex, VIndex) |
717 | -- is not modified. |
718 | raises OutOfRange; |
719 | ---Purpose : |
720 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
721 | -- VIndex > NbVPoles. |
722 | |
723 | |
724 | SetPole (me : mutable; UIndex, VIndex : Integer; P : Pnt; Weight : Real) |
725 | ---Purpose : |
726 | -- Substitutes the pole and the weight of range (UIndex, VIndex) |
727 | -- with P and W. |
728 | raises OutOfRange, |
729 | ---Purpose : |
730 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
731 | -- VIndex > NbVPoles. |
732 | ConstructionError; |
733 | ---Purpose : Raised if Weight <= Resolution from package gp. |
734 | |
735 | |
736 | SetPoleCol (me : mutable; VIndex : Integer; CPoles : Array1OfPnt from TColgp) |
737 | ---Purpose : |
738 | -- Changes a column of poles or a part of this column. |
739 | raises OutOfRange, |
740 | ---Purpose : Raised if Vindex < 1 or VIndex > NbVPoles. |
741 | ConstructionError; |
742 | ---Purpose : |
743 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles. |
744 | |
745 | |
746 | SetPoleCol (me : mutable; VIndex : Integer; CPoles : Array1OfPnt from TColgp; |
747 | CPoleWeights : Array1OfReal from TColStd) |
748 | ---Purpose : |
749 | -- Changes a column of poles or a part of this column with the |
750 | -- corresponding weights. If the surface was rational it can |
751 | -- become non rational. If the surface was non rational it can |
752 | -- become rational. |
753 | raises OutOfRange, |
754 | ---Purpose : Raised if Vindex < 1 or VIndex > NbVPoles. |
755 | ConstructionError; |
756 | ---Purpose : |
757 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles |
758 | -- Raised if the bounds of CPoleWeights are not the same as the |
759 | -- bounds of CPoles. |
760 | -- Raised if one of the weight value of CPoleWeights is lower or |
761 | -- equal to Resolution from package gp. |
762 | |
763 | |
764 | SetPoleRow (me : mutable; UIndex : Integer; CPoles : Array1OfPnt from TColgp; |
765 | CPoleWeights : Array1OfReal from TColStd) |
766 | ---Purpose : |
767 | -- Changes a row of poles or a part of this row with the |
768 | -- corresponding weights. If the surface was rational it can |
769 | -- become non rational. If the surface was non rational it can |
770 | -- become rational. |
771 | raises OutOfRange, |
772 | ---Purpose : Raised if Uindex < 1 or UIndex > NbUPoles. |
773 | ConstructionError; |
774 | ---Purpose : |
775 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles |
776 | -- raises if the bounds of CPoleWeights are not the same as the |
777 | -- bounds of CPoles. |
778 | -- Raised if one of the weight value of CPoleWeights is lower or |
779 | -- equal to Resolution from package gp. |
780 | |
781 | |
782 | SetPoleRow (me : mutable; UIndex : Integer; CPoles : Array1OfPnt from TColgp) |
783 | ---Purpose : |
784 | -- Changes a row of poles or a part of this row. |
785 | raises OutOfRange, |
786 | ---Purpose : Raised if Uindex < 1 or UIndex > NbUPoles. |
787 | ConstructionError; |
788 | ---Purpose : |
789 | -- Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles. |
790 | |
791 | |
792 | SetWeight (me : mutable; UIndex, VIndex : Integer; Weight : Real) |
793 | ---Purpose : |
794 | -- Changes the weight of the pole of range UIndex, VIndex. |
795 | -- If the surface was non rational it can become rational. |
796 | -- If the surface was rational it can become non rational. |
797 | raises OutOfRange, |
798 | ---Purpose : |
799 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
800 | -- VIndex > NbVPoles |
801 | ConstructionError; |
802 | ---Purpose : |
803 | -- Raised if weight is lower or equal to Resolution from |
804 | -- package gp |
805 | |
806 | |
807 | SetWeightCol (me : mutable; VIndex : Integer; |
808 | CPoleWeights : Array1OfReal from TColStd) |
809 | ---Purpose : |
810 | -- Changes a column of weights of a part of this column. |
811 | raises OutOfRange, |
812 | ---Purpose : |
813 | -- Raised if VIndex < 1 or VIndex > NbVPoles |
814 | ConstructionError; |
815 | ---Purpose : |
816 | -- Raised if CPoleWeights.Lower() < 1 or |
817 | -- CPoleWeights.Upper() > NbUPoles. |
818 | -- Raised if a weight value is lower or equal to Resolution |
819 | -- from package gp. |
820 | |
821 | |
822 | SetWeightRow (me : mutable; UIndex : Integer; |
823 | CPoleWeights : Array1OfReal from TColStd) |
824 | ---Purpose : |
825 | -- Changes a row of weights or a part of this row. |
826 | raises OutOfRange, |
827 | ---Purpose : |
828 | -- Raised if UIndex < 1 or UIndex > NbUPoles |
829 | ConstructionError; |
830 | ---Purpose : |
831 | -- Raised if CPoleWeights.Lower() < 1 or |
832 | -- CPoleWeights.Upper() > NbVPoles. |
833 | -- Raised if a weight value is lower or equal to Resolution |
834 | -- from package gp. |
835 | |
836 | MovePoint(me: mutable; U, V : Real; P: Pnt; |
837 | UIndex1, UIndex2, VIndex1, VIndex2: Integer; |
838 | UFirstIndex, ULastIndex, VFirstIndex, VLastIndex: out Integer) |
839 | ---Purpose: Move a point with parameter U and V to P. |
840 | -- given u,v as parameters) to reach a new position |
841 | -- UIndex1, UIndex2, VIndex1, VIndex2: |
842 | -- indicates the poles which can be moved |
843 | -- if Problem in BSplineBasis calculation, no change |
844 | -- for the curve and |
845 | -- UFirstIndex, VLastIndex = 0 |
846 | -- VFirstIndex, VLastIndex = 0 |
847 | raises OutOfRange; |
848 | ---Purpose: |
849 | -- Raised if UIndex1 < UIndex2 or VIndex1 < VIndex2 or |
850 | -- UIndex1 < 1 || UIndex1 > NbUPoles or |
851 | -- UIndex2 < 1 || UIndex2 > NbUPoles |
852 | -- VIndex1 < 1 || VIndex1 > NbVPoles or |
853 | -- VIndex2 < 1 || VIndex2 > NbVPoles |
854 | |
855 | |
856 | |
857 | ---Purpose : characteristics of the surface |
858 | |
859 | IsUClosed (me) returns Boolean; |
860 | ---Purpose : |
861 | -- Returns true if the first control points row and the last |
862 | -- control points row are identical. The tolerance criterion |
863 | -- is Resolution from package gp. |
864 | |
865 | IsVClosed (me) returns Boolean; |
866 | ---Purpose : |
867 | -- Returns true if the first control points column and the |
868 | -- last last control points column are identical. |
869 | -- The tolerance criterion is Resolution from package gp. |
870 | |
871 | |
872 | IsCNu (me; N : Integer) returns Boolean |
873 | ---Purpose : |
874 | -- Returns True if the order of continuity of the surface in the |
875 | -- U direction is N. |
876 | raises RangeError; |
877 | ---Purpose : Raised if N < 0. |
878 | |
879 | |
880 | IsCNv (me; N : Integer) returns Boolean |
881 | ---Purpose : |
882 | -- Returns True if the order of continuity of the surface |
883 | -- in the V direction is N. |
884 | raises RangeError; |
885 | ---Purpose : Raised if N < 0. |
886 | |
887 | |
888 | IsUPeriodic (me) returns Boolean; |
889 | ---Purpose : |
890 | -- Returns True if the surface is closed in the U direction |
891 | -- and if the B-spline has been turned into a periodic surface |
892 | -- using the function SetUPeriodic. |
893 | |
894 | |
895 | IsURational (me) returns Boolean; |
896 | ---Purpose : |
897 | -- Returns False if for each row of weights all the weights |
898 | -- are identical. |
899 | -- The tolerance criterion is resolution from package gp. |
900 | -- Example : |
901 | -- |1.0, 1.0, 1.0| |
902 | -- if Weights = |0.5, 0.5, 0.5| returns False |
903 | -- |2.0, 2.0, 2.0| |
904 | |
905 | |
906 | IsVPeriodic (me) returns Boolean; |
907 | ---Purpose : |
908 | -- Returns True if the surface is closed in the V direction |
909 | -- and if the B-spline has been turned into a periodic |
910 | -- surface using the function SetVPeriodic. |
911 | |
912 | |
913 | IsVRational (me) returns Boolean; |
914 | ---Purpose : |
915 | -- Returns False if for each column of weights all the weights |
916 | -- are identical. |
917 | -- The tolerance criterion is resolution from package gp. |
918 | --- Examples : |
919 | -- |1.0, 2.0, 0.5| |
920 | -- if Weights = |1.0, 2.0, 0.5| returns False |
921 | -- |1.0, 2.0, 0.5| |
922 | |
923 | IsCacheValid(me; UParameter, VParameter : Real) returns Boolean ; |
924 | |
925 | ---Purpose : |
926 | -- Tells whether the Cache is valid for the |
927 | -- given parameter |
928 | -- Warnings : the parameter must be normalized within |
929 | -- the period if the curve is periodic. Otherwise |
930 | -- the answer will be false |
931 | -- |
932 | |
933 | Bounds (me; U1, U2, V1, V2 : out Real); |
934 | ---Purpose : |
935 | -- Returns the parametric bounds of the surface. |
936 | --- Warnings : |
937 | -- These parametric values are the bounds of the array of |
938 | -- knots UKnots and VKnots only if the first knots and the |
939 | -- last knots have a multiplicity equal to UDegree + 1 or |
940 | -- VDegree + 1 |
941 | |
942 | |
943 | Continuity (me) returns Shape from GeomAbs; |
944 | ---Purpose : |
945 | -- Returns the continuity of the surface : |
946 | -- C0 : only geometric continuity, |
947 | -- C1 : continuity of the first derivative all along the Surface, |
948 | -- C2 : continuity of the second derivative all along the Surface, |
949 | -- C3 : continuity of the third derivative all along the Surface, |
950 | -- CN : the order of continuity is infinite. |
951 | -- A B-spline surface is infinitely continuously differentiable |
952 | -- for the couple of parameters U, V such thats U != UKnots(i) |
953 | -- and V != VKnots(i). The continuity of the surface at a knot |
954 | -- value depends on the multiplicity of this knot. |
955 | --- Example : |
956 | -- If the surface is C1 in the V direction and C2 in the U |
957 | -- direction this function returns Shape = C1. |
958 | |
959 | |
960 | FirstUKnotIndex (me) returns Integer; |
961 | ---Purpose : |
962 | -- Computes the Index of the UKnots which gives the first |
963 | -- parametric value of the surface in the U direction. |
964 | -- The UIso curve corresponding to this value is a |
965 | -- boundary curve of the surface. |
966 | |
967 | |
968 | FirstVKnotIndex (me) returns Integer; |
969 | ---Purpose : |
970 | -- Computes the Index of the VKnots which gives the |
971 | -- first parametric value of the surface in the V direction. |
972 | -- The VIso curve corresponding to this knot is a boundary |
973 | -- curve of the surface. |
974 | |
975 | |
976 | LastUKnotIndex (me) returns Integer; |
977 | ---Purpose : |
978 | -- Computes the Index of the UKnots which gives the |
979 | -- last parametric value of the surface in the U direction. |
980 | -- The UIso curve corresponding to this knot is a boundary |
981 | -- curve of the surface. |
982 | |
983 | |
984 | LastVKnotIndex (me) returns Integer; |
985 | ---Purpose : |
986 | -- Computes the Index of the VKnots which gives the |
987 | -- last parametric value of the surface in the V direction. |
988 | -- The VIso curve corresponding to this knot is a |
989 | -- boundary curve of the surface. |
990 | |
991 | |
992 | NbUKnots (me) returns Integer; |
993 | ---Purpose : Returns the number of knots in the U direction. |
994 | |
995 | NbUPoles (me) returns Integer; |
996 | ---Purpose : Returns number of poles in the U direction. |
997 | |
998 | NbVKnots (me) returns Integer; |
999 | ---Purpose : Returns the number of knots in the V direction. |
1000 | |
1001 | NbVPoles (me) returns Integer; |
1002 | ---Purpose : Returns the number of poles in the V direction. |
1003 | |
1004 | |
1005 | Pole (me; UIndex, VIndex : Integer) returns Pnt |
1006 | ---Purpose: |
1007 | -- Returns the pole of range (UIndex, VIndex). |
1008 | raises OutOfRange; |
1009 | ---Purpose : |
1010 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
1011 | -- VIndex > NbVPoles. |
1012 | |
1013 | |
1014 | Poles (me; P : out Array2OfPnt from TColgp) |
1015 | ---Purpose : Returns the poles of the B-spline surface. |
1016 | raises DimensionError; |
1017 | ---Purpose : |
1018 | -- Raised if the length of P in the U and V direction |
1019 | -- is not equal to NbUpoles and NbVPoles. |
1020 | |
1021 | |
1022 | UDegree (me) returns Integer; |
1023 | ---Purpose : |
1024 | -- Returns the degree of the normalized B-splines Ni,n in the U |
1025 | -- direction. |
1026 | |
1027 | |
1028 | UKnot (me; UIndex : Integer) returns Real |
1029 | ---Purpose : |
1030 | -- Returns the Knot value of range UIndex. |
1031 | raises OutOfRange; |
1032 | ---Purpose : Raised if UIndex < 1 or UIndex > NbUKnots |
1033 | |
1034 | |
1035 | UKnotDistribution (me) returns BSplKnotDistribution from GeomAbs; |
1036 | ---Purpose : |
1037 | -- Returns NonUniform or Uniform or QuasiUniform or |
1038 | -- PiecewiseBezier. If all the knots differ by a |
1039 | -- positive constant from the preceding knot in the U |
1040 | -- direction the B-spline surface can be : |
1041 | -- - Uniform if all the knots are of multiplicity 1, |
1042 | -- - QuasiUniform if all the knots are of multiplicity 1 |
1043 | -- except for the first and last knot which are of |
1044 | -- multiplicity Degree + 1, |
1045 | -- - PiecewiseBezier if the first and last knots have |
1046 | -- multiplicity Degree + 1 and if interior knots have |
1047 | -- multiplicity Degree |
1048 | -- otherwise the surface is non uniform in the U direction |
1049 | -- The tolerance criterion is Resolution from package gp. |
1050 | |
1051 | |
1052 | UKnots (me; Ku : out Array1OfReal from TColStd) |
1053 | ---Purpose : Returns the knots in the U direction. |
1054 | raises DimensionError; |
1055 | ---Purpose : |
1056 | -- Raised if the length of Ku is not equal to the number of knots |
1057 | -- in the U direction. |
1058 | |
1059 | |
1060 | UKnotSequence (me; Ku : out Array1OfReal from TColStd) |
1061 | ---Purpose : Returns the uknots sequence. |
1062 | -- In this sequence the knots with a multiplicity greater than 1 |
1063 | -- are repeated. |
1064 | --- Example : |
1065 | -- Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
1066 | raises DimensionError; |
1067 | ---Purpose : |
1068 | -- Raised if the length of Ku is not equal to NbUPoles + UDegree + 1 |
1069 | |
1070 | |
1071 | UMultiplicity (me; UIndex : Integer) returns Integer |
1072 | ---Purpose : |
1073 | -- Returns the multiplicity value of knot of range UIndex in |
1074 | -- the u direction. |
1075 | raises OutOfRange; |
1076 | ---Purpose : Raised if UIndex < 1 or UIndex > NbUKnots. |
1077 | |
1078 | |
1079 | UMultiplicities (me; Mu : out Array1OfInteger from TColStd) |
1080 | ---Purpose : |
1081 | -- Returns the multiplicities of the knots in the U direction. |
1082 | raises DimensionError; |
1083 | ---Purpose : |
1084 | -- Raised if the length of Mu is not equal to the number of |
1085 | -- knots in the U direction. |
1086 | |
1087 | |
1088 | VDegree (me) returns Integer; |
1089 | ---Purpose : |
1090 | -- Returns the degree of the normalized B-splines Ni,d in the |
1091 | -- V direction. |
1092 | |
1093 | |
1094 | VKnot (me; VIndex : Integer) returns Real |
1095 | ---Purpose : Returns the Knot value of range VIndex. |
1096 | raises OutOfRange; |
1097 | --- Purpse : Raised if VIndex < 1 or VIndex > NbVKnots |
1098 | |
1099 | |
1100 | VKnotDistribution (me) returns BSplKnotDistribution from GeomAbs; |
1101 | ---Purpose : |
1102 | -- Returns NonUniform or Uniform or QuasiUniform or |
1103 | -- PiecewiseBezier. If all the knots differ by a positive |
1104 | -- constant from the preceding knot in the V direction the |
1105 | -- B-spline surface can be : |
1106 | -- - Uniform if all the knots are of multiplicity 1, |
1107 | -- - QuasiUniform if all the knots are of multiplicity 1 |
1108 | -- except for the first and last knot which are of |
1109 | -- multiplicity Degree + 1, |
1110 | -- - PiecewiseBezier if the first and last knots have |
1111 | -- multiplicity Degree + 1 and if interior knots have |
1112 | -- multiplicity Degree |
1113 | -- otherwise the surface is non uniform in the V direction. |
1114 | -- The tolerance criterion is Resolution from package gp. |
1115 | |
1116 | |
1117 | VKnots (me; Kv : out Array1OfReal from TColStd) |
1118 | ---Purpose : Returns the knots in the V direction. |
1119 | raises DimensionError; |
1120 | ---Purpose : |
1121 | -- Raised if the length of Kv is not equal to the number of |
1122 | -- knots in the V direction. |
1123 | |
1124 | |
1125 | VKnotSequence (me; Kv : out Array1OfReal from TColStd) |
1126 | ---Purpose : Returns the vknots sequence. |
1127 | -- In this sequence the knots with a multiplicity greater than 1 |
1128 | -- are repeated. |
1129 | --- Example : |
1130 | -- Kv = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
1131 | raises DimensionError; |
1132 | ---Purpose : |
1133 | -- Raised if the length of Kv is not equal to NbVPoles + VDegree + 1 |
1134 | |
1135 | |
1136 | VMultiplicity (me; VIndex : Integer) returns Integer |
1137 | ---Purpose : |
1138 | -- Returns the multiplicity value of knot of range VIndex in |
1139 | -- the v direction. |
1140 | raises OutOfRange; |
1141 | ---Purpose : Raised if VIndex < 1 or VIndex > NbVKnots |
1142 | |
1143 | |
1144 | VMultiplicities (me; Mv : out Array1OfInteger from TColStd) |
1145 | ---Purpose : |
1146 | -- Returns the multiplicities of the knots in the V direction. |
1147 | raises DimensionError; |
1148 | ---Purpose : |
1149 | -- Raised if the length of Mv is not equal to the number of |
1150 | -- knots in the V direction. |
1151 | |
1152 | |
1153 | Weight (me; UIndex, VIndex : Integer) returns Real |
1154 | ---Purpose : Returns the weight value of range UIndex, VIndex. |
1155 | raises OutOfRange; |
1156 | ---Purpose : |
1157 | -- Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 |
1158 | -- or VIndex > NbVPoles. |
1159 | |
1160 | |
1161 | Weights (me; W : out Array2OfReal from TColStd) |
1162 | ---Purpose : Returns the weights of the B-spline surface. |
1163 | raises DimensionError; |
1164 | ---Purpose : |
1165 | -- Raised if the length of W in the U and V direction is |
1166 | -- not equal to NbUPoles and NbVPoles. |
1167 | |
1168 | |
1169 | |
1170 | |
1171 | |
1172 | |
1173 | ---Purpose : value and derivatives computation |
1174 | |
1175 | D0 (me; U, V : Real; P : out Pnt); |
1176 | |
1177 | |
1178 | D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec) |
1179 | raises UndefinedDerivative; |
1180 | ---Purpose : Raised if the continuity of the surface is not C1. |
1181 | |
1182 | |
1183 | D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec) |
1184 | raises UndefinedDerivative; |
1185 | ---Purpose : Raised if the continuity of the surface is not C2. |
1186 | |
1187 | |
1188 | D3 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, |
1189 | D3UVV : out Vec) |
1190 | raises UndefinedDerivative; |
1191 | ---Purpose : Raised if the continuity of the surface is not C3. |
1192 | |
1193 | |
1194 | DN (me; U, V : Real; Nu, Nv : Integer) returns Vec |
1195 | ---Purpose : |
1196 | -- Nu is the order of derivation in the U parametric direction and |
1197 | -- Nv is the order of derivation in the V parametric direction. |
1198 | raises UndefinedDerivative, |
1199 | ---Purpose : |
1200 | -- Raised if the continuity of the surface is not CNu in the U |
1201 | -- direction and CNv in the V direction. |
1202 | RangeError; |
1203 | ---Purpose : |
1204 | -- Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
1205 | |
1206 | |
1207 | |
1208 | |
1209 | |
1210 | |
1211 | ---Purpose : |
1212 | -- The following functions computes the point for the |
1213 | -- parametric values (U, V) and the derivatives at |
1214 | -- this point on the B-spline surface patch delimited |
1215 | -- with the knots FromUK1, FromVK1 and the knots ToUK2, |
1216 | -- ToVK2. (U, V) can be out of these parametric bounds |
1217 | -- but for the computation we only use the definition |
1218 | -- of the surface between these knots. This method is |
1219 | -- useful to compute local derivative, if the order of |
1220 | -- continuity of the whole surface is not greater enough. |
1221 | -- Inside the parametric knot's domain previously defined |
1222 | -- the evaluations are the same as if we consider the whole |
1223 | -- definition of the surface. Of course the evaluations are |
1224 | -- different outside this parametric domain. |
1225 | |
1226 | |
1227 | LocalD0 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer; |
1228 | P : out Pnt) |
1229 | raises DomainError, |
1230 | ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1231 | OutOfRange; |
1232 | ---Purpose : |
1233 | -- Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1234 | -- LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1235 | -- [FirstVKnotIndex, LastVKnotIndex] |
1236 | |
1237 | |
1238 | LocalD1 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer; |
1239 | P : out Pnt; D1U, D1V : out Vec) |
1240 | raises UndefinedDerivative, |
1241 | ---Purpose : |
1242 | -- Raised if the local continuity of the surface is not C1 |
1243 | -- between the knots FromUK1, ToUK2 and FromVK1, ToVK2. |
1244 | DomainError, |
1245 | ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1246 | OutOfRange; |
1247 | ---Purpose : |
1248 | -- Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1249 | -- LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1250 | -- [FirstVKnotIndex, LastVKnotIndex] |
1251 | |
1252 | |
1253 | LocalD2 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer; |
1254 | P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec) |
1255 | raises UndefinedDerivative, |
1256 | ---Purpose : |
1257 | -- Raised if the local continuity of the surface is not C2 |
1258 | -- between the knots FromUK1, ToUK2 and FromVK1, ToVK2. |
1259 | DomainError, |
1260 | ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1261 | OutOfRange; |
1262 | ---Purpose : |
1263 | -- Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1264 | -- LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1265 | -- [FirstVKnotIndex, LastVKnotIndex] |
1266 | |
1267 | |
1268 | LocalD3 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer; |
1269 | P : out Pnt; D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : |
1270 | out Vec) |
1271 | raises UndefinedDerivative, |
1272 | ---Purpose : |
1273 | -- Raised if the local continuity of the surface is not C3 |
1274 | -- between the knots FromUK1, ToUK2 and FromVK1, ToVK2. |
1275 | DomainError, |
1276 | ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1277 | OutOfRange; |
1278 | ---Purpose : |
1279 | -- Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1280 | -- LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1281 | -- [FirstVKnotIndex, LastVKnotIndex] |
1282 | |
1283 | |
1284 | LocalDN (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer; |
1285 | Nu, Nv : Integer) |
1286 | returns Vec |
1287 | raises UndefinedDerivative, |
1288 | ---Purpose : |
1289 | -- Raised if the local continuity of the surface is not CNu |
1290 | -- between the knots FromUK1, ToUK2 and CNv between the knots |
1291 | -- FromVK1, ToVK2. |
1292 | DomainError, |
1293 | ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1294 | RangeError, |
1295 | -- Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
1296 | OutOfRange; |
1297 | ---Purpose : |
1298 | -- Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1299 | -- LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1300 | -- [FirstVKnotIndex, LastVKnotIndex] |
1301 | |
1302 | LocalValue(me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer) |
1303 | ---Purpose : |
1304 | -- Computes the point of parameter U, V on the BSpline surface patch |
1305 | -- defines between the knots UK1 UK2, VK1, VK2. U can be out of the |
1306 | -- bounds [Knot UK1, Knot UK2] and V can be outof the bounds |
1307 | -- [Knot VK1, Knot VK2] but for the computation we only use the |
1308 | -- definition of the surface between these knot values. |
1309 | returns Pnt |
1310 | raises DomainError, |
1311 | ---Purpose : Raises if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1312 | OutOfRange; |
1313 | ---Purpose : |
1314 | -- Raises if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1315 | -- LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1316 | -- [FirstVKnotIndex, LastVKnotIndex] |
1317 | |
1318 | |
1319 | |
6e33d3ce |
1320 | UIso (me; U : Real) returns Curve; |
7fd59977 |
1321 | ---Purpose : |
1322 | -- Computes the U isoparametric curve. |
1323 | -- A B-spline curve is returned. |
1324 | |
1325 | |
6e33d3ce |
1326 | VIso (me; V : Real) returns Curve; |
7fd59977 |
1327 | ---Purpose : |
1328 | -- Computes the V isoparametric curve. |
1329 | -- A B-spline curve is returned. |
1330 | |
1331 | |
6e33d3ce |
1332 | UIso (me; U : Real; CheckRational : Boolean) returns Curve; |
7fd59977 |
1333 | ---Purpose : |
1334 | -- Computes the U isoparametric curve. |
1335 | -- If CheckRational=False, no try to make it non-rational. |
1336 | -- A B-spline curve is returned. |
1337 | |
1338 | |
6e33d3ce |
1339 | VIso (me; V : Real; CheckRational : Boolean) returns Curve; |
7fd59977 |
1340 | ---Purpose : |
1341 | -- Computes the V isoparametric curve. |
1342 | -- If CheckRational=False, no try to make it non-rational. |
1343 | -- A B-spline curve is returned. |
1344 | |
1345 | |
1346 | |
1347 | |
1348 | |
1349 | ---Purpose : transformations |
1350 | |
1351 | Transform (me : mutable; T : Trsf) ; |
1352 | |
1353 | --- Purpose: Applies the transformation T to this BSpline surface. |
1354 | |
1355 | MaxDegree (myclass) returns Integer; |
1356 | ---Purpose : |
1357 | -- Returns the value of the maximum degree of the normalized |
1358 | -- B-spline basis functions in the u and v directions. |
1359 | |
1360 | |
1361 | Resolution(me : mutable; |
1362 | Tolerance3D : Real ; |
1363 | UTolerance : out Real ; |
1364 | VTolerance : out Real) |
1365 | ---Purpose: Computes two tolerance values for this BSpline |
1366 | -- surface, based on the given tolerance in 3D space |
1367 | -- Tolerance3D. The tolerances computed are: |
1368 | -- - UTolerance in the u parametric direction, and |
1369 | -- - VTolerance in the v parametric direction. |
1370 | -- If f(u,v) is the equation of this BSpline surface, |
1371 | -- UTolerance and VTolerance guarantee that : |
1372 | -- | u1 - u0 | < UTolerance and |
1373 | -- | v1 - v0 | < VTolerance |
1374 | -- ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D |
1375 | ; |
1376 | |
6e33d3ce |
1377 | Copy (me) returns like me; |
7fd59977 |
1378 | |
1379 | ---Purpose: Creates a new object which is a copy of this BSpline surface. |
1380 | |
1381 | UpdateUKnots(me : mutable) |
1382 | ---Purpose: Recompute the flatknots, the knotsdistribution, the |
1383 | -- continuity for U. |
1384 | is static private; |
1385 | |
1386 | UpdateVKnots(me : mutable) |
1387 | ---Purpose: Recompute the flatknots, the knotsdistribution, the |
1388 | -- continuity for V. |
1389 | is static private; |
1390 | |
1391 | |
1392 | InvalidateCache(me : mutable) |
1393 | ---Purpose : Invalidates the cache. This has to be private this has to be private |
1394 | is static private; |
1395 | |
1396 | ValidateCache(me : mutable ; UParameter : Real; |
1397 | VParameter : Real) |
1398 | |
1399 | is static private; |
1400 | ---Purpose : updates the cache and validates it |
1401 | |
1402 | |
1403 | fields |
1404 | |
1405 | urational : Boolean; |
1406 | vrational : Boolean; |
1407 | uperiodic : Boolean; |
1408 | vperiodic : Boolean; |
1409 | uknotSet : BSplKnotDistribution from GeomAbs; |
1410 | vknotSet : BSplKnotDistribution from GeomAbs; |
1411 | Usmooth : Shape from GeomAbs; |
1412 | Vsmooth : Shape from GeomAbs; |
1413 | udeg : Integer; |
1414 | vdeg : Integer; |
1415 | poles : HArray2OfPnt from TColgp; |
1416 | weights : HArray2OfReal from TColStd; |
1417 | ufknots : HArray1OfReal from TColStd; |
1418 | vfknots : HArray1OfReal from TColStd; |
1419 | uknots : HArray1OfReal from TColStd; |
1420 | vknots : HArray1OfReal from TColStd; |
1421 | umults : HArray1OfInteger from TColStd; |
1422 | vmults : HArray1OfInteger from TColStd; |
1423 | -- Inplementation of the cache on surfaces |
1424 | cachepoles : HArray2OfPnt from TColgp; |
1425 | -- Taylor expansion of the poles function, in homogeneous |
1426 | -- form if the curve is rational. The taylor expansion |
1427 | -- is normalized so that the span corresponds to |
1428 | -- [0 1]x[0 1]. The Taylor expension of lower degree |
1429 | -- is stored as consecutive Pnt in the array that is |
1430 | -- if udeg <= vdeg than the array stores the following |
1431 | -- |
1432 | -- (2,0) (3,0) |
1433 | -- (1,0) f (u0,v0) f (u0,v0) |
1434 | -- f (u0,v0) f (u0,v0) ------------- ----------- |
1435 | -- 2 3! |
1436 | -- |
1437 | -- (2,1) (3,1) |
1438 | -- (0,1) (1,1) f (u0,v0) f (u0,v0) |
1439 | -- f (u0,v0) f (u0,v0) ------------- ----------- |
1440 | -- 2 3! |
1441 | -- |
1442 | -- Otherwise it is stored in the following fashion |
1443 | -- |
1444 | -- |
1445 | -- (0,2) (0,3) |
1446 | -- (0,1) f (u0,v0) f (u0,v0) |
1447 | -- f (u0,v0) f (u0,v0) ------------- ----------- |
1448 | -- 2 3! |
1449 | -- |
1450 | -- (1,2) (1,3) |
1451 | -- (1,0) (1,1) f (u0,v0) f (u0,v0) |
1452 | -- f (u0,v0) f (u0,v0) ------------- ----------- |
1453 | -- 2 3! |
1454 | -- |
1455 | -- The size of the array is (1,Max degree) (1, Min degree) |
1456 | -- |
1457 | cacheweights : HArray2OfReal from TColStd; |
1458 | -- Taylor expansion of the poles function, in homogeneous |
1459 | -- form if the curve is rational. The taylor expansion |
1460 | -- is normalized so that the span corresponds to |
1461 | -- [0 1]x[0 1]. The Taylor expension of lower degree |
1462 | -- is stored as consecutive Real in the array as explained above |
1463 | ucacheparameter : Real ; |
1464 | vcacheparameter : Real ; |
1465 | -- Parameters at which the Taylor expension is stored in |
1466 | -- the cache |
1467 | ucachespanlenght : Real ; |
1468 | vcachespanlenght : Real ; |
1469 | -- Since the Taylor expansion is normalized in the |
1470 | -- cache to evaluate the cache one has to use |
1471 | -- (UParameter - uparametercache) / ucachespanlenght |
1472 | -- (VParameter - vparametercache) / vcachespanlenght |
1473 | ucachespanindex : Integer ; |
1474 | vcachespanindex : Integer ; |
1475 | -- the span for which the cache is valid if |
1476 | -- validcache is 1 |
1477 | validcache : Integer ; |
1478 | |
1479 | -- usefull to evaluate the parametric resolutions |
1480 | umaxderivinv : Real from Standard; |
1481 | vmaxderivinv : Real from Standard; |
1482 | maxderivinvok : Boolean from Standard; |
1483 | |
83ada95b |
1484 | myMutex : Mutex from Standard; |
1485 | -- protected bsplinesurface-cache |
1486 | |
7fd59977 |
1487 | end; |