Week 3 Circle Generating Algorithm
Week 3 Circle Generating Algorithm
-y,x y,x
-x,y x,y
-x,-y x,-y
y,-x
-y,-x
Scan Converting a Circle using Polynomial method:-
This method defines a circle with second order
polynomial equation
y2 = r2 – x2
where x, y = x & y coordinates, r = radius
y r
x
0 x
• However, unsurprisingly this is not a brilliant
solution!
• Firstly, the resulting circle has large gaps
where the slope approaches the vertical
• Secondly, the calculations are not very
efficient
– The square (multiply) operations
– The square root operation – try really hard to
avoid these!
• We need a more efficient, more accurate
solution
Scan Convert a Circle using trigonometric
method:-
This second method of defining a circle uses
functions : x = r cos θ, y = r sin θ
y
P(r cos θ,r sin θ)
r sin θ
θ
x
r cos θ
θ = current angle, r = circle radius
By this method θ is stepped from θ to π /4
& each value of x & y is calculated.
Computation of values of sin θ & cos θ are
very time consuming
Bresenham’s Circle Algorithm
Working: If the eight-way symmetry of a circle is used
to generate a circle, points will have to be
generated through 45º angle. And, if points are
generated from 90º to 45º, moves will be made
only in the +x and –y directions.
T (xi+1,yi)
yi
(xi+1,yi-1)
yi -1
S
xi xi + 1 x
• Assume that (xi, yi) are the coordinates of the last scan-
converted pixel upon entering step i.
• Coordinates of
T are (xi +1, yi)
S are (xi +1, yi – 1)
17
Eight-Way Symmetry
• The first thing we can notice to make our circle
drawing algorithm more efficient is that circles
centred at (0, 0) have eight-way symmetry.
(-x, y) (x, y)
(-y, x) (y, x)
R
2
(-y, -x) (y, -x)
29