|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.geometry.euclidean.twod.Segment
public class Segment
Simple container for a two-points segment.
Constructor Summary | |
---|---|
Segment(Vector2D start,
Vector2D end,
Line line)
Build a segment. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Segment(Vector2D start, Vector2D end, Line line)
start
- start point of the segmentend
- end point of the segmentline
- line containing the segmentMethod Detail |
---|
public Vector2D getStart()
public Vector2D getEnd()
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 @ Codeguru
p
- to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |