UNB/ CS/ David Bremner/ teaching/ cs4735/ milestones/ CS4735 Assignment 4

Part 1: Rasterization and clipping


Given a polygon with vertices (in counterclockwise order):{(3, 5), (1, 7), (1, 1), (7, 6), (3, 5)}

  1. Find the Edge Table for the scan line algorithm
  2. Find the Active Edge Table for lines 4,5, and 6
  3. Clip the edges to the 3x3 viewport with lower left corner at (2,3); use the Cohen-Sutherland algorithm.

Part 2: Clipping Rays

Write a procedure (in pseudocode) to test whether a line P+t ũ intersects an axis aligned rectangle lying on the z=0 plane. The inputs to your procedure are P, a point in space that does not lie on the z=0 plane, ũ, an arbitrary vector not orthogonal to the z-axis, and the bottom left and top right corners of the rectangle to test against. If the line does not intersect the rectangle, then the procedure should return a special value MISS to indicate this, and otherwise it should return the (x,y) coordinates of the intersection point.