Class BSpline
Class defining a B-Spline polynomial.
Implements
Inherited Members
Namespace: BRIDGES.Arithmetic.Polynomials.Univariate.Specials
Assembly: BRIDGES.dll
Syntax
public class BSpline : Polynomial, IGroupAction<Polynomial, double>
Constructors
| Improve this Doc View SourceBSpline(Int32, Int32, Int32, IList<Double>)
Initialises a new instance of BSpline class by defining its index, degree and knot vector.
Declaration
public BSpline(int spanIndex, int index, int degree, IList<double> knotVector)
Parameters
Type | Name | Description |
---|---|---|
Int32 | spanIndex | Index of knot span on which the current BSpline is defined. |
Int32 | index | Index of the B-Spline polynomial. |
Int32 | degree | Degree of the B-Spline polynomial. |
IList<Double> | knotVector | Knot vector of the B-Spline polynomial. |
Fields
| Improve this Doc View Source_knotVector
Knot vector associated with the current BSpline.
Declaration
protected List<double> _knotVector
Field Value
Type | Description |
---|---|
List<Double> |
Properties
| Improve this Doc View SourceIndex
Gets the index of the current BSpline.
Declaration
public int Index { get; }
Property Value
Type | Description |
---|---|
Int32 |
KnotVector
Gets the knot vector associated with the current BSpline.
Declaration
public double[] KnotVector { get; }
Property Value
Type | Description |
---|---|
Double[] |
SpanIndex
Gets the index of knot span on which the current BSpline is defined.
Declaration
public int SpanIndex { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceComputeCoefficients(Int32, Int32, Int32, IList<Double>)
Sets the coefficients of the current BSpline polynomial.
Declaration
protected static double[] ComputeCoefficients(int spanIndex, int index, int degree, IList<double> knotVector)
Parameters
Type | Name | Description |
---|---|---|
Int32 | spanIndex | Index of knot span on which the current BSpline is defined. |
Int32 | index | Index of the BSpline polynomial. |
Int32 | degree | Degree of the BSpline polynomial. |
IList<Double> | knotVector | Knot vector of the BSpline polynomial. |
Returns
Type | Description |
---|---|
Double[] | The coefficients of the BSpline polynomial. |
EvaluateAt(Double, Int32, Int32, IList<Double>)
Evaluates the BSpline at a given value.
Declaration
public static double EvaluateAt(double val, int index, int degree, IList<double> knotVector)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to evaluate at. |
Int32 | index | Index of the BSpline to evaluate. |
Int32 | degree | Degree of the BSpline to evaluate. |
IList<Double> | knotVector | Knot Vector associated with the BSpline to evaluate. |
Returns
Type | Description |
---|---|
Double | The value of the BSpline the given value. |
Remarks
The code is adapted from algorithm 2.4 described in the NURBS Book, by L. Piegl and W. Tiller.
EvaluateAt(Double)
Computes the current BSpline at a given value.
Declaration
public override double EvaluateAt(double val)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to evaluate at. |
Returns
Type | Description |
---|---|
Double | The computed value of the current BSpline. |
Overrides
| Improve this Doc View SourceEvaluateBasisAt(Double, Int32, Int32, IList<Double>)
Evaluates a BSpline basis at a given value.
Declaration
public static double[] EvaluateBasisAt(double val, int knotSpanIndex, int degree, IList<double> knotVector)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to evaluate at. |
Int32 | knotSpanIndex | Index of knot span containing the value. |
Int32 | degree | Degree of the BSpline basis. |
IList<Double> | knotVector | Knot vector of the BSpline basis. |
Returns
Type | Description |
---|---|
Double[] | The values of the non-zero BSpline polynomials of the basis, i.e. those ranging from
N_{ |
Remarks
The code is adapted from algorithm 2.2 described in the NURBS Book, by L. Piegl and W. Tiller.
EvaluateBasisDerivativesAt(Double, Int32, Int32, IList<Double>, Int32)
Evaluates the BSpline basis' derivatives of a given order, at a given value.
Declaration
public static double[][] EvaluateBasisDerivativesAt(double val, int knotSpanIndex, int degree, IList<double> knotVector, int order)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to evaluate at. |
Int32 | knotSpanIndex | Index of knot span containing the value. |
Int32 | degree | Initial degree of the BSpline basis. |
IList<Double> | knotVector | Initial knot vector of the BSpline basis. |
Int32 | order | Order of the derivatives. |
Returns
Type | Description |
---|---|
Double[][] | The values of successive derivatives of the non-zero BSpline polynomial of the basis, i.e. those ranging from
N_{ |
Remarks
The code is adapted from algorithm 2.3 described in the NURBS Book, by L. Piegl and W. Tiller.
EvaluateDerivativesAt(Double, Int32, Int32, IList<Double>, Int32)
Evaluates the BSpline derivative of a given order; at a given value.
Declaration
public static double[] EvaluateDerivativesAt(double val, int index, int degree, IList<double> knotVector, int order)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to evaluate at. |
Int32 | index | Index of the BSpline to evaluate. |
Int32 | degree | Initial degree of the BSpline to evaluate. |
IList<Double> | knotVector | Initial knot Vector associated with the BSpline to evaluate. |
Int32 | order | Order of the derivative. |
Returns
Type | Description |
---|---|
Double[] | The value of the successive BSpline derivatives at the given value. The index corresponds to the order of derivation. |
Remarks
The code is adapted from algorithm 2.5 described in the NURBS Book, by L. Piegl and W. Tiller.
FindKnotSpanIndex(Double, Int32, IList<Double>)
Identifies the index of the knot span containing a given value, using a binary search.
Declaration
public static int FindKnotSpanIndex(double val, int degree, IList<double> knotVector)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to locate in the knot vector. |
Int32 | degree | Degree of the BSpline basis. |
IList<Double> | knotVector | Knot vector of the BSpline basis. |
Returns
Type | Description |
---|---|
Int32 | The (zero-based) index of the knot span containing the value. |
Remarks
The code is adapted from algorithm 2.1 described in the NURBS Book, by L. Piegl and W. Tiller.
SetKnotVector(IList<Double>, Int32, out List<Double>)
Sets the knot vector of the current BSpline polynomial while ensuring its validity.
Declaration
protected static bool SetKnotVector(IList<double> knotVector, int degree, out List<double> knotList)
Parameters
Type | Name | Description |
---|---|---|
IList<Double> | knotVector | Knot vector to evaluate. |
Int32 | degree | Degree of the B-Spline polynomial. |
List<Double> | knotList | Knot vector to set. |
Returns
Type | Description |
---|---|
Boolean |