Most efficient way to determine if a cube intersects a frustum

483 Views Asked by At

I'm looking for a fast, efficient (even if sometimes false positive) way to determine if a cube intersects a frustum.

I've been using a brute force test of just seeing if all cube points are behind one of the planes, and rejecting on that basis, using this function:

inline char ClassifyPoint(Vector thePoint, char thePlane) 
{
    Vector aDir=mPlane[thePlane].mPos-thePoint;
    float aD=aDir.Dot(mPlane[thePlane].mNormal);
    if (aD<-0.0005f) return 1; // In front of plane
    if (aD>0.0005f) return -1; // Behind plane
    return 0; // "On" the plane
}

It also seems to work if I just use the center of each cube face, which saves me two tests.

But I wanted to know if there's a faster way, something more volume oriented.

0

There are 0 best solutions below