######
Posted by:
christian on
26 May 2015

(1 comment)

A short gallery of images generated by my Penrose tiling generator, available on github.

#### Example 1: Inflation of a single B_{L} tile.

The Initial triangle is defined with the origin at the centre of its base:

This initial triangle is inflated for 5 generations. The default configuration is used for its appearance.

```
# example1.py
import math
from penrose import PenroseP3, BtileL, psi
# A simple example starting with a BL tile
scale = 100
tiling = PenroseP3(scale, ngen=5)
theta = 2*math.pi / 5
rot = math.cos(theta) + 1j*math.sin(theta)
A = -scale/2 + 0j
B = scale/2 * rot
C = scale/2 / psi + 0j
tiling.set_initial_tiles([BtileL(A, B, C)])
tiling.make_tiling()
tiling.write_svg('example1.svg')
```

#### Example 2: A "sun" initialized by a semicircular arrangement of B_{S} tiles.

The five initial B_{S} tiles are arranged as below, with their vertices calculated by successive rotations of the edge BA_{1}.

```
# example4.py
import math
from penrose import PenroseP3, BtileS, BtileL
# A "sun"
scale = 100
config={'tile-opacity': 0.9, 'stroke-colour': '#800',
'Stile-colour': '#f00', 'Ltile-colour': '#ff0'}
tiling = PenroseP3(scale*1.1, ngen=4, config=config)
theta = math.pi / 5
alpha = math.cos(theta)
rot = math.cos(theta) + 1j*math.sin(theta)
A1 = scale + 0.j
B = 0 + 0j
C1 = C2 = A1 * rot
A2 = A3 = C1 * rot
C3 = C4 = A3 * rot
A4 = A5 = C4 * rot
C5 = -A1
tiling.set_initial_tiles([BtileS(A1, B, C1), BtileS(A2, B, C2),
BtileS(A3, B, C3), BtileS(A4, B, C4),
BtileS(A5, B, C5)])
tiling.make_tiling()
tiling.write_svg('example4.svg')
```

#### Example 3: A star, including coloured arc lines.

The five initial tiles are laid out as below, with the vertices p, q, r and s calculated by rotation of the edges AB_{1} and AC_{5}.

The completed star is rotated by 90 degrees so that one of its vertices points upwards and the arc and tile colours customized.

```
# example3.py
import math
from penrose import PenroseP3, BtileL, psi
# A star with five-fold symmetry
# The Golden ratio
phi = 1 / psi
scale = 100
config = {'draw-arcs': True,
'Aarc-colour': '#ff5e25',
'Carc-colour': 'none',
'Stile-colour': '#090',
'Ltile-colour': '#9f3',
'rotate': math.pi/2}
tiling = PenroseP3(scale*2, ngen=5, config=config)
theta = 2*math.pi / 5
rot = math.cos(theta) + 1j*math.sin(theta)
B1 = scale
p = B1 * rot
q = p*rot
C5 = -scale * phi
r = C5 / rot
s = r / rot
A = [0]*5
B = [scale, p, p, q, q]
C = [s, s, r, r, C5]
tiling.set_initial_tiles([BtileL(*v) for v in zip(A, B, C)])
tiling.make_tiling()
tiling.write_svg('example3.svg')
```

Share on Facebook
## Comments

Comments are pre-moderated. Please be patient and your comment will appear soon.

## GZ 2 years, 7 months ago

Well done sir! Amazing aperiodic pattern beautifully visualized

Link | Reply## New Comment