Here you can find the source of distance2D(double x1, double z1, double x2, double z2)
public static double distance2D(double x1, double z1, double x2, double z2)
//package com.java2s; //License from project: Open Source License public class Main { public static double distance2D(double x1, double z1, double x2, double z2) { return Math.sqrt(((x1 - x2) * (x1 - x2)) + ((z1 - z2) * (z1 - z2))); }/*from w w w . ja va 2s . c om*/ }