Game Development Reference
In-Depth Information
If we visit all six planes of the view frustum and never encounter the case
that both endpoints produce a dot product less than or equal to
, then the cyl-
inder is probably at least partially visible. Of course, this means that we do not
have to replace any endpoints for the last plane that we visit. As soon as we know
that at least one endpoint
r
eff
L Q for the final plane, we know
that part of the cylinder intersects the view frustum.
Q satisfies
>−
r
i
eff
8.2.4 Bounding Box Test
When determining whether a box intersects the view frustum, we have a choice
between reducing the problem to that of testing a point or to that of testing a line
segment. If the bounding box extents in the primary axis direction R are signifi-
cantly greater than those in the S and T directions, then we may choose to test a
line segment. For bounding boxes whose dimensions are roughly equal, we favor
the point test.
We assume in this section that the magnitudes of the vectors R , S , and T rep-
resenting the principal axes of the object bounded by the box are equal to the di-
mensions of the box itself. To reduce the problem of intersecting a box with the
view frustum to that of testing whether its center lies inside the expanded frustum
planes, we need a way to determine the box's effective radius. As shown in Fig-
ure 8.7, we can calculate the effective radius ef r of a box with respect to a plane
having unit normal direction N using the formula
(
)
r
=
1
RN
+
SN
+
TN .
(8.47)
eff
2
Q
N
1
2
R
1
2
R N
1
2
S N
1
2
S
Figure 8.7. Calculating the effective radius of a box.