I have a line segment and I want to find the arc that it projects to on a sphere. I know there are two arcs; I'm interested in the one that's closest to the line (or intersects it).
The easy way to do it is to pick individual points along the segment and project them to the sphere. The problem with this is that it generates inefficient code.
If I know the projections on the sphere for the endpoints of the line, can I express the arc as parameterized spherical coordinates?
For example, for now I'm using the following approximation (approximations would be ok too if they're generally accurate):
$C, r$ : sphere center and radius
$P_0P_1$ : line segment
$Q_0,Q_1$ : spherical coordinates of projections of $P_0$ and $P_1$ on sphere
$X$ : point along $P_0P_1$ : $X = P_0 + t(P_1-P_0)$
$Y$ : spherical coordinates of point along arc, calculated as follows:
$s = \frac{||\hat{CX} - \hat{CP_0}||}{||\hat{CP_1} - \hat{CP_0}||}$
Y = (1-s)Q_0 + sQ_1
... but this generates a just-ok approximation, where I want to do something better.
I tried interpolating via angle:
$s = \frac{\measuredangle(CX,CP_0)}{\measuredangle(CP_1,CP_0)}$
... but for some reason, it produces worse results.