|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrcssjava.geom.LineSegment
public class LineSegment
Implementation of 2d line segment
Constructor Summary | |
---|---|
LineSegment()
Constructs a line segment with both endpoints at the origin |
|
LineSegment(VecPosition p1,
VecPosition p2)
Constructs a line segment with the given endpoints |
Method Summary | |
---|---|
Rectangle |
getBoundingRectangle()
Create the rectangle that has this line segment as a diagonal |
VecPosition |
getIntersection(Line l)
Get intersection with line |
VecPosition |
getIntersection(LineSegment ls)
Get intersection with line segment |
double |
getLength()
Get distance between endpoints |
Line |
getLine()
Create infinite line from this segment |
VecPosition |
getMidpoint()
Get point on line segment halfway between endpoints |
void |
setPoints(VecPosition p1,
VecPosition p2)
Set endpoints of line segment |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineSegment()
public LineSegment(VecPosition p1, VecPosition p2)
p1
- first endpointp2
- second endpointMethod Detail |
---|
public void setPoints(VecPosition p1, VecPosition p2)
p1
- first endpointp2
- second endpointpublic double getLength()
public VecPosition getMidpoint()
public Rectangle getBoundingRectangle()
public Line getLine()
public VecPosition getIntersection(Line l)
l
- line to intersect with
null
if nonepublic VecPosition getIntersection(LineSegment ls)
ls
- line segment to intersect with
null
if none
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |