Game Development Reference
In-Depth Information
direction), then, of course, the appropriate boundary tests would be applied
after computing t 1 and t 2 .
A.9
Intersection of a Ray and Plane
A ray intersects a plane in 3D at a point. Let the ray be defined paramet-
rically by
p (t) = p 0 + t d .
The plane will be defined in the standard implicit manner, by all points p
such that
p n = d.
Although we often restrict the plane normal n and the ray direction vector
d to be unit vectors, in this case neither restriction is necessary.
Figure A.6
Intersection of a ray and plane in 3D
Let us solve for t at the point of intersection, assuming an infinite ray
for the moment:
( p 0 + t d ) n = d,
p 0
Parametric intersection
of a ray and a plane
n + t d n = d,
t d n = d − p 0
n ,
t = d − p 0 n
d n
.
(A.4)
If the ray is parallel to the plane, then the denominator d n is zero and
there is no intersection. If the value for t is out of range, then the ray does
not intersect the plane. We may also wish to intersect only with the front
of the plane. In this case, we say there is an intersection only if the ray
points in a direction opposite to the normal of the plane (i.e., d n < 0).
 
Search WWH ::




Custom Search