CSC418/2504F: Fall 2001 Assignment 1

Sept. 19, 2001. Due: Oct. 3, 2001 in class.

Frequently-asked questions.

Solutions!

Questions about marking.

  1. Realism [4 marks] Suppose you are watching a computer-generated animation of a person drinking a glass of water. Based on animations you have seen, how do know that you are not watching a video tape of a real person? List at least eight differences. Be succinct.

  2. Illumination and Vectors [4 marks] The area illuminated by a beam of light from direction L depends on the cosine of the angle θ the beam makes with the surface normal N: |N||L|cosθ = N·L. Suppose the sun is at the zenith (directly overhead), at (latitude,longitude)=(0,0). The sun deposits 1370 W/m2 of light energy at that point on the earth's surface (ignore the atmosphere).
    1. [1 mark] At (lat,lon)=(30oN,0), how many degrees is the sun away from the zenith?
    2. [1 mark] At (lat,lon)=(30oN,45oW), how many degrees is the sun away from the zenith? (Hint: convert spherical to cartesian coordinates).
    3. [1 mark] How much solar energy is deposited at (lat,lon)=(30oN,0) and (30oN,45oW)?
    4. [1 mark] A cube-shaped building at (30oN,45oW) has its four walls facing E,W,N and S. How much solar energy falls on each of the walls? (Hint: use vector cross-products).

  3. Clipping [5 marks]
    1. [3 marks] Use the Sutherland-Hodgman algorithm to clip this polygon on this rectangular window:
      Vertex x y
      1 50 80
      2 250 150
      3 50 220
      4 210 150
      Clip Line Value
      B y=100
      T y=200
      L x=0
      R x=200
      • Clip the polygon in the following order: T,L,B,R.
      • List the vertices of the intermediate polygon after each pass.
    2. [2 marks] What shortcomings in the algorithm are evident? How can you overcome them?

  4. Gamma-correction [2 marks] To blend together two images I1 and I2, we normally compute their weighted average, for each pixel: However, the brightness B(x,y) of a pixel on a computer monitor does not correspond linearly to the pixel value I(x,y). Instead, it follows a power law: How would you modify the blending equation to account for this non-linearity?

  5. Scan Conversion [4 marks]
    1. [3 marks] Build the edge table for the following polygon:
    2. [1 mark] Will the Active Edge List algorithm work correctly for this polygon? Why or why not?

  6. Transformations [5 marks] 2D rotation, scaling, shear and translation are all affine transformations, of the form
    p' = Mp,   where p=[x,y,1]T and M is a 3x3 matrix of the form:
    [abc]
    [def]
    [001]

    1. [3 marks] An affine transformation can be completely specified by its action on three points. What is the matrix for the transformation that maps the points A(0,0) B(1,0) and C(1,0) to the points A'(1,2) B'(1,1) and C'(2,1) respectively?
    2. [2 marks] Points on a conic section (a parabola, ellipse, hyperbola, or line) obey the following implicit equation:
      • F(x,y) = hx2 + 2kxy + my2 + 2nx + 2ry + s = 0
      where h,k,m,n,r and s are constants. Show that applying a 2D affine transformation maps conic sections to conic sections. Hint: write F(x,y) in the form pTAp, where A is a 3x3 matrix.

  7. Interaction [6 marks] Write a program using OpenGL which lets the user manipulate a rectangle, using the mouse. The user can drag a corner handle or an edge handle to reshape the rectangle, or the center handle, to translate the rectangle. Use the template code provided at: Submit your code electronically on CDF, using one of the following commands: Submit a printed copy as well.