Scott Johnson wrote:
I am testing my company's own OpenFlight implementation and came across some 
corrupt data reading in Dof nodes.  Google found that the OSG OpenFlight plugin 
is compensating for the same corrupt data so that was useful to me and 
validated what coworkers were telling me about the cause of the corruption.

But I had a further problem. My test data from Creator 15.7 does not agree with the open flight spec or the code in Osg's readRange() line 431. The OSG code simply reads in four Float64s. When I try that I get NaN for the "current".
I finally arrived at this code to read in a range.


Code:

struct Range
{
    double min;
    double max;
    double current;
    double inc;
};

Range readRange( unsigned char *&p )
{
    Range r;
    r.min = readDouble(p);
    r.max = readDouble(p);
    unsigned long long hi = readUInt32(p);
    r.inc = readDouble(p);
    unsigned long long lo = readUInt32(p);
    unsigned long long x = (hi << 32 ) | lo;
    r.current = *reinterpret_cast < double * >(&x);
    return r;
}

Hi, Scott,

Your fix is extremely strange. Read the first 32 bits of a double, then read a whole double for a different field, then read the last 32 bits of the original double and assemble them. Are you sure that your fix isn't just coincidentally working? (I could see it appearing to work if inc is zero, for example). I'm not trying to be difficult, I just fail to see how the data could possibly end up arranged like this in the file.

Is this a known problem in Creator 15.7?

--"J"


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to