Some work is needed, I give just a start..
First, you should transpose the carthesian 3d coordinate on polar 2d coordinate for the projection of the cone on the plane.
The distance is just the distance between the origin and the point on the cone so:
For finding the angle you need to impose that a circle at $r^2z^2=1$ (that is long $2\pi$) mantain his lenght when transposed into an arc in polar coordinate ($=d*\alpha$).
Now you need to introduce 2d cartesian coordinate on the projection, setting:
Now you should convert $(x,y,z)\rightarrow(X,Y)$, find the equation of the line in $(X,Y)$ and then do the inverse transformation $(X,Y)\rightarrow(x,y,z)$.
Some care are needed for chooing the angle $\theta_0$, the easier choice is putting one of the two point at $\theta=0$, and choosing what geodesic (there are a lot of them, take a look here).
Analitically do the invertion don't seem easy, depends on what are you are interested on (finding the equation in $x,y,z$? finding the equation in polar 3d coordinate (that should be easier)? calculate the lenght of the geodesic(that can be done in 2d coordinate)?).
edit: take a look also at this PDF.