关键是找一个完全包裹所有对象的盒子:
if (ray hits bounding object)
return whether ray hits bounded objects
else
return false
例如,我们把对象集分为两组,红和蓝,然后用矩形包围他们:
if (hits purple)
hit0 = hits blue enclosed objects
hit1 = hits red enclosed objects
if (hit0 or hit1)
return true and info of closer hit
return false