Game Development Reference

In-Depth Information

which yields the relatively simple expression

(

)

2

(

)

2

(

)

2

r

=⋅

PN

=

RN

⋅

+ ⋅

SN

+ ⋅

TN
.

(8.40)

eff

Equation (8.40) provides the effective radius of an arbitrary ellipsoid with

respect to a plane having unit normal direction
N
. Since the near and far planes

are parallel, the ellipsoid's effective radius for those two planes is the same.

Thus, to test whether an ellipsoid falls outside the view frustum, we need to cal-

culate at most five effective radii. As with the sphere test, we compute the four-

dimensional dot products of the ellipsoid's center with each of the frustum plane

vectors. If any single dot product is less than or equal to

, then the ellipsoid is

not visible. Otherwise, the object bounded by the ellipsoid should be drawn.

−

r

eff

8.2.3 Bounding Cylinder Test

We reduced the problem of intersecting a sphere or an ellipsoid with the view

frustum to that of testing whether a point fell on the positive side of frustum

planes that were offset by the bounding volume's effective radius. To intersect a

cylinder with the view frustum, we instead reduce the problem to determining

whether a line segment is visible in a properly expanded frustum.

As with the ellipsoid test, we must determine the effective radius of a bound-

ing cylinder with respect to each of the view frustum planes. The effective radius

depends on the cylinder's orientation and ranges from zero (when the cylinder is

perpendicular to a plane) to the actual radius (when the cylinder is parallel to a

plane). Suppose that we are given a cylinder of radius
r
whose endpoints lie at
Q

and
Q
. We define the vector
A
to be the unit vector parallel to the axis of the

cylinder:

QQ

−

2

1

A

=

QQ
.

(8.41)

−

2

1

As shown in Figure 8.6, the effective radius
ef
r
of the cylinder with respect to a

plane having unit normal direction
N
is given by

r

=

r α

sin

,

(8.42)

eff

where
α
is the angle formed between the vectors
A
and
N
. This can also be writ-

ten as

r

r
=−

r

1cos

2

α

eff

(

)

2

=−⋅

1

AN
.

(8.43)

Search Nedrilad ::

Custom Search