Graphics Programs Reference
In-Depth Information
which can be found in a trig topic and jump to the answer. The coordinates of the new
point are given by
x' = x cos(B) - z sin(B)
z' = z cos(B) + x sin(B)
Similar expressions can be found for rotation about the other axes and will be discussed
in a later chapter where we look at rotations about more than one axis. Unlike transla-
tions where the order does not matter, the order of rotation about more than one axis
affects the final position. This is true for both viewer and object rotation.
Exercise 7.4: Viewer Rotation About the Y-axis
In this exercise, we will look at how to apply the equations that express the updated
coordinate values when the viewer undertakes a rotation about the y-axis. Open the file
7_4_glassCam_DONE.swf in the Chapter 7 folder. Figure 7.21 shows a sample screen
from the file. We'll use the arrow keys to control the movement.
Step 1: Getting started
Open 7_4_glassCam.fla and 7_2_maskCam_DONE.fla in the Chapter 7 folder. The
script from the latter file contains most of what we will need, so copy the script from
7_2_maskCam_DONE.fla and paste it into 7_4_glassCam.fla . Let's start by modifying
our viewer properties to include an initial angle of rotation about the y-axis (line 2).
Set the distance from the viewer to the picture plane to 600 in line 5.
Figure 7.21 Example of 7_4_glassCam_DONE.swf
Search WWH ::




Custom Search