# compute minimum distance between point and great arc on sphere

Suppose I have a point $P$ on a unit sphere whose spherical coordinates are $(\theta, \varphi)$, and a great arc from point $Q$ to point $R$, also specified in spherical coordinates. I want to find the minimum distance (great arc distance, preferably) between the point and the arc. Can somebody help me on that?

My best guess would be to take the formula for the Great arc distance between two points on a unit sphere, plug in a point $S$ parameterized by $t$ on the arc between $Q$ and $R$, and find the minimum distance between $P$ and $S$. But I would definitely need help with that.

-

Consider the full great circle that your $Q$ to $R$ arc is part of. There are two points (poles) which are each 90 degrees of arc from every point on the great circle. (You can find these points by forming a 90-90-x triangle from your arc segment.) Choosing the point which is on the same hemisphere as your point $P$, there is an arc from this pole, through $P$, to the great circle. Since the length of this arc is 90 degrees, the distance from $P$ to the great circle is the complement of the distance from the pole to $P$.
Determining the distance from $P$ to the actual arc then is just a matter of determining if the intersection point is between $Q$ and $R$, and if not, determining the distances from $P$ to $Q$ and $R$ to get the minimum.
Regarding this last comment, which pole do you mean -- the point on the original y axis (90 degrees latitude), or the pole of the great circle through $Q$ and $R$? Regarding your initial answer, can you point me to how to form a 90-90-x triangle from the arc segment so as to find the poles? – LarsH Mar 22 '13 at 3:03