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

How to calculate the position of stars

  1. Nov 25, 2008 #1
    Hi all, hope everyone is doing well this rainy cold night. Hopefully it's not like that wherever you are. Anyhow - I hope someone can help me out.

    I'm writing some software for a mobile device to create star maps. I've gotten pretty far into it. I'm using data from the Yale bright star catalog that has the right ascension and declination of stars, then taking into account a users local time/date and geographic location (using the gps on the device), and from that info, calculating MST (mean sidereal time) and using that calculating what the Altitude and Azimuth of a star should be from your observation point on Earth. I've verified my calculations of alt + az are correct using some static star charts, but what I'm wrestling with now is how to map the star onto a plane in order to display it in on a screen, with minimal distortion.

    Right now, I'm using a simple map to put stars onto the 2d drawing surface. So, if for example my intended vertical and horizontal FOVs are 90 degrees, I want to only display stars with an Altitude 0-90 (0 being the local horizon) and I can easily figure out that:

    Altitude / verticalFOV = y / heightOfScreen
    Azimuth / 360 / horizontalFOV = x / widthOfScreen

    The problem arises as Altitude approaches the zenith (90) and because of this very linear mapping, the distances between the stars on screen is stretched and warped (makes drawing of constellations look pretty dumb).

    Anyhow, anyone know any way to project a star's location to 2d space given it's altitude and azimuth that minimizes the distortion at the zenith? Welcome to hear about any other ways of calculating or doing this type of thing. Many thanks in advance!
  2. jcsd
  3. Dec 16, 2008 #2
    Have you had a look at the program stellarium? Its free to download and might give you some ideas. Sorry I cant be of more help.

    P.S. I have been waiting for an application to arrive like this for my iphone, makes perfect sense with the GPS facility. Will this app be available for iphone?
  4. Dec 16, 2008 #3
    Hi! I did find Stellarium, thanks. They are doing things in a much more 3d way than I had anticipated, but the good news is that plain old polar coordinates are working out pretty well for me.

    The good news for you is that there are already several iPhone apps like this:




    Haven't used either, but they look cool. Later
  5. Dec 16, 2008 #4


    User Avatar
    Science Advisor
    Homework Helper

    It is a general problem of mapping a large sphere onto a small rectangle.
    Obvious solutions are to show the pole in the centre, but this wastes screen space, show north/east/south/west views but this goes wrong at the pole

    Could you use the tilt sensor to show a smaller window that changes as you raise the device (so the tilt becomes the azimuth) - the unit would then be simple window onto the stars in front of you?
    The GPS might not be good enough to give you the compass heading.
  6. Dec 16, 2008 #5
    Thanks mgb_phys,

    That's a pretty good idea too. The tilt sensor and compass are sensitive enough to do what you suggest. I'm already getting the compass heading and using that. (There's a digital compass in the device, don't need the gps for that) I think maybe a 30 degree swath of altitude might look pretty good on the device...Food for thought....
  7. Dec 16, 2008 #6


    User Avatar
    Science Advisor
    Homework Helper

    Translating star charts into what you see in the sky is difficult with paper charts.
    People have tried printing them reversed so looking down is the same as looking up.
    Holding them up at arms length is tricky.

    A phone screen that you could hold up in front of you and became effectively a Head Up Display with star names could be interesting. You would set the scale for the screen size held a comfortable distance (8-12") in front of you.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook