CG 04 Circle Algorithm
CG 04 Circle Algorithm
Lecture 04
Pk = f circle ( xk + 1, yk - ½ )
P = ( x + 1 ) 2 + ( y - ½ ) 2 – r 2 ……...(1)
Decision Parameter
Therefore, if Pk < 0 or negative then
yk+1 will be yk
and the formula to calculate Pk+1 will be:
Pk+1 = Pk + 2( xk + 1 ) + 1
Decision Parameter
Otherwise, if Pk > 0 or positive
while ( x < y )
Example
Example to calculate first octant of the circle using
midpoint algorithm
K Pk point
Example Cont…
Behaviour of
calculated points
around the circle is
observable
calculate first octant of the circle using midpoint
algorithm
R=9
Center=(2,1)