COM1370, Summer 1998, Prof. Futrelle

Midterm Exam, Answer notes

 

The answers to most of the questions on the exam are in the book. So these notes point out where they are, plus offer some comments to clear up the most common problems that students had answering the questions.

1. At y=6, only two edges are active, the ones that meet at the top vertex. The data structures for edges is shown in Fig. 3-39 on pg. 121. Two data structures would be on the active list. Both would have Ye (end value) = 10. The first, or left edge would have X = 1 as the starting value and 1/m = 1/3. The right edge has X = 11 as its starting value and 1/m = -7/8 (a negative value). You were to show these as a linked list of two nodes.

2a. This was a bit of a messy problem. It's easy to get bogged down in details with problems like this, so it can be a good idea to do the calculations with a simpler representation. Thus, we could write the matrix as,

 c  -s  0
 s  c  0
 0  0  1

2b. When squared gives,

 c- s2  -2cs  0
 2cs  c- s2  0
 0  0  1

The sine term is delta and the matrix element in the top center in the squared form works out to -2delta + delta3. To a good approximation we can ignore the second term compared to the first so the matrix element is approximately -2delta, indicating twice the angle of rotation. (If delta = 0.1, the first term is -0.2 and the second is 0.001, or 1/200-th the first term.) This argument can be carried through for the c- s2 matrix element also, though it's messier.

2c. The matrix for N simply has 2delta everywhere M has delta, so it closely matches M2.

3. The order is 7 4 3 1 2 5 6 8 9 10. Most people did fine with this. A few got the stack wrong -- at a given step, the element to remove from the stack is that last element that was inserted.

4. The standard way to rotate around a point is given in equation 5-32, pg. 193, and for our case is:

The first matrix on the right translates everything so that the tip is at the origin, then rotates everything around the origin by pi (= 180 degrees) and moves everything back with the inverse translation. After that, another translation matrix is applied (on the left) of the form T(-50,-40). In an animation, it would be best to flip the spaceship above the ground and only after that move it to its landing spot. That's why I asked you to rotate it around the tip first.

The form of the matrices is given on page 190 of the text, with cos(pi) = -1 and sin(pi) = 0.

5. Phong shading is discussed on pgs. 525-526. In it the surface normals are averaged to get the vertex normals, and then these are interpolated along the edges and finally along intermediate scan-line points. The major problem that most people had was that they didn't explain how the intensity is computed once the vector is obtained. The simplest form that involves the surface normal is eq. 14-4 on pg. 499. The more complex form, for specular reflection is given in eq. 14-5 on pg. 501. The diagram for the four vectors is Fig. 14-12, pg. 501.