Page 1 of 1

X,Y,Z Coords

Posted: 05.10.2005, 14:03
by bigtim
Is there a way to select an object and get it's X,Y,Z coordinates where the Sun is 0,0,0?

Posted: 05.10.2005, 14:13
by selden
No.

Sorry.

Posted: 05.10.2005, 16:42
by Malenfant
Not within Celestia.

However, there is this Mapping Page that contains Excel spreadsheets to figure it out given J2000 RA/Dec and parallax to the star.

Posted: 06.10.2005, 12:22
by cpotting
Try this script:

Code: Select all

function celestia_keyboard_callback(input)
   local response = false
   if input == "1" then
      factor = AU_PER_uLY
      units  = "AU"
      response = true
   elseif input == "2" then
      factor = 1 / 1000000
      units  = "LY"
      response = true
   elseif input == "3" then
      factor = 1 / 3262000
      units  = "pc"
      response = true
   end
   return response
end -- celestia_keyboard_callback()

celestia:flash("Solar Coordinates - C. Pottinger\n" ..
               "select an object and press a unit of scale:\n" ..
               "1=AU 2=LY 3=pc", 4);wait(4)
KM_PER_AU     = 149597870.7
KM_PER_uLY    = 9466411.842
AU_PER_uLY    = (KM_PER_uLY / KM_PER_AU)
POS_SOL       = celestia:find("Sol"):getposition()

selected = celestia:getselection()
units = ""
celestia:requestkeyboard(true)

while true do
   selected = celestia:getselection()
   if selected ~= nil and units ~= "" then
      d = selected:getposition():distanceto(POS_SOL)
      x = selected:getposition():getx() - POS_SOL:getx()
      y = selected:getposition():gety() - POS_SOL:gety()
      z = selected:getposition():getz() - POS_SOL:getz()
      celestia:flash("For " .. selected:name() .. " (d = " .. d * factor / KM_PER_uLY .. " " .. units .. ")\n" ..
                     " X = " .. x * factor .. " " .. units .. "\n" ..
                     " Y = " .. y * factor .. " " .. units .. "\n" ..
                     " Z = " .. z * factor .. " " .. units, 5)
   end
   wait(1)
end

Posted: 06.10.2005, 16:11
by Malenfant
I copied the script into a text file, saved it as xyz.cel, and then tried to open it, but got an error message saying "{ expected at start of file".

Posted: 06.10.2005, 16:58
by selden
It needs to be type .CELX not .CEL

Posted: 06.10.2005, 17:54
by Malenfant
OK, got it now - thanks Selden.

But what are the X=0, Y=0, and Z=0 axes? What's the coordinate reference frame?

The script claims that Alpha Centauri A is at:

X = -1.63 ly
Y = -2.95 ly
Z = 2.76 ly

In galactic coordinates (where +X is toward the galactic core, +Y is to spinward, and +Z is determined by galactic latitude), I figure (using the spreadsheet above) that it is at:

X = 3.12 ly
Y = -3.04 ly
Z = -0.05 ly

In equatorial coordinates (where RA 0 is +X, RA 6h is +Y, RA 12h is -X, RA 18h is -Y. +Dec is +Z, and -Dec is -Z), I figure that it is at:

X = -1.63 ly
Y = -1.36 ly
Z = -3.81 ly


The X coordinate in the script seems to agree with the equatorial coordinates, but the Y and Z don't. The same applies with other stars - X agrees but Y and Z don't. Which one is incorrect?

Posted: 06.10.2005, 17:58
by selden
You left out one coordinate system :)
Ecliptic

Posted: 06.10.2005, 20:10
by Malenfant
selden wrote:You left out one coordinate system :)
Ecliptic


Yeah, that's because I hadn't figured that one out! What is ecliptic anyway? It's apparently not RA/Dec or galactic lat/lon, and I can't recall hearing any other way to locate a star in the sky.

(I presume the coords in the script are ecliptic then?)

Posted: 06.10.2005, 22:32
by buggs_moran
What you have so far is very neat.

Posted: 07.10.2005, 03:00
by selden
Ecliptic is relative to the plane of the planetary orbits around the sun.

It's essentially the same as Equatorial, but does not include the 23.5 degree rotation due to the tilt of the Earth's axis.

Posted: 07.10.2005, 03:07
by Malenfant
selden wrote:Ecliptic is relative to the plane of the planetary orbits around the sun.

It's essentially the same as Equatorial, but does not include the 23.5 degree rotation due to the tilt of the Earth's axis.


Odd. When we see stars from Earth's surface then we're seeing them in the Equatorial frame by default. What do we gain by measuring them relative to Earth's orbit?

Are ecliptic coords still measured as RA/Dec? If so, how do you tell them apart from equatorial?

Posted: 07.10.2005, 03:53
by cpotting
Malenfant wrote:Odd. When we see stars from Earth's surface then we're seeing them in the Equatorial frame by default. What do we gain by measuring them relative to Earth's orbit?

Are ecliptic coords still measured as RA/Dec? If so, how do you tell them apart from equatorial?


Sorry I wasn't around earlier to answer some these questions (thanks Selden for jumping in).

Okay... the original request was to obtain the coordinates of objects relative to the Sun, not the Earth. It wasn't stated what the desired orientation of the frame of reference should be. So I was left on my own to guess.

I assumed that equatorial would be useless. It is only of use in giving relative locations when the origin is the Earth - in this case Sol is the origin.

Eliminating a galactic oriented system was also a no-brainer since the origin is some 34 or so pc above the galactic plane.

That left ecliptic as the only logical orientation for the frame of reference. And fortunately, Celx's "default" frame of reference is "universal" which is neatly aligned with the ecliptic.

