|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.geometry.euclidean.twod.Segment
public class Segment
Simple container for a two-points segment.
Field Summary | |
---|---|
private Vector2D |
end
End point of the segments. |
private Line |
line
Line containing the segment. |
private Vector2D |
start
Start point of the 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 |
Field Detail |
---|
private final Vector2D start
private final Vector2D end
private final Line line
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 |