Graphics Reference
In-Depth Information
camera position
zoomed across the
look at position
( d < -v d )
+d
-d
Camera
position (p e )
Look at
position (p a )
Figure 15.10.
Zooming across the look-at position.
to the object.
Zooming out corresponds to moving the camera away from the
object.
To properly simulate the zooming sensation, we can move the camera position
along the view vector. Mathematically,
p e =
V v ] ,
p a +[(
v d +
d
)
(15.5)
where p e is the new camera position and d is the camera movement along the view
vector. A d value of 0
.
0 corresponds to no zooming, a negative d value shortens
the view distance and thus create a zoom-in effect, and a positive d value results
in a zoom-out effect. In general,
≤−
d
v d
move camera beyond look at: no real-world analogy,
v d <
d
<
0
move camera closer: zooming in,
0
d
move camera away: zooming out.
The mathematics of Equation (15.5) is such that a d value of less than
v d cor-
respond to moving the camera beyond the look-at position. As illustrated in Fig-
ure 15.10, because the look-at position is not changed, after the camera moves
across the look at position, the view vector flips direction. In this way, the fi-
nal rendered image appears as though we have moved the camera to the other
side of the look-at position while still looking at the same look-at position. List-
ing 15.15 shows the camera zooming implementation of Equation 15.5. At la-
bel A, mouse movement in the x -direction is mapped into displacement along
Search WWH ::




Custom Search