I am sure the major portion of this has been covered, but I have an exception that I need to hash out.

I want to find the intersection of two great circle arcs (numerically). I have already determined the location of the two intersection points of the two corresponding great circles. However, this leave me with the problem of determining which point lies on the great circle arc.

Letlet $\displaystyle p_1,\,q_1, p_2, q_2$ define the great circle arcs, $\displaystyle A_1,A_2$, respectively, and let $\displaystyle I_1,\, I_2$ correspond to the intersections of the great circles. These intersections are antipodal of eachother, which is what causes my problem. To calculate the shortest distance between a point, $\displaystyle X$ and a great circle I use the following

$\displaystyle n = p \times q $

then the perpendicular distance is given by

$\displaystyle \theta = \cos^{-1}(n \cdot X) - \frac{\pi}{2}$.

From here I check to see if $\displaystyle \theta \le \epsilon$.

But, because of $\displaystyle 0 \le \cos^{-1} X \le \pi$ I get that both $\displaystyle I_1,\, I_2$ are on the arc. How do I get the proper angle from $\displaystyle \cos^{-1}$ using the information given?