Skip to content

Generalized Penrose Tilings

neozhaoliang edited this page Sep 12, 2017 · 3 revisions

Usage

This is a single script penrose.py, it requires the cairocffi lib be installed:

pip install cairocffi

Then simply run

python penrose.py

Each time you run this script it outputs a random pattern, these patterns are almost surely not "locally isomorphic" with each other.

About the code

This program uses de Bruijn's pentagrid method to draw aperiodic tilings. The main steps are:

  1. Firstly define the five directions of the five grids:

     GRIDS = [np.exp(2*np.pi*1j/5) for j in range(5)]
    

    and how many lines are needed in each grid. We will use an integer nlines for all grids, means that the lines numbered from -nlines to +nlines in each grid will be in our picture.

  2. Then shift these grids with a 5-tuple of floating numbers:

     SHIFTS = np.random.random(5) 
    

    where SHIFTS[i] is the shift of the i-th grid. When the sum of SHIFTS is an integer it gives the classical Penrose tiling. Two different shifts define isomorphic patterns if and only if their sum are congruent mod 1, i.e. the difference of them is an integer.

  3. Now compute all the rhombus: for each intersecting point of these grid lines there is a rhombus, i.e. for each 0 <= r < s <= 4 and -nlines <= kr, ks <= nlines, the intersecting point of the kr-th line in the r-th grid and the ks-th line in the s-th grid correspondes to a rhombus in the tiling. If s-r == 1 or 4 then this is a thin rhombus, otherwise it's fat.

  4. Draw all these rhombus and assign different colors to thin and fat rhmbus.

Reference:

Algebraic theory of Penrose's non-periodic tilings of the plane, by N.G. de Bruijn.