This section will present pseudo-code for the Polygon Scan Conversion algorithm to the user. The writing of the actual code for the algorithm will be left as an exercice for the reader.
Procedure MAIN
Begin
initialize ET
initialize AET
build ET
y = <smallest non-empty bucket in ET>
AET = NIL
While ET and AET are not empty
Begin
Move all edges from ET[y] whose Y-min = y to the AET, sorting on x
Using the odd-parity rule on the x coordinates in the AET, fill in appropriate pixel values.
Remove from the AET all edges for which y = Y-max
Increment y by 1
For each nonvertical edge remaining in the AET, update x for the new y
resort AET
End
End
From Graphica -- see details 26.11.1996