List of utility methods to do Distance Calculate
double | distanceSqr(final float[] a, final float[] b) Distance between points a and b , squared.
double sum = 0; for (int i = 0; i < a.length; i++) { final double d = a[i] - b[i]; sum += d * d; return sum; |
double | DistanceSquareBetweenPoints(double x1, double y1, double x2, double y2) Distance Square Between Points double d1 = x1 - x2; double d2 = y1 - y2; double d = d1 * d1 + d2 * d2; if (d <= 0) return 0; else return d; |
double | distanceSquared(double dx, double dy) distance Squared return (dx * dx) + (dy * dy);
|
double | distanceSquared(double x1, double y1, double x2, double y2) Determines the non-squared distance between two hypothetical points. return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
|
double | distanceSquared(double x1, double y1, double x2, double y2) Return the square of the distance between two points, (x1, y1) and (x2, y2). return Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
|
double | distanceSquared(final double[] x, final double[] y) distance Squared double dist = 0.0; for (int iii = 0; iii < x.length; iii++) { dist += (x[iii] - y[iii]) * (x[iii] - y[iii]); return dist; |
double | DistanceSquared(int x1, int z1, int x2, int z2) Distance Squared return Math.pow(x2 - x1, 2) + Math.pow(z2 - z1, 2);
|
int | distanceSquared(int xa, int ya, int xb, int yb) distance Squared return square(xa - xb) + square(ya - yb);
|
float | distanceSquared(int[] referenceBlock, float[] center) distance Squared float distX = referenceBlock[0] - center[0]; float distY = referenceBlock[1] - center[1]; float distZ = referenceBlock[2] - center[2]; return distX * distX + distY * distY + distZ * distZ; |
float | distanceSquaredPointToLine(float px, float py, float x1, float y1, float x2, float y2) Compute the distance between a point and a line. final float rdenomenator = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); if (rdenomenator == 0.) { return distanceSquaredPointToPoint(px, py, x1, y1); final float result = ((y1 - py) * (x2 - x1) - (x1 - px) * (y2 - y1)) / rdenomenator; return (result * result) * Math.abs(rdenomenator); |