Package toxi.math
Class DecimatedInterpolation
java.lang.Object
toxi.math.DecimatedInterpolation
- All Implemented Interfaces:
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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDecimatedInterpolation(int steps) DecimatedInterpolation(int steps, InterpolateStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptiondoubleinterpolate(double a, double b, double f) Implements an interpolation equation using double precision values.floatinterpolate(float a, float b, float f) Implements an interpolation equation using float values.
-
Field Details
-
numSteps
public int numSteps -
strategy
-
-
Constructor Details
-
DecimatedInterpolation
public DecimatedInterpolation(int steps) -
DecimatedInterpolation
-
-
Method Details
-
interpolate
public double interpolate(double a, double b, double f) Description copied from interface:InterpolateStrategyImplements an interpolation equation using double precision values.- Specified by:
interpolatein interfaceInterpolateStrategy- Parameters:
a- current valueb- target valuef- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-
interpolate
public float interpolate(float a, float b, float f) Description copied from interface:InterpolateStrategyImplements an interpolation equation using float values.- Specified by:
interpolatein interfaceInterpolateStrategy- Parameters:
a- current valueb- target valuef- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-