1 -- Created on: 1993-03-24
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- xab : modified 15-Mar-95 : added cache mecanism to speed up
21 class BSplineCurve from Geom2d inherits BoundedCurve from Geom2d
23 --- Purpose : Describes a BSpline curve.
24 -- A BSpline curve can be:
25 -- - uniform or non-uniform,
26 -- - rational or non-rational,
27 -- - periodic or non-periodic.
28 -- A BSpline curve is defined by:
29 -- - its degree; the degree for a
30 -- Geom2d_BSplineCurve is limited to a value (25)
31 -- which is defined and controlled by the system. This
32 -- value is returned by the function MaxDegree;
33 -- - its periodic or non-periodic nature;
34 -- - a table of poles (also called control points), with
35 -- their associated weights if the BSpline curve is
36 -- rational. The poles of the curve are "control points"
37 -- used to deform the curve. If the curve is
38 -- non-periodic, the first pole is the start point of the
39 -- curve, and the last pole is the end point of the
40 -- curve. The segment, which joins the first pole to the
41 -- second pole, is the tangent to the curve at its start
42 -- point, and the segment, which joins the last pole to
43 -- the second-from-last pole, is the tangent to the
44 -- curve at its end point. If the curve is periodic, these
45 -- geometric properties are not verified. It is more
46 -- difficult to give a geometric signification to the
47 -- weights but they are useful for providing exact
48 -- representations of the arcs of a circle or ellipse.
49 -- Moreover, if the weights of all the poles are equal,
50 -- the curve has a polynomial equation; it is
51 -- therefore a non-rational curve.
52 -- - a table of knots with their multiplicities. For a
53 -- Geom2d_BSplineCurve, the table of knots is an
54 -- increasing sequence of reals without repetition; the
55 -- multiplicities define the repetition of the knots. A
56 -- BSpline curve is a piecewise polynomial or rational
57 -- curve. The knots are the parameters of junction
58 -- points between two pieces. The multiplicity
59 -- Mult(i) of the knot Knot(i) of the BSpline
60 -- curve is related to the degree of continuity of the
61 -- curve at the knot Knot(i), which is equal to
62 -- Degree - Mult(i) where Degree is the
63 -- degree of the BSpline curve.
64 -- If the knots are regularly spaced (i.e. the difference
65 -- between two consecutive knots is a constant), three
66 -- specific and frequently used cases of knot distribution
68 -- - "uniform" if all multiplicities are equal to 1,
69 -- - "quasi-uniform" if all multiplicities are equal to 1,
70 -- except the first and the last knot which have a
71 -- multiplicity of Degree + 1, where Degree is
72 -- the degree of the BSpline curve,
73 -- - "Piecewise Bezier" if all multiplicities are equal to
74 -- Degree except the first and last knot which have
75 -- a multiplicity of Degree + 1, where Degree is
76 -- the degree of the BSpline curve. A curve of this
77 -- type is a concatenation of arcs of Bezier curves.
78 -- If the BSpline curve is not periodic:
79 -- - the bounds of the Poles and Weights tables are 1
80 -- and NbPoles, where NbPoles is the number of
81 -- poles of the BSpline curve,
82 -- - the bounds of the Knots and Multiplicities tables are
83 -- 1 and NbKnots, where NbKnots is the number
84 -- of knots of the BSpline curve.
85 -- If the BSpline curve is periodic, and if there are k
86 -- periodic knots and p periodic poles, the period is:
87 -- period = Knot(k + 1) - Knot(1)
88 -- and the poles and knots tables can be considered as
89 -- infinite tables, such that:
90 -- - Knot(i+k) = Knot(i) + period
91 -- - Pole(i+p) = Pole(i)
92 -- Note: data structures of a periodic BSpline curve are
93 -- more complex than those of a non-periodic one.
95 -- In this class we consider that a weight value is zero if
96 -- Weight <= Resolution from package gp.
97 -- For two parametric values (or two knot values) U1, U2 we
98 -- consider that U1 = U2 if Abs (U2 - U1) <= Epsilon (U1).
99 -- For two weights values W1, W2 we consider that W1 = W2 if
100 -- Abs (W2 - W1) <= Epsilon (W1). The method Epsilon is
101 -- defined in the class Real from package Standard.
104 -- . A survey of curve and surface methods in CADG Wolfgang BOHM
106 -- . On de Boor-like algorithms and blossoming Wolfgang BOEHM
108 -- . Blossoming and knot insertion algorithms for B-spline curves
110 -- . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
111 -- . Curves and Surfaces for Computer Aided Geometric Design,
112 -- a practical guide Gerald Farin
115 uses Array1OfInteger from TColStd,
116 Array1OfReal from TColStd,
117 HArray1OfInteger from TColStd,
118 HArray1OfReal from TColStd,
119 Array1OfPnt2d from TColgp,
122 HArray1OfPnt2d from TColgp,
125 BSplKnotDistribution from GeomAbs,
126 Geometry from Geom2d,
129 raises ConstructionError from Standard,
130 DimensionError from Standard,
131 DomainError from Standard,
132 OutOfRange from Standard,
133 RangeError from Standard,
134 NoSuchObject from Standard,
135 UndefinedDerivative from Geom2d
141 Create (Poles : Array1OfPnt2d from TColgp;
142 Knots : Array1OfReal from TColStd;
143 Multiplicities : Array1OfInteger from TColStd;
145 Periodic : Boolean = Standard_False)
147 returns BSplineCurve from Geom2d
149 ---Purpose : Creates a non-rational B_spline curve on the
150 -- basis <Knots, Multiplicities> of degree <Degree>.
151 -- The following conditions must be verified.
152 -- 0 < Degree <= MaxDegree.
154 -- Knots.Length() == Mults.Length() >= 2
156 -- Knots(i) < Knots(i+1) (Knots are increasing)
158 -- 1 <= Mults(i) <= Degree
160 -- On a non periodic curve the first and last multiplicities
161 -- may be Degree+1 (this is even recommanded if you want the
162 -- curve to start and finish on the first and last pole).
164 -- On a periodic curve the first and the last multicities
167 -- on non-periodic curves
169 -- Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2
171 -- on periodic curves
173 -- Poles.Length() == Sum(Mults(i)) except the first or last
175 raises ConstructionError;
179 Create (Poles : Array1OfPnt2d from TColgp;
180 Weights : Array1OfReal from TColStd;
181 Knots : Array1OfReal from TColStd;
182 Multiplicities : Array1OfInteger from TColStd;
184 Periodic : Boolean = Standard_False)
186 returns BSplineCurve from Geom2d
188 ---Purpose : Creates a rational B_spline curve on the basis
189 -- <Knots, Multiplicities> of degree <Degree>.
190 -- The following conditions must be verified.
191 -- 0 < Degree <= MaxDegree.
193 -- Knots.Length() == Mults.Length() >= 2
195 -- Knots(i) < Knots(i+1) (Knots are increasing)
197 -- 1 <= Mults(i) <= Degree
199 -- On a non periodic curve the first and last multiplicities
200 -- may be Degree+1 (this is even recommanded if you want the
201 -- curve to start and finish on the first and last pole).
203 -- On a periodic curve the first and the last multicities
206 -- on non-periodic curves
208 -- Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2
210 -- on periodic curves
212 -- Poles.Length() == Sum(Mults(i)) except the first or last
214 raises ConstructionError;
217 IncreaseDegree (me : mutable; Degree : Integer)
219 ---Purpose: Increases the degree of this BSpline curve to
220 -- Degree. As a result, the poles, weights and
221 -- multiplicities tables are modified; the knots table is
222 -- not changed. Nothing is done if Degree is less than
223 -- or equal to the current degree.
225 -- Standard_ConstructionError if Degree is greater than
226 -- Geom2d_BSplineCurve::MaxDegree().
227 raises ConstructionError;
230 IncreaseMultiplicity (me : mutable; Index : Integer; M : Integer)
232 ---Purpose :Increases the multiplicity of the knot <Index> to
235 -- If <M> is lower or equal to the current
236 -- multiplicity nothing is done. If <M> is higher than
237 -- the degree the degree is used.
241 ---Purpose: If <Index> is not in [FirstUKnotIndex, LastUKnotIndex]
244 IncreaseMultiplicity (me : mutable; I1, I2 : Integer; M : Integer)
246 ---Purpose :Increases the multiplicities of the knots in
249 -- For each knot if <M> is lower or equal to the
250 -- current multiplicity nothing is done. If <M> is
251 -- higher than the degree the degree is used.
252 -- As a result, the poles and weights tables of this curve are modified.
254 -- It is forbidden to modify the multiplicity of the first or
255 -- last knot of a non-periodic curve. Be careful as
256 -- Geom2d does not protect against this.
258 -- Standard_OutOfRange if either Index, I1 or I2 is
259 -- outside the bounds of the knots table.
263 IncrementMultiplicity (me : mutable; I1, I2 : Integer; M : Integer)
265 ---Purpose : Increases by M the multiplicity of the knots of indexes
266 -- I1 to I2 in the knots table of this BSpline curve. For
267 -- each knot, the resulting multiplicity is limited to the
268 -- degree of this curve. If M is negative, nothing is done.
269 -- As a result, the poles and weights tables of this
270 -- BSpline curve are modified.
272 -- It is forbidden to modify the multiplicity of the first or
273 -- last knot of a non-periodic curve. Be careful as
274 -- Geom2d does not protect against this.
276 -- Standard_OutOfRange if I1 or I2 is outside the
277 -- bounds of the knots table.
282 InsertKnot (me : mutable;
285 ParametricTolerance : Real = 0.0);
287 ---Purpose: Inserts a knot value in the sequence of knots. If
288 -- <U> is an existing knot the multiplicity is
291 -- If U is not on the parameter range nothing is
294 -- If the multiplicity is negative or null nothing is
295 -- done. The new multiplicity is limited to the
298 -- The tolerance criterion for knots equality is
299 -- the max of Epsilon(U) and ParametricTolerance.
301 -- - If U is less than the first parameter or greater than
302 -- the last parameter of this BSpline curve, nothing is done.
303 -- - If M is negative or null, nothing is done.
304 -- - The multiplicity of a knot is limited to the degree of
305 -- this BSpline curve.
308 InsertKnots (me : mutable; Knots : Array1OfReal from TColStd;
309 Mults : Array1OfInteger from TColStd;
310 ParametricTolerance : Real = 0.0;
311 Add : Boolean = Standard_False);
313 ---Purpose: Inserts the values of the array Knots, with the
314 -- respective multiplicities given by the array Mults, into
315 -- the knots table of this BSpline curve.
316 -- If a value of the array Knots is an existing knot, its multiplicity is:
317 -- - increased by M, if Add is true, or
318 -- - increased to M, if Add is false (default value).
319 -- The tolerance criterion used for knot equality is the
320 -- larger of the values ParametricTolerance (defaulted
321 -- to 0.) and Standard_Real::Epsilon(U),
322 -- where U is the current knot value.
324 -- - For a value of the array Knots which is less than
325 -- the first parameter or greater than the last
326 -- parameter of this BSpline curve, nothing is done.
327 -- - For a value of the array Mults which is negative or
328 -- null, nothing is done.
329 -- - The multiplicity of a knot is limited to the degree of
330 -- this BSpline curve.
334 RemoveKnot(me : mutable; Index : Integer;
336 Tolerance : Real) returns Boolean
338 ---Purpose : Reduces the multiplicity of the knot of index Index
339 -- to M. If M is equal to 0, the knot is removed.
340 -- With a modification of this type, the array of poles is also modified.
341 -- Two different algorithms are systematically used to
342 -- compute the new poles of the curve. If, for each
343 -- pole, the distance between the pole calculated
344 -- using the first algorithm and the same pole
345 -- calculated using the second algorithm, is less than
346 -- Tolerance, this ensures that the curve is not
347 -- modified by more than Tolerance. Under these
348 -- conditions, true is returned; otherwise, false is returned.
349 -- A low tolerance is used to prevent modification of
350 -- the curve. A high tolerance is used to "smooth" the curve.
352 -- Standard_OutOfRange if Index is outside the
353 -- bounds of the knots table.
357 InsertPoleAfter (me : mutable; Index : Integer; P : Pnt2d;
360 -- The new pole is inserted after the pole of range Index.
361 -- If the curve was non rational it can become rational.
362 raises ConstructionError,
364 -- Raised if the B-spline is NonUniform or PiecewiseBezier or if
367 --- Purpose : Raised if Index is not in the range [1, Number of Poles]
370 InsertPoleBefore (me : mutable; Index : Integer; P : Pnt2d;
373 -- The new pole is inserted before the pole of range Index.
374 -- If the curve was non rational it can become rational.
375 raises ConstructionError,
377 -- Raised if the B-spline is NonUniform or PiecewiseBezier or if
380 --- Purpose : Raised if Index is not in the range [1, Number of Poles]
383 RemovePole (me : mutable; Index : Integer)
385 -- Removes the pole of range Index
386 -- If the curve was rational it can become non rational.
387 raises ConstructionError,
389 -- Raised if the B-spline is NonUniform or PiecewiseBezier.
390 -- Raised if the number of poles of the B-spline curve is lower or
391 -- equal to 2 before removing.
393 --- Purpose : Raised if Index is not in the range [1, Number of Poles]
395 Reverse (me : mutable);
396 --- Purpose : Reverses the orientation of this BSpline curve. As a result
397 -- - the knots and poles tables are modified;
398 -- - the start point of the initial curve becomes the end
399 -- point of the reversed curve;
400 -- - the end point of the initial curve becomes the start
401 -- point of the reversed curve.
404 ReversedParameter(me; U : Real) returns Real;
405 ---Purpose: Computes the parameter on the reversed curve for
406 -- the point of parameter U on this BSpline curve.
407 -- The returned value is: UFirst + ULast - U,
408 -- where UFirst and ULast are the values of the
409 -- first and last parameters of this BSpline curve.
412 Segment (me : mutable; U1, U2 : Real)
413 ---Purpose : Modifies this BSpline curve by segmenting it
414 -- between U1 and U2. Either of these values can be
415 -- outside the bounds of the curve, but U2 must be greater than U1.
416 -- All data structure tables of this BSpline curve are
417 -- modified, but the knots located between U1 and U2
418 -- are retained. The degree of the curve is not modified.
420 -- Even if <me> is not closed it can become closed after the
421 -- segmentation for example if U1 or U2 are out of the bounds
422 -- of the curve <me> or if the curve makes loop.
423 -- After the segmentation the length of a curve can be null.
424 -- - The segmentation of a periodic curve over an
425 --- interval corresponding to its period generates a
426 -- non-periodic curve with equivalent geometry.
428 -- Standard_DomainError if U2 is less than U1.
429 raises DomainError from Standard;
430 ---Purpose: raises if U2 < U1.
433 SetKnot (me : mutable; Index : Integer; K : Real)
434 --- Purpose : Modifies this BSpline curve by assigning the value K
435 -- to the knot of index Index in the knots table. This is a
436 -- relatively local modification because K must be such that:
437 -- Knots(Index - 1) < K < Knots(Index + 1)
439 -- Standard_ConstructionError if:
440 -- - K is not such that:
441 -- Knots(Index - 1) < K < Knots(Index + 1)
442 -- - M is greater than the degree of this BSpline curve
443 -- or lower than the previous multiplicity of knot of
444 -- index Index in the knots table.
445 -- Standard_OutOfRange if Index is outside the bounds of the knots table.
446 raises ConstructionError,
450 SetKnots (me : mutable; K : Array1OfReal from TColStd)
451 --- Purpose : Modifies this BSpline curve by assigning the array
452 -- K to its knots table. The multiplicity of the knots is not modified.
454 -- Standard_ConstructionError if the values in the
455 -- array K are not in ascending order.
456 -- Standard_OutOfRange if the bounds of the array
457 -- K are not respectively 1 and the number of knots of this BSpline curve.
458 raises ConstructionError,
462 SetKnot (me : mutable; Index : Integer; K : Real; M : Integer)
463 --- Purpose : Modifies this BSpline curve by assigning the value K
464 -- to the knot of index Index in the knots table. This is a
465 -- relatively local modification because K must be such that:
466 -- Knots(Index - 1) < K < Knots(Index + 1)
467 -- The second syntax allows you also to increase the
468 -- multiplicity of the knot to M (but it is not possible to
469 -- decrease the multiplicity of the knot with this function).
471 -- Standard_ConstructionError if:
472 -- - K is not such that:
473 -- Knots(Index - 1) < K < Knots(Index + 1)
474 -- - M is greater than the degree of this BSpline curve
475 -- or lower than the previous multiplicity of knot of
476 -- index Index in the knots table.
477 -- Standard_OutOfRange if Index is outside the bounds of the knots table.
478 raises ConstructionError,
481 PeriodicNormalization(me ; U : in out Real) ;
483 ---Purpose : Computes the parameter normalized within the
484 -- "first" period of this BSpline curve, if it is periodic:
485 -- the returned value is in the range Param1 and
486 -- Param1 + Period, where:
487 -- - Param1 is the "first parameter", and
488 -- - Period the period of this BSpline curve.
489 -- Note: If this curve is not periodic, U is not modified.
491 SetPeriodic (me : mutable)
492 --- Purpose :Changes this BSpline curve into a periodic curve.
493 -- To become periodic, the curve must first be closed.
494 -- Next, the knot sequence must be periodic. For this,
495 -- FirstUKnotIndex and LastUKnotIndex are used to
496 -- compute I1 and I2, the indexes in the knots array
497 -- of the knots corresponding to the first and last
498 -- parameters of this BSpline curve.
499 -- The period is therefore Knot(I2) - Knot(I1).
500 -- Consequently, the knots and poles tables are modified.
502 -- Standard_ConstructionError if this BSpline curve is not closed.
503 raises ConstructionError;
506 SetOrigin (me : mutable; Index : Integer)
507 ---Purpose: Assigns the knot of index Index in the knots table as
508 -- the origin of this periodic BSpline curve. As a
509 -- consequence, the knots and poles tables are modified.
511 -- Standard_NoSuchObject if this curve is not periodic.
512 -- Standard_DomainError if Index is outside the
513 -- bounds of the knots table.
518 SetNotPeriodic (me : mutable);
519 --- Purpose : Changes this BSpline curve into a non-periodic
520 -- curve. If this curve is already non-periodic, it is not modified.
521 -- Note that the poles and knots tables are modified.
523 -- If this curve is periodic, as the multiplicity of the first
524 -- and last knots is not modified, and is not equal to
525 -- Degree + 1, where Degree is the degree of
526 -- this BSpline curve, the start and end points of the
527 -- curve are not its first and last poles.
530 SetPole (me : mutable; Index : Integer; P : Pnt2d)
531 --- Purpose : Modifies this BSpline curve by assigning P to the
532 -- pole of index Index in the poles table.
534 -- Standard_OutOfRange if Index is outside the
535 -- bounds of the poles table.
536 -- Standard_ConstructionError if Weight is negative or null.
540 SetPole (me : mutable; Index : Integer; P : Pnt2d; Weight : Real)
541 --- Purpose : Modifies this BSpline curve by assigning P to the
542 -- pole of index Index in the poles table.
543 -- The second syntax also allows you to modify the
544 -- weight of the modified pole, which becomes Weight.
545 -- In this case, if this BSpline curve is non-rational, it
546 -- can become rational and vice versa.
548 -- Standard_OutOfRange if Index is outside the
549 -- bounds of the poles table.
550 -- Standard_ConstructionError if Weight is negative or null.
554 SetWeight (me : mutable; Index : Integer; Weight : Real)
555 --- Purpose : Assigns the weight Weight to the pole of index Index of the poles table.
556 -- If the curve was non rational it can become rational.
557 -- If the curve was rational it can become non rational.
559 -- Standard_OutOfRange if Index is outside the
560 -- bounds of the poles table.
561 -- Standard_ConstructionError if Weight is negative or null.
565 MovePoint (me : mutable; U: Real; P: Pnt2d; Index1, Index2: Integer;
566 FirstModifiedPole, LastModifiedPole: out Integer)
567 ---Purpose : Moves the point of parameter U of this BSpline
568 -- curve to P. Index1 and Index2 are the indexes in the
569 -- table of poles of this BSpline curve of the first and
570 -- last poles designated to be moved.
571 -- FirstModifiedPole and LastModifiedPole are the
572 -- indexes of the first and last poles, which are
573 -- effectively modified.
574 -- In the event of incompatibility between Index1,
575 -- Index2 and the value U:
576 -- - no change is made to this BSpline curve, and
577 -- - the FirstModifiedPole and LastModifiedPole are returned null.
579 -- Standard_OutOfRange if:
580 -- - Index1 is greater than or equal to Index2, or
581 -- - Index1 or Index2 is less than 1 or greater than the
582 -- number of poles of this BSpline curve.
586 MovePointAndTangent (me : mutable;
592 EndingCondition : Integer;
593 ErrorStatus : out Integer)
595 ---Purpose : Move a point with parameter U to P.
596 -- and makes it tangent at U be Tangent.
597 -- StartingCondition = -1 means first can move
598 -- EndingCondition = -1 means last point can move
599 -- StartingCondition = 0 means the first point cannot move
600 -- EndingCondition = 0 means the last point cannot move
601 -- StartingCondition = 1 means the first point and tangent cannot move
602 -- EndingCondition = 1 means the last point and tangent cannot move
604 -- ErrorStatus != 0 means that there are not enought degree of freedom
605 -- with the constrain to deform the curve accordingly
610 IsCN (me; N : Integer) returns Boolean
611 --- Purpose : Returns true if the degree of continuity of this
612 -- BSpline curve is at least N. A BSpline curve is at least GeomAbs_C0.
613 -- Exceptions Standard_RangeError if N is negative.
616 IsG1 (me; theTf, theTl, theAngTol : Real) returns Boolean;
618 -- Check if curve has at least G1 continuity in interval [theTf, theTl]
619 -- Returns true if IsCN(1)
621 -- angle betweem "left" and "right" first derivatives at
622 -- knots with C0 continuity is less then theAngTol
623 -- only knots in interval [theTf, theTl] is checked
625 IsClosed (me) returns Boolean;
627 -- Returns true if the distance between the first point and the
628 -- last point of the curve is lower or equal to Resolution
631 -- The first and the last point can be different from the first
632 -- pole and the last pole of the curve.
635 IsPeriodic (me) returns Boolean;
636 --- Purpose : Returns True if the curve is periodic.
639 IsRational (me) returns Boolean;
641 -- Returns True if the weights are not identical.
642 -- The tolerance criterion is Epsilon of the class Real.
644 Continuity (me) returns Shape from GeomAbs;
646 -- Returns the global continuity of the curve :
647 -- C0 : only geometric continuity,
648 -- C1 : continuity of the first derivative all along the Curve,
649 -- C2 : continuity of the second derivative all along the Curve,
650 -- C3 : continuity of the third derivative all along the Curve,
651 -- CN : the order of continuity is infinite.
652 -- For a B-spline curve of degree d if a knot Ui has a
653 -- multiplicity p the B-spline curve is only Cd-p continuous
654 -- at Ui. So the global continuity of the curve can't be greater
655 -- than Cd-p where p is the maximum multiplicity of the interior
656 -- Knots. In the interior of a knot span the curve is infinitely
657 -- continuously differentiable.
660 Degree (me) returns Integer;
661 --- Purpose : Returns the degree of this BSpline curve.
662 -- In this class the degree of the basis normalized B-spline
663 -- functions cannot be greater than "MaxDegree"
666 --- Purpose : Computation of value and derivatives
668 D0 (me; U : Real; P : out Pnt2d);
671 D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d)
672 raises UndefinedDerivative;
673 --- Purpose : Raised if the continuity of the curve is not C1.
676 D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d)
677 raises UndefinedDerivative;
678 --- Purpose : Raised if the continuity of the curve is not C2.
681 D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d)
682 raises UndefinedDerivative;
683 --- Purpose: For this BSpline curve, computes
684 -- - the point P of parameter U, or
685 -- - the point P and one or more of the following values:
686 -- - V1, the first derivative vector,
687 -- - V2, the second derivative vector,
688 -- - V3, the third derivative vector.
690 -- On a point where the continuity of the curve is not the
691 -- one requested, these functions impact the part
692 -- defined by the parameter with a value greater than U,
693 -- i.e. the part of the curve to the "right" of the singularity.
694 -- Raises UndefinedDerivative if the continuity of the curve is not C3.
696 DN (me; U : Real; N : Integer) returns Vec2d
697 --- Purpose: For the point of parameter U of this BSpline curve,
698 -- computes the vector corresponding to the Nth derivative.
700 -- On a point where the continuity of the curve is not the
701 -- one requested, this function impacts the part defined
702 -- by the parameter with a value greater than U, i.e. the
703 -- part of the curve to the "right" of the singularity.
704 -- Raises UndefinedDerivative if the continuity of the curve is not CN.
705 -- RangeError if N < 1.
706 raises UndefinedDerivative,
709 --- Purpose: The following functions computes the point of parameter U
710 -- and the derivatives at this point on the B-spline curve
711 -- arc defined between the knot FromK1 and the knot ToK2.
712 -- U can be out of bounds [Knot (FromK1), Knot (ToK2)] but
713 -- for the computation we only use the definition of the curve
714 -- between these two knots. This method is useful to compute
715 -- local derivative, if the order of continuity of the whole
716 -- curve is not greater enough. Inside the parametric
717 -- domain Knot (FromK1), Knot (ToK2) the evaluations are
718 -- the same as if we consider the whole definition of the
719 -- curve. Of course the evaluations are different outside
720 -- this parametric domain.
723 LocalValue (me; U : Real; FromK1, ToK2 : Integer) returns Pnt2d
725 --- Purpose : Raised if FromK1 = ToK2.
728 -- Raised if FromK1 and ToK2 are not in the range
729 -- [FirstUKnotIndex, LastUKnotIndex].
732 LocalD0 (me; U : Real; FromK1, ToK2 : Integer;
734 raises UndefinedDerivative, OutOfRange;
737 LocalD1 (me; U : Real; FromK1, ToK2 : Integer;
738 P : out Pnt2d; V1 : out Vec2d)
739 raises UndefinedDerivative,
741 -- Raised if the local continuity of the curve is not C1
742 -- between the knot K1 and the knot K2.
744 --- Purpose : Raised if FromK1 = ToK2.
747 -- Raised if FromK1 and ToK2 are not in the range
748 -- [FirstUKnotIndex, LastUKnotIndex].
751 LocalD2 (me; U : Real; FromK1, ToK2 : Integer;
752 P : out Pnt2d; V1, V2 : out Vec2d)
753 raises UndefinedDerivative,
755 -- Raised if the local continuity of the curve is not C2
756 -- between the knot K1 and the knot K2.
758 --- Purpose : Raised if FromK1 = ToK2.
761 -- Raised if FromK1 and ToK2 are not in the range
762 -- [FirstUKnotIndex, LastUKnotIndex].
766 LocalD3 (me; U : Real; FromK1, ToK2 : Integer;
767 P : out Pnt2d; V1, V2, V3 : out Vec2d)
768 raises UndefinedDerivative,
770 -- Raised if the local continuity of the curve is not C3
771 -- between the knot K1 and the knot K2.
773 --- Purpose : Raised if FromK1 = ToK2.
776 -- Raised if FromK1 and ToK2 are not in the range
777 -- [FirstUKnotIndex, LastUKnotIndex].
780 LocalDN (me; U : Real; FromK1, ToK2 : Integer; N : Integer) returns Vec2d
781 raises UndefinedDerivative,
783 -- Raised if the local continuity of the curve is not CN
784 -- between the knot K1 and the knot K2.
786 --- Purpose : Raised if FromK1 = ToK2.
788 --- Purpose : Raised if N < 1.
791 -- Raises if FromK1 and ToK2 are not in the range
792 -- [FirstUKnotIndex, LastUKnotIndex].
795 EndPoint (me) returns Pnt2d;
797 -- Returns the last point of the curve.
799 -- The last point of the curve is different from the last
800 -- pole of the curve if the multiplicity of the last knot
801 -- is lower than Degree.
804 FirstUKnotIndex (me) returns Integer;
806 -- For a B-spline curve the first parameter (which gives the start
807 -- point of the curve) is a knot value but if the multiplicity of
808 -- the first knot index is lower than Degree + 1 it is not the
809 -- first knot of the curve. This method computes the index of the
810 -- knot corresponding to the first parameter.
813 FirstParameter (me) returns Real;
815 -- Computes the parametric value of the start point of the curve.
816 -- It is a knot value.
819 Knot (me; Index : Integer) returns Real
821 -- Returns the knot of range Index. When there is a knot
822 -- with a multiplicity greater than 1 the knot is not repeated.
823 -- The method Multiplicity can be used to get the multiplicity
826 --- Purpose : Raised if Index < 1 or Index > NbKnots
829 Knots (me; K : out Array1OfReal from TColStd)
830 --- Purpose : returns the knot values of the B-spline curve;
831 raises DimensionError;
833 -- Raised if the length of K is not equal to the number of knots.
835 returns Array1OfReal from TColStd
836 ---Purpose : returns the knot values of the B-spline curve;
837 ---C++ : return const &
841 KnotSequence (me; K : out Array1OfReal from TColStd)
842 --- Purpose : Returns the knots sequence.
843 -- In this sequence the knots with a multiplicity greater than 1
846 -- K = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
847 raises DimensionError;
849 -- Raised if the length of K is not equal to NbPoles + Degree + 1
851 returns Array1OfReal from TColStd
852 ---Purpose : Returns the knots sequence.
853 -- In this sequence the knots with a multiplicity greater than 1
856 -- K = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
857 ---C++ : return const &
862 KnotDistribution (me) returns BSplKnotDistribution from GeomAbs;
864 -- Returns NonUniform or Uniform or QuasiUniform or PiecewiseBezier.
865 -- If all the knots differ by a positive constant from the
866 -- preceding knot the BSpline Curve can be :
867 -- - Uniform if all the knots are of multiplicity 1,
868 -- - QuasiUniform if all the knots are of multiplicity 1 except for
869 -- the first and last knot which are of multiplicity Degree + 1,
870 -- - PiecewiseBezier if the first and last knots have multiplicity
871 -- Degree + 1 and if interior knots have multiplicity Degree
872 -- A piecewise Bezier with only two knots is a BezierCurve.
873 -- else the curve is non uniform.
874 -- The tolerance criterion is Epsilon from class Real.
877 LastUKnotIndex (me) returns Integer;
879 -- For a BSpline curve the last parameter (which gives the
880 -- end point of the curve) is a knot value but if the
881 -- multiplicity of the last knot index is lower than
882 -- Degree + 1 it is not the last knot of the curve. This
883 -- method computes the index of the knot corresponding to
884 -- the last parameter.
887 LastParameter (me) returns Real;
889 -- Computes the parametric value of the end point of the curve.
890 -- It is a knot value.
895 ParametricTolerance : Real;
896 I1, I2 : in out Integer;
897 WithKnotRepetition : Boolean = Standard_False);
899 -- Locates the parametric value U in the sequence of knots.
900 -- If "WithKnotRepetition" is True we consider the knot's
901 -- representation with repetition of multiple knot value,
902 -- otherwise we consider the knot's representation with
903 -- no repetition of multiple knot values.
904 -- Knots (I1) <= U <= Knots (I2)
905 -- . if I1 = I2 U is a knot value (the tolerance criterion
906 -- ParametricTolerance is used).
907 -- . if I1 < 1 => U < Knots (1) - Abs(ParametricTolerance)
908 -- . if I2 > NbKnots => U > Knots (NbKnots) + Abs(ParametricTolerance)
911 Multiplicity (me; Index : Integer) returns Integer
913 -- Returns the multiplicity of the knots of range Index.
915 --- Purpose : Raised if Index < 1 or Index > NbKnots
918 Multiplicities (me; M : out Array1OfInteger from TColStd)
920 -- Returns the multiplicity of the knots of the curve.
921 raises DimensionError;
923 -- Raised if the length of M is not equal to NbKnots.
925 returns Array1OfInteger from TColStd
926 ---Purpose : returns the multiplicity of the knots of the curve.
927 ---C++ : return const &
931 NbKnots (me) returns Integer;
933 -- Returns the number of knots. This method returns the number of
934 -- knot without repetition of multiple knots.
937 NbPoles (me) returns Integer;
938 --- Purpose : Returns the number of poles
941 Pole (me; Index : Integer) returns Pnt2d
942 --- Purpose : Returns the pole of range Index.
944 --- Purpose : Raised if Index < 1 or Index > NbPoles.
947 Poles (me; P : out Array1OfPnt2d)
948 --- Purpose : Returns the poles of the B-spline curve;
949 raises DimensionError;
951 -- Raised if the length of P is not equal to the number of poles.
953 returns Array1OfPnt2d from TColgp
954 ---Purpose : Returns the poles of the B-spline curve;
955 ---C++ : return const &
959 StartPoint (me) returns Pnt2d;
961 -- Returns the start point of the curve.
963 -- This point is different from the first pole of the curve if the
964 -- multiplicity of the first knot is lower than Degree.
967 Weight (me; Index : Integer) returns Real
968 --- Purpose : Returns the weight of the pole of range Index .
970 --- Purpose : Raised if Index < 1 or Index > NbPoles.
973 Weights (me; W : out Array1OfReal from TColStd)
974 --- Purpose : Returns the weights of the B-spline curve;
975 raises DimensionError;
977 -- Raised if the length of W is not equal to NbPoles.
979 returns Array1OfReal from TColStd
980 ---Purpose : Returns the weights of the B-spline curve;
981 ---C++ : return const &
989 Transform (me : mutable; T : Trsf2d);
990 ---Purpose: Applies the transformation T to this BSpline curve.
992 MaxDegree (myclass) returns Integer;
994 -- Returns the value of the maximum degree of the normalized
995 -- B-spline basis functions in this package.
998 Resolution(me : mutable;
1000 UTolerance : out Real);
1001 ---Purpose: Computes for this BSpline curve the parametric
1002 -- tolerance UTolerance for a given tolerance
1003 -- Tolerance3D (relative to dimensions in the plane).
1004 -- If f(t) is the equation of this BSpline curve,
1005 -- UTolerance ensures that:
1006 -- | t1 - t0| < Utolerance ===>
1007 -- |f(t1) - f(t0)| < ToleranceUV
1010 Copy (me) returns like me;
1011 ---Purpose: Creates a new object which is a copy of this BSpline curve.
1013 UpdateKnots(me : mutable)
1014 ---Purpose: Recompute the flatknots, the knotsdistribution, the continuity.
1022 knotSet : BSplKnotDistribution from GeomAbs;
1023 smooth : Shape from GeomAbs;
1025 poles : HArray1OfPnt2d from TColgp;
1026 weights : HArray1OfReal from TColStd;
1027 flatknots : HArray1OfReal from TColStd;
1028 knots : HArray1OfReal from TColStd;
1029 mults : HArray1OfInteger from TColStd;
1030 maxderivinv : Real from Standard;
1031 maxderivinvok : Boolean from Standard;