I did consider giving the option to re-orient the X axis to be aligned toward the galactic centre, but I wanted to provide bigtim with something quickly that met his specified needs (and I still had to shower and get to work this morning too).

There. Now you have the rational for using the ecliptic frame of reference. What is the ecliptic frame of reference? Well...

***EDIT***
I originally had posted a long-winded explanation of coordinate systems here before I reread and saw that you (Malenfant) already know about the need to define the X Y and Z. So I removed it. Here is the shorter version.
***EDIT***

The ecliptic frame of reference means that the ecliptic plane also defines the X-Z plane. The X axis points "horizontally" towards the vernal equinox and the Y axis points "upward" 90 degrees to the X-Z plane. The Z axis is 90 degrees to the X-Y plane (so it points to the summer solitce point - or may the winter one...). Place the Sun at the origin and you have the coordinate system used by the script.

Also remember, bigtim was looking for a way to describe an object's position relative to the Sun, hence X Y Z coordinates. RA/Dec tells you tje direction to an object, not the position of the object. It is the difference between having someone tell you that you have to "go three blocks east and two blocks north" and someone else pointing and saying that "its that way". "that way" doesn't tell WHERE it is, just in what direction it lays.

Hope that helps.

BTW: Bigtim? Is this what you wanted? I really didn't have much time this morning. If not, let me know and I'll see what I can do.

Posted: 07.10.2005, 07:23
by Malenfant
cpotting wrote:Eliminating a galactic oriented system was also a no-brainer since the origin is some 34 or so pc above the galactic plane.

Eh? I thought the origin for galactic coordinates was the Sun? (at least, that's how the spreadsheet calculates them)


Also remember, bigtim was looking for a way to describe an object's position relative to the Sun, hence X Y Z coordinates. RA/Dec tells you tje direction to an object, not the position of the object. It is the difference between having someone tell you that you have to "go three blocks east and two blocks north" and someone else pointing and saying that "its that way". "that way" doesn't tell WHERE it is, just in what direction it lays.


Well you also need the parallax so you can calculate the distance. But you need that for any coordinate system.

Posted: 08.10.2005, 01:06
by rthorvald
cpotting wrote:Try this script

... Trying to run this in OSX returns a "fatal error", whereupon Celestia tries to quit (dirkpitt??s latest unofficial version).

Other CELX-scripts works fine...

- rthorvald

Posted: 10.10.2005, 14:44
by cpotting
rthorvald wrote:... Trying to run this in OSX returns a "fatal error", whereupon Celestia tries to quit (dirkpitt??s latest unofficial version).

Other CELX-scripts works fine...


Unfortunately, I don't have OSX, so I can't debug it. I can't imagine what would be causing the problem... the script is not doing anything complicated.

If you happen to figure it out, please let me know, so I can avoid building the same bug into future scripts.

Posted: 10.10.2005, 15:00
by cpotting
Malenfant wrote:Eh? I thought the origin for galactic coordinates was the Sun? (at least, that's how the spreadsheet calculates them)

That depends on which "galactic coordinates" you are talking about:

One can define the "galactic coordinates" of an object to mean that object's position in the sky described as angular separations for axes aligned with centre of the Milky Way and a line normal to plane of the Milky Way (as is done here http://en.wikipedia.org/wiki/Galactic_coordinates). Such a system would have its origin at Earth.

It could also be defined as a coordinate system based on distances or angles measured from axes with their origin at the centre of the galaxy.

It could probably be defined many other ways too. Obviously you have run across one where the origin has been set to the Sun.

I was referring to the second type - based on the centre of the galaxy.

Malenfant wrote:
Also remember, bigtim was looking for a way to describe an object's position relative to the Sun, hence X Y Z coordinates. RA/Dec tells you tje direction to an object, not the position of the object. It is the difference between having someone tell you that you have to "go three blocks east and two blocks north" and someone else pointing and saying that "its that way". "that way" doesn't tell WHERE it is, just in what direction it lays.

Well you also need the parallax so you can calculate the distance. But you need that for any coordinate system.


Not really. X Y Z coordinate systems do not need to specify a parallax or distance. That is only required for systems that only indicate direction (like RA/Dec). Unless you mean that you need parallax to figure out the distance in the first place - which is only partially true.

Posted: 10.10.2005, 16:10
by selden
The IAU's galactic coordinate system currently used by astronomers is centered on the Earth/Sun, with coordinates l2 and b2 on the sky.

One summary of astronomical coordinate systems is at
http://www.ess.sunysb.edu/fwalter/PHY515/coords.html

Accept no substitutes. :)

Posted: 13.10.2005, 22:01
by cpotting
selden wrote:The IAU's galactic coordinate system currently used by astronomers is centered on the Earth/Sun, with coordinates l2 and b2 on the sky.

One summary of astronomical coordinate systems is at
http://www.ess.sunysb.edu/fwalter/PHY515/coords.html

Accept no substitutes. :)

Okay. I was unaware that the IAU had an "official" definition for the term "galactic coordinate" - so I may have cause some confusion by using that term (acutally, looking at it again, I see that Malenfant introduced the term "galactic coordinates", but why quibble).

But the original post does say
Eliminating a galactic oriented system
. I was simply talking about an X Y Z system where the X-Z plane would be aligned with the "equator" of the galaxy. I was saying, that I realised that that is not what bigtim wanted since the an X-Z plane aligned with the "equator" of the galaxy and with the Sun at the origin would result in the X-Z plane being some 34 or so parsecs "above" of the galaxy's "equator" and thus not a very useful "galactic oriented system".