CS 435 Autumn 2000  Introduction to Interactive Graphics
David S. Ebert
Lab 4 Helpful Suggestions
Reminder about Spaces
As the lab handout mentions, the COP (PRP) is in world coordinates in
the data files, our model assumes it is in VRC coordinates. You need to
convert it. The following will do it:
where Rx, Ry, and Rz are the basis of the VRC in world coordinates
(see pg 720 of the notes), the components of the R matrix.
Window to Viewport Transformation
The transformation by results in a canonical view volume with
the projection plane now being a square, with sides of length
. At this point, the original window has been transformed
into a square. The windowtoviewport transformation needs to get it
back to it's original shape.
Think of this as a 2 step process:
 Use the size of the window given in the input file and the
drawing area on the Edge display to calculate the size of the viewport:
 Calculate
 This is now used to get the height and width of the
viewport, knowing that the size of the drawing area is
600x500 (600/500 = 1.2)  assumes a 50 pixel blank border.
 If then .
 Else .
 Given this height and width, calculate viewport
boundaries as follows:




 The ``new window'' in the window to viewport transformation is
the transformed window on the projection plane:
,
,
,
.
The viewport is
specified by the above calculated .
What order should we do things in?
The general order of operations for your lab should be the following:
 Read in the input file.
 Calculate T(vrp) and R
 Save a copy of COP in world space for backface and lighting calculations.
 Calculate COP(also called PRP) in VRC coordinates.
 Calculate T(prp).
 Calculate vrp'
 Calculate Sh and Sc, remember that CW has a z component of 0 and
DOP = CWPRP(after R & T(vrp)).
 Calculate Nper = Sc*SH*T(prp)*R*T(vrp). (all of these are 4x4
matrices)
 Calculate
 Calculate Window to viewport transformation.
 Calculate Mper with d = zproj.
 Initialize Transform = Identity
 Loop for each rotation and scale the user clicks on
 Calculate the rotation or Scale matrix for rotation/scale about the
axis that was specified, call it T1.
 Set Transform = T1*Transform
 Transform points to world space, then to normalized
canonical view volume: .
Or, if doing illumination and backface rejection,
Transform to world space, backface reject, calculate
illumination, then transform to normalized canonical view volume.
 Clip points
 Transform by Mper.
 Divide by w.
 Perform window to viewport mapping.
I suggest using easy.dat to test the program!
David Ebert