Polygon Filling

CSC-214 · Semester III · Computer Graphics

Polygon Filling (Scanline)

Fill a rectangle by computing span intersections per row.

Row 0 processed: .......... — every cell between the left and right boundary pixel is painted.

Scanline fill algorithm

  1. For each horizontal scanline, find intersections with polygon edges.
  2. Sort intersections left to right.
  3. Pair them up: fill between (0,1), skip (1,2), fill (2,3)...

Handles concave polygons too, once the even-odd rule is applied consistently.

Scanline trace:

..........