Computer Graphics Line Algorithm Comparator
DDA Bresenham
Pixel-Level Visualization

DDA vs Bresenham's
Line Algorithm

Watch two rasterization algorithms draw the same line — pixel by pixel. Step through each decision, compare pixel choices, and inspect Bresenham's decision parameter pk live.

DDA — Digital Differential Analyzer

Computes each pixel by incrementing floats along the parametric form of the line:

xi+1 = xi + Δx/steps  |  yi+1 = yi + Δy/steps

Uses floating-point arithmetic and round(). Simple but slower on hardware due to FP ops.

Bresenham's Algorithm

Avoids floating-point entirely with an integer decision parameter:

pk = 2Δy − Δx  (initial)
If pk ≥ 0: plot (x+1, y+1), pk+1 = pk + 2Δy − 2Δx
If pk < 0: plot (x+1, y), pk+1 = pk + 2Δy

Purely integer arithmetic — fast, hardware-friendly, industry standard.

Endpoint Configuration Drag endpoints directly on the canvas, or type below
P0
P1
0 / 0
Speed 4
Zoom
DDA Algorithm
Bresenham's Algorithm
Set endpoints and click Draw to begin.