This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.
An Oriented Bounding Box (OBB) Intersection Test
A drawback of using an axis-aligned bounding box is that it can’t fit rotating geometry very tightly.
On the other hand, an oriented bounding box can be rotated with the objects, fitting the geometry with less volume than an AABB. This requires that the orientation of the box must also be specified. Figure 8 shows a 2D example, where A1, A2, B1 and B2 are the local axes of boxes A and B.
For OBBs, the separating axis test must be generalized to three dimensions. A box's scalar projection onto a unit vector L creates an interval along the axis defined by L.
The radius of the projection of box A onto L is
The same is true for B, and L forms a separating axis if
Note that L does not have to be a unit vector for this test to work. The boxes A and B are disjoint if none of the 6 principal axes and their 9 cross products form a separating axis. These tests are greatly simplified if T and B’s basis vectors (B1, B2, B3) are transformed into A’s coordinate frame.
An OBB class and an implementation of the OBB overlap test is given in Listing 6 below.
Listing 6. An OBB class.
OBB : public COORD_FRAME
VeCTOR E; //extents
if two oriented bounding boxes overlap
//translation, in parent frame
For a more complete discussion of OBBs and the separating axis test, please see . Some other applications of the separating axis test are given next.