Here you can find the source of DistanceSquareBetweenPoints(double x1, double y1, double x2, double y2)
public static double DistanceSquareBetweenPoints(double x1, double y1, double x2, double y2)
//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; } }