Sutherland-Hodgeman Polygon Clipping Algorithm (C++)

#include <iostream.h> #include <conio.h> #include <graphics.h> int xl,yl,xh,yh,poly[100],n; void left_clip(){ int temp[100],i,j=0,count=0,x1,y1,x2,y2; for(i=0;i<2*n;i+=2){ x1 = poly[i]; y1 = poly[i+1]; x2 = poly[i+2]; y2 = poly[i+3]; if(x1<xl && x2<xl){ //both points outside. Do not store any vertices }else if(x1>xl && x2>xl){ //both points inside. Store second vertex temp[j] = x2; temp[j+1] = y2; j+=2; count++; }else if(x1<xl && x2>xl){ //outside to inside. Store intersection n second … Continue reading Sutherland-Hodgeman Polygon Clipping Algorithm (C++)