Game Development Reference
In-Depth Information
To compute an AABB for a transformed AABB it is not enough to
simply transform the original p min and p max . This could result in a bogus
bounding box, for example, if x min > x max . To compute a new AABB,
we must transform the eight corner points, and then form an AABB from
these eight transformed points.
Depending on the transformation, this usually results in a bounding
box that is larger than the original bounding box. For example, in 2D, a
rotation of 45 degrees will increase the size of the bounding box significantly
(see Figure 9.11).
Figure 9.11
The AABB of a
transformed box
Compare the size of the original AABB in Figure 9.11 (the blue box),
with the new AABB (the largest red box on the right) which was computed
solely from the rotated AABB. The new AABB is almost twice as big.
Notice that if we were able to compute an AABB from the rotated object
rather than the rotated AABB, it is about the same size as the original
AABB.
As it turns out, the structure of an AABB can be exploited to speed up
the generation of the new AABB, so it is not necessary to actually transform
all eight corner points and build a new AABB from these points.
Let's quickly review what happens when we transform a 3D point by
a 3 × 3 matrix (see Section 4.1.7 if you have forgotten how to multiply a
vector by a matrix):
2
3
m 11 m 12 m 13
m 21 m 22 m 23
m 31 m 32 m 33
4
5
x
y
z
=
x y z
;
x
= m 11 x + m 21 y + m 31 z,
y
= m 12 x + m 22 y + m 32 z,
z
= m 13 x + m 23 y + m 33 z.
Search WWH ::




Custom Search