Sei sulla pagina 1di 1

www.eazynotes.com

Gursharan Singh Tatla

Page No. 1

BRESENHAM’S CIRCLE ALGORITHM

Bresenham Circle ( X c , Y c , R):

Description: Here X c and Y c denote the x coordinate and y coordinate of the center of the

circle. R is the radius.

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

Set X = 0 and Y = R

Set D = 3 2R

Repeat While (X < Y)

Call Draw Circle(X c , Y c , X, Y) [End of While]

Exit

Call Draw Circle(X c , Y c , X, Y) Set X = X +
Call Draw Circle(X c , Y c , X, Y)
Set X = X + 1
If (D < 0) Then
D =
D +
4X + 6
Else
Set Y = Y – 1
D = D + 4(X – Y) + 10
[End of If]

Draw Circle (X c , Y c , X, Y):

1.

2.

3.

4.

5.

6.

7.

8.

9.

Call PutPixel(X c + X, Y c , + Y)

4. 5. 6. 7. 8. 9. Call PutPixel(X c + X, Y c , + Y)

Call PutPixel(X c - X, Y c , + Y)

Call PutPixel(X c + X, Y c , - Y)

Call PutPixel(X c - X, Y c , - Y)

Call PutPixel(X c + Y, Y c , + X)

Call PutPixel(X c - Y, Y c , + X)

Call PutPixel(X c + Y, Y c , - X)

Call PutPixel(X c - Y, Y c , - X)

Exit