Download presentation

Presentation is loading. Please wait.

1
**UNIT-1 Bresenham’s Circle Algorithm**

Computer Graphics By & UNIT-1 Bresenham’s Circle Algorithm

2
**Bresenham’s Circle Algorithm**

Consider only 45° ≤ ≤ 90° General Principle The circle function: and

3
**Bresenham’s Circle Algorithm**

p1 p3 yi D(si) D(ti) yi - 1 p2 r xi xi + 1 After point p1, do we choose p2 or p3?

4
**Bresenham’s Circle Algorithm**

Define: D(si) = distance of p3 from circle D(ti) = distance of p2 from circle i.e. D(si) = (xi + 1)2 + yi2 – r [always +ve] D(ti) = (xi + 1)2 + (yi – 1)2 – r2 [always -ve] Decision Parameter pi = D(si) + D(ti) so if pi < 0 then the circle is closer to p3 (point above) if pi ≥ 0 then the circle is closer to p2 (point below)

5
The Algorithm x0 = 0 y0 = r p0 = [12 + r2 – r2] + [12 + (r-1)2 – r2] = 3 – 2r if pi < 0 then yi+1 = yi pi+1 = pi + 4xi + 6 else if pi ≥ 0 then yi+1 = yi – 1 pi+1 = pi + 4(xi – yi) + 10 Stop when xi ≥ yi and determine symmetry points in the other octants xi+1 = xi + 1

6
**Example r = 10 p0 = 3 – 2r = -17 Initial point (x0, y0) = (0, 10) i pi**

9 8 7 6 5 4 3 2 1 i pi xi, yi -17 (0, 10) 1 -11 (1, 10) 2 -1 (2, 10) 3 13 (3, 10) 4 -5 (4, 9) 5 15 (5, 9) 6 9 (6, 8) 7 (7,7)

7
**Exercises Draw the circle with r = 12 using the Bresenham algorithm.**

Draw the circle with r = 14 and center at (15, 10).

8
**Decision Parameters Prove that if pi < 0 and yi+1 = yi then**

pi+1 = pi + 4xi + 6 Prove that if pi ≥ 0 and yi+1 = yi – 1 then pi+1 = pi + 4(xi – yi) + 10

9
**Advantages of Bresenham circle**

Only involves integer addition, subtraction and multiplication There is no need for squares, square roots and trigonometric functions

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google