Java Distance Calculate distSq(double x1, double y1, double z1, double x2, double y2, double z2)

Here you can find the source of distSq(double x1, double y1, double z1, double x2, double y2, double z2)

Description

dist Sq

License

Open Source License

Declaration

public static double distSq(double x1, double y1, double z1, double x2, double y2, double z2) 

Method Source Code

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

public class Main {
    public static double distSq(double x1, double y1, double z1, double x2, double y2, double z2) {
        return (sq(x2 - x1) + sq(y2 - y1) + sq(z2 - z1));
    }/*w w  w .  ja  v a 2  s. c  o  m*/

    public static double sq(double f) {
        return f * f;
    }

    public static double sq(double f, int i) {
        if (i == 2)
            return sq(f);
        double f1 = 1D;
        for (int j = 0; j < i; j++)
            f1 *= f;
        return f1;
    }
}

Related

  1. distPointSegmentSquared(double px, double py, double qx, double qy, double rx, double ry)
  2. distribution(int[] values)
  3. distsimFeaturesException()
  4. distSphericalEarth(double lat1, double lon1, double lat2, double lon2)
  5. distSq(double x1, double y1, double x2, double y2)
  6. distSqr2(double x1, double y1, double x2, double y2)
  7. distSquared(double ax, double ay, double bx, double by)
  8. distSquared(float x0, float y0, float x1, float y1)
  9. distSquaredCartesian(double[] vec1, double[] vec2)