Copyright 2012-04-26 Werner Randelshofer

org.monte.media
Class AbstractSplineInterpolator

java.lang.Object
  extended by org.monte.media.Interpolator
      extended by org.monte.media.AbstractSplineInterpolator
Direct Known Subclasses:
BezierInterpolator, SplineInterpolator

public abstract class AbstractSplineInterpolator
extends Interpolator

AbstractSplineInterpolator.

Version:
1.0 2012-01-25 Created.
Author:
Werner Randelshofer

Constructor Summary
AbstractSplineInterpolator()
           
AbstractSplineInterpolator(boolean reverse)
          Creates a new interpolator which interpolates into the specified direction within one second.
AbstractSplineInterpolator(float startValue, float endValue)
          Creates a new interpolator which interpolates from the specified start value to the specified end value within one second.
AbstractSplineInterpolator(float startValue, float endValue, long timespan)
          Creates a new interpolator which interpolates from the specified start value to the specified end value within the specified timespan.
AbstractSplineInterpolator(long timespan)
          Creates a new interpolator which interpolates from 0 to 1 within the specified timespan.
 
Method Summary
 float getFraction(float t)
          Evaluates the spline function at time t, and clamps the result value between 0 and 1.
protected abstract  java.awt.geom.Point2D.Float getXY(float t, java.awt.geom.Point2D.Float p)
          Evaluates the spline function at curve parameter time t.
protected abstract  float getY(float t)
          Evaluates the spline function at curve parameter time t.
protected  void update(float fraction)
          This method is empty.
protected  void updateFractions(int N)
          This method must be called by the subclass in the constructor.
 
Methods inherited from class org.monte.media.Interpolator
finish, initialize, interpolate, isElapsed, isFinished, isSequential, replaces, setTimespan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSplineInterpolator

public AbstractSplineInterpolator()

AbstractSplineInterpolator

public AbstractSplineInterpolator(long timespan)
Creates a new interpolator which interpolates from 0 to 1 within the specified timespan.


AbstractSplineInterpolator

public AbstractSplineInterpolator(boolean reverse)
Creates a new interpolator which interpolates into the specified direction within one second.

Parameters:
reverse - Set this to true, if you want to interpolate from 1 to 0 instead of from 0 to 1.

AbstractSplineInterpolator

public AbstractSplineInterpolator(float startValue,
                                  float endValue)
Creates a new interpolator which interpolates from the specified start value to the specified end value within one second.

Parameters:
startValue - A value between 0 and 1.
endValue - A value between 0 and 1.

AbstractSplineInterpolator

public AbstractSplineInterpolator(float startValue,
                                  float endValue,
                                  long timespan)
Creates a new interpolator which interpolates from the specified start value to the specified end value within the specified timespan.

Parameters:
startValue - A value between 0 and 1.
endValue - A value between 0 and 1.
timespan - A timespan in milliseconds.
Method Detail

updateFractions

protected void updateFractions(int N)
This method must be called by the subclass in the constructor.

Parameters:
N -

getFraction

public final float getFraction(float t)
Evaluates the spline function at time t, and clamps the result value between 0 and 1.

Overrides:
getFraction in class Interpolator
Parameters:
t - The linear fraction between 0 and 1.
Returns:
A computed fraction between 0 and 1.

getXY

protected abstract java.awt.geom.Point2D.Float getXY(float t,
                                                     java.awt.geom.Point2D.Float p)
Evaluates the spline function at curve parameter time t.


getY

protected abstract float getY(float t)
Evaluates the spline function at curve parameter time t.


update

protected void update(float fraction)
This method is empty. Subclasses don't have to call super.update(fraction).

Specified by:
update in class Interpolator
Parameters:
fraction - An interpolated fraction between 0 and 1.

Copyright 2012-04-26 Werner Randelshofer