#include
#include
void circlePoint(int x,int y) 八分法画圆程序
{
circle(320 x20,250 y20,3);
circle(320 y20,250 x20,3);
circle(320-y20,250 x20,3);
circle(320-x20,250 y20,3);
circle(320-x20,250 y20,3);
circle(320-x20,250-y20,3);
circle(320-y20,250-x20,3);
circle(320 y20,250-x20,3);
circle(320 x20,250-y20,3);
}
void MidBresenhamcircle(int r) * 中点Bresenham算法画圆的程序 *
{
int x,y,d;
x=0;y=r;d=2-r;* 统计初始值 *
while(x
if(d<0) d =2x 3; 依照毛病项d的判断,决意非最大位移方向上是走仍是不走 * else
{ d =2*(x-y) 5;
y–;
}
x ;
delay(900000);
} * while *
}
main()
{
int i,j,r,graphmode,graphdriver;
detectgraph(&graphdriver,&graphmode);
initgraph(&graphdriver,&graphmode," “);
printf(“中点Bresenhamcircle算法画圆的程序\n”);提示信息
printf(“看重 |r|<=22”);
printf(”\n输入半径值 r:“);
scanf(”%d",&r);
printf(“按随意任性键表现图形…”);
gainch();
cleardevice();
setbkcolor(BLACK);
for(i=20;i<=620;i =20) 使用双循环画点函数画出表格中的纵坐标
for(j=20;j<=560;j )
putpixel(i,j,2);
for(j=20;j<=560;j =20) 使用双循环画点函数画出表格中的横坐标
for(i=20;i<=620;i )
putpixel(i,j,2);
outtextxy(320,255,“0”);原点坐标
outtextxy(320-520,255,“-5”);circle(320-520,250,2);横坐标值
outtextxy(320 520,255,“5”);circle(320 520,250,2);
outtextxy(320-2020,255,“-20”);circle(320-2020,250,2);
outtextxy(320 2020,255,“20”);circle(320 2020,250,2);
outtextxy(320-2520,255,“-25”);circle(320-2520,250,2);
outtextxy(320 2520,255,“25”);circle(320 2520,250,2);
outtextxy(320,250-520,“-5”);circle(320,250-520,2);纵坐标值
outtextxy(320,250 520,“5”);circle(320,250 520,2);
outtextxy(320,250-2020,“-20”);circle(320,250-2020,2);
outtextxy(320,250 2020,“20”);circle(320,250 2020,2);
outtextxy(20,20,“The center of the circle is (0,0) “);坐标轴左上角表现提示信息 setcolor(RED);标记坐标轴
line(20,250,620,250);outtextxy(320 2520,230,“X”);
line(320,20,320,560);outtextxy(330,20,“Y”);
setcolor(YELLOW);
MidBresenhamcircle(r);
setcolor(BLUE);绘制圆
circle(320,250,r20);
setcolor(2);
gainch();
closegraph();
}
--------------------------------------------------------#include
void main()
{
int driver,mode;
driver=DETECT;
mode=0;
initgraph(&driver,&mode,””);
setcolor(25);
circle(20,20,20);
gainch();
}