# CG Homework 4, due Thu 2016-09-29 9am

1. (2 pts) (Reverse engineering rotations) In 2D, if the point (3,2) rotates about the origin to (2,-3), what's the angle?

2. (2 pts) Give the matrix M that has this property: for all vectors p, $Mp = \begin{pmatrix}3\\4\\5\end{pmatrix} \times p$.

3. corrected (2 pts) Give the matrix M that has this property: for all vectors p, $Mp = \left( \begin{pmatrix}3\\4\\5\end{pmatrix} \cdot p \right) \begin{pmatrix}3\\4\\5\end{pmatrix}$.

4. (2 pts) Why can the following not possibly be a 3D Cartesian rotation matrix?

$\begin{pmatrix} 2& 0 &0\\1 & 0 &0\\0& 0 &1\end{pmatrix}$

5. (2 pts) Use any method (not involving soliciting answers on the internet) to rotate the point (4,4,6) by 60 degrees about the axis (2,2,3). Explain your method. (E.g., if you saw the answer in a vision, are your visions generally accurate?)

6. (2 pts) Can the volume of a small cube change when its vertices are rotated? (yes or no). Why (not)?

7. (2 pts) What is the ''event loop''?

8. (2 pts) Why does putting all your vertices into an array and telling OpenGL about it make a big graphics program faster?

9. (2 pts) Since the Z (aka depth) buffer looks so useful, why is it not enabled by default?

10. (2 pts) What's the quaternion representing a rotation of 180 degrees about the axis (0,0,1)?

11. (2 pts) Use the quaternion formulation to rotate the point (0,1,0) by 180 degrees about the axis (0,0,1).

12. (2 pts) Use the vector formulation to rotate the point (0,1,0) by 180 degrees about the axis (0,0,1).

13. (26) Extend your program from last week that displays the Starship Enterprise as follows:

1. Do the rotation in the vertex shader instead of in the javascript program.
2. Make the color of each pixel depend on its z-value.

(Total: 50 points.)