# How to find tangent distance from a point on a sphere to a spherical polar cap?

Suppose we have a point $P$ on a unit-sphere, and another point $X$ (may be north-pole) with spherical cap radius $r$ (radius along sphere surface). We need to find tangent distance from $P$ to the cap (tangent along spherical surface).

This is part of a bigger problem: We need to find shortest distance between two points on a sphere (along surface) so that it does not go through a spherical cap.

• What do you mean by "tangent distance"? do you mean the distance measured along the surface of the sphere? – bubba Mar 22 '15 at 12:05
• Problem description edited. – mahbub Mar 22 '15 at 12:53
• You should be able to write an equation for the "base" $B$ of your spherical cap and parametric equations for the great circles through $P$. Then it is only a matter of finding those circles that intersect $B$ in exactly one point and of choosing the shortest segment. This may not be the fastest algorithm, though... – A.P. Mar 22 '15 at 13:02
• Finding the shortest path from $P$ to $Q$ that misses some spherical cap $C$ centered at a point $X$ does not seem to entail finding the distance from $P$ to $C$. That is, your question does not seem to be an intermediate problem for your stated final goal. – Andrew D. Hwang Mar 22 '15 at 13:42

I'm not sure to well understand your question, so I add a figure.

The figure is a plane section of your sphere passing from $P$. If I well understand the distance that you want is the length of the arc $PB$.( If this is wrong than my answer is wrong)

You know the radius of the cap, that is the arc $AB=\beta$. In this case the arc $PB$ is simply $\dfrac{\pi}{2}-\alpha-\beta$ , where $\alpha$ is the arc that fix the position of $P$ with respect to the equatorial plane of the sphere(its latitude).

If you know as radius of the cap the distance $CB$ than you can find $\beta=\arcsin (CB)$.

• No this is not tangent. Most probably the tangent will be a greater circle passing through P and touching the polar-cap-circle at exactly one point. – mahbub Mar 22 '15 at 19:11
• This is a circle on the plane passing through the point and the center of the sphere, so it is the greater possible circle. Anyway, you have to better define what you means of a ''tangent''. – Emilio Novati Mar 22 '15 at 19:36

Without loss of generality we may assume that $X$ is the North pole, so that the border of your spherical cap $C$ is parallel to the $xy$-plane and has equation $$\begin{cases} x^2 + y^2 = r^2 \\ z = \sqrt{1 - x^2 - y^2} = \sqrt{1 - r^2} =: z_C \end{cases}$$ Further, we may assume that $C$ is strictly contained in the upper hemisphere and that $P \notin C$. Indeed, if $P$ is inside $C$ every great circle through $P$ intersects the border of $C$ in two distinct points, while if $P \in \partial C$ the distance you are looking for is trivially $0$.

If I understand correctly, you are looking for the shortest arc of great circle from $P = (x_P,y_P,z_P)$ to a point of tangency with $\partial C$. If this is the case, then observe that there are exactly two great circles $\gamma_1,\gamma_2$ through $P$ which are tangent to $\partial C$, and those are symmetric with respect to the plane $\pi$ through $P$, $X$, and the centre of the sphere $O$. In particular, this means that if $\sigma$ is the plane through $X$ orthogonal to $\pi$, then $$\sigma \cap \partial C = (\gamma_1 \cap \partial C) \cup (\gamma_2 \cap \partial C)$$ Since by construction the projection of $P$ to the $xy$-plane must be orthogonal to $\sigma$, it follows that $\sigma$ is given by the equation $$x_P x + y_P y = 0$$ Now suppose without loss of generality that $y_P \neq 0$. Then substituting $y = - \frac{x_P}{y_P} x$ into the equation for $\partial C$ gives $$\sigma \cap \partial C = \left\{\left(\pm \, c, \mp \, \frac{x_P}{y_P} c, z_C\right)\right\} \quad \text{where } \quad c = r \left(\left( \frac{x_P}{y_P} \right)^2 + 1 \right)^{-1/2}$$ Finally, the distance you are looking for is the orthodromic between $P$ and any one of those two points.