BodyFrame Vector alignment problem

Report bugs, bug fixes and workarounds here.
Avatar
Topic author
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

BodyFrame Vector alignment problem

Post #1by selden » 01.06.2008, 14:07

I'm not sure if this is a bug or my misunderstanding.

I'm trying to align an object so that it is perpendicular to the Earth's surface at the current position and with its X axis aligned with the Earth's polar axis -- pointed toward the North pole.

Here's the SSC definition:

Code: Select all

"clock_position" "Sol/Earth"
{
   Radius 0.0001
   Color [ 0 1 0]

   OrbitFrame {BodyFixed{Center "Sol/Earth"}}

#   LongLat [   -116.863800000000     33.355950000000      1.757175514351]

   FixedPosition [ -2407.995293963999 -4753.859694051927 3507.914571886229]

 }

# make perp to surface & 0 -> N.
Modify "clock_position" "Sol/Earth"
{
    BodyFrame
    {
        TwoVector
        {
            Center "Sol/Earth/clock_position"
            Primary   
            {
                Axis "-z" # down
                RelativePosition {Target "Sol/Earth"}
            }
            Secondary   
            {
                Axis "x"
                ConstantVector   
                {
                    Vector [ 0 0 1] # align my X with Earth's Z so 0 is toward north
                    Frame {  BodyFixed { Center "Sol/Earth" } }
                }
            }
        }
    }
}


However, when I inspect the object's orientation, its longitude of 0 degrees points about 20 degrees west of North.

This URL takes you to the viewpoint shown in the image below:
20deg
It's looking down from above the object, toward the Earth's center.

The image was captured using Celestia built from svn so that the object's "planetographic grid" can be seen. The same problem can be seen in v1.5.1, although without the grid.

Instructions to reproduce this viewpoint:
+ Create an SSC using the code shown above.
+ Start Celestia using the URL provided above.
+ Right-Mouse-Button click on the green sphere and select Reference Vectors/ Show Body Axes
+ If you're running an svn version of Celestia,
___+ Right-Mouse-Button click on the green sphere and select Reference Vectors/ Show Planetographic grid
+ Right-Mouse-Button click on the Earth (the grey background) and select Reference Vectors/ Show Body Axes
+ Type Ctrl-W (Wire Frame view) so the Earth's axes are visible.

What am I doing wrong?
Selden

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Re: BodyFrame Vector alignment problem

Post #2by Chuft-Captain » 01.06.2008, 16:56

Selden,

The only way I've managed to do this is with a bit of a hack, as follows:
(I've just done this for the Z-axis, but I'm sure you can make the appropriate transforms for your X-axis pointing).

As you can see, it involves the use of the old "Orientation" command, which appears to have the affect of rotating the mesh itself within the bodyframe. If you only care about the mesh alignment, then this hack may work for you, but if it's essential for you to move the bodyframe itself, I'm sorry, I've tried various strategies in the last couple of hours, with no success.
Hope this helps though.

Note also that I'm not using the latest SVN version that you are, but a somewhat dated one ( possibly svn-r4201 )

CC

Code: Select all

    "clock2" "Sol/Earth"
    {
   Class "Spacecraft"
   Mesh "58casual-man.cmod"
       Radius 500.0001
       Color [ 0 1 0]

       OrbitFrame {BodyFixed{Center "Sol/Earth"}}

    #   LongLat [   -116.863800000000     33.355950000000      1.757175514351]

       FixedPosition [ -2407.995293963999 -4753.859694051927 3507.914571886229]

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

   FixedRotation
   {
      Inclination    0
      AscendingNode   63.1362   # 180+long ( longitude = -116.8638 )   
      MeridianAngle    0
   }

Orientation   [ 56.64405 0 0 1 ]  # 90 - lat   
    }

   
   # make perp to surface & 0 -> N.
    Modify "clock2" "Sol/Earth"
    {
        BodyFrame
        {
            TwoVector
            {
                Center "Sol/Earth/clock_position"
                Primary   
                {
                    Axis "-z" # down
                    RelativePosition {Target "Sol/Earth"}
                }
                Secondary   
                {
                    Axis "x"
                    ConstantVector   
                    {
                        Vector [ 0 0 1] # align my X with Earth's Z so 0 is toward north
                        Frame {  BodyFixed { Center "Sol/Earth" } }
                    }
                }
            }
        }
   
}


test1.jpg
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

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

Re: BodyFrame Vector alignment problem

Post #3by chris » 01.06.2008, 18:04

You forgot to fix the rotation. Just add this line:

Code: Select all

FixedRotation {}


I wish that fixed rotation was the default, but this wasn't possible because of backward compatibility requirements. The default rotation is synchronous rotation about a fixed axis.

Celestia 1.6.0 allows you to simplify this definition somewhat. It is no longer necessary to use Modify to create self-referential frames.

Code: Select all

"clock_position" "Sol/Earth"
{
   Radius 0.0001
   Color [ 0 1 0]

   FixedPosition [ -2407.995293963999 -4753.859694051927 3507.914571886229]
   FixedRotation {}

   OrbitFrame {BodyFixed{Center "Sol/Earth"}}

    BodyFrame
    {
        TwoVector
        {
            Center "Sol/Earth/clock_position"
            Primary   
            {
                Axis "-z" # down
                RelativePosition {Target "Sol/Earth"}
            }
            Secondary   
            {
                Axis "x"
                ConstantVector   
                {
                    Vector [ 0 0 1] # align my X with Earth's Z so 0 is toward north
                    Frame {  BodyFixed { Center "Sol/Earth" } }
                }
            }
        }
    }
}


I think that this reference frame is useful enough for orienting surface objects that we need to have some easier way to create it--the two vector frame works, but it's complicated. Also, there should be a simple form of FixedPosition that lets you specify the latitude, longitude, and altitude of an object (with an option for how the altitude should be interpreted: relative to the surface, or relative to the center.) Together, these features would make it much easier to position and orient objects on the surface of planets.

--Chris

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

Re: BodyFrame Vector alignment problem

Post #4by selden » 01.06.2008, 18:30

Chris,

Thanks!

That fixed it.
*ahem*
Selden

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Re: BodyFrame Vector alignment problem

Post #5by Chuft-Captain » 02.06.2008, 12:52

CC wrote:I've tried various strategies in the last couple of hours...
..except the obvious one! :roll: :oops:
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

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

Re: BodyFrame Vector alignment problem

Post #6by selden » 02.06.2008, 12:56

CC,

Sometimes the most obvious things are the things least likely to be tried!

fwiw, I made use of this fix in my Sidereal Clock Addon.

viewtopic.php?f=6&t=12471
Selden

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Re: BodyFrame Vector alignment problem

Post #7by Chuft-Captain » 02.06.2008, 15:04

fwiw, I made use of this fix in my Sidereal Clock Addon.
So I see...(already downloaded!)

:lol:
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS


Return to “Bugs”