Malenfant wrote:The reason I'm asking is that I'm trying to figure out how to calculate the planetocentric latitude of the sub-observer point (from this I can know the tilt of the rings relative to the observer), and for that I need to know how the orientation of the planet in space is defined.
Can anyone help?
Since you are referring to the sub-observer point, I assume you are working on a celx script. If not, just ignore the following as the rantings of a misguided fool
You should not need to bother with the information in the ssc file. The latitude and longitude can be calculated from information available within celx. The following code (taken from the Celx Visual Guide) should demonstrate:
Code: Select all
u_pos = celestia:getobserver():getposition()
e_frame = celestia:newframe("planetographic", celestia:find("Earth"))
e_pos = e_frame:to(u_pos)
lng = math.atan2(e_pos.z, -e_pos.x);
lat = math.pi / 2 - math.atan2(math.sqrt(e_pos.x * e_pos.x + e_pos.z * e_pos.z), e_pos.y)
celestia:flash("We are over lat " .. math.deg(lat) .. ", long " .. " .. math.deg(lng), 10)
wait(5)
What is it doing?
Code: Select all
u_pos = celestia:getobserver():getposition()
The first line simply gets the oberserver's position expressed in universal coordinates (an X-Y-Z coodinate system centered on a point about 200 au from the Sun).
Code: Select all
e_frame = celestia:newframe("planetographic", celestia:find("Earth"))
Now we generate a new object that represents a coordinate system centred on Earth, aligned with Earth's poles and equator and rotating as Earth rotates (sound familiar - that's exactly what the latitude-longitude system is - the only difference is that the "planetographic" system is an X-Y-Z coordinate system, not an Angle-Angle system).
Now we convert the XYZ position in the universal coordinates to an XYZ position in the planetographic coordinates (ie. convert "how far X-wise, Y-wise and Z-wise are we from that point 200 au from the sun" to "how far are we X-wise, Y-wise and Z-wise from the centre of the Earth"). We now know where the observer is relative to the Earth.
Code: Select all
lng = math.atan2(e_pos.z, -e_pos.x);
lat = math.pi / 2 - math.atan2(math.sqrt(e_pos.x * e_pos.x + e_pos.z * e_pos.z), e_pos.y)
A little trig and we have the observer's latitude and longitude.
Code: Select all
celestia:flash("We are over lat " .. math.deg(lat) .. ", long " .. " .. math.deg(lng), 10)
wait(5)
Voila!