Professional Documents
Culture Documents
Digital Differential Analyzer
Digital Differential Analyzer
The basis of the DDA method is to take unit steps along one coordinate and
compute the corresponding values along the other coordinate. The unit steps
are always along the coordinate of greatest change, e.g. if dx = 10 and dy = 5,
then we would take unit steps along x and compute the steps along y.
Let us assume a line of positive slope and draw from x1, y1 to x2, y2.
{slope = m = dy/dx}
if m <= 1.0 then
For a line with slopeslope < 0.0 and drawing from x1, y1 to x2, y2, i.e., left to
right then:
if |m| < 1 then
let dx = 1 and yi+1 = yi + m
else {|m| 1}
let dy = -1 and xi+1 = xi -1/m
if draw from x2, y2 to x1, y1 (right to left) then:
if |m| < 1 then let dx = -1 yi+1 = yi -m
else {|m| 1} dy = 1 xi+1 = xi + 1/m