Closed daniel-j-h closed 7 years ago
greatCircleDistance
is the haversine distance where the haversine is approximated as x^2/4 for small x and cos(phi_1)cos(phi_2) as cos^2((phi_1+phi_2)/2) for close phi_1 and phi_2.
I think also the reason to use the approximated version is only performance, but to check how it is better some profiling is needed.
The original cycle here was something like we started out with haversine everywhere since it is the most precise formula that is somewhat fast, then switched everything to great circle distance to get a performance speedup. However we realized that great circle distance is not precise enough for some things and switched them back.
I would not call it carefully sprinkled
but at least picked with some care.
Interesting. I'm closing this as interesting but not actionable for us at the moment.
We can profile and check in the future if needs be.
The following is a good distance calculation from "5. Starting point for Newton’s method" in "Algorithms for geodesics" by Charles F. F. Karney (2013):
$ ./geodesic_inverse_approx.py 60.0 60.1 0.1
input: lat1= 60.000000 lat2= 60.100000 lam12= 0.100000
output: az1= 26.526 az2= 26.612 s12= 12456.777
error: az1= 1.2e-05 az2= 1.2e-05 s12= 1.3e-03
python source: https://gist.github.com/c8ad6ce4a936e456d281511e2d7a2434
In Coordinate calculation it seems like we provide
for measuring distance between two coordinates on a sphere (this is usually called great circle distance).
From what I can see the
greatCircleDistance
titled function really is a equirectangular approximation.The only reason for using it I can come up with is speed. Are those calls really carefully sprinkled in when we need to care about the performance? Any insights here?
cc @TheMarex @oxidase