How to compute coordinates of a point that intersects an sphere 
Hi all.
Is there a way to compute the S(x,y,z), given the following information:
A(x,y,z)
e = elevation (from the line AS)
Az = azimuth (over A). Perpendicular to x axis. Can vary from 0 tp 360.
R = Radius of Earth (appr. 6378.1363)
h = height of S (in kilometers)
EARTH CENTER = origin of the system O(0, 0, 0)
Can anyone help me? I'm writing the code using python, if it is helpful.
Rgds
 A: Assuming that the angle $e$ and the point $S$ lie in the same plane as the line $x=z=0$ and the point $A$, use the law of Cosines with angle $\theta=\angle ACS$:
$$\frac {|AS|}{\cos \theta}=\frac{R+h}{\cos\left(\frac \pi 2+e\right)}=\frac{R+h}{\sin(e)}=\frac{R}{\cos\left(\pi-\frac\pi 2-\theta-e\right)}=\frac{R}{\sin(\theta+e)}$$
This is three equations with two unknowns, and in particular we can solve for $\theta$ easily as
$$\sin(\theta+e)=\frac{R\sin(e)}{R+h}\\
\theta=\arcsin\left(\frac{R\sin(e)}{R+h}\right)-e$$
We should also get the angle $\phi$ between the lines $x=z=0$ and $\vec {CA}$ as this will make other vector calculations easier.  Using the notation $A=(X_A,Y_A,Z_A)$ for the coordinates at point $A$, we get
$$\phi=\arccos\left(\frac{Y_A}{\sqrt{X_A^2+Y_A^2+Z_A^2}}\right)$$
We have assumed that $\theta$ and $\phi$ are angles in the same plane, so now we have an angle and a length of travel and we can identify the point $S$ by these...  But note that we have to use a ratio of the $X_A$ and $Z_A$ coordinates to help with this process since we cannot otherwise distinguish between them.  The $Y_S$ coordinate is direct:
$$Y_S=(R+h)\cos(\theta+\phi)$$
The other two are as follows:
$$X_S=\frac{X_A}{\sqrt{X_A^2+Z_A^2}}(R+h)\sin(\theta+\phi)$$
$$Z_S=\frac{Z_A}{\sqrt{X_A^2+Z_A^2}}(R+h)\sin(\theta+\phi)$$
