DDA Line Drawing

CSC-214 · Semester III · Computer Graphics

DDA Line Drawing

Digital differential analyzer — stepping by the larger delta.

Current pixel

step 0: x=2.0, y=2.0 → pixel (2,2)

Algorithm

  1. Compute dx, dy; steps = max(|dx|, |dy|).
  2. xinc = dx/steps, yinc = dy/steps.
  3. Start at (x0,y0); repeatedly add increments and round to the nearest pixel.

This example: dx=33, dy=15, steps=33.