Open CASCADE Technology 6.6.0
|
Definition of the 1D B_spline curve.
Uniform or non-uniform
Rational or non-rational
Periodic or non-periodic
a b-spline curve is defined by :
The Degree (up to 25)
The Poles (and the weights if it is rational)
The Knots and Multiplicities
The knot vector is an increasing sequence of
reals without repetition. The multiplicities are
the repetition of the knots.
If the knots are regularly spaced (the difference
of two consecutive knots is a constant), the
knots repartition is :
More...
#include <Law_BSpline.hxx>
Public Member Functions | |
Law_BSpline (const TColStd_Array1OfReal &Poles, const TColStd_Array1OfReal &Knots, const TColStd_Array1OfInteger &Multiplicities, const Standard_Integer Degree, const Standard_Boolean Periodic=Standard_False) | |
Creates a non-rational B_spline curve on the basis <Knots, Multiplicities> of degree <Degree>. | |
Law_BSpline (const TColStd_Array1OfReal &Poles, const TColStd_Array1OfReal &Weights, const TColStd_Array1OfReal &Knots, const TColStd_Array1OfInteger &Multiplicities, const Standard_Integer Degree, const Standard_Boolean Periodic=Standard_False) | |
Creates a rational B_spline curve on the basis <Knots, Multiplicities> of degree <Degree>. | |
void | IncreaseDegree (const Standard_Integer Degree) |
Increase the degree to <Degree>. Nothing is done if <Degree> is lower or equal to the current degree. | |
void | IncreaseMultiplicity (const Standard_Integer Index, const Standard_Integer M) |
Increases the multiplicity of the knot <Index> to <M>. If <M> is lower or equal to the current multiplicity nothing is done. If <M> is higher than the degree the degree is used. //! If <Index> is not in [FirstUKnotIndex, LastUKnotIndex] | |
void | IncreaseMultiplicity (const Standard_Integer I1, const Standard_Integer I2, const Standard_Integer M) |
Increases the multiplicities of the knots in [I1,I2] to <M>. For each knot if <M> is lower or equal to the current multiplicity nothing is done. If <M> is higher than the degree the degree is used. //! If <I1,I2> are not in [FirstUKnotIndex, LastUKnotIndex] | |
void | IncrementMultiplicity (const Standard_Integer I1, const Standard_Integer I2, const Standard_Integer M) |
Increment the multiplicities of the knots in [I1,I2] by <M>. If <M> is not positive nithing is done. For each knot the resulting multiplicity is limited to the Degree. //! If <I1,I2> are not in [FirstUKnotIndex, LastUKnotIndex] | |
void | InsertKnot (const Standard_Real U, const Standard_Integer M=1, const Standard_Real ParametricTolerance=0.0, const Standard_Boolean Add=Standard_True) |
Inserts a knot value in the sequence of knots. If <U> is an existing knot the multiplicity is increased by <M>. 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. | |
void | InsertKnots (const TColStd_Array1OfReal &Knots, const TColStd_Array1OfInteger &Mults, const Standard_Real ParametricTolerance=0.0, const Standard_Boolean Add=Standard_False) |
Inserts a set of knots values in the sequence of knots. For each U = Knots(i), M = Mults(i) If <U> is an existing knot the multiplicity is increased by <M> if <Add> is True, increased to <M> if <Add> 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. | |
Standard_Boolean | RemoveKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance) |
Decrement the knots multiplicity to <M>. If M is 0 the knot is removed. The Poles sequence is modified. As there are two ways to compute the new poles the average is computed if the distance is lower than the <Tolerance>, else False is returned. A low tolerance is used to prevent the modification of the curve. A high tolerance is used to "smooth" the curve. Raised if Index is not in the range [FirstUKnotIndex, LastUKnotIndex] //! 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. | |
void | Reverse () |
Changes the direction of parametrization of <me>. 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. | |
Standard_Real | ReversedParameter (const Standard_Real U) const |
Returns the parameter on the reversed curve for the point of parameter U on <me>. returns UFirst + ULast - U | |
void | Segment (const Standard_Real U1, const Standard_Real U2) |
Segments the curve between U1 and U2. The control points are modified, the first and the last point are not the same. Warnings : Even if <me> is not closed it can become closed after the segmentation for example if U1 or U2 are out of the bounds of the curve <me> or if the curve makes loop. After the segmentation the length of a curve can be null. //! raises if U2 < U1. | |
void | SetKnot (const Standard_Integer Index, const Standard_Real K) |
Changes the knot of range Index. The multiplicity of the knot is not modified. //! Raised if K >= Knots(Index+1) or K <= Knots(Index-1). //! Raised if Index < 1 || Index > NbKnots | |
void | SetKnots (const TColStd_Array1OfReal &K) |
Changes all the knots of the curve The multiplicity of the knots are not modified. Raised if there is an index such that K (Index+1) <= K (Index). Raised if K.Lower() < 1 or K.Upper() > NbKnots | |
void | SetKnot (const Standard_Integer Index, const Standard_Real K, const Standard_Integer 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 | |
void | PeriodicNormalization (Standard_Real &U) const |
returns the parameter normalized within the period if the curve is periodic : otherwise does not do anything | |
void | SetPeriodic () |
Makes a closed B-spline into a periodic curve. The curve is periodic if the knot sequence is periodic and if the curve is closed (The tolerance criterion is Resolution from gp). The period T is equal to Knot(LastUKnotIndex) - Knot(FirstUKnotIndex). A periodic B-spline can be uniform or not. //! Raised if the curve is not closed. | |
void | SetOrigin (const Standard_Integer Index) |
Set the origin of a periodic curve at Knot(index) KnotVector and poles are modified. //! Raised if the curve is not periodic //! Raised if index not in the range [FirstUKnotIndex , LastUKnotIndex] | |
void | SetNotPeriodic () |
Makes a non periodic curve. If the curve was non periodic the curve is not modified. | |
void | SetPole (const Standard_Integer Index, const Standard_Real P) |
Substitutes the Pole of range Index with P. Raised if Index < 1 || Index > NbPoles | |
void | SetPole (const Standard_Integer Index, const Standard_Real P, const Standard_Real Weight) |
Substitutes the pole and the weight of range Index. If the curve <me> is not rational it can become rational If the curve was rational it can become non rational Raised if Index < 1 || Index > NbPoles //! Raised if Weight <= 0.0 | |
void | SetWeight (const Standard_Integer Index, const Standard_Real 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 //! Raised if Weight <= 0.0 | |
Standard_Boolean | IsCN (const Standard_Integer N) const |
Returns the continuity of the curve, the curve is at least C0. //! Raised if N < 0. | |
Standard_Boolean | IsClosed () const |
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. | |
Standard_Boolean | IsPeriodic () const |
Returns True if the curve is periodic. | |
Standard_Boolean | IsRational () const |
Returns True if the weights are not identical. The tolerance criterion is Epsilon of the class Real. | |
GeomAbs_Shape | Continuity () const |
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. | |
Standard_Integer | Degree () const |
Computation of value and derivatives | |
Standard_Real | Value (const Standard_Real U) const |
void | D0 (const Standard_Real U, Standard_Real &P) const |
void | D1 (const Standard_Real U, Standard_Real &P, Standard_Real &V1) const |
void | D2 (const Standard_Real U, Standard_Real &P, Standard_Real &V1, Standard_Real &V2) const |
void | D3 (const Standard_Real U, Standard_Real &P, Standard_Real &V1, Standard_Real &V2, Standard_Real &V3) const |
Standard_Real | DN (const Standard_Real U, const Standard_Integer N) const |
The following functions computes 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. | |
Standard_Real | LocalValue (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2) const |
void | LocalD0 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real &P) const |
void | LocalD1 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real &P, Standard_Real &V1) const |
void | LocalD2 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real &P, Standard_Real &V1, Standard_Real &V2) const |
void | LocalD3 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real &P, Standard_Real &V1, Standard_Real &V2, Standard_Real &V3) const |
Standard_Real | LocalDN (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Integer N) const |
Standard_Real | EndPoint () const |
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. | |
Standard_Integer | FirstUKnotIndex () const |
For a B-spline curve the first parameter (which gives the start point of the curve) is a knot value but if the multiplicity of the first knot index is lower than Degree + 1 it is not the first knot of the curve. This method computes the index of the knot corresponding to the first parameter. | |
Standard_Real | FirstParameter () const |
Computes the parametric value of the start point of the curve. It is a knot value. | |
Standard_Real | Knot (const Standard_Integer Index) const |
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. //! Raised if Index < 1 or Index > NbKnots | |
void | Knots (TColStd_Array1OfReal &K) const |
returns the knot values of the B-spline curve; Raised if the length of K is not equal to the number of knots. | |
void | KnotSequence (TColStd_Array1OfReal &K) const |
Returns the knots sequence. In this sequence the knots with a multiplicity greater than 1 are repeated. Example : K = {k1, k1, k1, k2, k3, k3, k4, k4, k4} Raised if the length of K is not equal to NbPoles + Degree + 1 | |
GeomAbs_BSplKnotDistribution | KnotDistribution () const |
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 : | |
Standard_Integer | LastUKnotIndex () const |
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. | |
Standard_Real | LastParameter () const |
Computes the parametric value of the end point of the curve. It is a knot value. | |
void | LocateU (const Standard_Real U, const Standard_Real ParametricTolerance, Standard_Integer &I1, Standard_Integer &I2, const Standard_Boolean WithKnotRepetition=Standard_False) const |
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) | |
Standard_Integer | Multiplicity (const Standard_Integer Index) const |
Returns the multiplicity of the knots of range Index. //! Raised if Index < 1 or Index > NbKnots | |
void | Multiplicities (TColStd_Array1OfInteger &M) const |
Returns the multiplicity of the knots of the curve. Raised if the length of M is not equal to NbKnots. | |
Standard_Integer | NbKnots () const |
Returns the number of knots. This method returns the number of knot without repetition of multiple knots. | |
Standard_Integer | NbPoles () const |
Returns the number of poles | |
Standard_Real | Pole (const Standard_Integer Index) const |
Returns the pole of range Index. //! Raised if Index < 1 or Index > NbPoles. | |
void | Poles (TColStd_Array1OfReal &P) const |
Returns the poles of the B-spline curve; Raised if the length of P is not equal to the number of poles. | |
Standard_Real | StartPoint () const |
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. | |
Standard_Real | Weight (const Standard_Integer Index) const |
Returns the weight of the pole of range Index . //! Raised if Index < 1 or Index > NbPoles. | |
void | Weights (TColStd_Array1OfReal &W) const |
Returns the weights of the B-spline curve; Raised if the length of W is not equal to NbPoles. | |
void | MovePointAndTangent (const Standard_Real U, const Standard_Real NewValue, const Standard_Real Derivative, const Standard_Real Tolerance, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Integer &ErrorStatus) |
Changes the value of the Law at parameter U to NewValue. and makes its derivative at U be derivative. 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 | |
void | Resolution (const Standard_Real Tolerance3D, Standard_Real &UTolerance) const |
given Tolerance3D returns UTolerance such that if f(t) is the curve we have | t1 - t0| < Utolerance ===> |f(t1) - f(t0)| < Tolerance3D | |
Handle_Law_BSpline | Copy () const |
Static Public Member Functions | |
static Standard_Integer | MaxDegree () |
Returns the value of the maximum degree of the normalized B-spline basis functions in this package. |
Law_BSpline::Law_BSpline | ( | const TColStd_Array1OfReal & | Poles, |
const TColStd_Array1OfReal & | Knots, | ||
const TColStd_Array1OfInteger & | Multiplicities, | ||
const Standard_Integer | Degree, | ||
const Standard_Boolean | Periodic = Standard_False |
||
) |
Law_BSpline::Law_BSpline | ( | const TColStd_Array1OfReal & | Poles, |
const TColStd_Array1OfReal & | Weights, | ||
const TColStd_Array1OfReal & | Knots, | ||
const TColStd_Array1OfInteger & | Multiplicities, | ||
const Standard_Integer | Degree, | ||
const Standard_Boolean | Periodic = Standard_False |
||
) |
GeomAbs_Shape Law_BSpline::Continuity | ( | ) | const |
Handle_Law_BSpline Law_BSpline::Copy | ( | ) | const |
void Law_BSpline::D0 | ( | const Standard_Real | U, |
Standard_Real & | P | ||
) | const |
void Law_BSpline::D1 | ( | const Standard_Real | U, |
Standard_Real & | P, | ||
Standard_Real & | V1 | ||
) | const |
void Law_BSpline::D2 | ( | const Standard_Real | U, |
Standard_Real & | P, | ||
Standard_Real & | V1, | ||
Standard_Real & | V2 | ||
) | const |
void Law_BSpline::D3 | ( | const Standard_Real | U, |
Standard_Real & | P, | ||
Standard_Real & | V1, | ||
Standard_Real & | V2, | ||
Standard_Real & | V3 | ||
) | const |
Standard_Integer Law_BSpline::Degree | ( | ) | const |
Standard_Real Law_BSpline::DN | ( | const Standard_Real | U, |
const Standard_Integer | N | ||
) | const |
Standard_Real Law_BSpline::EndPoint | ( | ) | const |
Standard_Real Law_BSpline::FirstParameter | ( | ) | const |
Standard_Integer Law_BSpline::FirstUKnotIndex | ( | ) | const |
void Law_BSpline::IncreaseDegree | ( | const Standard_Integer | Degree | ) |
void Law_BSpline::IncreaseMultiplicity | ( | const Standard_Integer | Index, |
const Standard_Integer | M | ||
) |
void Law_BSpline::IncreaseMultiplicity | ( | const Standard_Integer | I1, |
const Standard_Integer | I2, | ||
const Standard_Integer | M | ||
) |
void Law_BSpline::IncrementMultiplicity | ( | const Standard_Integer | I1, |
const Standard_Integer | I2, | ||
const Standard_Integer | M | ||
) |
void Law_BSpline::InsertKnot | ( | const Standard_Real | U, |
const Standard_Integer | M = 1 , |
||
const Standard_Real | ParametricTolerance = 0.0 , |
||
const Standard_Boolean | Add = Standard_True |
||
) |
void Law_BSpline::InsertKnots | ( | const TColStd_Array1OfReal & | Knots, |
const TColStd_Array1OfInteger & | Mults, | ||
const Standard_Real | ParametricTolerance = 0.0 , |
||
const Standard_Boolean | Add = Standard_False |
||
) |
Standard_Boolean Law_BSpline::IsClosed | ( | ) | const |
Standard_Boolean Law_BSpline::IsCN | ( | const Standard_Integer | N | ) | const |
Standard_Boolean Law_BSpline::IsPeriodic | ( | ) | const |
Standard_Boolean Law_BSpline::IsRational | ( | ) | const |
Standard_Real Law_BSpline::Knot | ( | const Standard_Integer | Index | ) | const |
GeomAbs_BSplKnotDistribution Law_BSpline::KnotDistribution | ( | ) | const |
void Law_BSpline::Knots | ( | TColStd_Array1OfReal & | K | ) | const |
void Law_BSpline::KnotSequence | ( | TColStd_Array1OfReal & | K | ) | const |
Standard_Real Law_BSpline::LastParameter | ( | ) | const |
Standard_Integer Law_BSpline::LastUKnotIndex | ( | ) | const |
void Law_BSpline::LocalD0 | ( | const Standard_Real | U, |
const Standard_Integer | FromK1, | ||
const Standard_Integer | ToK2, | ||
Standard_Real & | P | ||
) | const |
void Law_BSpline::LocalD1 | ( | const Standard_Real | U, |
const Standard_Integer | FromK1, | ||
const Standard_Integer | ToK2, | ||
Standard_Real & | P, | ||
Standard_Real & | V1 | ||
) | const |
void Law_BSpline::LocalD2 | ( | const Standard_Real | U, |
const Standard_Integer | FromK1, | ||
const Standard_Integer | ToK2, | ||
Standard_Real & | P, | ||
Standard_Real & | V1, | ||
Standard_Real & | V2 | ||
) | const |
void Law_BSpline::LocalD3 | ( | const Standard_Real | U, |
const Standard_Integer | FromK1, | ||
const Standard_Integer | ToK2, | ||
Standard_Real & | P, | ||
Standard_Real & | V1, | ||
Standard_Real & | V2, | ||
Standard_Real & | V3 | ||
) | const |
Standard_Real Law_BSpline::LocalDN | ( | const Standard_Real | U, |
const Standard_Integer | FromK1, | ||
const Standard_Integer | ToK2, | ||
const Standard_Integer | N | ||
) | const |
Standard_Real Law_BSpline::LocalValue | ( | const Standard_Real | U, |
const Standard_Integer | FromK1, | ||
const Standard_Integer | ToK2 | ||
) | const |
void Law_BSpline::LocateU | ( | const Standard_Real | U, |
const Standard_Real | ParametricTolerance, | ||
Standard_Integer & | I1, | ||
Standard_Integer & | I2, | ||
const Standard_Boolean | WithKnotRepetition = Standard_False |
||
) | const |
static Standard_Integer Law_BSpline::MaxDegree | ( | ) | [static] |
void Law_BSpline::MovePointAndTangent | ( | const Standard_Real | U, |
const Standard_Real | NewValue, | ||
const Standard_Real | Derivative, | ||
const Standard_Real | Tolerance, | ||
const Standard_Integer | StartingCondition, | ||
const Standard_Integer | EndingCondition, | ||
Standard_Integer & | ErrorStatus | ||
) |
void Law_BSpline::Multiplicities | ( | TColStd_Array1OfInteger & | M | ) | const |
Standard_Integer Law_BSpline::Multiplicity | ( | const Standard_Integer | Index | ) | const |
Standard_Integer Law_BSpline::NbKnots | ( | ) | const |
Standard_Integer Law_BSpline::NbPoles | ( | ) | const |
void Law_BSpline::PeriodicNormalization | ( | Standard_Real & | U | ) | const |
Standard_Real Law_BSpline::Pole | ( | const Standard_Integer | Index | ) | const |
void Law_BSpline::Poles | ( | TColStd_Array1OfReal & | P | ) | const |
Standard_Boolean Law_BSpline::RemoveKnot | ( | const Standard_Integer | Index, |
const Standard_Integer | M, | ||
const Standard_Real | Tolerance | ||
) |
void Law_BSpline::Resolution | ( | const Standard_Real | Tolerance3D, |
Standard_Real & | UTolerance | ||
) | const |
void Law_BSpline::Reverse | ( | ) |
Standard_Real Law_BSpline::ReversedParameter | ( | const Standard_Real | U | ) | const |
void Law_BSpline::Segment | ( | const Standard_Real | U1, |
const Standard_Real | U2 | ||
) |
void Law_BSpline::SetKnot | ( | const Standard_Integer | Index, |
const Standard_Real | K, | ||
const Standard_Integer | M | ||
) |
void Law_BSpline::SetKnot | ( | const Standard_Integer | Index, |
const Standard_Real | K | ||
) |
void Law_BSpline::SetKnots | ( | const TColStd_Array1OfReal & | K | ) |
void Law_BSpline::SetNotPeriodic | ( | ) |
void Law_BSpline::SetOrigin | ( | const Standard_Integer | Index | ) |
void Law_BSpline::SetPeriodic | ( | ) |
void Law_BSpline::SetPole | ( | const Standard_Integer | Index, |
const Standard_Real | P | ||
) |
void Law_BSpline::SetPole | ( | const Standard_Integer | Index, |
const Standard_Real | P, | ||
const Standard_Real | Weight | ||
) |
void Law_BSpline::SetWeight | ( | const Standard_Integer | Index, |
const Standard_Real | Weight | ||
) |
Standard_Real Law_BSpline::StartPoint | ( | ) | const |
Standard_Real Law_BSpline::Value | ( | const Standard_Real | U | ) | const |
Standard_Real Law_BSpline::Weight | ( | const Standard_Integer | Index | ) | const |
void Law_BSpline::Weights | ( | TColStd_Array1OfReal & | W | ) | const |