Class Spline2D
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
Spline2DInterpolate,Spline2DLeastSquares
The simplest method of obtaining multivariate interpolation and approximation functions is to take univariate methods and form a multivariate method via tensor products. In the case of two-dimensional spline interpolation, the derivation proceeds as follows: Let \(t_x\) be a knot sequence for splines of order \(k_x\), and \(t_y\) be a knot sequence for splines of order \(k_y\). Let \(N_x + k_x\) be the length of \(t_x\), and \(N_y + k_x\) be the length of \(t_y\). Then, the tensor-product spline has the following form: $$\sum\limits_{m = 0}^{N_y - 1} {\sum\limits_{n = 0}^{N_x - 1} {c_{nm} B_{n,k_x ,t_x } \left( x \right)B_{m,k_y ,t_y } \left( y \right)} }$$ Given two sets of points $$\left\{ {x_i } \right\}_{i = 1}^{N_x }$$ and $$\left\{ {y_j } \right\}_{j = 1}^{N_y }$$ for which the corresponding univariate interpolation problem can be solved, the tensor-product interpolation problem finds the coefficients \(c_{nm}\) so that $$\sum\limits_{m = 0}^{N_y - 1} {\sum\limits_{n = 0}^{N_x - 1} {c_{nm} B_{n,k_x ,t_x } \left( {x_i } \right)B_{m,k_y ,t_y } \left( {y_j } \right)} } = f_{ij}$$ This problem can be solved efficiently by repeatedly solving univariate interpolation problems as described in de Boor (1978, p. 347).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]derivative(double[] xVec, double[] yVec, int xPartial, int yPartial) Returns the values of the partial derivative of the tensor-product spline of an array of points.doublederivative(double x, double y, int xPartial, int yPartial) Returns the value of the partial derivative of the tensor-product spline at the point (x, y).double[][]Returns the coefficients for the tensor-product spline.double[]Returns the knot sequences in the x-direction.double[]Returns the knot sequences in the y-direction.doubleintegral(double a, double b, double c, double d) Returns the value of an integral of a tensor-product spline on a rectangular domain.double[][]value(double[] xVec, double[] yVec) Returns the values of the tensor-product spline of an array of points.doublevalue(double x, double y) Returns the value of the tensor-product spline at the point (x, y).
-
Constructor Details
-
Spline2D
public Spline2D()
-
-
Method Details
-
getXKnots
public double[] getXKnots()Returns the knot sequences in the x-direction.- Returns:
- a
doublearray containing the knot sequences of the spline in the x-direction.
-
getYKnots
public double[] getYKnots()Returns the knot sequences in the y-direction.- Returns:
- a
doublearray containing the knot sequences of the spline in the y-direction.
-
getCoefficients
public double[][] getCoefficients()Returns the coefficients for the tensor-product spline.- Returns:
- a
doublematrix containing the coefficients.
-
value
public double value(double x, double y) Returns the value of the tensor-product spline at the point (x, y).- Parameters:
x- adoublescalar specifying the x-coordinate of the evaluation point for the tensor-product spline.y- adoublescalar specifying the y-coordinate of the evaluation point for the tensor-product spline.- Returns:
- a
doublescalar containing the value of the tensor-product spline.
-
derivative
public double derivative(double x, double y, int xPartial, int yPartial) Returns the value of the partial derivative of the tensor-product spline at the point (x, y).- Parameters:
x- adoublescalar specifying the x-coordinate of the evaluation point for the tensor-product spline.y- adoublescalar specifying the y-coordinate of the evaluation point for the tensor-product spline.xPartial- anintscalar specifying the x-partial derivative.yPartial- anintscalar specifying the y-partial derivative.- Returns:
- a
doublescalar containing the value of the partial derivative $$\frac{{\partial ^{i + j} s}}{{\partial ^i x\,\,\partial ^j y}}$$ where i =xPartialand j =yPartial, at (x, y).
-
value
public double[][] value(double[] xVec, double[] yVec) Returns the values of the tensor-product spline of an array of points.- Parameters:
xVec- adoublearray specifying the x-coordinates at which the spline is to be evaluated.yVec- adoublearray specifying the y-coordinates at which the spline is to be evaluated.- Returns:
- a
doublematrix containing the values evaluated.
-
derivative
public double[][] derivative(double[] xVec, double[] yVec, int xPartial, int yPartial) Returns the values of the partial derivative of the tensor-product spline of an array of points.- Parameters:
xVec- adoublearray specifying the x-coordinates at which the spline is to be evaluated.yVec- adoublearray specifying the y-coordinates at which the spline is to be evaluated.xPartial- anintscalar specifying the x-partial derivative.yPartial- anintscalar specifying the y-partial derivative.- Returns:
- a
doublematrix containing the values of the partial derivatives $$\frac{{\partial ^{i + j} s}}{{\partial ^i x\,\,\partial ^j y}}$$ where i =xPartialand j =yPartial, at each (x, y).
-
integral
public double integral(double a, double b, double c, double d) Returns the value of an integral of a tensor-product spline on a rectangular domain.If s is the spline, then the
integralmethod returns $$\int_a^b {\int_c^d {s\left( {x,y} \right)} } dydx$$ This method uses the (univariate integration) identity (22) in de Boor (1978, p. 151) $$\int_{t_0 }^x {\sum\limits_{i = 0}^{n - 1} {\alpha _i } } B_{i,k} \left( \tau \right)d\tau = \sum\limits_{i = 0}^{r - 1} {\left[ {\sum\limits_{j = 0}^i {\alpha _j \frac{{t_{j + k} - t_j }}{k}} } \right]} B_{i,k + 1} \left( x \right)$$ where \(t_0 \le x \le t_r\).It assumes (for all knot sequences) that the first and last k knots are stacked, that is, \(t_0 = \ldots = t_{k-1}\) and \(t_n = \ldots = t_{n+k-1}\) , where k is the order of the spline in the x or y direction.
- Parameters:
a- adoublespecifying the lower limit for the first variable of the tensor-product spline.b- adoublespecifying the upper limit for the first variable of the tensor-product spline.c- adoublespecifying the lower limit for the second variable of the tensor-product spline.d- adoublespecifying the upper limit for the second variable of the tensor-product spline.- Returns:
- a
double, the integral of the tensor-product spline over the rectangle[a, b]by[c, d].
-