CS 381, Fall 2007
HW #3

General Information

Homework Policies

See the Homework Policies handout.

Questions (10 pts)

  1. Let u = (1, –1 ,2), and let v = (0, 3 ,1). Compute each of the following.
    1. 2u.
    2. u + v.
    3. u · v.
    4. u × v.
    5. Find the angle between u and v, in degrees, to one decimal place.
  2. Derive the 2D rotation matrix, R(45), for a 45 degree counterclockwise rotation of a point around the origin.
    1. Demonstrate the transformation by multiplying R(45) by the point (1,1).
  3. Derive the 2D translation matrix T(P), which translates a point Q to the point Q + P using homogeneous coordinates for P and Q.

Program #1 (5 pts)

Compile and run the OpenGL program double.c
  1. How does resizing the window affect the animation with respect to the size and rotation speed of the square? What does myReshape() do?
  2. What functions do the mouse buttons perform? Modify the program to attach a popup menu to the left mouse button which replaces all other button functions. The menu should have entries for "start", "stop" and "quit".
  3. What variable controls the rotation speed of the square? Modify this variable by trial and error to make the square rotate at a speed of approximately 1 full rotation per second.
  4. Based on the results of (c), estimate the display update rate in frames per second (fps) for your system. Explain your estimate.

Program #2 (5 pts)

Compile and run the OpenGL program timer.cpp. Modify the program to display an analog clock as a circle with a radial line representing the second hand that makes one revolution every 60 seconds.

Extra Credit:

Note

Particularly well-done programs may be demonstrated in class.


CS 381, Fall 2007: Assignment 3 / Last update: 2 Oct 2007