
11.12 Miscellaneous 639
P
min
P
max
Q
min
Q
max
Figure 11.71 Intersection of two axis-aligned bounding boxes.
11.12.7 Oriented Bounding Boxes
In this section we discuss the problem of detecting the intersection of oriented
bounding boxes. An OBB is defined in Section 11.12.3 by a centerpoint C, a right-
handed orthonormal basis {ˆu, ˆv, ˆw}, and half-lengths {h
ˆu
, h
ˆv
, h
ˆw
}. Because OBBs are
used to bound other primitives for the purpose of speeding up intersection, picking,
or (perhaps) rendering operations by culling out cases that definitely do not intersect,
we only are concerned with finding out if there is an intersection; if the OBB’s do in-
tersect, then the primitives they bound may or may not, and we must then perform
the object-specific tests on the bounded primitives.
The algorithm we present is due to Gottschalk, Lin, and Manocha (1996). The
motivation is this: The naive approach would be to simply test every edge of each
OBB against every face of the other, yielding 144 edge-face tests. Much more efficient
is the use of the separating axis test, which is based on the following theorem: any two
nonoverlapping polytopes can always be separated by a plane that is either parallel to
a face of one of the polytopes or parallel to an edge of each. An illustration in 2D
will help make this more clear; see Figure 11.72. The plane (line in 2D) that separates
OBBs A and B is shown as a dotted line.
Each OBB has three face orientations and three edge directions. This gives us a
total of 15 axes to test—3 faces from each of two boxes and 9 combinations of edges.
If the OBBs don’t overlap, then there will be at least one separating axis; if the OBBs
do overlap, there will be none. Note that in general, if the OBBs are nonoverlapping,
then a separating axis will be found (on average) in fewer than 15 tests.
The basic test is as follows:
1. Choose an axis to test.
2. Project the centers of the OBBs onto the axis.
3. Compute the radii of the intervals r
A
and r
B
.