PDA

View Full Version : Computing Where Something Is



dartmanx
2011-Sep-30, 12:01 AM
I'm trying to write something in Java, but don't know where to start. Here's what I want to do:

1. I decide I want to look at M31 tonight.
2. I put in my coordinates.
3. Computer figures out where M31 is, and if it's not below the horizon, tells me the direction and angle to point my scope.

I realize NASA puts out data for the moon and planets, but that's not all there is to look at... I've looked at the SPICE stuff and am unsure that it can help (for more than the moon and planets, that is). I have no idea how the commercial products do it, frankly.

Can anyone point me in the right direction to get started?

Jason

Jeff Root
2011-Sep-30, 05:43 AM
Start by writing out a more detailed description of what you
want the program to do.

-- Jeff, in Minneapolis

jfribrg
2011-Oct-01, 01:53 AM
If you want to know where to look in the sky for a particular object you would need to provide more info such as:
1)your latitude and longitude.
2)the current time
3) the object you're looking for.
4) a database of objects along with their celestial coordinates. If you want to locate planets, comets, and asteroids and other objects in the Solar System, then the database needs to somehow have enough information to determine where the object is at any specific time.

Then the program would convert the celestial coordinates to a usable measure such as "x degrees west and y degrees above the horizon.

However, there are plenty of viewing aids that will allow you to locate these objects in the sky without the need to write a program.

kamaz
2011-Oct-01, 09:20 AM
The magic Google keywords you are looking for are ephemeris calculation. I am not sure why you want to write your own ephemeris code, since such things are freely available, unless this is supposed to a self-education project. Anyway...

This is a two-part problem. For fixed objects (stars, nebulae, etc.) you start with the (Right Ascension, DEClination) coordinates of the object (you take that from a catalog) and calculate object's (AZimuth, ELevation) at the observer's location (LONgitude and LATitude) at the specific TIME. For planets, you have to first calculate where the planet currently is on the celestial sphere (RA, DEC) and plug that into the step above. There are separate algorithms for that.

This page (http://www.aphayes.pwp.blueyonder.co.uk/ephemeris/index.html) contains ephemeris calculation done in JavaScript. Start with a function radtoaa() in observer.js, which does the (RA, DEC)->(AZ, EL) conversion.

Jeff Root
2011-Oct-01, 09:39 AM
I'm accustomed to thinking in terms of a polar-aligned telescope.
If you have the right ascension and declination, there's nothing to
calculate. Just set the RA and Dec on the scope's setting circles.

-- Jeff, in Minneapolis

TonyE
2011-Oct-01, 04:23 PM
"Astronomy on the Personal Computer" by Montenbruck and Pfleger, Springer, (Currently 4th Ed, 2009) will tell you everything you need to know
(although the code is in c++).