Does MeshCenter command work with 1.5.x ReferenceFrame code?

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
Topic author
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #1by Chuft-Captain » 10.01.2009, 10:55

I have a mesh for which I want the "origin" to be at the outer edge of the mesh (along the X-axis), so that point is treated as the center of the mesh for the purposes of orientation.

Assuming the radius of the mesh in Celestia is 0.0015, I would have thought that one of the following statements would have done the job:

Code: Select all

MeshCenter [ 0.0015 0 0 ]
or

Code: Select all

MeshCenter [ -0.0015 0 0 ]


However, this seems to have no effect.... It appears that reference and body frames are always centered on the center of the bounding box, and this cannot be changed by the MeshCenter statement.

This is how it's orientation is handled:

Code: Select all

BodyFrame {
    TwoVector {
        Center "Sol/Earth/GLOBALSTAR M002/GLOBALSTAR M002 Panel LHS"
        Primary {
            Axis "y"
            RelativePosition { Target "Sol" }
        }
        Secondary {
            Axis "-x"
            RelativeVelocity { Target "Sol/Earth" }
        }
    }
}

FixedRotation {}

The trouble is, this BodyFrame code seems to always act on the ceter of the bounding box (regardless of whether a MeshCemter statement is used or not)

Anyone have any ideas???

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

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #2by selden » 10.01.2009, 14:24

1. modify your mesh to include invisible elements such that the center of them all is at the desired center.

2. use Celestia v1.6 and the directives NormalizeMesh and MeshScale.
See http://www.celestiaproject.net/forum/viewtopic ... 10&t=12520
Selden

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #3by Chuft-Captain » 10.01.2009, 14:42

selden wrote:1. modify your mesh to include invisible elements such that the center of them all is at the desired center.
Thanks Selden, but that's actually exactly how I currently manage it (see: http://www.youtube.com/watch?v=jeX9miuSDZc ).
I was actually looking for a more elegant method as I'm sick of all the *un-nescessary* messing around with meshes. :wink:

selden wrote:2. use Celestia v1.6 and the directives NormalizeMesh and MeshScale.
See http://www.celestiaproject.net/forum/viewtopic ... 10&t=12520
Perhaps this is the more elegant method I'm looking for. Why does it always have to be in the *next* version! :lol:

I still wonder why MeshCenter doesn't do what the documentation claims it does.
Maybe it only worked with 1.4.x, or maybe it was broken in some SVN builds. (The build I'm using for this is fairly old ( svn4382 ).

AHA! Just found this thread which does seem to confirm that there was a bug prior to svn 4383: http://forum.celestialmatters.org/viewt ... 5d8bd905c7

Damn it!!
"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
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #4by Chuft-Captain » 10.01.2009, 15:03

Chuft-Captain wrote:
selden wrote:2. use Celestia v1.6 and the directives NormalizeMesh and MeshScale.
See http://www.celestiaproject.net/forum/viewtopic ... 10&t=12520
Hmm, I just read that thread Selden, and although these new directives would help with positioning objects relative to each other, I fail to see how they help with my issue.
What I'm talking about is having a way to offset a model mesh from it's reference point, or conversely: offset it's reference-point (ie. the origin of the bodyframe) from the centre of it's bounding sphere (if you prefer to think of it in that sense), for the purposes of orientation rather than position.

For example, in the video, those solar panels need IMO for their bodyframe to be centered at their tips (where they connect to the satellite), which will in this case be at, or very close to, the outside of the bounding box of the solar panel mesh (in the absence of invisible mesh tricks). So what I'm looking for is a directive to tell it that that is the position where the center of it's bodyframe should be, rather than the physical center of the panel, if you see what I mean.

Supposedly that's what MeshCenter is designed to do (ie. Change the "center" position of a mesh from the default location at the center of it's bounding sphere.), but perhaps I misunderstood.

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

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #5by selden » 10.01.2009, 15:38

When you specify NormalizeMesh false, the center of the coordinate system of the model is used as the center of Celestia's Mesh. In other words, place the solar panel off-center when you design it, with the center of rotation at the center of its coordinate system.
Selden

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #6by Chuft-Captain » 10.01.2009, 15:42

