I'm trying to make a little application to draw ground station coverage circles (before anyone suggests using other software, I enjoy making these kinds of things myself!)
I already have code that converts the lat and long coordinates of a point on the surface to points on a Mercator projection map so now I'm drawing the 'circles' around these.
I also have the equation to calculate the slant range (maximum distance between the satellite and the ground station at minimum elevation).
Here's what I do currently:
Convert lat, long and Re of ground stations (spherical coords) to x1, y1, z1 (Cartesian coords)
Convert elevation, azimuth and slant range (spherical coords) to x2, y2, z2 (Cartesian coords) in ground station centred reference frame
Translate x2,y2,z2 from part 2 to Earth centred (x2+x1, y2+y1, z2+z1) lets call these x3, y3, z3
Rotate x3, y3, z3 to align with earth centred reference frame lets say x4, y4, z4
Convert x4, y4, z4 to spherical coordinates and then plot the lat and long that I've found.
To my eye the above should give me the correct points to plot however there is an error somewhere. I know I step 1 is correct (the magnitude of the vector is Re). I know step 2 is correct since the magnitude of the vector is the slant range. But here's where I hit a problem.... No idea where the problem is though.