public class BSpline extends java.lang.Object implements MathFunction, MathFunctionWithIntegral, MathFunctionWithDerivative, MathFunctionWithFirstDerivative
| Ni, p(t) | = | ((t - ti)/(ti+p - ti))Ni, p-1(t) + ((ti+p+1 - t)/(ti+p+1 - ti+1))Ni+1, p-1(t) | |
| Ni, 0(t) | = | {![]() |
This class provides methods to evaluate
P(t) = (X(t), Y(t)) at any value of t,
for a B-spline of any degree p >= 1.
Note that the
evaluate method
of this class can be slow, since it
uses a root finder to determine
the value of t* for which X(t*) = x
before it computes Y(t*).
| Constructor and Description |
|---|
BSpline(double[] x,
double[] y,
double[] knots)
Constructs a new uniform B-spline
with control points at (x[i], y[i]), and
knot vector given by the array knots.
|
BSpline(double[] x,
double[] y,
int degree)
Constructs a new uniform B-spline of degree degree
with control points at (x[i], y[i]).
|
| Modifier and Type | Method and Description |
|---|---|
static BSpline |
createApproxBSpline(double[] x,
double[] y,
int degree,
int h)
Returns a B-spline curve of degree degree smoothing
(xi, yi), for
i = 0,…, n points.
|
static BSpline |
createInterpBSpline(double[] x,
double[] y,
int degree)
Returns a B-spline curve of degree degree interpolating the
(xi, yi) points.
|
double |
derivative(double u)
Computes (or estimates) the first derivative
of the function at point x.
|
double |
derivative(double u,
int n)
Computes (or estimates) the nth derivative
of the function at point x.
|
BSpline |
derivativeBSpline()
Returns the derivative B-spline object of the current variable.
|
BSpline |
derivativeBSpline(int i)
Returns the ith derivative B-spline object of the current variable;
i must be less than the degree of the original B-spline.
|
double |
evaluate(double u)
Returns the value of the function evaluated at x.
|
double |
evalX(double u) |
double |
evalY(double u) |
double[] |
getKnots()
Returns an array containing the knot vector
(t0, tm-1).
|
double |
getMaxKnot()
Returns the knot maximal value.
|
double |
getMinKnot()
Returns the knot minimal value.
|
double[] |
getX()
Returns the Xi coordinates for this spline.
|
double[] |
getY()
Returns the Yi coordinates for this spline.
|
double |
integral(double a,
double b)
Computes (or estimates) the integral of the
function over the interval [a, b].
|
public BSpline(double[] x,
double[] y,
int degree)
x - the values of X.y - the values of Y.degree - the degree of the B-spline.public BSpline(double[] x,
double[] y,
double[] knots)
x - the values of X.y - the values of Y.knots - the knots of the B-spline.public double[] getX()
public double[] getY()
public double getMaxKnot()
public double getMinKnot()
public double[] getKnots()
public static BSpline createInterpBSpline(double[] x, double[] y, int degree)
x - the values of X.y - the values of Y.degree - the degree of the B-spline.public static BSpline createApproxBSpline(double[] x, double[] y, int degree, int h)
)2.
x - the values of X.y - the values of Y.degree - the degree of the B-spline.h - the desired number of control points.public BSpline derivativeBSpline()
public BSpline derivativeBSpline(int i)
i - the degree of the derivative.public double evaluate(double u)
MathFunctionevaluate in interface MathFunctionu - value at which the distribution function is evaluatedpublic double integral(double a,
double b)
MathFunctionWithIntegralintegral in interface MathFunctionWithIntegrala - the starting point of the interval.b - the ending point of the interval.public double derivative(double u)
MathFunctionWithFirstDerivativederivative in interface MathFunctionWithFirstDerivativeu - the point to evaluate the derivative to.public double derivative(double u,
int n)
MathFunctionWithDerivativeevaluate.derivative in interface MathFunctionWithDerivativeu - the point to evaluate the derivate to.n - the order of the derivative.public double evalX(double u)
public double evalY(double u)
To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.