Hang on... I think I see where you're coming from with MeshScale.... let me try something....
"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
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #7by Chuft-Captain » 10.01.2009, 16:17

selden wrote:When you specify NormalizeMesh false, the center of the coordinate system of the model is used as the center of Celestia's Mesh. In other words, place the solar panel off-center when you design it, with the center of rotation at the center of its coordinate system.
That's what I've done, but it's not working.
The panel:
panel.jpg
is still rotating around it's physical center. :?

Must be something wrong in my SSC. Just one question... if I specify NormaliseMesh false, does that mean that Celestia interprets the dimensions of the mesh "as modeled" in Animator. eg. If a mesh is modeled with a longest diagonal of 20meters in Animator, then a MeshScale of 1 and a radius of 1, will give a mesh in Celestia 20km long??? A Meshscale of 0.5 would give an object 10km long. I'm a little slow today, sorry Selden.

(btw. Using svn4585 at the moment to avoid old bugs getting in the way... and of course to allow use of MeshScale and NormalizeMesh directives :lol: ).
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #8by selden » 11.01.2009, 19:17

NormalizeMesh and MeshScale work fine for me with off-center 3DS models.

Here's what I see when using only one off-center model:
mysatellite.jpg


Here's the off-center model as shown by Anim8or:
solar_panel.png


Here's the SSC file that I used:

Code: Select all

