public final class Line2D extends Object
| Constructor and Description |
|---|
Line2D(double x1,
double y1,
double x2,
double y2) |
| Modifier and Type | Method and Description |
|---|---|
double |
getX1() |
double |
getX2() |
double |
getY1() |
double |
getY2() |
boolean |
intersectsLine(Line2D l)
Tests if the specified line segment intersects this line segment.
|
double |
ptSegDist(double px,
double py)
Returns the distance from a point to this line segment.
|
static double |
ptSegDist(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Returns the distance from a point to a line segment.
|
static double |
ptSegDistSq(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Returns the square of the distance from a point to a line segment.
|
public double getX1()
public double getX2()
public double getY1()
public double getY2()
public double ptSegDist(double px,
double py)
px - the X coordinate of the specified point being measured against
this line segmentpy - the Y coordinate of the specified point being measured against
this line segmentpublic static double ptSegDist(double x1,
double y1,
double x2,
double y2,
double px,
double py)
x1 - the X coordinate of the start point of the specified line segmenty1 - the Y coordinate of the start point of the specified line segmentx2 - the X coordinate of the end point of the specified line segmenty2 - the Y coordinate of the end point of the specified line segmentpx - the X coordinate of the specified point being measured against the
specified line segmentpy - the Y coordinate of the specified point being measured against the
specified line segmentpublic static double ptSegDistSq(double x1,
double y1,
double x2,
double y2,
double px,
double py)
x1 - the X coordinate of the start point of the specified line segmenty1 - the Y coordinate of the start point of the specified line segmentx2 - the X coordinate of the end point of the specified line segmenty2 - the Y coordinate of the end point of the specified line segmentpx - the X coordinate of the specified point being measured against the
specified line segmentpy - the Y coordinate of the specified point being measured against the
specified line segmentpublic boolean intersectsLine(Line2D l)
l - the specified Line2Dtrue if this line segment and the specified line segment
intersect each other; false otherwise.Copyright © 2013–2023. All rights reserved.