2-Circle Drawing Algorithms
2-Circle Drawing Algorithms
For clockwise generation of the circle there are only three possible
selections for the next pixel which best represent the circle:
MH
(Xi,Yi) (Xi+1,Yi)
(0,R)
MD
MV
The algorithm chose the pixel ( the movement )which minimize the
square of the distance between one of these pixels and the true circle
- ١٧ -
The distance in the three cases are measured by :
The difference between the square of the distance from the center of the
circle to the diagonal pixel at (Xi+1 , Yi-1) and the distance to a point on
the circle R^2 is
if ə <0 then the difference from the actual circle to the diagonal
pixel (MD) is greater than that to the horizontal pixel (MH).
- ١٨ -
Summery
1- Di < 0
ə ≤ 0 , then choose pixel at (Xi+1 , Yi) i.e. MH
ə > 0 , then choose pixel at (Xi+1 , Yi-1) i.e. MD
2- Di > 0
β ≤ 0 , then choose pixel at (Xi+1 , Yi-1) i.e. MD
β > 0 , then choose pixel at (Xi , Yi-1) i.e. MV
3- Di = 0
choose pixel at (Xi+1 , Yi-1) i.e. MD
Xi=0
Yi=R
Di= 2 (1-R)
Limit = 0
4: Finish
- ١٩ -
Example 5 :
Draw a circle with R=4
Plot (X,Y) Di ə β Xi Yi
-6 - - 0 4
(0,4) -3 -5 - 1 4
(1,4) -3 1 - 2 3
(2,3) 4 -1 - 3 3
(3,3) 1 - 1 3 2
(3,2) 9 - -5 4 1
(4,1) 10 - 9 4 0
(4,0) -3
- ٢٠ -