5-sided Sierpinski Gasket
2008.05.22
Mathematics, Pictures/Images, Programming

While in the stall attending to some personal business today, I read the graffiti as usual. One particular one is a pretty poor attempt at an Apollonian gasket. Somehow from there I started wondering if it is possible to construct Apollonian gaskets with five-fold symmetry (in particular, I was seeing if I can draw a gasket such that instead of having hyperbolic triangles left over, we have all hyperbolic pentagons).

The question can be (sort of) reduced to one in planar graphs, in particular the tiling of a pentagon by smaller pentagons. Once I see this, I realized that this allows a way to construct an analogue to the Sierpinski gasket using pentagons.

Here's a rough illustration: Illustration of the pentagonal Sierpinski gasket

Here's how I drew it: I first discovered the PERL module PostScript::Simple (interested parties can search for thatn on CPAN). Then I wrote this simple (ugly and inelegant, probably with lots of inefficiencies) script with a single recursion:

use strict;
use PostScript::Simple;

my $p = new PostScript::Simple(colour => 1, eps => 1, units => "pt", xsize => 1000, ysize => 1000);

my @pa = (500,100);
my @pb = (200,300);
my @pc = (325,650);
my @pd = (675,650);
my @pe = (800,300);

$p->polygon( @pa, @pb, @pc, @pd, @pe, @pa);

iterDrawPenta(8,@pa,@pb,@pc,@pd,@pe);
$p->output("test.eps");


sub iterDrawPenta {
if ($_[0] == 0){ return; }
my @points = @_[1..10];
my @points2 = @_[3..10,1,2];
my @points3 = @_[5..10,1..4];
my @points4 = @_[9,10,1..8];
my @outside;
my @inside;

for (my $k = 0; $k < 5; $k ++){
push(@outside, ($points[2*$k] + $points2[2*$k])/2);
push(@outside, ($points[2*$k+1] + $points2[2*$k+1])/2);
push(@inside, ((2*$points[2*$k] + $points4[2*$k])/3 + (2*$points2[2*$k] + $points3[2*$k])/3)/2);
push(@inside, ((2*$points[2*$k+1] + $points4[2*$k+1])/3 + (2*$points2[2*$k+1] + $points3[2*$k+1])/3)/2);
$p->line(@outside[2*$k,2*$k+1],@inside[2*$k,2*$k+1]);
}

$p->polygon(@inside, @inside[0,1]);
iterDrawPenta( $_[0] - 1, @points[0,1], @outside[0,1], @inside[0,1], @inside[8,9], @outside[8,9]);
iterDrawPenta( $_[0] - 1, @points[2,3], @outside[2,3], @inside[2,3], @inside[0,1], @outside[0,1]);
iterDrawPenta( $_[0] - 1, @points[4,5], @outside[4,5], @inside[4,5], @inside[2,3], @outside[2,3]);
iterDrawPenta( $_[0] - 1, @points[6,7], @outside[6,7], @inside[6,7], @inside[4,5], @outside[4,5]);
iterDrawPenta( $_[0] - 1, @points[8,9], @outside[8,9], @inside[8,9], @inside[6,7], @outside[6,7]);
}

The script uses the PostScript::Simple module and starts by initiating an eps canvas. The five arrays pa,pb,pc,pd,pe are the initial starting coordinates for the pentagon. The main drawing is done by the sub-routine iterDrawPenta which divides the input-pentagon into 6 sub-pentagons, and recursively calls itself, inputting the 5 outer sub-pentagons. The leading parameter of iterDrawPenta keeps track of the level of recursion.

The figure above was drawn using 8 levels of recursion, which produced a 79 megabyte postscript file, which I then converted to a much smaller png image.

Posted at 21:17:49 EDT by W comment

blogCentralFront Page
2009.11.20 00:41:20 GMT Feynman's Messenger Lectures online Just found out something rather cool: Microsoft Research, through Project Tuva, is publishing videos of Richard Feynman's Messenger Lectures. Go watch.
2009.11.18 11:05:07 GMT Alcohol consumption Different cultures certainly have different views on alcohol. For example, at Hertford College Oxford, wine is allowed if reasonably drunk and 4) A small amount of beer or lager will be allowed wher
2009.11.16 19:17:31 GMT Luc visits; Willie doesn't check e-mail Holy cow! I just realized that I spent a day at work without checking e-mail! Okay, to be honest, today I was hosting Luc Nguyen, who we invited to speak on his work about the regularity near the sing
2009.11.15 18:19:32 GMT Chicken soup Chicken soup is not just good for the soul. It has been scientifically proven to mitigate inflammation. Maybe mommy's chicken soup was the reason that the same bug that took Pin out of commission for
2009.11.10 17:58:53 GMT Sayonara, e-nibbles; hullo, Gee-Mi-Ni It's final: e-nibbles is no more. e-nibbles was my trusty Dell D600 which I purchased summer after my Junior year in college through the Student Computer Initiative. Immediately after receiving the ob
2009.09.30 10:12:57 BST Ahhh! Cruft discovered in pre-print. Ack, I should've known better. I stayed up a bit later on Monday night than I intended to. I was asked, by Claude, last week, about whether certain cases (in particular the Born-Infeld model) not cove
2009.09.28 18:30:27 BST Spiders spiders everywhere Wow! Third post today, and here I thought I have been neglecting my blog. Anyway, it turns out that I am not the only person to have noticed the large number of spiders in Britain this autumn. Going o
2009.09.28 15:12:09 BST Causality of generalized wave-maps--paper on arXiv Oh, almost forgot. New paper on arXiv. Gary Gibbons showed via explicit computations using eigenvalues that the Skyrmion equation obeys the dominant energy condition. In my paper, I proved the dominan
2009.09.28 14:42:39 BST The evolution debate as an illustration of speciation I was reading some article or another in Wired, which happens to be about dinosaurs. And of course, the religious kooks came out of the woodwork to attack evolution on the comment board. And it occurr
2009.09.02 12:42:44 BST New beginnings: first days at Cambridge Heh. Did you, dear reader, notice the change on the date-stamp for the previous entry? It was posted in British Standard Time. Yes, I am now taking a position in the Department of Pure Mathematics and