RE: [Algorithms] Problem with Woo's "Fast Ray-Box Intersection"
Brought to you by:
vexxed72
From: Akbar A. <sye...@ea...> - 2000-08-26 08:36:10
|
something might bite you later on in that book before you check out something in it, make sure you test it against this http://www.acm.org/pubs/tog/GraphicsGems/Errata.GraphicsGems here's the raybox code if anyone is currently working on it ;) it has the fix http://www.acm.org/tog/GraphicsGems/gems/RayBox.c entire listing from the series in a -listed fashion http://www.acm.org/tog/GraphicsGems/gems.html peace. akbar A. "We want technology for the sake of the story, not for its own sake. When you look back, say 10 years from now, current technology will seem quaint" Pixars' Edwin Catmull. -----Original Message----- From: gda...@li... [mailto:gda...@li...]On Behalf Of Klaus Hartmann Sent: Saturday, August 26, 2000 1:26 AM To: gda...@li... Subject: [Algorithms] Problem with Woo's "Fast Ray-Box Intersection" Hi all, I have a problem that I don't understand. I have the following line of source in my implementation of Woo's "Fast Ray-Box Intersection": hitpoint[i] = rayOrg[i] + maxT[whichPlane] * rayDir[i]; hitpoint, rayOrg, maxT, and rayDir are all arrays with three floating-point values (indices 0 to 2). Now here are some values: i = 2 (which is a valid index) whichPlane = 0 (also a valid index) rayOrg[i] = -2 maxT[whichPlane] = 2.82843 rayDir[i] = 0.707107 These are all very valid values, and the result should now be: hitpoint[i] = -2 + 2.82843 * 0.707107 = 2.65201e-06 However, the debugger says, that hitpoint[i] = -6.8457097e-008 Okay, so I thought that maybe this is a precision problem. I tried doubles, but I got the same wrong value. Then I thought, that there might be something wrong hitpoint[i], so I replaced that with a local double variable, but the result is still wrong. Why? I cannot believe that 2.65201e-06 is too small to be represented as a double-precision floating-point value. Can someone explain this to me? Or do you see a bug in the above C line? If you don't believe me, then I'm very well willing to upload the code (very small), and you can step through it, and see for yourselves. Niki _______________________________________________ GDAlgorithms-list mailing list GDA...@li... http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |