com.yobotics.simulationconstructionset.util.splines
Class QuinticSplineInterpolator

java.lang.Object
  extended by com.yobotics.simulationconstructionset.util.splines.QuinticSplineInterpolator

public class QuinticSplineInterpolator
extends java.lang.Object


Constructor Summary
QuinticSplineInterpolator(java.lang.String name, int pointsToInterpolate, int numberOfSplines, YoVariableRegistry parentRegistry)
          Create a new QuinticSplineInterpolator
 
Method Summary
 void compute(double xx, int numberOfDerivatives, double[][] resultToPack)
          Calculates the y coordinate of the spline corresponding to the x coordinate resultToPack is a 2-dimensional array with resultToPack[spline][derivative], where the 0th derivative is the position, 1st velocity etc...
 void determineCoefficients(int splineIndex, double[] yIn, double v0, double vf, double a0, double af)
          Determines the coefficients for one spline
 void initialize(double[] xIn)
          Initializes the spline
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuinticSplineInterpolator

public QuinticSplineInterpolator(java.lang.String name,
                                 int pointsToInterpolate,
                                 int numberOfSplines,
                                 YoVariableRegistry parentRegistry)
Create a new QuinticSplineInterpolator

Parameters:
name - Name of the YoVariableRegistry
pointsToInterpolate - Number of points the spline has to pass (>= 2)
numberOfSplines - Number of splines it creates that have the same x coordinates for the points to interpolate
Method Detail

initialize

public void initialize(double[] xIn)
Initializes the spline

Parameters:
xIn - Array (length = pointsToInterpolate) with the x coordinates of the points to interpolate

determineCoefficients

public void determineCoefficients(int splineIndex,
                                  double[] yIn,
                                  double v0,
                                  double vf,
                                  double a0,
                                  double af)
Determines the coefficients for one spline

Parameters:
splineIndex - Index for the spline ( 0 <= splineIndex < pointsToInterpolate)
yIn - Array (length = pointsToInterpolate) with the y coordinates of the points to interpolate
v0 - Initial velocity
vf - Final velocity
a0 - Initial acceleration
af - Final acceleration

compute

public void compute(double xx,
                    int numberOfDerivatives,
                    double[][] resultToPack)
Calculates the y coordinate of the spline corresponding to the x coordinate resultToPack is a 2-dimensional array with resultToPack[spline][derivative], where the 0th derivative is the position, 1st velocity etc...

Parameters:
xx - x coordinate to calculate
numberOfDerivatives - Number of derivatives to calculate ( <= 5 )
resultToPack - array[numberOfSplines][numberOfDerivatives+1]