Tuesday, November 6, 2007

Floodfill Polygon Filling

Program : Floodfill Polygon Filling



#include<stdio.h>

#include<conio.h>

#include<math.h> //header file inclusion

#include<graphics.h>


void main() //main function

{

int gdriver=DETECT,gmode,errorcode;

int x,y,i,r;

int xc,yc,t; //variable initializations

clrscr();

initgraph(&gdriver,&gmode,"D:\\TC"); //initializing graphics window

printf("\nEnter the co-ordinates of the centre of the circle(xc,yc): \n");

scanf("%d%d",&xc,&yc); //Inputting center coordinates

printf("\nEnter the radius of the circle ,r:");

scanf("%d",&r); //Inputting circle radius

for(i=0;i<360;i++)

{

x=r*cos(i); //polar conversion

y=r*sin(i);

circleplot(xc,yc,x,y); //calling circleplot() function

}

0 comments: