i
i
i
i
i
i
i
i
726 16. Intersection Test Methods
any time the ray misses a bounding volume (BV), then that subtree can be
discarded from further tests, since the ray will not hit any of its contents.
However, if the ray hits a BV, its children’s BVs must be tested as well.
Finally, the recursion may end in a leaf that contains geometry, in which
case the ray must be tested against each primitive in the geometry node.
As we have seen in Section 14.3, view frustum culling is a means for
efficiently discarding geometry that is outside the view frustum. Tests
that decide whether a bounding volume is totally outside, totally inside, or
partially inside a frustum are needed to use this method.
In collision detection algorithms (see Chapter 17), which are also built
upon hierarchies, the system must decide whether or not two primitive
objects collide. These primitive objects include triangles, spheres, axis-
aligned bounding boxes (AABBs), oriented bounding boxes (OBBs), and
discrete oriented polytopes (k-DOPs).
In all of these cases, we have encountered a certain class of problems
that require intersection tests. An intersection test determines whether two
objects, A and B, intersect, which may mean that A is totally inside B
(or vice versa), that the boundaries of A and B intersect, or that they are
totally disjoint. However, sometimes more information may be needed, such
as the closest intersection point, the distance to this intersection point, etc.
In this chapter, a set of fast intersection test methods is identified and
studied thoroughly. We not only present the basic algorithms, but also
give advice on how to construct new and efficient intersection test meth-
ods. Naturally, the methods presented in this chapter are also of use in
offline computer graphics applications. For example, the algorithms pre-
sented in Sections 16.6 through 16.9 can be used in ray tracing and global
illumination programs.
After briefly covering hardware-accelerated picking methods, this chap-
ter continues with some useful definitions, followed by algorithms for form-
ing bounding volumes around primitives. Rules of thumb for constructing
efficient intersection test methods are presented next. Finally, the bulk of
the chapter is made up of a cookbook of intersection test methods.
16.1 Hardware-Accelerated Picking
There are a few hardware-accelerated picking methods worth mentioning.
One method was first presented by Hanrahan and Haeberli [497]. To sup-
port picking, the scene is rendered with each polygon having a unique color
value that is used as an identifier. The image formed is stored offscreen and
is then used for extremely rapid picking. When the user clicks on a pixel,
the color identifier is looked up in this image and the polygon is immedi-
ately identified. The major disadvantage of this method is that the entire