Here you can find the source of DistanceBetweenPoints(double x1, double y1, double x2, double y2)
public static double DistanceBetweenPoints(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 DistanceBetweenPoints(double x1, double y1, double x2, double y2) { return Math.sqrt(DistanceSquareBetweenPoints(x1, y1, x2, y2)); }// w w w . j av a 2s.com 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 return d; } }