https://jiahuanglin.xyz/posts/scanline-algorithm/
Scanline algorithm - Jacob Lin