Bresenham developed an algorithm for drawing straight lines
on a raster device. This algorithm uses integer arithmetic only and is faster
and more accurate than the more obvious algorithms that use floating-point arithmetic.
Most raster devices contain embedded variants of Bresenham's algorithm.

To connect P_{1} = (x_{1},y_{1}) with
P_{2} = (x_{2},y_{2}) on a raster device:

The Algorithm:
var dy = y2-y1 var dx = x2-x1 var d = 2*dy - dx var x = x1 var y = y1 while (x <= x2) { |