Java Euclidean Distance euclideanDistance(double x1, double y1, double x2, double y2)

Here you can find the source of euclideanDistance(double x1, double y1, double x2, double y2)

Description

euclidean Distance

License

Open Source License

Declaration

public static double euclideanDistance(double x1, double y1, double x2, double y2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double euclideanDistance(double x1, double y1, double x2, double y2) {
        return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
    }//from w  w  w  .  j  a v a2  s.  c o m

    public static double euclideanDistance(Double[] point1, Double[] point2) {
        double distance = 0.0d;
        for (int i = 0; i < point1.length; i++) {
            // for (int j=0; j < point2.length; j++){
            //if (i ==j){
            distance += Math.sqrt(Math.pow(point1[i] - point2[i], 2));
            //}
            //}
        }
        return distance; //Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
    }
}

Related

  1. euclideanDist(double[] ePointOne, double[] ePoint2)
  2. euclideanDist(final double[] vec1, final double[] vec2, int n)
  3. euclideanDist(float[] v1, float[] v2)
  4. euclideanDistance(double instance1[], double instance2[])
  5. euclideanDistance(double x1, double y1, double x2, double y2)
  6. EuclideanDistance(double xSource, double ySource, double xTarget, double yTarget)
  7. euclideanDistance(double[] a, double[] b)
  8. euclideanDistance(double[] coord1, double[] coord2)
  9. euclideanDistance(double[] data, double[] pattern)