
What we'd like to do is to use this discriminating function to maintain our trajectory of drawn pixels as close as possible to the desired circle. Luckily, we can start with a point on the circle, (x_{0}, y_{0}+r) (or (0, r) in our adjusted coordinate system). As we move along in steps of x we note that the slope is less than zero and greater than negative one at points in the direction we're heading that are near our known point on a circle. Thus we need only to figure out at each step whether to step down in y or maintain y at each step.
We will compute points between x=0 and x=y and then draw the 8 matching pointsIn that area, the slope of the curve is between 0 and 1From each step/point (x, y), the next one is either (x+1, y) or (x+1, y1)We decide about which one by looking at the midpoint M

int x = 0;
int y = radius; int p = 1  radius;
circlePoints(xCenter, yCenter, x, y, pix);
while (x < y) {
x++;
if (p < 0) {
p += 2*x+1;
} else {
y;
p += 2*(xy+1);
}
circlePoints(xCenter, yCenter, x, y, pix);
}

See the "Links" link above to find out the sources of the proposed informations Pascal Vuylsteker / eScience / Computer Science / ANU 
Last modified: 20/4/2004
TOC  Print 
Send your comments at : <Hugh.Fisher@anu.edu.au> 