Calculate the great-circle distance between two points on a sphere (e.g. Earth) using the Haversine formula.