Midpoint Circle Drawing Algorithm
Midpoint Circle Drawing Algorithm
Algorithms
Circle Generation Algorithms
The equation of a circle:
8 -Way symmetry
Midpoint Circle
Algorithm
Circle Generation Algorithms
As in the line algorithm, we sample at
unit intervals and determine the closet
pixel position to the circle path at each
step.
Circle Generation Algorithms
Points are generated from 90º to 45º, moves
will be made only in the +x and –y
direction.
positive x direction over this octant and use
a decision parameter
Circle Generation Algorithms
We define a circle function:
< 0
f circle
( x, y ) = x + y − r = 0
2 2 2
> o
Circle Generation Algorithms
Midpoint 1
( x + 1, y − )
i i
2
Consider the coordinates of the point
halfway between pixel T and pixel S
Midpoint
Circle Generation Algorithms
2 2
Circle Generation Algorithms
If pi < 0 is negative, the midpoint
is inside the pixel, and we choose
pixel T.
If pi ≥ 0 we choose pixel S.
Circle Generation Algorithms
Parameter for the next step is:
1
p = ( x + 1) + ( y − ) − r
i +1 i +1
2
i +1
2
2
since
x = x +1
i +1 i
Circle Generation Algorithms
If T is chosen ( pi < 0 ) we have:
If pixel S is chosen ( pi ≥ 0 ) we
have
Circle Generation Algorithms
In terms of
Circle Generation Algorithms
Initial value for the decision parameter using the
original function of (0,r)