1、圆弧的特征
圆被定义为到给定中心位置(x0,y0)(x_0,y_0)(x0,y0)的距离为rrr的点集。圆心为(x0,y0)(x_0,y_0)(x0,y0)的圆有4条对称轴x=x0,y=y0,y=x+y0−x0,y=−x+x0+y0x = x_0,y = y_0,y = x + y_0 - x_0,y = -x +x_0 + y_0x=x0,y=y0,y=x+y0−x0,y=−x+x0+y0。若已知圆弧上一点(x,y)(x,y)(x,y),可以得到其关于4条对称轴的其它7个点,这种性质称为八对称性。因此,只要扫描1/8圆弧,就可以用八对称性求出整个圆弧的像素集。
显示圆弧上8个对称点的算法如下:
void CirclePoints(int x,int y,int color)
{
drawpixel(x, y,int color); drawpixel(y - (y0 - x0), x + (y0 - x0),int color);
drawpixel(y - (y0 - x0), x0 + y0 - x,int color); drawpixel(x, 2 * y0 - y,int color);
drawpixel(2 * x0 - x, 2 * y0 - y,int color); drawpixel(x0 + y0 - y, x0 + y0 - x,int color);
drawpixel(x0 + y0 - y, x + (y0 - x0),int color); drawpixel(2 * x0 - x, y,int color);
}
2、中点画圆法
构造函数F(x,y)=(x−x0)2+(y−y0)2−R2F(x,y) = (x-x_0)^2 + (y-y_0)^2-R^2F(x,y)=(x−x0)2+(y−y0)2−R2,对于圆上的点,F(x,y)=0F(x,y)=0F(x,y)=0;对于圆外的点,F(x,y)>

本文介绍了圆弧的八对称性特征,并详细讲解了中点画圆法和极坐标画圆法,提供了这两种方法的算法描述。最后,通过VS2017和OpenGL实现了圆弧的扫描转换,展示了运行结果。
最低0.47元/天 解锁文章
876

被折叠的 条评论
为什么被折叠?



