MidPoint Circle Drawing Algorithm

For simplicity, an ellipse having a centre at the origin and axes (major & minor) parallel to the coordinate axes is considered. The algebraic expression of such an ellipse is:

x2/a2+y2/b2=1

where 2a=length of the major axis
2b=length of the minor axis
So, b2x2+a2y2-a2b2=0

From coordinate geometry, we get
f(x, y)= b2x2+a2y2-a2b2

{ < 0 implies (x,y) inside the ellipse

= 0 implies (x, y) on the ellipse

> 0 implies (x, y) outside the ellipse }

1. Insert radius r and center (xc, yc)
and obtain the first point on the circumference of a circle centered on the origin as (x0, y0) = (0,r) [ initial starting positions]
2. Calculate the initial value,
P=1.25-r
do
{
Plot(x,y)
if(P< 0)

{
x=x+1
y=y
P=P+2x+1
}
else
{
x=x+1
y=y-1
P=P+2x-2y+1
}
}
3. While(x< y) Determine symmetry points in other screen octanes.

4. STOP