求一个多边形的裁剪算法
来源:百度知道 编辑:UC知道 时间:2024/05/04 08:50:45
要在VC++编译环境下的用C语言编写,有厉害的大侠请赐教,程序的后面要写上注释,越详细越好,最好是调试过的,能够运行的
编译环境是VC++6.0,上次没说清楚 ,最好还能给出图
编译环境是VC++6.0,上次没说清楚 ,最好还能给出图
#include <graphics.h>
#include <dos.h>
union REGS i,o;
int xl=100,xr=540,yb=400,yt=200; /*方框边界*/
void init()
{
int driver=DETECT,gm;
initgraph(&driver,&gm,"");
printf("Instruction:\n");
printf("1.Press left mouse button to set the vertex;\n");
printf("2.Press right button to end drawing;\n");
/*printf("3.Press both button to clip.");*/
outtextxy(450, 440, "Edit by lcf&hy!");
setwritemode(2);
line(0,70,639,70);
setcolor(YELLOW);
rectangle(xl,yt,xr,yb);
i.x.ax=0;
int86(0x33,&i,&o);
if(o.x.ax==0)
{
printf("Mouse is not available...");
getch();
exit();
}
i.x.ax=1;
int86(0x33,&i,&o);