GMontag
10-21-04, 07:13 AM
I know the algorithm for drawing a sierpinski triangle by random accretion:
1. Pick a random point.
2. Pick a random vertice of the triangle
3. Move halfway towards that vertice and draw a point.
4. Repeat steps 2 and 3 indefinately.
My question is, is there a similar algorithm for making the Sierpinski Gasket (square divided into 9 equal sections with the middle section removed, recursively)?
I have a vague recollection that the answer is yes... but I can't recall the details.
I think that it might be to pick an edge (not a corner) and move halfway to that edge...
I'll do a little simulation and let you know what I find.
After some thought, I looked up the Chas game, something I had an interest in when attempting (and failing) to develop a commercial fractal image compression utility.
With the chaos game rules in mind, a brief look at the Sierpinski Square indicates that the required rule is to choose a corner at random, and move 2/3 of the way to that corner - because the gasket is self-similar on a scale of 3 in each dimension.
Thinking about this some more, it is not enough to choose from only the four corners - that would produce a gasket with only four sub-squares.
To produce the whole Sierpinski square:
Pick a random point in the square.
Choose one point from: the four corners and the midpoints of the sides.
Move 2/3 of the way toward your chosen point.
Repeat!
GMontag
10-22-04, 05:00 AM
Thanks Pete, I'll try that algorithm when I get home (I'm writing a screen saver). I'll send you a copy when I'm done if you wish (if you use OS X, that is).
Sorry - stuck in MS land.