"MySatellite" "Sol/Earth"
{ Class "spacecraft"
  Radius 10
  Color [1 1 0 ]

  EllipticalOrbit { SemiMajorAxis 10000 Period 1 }

}
"Panel_1" "Sol/Earth/MySatellite"
{ Class "component"
  NormalizeMesh false
  MeshScale 1
  Mesh "solar_panel.3ds"
  Radius 100

  OrbitFrame { BodyFixed { Center "Sol/Earth/MySatellite" }}
  FixedPosition [ 0 0 0 ]

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

"Panel_2" "Sol/Earth/MySatellite"
{ Class "component"
  NormalizeMesh false
  MeshScale 1
  Mesh "solar_panel.3ds"
  Radius 100

  OrbitFrame { BodyFixed { Center "Sol/Earth/MySatellite" }}
  FixedPosition [ 0 0 0 ]

  BodyFrame { BodyFixed { Center "Sol/Earth/MySatellite" }}
  FixedRotation { MeridianAngle 180 }
}


I rebuilt Celestia using today's SVN code, r4593.
Selden

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #9by Chuft-Captain » 11.01.2009, 19:27

Try changing the bodyframe on your panels so that they track the Sun Selden.
I'd be interested to see where they pivot.

CC

My code:

Code: Select all

"GLOBALSTAR M002 Body" "Sol/Earth/GLOBALSTAR M002" {
 Class "spacecraft"
 Mesh "GlobalstarBody.cmod"
 NormalizeMesh false
 MeshScale 0.000035
 MeshCenter [ 0 -16 6.5 ]
 Radius 0.0013   #0.004999999888241291

FixedPosition [ 0 0 0 ]

BodyFrame {
    TwoVector {
        Center "Sol/Earth/GLOBALSTAR M002/GLOBALSTAR M002 Body"
        Primary {
            Axis "z"
            RelativePosition { Target "Sol/Earth" }
        }
        Secondary {
            Axis "x"
            RelativeVelocity { Target "Sol/Earth" }
        }
    }
}

FixedRotation {}

}


"GLOBALSTAR M002 Panel LHS" "Sol/Earth/GLOBALSTAR M002/GLOBALSTAR M002 Body" {
 Class "component"
# Clickable "false"
 Mesh "GlobalstarPanel.cmod"
 NormalizeMesh false
 MeshScale 0.00003
 MeshCenter [ 0 0 0 ]
 Radius 0.003

FixedPosition [ -0.00048 0.00009 -0.00056 ]

BodyFrame {
    TwoVector {
        Center "Sol/Earth/GLOBALSTAR M002/GLOBALSTAR M002 Body/GLOBALSTAR M002 Panel LHS"
        Primary {
            Axis "z"
            RelativePosition { Target "Sol" }
        }
        Secondary {
            Axis "x"
            RelativeVelocity { Target "Sol/Earth" }
        }
    }
}

FixedRotation {}

}


"GLOBALSTAR M002 Panel RHS" "Sol/Earth/GLOBALSTAR M002/GLOBALSTAR M002 Body" {
 Class "component"
# Clickable false
 Mesh "GlobalstarPanel.cmod"
 NormalizeMesh false
 MeshScale 0.00003
 MeshCenter [ 0 0 0 ]
 Radius 0.003

FixedPosition [ 0.00048 0.00009 -0.00056 ]

BodyFrame {
    TwoVector {
        Center "Sol/Earth/GLOBALSTAR M002/GLOBALSTAR M002 Body/GLOBALSTAR M002 Panel RHS"
        Primary {
            Axis "z"
            RelativePosition { Target "Sol" }
        }
        Secondary {
            Axis "-x"
            RelativeVelocity { Target "Sol/Earth" }
        }
    }
}

FixedRotation {}

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

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

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

Re: Does MeshCenter command work with 1.5.x ReferenceFrame code?

Post #10by selden » 14.01.2009, 15:47

Sorry about the delay in getting back to this. Here's what works for me.

Code: Select all


"MySatellite" "Sol/Earth"
{
   Class "spacecraft"
   NormalizeMesh false
   MeshScale 1
   Mesh "satellite.3ds"
   Radius 100

   EllipticalOrbit { SemiMajorAxis 10000 Period 1 Inclination 45}

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

}

# Orient satellite so it always points toward the Earth
# with fixed orientation relative to orbit

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

# specify location of 1st solar panel relative to satellite body

"panel_1" "Sol/Earth/MySatellite"
{
   Class "component"
   NormalizeMesh false
   MeshScale 1
   Mesh "solar_panel_left.3ds"
   Radius 100


    OrbitFrame       { BodyFixed { Center "Sol/Earth/MySatellite" }}
    FixedPosition [ 0 10 -5 ]

    BodyFrame       { BodyFixed  { Center "Sol/Earth/MySatellite" }}
    FixedRotation   { MeridianAngle -90 }
}

# Orient panel relative to satellite
# and orient front of panel toward sun

Modify "panel_1" "Sol/Earth/MySatellite"
{
    BodyFrame
    {
        TwoVector
        {
            Center "Sol/Earth/MySatellite/panel_1"
            Primary   
            {
                Axis "y"
      ConstantVector {
          Vector [ 0 0 1]
          Frame { BodyFixed { Center "Sol/Earth/MySatellite" }}
          }
            }
            Secondary   
            {
                Axis "-z"
      RelativePosition {Target "Sol"}
            }
        }
    }

}


# specify location of 2nd solar panel relative to satellite body

"panel_2" "Sol/Earth/MySatellite"
{
   Class "component"
   NormalizeMesh false
   MeshScale 1
   Mesh "solar_panel_left.3ds"
   Radius 100


    OrbitFrame       { BodyFixed { Center "Sol/Earth/MySatellite" }}
    FixedPosition [ 0 -10 5 ]

    BodyFrame       { BodyFixed  { Center "Sol/Earth/MySatellite" }}
    FixedRotation   { MeridianAngle 90 }
}

# Orient panel relative to satellite
# and orient front of panel toward sun

Modify "panel_2" "Sol/Earth/MySatellite"
{
    BodyFrame
    {
        TwoVector
        {
            Center "Sol/Earth/MySatellite/panel_2"
            Primary   
            {
                Axis "y"
      ConstantVector {
          Vector [ 0 0 1]
          Frame { BodyFixed { Center "Sol/Earth/MySatellite" }}
          }
            }
            Secondary   
            {
                Axis "-z"
      RelativePosition {Target "Sol"}
            }
        }
    }

}


A picture of the results:
solar_panels.jpg


The entire addon, including an8 and html to goto this viewpoint:
solar_panels.zip
Selden


Return to “Development”