CS 621 Contemporary Computer Graphics


Homework 3 , due March 4, 2009 ( Wed )

  1. ( 20 points ) Draw a lit sphere like the one shown below using the Phong model.

    Add to your image a cube that partially 'overlaps' with the sphere. Your program should allow a user to press the key 's' or 'S' to move the sphere forward ( to the front ) or backward respectively so that it may partially block the cube or the cube may partially block the sphere depending on their z value. ( Note that you need to "glEnable ( GL_DEPTH_TEST )".

  2. ( 20 points ) Consider vectors A = ( 1, 2, 5, 0 ), B = ( 3, 4, 2, 0 ), and two 4x4 matrices C and D with Make use of the functions in your raytracing package to find the following:
    1. |A|
    2. a unit vector in the direction of A
    3. A + B
    4. A - B
    5. AB
    6. A x B
    7. Angle between A and B
    8. Projection of B along A
       
    1. Projection of B perpendicular to A
    2. |C| ( determinant of C )
    3. C-1 ( inverse )
    4. CT ( transpose )
    5. C + D
    6. C ⋅ D
    7. C ⋅ A

  3. ( 20 points ) Make use of your raytracing package to do the following.
Make a demo of your programs to the instructor before a class or during the office hours. Then for each programming problem, just submit comments on your program, stating if it compiles and work properly, and the techniques you have used. If you have not made the demo, submit the program along with sample outputs.