Hi, I'm not sure if this should be in the High School forum, but here goes:
I am currently writing some planetarium software for use on my website. I have calculated the Alt/Az of lots of objects, and used the conversion to spherical polars to plot them onto a cartesian xy plane (the screen!) with r=1. For those of you who are not sure, Alt is the altitude of the object above the horizon (0-90 deg) and Az is the azimuth (0-360 deg) measured East from North. The zenith (directly up) is at (0,0).
This all works fine. My problem is that I want to move my viewpoint around within the 'celestial sphere'. I can zoom in and out with no problem, and I can add small amounts to the the Azimuth of each object in order to rotate the 'sky'. What I cannot do is change the Alt of the point at which I am looking, the default is to look straight up at the zenith.
I assume to accomplish this, I need to add or subtract a certain value from the Alt and Az of each object. I cannot get my head around how to do this.
I have attached an image as an example. The circle shows a bottom-up view of a hemisphere. Firstly my viewpoint is centered on the zenith (0 deg, 0 deg). Here, A is at (20 deg, 0 deg) B is at (20 deg, 90 deg) C is at (20 deg, 180 deg) and D is at (20 deg, 270 deg). If I was to move my viewpoint to X (10 deg, 0 deg), then clearly A would become(10 deg, 0 deg) and C would be (30 deg, 180 deg). How would I find the apparent Alt/Az of B and D, and is there a generalised form of this that I could use using any offset to any initial position?
I might be making this much harder than it actually is, so if you can help or you have any questions, please give me a shout.