Here you can find the source of getDistance(Point2D.Double pt1, Point2D.Double pt2)
public static double getDistance(Point2D.Double pt1, Point2D.Double pt2)
//package com.java2s; //License from project: Apache License import java.awt.geom.Point2D; public class Main { public static double getDistance(Point2D.Double pt1, Point2D.Double pt2) { double dx = pt2.x - pt1.x, dy = pt2.y - pt1.y; return Math.sqrt(dx * dx + dy * dy); }// www .jav a 2 s . co m }