Finding intersections of a spherical spiral with a geodesic segment Long story short:

*

*Can we analytically solve for $φ$ in this equation? $\sin(\varphi) \cdot (A \cdot \cos(k \cdot \varphi) + B \cdot \sin(k \cdot \varphi)) + C \cdot \cos(\varphi)=0$

*Given a point on a geodesic, how can you tell whether it's on the shortest path between two points also on the geodesic (and not on the longer path)?

Conventions:

*

*$3$D Cartesian coordinates $(x,y,z)$ are right-handed.

*Spherical coordinates $(\theta,\varphi)$ as described below, with the distance from the origin ($r$) always being $1$ and therefore ignored in this post.

*$\theta \in [0,2\pi)$ is the angle from the positive $x$ axis to the origin to the point on the $xy$ plane above/below the point (counterclockwise).

*$\varphi \in [0,\pi]$ is the angle from the positive $z$ axis to the origin to the point.

I am looking for the intersections of a spherical spiral with a geodesic segment. The spiral is defined by $\theta (\varphi)= k\varphi$ with $\varphi \in [0,\pi]$. The goedesic segment is defined as the shorter path along the unit circle between points $p_0$ $(\theta _0,\varphi _0)$ or $(x_0,y_0,z_0)$ and $p_1$ $(\theta _1,\varphi _1)$ or $(x_1,y_1,z_1)$. $p_0$ and $p_1$ are never polar opposites, so we don't have to worry about the case where there are infinitely many paths of equal length. Here is what I have so far:
A geodesic is just the intersection of a sphere with a plane that passes through its origin. So
the geodesic is described by $Ax+By+Cz=0$, $x^2+y^2+z^2=1$, with some start and end points. The geodesic had better contain the two bounding points, so if we find the plane containing $p_0$, $p_1$, and the origin, we should have our description of the geodesic. So let's cross-multiply the position vectors of $p_0$ and $p_1$ in Cartesian coordinates to get $A, B,$ and $C$:
$$Ax + By + Cz = 0$$
$$A = y_0 \cdot z_1 - z_0 \cdot y_1$$
$$B = z_0 \cdot x_1 - x_0 \cdot x_1$$
$$C = x_0 \cdot y_1 - y_0 \cdot z_1$$
Then I convert to spherical coordinates, again assuming $r=1$:
$$A \cdot \cos(\theta) \cdot \sin(\varphi) + B \cdot \sin(\theta) \cdot \sin(\varphi) + C \cdot \cos(\theta) = 0$$
$$A = \sin(\theta _0) \cdot \sin(\varphi _0) \cdot \cos(\varphi_1) - \cos(\varphi_0) \cdot \sin(\theta_1) \cdot \sin(\varphi _1)$$
$$B = \cos(\varphi _0) \cdot \cos(\theta _1) \cdot \sin(\varphi _1) - \cos(\theta _0) \cdot \sin(\varphi _0) \cdot \cos( \varphi _1)$$
$$C = \cos(\theta _0) \cdot \sin(\varphi _0) \cdot \sin(\theta _1) \cdot \sin(\varphi _1) - \sin(\theta _0) \cdot \sin(\varphi_ 0) \cdot \cos(\theta _1) \cdot \sin(\varphi _1)$$
That's getting messy! Let's ignore $A, B$ and $C$ for now, since they all evaluate to constants. Now to find the intersections with the spiral, just substitute $\theta$ with $k \varphi$:
$$A \cdot \cos(k \varphi) \cdot \sin(\varphi) + B \cdot \sin(k \varphi) \cdot \sin(\varphi) + C \cdot \cos(\varphi) = 0$$
and factor:
$$\sin(\varphi) \cdot (A \cdot \cos(k \varphi) + B \cdot \sin(k \varphi)) + C \cdot \cos(\varphi) = 0$$
Now I want all the values of $\varphi \in [0,\pi]$ that satisfy these equations. The problem is, I don't know how to find the analytic solution! I can do it numerically within a certain tolerance pretty easily, but I'd love to have an exact answer.
The other problem I have is that once I have found these intersections, I need to determine which of them lie on the shorter of the two paths between $p_0$ and $p_1$. I know I can't just ask whether the $\varphi$ coordinate is between $\varphi _0$ and $\varphi _1$, since, e.g., if $p_0 = (0,\frac{\pi}{4})$ and $(\frac{\pi}{4},\frac{\pi}{4})$, the geodesic will have $\varphi > \frac{\pi}{4}$ between the two points. I also can't just ask whether the intersection's $\theta$ coordinate is between $\theta _0$ and $\theta _1$, since that will always be true if $p_0$ and $p_1$ have the same $\theta$.

I am afraid there is no analytical solution of this equation, because the arguments of the trigonometric functions, $\phi$ and $k\phi$ can be incommensurable.
There could be solutions for a few rational values of $k$ such as $\dfrac12,1,2$. By rationalizing the trigonometric functions (Weierstrass substitution) or using the complex representation, you can turn the equation to a polynomial form.
