public class FreePathInterpolator extends BaseInterpolator
Path
is the input value and the output is the y coordinate of the line at that point.
This means that the Path must conform to a function y = f(x)
.
The Path
must not have gaps in the x direction and must not
loop back on itself such that there can be two points sharing the same x coordinate.
It is alright to have a disjoint line in the vertical direction:
Path path = new Path(); path.lineTo(0.25f, 0.25f); path.moveTo(0.25f, 0.5f); path.lineTo(1f, 1f);
Constructor and Description |
---|
FreePathInterpolator(Path path)
Create an interpolator for an arbitrary
Path . |
Modifier and Type | Method and Description |
---|---|
float |
getArcLength()
Returns the arclength of the path we are interpolating.
|
float |
getInterpolation(float t)
Using the line in the Path in this interpolator that can be described as
y = f(x) , finds the y coordinate of the line given t
as the x coordinate. |
float |
getX(float y)
Finds the x that provides the given
y = f(x) . |
getChangingConfiguration
public FreePathInterpolator(Path path)
Path
.path
- The Path
to use to make the line representing the interpolator.public float getInterpolation(float t)
y = f(x)
, finds the y coordinate of the line given t
as the x coordinate.t
- Treated as the x coordinate along the line.t
.TimeInterpolator.getInterpolation(float)
public float getX(float y)
y = f(x)
.y
- a value from (0,1) that is in this path.public float getArcLength()