Most of the images on this site have been created with a Python script I created that can render polygon tilings into SVG.

I can then colour or otherwise manipulate the SVG files in the Inkscape SVG editor and then render parts of them to bitmap images for display on this site.

You can find the script here on github. You are welcome to use it to create your own images. I can't provide any support for it beyond the information supplied on this site.

You first need to install the Python Shapely library for manipulating polygons:

http://trac.gispython.org/lab/wiki/Shapely

The best way to learn to use the supplied functions is to experiment with them starting with the examples supplied below.

### Tiling()

Creates a new tiling.

**Example**

t = Tiling()

### rh(n,m=2)

Creates a rhomb with angle mπ/n.

If n is negative, this is a convenience to select the other rhomb angle.

rh(-n,m) = rh(n,n-m)

**Example**

rh(14) #returns the 14-rhomb (small angle)

rh(-14) #returns the 14-rhomb (large angle)

### t.start_polygon(n)

Adds the first polygon to a tiling. n can either be an integer > 2, in which case it is a regular polygon, or the output of the **rh()** function and so is a rhomb. The first polygon is assigned the number 0.

**Example**

t.start_polygon(10) # start the tiling with a decagon

### t.extend_edge(v0,e0,polygon_list)

Adds a sequence of polygons around the vertex v0 and starting at edge e0.

**Example**

t.extend_edge(1,0,[3,rh(15)]) # adds a triangle and the 15-rhomb around vertex 1 and starting at edge 0.

### t.merge(v0,e0,t0,v1,e1)

Merges the tiling t0 into the current tiling t. The vertex and edge v1, e1 on the tiling t0 is joined to the vertex and edge v0, e0 in the current tiling.

**Example**

# The example below merges a tiling containing a pentagon with one containing an octagon.

t = Tiling()

t.start_polygon(5)

t0 = copy.deepcopy(t)

t = Tiling()

t.start_polygon(8)

t.merge(0,0,t0,0,0)

### t.punch(v0,e0,n)

Attaches the polygon n to the vertex and edge v0, e0 and punches it out of the surrounding polygon.

n can either be an integer > 2, in which case it is a regular polygon, or the output of the **rh()** function and so is a rhomb.

**Example**

# The example below creates a tiling with a decagon and then punches a pentagon from it.

t = Tiling()

t.start_polygon(10)

t.punch(0,0,5)

### t.split(v0,e0,p0)

Split a worm off from polygon p0 starting with the vertex and edge v0, e0.

### t.decompose_polygon(p0,n,small_order,position_function=position_opposite,eliminate_sym_classes=True)

Decompose the polygon with number p0 into n smaller regular polygons with small_order sides using the given position function.

The polygon is decomposed into worms and smaller polygons.

The currently available position functions are position_opposite (the default), position_sequential, position_alternating and position_6.

The position_6 function is only usable for decompositions with 6 edge classes.

If the final parameter is false and small_order is even, this activates an alternative decomposition function which does not eliminate all the edges of a given class at each stage. This is not yet documented on the site.

**Example**

# decomposes a 30-gon into 3 pentagons

t = Tiling()

t.start_polygon(30)

t.decompose_polygon(0,3,5)

### t.universal_tiler_tu(n,t0)

The tiling t0 should include a 6n-sided polygon (possibly decomposed into smaller polygons).

This function will then compute a 3n order rhombic star and combine it with two copies of the 6n-sided polygon to create a translational unit for a plane tiling.

It may take a while to run.

### t.decompose_zonagon(p0,as_worms=True)

Decomposes the polygon with number p0 entirely into worms. This function will fail if the polygon is not a zonagon.

if as_worms is False, the worms will also be chopped into rhombs.

**Example**

# dissolves the 60-gon into worms

t = Tiling()

t.start_polygon(60)

t.decompose_zonagon(0)

### t.clip_all_worms()

Clips all the worms in the tiling into rhombs.

### t.toSVG(include_labels=False)

Renders the tiling into SVG and returns the result as a string suitable for saving to a file.

If include_labels is True, the SVG file will include labels for each edge and vertex. (Polygon numbers are not currently displayed but they probably will be in a future release of this code.)

### Larger example

# hendecagon tiling example

# You can change n below to generate a translational unit

# for a tiling containing any n-gon

print "Computing parts for translational unit."

print

print "Decomposing 6n polygon."

n = 11

t = Tiling()

t.start_polygon(6*n)

t.decompose_polygon(0,6,n,position_6)

t.clip_all_worms()

decomp = copy.deepcopy(t)

print

print "Computing translational unit. This may take some time."

t = Tiling()

t.universal_tiler_tu(n,decomp)

xml = t.toSVG()

fd = open("d:/tess/output.svg","w")

fd.write(xml)

fd.close()

print "Tiling output completed."