Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#174 FixedPosition [0 0 0] works but not equivalent ScriptedOrbit

v1.5
closed-fixed
Chris Laurel
5
2008-01-20
2008-01-20
Selden Ball
No

This has been driving me crazy all morning.
I fear it's a bug in Celestia's code.
I can't find anything wrong in my ScriptedOrbit use.

An SSC object (in a complicated environment) is placed correctly with
FixedPosition [0 0 0]
but is placed incorrectly with
ScriptedOrbit { Module "orbit_000" Function "PlaceAt000" }

celxx/orbit_000.lua contains

PlaceAt000 = function (sscvals)

local orbit = {}
orbit.params = sscvals
orbit.boundingRadius = 100

function orbit:position(tjd)

return 0, 0, 0
end

return orbit
end

An Addon which demonstrates this is available at
http://www.lepp.cornell.edu/~seb/celestia/files/scripted_000_bug.zip
(1.5KB)
It requires my HaleTelescope Addon as a prerequisite.

http://www.lepp.cornell.edu/~seb/celestia/files/hale_telescope_v2.zip
(10.4MB)

Instructions for reproducing the problem are at the top of the ssc file scripted_000_bug.ssc
(Note that the use of 000 is a very simplified example. The failure was discovered with a more complicated function and environment :-( )

Discussion

  • Chris Laurel
    Chris Laurel
    2008-01-20

    • assigned_to: nobody --> cjlaurel
     
  • Chris Laurel
    Chris Laurel
    2008-01-20

    Logged In: YES
    user_id=159994
    Originator: NO

    Fortunately, I'm able to reproduce the problem with a much simpler configuration. Placing a marker on the object shows that it's rendered in the right place, but I can't see anything when I approach it.

     
  • Chris Laurel
    Chris Laurel
    2008-01-20

    Logged In: YES
    user_id=159994
    Originator: NO

    Oddly enough, assigning the orbit a period seems to make it work. I'm still trying to understand why.

     
  • Chris Laurel
    Chris Laurel
    2008-01-20

    Logged In: YES
    user_id=159994
    Originator: NO

    The problem is an interaction of two defaults: the default rotation model is synchronous, and the default period of a ScriptedOrbit is 0 (that is, aperiodic.) The period of a synchronous rotator is equal to its orbital period; when the orbital period is zero, the rotation rate is infinite. The infinity ultimately results in bad transformation matrix in OpenGL and no rendering occurring. A quick fix is to make sure you specify FixedRotation {} (or some other rotation model) for all objects with ScriptedOrbits that aren't periodic. I'll patch the code and change the default rotation model to FixedRotation for objects that don't have periodic orbits.

     
  • Selden Ball
    Selden Ball
    2008-01-20

    Logged In: YES
    user_id=662401
    Originator: YES

    Thanks!

    I hadn't noticed that I'd omitted a rotation for this set of objects.

     
  • Chris Laurel
    Chris Laurel
    2008-01-20

    • status: open --> open-fixed
     
  • Chris Laurel
    Chris Laurel
    2008-01-20

    Logged In: YES
    user_id=159994
    Originator: NO

    I implemented the fix that changes the default rotation model to FixedRotation for objects with aperiodic orbits. Selden, if you could independently verify the fix, I'll close this bug.

     
  • Selden Ball
    Selden Ball
    2008-01-20

    • status: open-fixed --> closed-fixed
     
  • Selden Ball
    Selden Ball
    2008-01-20

    Logged In: YES
    user_id=662401
    Originator: YES

    I do hearby confirm that the bug is fixed!

    (I've closed the bug report.)