Mid Point Circle Drawing Algorithm
A circle is made up of 8 Equal Octets so we need to find only coordinates of anyone 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 a screen.
We will find pixels assuming that Center is at Origin (0,0) then we will add the coordinates of center to corresponding X and Y while drawing circle on the 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 = 5/4 - r (Initial decision Parameter)
Step 4: Plot Circle (Xc,Yc,X,Y)
Step 5: if D < 0 Then
D = D+(2*x)+1
X=X+1
Y=Y
Else
D= D+(2*x)-(2*y)+1
X=X+1
Y=Y-1
Step 6: Check, if X=Y
Goto Step 7
Else
Goto Step 4
Step 7: Stop/Exit.
Mid point circle drawing derivation
Program of Bresenhams circle drawing program
Bresenham Line drawing derivation
Wexnesu-gi Brian Gancio https://marketplace.visualstudio.com/items?itemName=spechautricji.Elsword-gratuita
ReplyDeletepostmatzaruc
wow it was an nice article and also useful for me to complete my projects Best software development company in chennai
ReplyDelete