CS 551/645: Introduction to Computer Graphics

Assignment #4

Goal: Implement clipping of triangles

Assigned: Wednesday, September 29, 1999

Due: Wednesday, October 6, 1999

Relevant reading/files/software:

Synopsis: You will design a clipping stage for the rendering pipeline we are building. Your clipper will take as input the three vertices of a triangle, clip the triangle, and draw the clipped polygon (if any) using libtri.a.

Specifics: We are providing a header file cliptri.h defining function prototypes for the library; you will have to fill in the source code for those functions. You can reuse the framebuffer library from Assignment 3 (frame.h, and frame.c) for debugging purposes. We also provide the usual Makefile, and a canonical version of tri.h and libtri.a (for solaris, and for irix, both of which were last modified on Friday at 5:25PM) to use if you wish. A few things to note:

setviewport(100,100,200,200);

drawcliptri(0,0, 400,0, 0,400); // leaving off the color info

will draw a triangle entirely covering the viewport. In this case pixels such as (100,100) and (200,200) will be turned on.

Test Files: You may wish to reuse the test files from Assignment 3.

Grading: The usual 10-point scale. An assignment that does everything correctly will receive 8 points. Fast algorithms (that still produce correct output!) can earn up to 9 points. Points will be deducted for assignments that don't compile "out of the box", or that crash on some input, or that produce incorrect output (e.g., turning on pixels that should be unaffected, or failing to turn on pixels that should be affected). The two fastest (and entirely correct) assignments get 10s.

Turning in the assignment: Before class starts on Wednesday, October 6, you should:

Advice: Get it working (shouldn't be too hard), then make it fast.