How do I add an orbit of the moon in relation to the sun?

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
neoniv
Posts: 7
Joined: 31.01.2006
With us: 18 years 9 months

How do I add an orbit of the moon in relation to the sun?

Post #1by neoniv » 15.02.2006, 22:02

I want to create an additional orbital path/trace for the moon
that is in relationship to the sun instead of the earth..

Or more precisely. I want both. The one orbit now shows the moon
going around the earth. It is always in reference to the Earth and
always elipitcal...even when seen from the point of the sun.

My question is:

How do I create an additional path that shows the orbit that the "moon"
leaves around the sun, instead of the "moon around the earth"??

It would be some kind of ring wave looking trace, I believe.



I am looking for some C++ code here...right now I am using..

Code: Select all

Point3d pos = body->getOrbit()->positionAtTime(t);

..to get the postitions of the moon over time.

I then create a GL_LINE_STRIP to replay the position data.

Problem is the new path stays with the earth...here is a partial
drawn path...see how it is relational to the earth...not the sun?

Image

Did I make myself clear?

Can anyone help here.

In anticipation and thanks,
neoniv

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

Post #2by selden » 16.02.2006, 09:57

Unortunately, Celestia doesn't have the feature "display orbit relative to a different coordinate system".

You'll need to include a copy of the SSC entry that you're using if you want more help.

A model like you describe would have to be defined in the SSC files as an object that is orbiting the sun.

If you do that, it should work, I think.
Selden

Topic author
neoniv
Posts: 7
Joined: 31.01.2006
With us: 18 years 9 months

Thanks Selden...a few more questions...need C++ help here.

Post #3by neoniv » 16.02.2006, 18:05

Selden / Others:

Appreciate your answer.. BUT- I knew that. :-)

I am working in C++ at the root level and trying to figure out how
to track the earth's moon from the heliocentric point of view or even
from a solar system barycentric point of view.

It appears that Celestia calculates the moon's position
relation to the earth and not in relationship to the Sun.

So a few questions for you Selden or anyone out there...

I need to, in C++, write code to show the path of the
moon in relation to the Sun (a kind of ring wave line)
This begs a few more fundamental questions:

#1 How is Celestia organized ... is the solar system model based
on sidereal ephemera? For example is the moons orbit part of sidereal
ephemera or is it calculated on Geocentric information?

#2 Galactic. When we speed up the solar system and move back a bit
and see it moving against the stars.. are those stars positions calculated
and part of another coordinate system..?

#3 What is the basic structure / hierarchy architecture of Celestia and
how does it nest or interpolate through coordinate systems or does it?

Hope some one can help me with this. Many thanks.

respect,
neoniv.

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

Post #4by selden » 16.02.2006, 21:06

(Please don't choose the colors for your text: just use the defaults. The phpbb color scheme that I use results in a white background for quotes. Yellow is almost invisible against that.)

I'll have to refer you to Celestia's source code to find out exactly how the lunar orbit is calculated.

http://cvs.sourceforge.net/viewcvs.py/c ... 8&view=log

Most planetary orbits are calculated using the VSOP87 theory with JPL's DE406 as an option. I don't see a mention of what ephemeris is used for the Lunar orbit, though.

Star positions are precalculated and their heliocentric xyz coordinates are read from stars.dat. (For historical reasons, to avoid numerical problems when stars.dat contained parallaxes, the Sun's position is slightly offset from [0,0,0].)
Selden


Return to “Development”