On 7/18/06, Mike Speciner <speciner@ll.mit.edu> wrote:
Am I missing something? Why do you need square root at all? sqrt(x*x+y*y) < n is the same as x*x+y*y < n*n.
Also, you don't need to check every point (an O(n^2) process). If you just follow around the edge of the circle (an O(n) process), you can easily infer the interior points.
--ms
In fact, there's a clever algorithm for poltting the mandelbrot set that uses that fact: since points in the set take the longest to compute, we want to compute as few as possible. So divide up the space into quadrants and compute the edge values: if all the edge values are the same, then the interior is the same (assuming you don't have the entire set inside one quadrant). -- Mike Stay metaweta@gmail.com http://math.ucr.edu/~mike