I'd like to calculate the x, y, z distance to an object given its spherical coordinates theta and phi and it's altitude above the earth. My origin is on the surface of the earth so I don't know the rho coordinate of the object.
I think I can do that using the x, y, z formulas listed here but I am not sure how to calculate the distance that the object is from me (rho). How should I approach this? I'd like to assume the earth is a simple sphere for this exercise.
I took a look at this MATLAB page and it mentions a "broadside" formula but I am not sure how my angles line up with the angles that it mentions.
Example:
Altitude = 100
Theta = 30deg
Phi = 30deg
I've thought about trying to make a triangle with one side being radius of the earth, the second side being radius of earth + altitude and the third side being rho. I am not sure how to calculate the angles of that triangle.
I think I figured it out.
You can calculate rho by considering a triangle:
The central angle would be 180 - theta and the two sides would have length of radius of the earth and radius of the earth + altitude. The third side can be figured out with the law of sines.
Once you have rho, you can calculate x, y, z based on how the the spherical coordinate system is specified (directions of +x, +y, +z).