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.
|
protected static double |
jMdspheedis(double x1,
double y1,
double x2,
double y2,
double smax,
double iflat)
The method jMdspheedis computes the precise ellipsoidal distance
using long/lat of two points.
|
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 segmentprotected static double jMdspheedis(double x1, double y1, double x2, double y2, double smax, double iflat)
Input is geodetic longitude, latitude in radians of two points on earth spheroid.
Based on Mathematica Geodesy package by John Novak
Will return 0. for arcs of the order of a meter or less. For very short arcs use mdsphedis(). Will return the antipodal distance for points which are very close to antipodal.
Accuracy is of order 1e-9.
x1
- longitude of first point in radiansy1
- latitude of first point in radiansx2
- longitude of second point in radiansy2
- latitude of second point in radianssmax
- smax of ellipsoidiflat
- inverse flattening