Assignment 3: Due Sept 25
Add clipping of points and lines to the package. Implement the Cohen-Sutherland Clipping Algorithm described in the text, and in class.
You might consider adding a routine set_clipping(on/off) which lets your package either turn on or off clipping. This can be useful for debugging purposes. With clipping off, you'll be in the situation of Assignments 1,2 which presumably already work when you start on Assignment 3.
Clipping should be added in a device-independent way. That way it is available to all of your drivers and to any future drivers that you create. So it would be belong in libindep.c.
As a test of clipping we will use the following demo:
Create a window with corners (0,0) and (10,10). Create a viewport with corners (0.2,0.2) and (0.8,0.8)
Draw the lines: (2,2) to (8,8) (12,2) to (11,9) (12,2) to (8,3) (-3,5) to (5,13) (-3,8) to (5,16)
Obviously no line should be seen outside the viewport if the code is working correctly.