1 -- Created on: 1993-03-09
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 evaluation
18 -- mei : modified 08-Jun-95 : added method MovePoint
21 class BSplineCurve from Geom inherits BoundedCurve from Geom
23 ---Purpose : Definition of the B_spline curve.
24 -- A B-spline curve can be
25 -- Uniform or non-uniform
26 -- Rational or non-rational
27 -- Periodic or non-periodic
29 -- a b-spline curve is defined by :
30 -- its degree; the degree for a
31 -- Geom_BSplineCurve is limited to a value (25)
32 -- which is defined and controlled by the system.
33 -- This value is returned by the function MaxDegree;
34 -- - its periodic or non-periodic nature;
35 -- - a table of poles (also called control points), with
36 -- their associated weights if the BSpline curve is
37 -- rational. The poles of the curve are "control
38 -- points" used to deform the curve. If the curve is
39 -- non-periodic, the first pole is the start point of
40 -- the curve, and the last pole is the end point of
41 -- the curve. The segment which joins the first pole
42 -- to the second pole is the tangent to the curve at
43 -- its start point, and the segment which joins the
44 -- last pole to the second-from-last pole is the
45 -- tangent to the curve at its end point. If the curve
46 -- is periodic, these geometric properties are not
47 -- verified. It is more difficult to give a geometric
48 -- signification to the weights but are useful for
49 -- providing exact representations of the arcs of a
50 -- circle or ellipse. Moreover, if the weights of all the
51 -- poles are equal, the curve has a polynomial
52 -- equation; it is therefore a non-rational curve.
53 -- - a table of knots with their multiplicities. For a
54 -- Geom_BSplineCurve, the table of knots is an
55 -- increasing sequence of reals without repetition;
56 -- the multiplicities define the repetition of the knots.
57 -- A BSpline curve is a piecewise polynomial or
58 -- rational curve. The knots are the parameters of
59 -- junction points between two pieces. The
60 -- multiplicity Mult(i) of the knot Knot(i) of
61 -- the BSpline curve is related to the degree of
62 -- continuity of the curve at the knot Knot(i),
63 -- which is equal to Degree - Mult(i)
64 -- where Degree is the degree of the BSpline curve.
65 -- If the knots are regularly spaced (i.e. the difference
66 -- between two consecutive knots is a constant), three
67 -- specific and frequently used cases of knot
68 -- distribution can be identified:
69 -- - "uniform" if all multiplicities are equal to 1,
70 -- - "quasi-uniform" if all multiplicities are equal to 1,
71 -- except the first and the last knot which have a
72 -- multiplicity of Degree + 1, where Degree is
73 -- the degree of the BSpline curve,
74 -- - "Piecewise Bezier" if all multiplicities are equal to
75 -- Degree except the first and last knot which
76 -- have a multiplicity of Degree + 1, where
77 -- Degree is the degree of the BSpline curve. A
78 -- curve of this type is a concatenation of arcs of Bezier curves.
79 -- If the BSpline curve is not periodic:
80 -- - the bounds of the Poles and Weights tables are 1
81 -- and NbPoles, where NbPoles is the number
82 -- of poles of the BSpline curve,
83 -- - the bounds of the Knots and Multiplicities tables
84 -- are 1 and NbKnots, where NbKnots is the
85 -- number of knots of the BSpline curve.
86 -- If the BSpline curve is periodic, and if there are k
87 -- periodic knots and p periodic poles, the period is:
88 -- period = Knot(k + 1) - Knot(1)
89 -- and the poles and knots tables can be considered
90 -- as infinite tables, verifying:
91 -- - Knot(i+k) = Knot(i) + period
92 -- - Pole(i+p) = Pole(i)
93 -- Note: data structures of a periodic BSpline curve
94 -- are more complex than those of a non-periodic one.
96 -- In this class, weight value is considered to be zero if
97 -- the weight is less than or equal to gp::Resolution().
100 -- . A survey of curve and surface methods in CADG Wolfgang BOHM
102 -- . On de Boor-like algorithms and blossoming Wolfgang BOEHM
104 -- . Blossoming and knot insertion algorithms for B-spline curves
106 -- . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
107 -- . Curves and Surfaces for Computer Aided Geometric Design,
108 -- a practical guide Gerald Farin
110 uses Array1OfInteger from TColStd,
111 Array1OfReal from TColStd,
112 HArray1OfInteger from TColStd,
113 HArray1OfReal from TColStd,
114 Array1OfPnt from TColgp,
118 HArray1OfPnt from TColgp,
121 BSplKnotDistribution from GeomAbs,
126 raises ConstructionError from Standard,
127 DimensionError from Standard,
128 DomainError from Standard,
129 OutOfRange from Standard,
130 RangeError from Standard,
131 NoSuchObject from Standard,
132 UndefinedDerivative from Geom
136 Create (Poles : Array1OfPnt from TColgp;
137 Knots : Array1OfReal from TColStd;
138 Multiplicities : Array1OfInteger from TColStd;
140 Periodic : Boolean = Standard_False)
142 returns BSplineCurve from Geom
144 ---Purpose : Creates a non-rational B_spline curve on the
145 -- basis <Knots, Multiplicities> of degree <Degree>.
147 raises ConstructionError;
149 -- The following conditions must be verified.
151 -- 0 < Degree <= MaxDegree.
153 -- Knots.Length() == Mults.Length() >= 2
155 -- Knots(i) < Knots(i+1) (Knots are increasing)
157 -- 1 <= Mults(i) <= Degree
159 -- On a non periodic curve the first and last multiplicities
160 -- may be Degree+1 (this is even recommanded if you want the
161 -- curve to start and finish on the first and last pole).
163 -- On a periodic curve the first and the last multicities
166 -- on non-periodic curves
168 -- Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2
170 -- on periodic curves
172 -- Poles.Length() == Sum(Mults(i)) except the first or last
175 Create (Poles : Array1OfPnt from TColgp;
176 Weights : Array1OfReal from TColStd;
177 Knots : Array1OfReal from TColStd;
178 Multiplicities : Array1OfInteger from TColStd;
180 Periodic : Boolean = Standard_False;
181 CheckRational : Boolean = Standard_True)
183 returns BSplineCurve from Geom
185 ---Purpose : Creates a rational B_spline curve on the basis
186 -- <Knots, Multiplicities> of degree <Degree>.
187 -- Raises ConstructionError subject to the following conditions
188 -- 0 < Degree <= MaxDegree.
190 -- Weights.Length() == Poles.Length()
192 -- Knots.Length() == Mults.Length() >= 2
194 -- Knots(i) < Knots(i+1) (Knots are increasing)
196 -- 1 <= Mults(i) <= Degree
198 -- On a non periodic curve the first and last multiplicities
199 -- may be Degree+1 (this is even recommanded if you want the
200 -- curve to start and finish on the first and last pole).
202 -- On a periodic curve the first and the last multicities
205 -- on non-periodic curves
207 -- Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2
209 -- on periodic curves
211 -- Poles.Length() == Sum(Mults(i)) except the first or last
213 raises ConstructionError;
218 IncreaseDegree (me : mutable; Degree : Integer)
220 ---Purpose: Increases the degree of this BSpline curve to
221 -- Degree. As a result, the poles, weights and
222 -- multiplicities tables are modified; the knots table is
223 -- not changed. Nothing is done if Degree is less than
224 -- or equal to the current degree.
226 -- Standard_ConstructionError if Degree is greater than
227 -- Geom_BSplineCurve::MaxDegree().
228 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.
255 ---Purpose: If <I1,I2> are not in [FirstUKnotIndex, LastUKnotIndex]
257 IncrementMultiplicity (me : mutable; I1, I2 : Integer; M : Integer)
259 ---Purpose :Increment the multiplicities of the knots in
262 -- If <M> is not positive nithing is done.
264 -- For each knot the resulting multiplicity is
265 -- limited to the Degree.
269 ---Purpose: If <I1,I2> are not in [FirstUKnotIndex, LastUKnotIndex]
274 InsertKnot (me : mutable;
277 ParametricTolerance : Real = 0.0;
278 Add : Boolean = Standard_True);
280 ---Purpose: Inserts a knot value in the sequence of knots. If
281 -- <U> is an existing knot the multiplicity is
284 -- If U is not on the parameter range nothing is
287 -- If the multiplicity is negative or null nothing is
288 -- done. The new multiplicity is limited to the
291 -- The tolerance criterion for knots equality is
292 -- the max of Epsilon(U) and ParametricTolerance.
295 InsertKnots (me : mutable; Knots : Array1OfReal from TColStd;
296 Mults : Array1OfInteger from TColStd;
297 ParametricTolerance : Real = 0.0;
298 Add : Boolean = Standard_False);
300 ---Purpose: Inserts a set of knots values in the sequence of
303 -- For each U = Knots(i), M = Mults(i)
305 -- If <U> is an existing knot the multiplicity is
306 -- increased by <M> if <Add> is True, increased to
307 -- <M> if <Add> is False.
309 -- If U is not on the parameter range nothing is
312 -- If the multiplicity is negative or null nothing is
313 -- done. The new multiplicity is limited to the
316 -- The tolerance criterion for knots equality is
317 -- the max of Epsilon(U) and ParametricTolerance.
323 RemoveKnot(me : mutable; Index : Integer;
325 Tolerance : Real) returns Boolean
327 ---Purpose : Reduces the multiplicity of the knot of index Index
328 -- to M. If M is equal to 0, the knot is removed.
329 -- With a modification of this type, the array of poles is also modified.
330 -- Two different algorithms are systematically used to
331 -- compute the new poles of the curve. If, for each
332 -- pole, the distance between the pole calculated
333 -- using the first algorithm and the same pole
334 -- calculated using the second algorithm, is less than
335 -- Tolerance, this ensures that the curve is not
336 -- modified by more than Tolerance. Under these
337 -- conditions, true is returned; otherwise, false is returned.
338 -- A low tolerance is used to prevent modification of
339 -- the curve. A high tolerance is used to "smooth" the curve.
341 -- Standard_OutOfRange if Index is outside the
342 -- bounds of the knots table.
346 ---Purpose : pole insertion and pole removing
347 -- this operation is limited to the Uniform or QuasiUniform
348 -- BSplineCurve. The knot values are modified . If the BSpline is
349 -- NonUniform or Piecewise Bezier an exception Construction error
353 Reverse (me : mutable);
355 -- Changes the direction of parametrization of <me>. The Knot
356 -- sequence is modified, the FirstParameter and the
357 -- LastParameter are not modified. The StartPoint of the
358 -- initial curve becomes the EndPoint of the reversed curve
359 -- and the EndPoint of the initial curve becomes the StartPoint
360 -- of the reversed curve.
363 ReversedParameter(me; U : Real) returns Real;
364 ---Purpose: Returns the parameter on the reversed curve for
365 -- the point of parameter U on <me>.
367 -- returns UFirst + ULast - U
369 Segment (me : mutable; U1, U2 : Real)
370 ---Purpose : Modifies this BSpline curve by segmenting it between
371 -- U1 and U2. Either of these values can be outside the
372 -- bounds of the curve, but U2 must be greater than U1.
373 -- All data structure tables of this BSpline curve are
374 -- modified, but the knots located between U1 and U2
375 -- are retained. The degree of the curve is not modified.
377 -- Even if <me> is not closed it can become closed after the
378 -- segmentation for example if U1 or U2 are out of the bounds
379 -- of the curve <me> or if the curve makes loop.
380 -- After the segmentation the length of a curve can be null.
381 raises DomainError from Standard;
382 ---Purpose: raises if U2 < U1.
385 SetKnot (me : mutable; Index : Integer; K : Real)
386 ---Purpose : Modifies this BSpline curve by assigning the value K
387 -- to the knot of index Index in the knots table. This is a
388 -- relatively local modification because K must be such that:
389 -- Knots(Index - 1) < K < Knots(Index + 1)
390 -- The second syntax allows you also to increase the
391 -- multiplicity of the knot to M (but it is not possible to
392 -- decrease the multiplicity of the knot with this function).
393 -- Standard_ConstructionError if:
394 -- - K is not such that:
395 -- Knots(Index - 1) < K < Knots(Index + 1)
396 -- - M is greater than the degree of this BSpline curve
397 -- or lower than the previous multiplicity of knot of
398 -- index Index in the knots table.
399 -- Standard_OutOfRange if Index is outside the bounds of the knots table.
400 raises ConstructionError,
404 SetKnots (me : mutable; K : Array1OfReal from TColStd)
405 ---Purpose : Modifies this BSpline curve by assigning the array
406 -- K to its knots table. The multiplicity of the knots is not modified.
408 -- Standard_ConstructionError if the values in the
409 -- array K are not in ascending order.
410 -- Standard_OutOfRange if the bounds of the array
411 -- K are not respectively 1 and the number of knots of this BSpline curve.
412 raises ConstructionError,
415 SetKnot (me : mutable; Index : Integer; K : Real; M : Integer)
417 -- Changes the knot of range Index with its multiplicity.
418 -- You can increase the multiplicity of a knot but it is
419 -- not allowed to decrease the multiplicity of an existing knot.
420 raises ConstructionError,
422 -- Raised if K >= Knots(Index+1) or K <= Knots(Index-1).
423 -- Raised if M is greater than Degree or lower than the previous
424 -- multiplicity of knot of range Index.
426 ---Purpose : Raised if Index < 1 || Index > NbKnots
428 PeriodicNormalization(me ; U : in out Real) ;
430 ---Purpose : returns the parameter normalized within
431 -- the period if the curve is periodic : otherwise
432 -- does not do anything
434 SetPeriodic (me : mutable)
435 ---Purpose : Changes this BSpline curve into a periodic curve.
436 -- To become periodic, the curve must first be closed.
437 -- Next, the knot sequence must be periodic. For this,
438 -- FirstUKnotIndex and LastUKnotIndex are used
439 -- to compute I1 and I2, the indexes in the knots
440 -- array of the knots corresponding to the first and
441 -- last parameters of this BSpline curve.
442 -- The period is therefore: Knots(I2) - Knots(I1).
443 -- Consequently, the knots and poles tables are modified.
445 -- Standard_ConstructionError if this BSpline curve is not closed.
446 raises ConstructionError;
449 SetOrigin (me : mutable; Index : Integer)
450 ---Purpose: Assigns the knot of index Index in the knots table as
451 -- the origin of this periodic BSpline curve. As a
452 -- consequence, the knots and poles tables are modified.
454 -- Standard_NoSuchObject if this curve is not periodic.
455 -- Standard_DomainError if Index is outside the bounds of the knots table.
459 SetOrigin (me : mutable;
460 U : Real from Standard;
461 Tol : Real from Standard)
462 ---Purpose: Set the origin of a periodic curve at Knot U. If U
463 -- is not a knot of the BSpline a new knot is
464 -- inseted. KnotVector and poles are modified.
466 ---Purpose: Raised if the curve is not periodic
469 SetNotPeriodic (me : mutable);
470 ---Purpose : Changes this BSpline curve into a non-periodic
471 -- curve. If this curve is already non-periodic, it is not modified.
472 -- Note: the poles and knots tables are modified.
474 -- If this curve is periodic, as the multiplicity of the first
475 -- and last knots is not modified, and is not equal to
476 -- Degree + 1, where Degree is the degree of
477 -- this BSpline curve, the start and end points of the
478 -- curve are not its first and last poles.
482 SetPole (me : mutable; Index : Integer; P : Pnt)
483 ---Purpose : Modifies this BSpline curve by assigning P to the pole
484 -- of index Index in the poles table.
486 -- Standard_OutOfRange if Index is outside the
487 -- bounds of the poles table.
488 -- Standard_ConstructionError if Weight is negative or null.
491 SetPole (me : mutable; Index : Integer; P : Pnt; Weight : Real)
492 ---Purpose: Modifies this BSpline curve by assigning P to the pole
493 -- of index Index in the poles table.
494 -- This syntax also allows you to modify the
495 -- weight of the modified pole, which becomes Weight.
496 -- In this case, if this BSpline curve is non-rational, it
497 -- can become rational and vice versa.
499 -- Standard_OutOfRange if Index is outside the
500 -- bounds of the poles table.
501 -- Standard_ConstructionError if Weight is negative or null.
506 SetWeight (me : mutable; Index : Integer; Weight : Real)
508 -- Changes the weight for the pole of range Index.
509 -- If the curve was non rational it can become rational.
510 -- If the curve was rational it can become non rational.
513 -- Raised if Index < 1 || Index > NbPoles
515 ---Purpose : Raised if Weight <= 0.0
517 MovePoint (me : mutable; U: Real; P: Pnt; Index1, Index2: Integer;
518 FirstModifiedPole, LastModifiedPole: out Integer)
519 ---Purpose : Moves the point of parameter U of this BSpline curve
520 -- to P. Index1 and Index2 are the indexes in the table
521 -- of poles of this BSpline curve of the first and last
522 -- poles designated to be moved.
523 -- FirstModifiedPole and LastModifiedPole are the
524 -- indexes of the first and last poles which are effectively modified.
525 -- In the event of incompatibility between Index1, Index2 and the value U:
526 -- - no change is made to this BSpline curve, and
527 -- - the FirstModifiedPole and LastModifiedPole are returned null.
529 -- Standard_OutOfRange if:
530 -- - Index1 is greater than or equal to Index2, or
531 -- - Index1 or Index2 is less than 1 or greater than the
532 -- number of poles of this BSpline curve.
535 MovePointAndTangent (me : mutable;
541 EndingCondition : Integer;
542 ErrorStatus : out Integer)
545 -- Move a point with parameter U to P.
546 -- and makes it tangent at U be Tangent.
547 -- StartingCondition = -1 means first can move
548 -- EndingCondition = -1 means last point can move
549 -- StartingCondition = 0 means the first point cannot move
550 -- EndingCondition = 0 means the last point cannot move
551 -- StartingCondition = 1 means the first point and tangent cannot move
552 -- EndingCondition = 1 means the last point and tangent cannot move
554 -- ErrorStatus != 0 means that there are not enought degree of freedom
555 -- with the constrain to deform the curve accordingly
559 IsCN (me; N : Integer) returns Boolean
561 -- Returns the continuity of the curve, the curve is at least C0.
563 ---Purpose : Raised if N < 0.
565 IsG1 (me; theTf, theTl, theAngTol : Real) returns Boolean;
567 -- Check if curve has at least G1 continuity in interval [theTf, theTl]
568 -- Returns true if IsCN(1)
570 -- angle betweem "left" and "right" first derivatives at
571 -- knots with C0 continuity is less then theAngTol
572 -- only knots in interval [theTf, theTl] is checked
574 IsClosed (me) returns Boolean;
576 -- Returns true if the distance between the first point and the
577 -- last point of the curve is lower or equal to Resolution
580 -- The first and the last point can be different from the first
581 -- pole and the last pole of the curve.
584 IsPeriodic (me) returns Boolean;
585 ---Purpose : Returns True if the curve is periodic.
588 IsRational (me) returns Boolean;
590 -- Returns True if the weights are not identical.
591 -- The tolerance criterion is Epsilon of the class Real.
593 Continuity (me) returns Shape from GeomAbs;
595 -- Returns the global continuity of the curve :
596 -- C0 : only geometric continuity,
597 -- C1 : continuity of the first derivative all along the Curve,
598 -- C2 : continuity of the second derivative all along the Curve,
599 -- C3 : continuity of the third derivative all along the Curve,
600 -- CN : the order of continuity is infinite.
601 -- For a B-spline curve of degree d if a knot Ui has a
602 -- multiplicity p the B-spline curve is only Cd-p continuous
603 -- at Ui. So the global continuity of the curve can't be greater
604 -- than Cd-p where p is the maximum multiplicity of the interior
605 -- Knots. In the interior of a knot span the curve is infinitely
606 -- continuously differentiable.
609 Degree (me) returns Integer;
610 ---Purpose: Returns the degree of this BSpline curve.
611 -- The degree of a Geom_BSplineCurve curve cannot
612 -- be greater than Geom_BSplineCurve::MaxDegree().
614 ---Purpose : Computation of value and derivatives
616 D0 (me ; U : Real; P : out Pnt);
617 ---Purpose: Returns in P the point of parameter U.
619 D1 (me; U : Real; P : out Pnt; V1 : out Vec)
620 raises UndefinedDerivative;
621 ---Purpose : Raised if the continuity of the curve is not C1.
624 D2 (me; U : Real; P : out Pnt; V1, V2 : out Vec)
625 raises UndefinedDerivative;
626 ---Purpose : Raised if the continuity of the curve is not C2.
629 D3 (me; U : Real; P : out Pnt; V1, V2, V3 : out Vec)
630 raises UndefinedDerivative;
631 ---Purpose : Raised if the continuity of the curve is not C3.
634 DN (me; U : Real; N : Integer) returns Vec
635 ---Purpose : For the point of parameter U of this BSpline curve,
636 -- computes the vector corresponding to the Nth derivative.
638 -- On a point where the continuity of the curve is not the
639 -- one requested, this function impacts the part defined
640 -- by the parameter with a value greater than U, i.e. the
641 -- part of the curve to the "right" of the singularity.
643 -- Standard_RangeError if N is less than 1.
644 raises UndefinedDerivative,
648 -- The following functions compute the point of parameter U
649 -- and the derivatives at this point on the B-spline curve
650 -- arc defined between the knot FromK1 and the knot ToK2.
651 -- U can be out of bounds [Knot (FromK1), Knot (ToK2)] but
652 -- for the computation we only use the definition of the curve
653 -- between these two knots. This method is useful to compute
654 -- local derivative, if the order of continuity of the whole
655 -- curve is not greater enough. Inside the parametric
656 -- domain Knot (FromK1), Knot (ToK2) the evaluations are
657 -- the same as if we consider the whole definition of the
658 -- curve. Of course the evaluations are different outside
659 -- this parametric domain.
662 LocalValue (me; U : Real; FromK1, ToK2 : Integer) returns Pnt
664 ---Purpose : Raised if FromK1 = ToK2.
667 -- Raised if FromK1 and ToK2 are not in the range
668 -- [FirstUKnotIndex, LastUKnotIndex].
670 LocalD0 (me; U : Real; FromK1, ToK2 : Integer; P : out Pnt)
672 ---Purpose : Raised if FromK1 = ToK2.
675 -- Raised if FromK1 and ToK2 are not in the range
676 -- [FirstUKnotIndex, LastUKnotIndex].
678 LocalD1 (me; U : Real; FromK1, ToK2 : Integer; P : out Pnt; V1 : out Vec)
679 raises UndefinedDerivative,
681 -- Raised if the local continuity of the curve is not C1
682 -- between the knot K1 and the knot K2.
684 ---Purpose : Raised if FromK1 = ToK2.
687 -- Raised if FromK1 and ToK2 are not in the range
688 -- [FirstUKnotIndex, LastUKnotIndex].
691 LocalD2 (me; U : Real; FromK1, ToK2 : Integer; P : out Pnt; V1, V2 : out Vec)
692 raises UndefinedDerivative,
694 -- Raised if the local continuity of the curve is not C2
695 -- between the knot K1 and the knot K2.
697 ---Purpose : Raised if FromK1 = ToK2.
700 -- Raised if FromK1 and ToK2 are not in the range
701 -- [FirstUKnotIndex, LastUKnotIndex].
705 LocalD3 (me; U : Real; FromK1, ToK2 : Integer;
706 P : out Pnt; V1, V2, V3 : out Vec)
707 raises UndefinedDerivative,
709 -- Raised if the local continuity of the curve is not C3
710 -- between the knot K1 and the knot K2.
712 ---Purpose : Raised if FromK1 = ToK2.
715 -- Raised if FromK1 and ToK2 are not in the range
716 -- [FirstUKnotIndex, LastUKnotIndex].
719 LocalDN (me; U : Real; FromK1, ToK2 : Integer; N : Integer) returns Vec
720 raises UndefinedDerivative,
722 -- Raised if the local continuity of the curve is not CN
723 -- between the knot K1 and the knot K2.
725 ---Purpose : Raised if FromK1 = ToK2.
727 ---Purpose : Raised if N < 1.
730 -- Raises if FromK1 and ToK2 are not in the range
731 -- [FirstUKnotIndex, LastUKnotIndex].
734 EndPoint (me) returns Pnt;
736 -- Returns the last point of the curve.
738 -- The last point of the curve is different from the last
739 -- pole of the curve if the multiplicity of the last knot
740 -- is lower than Degree.
743 FirstUKnotIndex (me) returns Integer;
744 ---Purpose : Returns the index in the knot array of the knot
745 -- corresponding to the first or last parameter of this BSpline curve.
746 -- For a BSpline curve, the first (or last) parameter
747 -- (which gives the start (or end) point of the curve) is a
748 -- knot value. However, if the multiplicity of the first (or
749 -- last) knot is less than Degree + 1, where
750 -- Degree is the degree of the curve, it is not the first
751 -- (or last) knot of the curve.
754 FirstParameter (me) returns Real;
755 ---Purpose : Returns the value of the first parameter of this
756 -- BSpline curve. This is a knot value.
757 -- The first parameter is the one of the start point of the BSpline curve.
761 Knot (me; Index : Integer) returns Real
763 -- Returns the knot of range Index. When there is a knot
764 -- with a multiplicity greater than 1 the knot is not repeated.
765 -- The method Multiplicity can be used to get the multiplicity
768 ---Purpose : Raised if Index < 1 or Index > NbKnots
771 Knots (me; K : out Array1OfReal from TColStd)
772 ---Purpose : returns the knot values of the B-spline curve;
774 -- A knot with a multiplicity greater than 1 is not
775 -- repeated in the knot table. The Multiplicity function
776 -- can be used to obtain the multiplicity of each knot.
777 raises DimensionError;
779 -- Raised if the length of K is not equal to the number of knots.
781 returns Array1OfReal from TColStd
782 ---Purpose : returns the knot values of the B-spline curve;
784 -- A knot with a multiplicity greater than 1 is not
785 -- repeated in the knot table. The Multiplicity function
786 -- can be used to obtain the multiplicity of each knot.
787 ---C++ : return const &
791 KnotSequence (me; K : out Array1OfReal from TColStd)
792 ---Purpose : Returns K, the knots sequence of this BSpline curve.
793 -- In this sequence, knots with a multiplicity greater than 1 are repeated.
794 -- In the case of a non-periodic curve the length of the
795 -- sequence must be equal to the sum of the NbKnots
796 -- multiplicities of the knots of the curve (where
797 -- NbKnots is the number of knots of this BSpline
798 -- curve). This sum is also equal to : NbPoles + Degree + 1
799 -- where NbPoles is the number of poles and
800 -- Degree the degree of this BSpline curve.
801 -- In the case of a periodic curve, if there are k periodic
802 -- knots, the period is Knot(k+1) - Knot(1).
803 -- The initial sequence is built by writing knots 1 to k+1,
804 -- which are repeated according to their corresponding multiplicities.
805 -- If Degree is the degree of the curve, the degree of
806 -- continuity of the curve at the knot of index 1 (or k+1)
807 -- is equal to c = Degree + 1 - Mult(1). c
808 -- knots are then inserted at the beginning and end of
809 -- the initial sequence:
810 -- - the c values of knots preceding the first item
811 -- Knot(k+1) in the initial sequence are inserted
812 -- at the beginning; the period is subtracted from these c values;
813 -- - the c values of knots following the last item
814 -- Knot(1) in the initial sequence are inserted at
815 -- the end; the period is added to these c values.
816 -- The length of the sequence must therefore be equal to:
817 -- NbPoles + 2*Degree - Mult(1) + 2.
819 -- For a non-periodic BSpline curve of degree 2 where:
820 -- - the array of knots is: { k1 k2 k3 k4 },
821 -- - with associated multiplicities: { 3 1 2 3 },
822 -- the knot sequence is:
823 -- K = { k1 k1 k1 k2 k3 k3 k4 k4 k4 }
824 -- For a periodic BSpline curve of degree 4 , which is
825 -- "C1" continuous at the first knot, and where :
826 -- - the periodic knots are: { k1 k2 k3 (k4) }
827 -- (3 periodic knots: the points of parameter k1 and k4
828 -- are identical, the period is p = k4 - k1),
829 -- - with associated multiplicities: { 3 1 2 (3) },
830 -- the degree of continuity at knots k1 and k4 is:
831 -- Degree + 1 - Mult(i) = 2.
832 -- 2 supplementary knots are added at the beginning
833 -- and end of the sequence:
834 -- - at the beginning: the 2 knots preceding k4 minus
835 -- the period; in this example, this is k3 - p both times;
836 -- - at the end: the 2 knots following k1 plus the period;
837 -- in this example, this is k2 + p and k3 + p.
838 -- The knot sequence is therefore:
839 -- K = { k3-p k3-p k1 k1 k1 k2 k3 k3
840 -- k4 k4 k4 k2+p k3+p }
842 -- Standard_DimensionError if the array K is not of
843 -- the appropriate length.Returns the knots sequence.
844 raises DimensionError;
846 returns Array1OfReal from TColStd
847 ---Purpose : returns the knots of the B-spline curve.
848 -- Knots with multiplicit greater than 1 are repeated
849 ---C++ : return const &
854 KnotDistribution (me) returns BSplKnotDistribution from GeomAbs;
856 -- Returns NonUniform or Uniform or QuasiUniform or PiecewiseBezier.
857 -- If all the knots differ by a positive constant from the
858 -- preceding knot the BSpline Curve can be :
859 -- - Uniform if all the knots are of multiplicity 1,
860 -- - QuasiUniform if all the knots are of multiplicity 1 except for
861 -- the first and last knot which are of multiplicity Degree + 1,
862 -- - PiecewiseBezier if the first and last knots have multiplicity
863 -- Degree + 1 and if interior knots have multiplicity Degree
864 -- A piecewise Bezier with only two knots is a BezierCurve.
865 -- else the curve is non uniform.
866 -- The tolerance criterion is Epsilon from class Real.
869 LastUKnotIndex (me) returns Integer;
871 -- For a BSpline curve the last parameter (which gives the
872 -- end point of the curve) is a knot value but if the
873 -- multiplicity of the last knot index is lower than
874 -- Degree + 1 it is not the last knot of the curve. This
875 -- method computes the index of the knot corresponding to
876 -- the last parameter.
879 LastParameter (me) returns Real;
881 -- Computes the parametric value of the end point of the curve.
882 -- It is a knot value.
887 ParametricTolerance : Real;
888 I1, I2 : in out Integer;
889 WithKnotRepetition : Boolean = Standard_False);
891 -- Locates the parametric value U in the sequence of knots.
892 -- If "WithKnotRepetition" is True we consider the knot's
893 -- representation with repetition of multiple knot value,
894 -- otherwise we consider the knot's representation with
895 -- no repetition of multiple knot values.
896 -- Knots (I1) <= U <= Knots (I2)
897 -- . if I1 = I2 U is a knot value (the tolerance criterion
898 -- ParametricTolerance is used).
899 -- . if I1 < 1 => U < Knots (1) - Abs(ParametricTolerance)
900 -- . if I2 > NbKnots => U > Knots (NbKnots) + Abs(ParametricTolerance)
903 Multiplicity (me; Index : Integer) returns Integer
905 -- Returns the multiplicity of the knots of range Index.
907 ---Purpose : Raised if Index < 1 or Index > NbKnots
910 Multiplicities (me; M : out Array1OfInteger from TColStd)
912 -- Returns the multiplicity of the knots of the curve.
913 raises DimensionError;
915 -- Raised if the length of M is not equal to NbKnots.
917 returns Array1OfInteger from TColStd
918 ---Purpose : returns the multiplicity of the knots of the curve.
919 ---C++ : return const &
923 NbKnots (me) returns Integer;
925 -- Returns the number of knots. This method returns the number of
926 -- knot without repetition of multiple knots.
929 NbPoles (me) returns Integer;
930 ---Purpose : Returns the number of poles
933 Pole (me; Index : Integer) returns Pnt
934 ---Purpose : Returns the pole of range Index.
936 ---Purpose : Raised if Index < 1 or Index > NbPoles.
939 Poles (me; P : out Array1OfPnt from TColgp)
940 ---Purpose : Returns the poles of the B-spline curve;
941 raises DimensionError;
943 -- Raised if the length of P is not equal to the number of poles.
945 returns Array1OfPnt from TColgp
946 ---Purpose : Returns the poles of the B-spline curve;
947 ---C++ : return const &
951 StartPoint (me) returns Pnt;
953 -- Returns the start point of the curve.
955 -- This point is different from the first pole of the curve if the
956 -- multiplicity of the first knot is lower than Degree.
959 Weight (me; Index : Integer) returns Real
960 ---Purpose : Returns the weight of the pole of range Index .
962 ---Purpose : Raised if Index < 1 or Index > NbPoles.
965 Weights (me; W : out Array1OfReal from TColStd)
966 ---Purpose : Returns the weights of the B-spline curve;
967 raises DimensionError;
969 -- Raised if the length of W is not equal to NbPoles.
971 returns Array1OfReal from TColStd
972 ---Purpose : Returns the weights of the B-spline curve;
973 ---C++ : return const &
982 Transform (me : mutable; T : Trsf);
983 ---Purpose: Applies the transformation T to this BSpline curve.
984 MaxDegree (myclass) returns Integer;
986 -- Returns the value of the maximum degree of the normalized
987 -- B-spline basis functions in this package.
989 Resolution(me : mutable;
991 UTolerance : out Real)
992 ---Purpose: Computes for this BSpline curve the parametric
993 -- tolerance UTolerance for a given 3D tolerance Tolerance3D.
994 -- If f(t) is the equation of this BSpline curve,
995 -- UTolerance ensures that:
996 -- | t1 - t0| < Utolerance ===>
997 -- |f(t1) - f(t0)| < Tolerance3D
1000 Copy (me) returns like me;
1001 ---Purpose: Creates a new object which is a copy of this BSpline curve.
1003 UpdateKnots(me : mutable)
1004 ---Purpose : Recompute the flatknots, the knotsdistribution, the continuity.
1007 IsEqual(me; theOther : BSplineCurve from Geom;
1008 thePreci : Real from Standard ) returns Boolean;
1009 ---Purpose : Comapare two Bspline curve on identity;
1018 knotSet : BSplKnotDistribution from GeomAbs;
1019 smooth : Shape from GeomAbs;
1021 poles : HArray1OfPnt from TColgp;
1022 weights : HArray1OfReal from TColStd;
1023 flatknots : HArray1OfReal from TColStd;
1024 knots : HArray1OfReal from TColStd;
1025 mults : HArray1OfInteger from TColStd;
1026 maxderivinv : Real from Standard;
1027 maxderivinvok : Boolean from Standard;