# Why is the scan line filling algorithm so seemingly over complicated?

It makes use of tables, buckets, and sorting, which all seem unnecessary.

I don't understand why I can't just fill between pairs of scan line intersections, ignoring vertices and edges with gradient 0.

My lecturer didn't provide the best notes on this algorithm, and all I can find online are even more complicated versions of it.

An ideal answer would be an explanation of the algorithm, and a reason why simply filling between pairs of intersections won't work.

• Some things to consider, while you wait for the answer. How would you get a unsorted dataset in order if not by sorting? So nearly every algorithm stars by organising data to suit their need. Where would you store that data? Suddenly you have tables and sorting on everything you do. May 22, 2017 at 5:37
• I agree, explanations seems to be rather confusing... I have found zero that seemed clear. I needed this algorithm for a project so I went searching for implementations. I ended up doing it myself from scratch and what I found was this: these extraneous pieces which are almost always roped in (as you say: tables, buckets, sorting)... only exist to reduce computation aka speed it up. In its essence, all you're doing is scanning across a plane line by line, and if you cross a polygon edge then you toggle between filling/not-filling.
– DAG
Sep 27, 2023 at 17:59