Every screen you have ever looked at is a grid of square pixels. Drawing a straight line on that grid is already a small puzzle — Bresenham's line algorithm solved it in 1962 using only integer arithmetic. A circle is harder: its equation is , and solving for at each involves a square root — an expensive floating-point operation that early hardware simply did not have.
In 1977, Jack Bresenham published a midpoint (or decision-variable) approach that removes the square root entirely. The key insight has two parts:
- 8-way symmetry. A circle is symmetric about both axes and both diagonals, so computing one pixel in the first octant (, ) immediately gives you seven more pixels for free.
- Integer decision variable. Instead of computing at each step, you maintain an integer that tells you whether the next pixel should step straight right or diagonally down-right. Updating costs only addition and subtraction — never a multiply or divide.
The result is one of the fastest circle-drawing routines ever devised, and it still powers the rasterizers embedded in GPUs and font renderers today.
Comments
Loading comments...