Edge Coherence

Not all edges intersect each scan-line.

Many edges that are intersected by scan-line i will also be intersected by scan-line i+1.

The formula for the scan-line s is y = s, for an edge y = mx + b.

Their intersection is s = mx + b which yields x(s) = (s - b)/m.

For scan-line s + 1, x(s+1) = (s+1 - b)/m = x(s) + 1/m.

x(s+1 = x(s) + 1/m.

Polygon edges are sorted according to their minimum Y. Scan-lines are processed in increasing (decreasing) Y order. When the current scan-line moves above the upper endpoint, the edge becomes inactive.

Active edges are sorted accoring to increasing X. Filling the scan-line starts at the leftmost edge intersection and stops at the second. It restarts at the third intersection and stops at the fourth.