Constructor and Description |
---|
Segment(Vector2D start,
Vector2D end,
Line line)
Build a segment.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(Vector2D p)
Calculates the shortest distance from a point to this line segment.
|
Vector2D |
getEnd()
Get the end point of the segment.
|
Line |
getLine()
Get the line containing the segment.
|
Vector2D |
getStart()
Get the start point of the segment.
|
public Vector2D getStart()
public Line getLine()
public double distance(Vector2D p)
If the perpendicular extension from the point to the line does not cross in the bounds of the line segment, the shortest distance to the two end points will be returned.
Algorithm adapted from: Thread @ Codegurup
- to checkCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.