public final class CompJGeom
extends java.lang.Object
| Constructor and Description |
|---|
CompJGeom() |
| Modifier and Type | Method and Description |
|---|---|
static double |
distToLine(double px,
double py,
double q1x,
double q1y,
double q2x,
double q2y)
Finds the planar closest distance from a point to a line segment.
|
static double |
distToLine(JPoint2DD pt,
JPoint2DD q1,
JPoint2DD q2,
CoordSysInfo CSI)
Compute the distance from a point to a line.
|
static boolean |
lineLineIntersect(double a1x,
double a1y,
double a2x,
double a2y,
double b1x,
double b1y,
double b2x,
double b2y,
double[] c)
Finds the open-set intersection of two line segments, if any.
|
public static final boolean lineLineIntersect(double a1x,
double a1y,
double a2x,
double a2y,
double b1x,
double b1y,
double b2x,
double b2y,
double[] c)
Returns false ("no intersection") if the lines are nearly parallel (regardless of whether they cross).
If the end-point of a segment lies very near to the other segment, intersection test is not reliable; the caller should test the point-on-line case separately. If the endpoint lies exactly on an endpoint of the other segment this method guarantees to return false.
a1x - the first endpoint x-value of line segment aa1y - the first endpoint y-value of line segment aa2x - the first endpoint x-value of line segment aa2y - the first endpoint y-value of line segment ab1x - the first endpoint x-value of line segment bb1y - the first endpoint y-value of line segment bb2x - the first endpoint x-value of line segment bb2y - the first endpoint y-value of line segment ac - the intersection (if any). May pass null. If non-null, may be overwritten even if result is false.public static final double distToLine(JPoint2DD pt, JPoint2DD q1, JPoint2DD q2, CoordSysInfo CSI)
pt - the pointq1 - one end of the lineq2 - other end of the lineCSI - coordinate systempublic static final double distToLine(double px,
double py,
double q1x,
double q1y,
double q2x,
double q2y)
p - The pointq1 - The first vertex of the line segmentq2 - The second vertex of the line segment