IKO_Geom_BSplineCurve Interface
Represents a bspline curve. To create a bspline curve use a call similar to
iDIObjGenerator.Create3("KO_Geom_BSplineCurve") where iDIObjGenerator has
IDIObjGenerator type.
Definition of the B_spline curve. A B-spline curve can be Uniform or non-uniform
Rational or non-rational Periodic or non-periodic a b-spline curve is defined by
: its degree; the degree for a Geom_BSplineCurve is limited to a value (25)
which is defined and controlled by the system. This value is returned by the
function MaxDegree; its periodic or non-periodic nature; a table of poles (also
called control points), with their associated weights if the BSpline curve is
rational. The poles of the curve are "control
points" used to deform the curve. If the curve is non-periodic, the first pole
is the start point of the curve, and the last pole is the end point of the
curve. The segment which joins the first pole to the second pole is the tangent
to the curve at its start point, and the segment which joins the last pole to
the second-from-last pole is the tangent to the curve at its end point. If the
curve is periodic, these geometric properties are not verified. It is more
difficult to give a geometric signification to the weights but are useful for
providing exact representations of the arcs of a circle or ellipse. Moreover, if
the weights of all the poles are equal, the curve has a polynomial equation; it
is therefore a non-rational curve. a table of knots with their multiplicities.
For a Geom_BSplineCurve, the table of knots is an increasing sequence of reals
without repetition; the multiplicities define the repetition of the knots. A
BSpline curve is a piecewise polynomial or rational curve.
The knots are the parameters of junction points between two pieces. The
multiplicity Mult(i) of the knot Knot(i) of the BSpline curve is related to the
degree of continuity of the curve at the knot Knot(i), which is equal to Degree
- Mult(i) where Degree is the degree of the BSpline curve. If the knots are
regularly spaced (i.e. the difference between two consecutive knots is a
constant), three specific and frequently used cases of knot distribution can be
identified: "uniform" if all multiplicities are equal to 1, "quasi-uniform" if
all multiplicities are equal to 1, except the first and the last knot which have
a multiplicity of Degree + 1, where Degree is the degree of the BSpline curve,
"Piecewise Bezier" if all multiplicities are equal to Degree except the first
and last knot which have a multiplicity of Degree + 1, where Degree is the
degree of the BSpline curve. A curve of this type is a concatenation of arcs of
Bezier curves. If the BSpline curve is not periodic: the bounds of the Poles and
Weights tables are 1 and NbPoles, where NbPoles is the number of poles of the
BSpline curve, the bounds of the Knots and Multiplicities tables are 1 and
NbKnots, where NbKnots is the number of knots of the BSpline curve. If the
BSpline curve is periodic, and if there are k periodic knots and p periodic
poles, the period is: period = Knot(k + 1) - Knot(1) and the poles and knots
tables can be considered as infinite tables, verifying: Knot(i+k) = Knot(i) +
period Pole(i+p) = Pole(i)
Note: data structures of a periodic BSpline curve are more complex than those of
a non-periodic one. Warning In this class, weight value is considered to be zero
if the weight is less than or equal to gp::Resolution(). References : . A survey
of curve and surface methods in CADG Wolfgang BOHM CAGD 1 (1984) . On de
Boor-like algorithms and blossoming Wolfgang BOEHM cagd 5 (1988) . Blossoming
and knot insertion algorithms for B-spline curves Ronald N. GOLDMAN .
Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA . Curves and Surfaces
for Computer Aided Geometric Design, a practical guide Gerald Farin
Query IKO_gp_Object from this interface to
obtain or modify location and orientation of the curve
Query IKO_gp_Transformation to transform position and orientation
IKO_Standard_Object to create a copy or obtain type name
- Init
- Init2
- IncreaseDegree
- IncreaseMultiplicity
- IncreaseMultiplicity2
- InsertKnot
- InsertKnots
- RemoveKnot
- Reverse
- SetKnot
- SetKnots
- SetKnot2
- PeriodicNormalization
- SetPeriodic
- SetOrigin
- SetOrigin2
- SetNotPeriodic
- SetPole
- SetPole2
- SetWeight
- MovePoint
- MovePointAndTangent
- IsCN
- IsClosed
- IsPeriodic
- IsRational
- Continuity
- Degree
- D0
- D1
- D2
- D3
- DN
- EndPoint
- FirstUKnotIndex
- FirstParameter
- Knot
- Knots
- KnotSequence
- KnotDistribution
- LastUKnotIndex
- LastParameter
- LocateU
- Multiplicity
- Multiplicities
- NbKnots
- NbPoles
- Pole
- Poles
- StartPoint
- Weight
- Weights
HRESULT Init(IKO_TColgp_Array1OfPnt* Poles, IKO_TColStd_Array1OfReal*
Knots, IKO_TColStd_Array1OfInteger* Multiplicities, int Degree, VARIANT_BOOL
Periodic);
Constructs a non-rational B_spline curve on the basis of
degree .
HRESULT Init2(IKO_TColgp_Array1OfPnt* Poles, IKO_TColStd_Array1OfReal*
Weights, IKO_TColStd_Array1OfReal* Knots, IKO_TColStd_Array1OfInteger*
Multiplicities, int Degree, VARIANT_BOOL Periodic, VARIANT_BOOL CheckRational)
- Remarks:
Creates a rational B_spline curve on the basis
of degree . Raises ConstructionError subject to the
following conditions 0 < Degree <= MaxDegree. Weights.Length() == Poles.Length()
Knots.Length() == Mults.Length() >= 2 Knots(i) < Knots(i+1) (Knots are
increasing) 1 <= Mults(i) <= Degree On a non periodic curve the first and last
multiplicities may be Degree+1 (this is even recommanded if you want the curve
to start and finish on the first and last pole). On a periodic curve the first
and the last multicities must be the same. on non-periodic curves Poles.Length()
== Sum(Mults(i)) - Degree - 1 >= 2 on periodic curves Poles.Length() ==
Sum(Mults(i)) except the first or last
HRESULT IncreaseDegree(int Degree)
- Increases the degree of this BSpline curve to Degree. As a result, the poles,
weights and multiplicities tables are modified; the knots table is not changed.
Nothing is done if Degree is less than or equal to the current degree.
Exceptions Standard_ConstructionError if Degree is greater than
Geom_BSplineCurve::MaxDegree().
HRESULT IncreaseMultiplicity(int Index, int M)
Increases the multiplicity of the knot to
. If is lower or equal to the current multiplicity nothing is done. If is
higher than the degree the degree is used. //! If is not in
[FirstUKnotIndex, LastUKnotIndex]
HRESULT IncreaseMultiplicity2(int I1, int I2, int M)
- Remarks:
Increases the multiplicities of the knots in [I1,I2] to . For each knot if
is lower or equal to the current multiplicity nothing is done. If is higher
than the degree the degree is used. //! If are not in [FirstUKnotIndex,
LastUKnotIndex]
HRESULT InsertKnot(double U, int M, double ParametricTolerance,
VARIANT_BOOL Add)
Inserts a knot value in the sequence of knots. If is an existing knot the
multiplicity is increased by . If U is not on the parameter range nothing is
done. If the multiplicity is negative or null nothing is done. The new
multiplicity is limited to the degree. The tolerance criterion for knots
equality is the max of Epsilon(U) . If U is not on the parameter range nothing is
done. If the multiplicity is negative or null nothing is done. The new
multiplicity is limited to the degree. The tolerance criterion for knots
equality is the max of Epsilon(U) and ParametricTolerance.
HRESULT InsertKnots(IKO_TColStd_Array1OfReal* Knots,
IKO_TColStd_Array1OfInteger* Mults, double ParametricTolerance, VARIANT_BOOL
Add)
Inserts a set of knots values in the sequence of knots. For each U = Knots(i), M
= Mults(i) If is an existing knot the multiplicity is increased by if
is True, increased to
if is False. If U is not on the parameter range nothing is done. If the
multiplicity is negative or null nothing is done. The new multiplicity is
limited to the degree. The tolerance criterion for knots equality is the max of
Epsilon(U) and ParametricTolerance.
HRESULT RemoveKnot (int Index, int M, double Tolerance)
Reduces the multiplicity of the knot of index Index to M. If M is equal to 0, the
knot is removed. With a modification of this type, the array of poles is also
modified. Two different algorithms are systematically used to compute the new
poles of the curve. If, for each pole, the distance between the pole calculated
using the first algorithm and the same pole calculated using the second
algorithm, is less than Tolerance, this ensures that the curve is not modified
by more than Tolerance. Under these conditions, true is returned; otherwise,
false is returned. A low tolerance is used to prevent modification of the curve.
A high tolerance is used to "smooth" the curve. Exceptions Standard_OutOfRange
if Index is outside the bounds of the knots table. //! pole insertion and pole
removing this operation is limited to the Uniform or QuasiUniform BSplineCurve.
The knot values are modified . If the BSpline is NonUniform or Piecewise Bezier
an exception Construction error is raised.
HRESULT Reverse()
Changes the direction of parametrization of . The Knot sequence is modified,
the FirstParameter and the LastParameter are not modified. The StartPoint of the
initial curve becomes the EndPoint of the reversed curve and the EndPoint of the
initial curve becomes the StartPoint of the reversed curve.
HRESULT SetKnot(int Index, double K)
- Modifies this BSModifies this BSpline curve by assigning the value K to the knot of index Index
in the knots table. This is a relatively local modification because K must be
such that: Knots(Index - 1) < K < Knots(Index + 1) The second syntax allows you
also to increase the multiplicity of the knot to M (but it is not possible to
decrease the multiplicity of the knot with this function).
Standard_ConstructionError if: K is not such that: Knots(Index - 1) < K <
Knots(Index + 1) M is greater than the degree of this BSpline curve or lower
than the previous multiplicity of knot of index Index in the knots table.
Standard_OutOfRange if Index is outside the bounds of the knots table.
HRESULT SetKnots(IKO_TColStd_Array1OfReal* K)
Modifies this BSpline curve by assigning the array K to its knots table. The
multiplicity of the knots is not modified. Exceptions Standard_ConstructionError
if the values in the array K are not in ascending order. Standard_OutOfRange if
the bounds of the array K are not respectively 1 and the number of knots of this
BSpline curve.
HRESULT SetKnot2(int Index, double K, int M)
Changes the knot of range Index with its multiplicity. You can increase the
multiplicity of a knot but it is not allowed to decrease the multiplicity of an
existing knot. Raised if K >= Knots(Index+1) or K <= Knots(Index-1). Raised if M
is greater than Degree or lower than the previous multiplicity of knot of range
Index. //! Raised if Index < 1 || Index > NbKnots
HRESULT PeriodicNormalization(double* U)
returns the parameter normalized within the period if the curve is periodic :
otherwise does not do anything
HRESULT SetPeriodic()
Changes this BSpline curve into a periodic curve. To become periodic, the curve
must first be closed. Next, the knot sequence must be periodic. For this,
FirstUKnotIndex and LastUKnotIndex are used to compute I1 and I2, the indexes in
the knots array of the knots corresponding to the first and last parameters of
this BSpline curve. The period is therefore: Knots(I2) - Knots(I1).
Consequently, the knots and poles tables are modified. Exceptions
Standard_ConstructionError if this BSpline curve is not closed.
HRESULT SetOrigin(int Index)
Assigns the knot of index Index in the knots table as the origin of this periodic
BSpline curve. As a consequence, the knots and poles tables are modified.
Exceptions Standard_NoSuchObject if this curve is not periodic.
Standard_DomainError if Index is outside the bounds of the knots table.
HRESULT SetOrigin2(double U, double Tol)
Set the origin of a periodic curve at Knot U. If U is not a knot of the BSpline a
new knot is inseted. KnotVector and poles are modified.
HRESULT SetNotPeriodic()
Changes this BSpline curve into a non-periodic curve. If this curve is already
non-periodic, it is not modified. Note: the poles and knots tables are modified.
Warning If this curve is periodic, as the multiplicity of the first and last
knots is not modified, and is not equal to Degree + 1, where Degree is the
degree of this BSpline curve, the start and end points of the curve are not its
first and last poles.
HRESULT SetPole(int Index, DIPoint* P)
Modifies this BSpline curve by assigning P to the pole of index Index in the
poles table. Exceptions Standard_OutOfRange if Index is outside the bounds of
the poles table. Standard_ConstructionError if Weight is negative or null.
HRESULT SetPole2(int Index, DIPoint* P, double Weight)
Modifies this BSpline curve by assigning P to the pole of index Index in the
poles table. This syntax also allows you to modify the weight of the modified
pole, which becomes Weight. In this case, if this BSpline curve is non-rational,
it can become rational and vice versa. Exceptions Standard_OutOfRange if Index
is outside the bounds of the poles table. Standard_ConstructionError if Weight
is negative or null.
HRESULT SetWeight(int Index, double Weight)
Changes the weight for the pole of range Index. If the curve was non rational it
can become rational. If the curve was rational it can become non rational.
Raised if Index < 1 || Index > NbPoles
HRESULT MovePoint(double U, DIPoint* P, int Index1, int Index2, int*
HRESULT MovePoint(double U, DIPoint* P, int Index1, int Index2, int*
FirstModifiedPole, int* LastModifiedPole)
- Moves the point of parameter U of this BSpline curve to P. Index1 and Index2 are
the indexes in the table of poles of this BSpline curve of the first and last
poles designated to be moved. FirstModifiedPole and LastModifiedPole are the
indexes of the first and last poles which are effectively modified. In the event
of incompatibility between Index1, Index2 and the value U: no change is made to
this BSpline curve, and the FirstModifiedPole and LastModifiedPole are returned
null. Exceptions Standard_OutOfRange if: Index1 is greater than or equal to
Index2, or Index1 or Index2 is less than 1 or greater than the number of poles
of this BSpline curve.
HRESULT MovePointAndTangent(double U, DIPoint* P, DIVect* Tangent, double
Tolerance, int StartingCondition, int EndingCondition, int* ErrorStatus)
Move a point with parameter U to P. and makes it tangent at U be Tangent.
StartingCondition = -1 means first can move EndingCondition = -1 means last
point can move StartingCondition = 0 means the first point cannot move
EndingCondition = 0 means the last point cannot move StartingCondition = 1 means
the first point and tangent cannot move EndingCondition = 1 means the last point
and tangent cannot move and so forth ErrorStatus != 0 means that there are not
enought degree of freedom with the constrain to deform the curve accordingly
HRESULT IsCN(int N, VARIANT_BOOL* ret)
Returns the continuity of the curve, the curve is at least C0.
HRESULT IsClosed( VARIANT_BOOL* closed)
Returns true if the distance between the first point and the last point of the
curve is lower or equal to Resolution from package gp. Warnings : The first and
the last point can be different from the first pole and the last pole of the
curve.
HRESULT IsPeriodic( VARIANT_BOOL* periodic)
HRESULT IsRational( VARIANT_BOOL* rational)
Returns True if the weights are not identical. The tolerance criterion is Epsilon
of the class Real
HRESULT Continuity(int* continuity)
Returns the global continuity of the curve : C0 : only geometric continuity, C1 :
continuity of the first derivative all along the Curve, C2 : continuity of the
second derivative all along the Curve, C3 : continuity of the third derivative
all along the Curve, CN : the order of continuity is infinite. For a B-spline
curve of degree d if a knot Ui has a multiplicity p the B-spline curve is only
Cd-p continuous at Ui. So the global continuity of the curve can't be greater
than Cd-p where p is the maximum multiplicity of the interior Knots. In the
interior of a knot span the curve is infinitely continuously differentiable.
HRESULT Degree(int* degree)
Returns the degree of this BSpline curve. The degree of a Geom_BSplineCurve curve
cannot be greater than Geom_BSplineCurve::MaxDegree().
HRESULT D0(double U, DIPoint* P)
Returns in P the point of parameter U.
HRESULT D1(double U, DIPoint* P, DIVect* V1)
Returns in P the point of parameter U and its tangential vector
HRESULT D2(double U, DIPoint* P, DIVect* V1, DIVect* V2)
HRESULT D3(double U, DIPoint* P, DIVect* V1, DIVect* V2, DIVect* V3)
HRESULT DN(double U, int N, DIVect* V)
For the point of parameter U of this BSpline curve, computes the vector For the point of parameter U of this BSpline curve, computes the vector
corresponding to the Nth derivative. Warning On a point where the continuity of
the curve is not the one requested, this function impacts the part defined by
the parameter with a value greater than U, i.e. the part of the curve to the
"right" of the singularity. Exceptions Standard_RangeError if N is less than 1.
The following functions compute the point of parameter U and the derivatives at
this point on the B-spline curve arc defined between the knot FromK1 and the
knot ToK2. U can be out of bounds [Knot (FromK1), Knot (ToK2)] but for the
computation we only use the definition of the curve between these two knots.
This method is useful to compute local derivative, if the order of continuity of
the whole curve is not greater enough. Inside the parametric domain Knot
(FromK1), Knot (ToK2) the evaluations are the same as if we consider the whole
definition of the curve. Of course the evaluations are different outside this
parametric domain.
HRESULT EndPoint(DIPoint* P)
- Returns the last point of the curve. Warnings : The last point of the curve is
different from the last pole of the curve if the multiplicity of the last knot
is lower than Degree.
HRESULT FirstUKnotIndex(int* ind)
Returns the index in the knot array of the knot corresponding to the first or
last parameter of this BSpline curve. For a BSpline curve, the first (or last)
parameter (which gives the start (or end) point of the curve) is a knot value.
However, if the multiplicity of the first (or last) knot is less than Degree +
1, where Degree is the degree of the curve, it is not the first (or last) knot
of the curve.
HRESULT FirstParameter(double* t)
Returns the value of the first parameter of this BSpline curve. This is a knot
value. The first parameter is the one of the start point of the BSpline curve.
HRESULT Knot(int Index, double* t)
Returns the knot of range Index. When there is a knot with a multiplicity greater
than 1 the knot is not repeated. The method Multiplicity can be used to get the
multiplicity of the Knot.
HRESULT Knots(IKO_TColStd_Array1OfReal* K)
returns the knot values of the B-spline curve; Warning A knot with a multiplicity
greater than 1 is not repeated in the knot table. The Multiplicity function can
be used to obtain the multiplicity of each knot. Raised if the length of K is
not equal to the number of knots
HRESULT KnotSequence(IKO_TColStd_Array1OfReal* K)
Returns K, the knots sequence of this BSpline curve. In this sequence, knots with
a multiplicity greater than 1 are repeated. In the case of a non-periodic curve
the length of the sequence must be equal to the sum of the NbKnots
multiplicities of the knots of the curve (where NbKnots is the number of knots
of this BSpline curve). This sum is also equal to : NbPoles + Degree + 1 where
NbPoles is the number of poles and Degree the degree of this BSpline curve. In
the case of a periodic curve, if there are k periodic knots, the period is
Knot(k+1) - Knot(1).
The initial sequence is built by writing knots 1 to k+1, which are repeated
according to their corresponding multiplicities. If Degree is the degree of the
curve, the degree of continuity of the curve at the knot of index 1 (or k+1) is
equal to c = Degree + 1 - Mult(1). c knots are then inserted at the beginning
and end of the initial sequence: the c values of knots preceding the first item
Knot(k+1) in the initial sequence are inserted at the beginning; the period is
subtracted from these c values; the c values of knots following the last item
Knot(1) in the initial sequence are inserted at the end; the period is added to
these c values. The length of the sequence must therefore be equal to: NbPoles +
2*Degree - Mult(1) + 2.
Example For a non-periodic BSpline curve of degree 2 where: the array of knots
is: { k1 k2 k3 k4 }, with associated multiplicities: { 3 1 2 3 }, the knot
sequence is: K = { k1 k1 k1 k2 k3 k3 k4 k4 k4 } For a periodic BSpline curve of
degree 4 , which is "C1" continuous at the first knot, and where : the periodic
knots are: { k1 k2 k3 (k4) } (3 periodic knots: the points of parameter k1 and
k4 are identical, the period is p = k4 - k1), with associated multiplicities: {
3 1 2 (3) }, the degree of continuity at knots k1 and k4 is: Degree + 1 -
Mult(i) = 2. 2 supplementary knots are added at the beginning and end of the
sequence: at the beginning: the 2 knots preceding k4 minus the period; in this
example, this is k3 - p both times; at the end: the 2 knots following k1 plus
the period; in this example, this is k2 + p and k3 + p. The knot sequence is
therefore: K = { k3-p k3-p k1 k1 k1 k2 k3 k3 k4 k4 k4 k2+p k3+p } Exceptions
Standard_DimensionError if the array K is not of the appropriate length.Returns
the knots sequence.
HRESULT KnotDistribution(int* GeomAbs_BSplKnotDistribution_retVal)
- Returns type of knot spacing. The returned values are enumerated in
GeomAbs_BSplKnotDistribution
-
- Returns NonUniform or Uniform or QuasiUniform or PiecewiseBezier. If all the
knots differ by a positive constant from the preceding knot the BSpline Curve
can be : Uniform if all the knots are of multiplicity 1, QuasiUniform if all the
knots are of multiplicity 1 except for the first and last knot which are of
multiplicity Degree + 1, PiecewiseBezier if the first and last knots have
multiplicity Degree + 1 and if interior knots have multiplicity Degree A
piecewise Bezier with only two knots is a BezierCurve. else the curve is non
uniform. The tolerance criterion is Epsilon from class Real.
HRESULT LastUKnotIndex(int* retVal)
- For a BSpline curve the last parameter (which gives the end point of the curve)
is a knot value but if the multiplicity of the last knot index is lower than
Degree + 1 it is not the last knot of the curve. This method computes the index
of the knot corresponding to the last parameter.
HRESULT LastParameter(double* t)
Computes the parametric value of the end point of the curve. It is a knot value
HRESULT LocateU(double U, double ParametricTolerance, int* I1, int* I2,
VARIANT_BOOL WithKnotRepetition)
Locates the parametric value U in the sequence of knots. If "WithKnotRepetition"
is True we consider the knot's representation with repetition of multiple knot
value, otherwise we consider the knot's representation with no repetition of
multiple knot values. Knots (I1) <= U <= Knots (I2) . if I1 = I2 U is a knot
value (the tolerance criterion ParametricTolerance is used). . if I1 < 1 => U <
Knots (1) - Abs(ParametricTolerance) . if I2 > NbKnots => U > Knots (NbKnots) +
Abs(ParametricTolerance)
HRESULT Multiplicity(int Index, int* multiplicity)
Returns the multiplicity of the knots of range Index
HRESULT Multiplicities(IKO_TColStd_Array1OfInteger* iArr)
Returns the multiplicity of the knots of the curve. Raised if the length of M is
not equal to NbKnots.
HRESULT NbKnots(int* count)
Returns the number of knots. This method returns the number of knot without
repetition of multiple knots.
HRESULT NbPoles(int* count)
Returns the number of poles
HRESHRESULT Pole(int Index, DIPoint* P)
- Returns the pole of range Index
HRESULT Poles(IKO_TColgp_Array1OfPnt** iArr)
Returns the poles of the B-spline curve; Raised if the length of P is not equal
to the number of poles.
HRESULT StartPoint(DIPoint* P)
Returns the start point of the curve. Warnings : This point is different from the
first pole of the curve if the multiplicity of the first knot is lower than
Degree.
HRESULT Weight(int Index, double* weight)
Returns the weight of the pole of range Index
HRESULT Weights(IKO_TColStd_Array1OfReal* W)
|