Gotolonglat bug in SVN5063

Report bugs, bug fixes and workarounds here.
Avatar
Topic author
Marco Klunder
Posts: 181
Joined: 20.02.2008
Age: 62
With us: 16 years 9 months
Location: The Netherlands

Gotolonglat bug in SVN5063

Post #1by Marco Klunder » 12.11.2010, 17:32

Using Celestia SVN 5063, I experience the following bug, using the observer:gotolonglat() method in a celx script:

Code: Select all

obs=celestia:getobserver()
celestia:seturl("cel://PhaseLock/Sol:Earth/Sol:Earth:Moon/2009-12-11T01:02:21.01544?x=13iGcjN0OA&y=povOJMYO8////////////w&z=hir0Pqo15v///////////w&ow=0.498878&ox=-0.503754&oy=0.501514&oz=0.495819&fov=0.970781&ts=0&ltd=0&p=0&rf=3715&lm=52736&tsrc=0&ver=3", obs)
celestia:settimescale(1)
earth=celestia:find("Sol/Earth")
earthradius=earth:radius()
moon=celestia:find("Sol/Earth/Moon")
moonradius=moon:radius()
distance=220*earthradius
longitude=math.rad(166.7)
latitude=math.rad(63.7)
celestia:select(earth)
frame=celestia:newframe("ecliptic",earth)
obs=celestia:getobserver()
obs:setframe(frame)
obs:gotolonglat(earth, longitude, latitude, distance, 3.0 )
wait(2.0)
celestia:setrenderflags{atmospheres=true, cloudmaps=true, cloudshadows=true, orbits=true}
celestia:setorbitflags{Planet=false, Moon=true, Asteroid=false, Comet=false, Spacecraft=false, Invisible=false, Unknown=false, DwarfPlanet=false, MinorMoon=false, Star=false}
celestia:setambient (0.0)
celestia:getobserver():setfov(math.rad(38))
wait(1.0)


Traditional (and correct) result of the code above is:
Gotolonglat160.jpg


The Celestia SVN 5063 result however:
GotolonglatSVN.jpg

...ends up at the center of Earth (distance upper left corner: -6378,1 km).

Marco
Marco Klunder
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Re: Gotolonglat bug in SVN5063

Post #2by Vincent » 13.11.2010, 11:04

Marco,

This bug appeared while the Celestia code was Eigenized. Thanks for reporting it.
The gotoSelectionLongLat method now requires distance to be in kilometers.
Commenting out line 363 in celx_observer.cpp, as below, should fixed it.

Code: Select all

static int observer_gotolonglat(lua_State* l)
{
    CelxLua celx(l);
    celx.checkArgs(2, 7, "One to five arguments expected to observer:gotolonglat");
   
    Observer* o = this_observer(l);
   
    Selection* sel = celx.toObject(2);
    if (sel == NULL)
    {
        celx.doError("First arg to observer:gotolonglat must be an object");
    }
    double defaultDistance = sel->radius() * 5.0;
   
    double longitude  = celx.safeGetNumber(3, WrongType, "Second arg to observer:gotolonglat must be a number", 0.0);
    double latitude   = celx.safeGetNumber(4, WrongType, "Third arg to observer:gotolonglat must be a number", 0.0);
    double distance   = celx.safeGetNumber(5, WrongType, "Fourth arg to observer:gotolonglat must be a number", defaultDistance);
    double travelTime = celx.safeGetNumber(6, WrongType, "Fifth arg to observer:gotolonglat must be a number", 5.0);
   
    //distance = distance / KM_PER_LY;
   
    Vector3f up = Vector3f::UnitY();
    if (lua_gettop(l) >= 7)
    {
        Vec3d* uparg = celx.toVector(7);
        if (uparg == NULL)
        {
            celx.doError("Sixth argument to observer:gotolonglat must be a vector");
        }
        up = toEigen(*uparg).cast<float>();
    }
    o->gotoSelectionLongLat(*sel, travelTime, distance, (float)longitude, (float)latitude, up);
   
    return 0;
}
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3


Return to “Bugs”