> Note that if F(x,y)=0, then the point (x,y) is exactly on the circle. If F(x,y)>0, then the point is outside of the circle, and if F(x,y)<0 then the point is inside of it. <i>In other words, given any point (x,y), F(x,y) is the distance from the true circle line</i> [my emphasis].<p>This last is not quite true. The exact distance from the circle, call it G(x,y), is the corresponding difference of square roots, i.e.,<p><pre><code> def G(x, y, r):
return math.sqrt(x * x + y * y) - math.sqrt(r * r)
</code></pre>
and G(x,y) isn't just the square root of F(x,y), and indeed doesn't behave monotonically with respect to F(x,y).<p>It's an interest property of Bresenham's algorithm, that I've never seen even stated let alone proved in the literature, that this doesn't matter, and the algorithm is indeed exact in the sense that it always chooses the next point based on which is <i>truly</i> closest to the circle... despite using an error function that is only an approximation.