public final class DistUtils extends Object
| Constructor and Description |
|---|
DistUtils() |
| Modifier and Type | Method and Description |
|---|---|
static double |
pointToLineEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
Computes the euclidian distance between a point and its'
projection on a line (distance between a point and the line).
|
static double |
pointToLineSqEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
Computes the square of the euclidian distance between a point and its'
projection on a line (the distance between a point and the line).
|
static double |
pointToPointCbsvDist(double p1x,
double p1y,
double p2x,
double p2y)
The the chess (Chebyshev)
distance between two points.
|
static double |
pointToPointEucDist(double p1x,
double p1y,
double p2x,
double p2y)
The the euclidian distance between two points.
|
static double |
pointToPointMnhtDist(double p1x,
double p1y,
double p2x,
double p2y)
The the Manhattan
distance between two points.
|
static double |
pointToPointSqEucDist(double p1x,
double p1y,
double p2x,
double p2y)
The square of the euclidian distance between two points.
|
static double |
pointToSegEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
Computes the the minimum euclidian distance to the segment's point
which is the closest to the original point.
|
static double |
pointToSegSqEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
Computes the the minimum squared euclidian distance to the segment's point
which is the closest to the original point.
|
public static final double pointToPointSqEucDist(double p1x,
double p1y,
double p2x,
double p2y)
p1x - x coordinate of the first pointp1y - y coordinate of the first pointp2x - x coordinate of the second pointp2y - y coordinate of the second pointpublic static final double pointToPointEucDist(double p1x,
double p1y,
double p2x,
double p2y)
Math.sqrt(@link #pointToLineSqEucDist(double, double, double, double, double, double))
(i.e. more computational extensive than computing the square of the distance).p1x - x coordinate of the first pointp1y - y coordinate of the first pointp2x - x coordinate of the second pointp2y - y coordinate of the second pointpublic static final double pointToPointMnhtDist(double p1x,
double p1y,
double p2x,
double p2y)
p1x - x coordinate of the first pointp1y - y coordinate of the first pointp2x - x coordinate of the second pointp2y - y coordinate of the second pointpublic static final double pointToPointCbsvDist(double p1x,
double p1y,
double p2x,
double p2y)
p1x - x coordinate of the first pointp1y - y coordinate of the first pointp2x - x coordinate of the second pointp2y - y coordinate of the second pointpublic static final double pointToLineSqEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
[startX, startY]...[endX, endY] segment.pointX - the x coordinate of the pointpointY - the y coordinate of the pointstartX - the x coordinate of the first point on the linestartY - the y coordinate of the first point on the lineendX - the x coordinate of the second point on the lineendY - the y coordinate of the second point on the linepublic static final double pointToLineEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
Math.sqrt(pointToLineSqEucDist),
which makes this method more computational intensive than computing the
square of the distance.pointX - the x coordinate of the pointpointY - the y coordinate of the pointstartX - the x coordinate of the first point on the linestartY - the y coordinate of the first point on the lineendX - the x coordinate of the second point on the lineendY - the y coordinate of the second point on the linepublic static final double pointToSegSqEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
pointX - the x coordinate of the pointpointY - the y coordinate of the pointstartX - the x coordinate of the segment's startstartY - the y coordinate of the segment's startendX - the x coordinate of the segment's endendY - the y coordinate of the segment's endpublic static final double pointToSegEucDist(double pointX,
double pointY,
double startX,
double startY,
double endX,
double endY)
pointToSegSqEucDist(double, double, double, double, double, double).Copyright © 2016. All rights reserved.