Skip to main content

Bresenham: endpoints (10,18),(15,8)

Short answer

Use Bresenham's algorithm for |m|>1: start p0=0, update p by +10 if negative or -10 if nonnegative. The digitized pixels are (10,18), (11,17), (11,16), (12,15), (12,14), (13,13), (13,12), (14,11), (14,10), (15,9), (15,8).

Digitize the endpoint (10, 18), (15, 8) using Bresenham's algorithm.

Given: end points (10,18) and (15,8). Δx = 5, |Δy| = 10, the slope is m = −2 (|m| > 1, negative). So y decreases by 1 each step, and x either stays or increases by 1.

p0 = 2Δx − |Δy| = 10 − 10 = 0
p < 0: x same,  p = p + 2Δx = p + 10
p ≥ 0: x + 1,   p = p + 2Δx − 2|Δy| = p − 10
kp_k(x_k, y_k)
00(10,18)
1-10(11,17)
20(11,16)
3-10(12,15)
40(12,14)
5-10(13,13)
60(13,12)
7-10(14,11)
80(14,10)
9-10(15,9)
100(15,8)

Answer: (10,18), (11,17), (11,16), (12,15), (12,14), (13,13), (13,12), (14,11), (14,10), (15,9), (15,8).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 2 questions →