Understanding Great Circle Arcs Intersection Algorithm
The following material is the result of my attempt to understand the nice example from Jason Davies.
I was puzzled about the origin of the algorithm used to find the intersection of two great circle arcs.
Google helped and I discovered Roger Stafford’s post in Matlab newsgroup and the relevant Python’s implementation in the Spherical Geometry Toolkit.
The algorithm
You have two great circle arcs on a sphere,
Transform theses coordinates over to Cartesian coordinates using the equations:
where
These Cartesian coordinates correspond to a hypothetical spherical “earth” of unit radius, but that does not interfere in the following computations.
Let
Then, let’s define the following quantities:
(These quantities are crucial: they represent the projection of
The arcs
(Jason tests against
If they do intersect, you can transform the corresponding vector,
References
- Roger Stafford’s post on Matlab newsgroup (but it lacks the normalization step which is instead used in Jason Davies code, and in Spherical Geometry Toolkit)
- implementation in Python as part of the Spherical Geometry Toolkit
- Jason Davies implementation in D3.js
Written and published with StackEdit.
No comments:
Post a Comment