Cohen-Sutherland Line Clipping Algorithm (C++)

#include #include #include static int LEFT=1,RIGHT=2,BOTTOM=4,TOP=8,xl,yl,xh,yh; int getcode(int x,int y){ int code = 0; //Peform Bitwise OR to get outcode if(yyl) code |=BOTTOM; if(xxh) code |=RIGHT; return code; } void main(){ int gdriver = DETECT,gmode; initgraph(&gdriver,&gmode,”C:\TC\BGI”); setcolor(BLUE); cout<>xl>>yl>>xh>>yh; rectangle(xl,yl,xh,yh); int x1,y1,x2,y2; cout<>x1>>y1>>x2>>y2; line(x1,y1,x2,y2); getch(); int outcode1=getcode(x1,y1), outcode2=getcode(x2,y2); int accept = 0;                             … Continue reading Cohen-Sutherland Line Clipping Algorithm (C++)