?? 主函數.txt
字號:
main()
{
int select,i,j,radius,bound;
int x[10],y[10];
int x1,y1,x2,y2;
int x_seed, y_seed;
char ch;
int driver,mode;
driver=DETECT;
mode=0;
printf("*******1----------draw line*************\n");
printf("*******2----------draw circle***********\n");
printf("*******3----------draw mul_boundary*****\n");
scanf("%d",&select);
if(select==1)
{
printf(" A/a----------midpoint \n");
printf(" B/b----------DDA \n");
printf(" C/c----------Bresenham \n");
getchar();
ch=getchar();
if(ch=='A'||ch=='a')
{
printf("input start and end point\n");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
initgraph(&driver,&mode,"");
setcolor(15);
set_net(10,10);
MidPointLine(x1,y1,x2,y2,10);
}
if(ch=='B'||ch=='b')
{
printf("input start and end point\n");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
initgraph(&driver,&mode,"");
setcolor(15);
set_net(10,10);
dda_line(x1,y1,x2,y2,10);
}
if(ch=='C'||ch=='c')
{
printf("input start and end point\n");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
initgraph(&driver,&mode,"");
setcolor(15);
set_net(10,10);
bresenham_line(x1,y1,x2,y2,10);
}
}
if(select==2)
{
printf(" A/a----------bresenham circle \n");
printf(" B/b----------midpoint circle \n");
getchar();
ch=getchar();
if(ch=='A'||ch=='a')
{
printf("input 1 point and the radius:\n");
scanf("%d%d%d",&x1,&y1,&radius);
initgraph(&driver,&mode,"");
setcolor(15);
set_net(10,10);
bresenham_circle(x1,y1,radius,13);
}
if(ch=='B'||ch=='b')
{
printf("input the radius:\n");
scanf("%d",&radius);
MidPointCircle(radius ,13);
}
}
if(select==3)
{
printf("input the point in total=");
scanf("%d",&bound);
for(i=0;i<bound;i++)
{
printf("input the %d point =",i+1);
scanf("%d%d",&x[i],&y[i]);
}
printf("whether fill the mul_boundary(Y/N):");
getchar();
ch=getchar();
if(ch=='y'||ch=='Y')
{
printf("input seed point:");
scanf("%d%d",&x_seed, &y_seed);
}
initgraph(&driver,&mode,"");
setcolor(15);
set_net(10,10);
for(i=0;i<bound-1;i++)
dda_line(x[i],y[i],x[i+1],y[i+1],13);
if(ch=='y'||ch=='Y')seed_filling (x_seed, y_seed, 10, 13);
else exit(0);
}
getch();
restorecrtmode();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -