- All Implemented Interfaces:
DoubleBinaryOperator,RealValuedFunctTwoOps,RealValuedFunctVAOps,VADomainOps
This interpolator computes values by using the following expression: $$ \sum_{|\lambda| = 3} \beta_\lambda B^3_\lambda(u,v,w) $$ where u + v + w = 1, λ= (λ1,λ2,λ3) represent three indices, each in the range [0,3], and |λ| is defined as λ1+λ2+λ3. $B^3_\lambda (u,v,w)$ is a Bernstein polynomial of degree 3 over a triangle specified by barycentric coordinates (u, v, w), and is defined by the equation $$ B^3_\lambda (u,v,w) = \frac{3!}{\lambda_1!\lambda_2!\lambda_3!} u^{\lambda_1}v^{\lambda_2}w^{\lambda_3} $$
By convention, we will use (u,v) as independent variables and set w = 1 - (u + v). The control points are located as follows:
(0,1)
030
*
/ \
/ \
/ \
/ \
021 *---------* 120
/ \ / \
[u = 0] / \ / \ [w = 0]
(v axis) / \ / \
/ 111\ / \
012 *---------*---------* 210
/ \ / \ / \
/ \ / \ / \
/ \ / \ / \
/ \ / \ / \
*---------*---------*---------*
003 102 201 300
(0,0) (1,0)
[v = 0]
(u axis)
The ordered pairs (0,0), (0,1), and (1,0) give the values of
(u,v) at the vertices of the triangular region, and the sequences
of three numbers denote the λ indices labeling each
control point. On the boundaries, either u, v, or w is zero.
In many of the methods described below, we use the notation (x, y)
instead of (u, w). Some of the constructors allow a range for x
and a range for y to be specified. in this case
u = (x - xmin) / (xmax - xmin)The default values are xmin = 0, xmax = 1, ymin = 0, and ymax = 1. For the defaults, u = x and v = y.
v = (y - ymin) / (ymax - ymin)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.math.RealValuedFunctionVA
RealValuedFunctionVA.Linear -
Constructor Summary
ConstructorsConstructorDescriptionBicubicTriangleInterp(double[] inits) Constructor using an array.BicubicTriangleInterp(double xmin, double xmax, double ymin, double ymax, double[] inits) Constructor using an array and specifying the min/max values this function's domain.BicubicTriangleInterp(double p003, double p012, double p021, double p030, double p102, double p111, double p120, double p201, double p210, double p300) Constructor using explicit arguments.BicubicTriangleInterp(double xmin, double xmax, double ymin, double ymax, double p003, double p012, double p021, double p030, double p102, double p111, double p120, double p201, double p210, double p300) Constructor using explicit arguments and the minimum and maximum values of this functions domain. -
Method Summary
Modifier and TypeMethodDescriptiondoublederiv11At(double x, double y) Evaluate the partial derivative $ \frac{\partial^2 f}{\partial x_1^2}$ for a function f(x1,x2).doublederiv12At(double x, double y) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ for a function f(x1,x2).doublederiv1At(double x, double y) Evaluate the partial derivative $\frac{\partial f}{\partial x_1}$ for a function f(x1, x2).doublederiv21At(double x, double y) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ for a function f(x1,x2).doublederiv22At(double x, double y) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2^2}$ for a function f(x1,x2).doublederiv2At(double x, double y) Evaluate the partial derivative $\frac{\partial f}{\partial x_2}$ for a function f(x1,x2).doubleGet the maximum value of the first argument in the domain of the function.doubleGet the maximum value of the second argument in the domain of the function.doubleGet the minimum value of the first argument in the domain of the function.doubleGet the minimum value of the second argument in the domain of the function.booleanisInDomain(double x, double y) Determine if a point (x, y) is within the domain of a real-valued function of two arguments.doubleuFromXY(double x, double y) Get the normalized barycentric coordinate u given the coordinates (x, y).doublevalueAt(double x, double y) Call the function.doublevFromXY(double x, double y) Get the normalized barycentric coordinate v given the coordinates (x, y).doublewFromXY(double x, double y) Get the normalized barycentric coordinate w given the coordinates (x, y).doublexForZeroW(double y) Get the value of first argument to the function represented by this interpolator corresponding to a particular value of the second argument when w is zero.doublexFromUV(double u, double v) Get the X coordinate given the barycentric coordinates u and v.doublexFromVW(double v, double w) Get the X coordinate given the barycentric coordinates v and w.doublexFromWU(double w, double u) Get the X coordinate given the barycentric coordinates w and u.doubleyForZeroW(double x) Get the value of second argument to the function represented by this interpolator corresponding to a particular value of the first argument when w is zero.doubleyFromUV(double u, double v) Get the Y coordinate given the barycentric coordinates u and v.doubleyFromVW(double v, double w) Get the Y coordinate given the barycentric coordinates v and w.doubleyFromWU(double w, double u) Get the Y coordinate given the barycentric coordinates w and u.Methods inherited from class org.bzdev.math.RealValuedFunctionTwo
deriv, deriv1, deriv11, deriv12, deriv2, deriv21, deriv22, derivAt, domainMax1Closed, domainMax2Closed, domainMaxClosed, domainMin1Closed, domainMin2Closed, domainMinClosed, getDomainMax, getDomainMin, isInDomain, secondDeriv, secondDerivAt, valueAtMethods inherited from class org.bzdev.math.RealValuedFunctionVA
jacobian, jacobian, maxArgLength, minArgLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bzdev.math.RealValuedFunctTwoOps
applyAsDouble, maxArgLength, minArgLength
-
Constructor Details
-
BicubicTriangleInterp
public BicubicTriangleInterp(double[] inits) Constructor using an array. The array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order.- Parameters:
inits- the control points
-
BicubicTriangleInterp
public BicubicTriangleInterp(double xmin, double xmax, double ymin, double ymax, double[] inits) Constructor using an array and specifying the min/max values this function's domain. The array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order.- Parameters:
xmin- the bound on the interpolation region, corresponding to u = 0, for the first argument of fxmax- the bound on the interpolation region, corresponding to u = 1, for the first argument of fymin- the bound on the interpolation region, corresponding to v = 0, for the second argument of fymax- the bound on the interpolation region, corresponding to v = 1, for the second argument of finits- the control points
-
BicubicTriangleInterp
public BicubicTriangleInterp(double p003, double p012, double p021, double p030, double p102, double p111, double p120, double p201, double p210, double p300) Constructor using explicit arguments. The arguments provide the control points.- Parameters:
p003- the control point indexed by λ=(0,0,3)p012- the control point indexed by λ=(0,1,2)p021- the control point indexed by λ=(0,2,1)p030- the control point indexed by λ=(0,3,0)p102- the control point indexed by λ=(1,0,2)p111- the control point indexed by λ=(1,1,1)p120- the control point indexed by λ=(1,2,0)p201- the control point indexed by λ=(2,0,1)p210- the control point indexed by λ=(2,1,0)p300- the control point indexed by λ=(3,0,0)
-
BicubicTriangleInterp
public BicubicTriangleInterp(double xmin, double xmax, double ymin, double ymax, double p003, double p012, double p021, double p030, double p102, double p111, double p120, double p201, double p210, double p300) Constructor using explicit arguments and the minimum and maximum values of this functions domain. The arguments provide the control points.- Parameters:
xmin- the lower bound of the interpolation region for the first argument of fxmax- the upper bound of the interpolation region for the first argument of fymin- the lower bound of the interpolation region for the second argument of fymax- the upper bound of the interpolation region for the second argument of fp003- the control point indexed by λ=(0,0,3)p012- the control point indexed by λ=(0,1,2)p021- the control point indexed by λ=(0,2,1)p030- the control point indexed by λ=(0,3,0)p102- the control point indexed by λ=(1,0,2)p111- the control point indexed by λ=(1,1,1)p120- the control point indexed by λ=(1,2,0)p201- the control point indexed by λ=(2,0,1)p210- the control point indexed by λ=(2,1,0)p300- the control point indexed by λ=(3,0,0)
-
-
Method Details
-
getDomainMin1
public double getDomainMin1()Description copied from class:RealValuedFunctionTwoGet the minimum value of the first argument in the domain of the function.- Overrides:
getDomainMin1in classRealValuedFunctionTwo- Returns:
- the minimum value
-
getDomainMax1
public double getDomainMax1()Description copied from class:RealValuedFunctionTwoGet the maximum value of the first argument in the domain of the function.- Overrides:
getDomainMax1in classRealValuedFunctionTwo- Returns:
- the maximum value
-
getDomainMin2
public double getDomainMin2()Description copied from class:RealValuedFunctionTwoGet the minimum value of the second argument in the domain of the function.- Overrides:
getDomainMin2in classRealValuedFunctionTwo- Returns:
- the minimum value
-
getDomainMax2
public double getDomainMax2()Description copied from class:RealValuedFunctionTwoGet the maximum value of the second argument in the domain of the function.- Overrides:
getDomainMax2in classRealValuedFunctionTwo- Returns:
- the maximum value
-
isInDomain
Description copied from class:RealValuedFunctionTwoDetermine if a point (x, y) is within the domain of a real-valued function of two arguments.The default behavior of this method assumes the domain is a rectangular region and uses the methods
RealValuedFunctionTwo.getDomainMin1(),RealValuedFunctionTwo.getDomainMin2(),RealValuedFunctionTwo.getDomainMax1(),RealValuedFunctionTwo.getDomainMax2()RealValuedFunctionTwo.domainMin1Closed(),RealValuedFunctionTwo.domainMin2Closed(),RealValuedFunctionTwo.domainMax1Closed(), andRealValuedFunctionTwo.domainMax2Closed()to determine if the arguments represent a point in the functions domain. If the domain is not rectangular with each side either in or not in the domain, then this method must be overridden. If it is not possible with a reasonable amount of computation to determine that a point is in the domain, an UnsupportedOperationException may be thrown. If this exception is thrown, it should be thrown regardless of the arguments.- Overrides:
isInDomainin classRealValuedFunctionTwo- Parameters:
x- the 1st coordinatey- the 2nd coordinate- Returns:
- true if the point (x, y) is in this function's domain; false otherwise
- Throws:
UnsupportedOperationException- domain membership could not be determined.
-
uFromXY
public double uFromXY(double x, double y) Get the normalized barycentric coordinate u given the coordinates (x, y). The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
x- the first argument for this interpolator's functiony- the second argument for this interpolator's function- Returns:
- the value of u
-
vFromXY
public double vFromXY(double x, double y) Get the normalized barycentric coordinate v given the coordinates (x, y). The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
x- the first argument for this interpolator's functiony- the second argument for this interpolator's function- Returns:
- the value of v
-
wFromXY
public double wFromXY(double x, double y) Get the normalized barycentric coordinate w given the coordinates (x, y). The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
x- the first argument for this interpolator's functiony- the second argument for this interpolator's function- Returns:
- the value of w
-
xFromUV
public double xFromUV(double u, double v) Get the X coordinate given the barycentric coordinates u and v. The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
u- the barycentric coordinate uv- the barycentric coordinate v- Returns:
- the corresponding X coordinate
-
xFromWU
public double xFromWU(double w, double u) Get the X coordinate given the barycentric coordinates w and u. The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
w- the barycentric coordinate wu- the barycentric coordinate u- Returns:
- the corresponding X coordinate
-
xFromVW
public double xFromVW(double v, double w) Get the X coordinate given the barycentric coordinates v and w. The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
v- the barycentric coordinate vw- the barycentric coordinate w- Returns:
- the corresponding X coordinate
-
yFromUV
public double yFromUV(double u, double v) Get the Y coordinate given the barycentric coordinates u and v. The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
u- the barycentric coordinate uv- the barycentric coordinate v- Returns:
- the corresponding Y coordinate
-
yFromWU
public double yFromWU(double w, double u) Get the Y coordinate given the barycentric coordinates w and u. The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
w- the barycentric coordinate wu- the barycentric coordinate u- Returns:
- the corresponding Y coordinate
-
yFromVW
public double yFromVW(double v, double w) Get the Y coordinate given the barycentric coordinates v and w. The barycentric coordinates are denoted as (u, v, w) with the constraint that u + v + w = 1 and with each coordinate in the range [0, 1].- Parameters:
v- the barycentric coordinate vw- the barycentric coordinate w- Returns:
- the corresponding Y coordinate
-
yForZeroW
public double yForZeroW(double x) Get the value of second argument to the function represented by this interpolator corresponding to a particular value of the first argument when w is zero.- Parameters:
x- the value of the first argument- Returns:
- the value of the second argument
-
xForZeroW
public double xForZeroW(double y) Get the value of first argument to the function represented by this interpolator corresponding to a particular value of the second argument when w is zero.- Parameters:
y- the value of the second argument- Returns:
- the value of the first argument
-
valueAt
public double valueAt(double x, double y) Description copied from class:RealValuedFunctionTwoCall the function.- Specified by:
valueAtin interfaceRealValuedFunctTwoOps- Overrides:
valueAtin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the function for the given arguments
-
deriv1At
public double deriv1At(double x, double y) Description copied from class:RealValuedFunctionTwoEvaluate the partial derivative $\frac{\partial f}{\partial x_1}$ for a function f(x1, x2).- Overrides:
deriv1Atin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the partial derivative for the given argument
-
deriv2At
public double deriv2At(double x, double y) Description copied from class:RealValuedFunctionTwoEvaluate the partial derivative $\frac{\partial f}{\partial x_2}$ for a function f(x1,x2).- Overrides:
deriv2Atin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the partial derivative for the given argument
-
deriv11At
public double deriv11At(double x, double y) Description copied from class:RealValuedFunctionTwoEvaluate the partial derivative $ \frac{\partial^2 f}{\partial x_1^2}$ for a function f(x1,x2).- Overrides:
deriv11Atin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the partial derivative for the given argument
-
deriv12At
public double deriv12At(double x, double y) Description copied from class:RealValuedFunctionTwoEvaluate the partial derivative $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ for a function f(x1,x2).- Overrides:
deriv12Atin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the partial derivative for the given argument
-
deriv21At
public double deriv21At(double x, double y) Description copied from class:RealValuedFunctionTwoEvaluate the partial derivative $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ for a function f(x1,x2).- Overrides:
deriv21Atin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the partial derivative for the given argument
-
deriv22At
public double deriv22At(double x, double y) Description copied from class:RealValuedFunctionTwoEvaluate the partial derivative $\frac{\partial^2 f}{\partial x_2^2}$ for a function f(x1,x2).- Overrides:
deriv22Atin classRealValuedFunctionTwo- Parameters:
x- the function's first argumenty- the function's second argument- Returns:
- the value of the partial derivative for the given argument
-