Here you can find the source of distanceToPoint(float x1, float y1, float x2, float y2)
public static float distanceToPoint(float x1, float y1, float x2, float y2)
//package com.java2s; //License from project: Open Source License public class Main { public static float distanceToPoint(float x1, float y1, float x2, float y2) { return (float) Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }/*from w w w . jav a2 s . c o m*/ }