Week 56 Mid Point Circle Algorithm
Week 56 Mid Point Circle Algorithm
on circle
(-R,0) (R,0)
inside
outside
(0,R)
Choosing the Next Pixel
decision variable d
(x, y) (x+1, y)
E
choose E
M
choose SE
SE
(x+1, y+1)
Change of d when E is chosen
(x, y) (x+1, y) (x+2, y)
E
Mold Mnew
SE
(x+1, y+1) (x+2, y+1)
Change of d when SE is chosen
(x, y) (x+1, y)
E
Mold
SE
Mnew
M0
(1,-R+1)
Midpoint Circle Algo
x = 0;
y = -R;
d = 5/4 – R; /* real */
setPixel(x,y);
while (y > x) {
if (d > 0) { /* E chosen */
d += 2*x + 3;
x++;
} else { /* SE chosen */
d += 2*(x+y) + 5;
x++; y++;
}
setPixel(x,y);
}
New Decision Variable
OR S OR D
AND S AND D
INVERT NOT D
NOR NOT (S OR D)