Intersection of two arcs on sphere

You can find a javascript implementation here:

http://www.movable-type.co.uk/scripts/latlong.html

and a good explanation here:

http://www.boeing-727.com/Data/fly%20odds/distance.html


As far as I can tell to verify that two arcs intersect on the same sphere they must have an angular range that has at least shares one particular value of phi and theta, for instance if one arc covers (30,30 ) to (60, 60) and the other covers (0, 0) to (0, 60) they wouldn't intersect even if theta agrees. Basically the condition is that the intervals for both sets of phi and theta have nonzero set theoretic intersection at the same time, that is the ranges for phi must have at least one value in common at the same time as both ranges for theta have at least one value in common.