








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































2 3 4 5
2
4
3
5
For example, from position (2, 3) we have to choose between (3, 3) and (3, 4) We would like the point that is closer to the original line
( x k, y k)
( x k+1, y k)
( x k+1, y k+1)
y = m ( xk + 1 ) + b
y yk
yk+ 1
x (^) k + 1
d (^) lower
d (^) upper
Deriving The Bresenham Line Algorithm (cont…)
( ) ( 2 ( + 1 )− 2 + 2 − 1 ) ∆
∆ ∆ − = ∆ x y b x
y x dlower dupper x k k
= 2 ∆ y ⋅ xk − 2 ∆ x ⋅ yk + 2 ∆ y + ∆ x ( 2 b − 1 ) = 2 ∆ y ⋅ xk − 2 ∆ x ⋅ yk + c Docsity.com
Deriving The Bresenham Line Algorithm (cont…)
k k
k lower upper
Deriving The Bresenham Line Algorithm (cont…)
BRESENHAM’S LINE DRAWING ALGORITHM (for | m | < 1.0)
p (^) 0 = 2 ∆ y −∆ x
p (^) k + 1 = pk + 2 ∆ y Docsity.com
17
16
15
14
13
12
11
10
18
20 21 22 23 24 25 26 27 28 29 30
k pk (x^ k+1,y^ k+1) 0 1 2 3 4 5 6 7 8
17
16
15
14
13
12
11
10
18
20 21 22 23 24 25 26 27 28 29 30
k pk (x^ k+1,y^ k+1) 0 1 2 3 4 5 6 7 8
- y 0 = 20 2 − 02 ≈ - y 1 = 20 2 − 12 ≈ - y 2 = 20 2 − 22 ≈