Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Bresenham’s Circle Algorithm Define:D(s i ) = distance of p 3 from circle D(t i ) = distance of p 2 from circle i.e.D(s i ) = (x i + 1) 2 + y i 2 – r.

Similar presentations


Presentation on theme: "1 Bresenham’s Circle Algorithm Define:D(s i ) = distance of p 3 from circle D(t i ) = distance of p 2 from circle i.e.D(s i ) = (x i + 1) 2 + y i 2 – r."— Presentation transcript:

1 1 Bresenham’s Circle Algorithm Define:D(s i ) = distance of p 3 from circle D(t i ) = distance of p 2 from circle i.e.D(s i ) = (x i + 1) 2 + y i 2 – r 2 [always +ve] D(t i ) = (x i + 1) 2 + (y i – 1) 2 – r 2 [always -ve] Decision Parameter p i = D(s i ) + D(t i ) so if p i < 0 then the circle is closer to p 3 (point above) if p i ≥ 0 then the circle is closer to p 2 (point below)

2 2 The Algorithm x 0 = 0 y 0 = r p 0 = [1 2 + r 2 – r 2 ] + [1 2 + (r-1) 2 – r 2 ] = 3 – 2r if p i < 0 then y i+1 = y i p i+1 = p i + 4x i + 6 else if p i ≥ 0 then y i+1 = y i – 1 p i+1 = p i + 4(x i – y i ) + 10 Stop when x i ≥ y i and determine symmetry points in the other octants x i+1 = x i + 1

3 3 Example 10 9 8 7 6 5 4 3 2 1 0 012345678910 ipipi x i, y i 0-17(0, 10) 1-11(1, 10) 2(2, 10) 313(3, 10) 4-5(4, 9) 515(5, 9) 69(6, 8) 7(7,7) r = 10 p 0 = 3 – 2r = -17 Initial point (x 0, y 0 ) = (0, 10)

4 p 0 = -17+ 4*0 + 6 = -11 p 1 = -11+ 4*1 + 6 = -1 p 2 = -1+ 4*2 + 6 = 13 p 3 = 13 + 4(3 – 10) + 10 = -5

5 5 Exercises Draw the circle with r = 12 using the Bresenham algorithm. Draw the circle with r = 14 and center at (15, 10).


Download ppt "1 Bresenham’s Circle Algorithm Define:D(s i ) = distance of p 3 from circle D(t i ) = distance of p 2 from circle i.e.D(s i ) = (x i + 1) 2 + y i 2 – r."

Similar presentations


Ads by Google