|
||||||||||
| 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. |
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. |
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected List<Double> myXVals
| Constructor Detail |
|---|
public PathInterpolator(InterpolatorFactory factory)
factory - the given InterpolatorFactor| Method 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 Interpolatorx - time in millisecondsy - servo position (0 <= y <= 1)
public void addPoints(List<Point2D> points)
addPoints in interface Interpolatorpoints - points to add
public Point2D setPoint(int i,
double x,
double y)
setPoint in interface Interpolatori - index of point to updatex - new x valuey - new y value
public void removePoint(Point2D p)
removePoint in interface Interpolatorp - point to removepublic Point2D removePoint(int i)
removePoint in interface Interpolatori - index of point to remove
public 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 check
public 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 Interpolator
protected void moveControlPoint(int i,
double x,
double y)
i - x - y - public VersionProperty getInterpolatorVersion()
getInterpolatorVersion in interface Interpolatorpublic boolean touchesControlPoints()
touchesControlPoints in interface Interpolatorpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||