Source: Rasterization: a Practical Implementation (Scratchapixel)