How to calculate positions of stars?
November 19, 2008 4:11 PM   Subscribe

How do I calculate x,y values for a celestial body using a gnomonic projection?

OK, I'm writing some software displays constellations, stars, and other celestial bodies. I have delved into the domain enough that I have a semi-working program. I am able to display the correct stars, at the correct point in time, at a given lat/lng on the Earth. (Sidenote: geez, Mean Sidereal Time is some wacky stuff)

My problem arises though when, given horizontal and vertical field of views, mapping the calculated Altitude and Azimuth (which I've verified is correct) to X,Y points on a 2d screen. Right now, as Altitude of stars increase, there is significant weirdness about what happens to the constellations higher in the sky because right now, I am just mapping straight to the screen using a standard ratio of screen size and fov

I've looked around a bit, and found there are different projections (I think I'm on the right track) that can be used to do this, the most common of which is a Gnomonic Projection (also known as a tangential projection?) but I am not really sure how to apply this to celestial bodies...Maybe I need a geometry lesson...

Any help on where to find equations to calculate these projections would be much appreciated, or advice on what routes to explore...
posted by zackola to Science & Nature (7 answers total)
 
I don't fully understand what you're doing (it's been a while since I've looked at Altitude and Azimuth), but a Gnomonic Projection may be helpful. Have you inspected the recipe at Mathworld?
posted by onalark at 5:16 AM on November 20, 2008


I'm not sure quite where you're at with visualising it inside your head - you're trying to project the inside of a sphere onto a flat screen, right? So you know that what you're looking at should be curved, effectively the FOV at the horizon is less than at altitude? Or is it just the maths/programming that you're having the problem with?

If you're not entirely sure about what it should be doing, and you haven't already done so, having a look at something like Stellarium with the azimuthal grid turned on might help visualise it.

If you're way beyond that, sorry I can't help, and good luck!
posted by Lebannen at 10:32 AM on November 20, 2008


Response by poster: I think it's just the math and programming I'm taking issue with at this point. I've got the visualization down OK.
posted by zackola at 4:58 AM on November 21, 2008


Hi zack, I'm happy to help, but I don't have enough information from you to give you more advice on this.
posted by onalark at 7:18 AM on November 21, 2008


Best answer: Look at the mathworld link above for the gnomonic projection, I don't think I would use that for a planeterium-type display. The distortion there would mangify shapes near the horizon, where trees make it so you can't see them in real space.

To fit a whole hemisphere of the sky in a circle on a the screen, I'd probably use dumb polar coordinates. Use the zenith angle (90° minus altitude) as the radial angle, and the azimuth angle (bearing from north, or whatever the convention is) as the angular coordinate. To look away from the zenith without distortion, redefine "zenith," maybe putting a horizon to block things that are not visible from your hemisphere.

If you're currently using altitude and azimuth as rectangular coordinates, you're using a cylindrical projection, which will have distortions near the poles. Cylinder projections work for maps of the world, since no one lives at the poles. For a map of the sky you want continuity at the pole but can tolerate weirdness at (or below) the horizon.
posted by fantabulous timewaster at 10:13 AM on November 21, 2008


Response by poster: Hm,

In those mathworld links, does anyone know what they mean by 'central latitude' and 'central longitude'? I think I'm not too concerned about the distortion close to the horizon, as much as I am about distortion at the poles.
posted by zackola at 5:48 PM on November 23, 2008


The mathworld example of a gnomonic projection uses a central location of lat.0, long.0, which puts the smallest distortion in the ocean off Africa. Note which two lines are straight: the meridian through London and Paris, and the equator.

To put the minimum distortion at the pole, I guess you would use a central location lat. 90, long. anything.
posted by fantabulous timewaster at 6:40 PM on November 23, 2008


« Older "I did this on a blog for a year and I got famous...   |   Name that bizarre late 80s medical reality show. Newer »
This thread is closed to new comments.