toxi.math
Class DecimatedInterpolation

java.lang.Object
  extended by toxi.math.DecimatedInterpolation
All Implemented Interfaces:
InterpolateStrategy

public class DecimatedInterpolation
extends java.lang.Object
implements InterpolateStrategy

Delivers a number of decimated/stepped values for a given interval. E.g. by using 5 steps the interpolation factor is decimated to: 0, 20, 40, 60, 80 and 100%. By default LinearInterpolation is used, however any other InterpolateStrategy can be specified via the constructor.


Field Summary
 int numSteps
           
 InterpolateStrategy strategy
           
 
Constructor Summary
DecimatedInterpolation(int steps)
           
DecimatedInterpolation(int steps, InterpolateStrategy strategy)
           
 
Method Summary
 float interpolate(float a, float b, float f)
          Implements an interpolation equation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numSteps

public int numSteps

strategy

public InterpolateStrategy strategy
Constructor Detail

DecimatedInterpolation

public DecimatedInterpolation(int steps)

DecimatedInterpolation

public DecimatedInterpolation(int steps,
                              InterpolateStrategy strategy)
Method Detail

interpolate

public float interpolate(float a,
                         float b,
                         float f)
Description copied from interface: InterpolateStrategy
Implements an interpolation equation.

Specified by:
interpolate in interface InterpolateStrategy
Parameters:
a - current value
b - target value
f - normalized interpolation factor (0.0 .. 1.0)
Returns:
interpolated value