Here you can find the source of dist(float x1, float y1, float x2, float y2)
public static float dist(float x1, float y1, float x2, float y2)
//package com.java2s; //License from project: Open Source License public class Main { public static float dist(float x1, float y1, float x2, float y2) { final float x = (x2 - x1); final float y = (y2 - y1); return (float) Math.sqrt(x * x + y * y); }//from ww w. j av a 2s . c om public static float dist(float x1, float y1, float z1, float x2, float y2, float z2) { final float x = (x2 - x1); final float y = (y2 - y1); final float z = (z2 - z1); return (float) Math.sqrt(x * x + y * y + z * z); } }