public class PathInterpolator extends Object implements Interpolator
| Modifier and Type | Field and Description |
|---|---|
protected List<Double> |
myXVals
A sorted List of the points' x-values.
|
| Constructor and Description |
|---|
PathInterpolator(InterpolatorFactory factory)
Creates an empty AnimationInterpolater with an Interpolator from the
given InterpolatorFactory.
|
| Modifier and Type | Method and Description |
|---|---|
Point2D |
addPoint(double x,
double y)
Adds a point with the given coordinates.
|
void |
addPoints(int i,
List<Point2D> points)
Adds points with the given coordinates.
|
void |
addPoints(List<Point2D> points)
Adds given points.
|
void |
clear()
Removes all control points from the MotionPath.
|
boolean |
equals(Object obj) |
List<Point2D> |
getControlPoints()
Returns the control points for the interpolator.
|
List<Point2D> |
getInterpolatedPoints()
Returns the positions interpolated from the control points.
|
InterpolatorFactory |
getInterpolatorFactory()
Returns the factory for the underlying Interpolator.
|
org.jflux.api.common.rk.config.VersionProperty |
getInterpolatorVersion()
Returns the version of the underlying Interpolator.
|
int |
hashCode() |
Point2D |
insertPoint(int i,
double x,
double y)
Adds a point with the given coordinates.
|
protected boolean |
interpolate()
Iterates through the underlying interpolated points
and ensures that the time is always increasing.
|
boolean |
interpolationChanged()
Returns if the control points have been modified and needs to be
interpolated.
|
protected void |
moveControlPoint(int i,
double x,
double y)
WARNING! This method bypasses the sorting! You must ensure all points
are sorted after using this method.
|
boolean |
overlaps(PathInterpolator b)
Checks if values of another interpolator overlap this one.
|
Point2D |
removePoint(int i)
Remove point at given index.
|
void |
removePoint(Point2D p)
Removes given point.
|
void |
setInterpolatorFactory(InterpolatorFactory factory)
Changes underlying interpolator to the given type.
|
Point2D |
setPoint(int i,
double x,
double y)
Updates the point at index i.
|
boolean |
touchesControlPoints() |
public PathInterpolator(InterpolatorFactory factory)
factory - the given InterpolatorFactorpublic void setInterpolatorFactory(InterpolatorFactory factory)
factory - a factory for creating the underlying interpolatorpublic InterpolatorFactory getInterpolatorFactory()
public Point2D addPoint(double x, double y)
addPoint in interface Interpolatorx - time in millisecondsy - servo position (0 <= y <= 1)public void addPoints(List<Point2D> points)
addPoints in interface Interpolatorpoints - points to addpublic Point2D setPoint(int i, double x, double y)
setPoint in interface Interpolatori - index of point to updatex - new x valuey - new y valuepublic void removePoint(Point2D p)
removePoint in interface Interpolatorp - point to removepublic Point2D removePoint(int i)
removePoint in interface Interpolatori - index of point to removepublic List<Point2D> getControlPoints()
getControlPoints in interface Interpolatorpublic List<Point2D> getInterpolatedPoints()
getInterpolatedPoints in interface Interpolatorprotected boolean interpolate()
public boolean interpolationChanged()
interpolationChanged in interface Interpolatorpublic boolean overlaps(PathInterpolator b)
b - interpolator to checkpublic Point2D insertPoint(int i, double x, double y)
insertPoint in interface Interpolatori - ignoredx - time in millisecondsy - servo position (0 <= y <= 1)public void addPoints(int i,
List<Point2D> points)
addPoints in interface Interpolatori - ignoredpoints - List of Points to addpublic void clear()
clear in interface Interpolatorprotected void moveControlPoint(int i,
double x,
double y)
i - x - y - public org.jflux.api.common.rk.config.VersionProperty getInterpolatorVersion()
getInterpolatorVersion in interface Interpolatorpublic boolean touchesControlPoints()
touchesControlPoints in interface InterpolatorCopyright © 2011-2016. All Rights Reserved.