Package toxi.math
Class BezierInterpolation
java.lang.Object
toxi.math.BezierInterpolation
- All Implemented Interfaces:
InterpolateStrategy
Bezier curve interpolation with configurable coefficients. The curve
parameters need to be normalized offsets relative to the start and end values
passed to the
interpolate(float, float, float)
method, but can
exceed the normal 0 .. 1.0 interval. Use symmetrical offsets to create a
symmetrical curve, e.g. this will create a curve with 2 dips reaching the
minimum and maximum values at 25% and 75% of the interval...
BezierInterpolation b=new BezierInterpolation(3,-3);
BezierInterpolation b=new BezierInterpolation(1f/3,-1f/3);
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
interpolate
(double a, double b, double t) Implements an interpolation equation using double precision values.float
interpolate
(float a, float b, float t) Implements an interpolation equation using float values.void
setCoefficients
(float a, float b)
-
Field Details
-
c1
public float c1 -
c2
public float c2
-
-
Constructor Details
-
BezierInterpolation
public BezierInterpolation(float h1, float h2)
-
-
Method Details
-
interpolate
public double interpolate(double a, double b, double t) Description copied from interface:InterpolateStrategy
Implements an interpolation equation using double precision values.- Specified by:
interpolate
in interfaceInterpolateStrategy
- Parameters:
a
- current valueb
- target valuet
- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-
interpolate
public float interpolate(float a, float b, float t) Description copied from interface:InterpolateStrategy
Implements an interpolation equation using float values.- Specified by:
interpolate
in interfaceInterpolateStrategy
- Parameters:
a
- current valueb
- target valuet
- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-
setCoefficients
public void setCoefficients(float a, float b)
-