lt.monarch.math
Class CubicSplineReal

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

public class CubicSplineReal
extends java.lang.Object
implements AbstractSpline

Real cubic spline implementation

See Also:
Serialized Form

Constructor Summary
Constructor and Description
CubicSplineReal()
          Empty spline constructor
CubicSplineReal(double[] x, double[] y, int n)
          Real Cubic Spline constructor Default step number is 12
CubicSplineReal(double[] x, double[] y, int n, int steps)
          Real Cubic Spline constructor
 
Method Summary
Modifier and Type Method and Description
 AbstractSpline clone()
          Clones the object
 Point2D[] getLines()
          Gets spline line array
 double[] interpolateYAt(double x)
          Interpolates x value and returns the Y values array
 void setData(double[] x, double[] y, int n, int steps)
          Sets spline data
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubicSplineReal

public CubicSplineReal(double[] x,
                       double[] y,
                       int n,
                       int steps)
                throws java.lang.IllegalArgumentException
Real Cubic Spline constructor

Parameters:
x - X values array
y - Y values array
n - number of points
steps - number to how many steps one line between two points should be splitted up.
Throws:
java.lang.IllegalArgumentException

CubicSplineReal

public CubicSplineReal()
Empty spline constructor


CubicSplineReal

public CubicSplineReal(double[] x,
                       double[] y,
                       int n)
                throws java.lang.IllegalArgumentException
Real Cubic Spline constructor Default step number is 12

Parameters:
x - X values array
y - Y values array
n - number of points
Throws:
java.lang.IllegalArgumentException
Method Detail

setData

public void setData(double[] x,
                    double[] y,
                    int n,
                    int steps)
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
steps - 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

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