Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Astronomy related maths

  1. Jul 28, 2008 #1
    Hi, I couldn't decide whether this was more maths or more astronomy, but I settled for maths. Sorry for the long description, I think the answer is quite simple, and I'm making a meal of it!

    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.

    Attached Files:

  2. jcsd
  3. Jul 30, 2008 #2
    If your initial position is the zenith (your line of sight?), you would have to subtract some value. You would also have to specify an azimuth direction in accordance, so that you know which of the infinitely many directions that you desire for your new line of sight. It's like standing exactly on the north pole of the earth.

    When you change coordinates to A and say that the other coordinates are changing, you are talking about the "relative" coordinates to your line of sight; the Alt/Az coordinates should not change value at all unless you have moved to a new location on earth or a significant time interval has passed.

    It's really difficult for me to say anything else. I'm not familiar with your program. Do you have a workable version currently online? What portion of the sky is visible in your program, a small-portion or the whole local sky? Does your program permit the user to change locations on earth or viewing time?
    Last edited: Jul 30, 2008
  4. Aug 8, 2008 #3
    Hi, just a note to say that I solved (well got around!) this problem, by converting everything into Cartesian (xyz) coordinates, then applying the transformations that can be seen in the attached image. I found these formula in an old games programming book, and I even though this clearly isn't the native coordinate system of astronomy, I actually understand it, so it makes it a great deal easier for me to work with.

    Alpha, beta and gamma refer to rotations around the z, x and y axis respectively. Remember that the order that you do them in makes a huge difference to the outcome!

    Thank you for your response, If I hadn't have done it this way I may well have been working with you to figure it out.

    Attached Files:

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook