Class AbstractSplineInterpolator

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

public abstract class AbstractSplineInterpolator extends Interpolator
AbstractSplineInterpolator.
Author:
Werner Randelshofer
  • Constructor Details

    • 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 Details

    • 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 Point2D.Float getXY(float t, 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.
    • updateFractions

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