Intersection points between a circle and a straight line on a sphere

54 Views Asked by At

I have a circle on the surface of a sphere. I need to check whether the circle intersects with a given straight line or not. The center of the circle $c$ is given in terms of latitude and longitude $(\phi, \lambda)$, and the radius $r$ is given in meters. The latitude and longitudes of two endpoints of the straight line are given $(\phi_{p}, \lambda_{p}), (\phi_{q}, \lambda_{q})$.

I assume $t$ is a point on $pq$ such that $ct$ is the shortest distance from $c$ to $pq$. In the following scenarios intersections are possible. In all other cases no intersection will happen.

$$\Vert cp \Vert \geq r, \Vert cq \Vert \geq r, \Vert ct \Vert \leq r\Rightarrow 2\;\text{intersections}$$ $$\Vert cp \Vert < r, \Vert cq \Vert \geq r, \Vert ct \Vert \leq r\Rightarrow 1\;\text{intersections}$$ $$\Vert cp \Vert \geq r, \Vert cq \Vert < r, \Vert ct \Vert \leq r\Rightarrow 1\;\text{intersections}$$

In the first case I assume the two intersection points are $x, y$. The point near $p$ is $x$, and the point near $q$ is $y$. We already know $\Vert pq \Vert$. Using the Law of Cosines we can derive $\Vert xt \Vert$, thus $\Vert pq \Vert = \Vert pt \Vert - \Vert xt \Vert$.

$$\Vert xt \Vert = \cos^{-1}\Big(\frac{\cos(r)}{\cos(\Vert ct \Vert)}\Big)$$

But after this I am loosing track. I understand that both $x, y$ are in the great circle constructed by $p, q$. But I don't know how to determine the latitude and longitudes of $x$ and $y$ from this information. I targeted the first case assuming solving this will solve the other two cases. My actual problem is to know all the intersection points.