### CSC418/2504F: Fall 2002 Assignment 1 (30 marks)

sept. 18, 2002. Due: oct. 2, 2002 in class.
1. Realism [3 marks] A jaguar leaps into a pond.  You are shown two versions of this scene, one a film of the actual scene, the second a computer graphics version of the same scene.  List at least 6 differences that would allow you to tell when you were watching a computer generated animation. Be succinct.  (Camera model differences as discussed below are not allowed here!) [BONUS 1 mark] What is the air speed velocity of an unladen swallow? How is it different from the air speed velocity of a computer generated unladen swallow?
2. Camera Models [3 marks]  The camera model normally used in computer graphics is a "perfect" pinhole camera.  Real cameras must regulate the amount of light hitting the film plane in order to achieve proper exposures.  They have two mechanisms for doing this that are missing from the camera model used in computer graphics.  Identify these two mechanisms and explain why computer graphics images will often differ from camera images due to the simpler camera model used.
3. Vectors [4 marks] An underground gun located at <1,-1,3> and pointed at <1,2,7> is fired with a velocity of 10, on a planet with gravity 18. <x,0,z>  is the ground plane. Given the familiar motion of equation s=ut-0.5gt2(s is the displacement, u the initial velocity, g is gravity and t the time elapsed), calculate the time elapsed before the shell hits the ground and the location at which it hits the ground. A target of radius 4 has been painted on the ground centered at <2,0,7>. Does the shell hit the target? (All distances given are in meters and time in seconds).
4. Gamma-correction [3 marks] An image  I0 is displayed on a monitor that has a non-linearity factor of  γ1 without any Gamma correction. The image on the monitor is captured perfectly with a camera to generate an image I1. We now wish to display I1 on the monitor as a gamma corrected image I2. Write the gamma-corrected  image I2 as a function of I so that image I0 is correctly displayed on the monitor.
5. Transformations [5 marks] You are given an ellipse centered at <4,2> with a semi-major axis X, semi-minor axis Y of 3 and 4 respectively. We wish to apply an affine transformation M of the form below that converts the ellipse into a circle of radius 1 centered at <0,0>.
p' = Mp,   where p=[x,y,1]T and M is a 3x3 matrix of the form:
 [ a b c ] [ d e f ] [ 0 0 1 ]
1. [3 marks] Write the matrix M for such a transformation if one exists.
2. [2 marks] Decompose M into a scale matrix S, and translate matrix T.
1.  [12 marks] Write a program using OpenGL that:
1. [2 marks] Allows you to plot a sequence of 6 points on the screen by clicking the mouse 6 times.
2. [6 marks] A fixed viewport will be drawn on the screen in red.  Its coordinates are (-1.5,-1.5), (-1.5,1.5), (1.5,1.5), (1.5,-1.5),.  Treat the sequence of points as a polygon. Clip it to lie inside the viewport
3. [4 marks] For any convex polygon, triangulate the polygon. Alternate the colour of the triangles between white and red.  (i.e. every other triangle should be red.)
4. [4 marks BONUS] Extend the above to work with arbitrary polygons (i.e. concave or convex)

Use the template code provided at:

Submit your code electronically on CDF, using one of the following commands:
• `submit -N a1q6 csc418h poly.cpp ui.cpp`
• `submit -N a1q6 csc2504h poly.cpp ui.cpp`
Submit a printed copy as well.