Graphics Reference
In-Depth Information
Projection
Ray
Viewing
Ray
Camera
Position
Mouse Click
Position (pt dc )
Figure 15.11.
2D mouse position in the 3D scene.
camera positions and scene node transform settings, they occupy different pixel
positions in the two views. In Section 10.5, we learned to inversely transform
mouse positions from DC back to WC space such that the user can interact with
our application through what they can see on the display device.
To transform the 2D mouse position into 3D WC space, we must compute the
inverse transform:
.
DC
NDC
EC
WC
Our problem, of course, is that although DC is in 2D, the rest of the coordinate
Perspective projection. Ob-
jects are collapsed (or pro-
jected) along the projection
ray onto the image plane. A
projection ray is defined from
a position on the object toward
the camera position.
spaces are all in 3D. Recall that the 3D-to-2D perspective projection (from Fig-
ure 14.12) collapses objects along individual projection rays toward the camera
position onto the image plane. As illustrated in Figure 15.11, given a pixel po-
sition, we can reconstruct the projection ray by computing the line that connects
this pixel to the camera position. In 3D applications, when the user clicks the
mouse in the application window, she actually specifies a ray originating from the
camera position into the 3D world. The result of transforming a point in 2D DC
space to 3D space is not a position but a ray in 3D space.
Assuming that
width
=
W dc ,
Device drawing area
=
height
=
H dc ,
then the DC space is
DC space: 0
x dc
W dc ,
0
y dc
H dc ,
Search WWH ::




Custom Search