PRESENTATION ON MID-POINT CIRCLE DRAWING PRESENTED BY: NEHA KAURAV HIMANSHI GUPTA CLASS: BCA 3 rd SEM.
ABOUT CIRCLE A circle is all points in the same plane that lie at an equal distance from a center point. The circle is only composed of the points on the border. The distance between the midpoint and the circle border is called the radius. A line segment that has the endpoints on the circle and passes through the midpoint is called the diameter. The diameter is twice the size of the radius. A line segment that has its endpoints on the circular border but does not pass through the midpoint is called a chord.
Circle Algorithms 4 Use 8-fold symmetry and only compute pixel positions for the 45 ° sector. 45 ° ( x , y ) ( y , x ) (- x , y ) ( y , -x ) ( x , - y ) (- x , - y ) (- y , x ) ( -y , -x )
MIDPOINT CIRCLE ALGORITHM Circle function: F circle ( x,y )=x 2 +y 2 -r 2 F circle ( x,y )>0,then ( x,y ) lies outside the circle. F circle ( x,y )<0,then ( x,y ) lies inside the circle F circle ( x,y )=0,then ( x,y ) is on the circle boundary. . F k <0 Y k+1 = y k Next pixel=(x k +1,y k ) Midpoint inside the circle . F k >=0 Y k+1 =y k -1 Next pixel=(x k +1,y k -1) Midpoint above the circle
MIDPOINT CIRCLE ALGORITHM The decision parameter is the circle at the midpoint between the pixels y k and y k – 1 . f= f circle (x k +1,y k -1/2) =(x k +1) 2 +(y k -1/2) 2 -r 2 We know that X k+1 =x k +1, F k =f(x k +1,y k -1/2) F k =(x k +1) 2 +(y k -1/2) 2 -r 2 ( i ) F k+1 =f(x k +2,y k+1 -1/2) F k+1 =(x k +2) 2 +(y k+1 -1/2) 2 -r 2 (ii) Now subtracting eq n (ii) by ( i ) F k+1 -f k =2(x k +1)+(y 2 k+1 -y 2 k )-(y k+1 -y k )+1
So, If f k <0: y k+1 = y k F k+1 =f k +2x k+1 +1 If f k >=0: y k+1 =y k -1 F k+1 =f k +2x k+1 -2y k+1 +1 For the initial points, (x ,y )=(0,r) F = f circle (1,r-1/2) =1+(r-1/2) 2 -r =5/4-r =1-r
The Algorithm Initial values:- point(0, r ) x = 0 y = r Initial decision parameter At each x i position, starting at i = 0, perform the following test: if p i < 0, the next point is ( x i + 1, y i ) and p i +1 = p i + 2 x i +1 + 1 If p i ≥ 0, the next point is ( x i +1, y i -1) and p i +1 = p i + 2 x i +1 + 1 – 2 y i +1 where 2 x i +1 = 2 x i + 2 and 2 y i +1 = 2 y i – 2 Determine symmetry points in the other octants Move pixel positions ( x,y ) onto the circular path centered on ( x c , y c ) and plot the coordinates: x = x + x c , y = y + y c Repeat 3 – 5 until x >= y 8