Wednesday, December 5, 2007

Vliv as a fractal viewer

In a previous post, I was talking about dynamically generated tiles.
I have prototyped this and implemented a simple algorithm for generating dynamically tiles, a Newton fractal generator.

The idea is simple, given a point in the complex plane, and a polynomial, apply the Newton method to find out where the point ends. Each starting point eventually converges to one of the roots of the polynomial, that gives the base color. This color is then shaded using the number of iterations it takes to be around the root (there are of course other coloring algorithms, I choose this one because it is really simple to implement). Computation is done at a single tile level.

The beauty of this is that, using VLIV tiling features, the image size is virtually not limited, so viewing an image of size 256000x256000 is possible, and even not slower than a smaller size.

The complete source code for my sample implementation is less than 200 lines of code, most of it beeing my not optimal Newton method implementation.

Here is the result:


Imagine if the idea was implemented in Google Earth (or Maps), using Google storage and computation capabilities, it would make a nice feature...

This Wikipedia page has more information on Newton Fractals.
Simon Tatham has also a very detailed page on this topic.


No comments: