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 define the great circle arcs, , respectively, and let 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, and a great circle I use the following

then the perpendicular distance is given by

.

From here I check to see if .

But, because of I get that both are on the arc. How do I get the proper angle from using the information given?