org.robokind.api.animation
Class MotionPath

java.lang.Object
  extended by org.robokind.api.animation.PathInterpolator
      extended by org.robokind.api.animation.MotionPath
All Implemented Interfaces:
Interpolator

public class MotionPath
extends PathInterpolator

An extended PathInterpolator which can generate a CompiledPath from the interpolated positions.

Author:
Matthew Stevenson

Field Summary
 
Fields inherited from class org.robokind.api.animation.PathInterpolator
myXVals
 
Constructor Summary
MotionPath()
          Creates an empty MotionPath with the default Interpolator.
MotionPath(InterpolatorFactory factory)
          Creates a MotionPath with an Interpolator from the given InterpolatorFactory.
 
Method Summary
 MotionPath clone()
          Returns a deep copy of the Channel.
 boolean compilePath(long stepLength)
          Generates and caches a CompiledPath for the complete MotionPath.
 CompiledPath compilePath(long start, long end, long stepLength)
          Creates a CompiledPath from the interpolated points.
 CompiledPath getCompiledPath(long stepLength)
          Gets a CompiledPath of the full MotionPath.
 String getName()
          Returns the MotionPath's name.
 Long getStartTime()
          Returns the start time
 Long getStopTime()
          Returns the stop time
protected  boolean interpolate()
          Calls interpolate for PathInterpolator.
 void setName(String name)
          Sets the name of the MotionPath
 void setStartTime(Long time)
          Sets the start time
 void setStopTime(Long time)
          Sets the stop time
 
Methods inherited from class org.robokind.api.animation.PathInterpolator
addPoint, addPoints, addPoints, clear, getControlPoints, getInterpolatedPoints, getInterpolatorFactory, getInterpolatorVersion, insertPoint, interpolationChanged, moveControlPoint, overlaps, removePoint, removePoint, setInterpolatorFactory, setPoint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MotionPath

public MotionPath()
Creates an empty MotionPath with the default Interpolator.


MotionPath

public MotionPath(InterpolatorFactory factory)
Creates a MotionPath with an Interpolator from the given InterpolatorFactory.

Parameters:
factory - the InterpolatorFactory from which a Motion Path is to be created
Method Detail

getName

public String getName()
Returns the MotionPath's name. By default this is null.

Returns:
the MotionPath's name

setName

public void setName(String name)
Sets the name of the MotionPath

Parameters:
name - the name to set

setStartTime

public void setStartTime(Long time)
Sets the start time

Parameters:
time - start time

getStartTime

public Long getStartTime()
Returns the start time

Returns:
start time

setStopTime

public void setStopTime(Long time)
Sets the stop time

Parameters:
time - stop time

getStopTime

public Long getStopTime()
Returns the stop time

Returns:
stop time

getCompiledPath

public CompiledPath getCompiledPath(long stepLength)
Gets a CompiledPath of the full MotionPath. Returns a cached path if available, otherwise generates and caches the path. The cached path is cleared when the MotionPath is modified.

Parameters:
stepLength - milliseconds between positions
Returns:
CompiledPath of the full MotionPath

compilePath

public boolean compilePath(long stepLength)
Generates and caches a CompiledPath for the complete MotionPath.

Parameters:
stepLength - milliseconds between positions
Returns:
returns true if cache is changed, otherwise false

compilePath

public CompiledPath compilePath(long start,
                                long end,
                                long stepLength)
Creates a CompiledPath from the interpolated points.

Parameters:
start - path start time
end - path end time
stepLength - milliseconds between positions
Returns:
CompiledPath from this MotionPath's interpolated points

clone

public MotionPath clone()
Returns a deep copy of the Channel.

Overrides:
clone in class Object
Returns:
a deep copy of the Channel

interpolate

protected boolean interpolate()
Calls interpolate for PathInterpolator. If there is a change, the cached CompiledPath is cleared.

Overrides:
interpolate in class PathInterpolator
Returns:
true if there was an interpolation change, otherwise false


Copyright © 2011. All Rights Reserved.