openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] ImathBoxAlgo.h intersects() problem


From: John Haddon
Subject: [Openexr-devel] ImathBoxAlgo.h intersects() problem
Date: Thu, 23 Oct 2003 12:33:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Hi all,

I'm encountering some possibly strange behaviour with the intersects() function in ImathBoxAlgo.h, in that it seems to be returning intersections outside of the box. Running an interactive test with the code in a Maya plugin reveals intersections that /are/ on the plane of the front face of the box, but aren't actually on the box face.

Comparing the code to the Graphics Gems original, i noticed this section near the bottom of the function is different :

IMath :

        if ((quadrant[i] == right && result[i] < minB[i]) ||
                (quadrant[i] == left && result[i] > maxB[i]))
            {
                return false;   /* outside box */
            }


GG :

        if (coord[i] < minB[i] || coord[i] > maxB[i])
                return (FALSE);

(result and coord serve equivalent purposes for each case)

This section does seem to be attempting to throw away the cases that are on the right plane but not within the face, and taking out the additional quadrant[i]==XX conditional from Imath (making it equivalent to the GG form) seems to give the desired result i.e. no more unwanted intersections.

I first noticed this when using the box intersections in a tree acceleration structure for a mesh intersection test, and the modified function seems to produce valid results still, but far fewer tests are performed due to throwing away a great deal more bounding box nodes a lot earlier.

Could it be that the intersects() code is broken? Or have i missed something?

Cheers...

John






reply via email to

[Prev in Thread] Current Thread [Next in Thread]