public class Line extends Line2D.Float
Line2D.Double, Line2D.Float
x1, x2, y1, y2
Constructor and Description |
---|
Line(float x1,
float y1,
float x2,
float y2) |
Modifier and Type | Method and Description |
---|---|
Point |
getP1()
Get the start point of the line as a Point2D
|
Point |
getP2()
Get the end point of the line as a Point2D
|
Point |
intersectsAt(Line l)
Calculate the point of intersection of two lines.
|
float |
length()
Return the length of the line
|
void |
lengthen(float delta)
Make this line longer by an amount delta at each end.
|
double |
segDist(Line seg)
Returns the minimum distance between two line segments--this line segment and another.
|
getBounds2D, getX1, getX2, getY1, getY2, setLine, setLine
clone, contains, contains, contains, contains, getBounds, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine
public Point intersectsAt(Line l)
l
- the second linepublic double segDist(Line seg)
seg
- The other line segment.public void lengthen(float delta)
delta
- the amount added to each endpublic float length()
public Point getP1()
Line2D
getP1
in class Line2D.Float
public Point getP2()
Line2D
getP2
in class Line2D.Float