double DistanceAtAngle(PointVector& points, TemplatePtr& T, double theta) { PointVector newpoints(points); RotateBy(newpoints, theta); return PathDistance(newpoints, T->Points); }
void main() { clrscr(); float num,den; CodeMatrix temp; cout<<"Enter window co-ordinates\nEnter xmin and xmax\n"; cin>>xl>>xh; cout<<"Enter ymin and ymax\n"; cin>>yl>>yh; cout<<"Enter x and y co-ordinates of first end-point of line 1\n"; cin>>ax1>>ay1; cout<<"Enter x and y co-ordinates of second end-point of line 1\n"; cin>>ax2>>ay2; initialize(); display(); delay(2000); cleardevice(); num=ay2-ay1; den=ax2-ax1; m=num/den; again: code(ax1,ay1,a1); code(ax2,ay2,a2); if(checkzero(a1)==1&&checkzero(a2)==1) display(); else //(checkzero(a1)==-1&&checkzero(a2)==-1) { and(temp); if(checkzero(temp)==1) //!=0 means line is not visible inside window { //intersection points newpoints(a1,ax1,ay1,1); newpoints(a2,ax2,ay2,2); goto again; } //line discard } getch(); }