Java Distance Calculate computeDistance(final int[] position1, final int[] position2)

Here you can find the source of computeDistance(final int[] position1, final int[] position2)

Description

compute Distance

License

Open Source License

Declaration

final public static float computeDistance(final int[] position1, final int[] position2) 

Method Source Code

//package com.java2s;

public class Main {
    final public static float computeDistance(final int[] position1, final int[] position2) {
        float dist = 0;

        for (int d = 0; d < position1.length; ++d) {
            final int pos = position2[d] - position1[d];

            dist += pos * pos;/*from  ww w  . ja  v  a  2  s . co  m*/
        }

        return (float) Math.sqrt(dist);
    }
}

Related

  1. calculateDistanceNoNormalization(float[] vec1, float[] vec2)
  2. calculateDistancePointToShowerAxis(double cogx, double cogy, double delta, double x, double y)
  3. calculateDistanceWithWGS84(double lat1, double lng1, double lat2, double lng2)
  4. computeDistance(double lat1, double lon1, double lat2, double lon2)
  5. computeDistance(Double startLat, Double startLon, Double endLat, Double endLon)
  6. computeDistance(int p1x, int p1y, int p2x, int p2y)
  7. computeDistance(long[] a, long[] b)
  8. computeDistanceAndBearingFast(double lat1, double lon1, double lat2, double lon2, float[] results)
  9. computeDistanceImpl(final String firstStringInAlgorithm, final String secondStringInAlgorithm)