Bresenham's line algorithm (source code)

= Bresenham's line algorithm
{c}
{wiki}

<Jack Bresenham>'s <raster graphics> <algorithm> selects a thin sequence of <pixels> to represent a <line segment> by exact incremental <integer arithmetic>. For a first-octant segment with $0\leq\Delta y\leq\Delta x$, a scaled <midpoint line decision> chooses between the next same-row and next higher-row <pixels>.