3 ms·
I don't know if it is particularly elegant, but I have a soft spot for Bresenham's line algorithm - it's not so much about lines as it is an algorithm to repeat
by vanderZwan 13y ago
I don't know if it is particularly elegant, but I have a soft spot for Bresenham's line algorithm - it's not so much about lines as it is an algorithm to repeatedly add fractions to an accumulator using only addition and subtraction and without rounding errors (altough intermediate results are rounded to their nearest integer value).
- anonymous 13y agoBresenham's line algorithm generalises trivially to drawing trapezoids, too. There's also Bresenham's elliptic arc drawing algorithm that's similarly beautiful.