jbotrace.base
Class Track

java.lang.Object
  |
  +--jbotrace.base.Track

public class Track
extends java.lang.Object

Description: Track contains the information about a track and it's parts.


Constructor Summary
Track()
          Build a new track with empty lists for cars and parts
 
Method Summary
 void addSegment(Segment segment)
          Adds a part to the track
 Vec[] getBoundingBox()
          Returns a box bounding the whole track
 double getDistanceFromStart(int segmentNum, Vec pos)
          Returns the distance of the given point from the start line.
 Line getFinishLine()
          Returns the finish line
 double getHeight()
          Returns the height of the track calculate from boundingBox
 double getLength()
          Returns the length of the track
 double getLength(int firstSegment, int lastSegment)
          Returns the length of the given range of segments
 Segment getSegment(int num)
          Returns the segment specified by the number
 java.util.List getSegmentList()
          Returns the list of segments
 Segment getSegmentNextTo(Vec pos)
          Returns the segment next to the given position
 int getSegmentNumNextTo(Vec position)
          Returns the number of the nearest segment to the given position
 double getWidth()
          Returns the width of the track calculate from boundingBox
 boolean isOnSegment(Vec pos, int segmentNum)
          Returns true if the given position is on the specified segment
 boolean isOnTrack(Vec pos)
          Returns true if the given position is on a part of the track and false otherwise.
 void moveToOrigin()
          Moves the track to let the boundingBox begin in 0, 0
 void setFinishFraction(double finishFraction)
          Sets the fraction of 1st segment to finish line
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Track

public Track()
Build a new track with empty lists for cars and parts

Method Detail

addSegment

public void addSegment(Segment segment)
Adds a part to the track


getBoundingBox

public Vec[] getBoundingBox()
Returns a box bounding the whole track


getDistanceFromStart

public double getDistanceFromStart(int segmentNum,
                                   Vec pos)
Returns the distance of the given point from the start line. Gives wrong values, if the given position is not on a given curve segment!!


getLength

public double getLength()
Returns the length of the track


getLength

public double getLength(int firstSegment,
                        int lastSegment)
Returns the length of the given range of segments


getSegmentNextTo

public Segment getSegmentNextTo(Vec pos)
Returns the segment next to the given position


getSegmentNumNextTo

public int getSegmentNumNextTo(Vec position)
Returns the number of the nearest segment to the given position


getSegment

public Segment getSegment(int num)
Returns the segment specified by the number


getSegmentList

public java.util.List getSegmentList()
Returns the list of segments


isOnSegment

public boolean isOnSegment(Vec pos,
                           int segmentNum)
Returns true if the given position is on the specified segment


isOnTrack

public boolean isOnTrack(Vec pos)
Returns true if the given position is on a part of the track and false otherwise.


getFinishLine

public Line getFinishLine()
Returns the finish line


getHeight

public double getHeight()
Returns the height of the track calculate from boundingBox


getWidth

public double getWidth()
Returns the width of the track calculate from boundingBox


moveToOrigin

public void moveToOrigin()
Moves the track to let the boundingBox begin in 0, 0


setFinishFraction

public void setFinishFraction(double finishFraction)
Sets the fraction of 1st segment to finish line