This program renders generalized Penrose tilings using de Bruijn's penragrid method.
The code consists of three python scripts penrose_debruijn.py, penrose_kitedart, penrose_rhombus.py and several .inc, .pov files for POV-Ray rendering.
Firstly run python penrose_debruijn.py, this will output a png image of a generalized Penrose tiling rendered by cairo and a POV-Ray include file rhombus.inc, 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:
This program uses de Bruijn's pentagrid method to draw aperiodic tilings. The main steps are:
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.
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.
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.
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. N.G.de Bruijn.