CSC418/2504F: Winter2002 Assignment 1

jan. 17, 2002. Due: jan. 31, 2002 in class.

Frequently-asked questions.

Solutions!

Questions about marking.

  1. Realism [3 marks] List at least 6 areas where the computer-generated animation of Bruce Lee shown in class would differ visually from a video tape of the actor. Be succinct.
  2. Vectors [8 marks] A disco ball hangs from the ceiling of the Purple Pyjama nightclub. In coordinate space it is centered at <20,20,20> with a radius of 4. It is controlled by a remote located at <10,9,8> that fires a laser beam with a direction vector of <1,1,1>. The target area for receiving the beam is the part of the sphere surface within a 30 degree cone, with its axis pointing downward along <0,0,-1> from the center of the ball as shown in the Figure. The organization MAD (Mothers Against Disco) have sent a sniper to destroy the ball. The sniper hits the ball with three shots. For the ball to be destroyed all three shots must hit within some hemisphere of the ball. 
  1. [3 mark] Does the laser beam hit the ball?
  2. [3 mark] Does the beam hit the ball within the target area? (Hint: convert cartesian to spherical coordinates).
  3. [1 mark] What is the probability the ball is destroyed if it rotates at 2 kmph?
  4. [1 mark] What is the probability the ball is destroyed if it is stationary?
  1. Gamma-correction [3 marks] An image  I0 has been Gamma corrected to account for a non-linearity factor of  γ1 of  monitor-1 to produce an  image  I1 ,where  I1(x,y) = (I0(x,y))1/γ . We now wish to display image I0 on monitor-2 with a non-linearity factor of γ2 . Write the gamma-corrected  image I2 as a function of I so that image I0 is correctly displayed on monitor-2. 
  2. Transformations [6 marks] You are given an ellipse centered at <2,3> with a semi-major axis X, semi-minor axis Y of 5 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:
    [abc]
    [def]
    [001]
  1. [3 marks] Write the matrix M for such a transformation if one exists.
  2. [3 marks] Decompose M into a scale matrix S, and translate matrix T.
  3. [2 marks BONUS] Prove or disprove that an ellipse with its principal axes along X and Y can be transformed to a circle of radius 1 centered at <0,0> using only a scale and translate operation.
  1.  [10 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. You then specify a rectangular viewport by clicking and dragging using the mouse. 
    2. [6 marks] Treat the sequence of points as a polygon. Clip it to lie inside the viewport.

    Suppose we now triangulate the clipped polygon and scan convert every other triangle (If you look at any internal edge you have introduced to triangulate your polygon, one and only one of the two triangles on either side of the edge should be scan converted).

    1. [1 marks] Is the number of generated triangles always the same for a polygon of m vertices. Is it the same if the polygon after it is clipped has n vertices and if so, how many triangles are generated?
    2. [1 mark] Is it always possible to scan convert every other triangle as described?

    3. [3 marks BONUS] Given a convex polygon with n vertices what is the number of different triangulations T(n) it can have (Example : T(3)=1, T(4)=2, T(5)=5,T(6)=14). 

    Use the template code provided at: Submit your code electronically on CDF, using one of the following commands: Submit a printed copy as well.