Generalized Penrose tilings



  1. numpy and cairocffi.
  2. The free raytracer POV-Ray.

This program renders generalized Penrose tilings using de Bruijn's penragrid method.


The code consists of three python scripts, penrose_kitedart, and several .inc, .pov files for POV-Ray rendering.

Firstly run python, this will output a png image of a generalized Penrose tiling rendered by cairo and a POV-Ray include file, then you can render the .pov file with POV-Ray (don't run the .inc files, they are include files by the scenes).

The script penrose_kitedart draws the "kite and dart" pattern by the inflation way. The script penrose_rhombus draws the classical Penrose rhombus pattern by the inflation way.

One can also use ImageMagick to add some shading effect on the image rendered by cairo:

convert penrose_cairo.png +shade 20x20 -modulate 250 penrose_cairo.png

About the code

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

  1. Define the directions of the five grids:

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

    and the number of lines in each grid.

  2. Shift each grid with a real number between 0 and 1:

    SHIFTS = np.random.random(5)

    When the sum of these five real numbers is an integer then it gives the classical Penrose tiling, two different shifts give "the same" pattern (called "locally isomorphic") if and only if their sum are congruent mod 1.

  3. Compute the tiling: for each intersection 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 the tiling and assign different colors to the thin rhombus and the fat rhombus.


Algebraic theory of Penrose's non-periodic tilings of the plane. Bruijn.