$30
Homework 2
CS 354, BME 345
1. (5 points) Vector v = [x y z 0]T
is rotated about the x-axis until it lies in the xz plane. The new vector
is v
0
. What is |v
0
| (the length of v
0
)?
2. (5 points) Using v
0
from problem 1, v
00 is the projection of v
0 onto the z axis. What is |v
00|?
3. (10 points) Happy Harry is happy even when he’s sleeping. Give a series of 3x3 2D transformation
matrices (using homogeneous coordinates) in the proper order to transform Happy Harry from his
awake position centered at (x, y) (figure a) to his sleeping position centered at (x, 0) (figure b). Leave
any trigonometric functions unevaluated (leave rotation matrices in terms of sine and cosine).
(a) (b)
4. (5 points) A wireframe cube (see wikipedia: “wire-frame model”) is placed at the origin. The camera
is placed using gluLookAt(0, 0, 5, 0, 0, 0, 0, 1, 0). Using perspective projection, sketch what
will be rendered on the screen.
5. (10 points) The camera is placed using gluLookAt(0, 10, 5, 0, 5, 0, 0, 1, 0). What are the
coordinate axes u, v, n? Show your work.
6. Consider the following code:
glutInitWindowSize(500, 500);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1, 1, -1/3.0, 1/3.0, 1, 3);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 2,
0, 0, 0,
0, 1, 0);
glColor3f(0, 0, 0);
glutWireCube(2);
(a) (5 points) Sketch what will be rendered.
(b) (10 points) What percentage of the cube’s volume lies inside the view frustum?
1