CSC418/2504F: Winter 2002 Assignment 2

Feb 12 2002,  Due: Tues. Feb. 26, 2002 in class. 
  1. Transformations [4 marks] Consider the following 2-dimensional coordinate frames A and B and C.
    1. [2 mark] What are the coordinates of point P in frames A, B and C?
    2. [2 marks] What is the 3x3 homogeneous matrix MBC that, when multiplied by a point in frame B, yields that point's coefficients in frame C?
  2. Modeling [6 marks] A square pyramid is shown below.
    1. [1 mark] What is the volume of the pyramid?
    2. [1 mark] Count the number of faces, vertices and edges of the object. Do the same for a cube. Can you infer a relationship between the number of faces, vertices and edges of closed objects like these?
    3. [4 marks] What are the outward-facing unit normal vectors for each of the 5 faces and 5 vertices of the object?

  3. Ray Tracing (8 marks)
    In ray tracing, primary rays are shot from the eye, through pixels, and tested for intersection with objects. Write a program to intersect a primary ray with a cylinder with hemispherical caps (looks like a sausage) defined by the two point P1 and P2 and a radius r.  The parametric form of a ray starting at P, in direction V is Your program must read input from  stdin in the example form....

    0.5  1.6  2.7

    2 4 7

    8.3  9.1  -0.3

    6.0  -5.2  -8.9

    7.6

    where the ray is defined by the its origin <0.5  1.6  2.7> and direction <2 4 7> and the cylinder with hemispherical caps by 

    points <8.3  9.1  -0.3> and <6.0  -5.2  -8.9> and radius 7.6.

    the program should ouput the first intersection point to stdout if there is an intersection and "no intersection" if there is 

    no intersection between the ray and the primitive.

    Submit your code electronically, using one of the following commands:

    Submit a printed copy as well.

     

  4. Graphics pipeline [3 marks] You have been asked to write a cartoon like shader that only draws the sharp edges of an object to get a line drawing of the object. Basically you are to draw all the edges of a polymesh object whose adjacent faces F1 and F2 meet a sharp angle critereon (i.e. the angle between the normals to faces F1 and F2 is greater than 60 degrees). Can the edges to be drawn be determined after perspective projection and just prior to scan conversion, If so what is the test? How do the edges to be drawn change with changes in the camera eye position? What are the pros and cons of making this test in world coordinate space?  
  5. Hierarchies [9 marks] Write a program to draw and control this hand:

    1. [3 marks] The program has the palm and one digit of finger3 drawn. Draw the rest of the fingers.
    2. [3 marks] Write code to draw a cylinder that will be used to draw the yellow knuckles as show in the figure.
    3. [3 marks] We wish to be able to detect collisions between the digits of the fingers and the palm. To do this, develop an algorithm that will test for intersection between two cuboids. Write pseudo-code for this algorithm? (You do not need to program this).
    4. [3 marks] EXTRA CREDIT : Program the intersection check in (c) for the blue digits of the fingers and the palm so that if any of the blue digits intersects the palm, it is colored white (RGB=1,1,1)  instead of blue.
       Skeleton code is provided at
    5. [2 marks] EXTRA CREDIT : Add controls to the UI for rotation of the wrist around the X,Y,Z axes and make the hand rotate accordingly at the base of the palm (0,-3,0). 
    Submit your code electronically, using one of the following commands: Submit a printed copy as well.