Liang Barsky Line Clipping Algorithm (C++)

#include <conio.h> #include <iostream.h> #include <graphics.h> void main(){ int gdriver = DETECT, gmode; initgraph(&gdriver,&gmode,”C:\TC\BGI”); setcolor(BLUE); int xl,yl,xh,yh; cout<<“Enter bottom left and top right co-ordinates of the window: “; cin>>xl>>yl>>xh>>yh; rectangle(xl,yl,xh,yh); int x1,y1,x2,y2; cout<<“Enter endpoints of the line: “; cin>>x1>>y1>>x2>>y2; line(x1,y1,x2,y2); getch(); int p[4],q[4],i,accept=1;                               // To decide if line has to … Continue reading Liang Barsky Line Clipping Algorithm (C++)