**Sketch Line Segment That Joining By Using Bresenham Line Algorithm**

**Example:** Sketch line segment that joining (20, 10) and (25, 14) by using Bresenham line generation algorithm.

**Solution:** (x_{0}, y_{0}) → (20, 10) ; (x_{1}, y_{1}) → (25, 14)

m = (y_{1}- y_{0})/(x_{1} - x_{0})

= (14- 10)/(25 - 20)

= 4/5 < 1

Like, m = (Δy)/ (Δx)

= 4/5 =› Δy = 4

→ plot point (20, 10)

p_{i} = 2Δy - Δx

i = 1: p_{i} = 2 * 4 - 5 = 3

Here p_{1} > 0 consequently x_{0} ← 21; y_{0} ← 11 now plot (21, 11)

i = 2 as p_{1} > 0

∴p_{2} = p_{1} + 2(Δy - Δx)

= 3 + 2 (4 - 5) = 3 - 2 = 1

p_{2} > 0; hence x_{0} ← 22; y_{0} ← 12 plot (22,12)

i = 3 as p_{2} > 0

∴p_{3} = p_{2} + 2 (Δy - Δx) = 1 + 2 (4 - 5) = - 1

p_{3} < 0 ∴x_{0} ← 23

y_{0} ← 12

plot (23, 12)

i = 4 as p_{3} < 0

∴p_{4} = p_{3} + 2Δy

= -1 + 2 * 4 = 7

∴ x_{0} ← 24; y_{0} ← 13

plot (24, 13)

i = 5 as p_{4} > 0

∴p_{5} = p_{4} + 2 (Δy - Δx)

= 7 + 2 (4 - 5) = 5

x_{0} ← 25; y_{0} ← 14

Plot (25, 14)

{for i = 6, x0 will be > x_{i} so algorithm terminates