-
-
Notifications
You must be signed in to change notification settings - Fork 344
Generalized Penrose Tilings
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.
This program uses de Bruijn's pentagrid method to draw aperiodic tilings. The main steps are:
-
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. -
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 ofSHIFTS
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. -
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 thekr-th
line in ther-th
grid and theks-th
line in thes-th
grid correspondes to a rhombus in the tiling. Ifs-r == 1 or 4
then this is a thin rhombus, otherwise it's fat. -
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.