Asg 1: Translate the camera in 3D perspective

Objectives

Set up a Camera object (class) that contains the camera's pos (position), ref (refernce point), and vup (vertical tilt), where each of these three are 3D vectors (a numpy.array). Provide GLUT callbacks to translate the camera.

Assignment

  1. Use the gldraw.py program as the starting point, which allows reading in of Alias Wavefront .obj files.
  2. Create a Camera object that contains the following data objects:
  3. Note that you will need to use numpy.array([0.0,0.0,0.0]) for each of the pos, ref, vup instead of basic tuples (basic tuples are non-mutable).
  4. You can import numpy as np to make the typing easier
  5. Set up keyboard callbacks that adjust the camera position and reference to move (translate) the camera
  6. Suggested key bindings (if you use different ones, provide a USAGE file):

Details

  1. Your code should set up a projection matrix with gluPerspective(90,1.0,1.0,1000.0)
  2. Your code should just use an identity matrix for the modelview matrix, i.e., glLoadIdentity()
  3. Initialize the camera position, reference point, and tilt vector and use them as arguments to gluLookAt(), starting with:
  4. Set up keyboard callbacks so that, depending on the key pressed, e.g., a to translate left, the camera object is called so that "the camera moves itself", e.g., the_camera.crab(-0.1).
  5. The camera object can be made global, e.g., declared as global the_camera at the top of gldraw.py just like global points.

Turn in

Turn in all of your code, in one tar.gz archive of your asg##/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    4. Lessons learned, identified interesting features of your program
    5. Any special usage instructions
  2. source code (.py source)

How to hand in

See handin web page

Grading scheme