|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.robokind.api.animation.PathInterpolator
public class PathInterpolator
Wraps an Interpolator to provide certain guarantees for animating. The PathInterpolator ensures that all Control points are ordered by X-values. It also ensures that the X-values of interpolated points are non-decreasing. The underlying Interpolator type can be changed using either the Class or full class name of the desired interpolator.
Field Summary | |
---|---|
protected List<Double> |
myXVals
A sorted List of the points' x-values. |
Constructor Summary | |
---|---|
PathInterpolator(InterpolatorFactory factory)
Creates an empty AnimationInterpolater with an Interpolator from the given InterpolatorFactory. |
Method Summary | |
---|---|
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. |
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.robokind.api.common.config.VersionProperty |
getInterpolatorVersion()
Returns the version of the underlying Interpolator. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<Double> myXVals
Constructor Detail |
---|
public PathInterpolator(InterpolatorFactory factory)
factory
- the given InterpolatorFactorMethod Detail |
---|
public void setInterpolatorFactory(InterpolatorFactory factory)
factory
- a factory for creating the underlying interpolatorpublic InterpolatorFactory getInterpolatorFactory()
public Point2D addPoint(double x, double y)
addPoint
in interface Interpolator
x
- time in millisecondsy
- servo position (0 <= y <= 1)
public void addPoints(List<Point2D> points)
addPoints
in interface Interpolator
points
- points to addpublic Point2D setPoint(int i, double x, double y)
setPoint
in interface Interpolator
i
- index of point to updatex
- new x valuey
- new y value
public void removePoint(Point2D p)
removePoint
in interface Interpolator
p
- point to removepublic Point2D removePoint(int i)
removePoint
in interface Interpolator
i
- index of point to remove
public List<Point2D> getControlPoints()
getControlPoints
in interface Interpolator
public List<Point2D> getInterpolatedPoints()
getInterpolatedPoints
in interface Interpolator
protected boolean interpolate()
public boolean interpolationChanged()
interpolationChanged
in interface Interpolator
public boolean overlaps(PathInterpolator b)
b
- interpolator to check
public Point2D insertPoint(int i, double x, double y)
insertPoint
in interface Interpolator
i
- ignoredx
- time in millisecondsy
- servo position (0 <= y <= 1)
public void addPoints(int i, List<Point2D> points)
addPoints
in interface Interpolator
i
- ignoredpoints
- List of Points to addpublic void clear()
clear
in interface Interpolator
protected void moveControlPoint(int i, double x, double y)
i
- x
- y
- public org.robokind.api.common.config.VersionProperty getInterpolatorVersion()
getInterpolatorVersion
in interface Interpolator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |