Bresenham's circle drawing algorithm
Bresenham's circle drawing algorithm is a circle drawing algorithm that selects the nearest pixel position to complete the arc.
The unique part of this algorithm is that it uses only integer arithmetic which makes it significantly faster than mid point circle generation algorithm.
Algorithm:
(xc,yc) \\centre of the circle
x=0
y=r
p=3-2r
getcircle( xc,yc, x, y)
\\function to print pixel
While( x<=y):
x++
if(p<0):
p=p+4x+6
else:
p=p+4x-4y+10
y--
getcircle(xc, yc, x,y)
getcircle(xc, yc, x,y)
{
putpixel(xc+x, yc+y)
putpixel(xc-x, yc+y)
putpixel(xc+x, yc-y)
putpixel(xc-x, yc-y)
putpixel(xc+y, yc+x)
putpixel(xc-y, yc+x)
putpixel(xc+y, yc-x)
putpixel(xc-y, yc-x)
}
senseiiiiiiiii bakaaaa
ReplyDeleteBakabakabaka
ReplyDelete