hmi.math
Class CubicSpline

java.lang.Object
  extended by hmi.math.CubicSpline

public class CubicSpline
extends Object

A C2 continuous spline that goes through all control points Assumptions: The spline is not closed y''(0)=0 y''(n-1)=0 The point distribution is uniform

Author:
welberge

Field Summary
private  float[] a
           
private  float[] as
           
private  float[] b
           
private  float[] bs
           
private  float[] c
           
private  float[] cs
           
private  float[] d
           
private  float[] D
           
private  float[] ds
           
private  int n
           
private  float[] y
           
 
Constructor Summary
CubicSpline(float[] points)
          Constructor The interpolated 2D point are: (0, points[0]), (1, points[1]), ..., (n-1, points[n-1])
 
Method Summary
 float eval(float time)
          Evaluates the spline
 float evalDiff(float time)
          Evaluates the first derivative of the spline
 float evalDiff(float time, float h)
          Evaluates the first derivative of the spline
 float evalDiff2(float time)
          Evaluates the 2nd derivative of the spline
 float evalDiff2(float time, float h)
          Evaluates the 2nd derivative of the spline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a

private float[] a

b

private float[] b

c

private float[] c

d

private float[] d

y

private float[] y

D

private float[] D

as

private float[] as

bs

private float[] bs

cs

private float[] cs

ds

private float[] ds

n

private int n
Constructor Detail

CubicSpline

public CubicSpline(float[] points)
Constructor The interpolated 2D point are: (0, points[0]), (1, points[1]), ..., (n-1, points[n-1])

Parameters:
points - interpolation points
Method Detail

eval

public float eval(float time)
Evaluates the spline

Parameters:
time - time, scaled for length, 0<=time<=1
Returns:
the value at time

evalDiff

public float evalDiff(float time)
Evaluates the first derivative of the spline

Parameters:
time - time, scaled for length, 0<=time<=1
Returns:
the value of the first derivative of the spline at time

evalDiff

public float evalDiff(float time,
                      float h)
Evaluates the first derivative of the spline

Parameters:
time - time, scaled for length, 0<=time<=1
h - timestep between two points in the spline
Returns:
the value of the first derivative of the spline at time

evalDiff2

public float evalDiff2(float time)
Evaluates the 2nd derivative of the spline

Parameters:
time - time, scaled for length, 0<=time<=1
Returns:
the value of the 2nd derivative of the spline at time

evalDiff2

public float evalDiff2(float time,
                       float h)
Evaluates the 2nd derivative of the spline

Parameters:
time - time, scaled for length, 0<=time<=1
Returns:
the value of the 2nd derivative of the spline at time