计算机图形学第五章
代码说明:
#include// OPenGL实用工具库 constint XL=100; constint XR=300; constint YB=100; constint YT=200; int x1=150,y1=50,x2=250,y2=150; #defineLIFT 1 #defineRIGHT 2 #defineBOTTOM 4 #defineTOP 8 char encode(floatx,floaty) { char c=0; if(xXR) c|=RIGHT; if(yYT) c|=TOP; return c; } void CSLineClip(int&x1,int&y1,int&x2,int&y2,intXL,intXR,intYB,intYT) { char code1=encode(x1,y1); char code2=encode(x2,y2); int x,y; char code = 3; while (code1||code2) { if(code1 != 0) { code=code1; }else {
下载说明:请别用迅雷下载,失败请重下,重下不扣分!