Pixels: (10,12), (11,13), (12,14), (13,14), (14,15), (15,16), (16,17), (17,18), (18,18), (19,19), (20,20).
Bresenham's method steps along x from the left end point, so start from (10, 12) and go to (20, 20).
\[\Delta x = 20 - 10 = 10,\quad \Delta y = 20 - 12 = 8\]
The slope is \(8/10 = 0.8 < 1\), so x increases by 1 at every step. Constants:
\[2\Delta y = 16,\quad 2\Delta y - 2\Delta x = -4\]
\[p_0 = 2\Delta y - \Delta x = 16 - 10 = 6\]
Rule: if \(p_k < 0\), next pixel is \((x+1, y)\) and \(p_{k+1} = p_k + 16\); if \(p_k \ge 0\), next pixel is \((x+1, y+1)\) and \(p_{k+1} = p_k - 4\).
| k | \(p_k\) | \((x_{k+1}, y_{k+1})\) |
|---|---|---|
| 0 | 6 | (11, 13) |
| 1 | 2 | (12, 14) |
| 2 | −2 | (13, 14) |
| 3 | 14 | (14, 15) |
| 4 | 10 | (15, 16) |
| 5 | 6 | (16, 17) |
| 6 | 2 | (17, 18) |
| 7 | −2 | (18, 18) |
| 8 | 14 | (19, 19) |
| 9 | 10 | (20, 20) |
Together with the start point (10, 12), these 11 pixels form the line. The last pixel reached is (20, 20), which matches the given end point, a good check on the working.