2. Bressenham's algorithm: Circle drawing
from x=0 and x=y
ex: if r=10, (x0,y0)= (0,10)
p0 =1-r
if Pk<0 then (xk+1,yk)
and pk+1= pk+2xk+1+1
else (pk>0) then (xk+1,yk-1)
and pk+1= pk+2xk+1+1-2yk+1
3. Example 1: radius = 5
Algorithm:
ex: if r=radius, (x0,y0)= (0,r)
p0 =1-r
if Pk<0 then (xk+1,yk)
and pk+1= pk+2xk+1+1
else (pk>0) then (xk+1,yk-1)
and pk+1= pk+2xk+1+1-2yk+1
Solution:
X=0, r=5 , so plot first point at ( 0,5)
p0 =1-r = 1-5 = -4
X=1 , y=5 (if case)
pk+1= pk+2xk+1+1 = -4+2+1 = -1
X=2, y=5 (if case)
pk+1= pk+2xk+1+1 = -1 + 4+1 = 4
X= 3 y = 4 (else case)
pk+1= pk+2xk+1+1-2yk+1 = 4+6+1 – 8=3
X=4, y = 3 (else case)
X>y hence STOP
5. Reference
Hearn,Baker - Computer Graphics - C Version 2nd Ed
http://edu.uokufa.edu.iq/staff/dr.nidhal/compressed%20comp.book/H
earn,Baker%20-%20Computer%20Graphics%20-
%20C%20Version%202nd%20Ed.pdf