我正在寻找一种快速、有效(即使有时会出现误报)的方法来确定立方体是否与截锥体相交。
我一直在使用蛮力测试,看看是否所有立方体点都在其中一个平面后面,并在此基础上拒绝,使用此函数:
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
}
如果我只使用每个立方体面的中心,这似乎也有效,这样我就省了两次测试。
但我想知道是否有更快的方法,更注重体积的方法。