Represents a B-spline with control points at \((X_i, Y_i)\). More...
Public Member Functions | |
| BSpline (final double[] x, final double[] y, final int degree) | |
| Constructs a new uniform B-spline of degree degree with control points at (x[i], y[i]). | |
| BSpline (final double[] x, final double[] y, final double[] knots) | |
| Constructs a new uniform B-spline with control points at (x[i], y[i]), and knot vector given by the array knots. | |
| double[] | getX () |
| Returns the \(X_i\) coordinates for this spline. | |
| double[] | getY () |
| Returns the \(Y_i\) coordinates for this spline. | |
| double | getMaxKnot () |
| Returns the knot maximal value. | |
| double | getMinKnot () |
| Returns the knot minimal value. | |
| double[] | getKnots () |
| Returns an array containing the knot vector \((t_0, t_{m-1})\). | |
| BSpline | derivativeBSpline () |
| Returns the derivative B-spline object of the current variable. | |
| BSpline | derivativeBSpline (int i) |
| Returns the \(i\)th derivative B-spline object of the current variable; \(i\) must be less than the degree of the original B-spline. | |
| double | evaluate (final double u) |
| Returns the value of the function evaluated at \(x\). | |
| double | integral (double a, double b) |
| Computes (or estimates) the integral of the function over the interval \([a,
b]\). | |
| 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 \(n\)th derivative of the function at point x. | |
Static Public Member Functions | |
| static BSpline | createInterpBSpline (double[] x, double[] y, int degree) |
| Returns a B-spline curve of degree degree interpolating the. | |
| static BSpline | createApproxBSpline (double[] x, double[] y, int degree, int hp1) |
| Returns a B-spline curve of degree degree smoothing \((x_i, y_i)\), for \(i=0,…,n\) points. | |
Represents a B-spline with control points at \((X_i, Y_i)\).
Let
\(\mathbf{P_i}=(X_i, Y_i)\), for \(i=0,…,n-1\), be a control point and let \(t_j\), for \(j=0,…,m-1\) be a knot. A B-spline [41] of degree \(p=m-n-1\) is a parametric curve defined as
\[ \mathbf{P(t)} = \sum_{i=0}^{n-1} N_{i, p}(t) \mathbf{P_i},\mbox{ for }t_p\le t\le t_{m-p-1}. \]
Here,
\begin{align*} N_{i, p}(t) & = \frac{t-t_i}{t_{i+p} - t_i}N_{i, p-1}(t) + \frac{t_{i+p+1} - t}{t_{i+p+1} - t_{i+1}}N_{i+1, p-1}(t) \\ N_{i, 0}(t) & = \left\{ \begin{array}{ll} 1 & \mbox{ for }t_i\le t\le t_{i+1}, \\ 0 \mbox{ elsewhere}. \end{array} \right. \end{align*}
This class provides methods to evaluate \(\mathbf{P(t)}=(X(t), Y(t))\) at any value of \(t\), for a B-spline of any degree \(p\ge1\). Note that the evaluate(double) 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^*)\).
Definition at line 62 of file BSpline.java.
| umontreal.ssj.functionfit.BSpline.BSpline | ( | final double[] | x, |
| final double[] | y, | ||
| final int | degree ) |
Constructs a new uniform B-spline of degree degree with control points at (x[i], y[i]).
The knots of the resulting B-spline are set uniformly from x[0] to x[n-1].
| x | the values of \(X\). |
| y | the values of \(Y\). |
| degree | the degree of the B-spline. |
Definition at line 86 of file BSpline.java.
| umontreal.ssj.functionfit.BSpline.BSpline | ( | final double[] | x, |
| final double[] | y, | ||
| final double[] | knots ) |
Constructs a new uniform B-spline with control points at (x[i], y[i]), and knot vector given by the array knots.
| x | the values of \(X\). |
| y | the values of \(Y\). |
| knots | the knots of the B-spline. |
Definition at line 103 of file BSpline.java.
|
static |
Returns a B-spline curve of degree degree smoothing \((x_i, y_i)\), for \(i=0,…,n\) points.
The precision depends on the parameter \(hp1\): \(1 \le\mathtt{degree} \le hp1<n\), which represents the number of control points used by the new B-spline curve, minimizing the quadratic error
\[ L = \sum_{i=0}^n\left( \frac{Y_i - S_i(X_i)}{W_i}\right)^2. \]
This method uses the uniformly spaced method for interpolating points with a B-spline curve and a uniformed clamped knot vector, as described in http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/.
| x | the values of \(X\). |
| y | the values of \(Y\). |
| degree | the degree of the B-spline. |
| hp1 | the desired number of control points. |
Definition at line 234 of file BSpline.java.
|
static |
Returns a B-spline curve of degree degree interpolating the.
\((x_i, y_i)\) points [41] . This method uses the uniformly spaced method for interpolating points with a B-spline curve, and a uniformed clamped knot vector, as described in http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/.
| x | the values of \(X\). |
| y | the values of \(Y\). |
| degree | the degree of the B-spline. |
Definition at line 172 of file BSpline.java.
| double umontreal.ssj.functionfit.BSpline.derivative | ( | double | x | ) |
Computes (or estimates) the first derivative of the function at point x.
| x | the point to evaluate the derivative to. |
Implements umontreal.ssj.functions.MathFunctionWithFirstDerivative.
Definition at line 388 of file BSpline.java.
| double umontreal.ssj.functionfit.BSpline.derivative | ( | double | x, |
| int | n ) |
Computes (or estimates) the \(n\)th derivative of the function at point x.
For \(n=0\), this returns the result of umontreal.ssj.functions.MathFunction.evaluate(double).
| x | the point to evaluate the derivate to. |
| n | the order of the derivative. |
| IllegalArgumentException | if `n` is negative or 0. |
Implements umontreal.ssj.functions.MathFunctionWithDerivative.
Definition at line 392 of file BSpline.java.
| BSpline umontreal.ssj.functionfit.BSpline.derivativeBSpline | ( | ) |
Returns the derivative B-spline object of the current variable.
Using this function and the returned object, instead of the derivative method, is strongly recommended if one wants to compute many derivative values.
Definition at line 322 of file BSpline.java.
| BSpline umontreal.ssj.functionfit.BSpline.derivativeBSpline | ( | int | i | ) |
Returns the \(i\)th derivative B-spline object of the current variable; \(i\) must be less than the degree of the original B-spline.
Using this function and the returned object, instead of the derivative method, is strongly recommended if one wants to compute many derivative values.
| i | the degree of the derivative. |
Definition at line 363 of file BSpline.java.
| double umontreal.ssj.functionfit.BSpline.evaluate | ( | final double | x | ) |
Returns the value of the function evaluated at \(x\).
| x | value at which the function is evaluated |
Implements umontreal.ssj.functions.MathFunction.
Definition at line 372 of file BSpline.java.
| double[] umontreal.ssj.functionfit.BSpline.getKnots | ( | ) |
Returns an array containing the knot vector \((t_0, t_{m-1})\).
Definition at line 156 of file BSpline.java.
| double umontreal.ssj.functionfit.BSpline.getMaxKnot | ( | ) |
Returns the knot maximal value.
Definition at line 138 of file BSpline.java.
| double umontreal.ssj.functionfit.BSpline.getMinKnot | ( | ) |
Returns the knot minimal value.
Definition at line 147 of file BSpline.java.
| double[] umontreal.ssj.functionfit.BSpline.getX | ( | ) |
Returns the \(X_i\) coordinates for this spline.
Definition at line 120 of file BSpline.java.
| double[] umontreal.ssj.functionfit.BSpline.getY | ( | ) |
Returns the \(Y_i\) coordinates for this spline.
Definition at line 129 of file BSpline.java.
| double umontreal.ssj.functionfit.BSpline.integral | ( | double | a, |
| double | b ) |
Computes (or estimates) the integral of the function over the interval \([a, b]\).
| a | the starting point of the interval. |
| b | the ending point of the interval. |
Implements umontreal.ssj.functions.MathFunctionWithIntegral.
Definition at line 384 of file BSpline.java.