Celestia xyz to Ra, Dec function?

All about writing scripts for Celestia in Lua and the .cel system
Avatar
Topic author
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Celestia xyz to Ra, Dec function?

Post #1by selden » 11.10.2007, 12:04

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?
Selden

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #2by Vincent » 12.10.2007, 18:20

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.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Topic author
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #3by selden » 12.10.2007, 19:01

Vincent,

Thanks!
Selden

Avatar
Topic author
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #4by selden » 12.10.2007, 19:50

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.
Selden


Return to “Scripting”