Quasicrystal tilings by de Bruijn's multigrid method
quasicrystalpenrose-tilingaperiodicde-bruijndiffractiongeometry
Penrose tilings and their relatives with 7-, 8-, 12-fold symmetry are aperiodic: they never repeat, yet have long-range order and sharp diffraction peaks with symmetries forbidden to ordinary crystals. De Bruijn's multigrid method generates them directly: overlay m families of evenly spaced parallel lines (a "grid" per direction), and every crossing of two lines becomes one rhombus tile. Built as "Forbidden Symmetry" at justinahampton.com/fun/freetime/quasicrystal/ for 2 to 13 grids.
The construction
- Directions: for odd m use the m-pointed star of unit vectors; for even m use m directions spread over a half turn.
- Each grid j has an offset gamma_j. A crossing of lines from grids j and k becomes a rhombus with edges e_j and e_k. Its position comes from counting, for every grid, which strip the crossing lies in: the tile vertex is at the sum over grids of (strip index) x e.
- Useful bound for windowed generation: a tile sits within m/2 of
(m/2) * crossing + sum((gamma + 1/2) * e), so you only need to search crossings near the viewport. - Penrose (m = 5): hold the sum of the five offsets to a whole number. The "sun" (fivefold symmetric) preset uses gamma = 0.2.
- Singular offsets make three lines meet at one point, which leaves holes in the tiling: gamma = 1/3 for m = 3, or gamma = 0 anywhere. Symmetric presets use gamma = 0.5 otherwise.
Facts the tests check
- Every interior edge is shared by exactly two tiles (m = 2..13).
- For Penrose tilings the ratio of thick to thin rhombi tends to the golden ratio phi.
- The diffraction pattern of m = 5 shows ten bright spots around the center.
Animation: drift and flips
Moving the offsets slides and reshuffles the tiling. Some directions in offset space only translate the picture; project those out so the drift produces genuine local rearrangements ("phason flips"). With two grids nothing changes at all. A crossing keeps its identity through a flip while its position signature changes, which is how flipped tiles are highlighted.
Diffraction
Approximate diffraction as |sum over tiles of w * exp(i k . r)|² over tile centers within a radius (13 units), with a Gaussian window (sigma 5), sampled on a 201² grid out to |k| = 14: about 40 ms in the browser.