Bresenham’s Circle Drawing Algorithm
A circle is made up of 8 Equal Octets so we need to find only coordinates of any one octet rest we can conclude using that coordinates.
We took octet-2. Where X and Y will represent the pixel
Let us make a function Circle() with parameters coordinates of Centre (Xc,Yc) and pixel point (X,Y) that will plot the pixel on screen.
We will find pixels assuming that Centre is at Origin (0,0) then we will add the coordinates of centre to corresponding X and Y while drawing circle on screen.
Circle (Xc,Yc,X,Y) {
Plot (Y+Xc , X+Yc) ……Octet-1
Plot (X+Xc , Y+Yc) ……Octet-2
Plot (-X+Xc , Y+Yc) ……Octet-3
Plot (-Y+Xc , X+Yc) …..Octet-4
Plot (-Y+Xc , -X+Yc) ……Octet-5
Plot (-X+Xc , -Y+Yc) ……Octet-6
Plot (X+Xc , -Y+Yc) ……Octet-7
Plot (Y+Xc , -X+Yc) ……Octet-8
}
Each plot function is for different octet and will construct the circle while in loop.
Now,
Step 1: Get the Radius of Circle R
And Coordinates of centre of circle (Xc,Yc).
Step 2: X and Y are going to be plotted points
Set X=0 and Y=R
Step 3: D = 3-2R (Initial decision Parameter)
Step 4: Plot Circle (Xc,Yc,X,Y)
Step 5: if D < 0 Then
D = D + 4X + 6
X=X+1
Y=Y
Else
D=D+4(X-Y)+10
X=X+1
Y=Y-1
Step 6: Check, if X=Y
Goto Step 7
Else
Goto Step 4
Step 7: Stop/Exit.
For detailed derivation of this algorithm CheckOut:
Bresenham Circle Drawing Program in C
Bresenham Line Drawing Program in C
Bresenham's Circle Drawing Algorithm Derivation
Bresenham Line Drawing Program in C
Bresenham's Circle Drawing Algorithm Derivation
KKLKL
ReplyDeleteyou did a good job .I appreciate it
ReplyDeletevery nice
ReplyDeleteBresenham's Circle Drawing Algorithm is a powerful technique used to efficiently plot circles in computer graphics. With Sky node advanced tools and resources, developers can implement and optimize such algorithms to enhance graphics performance in their applications.
ReplyDelete