Вы находитесь на странице: 1из 1

www.eazynotes.

com

Gursharan Singh Tatla

Page No. 1

MID POINT CIRCLE ALGORITHM


Mid-Point Circle ( Xc, Yc, R):
Description: Here Xc and Yc 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. Exit Else Set Y = Y 1 P = P + 2(X Y) + 1 [End of If] Call Draw Circle(Xc, Yc, X, Y) [End of While] Set X = 0 and Y = R Set P = 1 R Repeat While (X < Y) Call Draw Circle(Xc, Yc, X, Y) Set X = X + 1 If (P < 0) Then P = P + 2X + 6

Draw Circle (Xc, Yc, X, Y):


1. 2. 3. 4. 5. 6. 7. 8. 9. Call PutPixel(Xc + X, Yc, + Y) Call PutPixel(Xc - X, Yc, + Y) Call PutPixel(Xc + X, Yc, - Y) Call PutPixel(Xc - X, Yc, - Y) Call PutPixel(Xc + Y, Yc, + X) Call PutPixel(Xc - Y, Yc, + X) Call PutPixel(Xc + Y, Yc, - X) Call PutPixel(Xc - Y, Yc, - X) Exit

Вам также может понравиться