What Links Here? (1 articles…)

Sierpinski Polygon

A Sierpinski triangle is the result of this line of thinking:

To draw a Sierpinski triangle just draw three smaller Sierpinski triangles. (Unless the shape is too small... then just draw a regular triangle).

What if we make the number 3 a parameter, :side, so that we create Sierpinski polygons: Sierpinski Squares, Sierpinski Pentagons, Sierpinski Hexagons, etc?

Then we'd have a shape known as the N-Flake.

As awesome as these shapes are, they don't really form a nice sequence. As the number of sides gets bigger, the shape turns into more and more of a splodgy blob, with polygons drawn over the top of polygons.

Looking at the algorithm, the chief suspect is that remaining constant, the number 2. Let's make that a configurable parameter, :r, for ratio. And try to work out an optimal value for it.

Here's the results of some experimentation with different values of :r.

Here's a table of my experimentally derived values of :r, versus the number of:sides.

:sides :r
3 2
4 2.5
5 2.62
6 3
7 3.3
8 3.415

What's the relationship between :sides and :r ?

:r = f(:sides)

What is the equation inside this f(:sides)?

I can see that :r gets bigger as :sides gets bigger. But not very quickly, and it appears to be slowing. And sometimes it neatly fits into integers. That's a pretty special property of the function. I tried drawing some figures on paper, looking at when the shapes touch, and quickly saw it was pretty complicated, so I went searching for answers online.

At the ultimate Sierpinski Triangle page he talks about "adjust(ing) the ratio until the corners match up," which is all I've done, but he doesn't allude to the actual formula for calculating :r from :sides.

But the wikipedia article on the N-Flake gives this formula for :r:

r = 2 ( 1 + k = 1 [ n / 4 ] cos 2πk n )

Where n = :sides, [n=4] means "the greatest integer less than or equal to n/4" (see this discussion). Cos is calulated in radians.

So, let's try and apply that to our poly_sier logo program.

One interesting thing is that the 4-sided Sierpinski polygon is now very boring looking, as it lines up all too well. The formula has given it a ratio of '2' - but any value between 2 and 3 will look better, with 2.5 about the best. I guess this is a case where aesthetics and mathematics have to agree to disagree.

 

Logo + Turtle graphics via Papert (via archive.org)

FCa