Game Development Reference
In-Depth Information
(x − c x ) 2 + (y − c y ) 2 = r 2
(2D circle)
(9.8)
Implicit definitions of a
circle and a sphere
(x − c x ) 2 + (y − c y ) 2 + (z − c z ) 2 = r 2
(3D sphere)
(9.9)
We might be interested in the diameter (distance from one point to a
point on the exact opposite side), and circumference (the distance all the
way around the circle) of a circle or sphere. Elementary geometry provides
formulas for those quantities, as well as for the area of a circle, surface area
of a sphere, and volume of a sphere:
D = 2r
(diameter)
C = 2πr = πD
(circumference)
A = πr 2
(area of circle)
S = 4πr 2
(surface area of sphere)
V = 4
3 πr 3
(volume of sphere)
For the calculus buffs, it is interesting to notice that the derivative of
the area of a circle with respect to r is the circumference, and the derivative
for the volume of a sphere is the surface area.
9.4
Bounding Boxes
Another simple geometric primitive commonly used as a bounding volume
is the bounding box. Bounding boxes may be either axially aligned, or
arbitrarily oriented. Axially aligned bounding boxes have the restriction
that their sides be perpendicular to principal axes. The acronym AABB is
often used for a xially a ligned b ounding b ox.
A 3D AABB is a simple 6-sided box with each side parallel to one of
the cardinal planes. The box is not necessarily a cube—the length, width,
and height of the box may each be different. Figure 9.9 shows a few simple
3D objects and their axially aligned bounding boxes.
Another frequently used acronym is OBB, which stands for o riented
b ounding b ox. We don't discuss OBBs much in this section, for two reasons.
First, axially aligned bounding boxes are simpler to create and use. But
more important, you can think about an OBB as simply an AABB with
an orientation; every bounding box is an AABB in some coordinate space;
in fact any one with axes perpendicular to the sides of the box will do. In
other words, the difference between an AABB and an OBB is not in the
box itself, but in whether you are performing calculations in a coordinate
space aligned with the bounding box.
 
Search WWH ::




Custom Search