jbotrace.base
Class Curve

java.lang.Object
  |
  +--jbotrace.base.Segment
        |
        +--jbotrace.base.Curve

public class Curve
extends Segment

Description: Curve is a subclass of part and descriptes a curve in the track.


Field Summary
 
Fields inherited from class jbotrace.base.Segment
CURVE, STRAIGHT
 
Constructor Summary
Curve(Vec center, double radius, double startWidth, double endWidth, double startAng, double endAng)
          Construcst a new curce with the given parameters.
 
Method Summary
 Vec[] getBoundingBox()
          Returns the box bounding of the segment
 Vec getCenter()
          Returns the center of the curve
 double getDistanceToEnd(Vec pos)
          Returns the distance to the end of the curve from the given position
 double getDistanceToLeft(Vec pos)
          Returns the distance to the left side of the curve at the given position
 double getDistanceToMiddle(Vec pos)
          Returns the distance to the middle of the curve
 double getDistanceToRight(Vec pos)
          Returns the distance to the right side of the curve at the given position
 double getDistanceToSide(Vec pos)
          Returns the distance of the given point to the side of the curve or the maximum value for double, if the point is not beside the curve
 double getEndAng()
          Returns the angle at the end of the curve
 double getEndWidth()
          Returns the width at the end of the curve
 double getLength()
          Calculates and returns the length of the curve
 Vec getMiddle()
          Returns the middle of the represented part of the track.
 double getRadius()
          Returns the radius of the curve
 double getStartAng()
          Returns the angle at the beginning of the curve
 double getStartWidth()
          Returns the width at the beginning of the curve
 int getType()
          Returns the type number of the segment.
 double getWidth(Vec pos)
          Return the width of the curve at the given position
 boolean isOnSegment(Vec pos)
          Returns true of the given position is on the part and false otherwise.
 void move(Vec moveVec)
          Moves the segment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Curve

public Curve(Vec center,
             double radius,
             double startWidth,
             double endWidth,
             double startAng,
             double endAng)
Construcst a new curce with the given parameters.

Method Detail

getBoundingBox

public Vec[] getBoundingBox()
Returns the box bounding of the segment

Specified by:
getBoundingBox in class Segment

getCenter

public Vec getCenter()
Returns the center of the curve


getDistanceToEnd

public double getDistanceToEnd(Vec pos)
Returns the distance to the end of the curve from the given position

Specified by:
getDistanceToEnd in class Segment

getDistanceToLeft

public double getDistanceToLeft(Vec pos)
Returns the distance to the left side of the curve at the given position

Specified by:
getDistanceToLeft in class Segment

getDistanceToMiddle

public double getDistanceToMiddle(Vec pos)
Returns the distance to the middle of the curve

Specified by:
getDistanceToMiddle in class Segment

getDistanceToRight

public double getDistanceToRight(Vec pos)
Returns the distance to the right side of the curve at the given position

Specified by:
getDistanceToRight in class Segment

getDistanceToSide

public double getDistanceToSide(Vec pos)
Returns the distance of the given point to the side of the curve or the maximum value for double, if the point is not beside the curve

Specified by:
getDistanceToSide in class Segment

getEndAng

public double getEndAng()
Returns the angle at the end of the curve


getEndWidth

public double getEndWidth()
Returns the width at the end of the curve

Specified by:
getEndWidth in class Segment

getLength

public double getLength()
Calculates and returns the length of the curve

Specified by:
getLength in class Segment

getMiddle

public Vec getMiddle()
Returns the middle of the represented part of the track.

Specified by:
getMiddle in class Segment

getRadius

public double getRadius()
Returns the radius of the curve

Specified by:
getRadius in class Segment

getStartAng

public double getStartAng()
Returns the angle at the beginning of the curve


getStartWidth

public double getStartWidth()
Returns the width at the beginning of the curve

Specified by:
getStartWidth in class Segment

getType

public int getType()
Returns the type number of the segment.

Specified by:
getType in class Segment

getWidth

public double getWidth(Vec pos)
Return the width of the curve at the given position


isOnSegment

public boolean isOnSegment(Vec pos)
Returns true of the given position is on the part and false otherwise.

Specified by:
isOnSegment in class Segment

move

public void move(Vec moveVec)
Moves the segment

Overrides:
move in class Segment