Algorithm Description:
The algorithm of the midpoint generation of a circle
If we construct the functionF(x,y)= x2+ y2- R2, the points on the circle haveF(x,y) = 0, for points outside the circleF(x,y) >0, for points within the circleF(x,y) <0.
As with the midpoint drawing line method, the construction discriminant:
D=F(M)=F( xp+1,yp -0.5) = (XP+ 1)2+(YP-0.5)2- R2
if D <0, you should take P1 is the next pixel, and then the discriminant of the next pixel is:
D=F(XP+2,YP-0.5) = (XP+2)2+(YP-0.5)2- R2=d +2XP+3
if D ≥ 0, you should take P2 is the next pixel, and the discriminant of the next pixel is
D=F(XP+2,YP-1.5) = (XP+2)2+(YP-1.5)2- R2=d+2 (XP-YP) +5
The first pixel we're talking about here is (0, R ), discriminant D the initial values are:
d0=F(1,R-0.5) =1.25-R
Detail Code:Computer Graphics-code_1
Build Result:
Computer graphics-midpoint generation algorithm validation for a circle