Page 1 of 1

Celestia xyz to Ra, Dec function?

Posted: 11.10.2007, 12:04
by selden
Has anyone written a Lua function to convert a position vector in Celestia's internal cartesian coordinate system to polar coordinates?

In particular, from x,y,z to RA, Dec, distance?
(which will be different depending on the viewpoint; e.g. the same object will have different RA,Dec, distance as the viewpoint moves around it.)

Vincent, is there one in the Lua Edu Tools?

Posted: 12.10.2007, 18:20
by Vincent
Selden,

You might want to have a look at the utils/celutil.lua file in the Lua Edu Tools package, at the '-- Return current Ra, Dec for selection' section. You'll certainly need to modify this piece of code to make it suit your needs. Let me know then if you need some more help.

Posted: 12.10.2007, 19:01
by selden
Vincent,

Thanks!

Posted: 12.10.2007, 19:50
by selden
Vincent,

The only substantive change I had to make was to change the reference to pkg.EARTH to be a reference to the viewpoint position. You might want to consider something like that for the EduTools, too, since otherwise the RA and Dec calculated for near-Earth satellites will be wrong: the observer's viewpoint isn't at the center of the Earth.