Earth-Moon Home-made Reference Frame Question

All about writing scripts for Celestia in Lua and the .cel system
Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 18 years
Location: Brooklyn, NY

Earth-Moon Home-made Reference Frame Question

Post #1by rbroberts » 28.03.2008, 19:56

I have this in a file in extras to define the Earth-Moon L1 point:

Code: Select all

"Moon-L1" "Sol/Earth/Moon"
{
  Class  "Invisible"
  Radius 0.001

  OrbitFrame
  {
    TwoVector
    {
      Center  "Sol/Earth/Moon"
      Primary
      {
        Axis "x"
        RelativePosition { Target "Sol/Earth" }
      }
      Secondary
      {
        Axis "y"
        RelativeVelocity { Target "Sol/Earth" }
      }
    }
  }

  BodyFrame
  {
    BodyFixed
    {
      Center  "Sol/Earth/Moon"
    }
  }

  FixedPosition [ 61272.261 0. 0 ]
}

This isn't quite right, but it's mostly good enough. I'm using in a script to show Lunar Libration. But then I realized what I really want is a point which is at a fixed distance from Earth so I can also show the changing size of the moon to the perigee/apogee distance difference. I cribbed the above definition and after a lot of trial and error have come up with this which seems to work.

Code: Select all

"LEO Moon Track" "Sol/Earth"
{
  Class  "Invisible"
  Radius 0.001

  OrbitFrame
  {
    TwoVector
    {
      Center  "Sol/Earth"
      Primary
      {
        Axis "x"
        RelativePosition { Target "Sol/Earth/Moon" }
      }
      Secondary
      {
        Axis "y"
        RelativeVelocity { Target "Sol/Earth/Moon" }
      }
    }
  }

  BodyFrame
  {
    TwoVector
    {
      Center  "Sol/Earth"
      Primary
      {
        Axis "x"
        RelativePosition { Target "Sol/Earth/Moon" }
      }
      Secondary
      {
        Axis "y"
        RelativeVelocity { Target "Sol/Earth/Moon" }
      }
    }
  }

  FixedPosition [ 7000.0 0. 0]
  RelativeVelocity { Target "Sol/Earth/Moon" }
}

I've read the page on http://en.wikibooks.org/wiki/Celestia/Reference_Frames so I didn't make this up out of the blue, but I still can't claim to understand what I've done. Can someone give me an interpretation? Let me try first...

The OrbitFrame is defining the orbital plane of my reference to be the same as that of the Moon.
The BodyFrame is just orienting my "object" the same way.
The FixedPosition is relative to the primary object which is Sol/Earth.
The RelativeVelocity was the "magic" to make it work and it was a stab in the dark.

roland
Roland B. Roberts, PhD
6818 Madeline Court
Brooklyn, NY 11220

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Re: Earth-Moon Home-made Reference Frame Question

Post #2by chris » 29.03.2008, 06:46

rbroberts wrote:I've read the page on http://en.wikibooks.org/wiki/Celestia/Reference_Frames so I didn't make this up out of the blue, but I still can't claim to understand what I've done. Can someone give me an interpretation? Let me try first...

The OrbitFrame is defining the orbital plane of my reference to be the same as that of the Moon.
The BodyFrame is just orienting my "object" the same way.
The FixedPosition is relative to the primary object which is Sol/Earth.
The RelativeVelocity was the "magic" to make it work and it was a stab in the dark.

You've got this all pretty much right. The OrbitFrame you've chosen is indeed the Moon's orbital plane. In fact, the orbital plane at a particular instant is defined by the position and velocity vectors of the object, which is why your TwoVector frame uses a RelativePosition vector and a RelativeVelocity vector.

It's also important to keep in mind that the frame you defined is rotating: the principal direction is the Earth-to-Moon vector at the current time. Here's an image that I made some time ago that depicts a TwoVector frame extremely similar to yours, except with the Sun-Earth instead of the Earth-Moon system.

--Chris

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 18 years
Location: Brooklyn, NY

Re: Earth-Moon Home-made Reference Frame Question

Post #3by rbroberts » 31.03.2008, 20:15

chris wrote:It's also important to keep in mind that the frame you defined is rotating: the principal direction is the Earth-to-Moon vector at the current time. Here's an image that I made some time ago that depicts a TwoVector frame extremely similar to yours, except with the Sun-Earth instead of the Earth-Moon system.
Well, your image didn't seem to make it with the post, but that's okay. I also have a similar frame I use for showing how the seasons work. I do want a rotating frame since I want to continuously face the Moon while maintaining a constant distance from Earth.

However, there is one part of the frame I don't quite have the way I want, which I describe here: viewtopic.php?f=9&t=12224.

Basically, I'd like to have my "vertical" axis aligned with the moon's terminator. I know that is not well-defined (mathematically speaking) at new and full moon, but from a practical standpoint, it's something which is easy to do with a photograph for comparison. My intent it to use the simulation alongside a sequence of photos I've taken in an 4th grade astronomy club.

roland
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 18 years
Location: Brooklyn, NY

Re: Earth-Moon Home-made Reference Frame Question

Post #4by rbroberts » 10.04.2008, 02:35

chris wrote:It's also important to keep in mind that the frame you defined is rotating: the principal direction is the Earth-to-Moon vector at the current time. Here's an image that I made some time ago that depicts a TwoVector frame extremely similar to yours, except with the Sun-Earth instead of the Earth-Moon system.

Actually, it doesn't seem to be rotating, at least not in 1.5.0. I have to track the moon to keep it in my field-of-view. I wish it was tracking. I'd like to do the same thing with the sun except I want to face away so I see the changing constellation through the seasons.

roland
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220


Return to “Scripting”