Class Trajectory
java.lang.Object
me.wobblyyyy.pathfinder.trajectory.Trajectory
public class Trajectory
extends java.lang.Object
Resource class for storing trajectory segments in a single compact form.
A trajectory is composed of an
Arrayable
of trajectory segments.
Interpolation and following of trajectories and trajectory segments is
to be handled elsewhere.- Since:
- 0.4.0
- Author:
- Colin Robertson
-
Field Summary
Fields Modifier and Type Field Description private int
currentSegment
The segment that's currently being worked with.private me.wobblyyyy.edt.DynamicArray<Segment>
segments
The internal container for each of the trajectory's segments. -
Constructor Summary
Constructors Constructor Description Trajectory(me.wobblyyyy.edt.Arrayable<Segment> segments)
Create a newTrajectory
based on anArrayable
container of individual trajectory segments. -
Method Summary
Modifier and Type Method Description void
completeSegment()
"Complete" the current segment by incrementing the current segment counter by one.Segment
getCurrentSegment()
Get the currently-active segment.Segment
getNextSegment()
Get the next segment.me.wobblyyyy.edt.DynamicArray<Segment>
getSegments()
Get aDynamicArray
of each of the trajectory's segments.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
segments
The internal container for each of the trajectory's segments. -
currentSegment
private int currentSegmentThe segment that's currently being worked with.
-
-
Constructor Details
-
Trajectory
Create a newTrajectory
based on anArrayable
container of individual trajectory segments.- Parameters:
segments
- anArrayable
containing each of the individual component trajectory segments.
-
-
Method Details
-
getSegments
Get aDynamicArray
of each of the trajectory's segments.- Returns:
- all of the trajectory's segments.
-
getCurrentSegment
Get the currently-active segment.- Returns:
- the currently-active segment.
-
getNextSegment
Get the next segment. If there is no next segment, return null instead. In addition to getting the next segment, this method will increment the current pointer.- Returns:
- the next segment (if it exists) or null (if it doesn't).
-
completeSegment
public void completeSegment()"Complete" the current segment by incrementing the current segment counter by one. Throw an ArrayIndexOutOfBoundsException if the requested index increment is out of the trajectory's array bounds.
-