Java Utililty Methods Distance Calculate

List of utility methods to do Distance Calculate

Description

The list of methods to do Distance Calculate are organized into topic(s).

Method

doubleDistance(final double[] minCorner, final double[] maxCorner)
Distance
double distance = 0;
for (int d = 0; d < minCorner.length; ++d) {
    distance += Math.pow((minCorner[d] - maxCorner[d]), 2);
return Math.sqrt(distance);
doubledistance(final double[] p, final double[] q)
distance
return Math.sqrt(sum(pow(subtract(p, q), 2)));
doubledistance(final double[] t1, final double[] t2)
distance
if (t1.length != t2.length)
    throw new IllegalStateException("distance() -> " + t1.length + "<>" + t2.length);
double sum = 0d;
for (int i = 0; i < t1.length; i += 1) {
    sum += (t1[i] - t2[i]) * (t1[i] - t2[i]);
return Math.sqrt(sum);
doubledistance(final String c1, final String c2, final String c1Prev, final String c2Prev)
distance
final double d1 = Double.parseDouble(c1) - Double.parseDouble(c1Prev);
final double d2 = Double.parseDouble(c2) - Double.parseDouble(c2Prev);
return StrictMath.hypot(d1, d2);
floatdistance(float aX, float aY, float bX, float bY)
distance
float xDiff = aX - bX;
float yDiff = aY - bY;
return (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff);
floatdistance(float speed, float delta)
distance
return speed * delta;
floatdistance(float value1, float value2)
Calculates the absolute value of the difference of two values.
return Math.abs(value1 - value2);
floatdistance(float value1, float value2)
Get the distance between two values.
return Math.abs(value1 - value2);
floatdistance(float value1, float value2)
distance
return Math.abs(value1 - value2);
floatdistance(float x1, float x2, float y1, float y2)
Distance.
float dx = x1 - x2;
float dy = y1 - y2;
return (float) Math.sqrt((dx * dx) + (dy * dy));