Computer Graphics CSC418/2504F, Fall 2000: Assignment 1

Due date: in class, 4 Oct. 2000.

Frequently Asked Questions.

Solutions

Marking criteria for questions 5 and 6.

Marking:

Do you have a serious question about your mark? Please contact the marker responsible. The TA's responsible for marking assignment 1 are:

If you cannot resolve the problem, then submit the assignment to the professor for re-marking. Include this cover sheet with your request. Please note that re-mark requests submitted more than 2 weeks after the assignment is returned (ie, after November 10th, 2000), will be not be considered.

  1. (Cameras)
    1. [1 mark] When an object is closer to us, we can see it in more detail. What aspect of the human visual system is responsible for this? Keep your answer brief.
    2. [1 mark] Why do we need microscopes to see tiny objects?
    3. [1 mark] Consider a pinhole camera with a pinhole-to-film distance F, and pinhole of diameter D mm, using film 35mm wide. How wide an object can be photographed at distance S mm from the pinhole?
    4. [1 mark] For the same camera, will the image be perfectly sharp? If not, how wide an image will a point of light produce?



  2. (Rasters)
    1. [1 mark] Consider a non-interlaced raster monitor with H scan lines, and W pixels per scan line, a refresh rate of R frames per second, horizontal retrace time of Th, and vertical retrace time time of Tv. What fraction of the frame time is spent retracing the electron beam?
    2. [1 mark] Consider an n x n frame buffer stored as a two-dimensional array a, such that pixel a[0][0] is at the top left corner and a[n-1][n-1] is at bottom right. Write a short fragment of C code that rotates the raster by 90 degrees counter-clockwise, without using too much extra storage.



  3. (Transformations)
    1. [1 mark] Assuming 2D coordinates (3x3 homogeneous matrices), show that rotations and translations do not commute.
    2. [1 mark] Derive a 3x3 homogeneous matrix that scales an object by a factor S, along the line y = m x.



  4. (Clipping) Clipping a polygon P to a rectangular window yields a new polygon CP, which may have a more or less vertices than P.
    1. [1 mark] if P is a triangle, how many vertices will CP have, at most?
    2. [1 mark] if P is a quadrilateral, how many vertices will CP have, at most?
    3. [1 mark] if P is convex and has N>4 vertices, how many will CP have, at most?
    4. [1 mark] if P is convex and has N>4 vertices, how many will CP have, at LEAST? (assume P is not trivially clipped).




  5. (Ray casting) [6 marks] Write a C program to test if a polygon contains a point, using the Jordan curve theorem (assume the point does not fall on a vertex or edge). The program reads the point and polygon from stdin, and writes the result ("in" or "out") on stdout. You MUST modify the code supplied at: Submit your code electronically, using one of the following commands: Submit a printed copy as well.



  6. (Interaction) [6 marks] Write a program using OpenGL which lets the user manipulate a rectangle, using the mouse. The user should be able to:
    1. click near a corner and drag it to a new position.
    2. click near an edge and drag it.
    3. click inside the rectangle and move the whole rectangle, without changing its shape.
    4. [1 mark bonus] click outside the rectangle to rotate it.
    Use the template code provided at: Submit your code electronically, using one of the following commands: Submit a printed copy as well.