List of utility methods to do Distance between Points
double | distance(@Nonnull Point2D pA, @Nonnull Point2D pB) calculate the distance between two points return pA.distance(pB);
|
double | distance(final double p1X, final double p1Y, final double p2X, final double p2Y) distance return Math.sqrt((p1X - p2X) * (p1X - p2X) + (p1Y - p2Y) * (p1Y - p2Y));
|
double | distance(Point2D a, Point2D b) distance return a.distance(b);
|
double | DistanceSquareToLine(double x, double y, double x1, double y1, double x2, double y2) Distance Square To Line double d1 = x1 - x2; double d2 = y1 - y2; double d = d1 * d1 + d2 * d2; if (d <= 0) return 0; double n = x * y1 - x1 * y + x1 * y2 - x2 * y1 + x2 * y - x * y2; return n * n / d; |
double | getDistance(Point2D point1, Point2D point2) Gets the distance between two points. return Point2D.Double.distance(point1.getX(), point1.getY(), point2.getX(), point2.getY());
|
double | getDistance(Point2D point1, Point2D point2) Compute the beeline distance between two points given in signed decimal coordinates wrapped in point objects, with the longitude in the X component and the latitude in the Y component. return getDistance(point1.getX(), point1.getY(), point2.getX(), point2.getY());
|
double | getDistance(Point2D.Double pt1, Point2D.Double pt2) get Distance double dx = pt2.x - pt1.x, dy = pt2.y - pt1.y; return Math.sqrt(dx * dx + dy * dy); |