Bresenham’s line draw
🎨 Bresenham's Line Drawing Algorithm
Interactive Pixel-by-Pixel Animation
⚙️ Line Parameters
Start
End
Pixel
Current
📐 Pixel Grid
Step
0
Current X
-
Current Y
-
Decision P
-
Pixels
0
📖 Step-by-Step Explanation
Click "Initialize" to begin the algorithm.
Current Algorithm State:
Waiting for initialization...
💻 Bresenham's Algorithm
dx = x2 - x1
dy = y2 - y1
p = 2dy - dx
x = x1
y = y1
while x <= x2:
plot(x, y)
x = x + 1
if p < 0:
p = p + 2dy
else:
y = y + 1
p = p + 2dy - 2dx