/* Define the structure to store the edges*/ #include #include using namespace std; struct edge{ int x1,y1,x2,y2,flag; }; int main() { int gd=DETECT,gm,n,i,j,k; struct edge ed[10],temped; float dx,dy,m[10],x_int[10],inter_x[10]; int x[10],y[10],ymax=0,ymin=480,yy,temp; initgraph(&gd,&gm,NULL); /*read the number of vertices of the polygon*/ cout<<"Enter the no.of vertices of the graph :"; cin>>n; /*read the vertices of the polygon and also find ymax and ymin*/ cout<<"Enter the vertices"; for(i=0;i>x[i]; cin>>y[i]; if(y[i]>ymax) ymax=y[i]; if(y[i]y2, if not interchnge y1 and y2 */ cout<<"\nUpdated Edge Information\n"; for(i=0;iymin) { //cout<<"\n\t"<ed[i].y2 && yy<=ed[i].y1) ed[i].flag=1; //Active edge else ed[i].flag=0; //not Active edge } j=0; for(i=0;ix_int[k+1]) { temp=(int)x_int[k]; x_int[k]=x_int[k+1]; x_int[k+1]=temp; } } } /*extracting pairs of values to draw lilnes*/ for(i=0;i