Game Development Reference
In-Depth Information
Figure 9.9. 3D objects and their AABB's
As an example, let's say that for objects in our world, we store the
AABB of the object in the objects' object space. When performing opera-
tions in object space, this bounding box is an AABB. But when performing
calculations in world (or upright) space, then this same bounding box is an
OBB, since it may be “at an angle” relative to the world axes.
Although this section focuses on 3D AABBs, most of the information
can be applied in a straightforward manner in 2D by simply dropping the
third dimension.
The next four sections cover the basic properties of AABBs. Sec-
tion 9.4.1 introduces the notation we use and describes the options we have
for representing an AABB. Section 9.4.2 shows how to compute the AABB
for a set of points. Section 9.4.3 compares AABBs to bounding spheres.
Section 9.4.4 shows how to construct an AABB for a transformed AABB.
9.4.1 Representing AABBs
Let us introduce several important properties of an AABB, and the notation
we use when referring to these values. The points inside an AABB satisfy
the inequalities
x min ≤ x ≤ x max ,
y min ≤ y ≤ y max ,
z min ≤ z ≤ z max .
Two corner points of special significance are
p min =
x min y min z min
,
p max =
x max y max z max
.
The center point c is given by
c = ( p min + p max )/2.
 
Search WWH ::




Custom Search