Class jovial.slotCar.track.TrackPosition
All Packages Class Hierarchy This Package Previous Next Index
Class jovial.slotCar.track.TrackPosition
java.lang.Object
|
+----jovial.slotCar.track.TrackPosition
- public class TrackPosition
- extends Object
Represents a position on a Track. Understands how to move along a track,
and can deliver an x,y position, and the orientation of an object moving
along the track.
- See Also:
- Track, TrackSegment
-
TrackPosition(int, TrackSegment)
- Initialize a new position
-
distance()
-
-
height()
-
-
moveBy(double)
- Move our position
-
orientation()
- Report the orientation of an object going down the track at the
position we represent
-
position()
- Report the x,y position we represent
-
setCurrSegment(TrackSegment)
- Change the current track segment.
-
setDistance(double)
- Change our distance along segment.
-
setOrientation(double)
- Change the value of orientation.
-
setPosition(Point)
- Change our position.
-
slot()
-
TrackPosition
public TrackPosition(int slot,
TrackSegment start)
- Initialize a new position
- Parameters:
- slot - The slot we're in. Either 0 or 1.
- start - The piece of track we start on
moveBy
public void moveBy(double distance)
- Move our position
- Parameters:
- dist - Distance to move (in pixels)
position
public Point position()
- Report the x,y position we represent
- Returns:
- the position
orientation
public double orientation()
- Report the orientation of an object going down the track at the
position we represent
- Returns:
- The angle. 0 is 3 o'clock, increasing angles go CCW
height
public int height()
- Returns:
- the height associated with our position
slot
public int slot()
- Returns:
- The slot we represent, 0 or 1
distance
protected double distance()
- Returns:
- the distance along the current segment
setDistance
protected void setDistance(double dist)
- Change our distance along segment. Should only be called by
TrackSegment.
- Parameters:
- dist - The new distance along our current track segment
setOrientation
protected void setOrientation(double o)
- Change the value of orientation. Should only be called by
TrackSegment.
- Parameters:
- o - The new orientation
setPosition
protected void setPosition(Point p)
- Change our position. Should only be called by TrackSegment.
- Parameters:
- p - The new position
setCurrSegment
protected void setCurrSegment(TrackSegment s)
- Change the current track segment. Should only be called by
TrackSegment.
- Parameters:
- s - The new segment
All Packages Class Hierarchy This Package Previous Next Index