中点画椭圆算法
中点圆算法 (Midpoint circle Algorithm)
This is an algorithm which is used to calculate the entire perimeter points of a circle in a first octant so that the points of the other octant can be taken easily as they are mirror points; this is due to circle property as it is symmetric about its center.
这是一种算法,用于计算第一个八分圆中一个圆的整个周边点,以便可以轻松地将另一个八分圆的点视为镜像点; 这是由于圆的属性有关它的中心对称。
In this algorithm decision parameter is based on a circle equation. As we know that the equation of a circle is x2 +y2 =r2 when the centre is (0, 0).
在该算法中,决策参数基于圆方程。 众所周知,当中心为(0,0)时,圆的方程为x 2 + y 2 = r 2 。
Now let us define the function of a circle i.e.: fcircle(x,y)= x2 +y2 - r2
现在让我们定义一个圆的函数,即: fcircle(x,y)= x 2 + y 2 -r 2
If fcircle < 0 then x, y is inside the circle boundary.
如果fcircle <0,则x , y在圆边界之内。
If fcircle > 0 then x, y is outside