public class LineSegmentLane extends AbstractLane
Constructor and Description |
---|
LineSegmentLane(double x1,
double y1,
double x2,
double y2,
double width,
double speedLimit)
Constructs a line-segment lane using two sets of coordinates.
|
LineSegmentLane(Line2D line,
double width,
double speedLimit)
Constructs a line-segment lane using a Line.
|
LineSegmentLane(Point2D p1,
Point2D p2,
double width,
double speedLimit)
Constructs a line-segment lane using two points.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point2D pos)
Whether or not the provided point can be considered "in" this Lane.
|
double |
distanceAlongLane(Point2D pos)
Get the distance along the Lane from the start of the Lane to the Point
in the center of the Lane nearest the given Point.
|
Point2D |
getEndPoint()
Get the ending point of the Lane.
|
double |
getHeadingAtNormalizedDistance(double normalizedDistance)
Get the heading of the Lane at a particular normalized distance from the
start of the Lane.
|
double |
getInitialHeading()
Get the heading of this Lane at its starting point.
|
Point2D |
getLeadPoint(Point2D pos,
double leadDist)
/**
Get a point further down the Lane from the nearest point to the given
position.
|
double |
getLength()
Get the length of this Lane.
|
Point2D |
getPointAtNormalizedDistance(double normalizedDistance)
Get a point in the center of the lane at a particular normalized distance
from the start of the Lane.
|
Shape |
getShape()
Get a Shape describing this Lane, including its width.
|
Shape |
getShape(double startFraction,
double endFraction)
Get a Shape describing an interval of this lane, using normalized
distances.
|
Point2D |
getStartPoint()
Get the starting point of the Lane.
|
double |
getTerminalHeading()
Get the heading of this Lane at its ending point.
|
double |
getWidth()
Get the width of this Lane, in meters.
|
Point2D |
intersectionPoint(Line2D l)
The point at which the the given Line intersects the center of this Lane.
|
Shape |
leftBorder()
Get a Shape representing the left border of this Lane.
|
Point2D |
leftIntersectionPoint(Line2D l)
The point at which the the given Line intersects the left border of this
Lane.
|
double |
nearestDistance(Point2D pos)
Get the distance from a point to the center of the Lane.
|
Point2D |
nearestPoint(Point2D p)
Get the point in the center of the Lane nearest to the provided point.
|
double |
normalizedDistance(double distance)
Get the normalized distance at the distance from the starting point.
|
double |
normalizedDistanceAlongLane(Point2D pos)
Get the normalized distance to the point in the center of the lane
nearest the provided point.
|
double |
remainingDistanceAlongLane(Point2D pos)
Get the amount of distance left in this Lane from the point on the Lane
nearest to the given point.
|
Shape |
rightBorder()
Get a Shape representing the right border of this Lane.
|
Point2D |
rightIntersectionPoint(Line2D l)
The point at which the the given Line intersects the right border of this
Lane.
|
getId, getLaneIM, getLeftNeighbor, getNextLane, getPrevLane, getRightNeighbor, getSpeedLimit, hasLeftNeighbor, hasNextLane, hasPrevLane, hasRightNeighbor, setId, setLeftNeighbor, setNextLane, setPrevLane, setRightNeighbor
public LineSegmentLane(Line2D line, double width, double speedLimit)
line
- the line segment representing the center of the Lanewidth
- the width of the Lane, in metersspeedLimit
- the speed limit of the Lane, in meters per secondpublic LineSegmentLane(Point2D p1, Point2D p2, double width, double speedLimit)
p1
- the starting Point of the Lanep2
- the ending Point of the Lanewidth
- the width of the Lane, in metersspeedLimit
- the speed limit of the Lane, in meters per secondpublic LineSegmentLane(double x1, double y1, double x2, double y2, double width, double speedLimit)
x1
- the x coordinate of the starting point of the Laney1
- the y coordinate of the starting point of the Lanex2
- the x coordinate of the ending point of the Laney2
- the y coordinate of the ending point of the Lanewidth
- the width of the Lane, in metersspeedLimit
- the speed limit of the Lane, in meters per secondpublic double getLength()
getLength
in interface Lane
getLength
in class AbstractLane
public Point2D getStartPoint()
getStartPoint
in interface Lane
getStartPoint
in class AbstractLane
public Point2D getEndPoint()
getEndPoint
in interface Lane
getEndPoint
in class AbstractLane
public Point2D getPointAtNormalizedDistance(double normalizedDistance)
getPointAtNormalizedDistance
in interface Lane
getPointAtNormalizedDistance
in class AbstractLane
normalizedDistance
- the normalized distance (between 0 and 1) from
the start of the Lanepublic Point2D nearestPoint(Point2D p)
nearestPoint
in interface Lane
nearestPoint
in class AbstractLane
p
- the point to which the nearest point in the center of the Lane
should be foundpublic double nearestDistance(Point2D pos)
nearestDistance
in interface Lane
nearestDistance
in class AbstractLane
pos
- the point from which to find the distance to the Lanepublic Point2D getLeadPoint(Point2D pos, double leadDist)
getLeadPoint
in interface Lane
getLeadPoint
in class AbstractLane
pos
- the position from which to calculate the nearest point in
the LaneleadDist
- the lead distance further down the Lane, in metersleadDist
further down the Lane from
the closest point in the Lane to pos
public double distanceAlongLane(Point2D pos)
distanceAlongLane
in interface Lane
distanceAlongLane
in class AbstractLane
pos
- the point to which to find the distance along the Lanepublic double remainingDistanceAlongLane(Point2D pos)
remainingDistanceAlongLane
in interface Lane
remainingDistanceAlongLane
in class AbstractLane
pos
- the point nearest which to find the distance to the end of the
Lanepublic double normalizedDistanceAlongLane(Point2D pos)
normalizedDistanceAlongLane
in interface Lane
normalizedDistanceAlongLane
in class AbstractLane
pos
- the point near to which to find the normalized distancepublic double normalizedDistance(double distance)
distance
- the distance along the center of the lane.public double getInitialHeading()
getInitialHeading
in interface Lane
getInitialHeading
in class AbstractLane
public double getTerminalHeading()
getTerminalHeading
in interface Lane
getTerminalHeading
in class AbstractLane
public double getHeadingAtNormalizedDistance(double normalizedDistance)
getHeadingAtNormalizedDistance
in interface Lane
getHeadingAtNormalizedDistance
in class AbstractLane
normalizedDistance
- the normalized distance (between 0 and 1) from
the start of the Lanepublic Point2D intersectionPoint(Line2D l)
intersectionPoint
in interface Lane
intersectionPoint
in class AbstractLane
l
- the Line with which to find the intersectionnull
if it doesn't intersectpublic double getWidth()
getWidth
in interface Lane
getWidth
in class AbstractLane
public Shape getShape()
getShape
in interface Lane
getShape
in class AbstractLane
public Shape getShape(double startFraction, double endFraction)
getShape
in interface Lane
getShape
in class AbstractLane
startFraction
- the normalized distance from the start of the lane
to the start of the segment which the Shape
representsendFraction
- the normalized distance from the start of the lane
to the end of the segment which the Shape representspublic boolean contains(Point2D pos)
contains
in interface Lane
contains
in class AbstractLane
pos
- the point to checkpublic Shape leftBorder()
leftBorder
in interface Lane
leftBorder
in class AbstractLane
public Shape rightBorder()
rightBorder
in interface Lane
rightBorder
in class AbstractLane
public Point2D leftIntersectionPoint(Line2D l)
leftIntersectionPoint
in interface Lane
leftIntersectionPoint
in class AbstractLane
l
- the Line with which to find the intersectionnull
if it doesn't intersectpublic Point2D rightIntersectionPoint(Line2D l)
rightIntersectionPoint
in interface Lane
rightIntersectionPoint
in class AbstractLane
l
- the Line with which to find the intersectionnull
if it doesn't intersectCopyright © 2013. All rights reserved.