lt.monarch.math
Class CubicSpline

java.lang.Object
  extended by lt.monarch.math.CubicSpline
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, AbstractSpline

public class CubicSpline
extends java.lang.Object
implements AbstractSpline

Cubic spline implementation. Data can not have adjacent identical values (x[i]!=x[i-1]).

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  Orientation orientation
          HORIZONTAL - from right to left; VERTICAL - from bottom to top;
protected  double[] xa
           
protected  Point2D[] xy
           
protected  double[] y2
           
protected  double[] ya
           
 
Constructor Summary
Constructor and Description
CubicSpline()
           
 
Method Summary
Modifier and Type Method and Description
 AbstractSpline clone()
          Clones the object
 Point2D[] getLines()
          Gets spline line array
 Orientation getOrientation()
           
 double[] interpolateYAt(double x)
          Interpolates x value and returns the Y values array
 boolean isXValueInRange(double x)
           
 boolean isYValueInRange(double y)
           
 void setData(double[] x, double[] y, int n, int step)
          Sets spline data
 void setOrientation(Orientation orientation)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xa

protected double[] xa

ya

protected double[] ya

y2

protected double[] y2

xy

protected Point2D[] xy

orientation

protected Orientation orientation
HORIZONTAL - from right to left; VERTICAL - from bottom to top;

Constructor Detail

CubicSpline

public CubicSpline()
Method Detail

setData

public void setData(double[] x,
                    double[] y,
                    int n,
                    int step)
Description copied from interface: AbstractSpline
Sets spline data

Specified by:
setData in interface AbstractSpline
Parameters:
x - normalized x values
y - normalized y values
n - point count
step - step count

getLines

public Point2D[] getLines()
Description copied from interface: AbstractSpline
Gets spline line array

Specified by:
getLines in interface AbstractSpline
Returns:
spline line array

interpolateYAt

public double[] interpolateYAt(double x)
Description copied from interface: AbstractSpline
Interpolates x value and returns the Y values array

Specified by:
interpolateYAt in interface AbstractSpline
Parameters:
x - x value, where to interpolate
Returns:
array of y values

isYValueInRange

public boolean isYValueInRange(double y)

isXValueInRange

public boolean isXValueInRange(double x)

getOrientation

public Orientation getOrientation()

setOrientation

public void setOrientation(Orientation orientation)

clone

public AbstractSpline clone()
                     throws java.lang.CloneNotSupportedException
Description copied from interface: AbstractSpline
Clones the object

Specified by:
clone in interface AbstractSpline
Overrides:
clone in class java.lang.Object
Returns:
object clone (new instance)
Throws:
java.lang.CloneNotSupportedException - exception if not possible to clone