meshi.util.mathTools
Class Spline2D
java.lang.Object
meshi.util.mathTools.Spline2D
public class Spline2D
- extends java.lang.Object
The class creates a 2D cubic spline object from given parameters, and allows for the
calculation of the spline value and derivative at any given point inside the spline
intervals.
After the method calc(x,y) is run, the public fields s s_tag_x and s_tag_y are updated:
s - the spline value at x,y.
s_tag_x - the spline first derivative at x,y with respect to x.
s_tag_y - the spline first derivative at x,y with respect to y.
Note:
1) calc will not work for values outside the range [break 1 , break n].
2) The class operates on any set of break points. However, if the break points are
evenly spaced (in both axes) then the calculation of calc(x,y) will be faster.
3) See the constructor documention for more details on how to set up the class properly.
|
Constructor Summary |
Spline2D(java.lang.String dataLine)
The constructor can create a specific spline object from a string with the format (Note that following
6 lines should appear in the SAME line, but I broke it for clarity). |
Spline2D(java.util.StringTokenizer st)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
breaksX
private double[] breaksX
breaksY
private double[] breaksY
coefs
private double[][][] coefs
evenBreaks
private boolean evenBreaks
breakIntervalX
private double breakIntervalX
breakIntervalY
private double breakIntervalY
s
public double s
s_tag_x
public double s_tag_x
s_tag_y
public double s_tag_y
Spline2D
public Spline2D(java.lang.String dataLine)
- The constructor can create a specific spline object from a string with the format (Note that following
6 lines should appear in the SAME line, but I broke it for clarity). Just to make it perfectly clear,
this object is created from ONE very long test-line:
{Number of breaks in X axis} {Number of breaks in Y axis} {break 1X} ... {break nX} {break 1Y} ... {break nY}
{square(1,1) constant coef} {square(1,1) X coef} {square(1,1) X^2 coef} {square(1,1) X^3 coefficient}
{square(1,1) Y coef} {square(1,1) Y*X coef} {square(1,1) Y*X^2 coef} {square(1,1) Y*X^3 coefficient}
{square(1,1) Y^2 coef} {square(1,1) Y^2*X coef} {square(1,1) Y^2*X^2 coef} {square(1,1) Y^2*X^3 coefficient}
{square(1,1) Y^3 coef} {square(1,1) Y^3*X coef} {square(1,1) Y^3*X^2 coef} {square(1,1) Y^3*X^3 coefficient}
{square(1,2) constant coef} {square(1,2) X coef} ...
Note:
1) There is an alternative constructor that requires a tokenizer of a string with
the above format.
2) The breaks must increase monotonicly.
3) The spline coefficients are not verified. Therefore, derivability is obtained only if the
coefficients are of a derivable spline.
4) In order to have numerical stability, the relative precision of the values in the
dataLine must be at least 1e-10.
Spline2D
public Spline2D(java.util.StringTokenizer st)
calc
public final void calc(double x,
double y)
calcEvenBreaks
private final void calcEvenBreaks(double x,
double y)
testForEvenBreaks
private boolean testForEvenBreaks(double[] vec)