
474 Chapter 8 Collision Detection
0
0
r
min
u
max
u
min
r
max
x
pmax
y
pmax
y
pmin
x
pmin
U
W – 1
x
y
R
– 1
(x, y)
(x, y)
E + nD
(a) (b)
Figure 8.28 The viewport on the near plane with screen coordinates (x, y) listed for the selected
point. The viewport is not the entire screen.
are 0, and the default maximum values are 1. If they are changed from the defaults, the
pick ray construction must be modified. Figure 8.28 shows the screen with a viewport
that is not the size of the screen.
The new construction for (x
v
, y
v
) is
(x
p
, y
p
) =
x
W − 1
,1−
y
H − 1
(x
w
, y
w
) =
x
p
− x
pmin
x
pmax
− x
pmin
,
y
p
− y
pmin
y
pmax
− y
pmin
(x
v
, y
v
) = ((1 − x
w
)r
min
+ x
w
r
max
, (1 − y
w
)u
min
+ y
w
u
max
)
The conversion is