An AABB does not intersect a plane if all four corners of the box are on the same side of the plane. A naive solution to this problem would be to get all eight corners of the plane as points, and then perform a half space test with every corner against the plane.
A better solution would be to use the
GetInterval function we wrote in the AABB to OBB section of this chapter to get the interval of the box along the normal of the plane. Then, we just have to make sure that the min and max intervals of the AABB are both greater than 0, or less than 0. If the signs of the min and max are different, we have an intersection.
We are going to take a third, more optimal approach. We will project the half extents of the box onto the plane. Then, we will find the distance between the box and the plane. We find the distance between the box and the plane by measuring how far the projected box interval is from the origin along the normal. If the distance of the box from the plane is less than...