void bresenhamcircle(int x0,int y0,int r,int color)
{
int x,y;
int d;
d=1-r;x=0;y=r;
while(x<=y)
{
pDC->SetPixel(x+x0,y+y0,color);
pDC->SetPixel(-x+x0,y+y0,color);
pDC->SetPixel(x+x0,-y+y0,color);
pDC->SetPixel(-x+x0,-y+y0,color);
pDC->SetPixel(y+x0,x+y0,color);
pDC->SetPixel(y+x0,-x+y0,color);
pDC->SetPixel(-y+x0,x+y0,color);
pDC->SetPixel(-y+x0,-x+y0,color);
if(d<0)
{
d=d+2*x+3;
}
else
{
d=d+2*(x-y)+5;y=y-1;
}
x=x+1;
}
}
Bresenham 画圆算法(VC++)
最新推荐文章于 2024-01-11 21:33:48 发布