This function takes the longitudes and latitudes of two points on a sphere with radius r, returns the great-circle distances between them. Option degree determines whether to use degree or radian as the unit of longitudes and latitudes.
double HaversineDistance(double lon1, double lat1, double lon2, double lat2, double r[, bool degree])
All arguments are of numeric type double
lon1
lat1
lon2
lat2
r
degree
Return the great-circle distances between the two points.
double dist=HaversineDistance(120, 30, 0, -60, 5000); ff=; //Should return 11388.7402734106.