Fractal Waffle

by Jay Tomlin


Fractal Waffle is a Java realization of fractal geometry's Sierpinski gasket. The algorithm for the Sierpinski gasket goes like this: you draw a square, divide it evenly into 9 squares (like a tic-tac-toe board) and then delete the middle square. This leaves 8 squares, each of which are subjected to the same algorithm on the next iteration. I've not seen a monitor with resolution sharp enough to see past the 6th iteration (when the applet was at 1000x900 pixels), so 6 iterations is the limit. Most monitors can handle 5 iterations. (The Fractal Waffle is actually a rectangle, but the algorithm still works the same way.) Since redrawing the gasket can take a long time for higer iterations, the waffle will not automatically redraw itself until you click the Redraw button.


Source code

Back to Jay's Java Goodies