Bresenhamcircledrawing

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Bresenhams mid point circle drawing Algorithm. Bresenham has developed a circle-drawing algorithm based on eight-way symmetry.

His algorithm is more effective than all previous methods. The eight-way symmetry rule implies that we need to compute only one octant, to determine the circle completely. Here the points are determined by interchanging the values with respect to one another. Bresenhams circle drawing algorithm finds the closest pixels to the circumference at each sampling step by setting up its decision parameter. To apply this algorithm we use the midpoint method. A circle is defined with a function: F(x, y) = x2 +y2 = r2 Fcircle (x, y) = x2 + Y2-r2 ------------------------------------------(1) Fcircle (x, Y){<0,is inside a circle boundary, >0,outside the circle boundary. =0,on the circle boundary,

Assuming we have just plotted a pixel at (xk , yk).We next need to determine whether the pixel at position (xk+1 , yk-1) or (xk+1 , yk) is closer to the circle. We then calculate the midpoint of yk and yk-1 by (Yk + Yk-1) / 2 = yk (1/2)

Our decision parameters which is evaluated at the midpoint b/w these two pixels Pk = Fcircle (xk+1, yk-1/2). = (xk+1)2 + (yk )2-r2 ------------------------------------------------(2) = x2k + 2xk + 1+ y2k- yk + 1/4 - r2 If pk < 0, plot yk, closer to the boundary and if pk >0, plot yk-1 , closer to the boundary. Successive decision parameters are obtained by using the incremental parameters.Decesion Parameter pk+1 is obtained by substituting k = k+1 in (2) and also xk+1 = xk + 1. Pk+1 = (xk+1 + 1)2 + (yk+1 )2 r2 = (xk+1)2 + 2xk+1 + 1 + (yk+1)2-yk+1 +1/4 r2 = x2k + 2xk + 1 + 2(xk +1) + 1 + y2k+1 Yk+1 +1/4 r2

Pk+1 - Pk = 2(xk +1 ) + y2k+1 yk+1 y2k + yK +1

Then, pk+1 = pk + 2(xk + 1)+ ( y2k+1 y2k) (yk+1 yk) +1 Where yk+1 is either yk or yk 1 depends on the sign of pk. If pk is +ve then yk+1 = yk 1 and pk is ve then yk+1 = yk. Then find the initial decision parameter p0 at starting position (x0, y0) ie (0, r). P0 = 5/4 r.

You might also like