util.gen
Class CubicSpline

java.lang.Object
  extended byutil.gen.CubicSpline

public class CubicSpline
extends java.lang.Object

For calculating cubic splines of incremental data, interpolation, from http://www.frank-buss.de/CubicSpline.java


Constructor Summary
CubicSpline(double[] y)
          The constructor calculates the second derivatives of the interpolating function at the tabulated points xi, with xi = (i, y[i]).
 
Method Summary
 double interpolate(int startIndex, double dist2NextPoint)
          Returns a cubic-spline interpolated value y for the point between point (n, y[n]) and (n+1, y[n+1), with t ranging from 0 for (n, y[n]) to 1 for (n+1, y[n+1]).
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubicSpline

public CubicSpline(double[] y)
The constructor calculates the second derivatives of the interpolating function at the tabulated points xi, with xi = (i, y[i]). Based on numerical recipes in C, http://www.library.cornell.edu/nr/bookcpdf/c3-3.pdf .

Parameters:
y - Array of y coordinates for cubic-spline interpolation.
Method Detail

interpolate

public double interpolate(int startIndex,
                          double dist2NextPoint)
Returns a cubic-spline interpolated value y for the point between point (n, y[n]) and (n+1, y[n+1), with t ranging from 0 for (n, y[n]) to 1 for (n+1, y[n+1]).

Parameters:
startIndex - The start index/ point.
dist2NextPoint - The distance to the next point (0..1).
Returns:
A cubic-spline interpolated y value.

main

public static void main(java.lang.String[] args)