CMPT 361
ASSIGNMENT 2
DUE DATE: MONDAY, NOVEMBER
13, 2000 - MIDNIGHT
Your
assignment has three parts:
· Create an environment which allows you to ADD, DELETE and manipulate (SCALE, ROTATE, TRANSLATE, SHEAR) objects in 3D space.
· Also allow control over the projections (ORTHOGRAPHIC, PERSPECTIVE) and camera orientation (CENTER OF PROJECTION, VIEW REFERENCE POINT).
· You must provide control for the objects via an input file.
· add <object> at <x,y,z> called <name>
where <object> is the name of one of the available objects (such as a cube), <x,y,z> is a
3D position in space, and <name> is a UNIQUE name you give the object (such as cube1).
· delete <name>
object gets deleted
· scale <name> by <Sx,Sy,Sz>
where <Sx, Sy, Sz> are scale factors in x, y and z. NOTE that scale should be relative
to the center of the object! (ie. scale cube1 by 10, 10, 10)
· rotate <name> by <Rx, Ry, Rz>
where <Rx, Ry, Rz> are angles of rotation (in degrees) around the x, y, and z axes.
NOTE that the rotation should be about the center of the object!
· translate <name> by <Tx,Ty,Tz>
where <Tx, Ty, Tz> is the 3D translation vector.
· scale <name> by <Sx,Sy,Sz>
where <Sx, Sy, Sz> are shear factors along the principle axes.
·
orthographic
projection
switch to orthographic projection.
· prespective projection
switch to perspective projection.
· centre of projection <Cx,Cy,Cz>
where <Cx, Cy, Cz> is the camera’s (viewer’s) eyepoint.
· view reference point <Vx,Vy,Vz>
where <Vx, Vy, Vz> is the point on the viewing plane on the line of sight that is
connected to the centre of projection.
· You will need to use homogeneous matrix multiplications to perform the scale, translate, rotate, and projection operations.
· 10% BONUS – implement a graphical user interface to perform all of the above operations (using GLUI).
Supplied Source Code:
· The only graphics routine you are allowed to use (and the only one you will need) is: writeLine(x1, y1, x2, y2)
Where (x1, y1) and (x2, y2) are the endpoints of the line, call it AFTER projecting the lines from 3D into 2D.
·
An assignment template
(and several GLUI examples) have been placed at:
http://www.sfu.ca/~swindell/cmpt361/cmpt361.htm
Documentation:
· Algorithms should be described with comments in the source code only, where appropriate. Tell us what your code is doing!
· Submit a short readme file to explain how to run your code
· Please submit your code and Makefile via the on-line submission system