Java Distance Calculate DistanceSquareBetweenPoints(double x1, double y1, double x2, double y2)

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

Description

Distance Square Between Points

License

BSD License

Declaration

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

Method Source Code

//package com.java2s;
// LICENSE:       This file is distributed under the BSD license.

public class Main {
    public static double DistanceSquareBetweenPoints(double x1, double y1,
            double x2, double y2) {
        double d1 = x1 - x2;
        double d2 = y1 - y2;
        double d = d1 * d1 + d2 * d2;
        if (d <= 0)
            return 0;
        else//from  w  w  w  .  ja va2  s.c om
            return d;
    }
}

Related

  1. distanceSQ(double[] pos1, double[] pos2)
  2. distanceSq(double[] vec1, double[] vec2)
  3. distanceSq(float x0, float y0, float x1, float y1)
  4. distanceSq(int x0, int y0, int x1, int y1)
  5. distanceSqr(final float[] a, final float[] b)
  6. distanceSquared(double dx, double dy)
  7. distanceSquared(double x1, double y1, double x2, double y2)
  8. distanceSquared(double x1, double y1, double x2, double y2)
  9. distanceSquared(final double[] x, final double[] y)