Thursday, 16 September 2010

BounceFractal



One standard way to make a fractal curve is to take a straight line, cut it in half, and move its mid-point a random amount. You then do the same with the two halves, but move their midpoints by a smaller random amount. If you keep going you end up after a few times with something like the picture above.

This is a way to generate artificial coastlines. If you do it with a triangle instead of a line and move the midpoints of its edges out of the plane of the triangle, you make an artificial fractal landscape (shown here flooded):


Here's a new way to do this sort of thing.

Take a box (blue) with a single diagonal line in it (black). Split the line in half and move it as far as you can without a disc on the split-point hitting anything. You get this:

Then repeat this on the two halves, with the exclusion disc reducing in radius at each stage and being imagined to be on every vertex of the curve:

That's it after six steps. Note that, although it looks random, it is entirely deterministic and its shape is set by that simple rule: split, and move as far as you can without the straight lines overlapping the discs.

Here it is after splitting ten times.

If you start with the four edges of a square (filled in red here so you can see what happens):


And let it run you get this:

For more on this idea see here.





No comments:

Post a Comment