Java Distance Calculate distance(double[] p1, double[] p2)

Here you can find the source of distance(double[] p1, double[] p2)

Description

distance

License

Apache License

Declaration

public static double distance(double[] p1, double[] p2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double distance(double[] p1, double[] p2) {
        int nd = p1.length;
        double out = 0.0;
        for (int d = 0; d < nd; d++) {
            out += (p1[d] - p2[d]) * (p1[d] - p2[d]);
        }/*w ww. j ava 2  s  . c o m*/

        return Math.sqrt(out);
    }
}

Related

  1. distance(double x1, double y1, double z1, double x2, double y2, double z2)
  2. distance(double xOrigin, double yOrigin, double xDestination, double yDestination)
  3. distance(double[] a, double[] b)
  4. distance(double[] a, double[] b)
  5. distance(double[] p1, double[] p2)
  6. distance(double[] x, int p, int q, int dim)
  7. distance(final Class child, final Class parent)
  8. distance(final double x, final double y)
  9. distance(final double x1, final double y1, final double x2, final double y2)