Assignment 1—Hello Wireframe World Due: Tuesday September 10

advertisement
Assignment 1—Hello Wireframe World
Due: Tuesday September 10 at 7am
1. Implement a 3-D vector class that stores 3 floats and has the following functionality:
a. Constructor from 3 floats
b. Read/write access through square brackets operator “[]”
c. Addition of two vectors
d. Subtraction of two vectors
e. Dot product
f. Cross product
g. Multiplication by scalar
h. Division by scalar
i. Normalization
j. Length computation
k. Rotation of “this” point about arbitrary axis
l. Rotation of “this” vector about arbitrary direction
m. Output to ostream, input from istream
2. Implement a 3x3 matrix class that stores 3 3-D vectors as rows and has the following
functionality:
a. Constructor from 3 3-D vectors
b. Read/write access to rows through square brackets operator “[]”
c. Function to get column
d. Function to set column
e. Multiplication with 3-D vector
f. Multiplication with another matrix
g. Inversion
h. Transposition
i. Function to set matrix as rotation about principal axis by theta degrees
j. Output to ostream, input from istream
3. Implement a planar pinhole camera class that stores the center of projection, the vector from
the eye to the top left corner of the image, the pixel width vector, the pixel height vector, and
the image resolution and that has the following functionality:
a. Constructor from resolution and horizontal field of view
b. Left-right, up-down, and forward-backward translations
c. Pan, tilt, roll rotations about center of projection
d. Change of focal length
e. Projection of 3-D point
f. Interpolation between two given cameras
g. Save / load from text file
1
4. Implement a frame buffer class that stores unsigned int pixels and the resolution of the frame
buffer and that has the following functionality:
a. Construction from input resolution
b. Set all pixels to given color
c. Set one pixel to given color
d. Draw 2-D segment with color interpolation
e. Draw 3-D segment with color interpolation
f. Draw axis aligned rectangle
g. Draw planar pinhole camera frustum
h. Load / save from tiff file
5. Implement a triangle mesh class that stores shared vertices and triangle connectivity data and
that has the following functionality:
a. Load from bin file
b. Computation of 3-D axis aligned bounding box (AABB)
c. Translation of vertices
d. Scaling of vertices
e. Placing the centroid at given position and scaling to given AABB size
f. Rendering in wireframe
6. Demonstrate your code.
a. Create a scene with at least 5 objects.
b. Each object should rotate about an arbitrary axis.
c. At least one object should be spinning, i.e. rotating about an axis passing through its
centroid.
d. Render a 10s 30Hz 720p video sequence illustrating your scene. For the first 5 seconds
the camera should be fixed. For the next 5s the camera should move progressively from
the initial view to a second view. The video file should be in a popular format. Use the
video making software of your choice.
7. Turn in via blackboard one zip archive that contains
a. Source code
b. Executable
c. Video file
© Popescu 2013, popescu@purdue.edu
2
Download