Java Distance Calculate distance(double[] a, double[] b)

Here you can find the source of distance(double[] a, double[] b)

Description

Measure distance between a and b

License

Apache License

Parameter

Parameter Description
Point B double[x,y]

Return

distance between A and B

Declaration

public static double distance(double[] a, double[] b) 

Method Source Code

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

public class Main {
    /**/*from   ww  w .  j a  v  a2  s . c o  m*/
     * Measure distance between a and b
     * @param Point A double[x,y]
     * @param Point B double[x,y]
     * @return distance between A and B
     */
    public static double distance(double[] a, double[] b) {
        return Math.sqrt(Math.pow(a[0] - b[0], 2)
                + Math.pow(a[1] - b[1], 2));
    }
}

Related

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