Package toxi.math
Class CircularInterpolation
java.lang.Object
toxi.math.CircularInterpolation
- All Implemented Interfaces:
InterpolateStrategy
Implementation of the circular interpolation function.
i = a-(b-a) * (sqrt(1 - (1 - f) * (1 - f) ))
-
Constructor Summary
ConstructorDescriptionCircularInterpolation
(boolean isFlipped) The interpolation slope can be flipped to have its steepest ascent towards the end value, rather than at the beginning in the default configuration. -
Method Summary
Modifier and TypeMethodDescriptiondouble
interpolate
(double a, double b, double f) Implements an interpolation equation using double precision values.float
interpolate
(float a, float b, float f) Implements an interpolation equation using float values.void
setFlipped
(boolean isFlipped)
-
Constructor Details
-
CircularInterpolation
public CircularInterpolation() -
CircularInterpolation
public CircularInterpolation(boolean isFlipped) The interpolation slope can be flipped to have its steepest ascent towards the end value, rather than at the beginning in the default configuration.- Parameters:
isFlipped
- true, if slope is inverted
-
-
Method Details
-
interpolate
public double interpolate(double a, double b, double f) Description copied from interface:InterpolateStrategy
Implements an interpolation equation using double precision values.- Specified by:
interpolate
in 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:InterpolateStrategy
Implements an interpolation equation using float values.- Specified by:
interpolate
in interfaceInterpolateStrategy
- Parameters:
a
- current valueb
- target valuef
- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-
setFlipped
public void setFlipped(boolean isFlipped)
-