Game Development Reference
In-Depth Information
soid aligned to the natural axes R , S , and T . We can transform the problem into
that of finding a bounding sphere by scaling the vertex positions in these direc-
tions so that their bounding box becomes a cube. Once the bounding sphere of
the scaled set is known, we scale its radius by the reciprocal amount in each di-
rection to derive the semiaxis lengths.
To scale the vertex positions so that they are bounded by a cube, we need to
know the distance between the planes representing the minimum and maximum
extents in each natural axis direction. These distances are equal to the dimensions
of the standard bounding box, which are given by the differences between the
minimum and maximum dot products of the points P with the vectors R , S , and
T . Calling these distances a , b , and c , respectively, we have
a
=
max
{
PR
}
min
{
PR
}
i
i
iN
1
≤≤
iN
1
≤≤
{
}
{
}
b
=
max
PS
min
PS
i
i
1
≤≤
iN
1
≤≤
iN
{
}
{
}
c
=
max
PT
min
PT
.
(8.20)
i
i
1
≤≤
iN
1
≤≤
iN
To transform the vertex set into one bounded by a cube, we need to scale their
positions by 1 a in the R direction, by 1 b in the S direction, and by 1 c in the T
direction. As stated in Equation (4.11), the matrix M that performs this scale is
given by
1 0 0
01 0
001
a
[
]
[
]
T
M
=
RST
b
RST ,
(8.21)
c
where we have replaced the inverse operation for the rightmost matrix by a
transpose operation since the vectors R , S , and T are orthonormal.
P has been transformed by the matrix M , we cal-
culate the bounding sphere for the set of points
Once each of the points
{
}
MPMP M . Once the
center Q of this sphere is known, we can calculate the center of the bounding
ellipsoid of the original set of vertices by transforming Q back into the unscaled
coordinate space. The ellipsoid center is simply given by
,
,
,
1
2
N
MQ , where the in-
1
verse of M is
a
00
[
]
[
]
1
T
M
=
RST
0
b
0
RST .
(8.22)
00
c
Search Nedrilad ::




Custom Search