Fractint L-System Tilings

A tutorial by William McWorter
mcworter@midohio.net
version 1.4
January 1997

Back to Tutorial Index




TILINGS


One way to construct a tiling which is particularly suited to an L-system interpretation is dissecting a figure into smaller copies of itself. For example, the square can be thought of as made up of four smaller squares.

(drawing of a square dissected into four smaller squares)

You can think of the square as a cell which subdivides into four squares. Each of these squares subdivides into four squares and so on. Since FRACTINT is limited to drawing line segments, it's a struggle to find an L-system to represent this situation. However, Adrian Mariano found a clever way to model square subdivision with his L-system SquareGasket. To make explaining things easier, let's look at this another way. The interior of the square above forms a cross. If each of the four arms of this cross are replaced by a cross, then the result partially completes a drawing of the square dissected into 16 squares. This leads to the following L-system.

Grid { 
  Angle 4	; Allow turns of 90=360/4 degrees
  Axiom f	; Birth string is the symbol f (see text below)
  f=f[+f][-f]f	; Replacement string for f (see text below)
  }

The triangular grid is another common tiling. The script below was suggested by that for the square; it replaces each line segment with an "italic" cross. x is a cross slanted forward and y is a cross slanted backward.


Trigrid1 {
  Angle 6
  Axiom x
  x=fy[+fy][--fy]fy
  y=fx[++fx][-fx]fx
  f=
  }

The irregular boundary of this picture may be a bit surprising, but then you often get more than you bargained for with L-systems.



Another tiling commonly seen in public bathrooms involves hexagons. How can we look at this tiling as an L-system? Consider the picture below.

A hexagon has six sides. The figure above has six hexagons surrounding a hexagon. What if each side of a hexagon is replaced by a hexagon? That would transform a hexagon into the figure above, but would it draw a hexagonal tiling at higher orders? The answer is yes but some lines are traced more than once. To eliminate retracing of lines, I devised an L-system which would replace a line with only a four sides of a hexagon.




Hex { 
  Angle 6	  ; Turns are 60=360/6 degrees
  Axiom f	  ; Birth string is f
  f=-f+f+g[+f+f]- ; Replacement string for f 
  g=gg		  ; Replacement string for g (see text below)
  }



The distance between the starting point and ending point of the replacement string for "f" is exactly twice as long as the length of each line in the string. Hence the replacement string for "g" must have the same property even though the string "gg" results in nothing being drawn. The picture below has order 7.

Normally when one dissects a figure into smaller copies of itself, the number of copies is most often a perfect square, like 4. The Sphinx below is one example. It is in the file fractint.l.

It is quite a challenge to invent dissections into nonsquare numbers of copies. An example of the dissection of a figure into two copies of itself is the isosceles right triangle.

It dissects into two isosceles right triangles. Another example is the 30-60-90 degree triangle. It dissects into three such triangles. Both of these dissections will be used later to construct spacefilling curves, the former to design one of Peano's spacefilling curves and the latter to design a new spacefilling curve.

If you drop the requirement that the parts of a dissection all be similar to the whole, amazing things can happen. Roger Penrose discovered some remarkable tilings, all of which can be rendered with an L-system. Try the L-systems in penrose.l , penrose2.l or the tiling.l files. Many of these are also in the file fractint.l as well. Here is the L-system Pentaplexity.



Stars&Pentas2  {
     ;; by Philippe Hurbain
     ;; Penrose's stars and pentagons, generated from
     ;; decomposition rules
     ;; u is the star, v is the boat, w is the thin rhombus
     ;; x, y and z are the pentagons
 Angle 10
 Axiom u
 u=@.381966[v]F[|y][-u]++F|+[v]F[|y]++F|+[v]F[|y]++F|+
 u=[v]F[|y]++F|+[v]F[|y]++F
 v=@.381966[v]F[|y]++F|+[v]F[|y]-[u]F-F|+[v]F[|y]++F
 w=@.381966G++[u]F|+F-F|+[v]F[|y]
 y=@.381966[x][y][w]F[|!y]++F++[y][w]F[|!y]++F++[z]F
 x=@.381966G++G++[!x][!z]F--[!z]F--[!z]F--[!z]F--[!z]F
 z=@.381966[z][x]F++[z]F++[w][y]F[|!y]++F++[z]F
 F=G
}


I tried my hand at this as well and discovered dissections of two different isosceles triangles into triangles similar to these two triangles.

(drawings of dissections of both triangles)

Here is an L-system to draw this tiling.

Isocepent { 
  Angle 10
  Axiom w
  w=++[-@1.618033989f@I1.618033989++++f]fx--[++@1.618033989f----f]fw--
  w=[--@1.618033989f++++f]fy++
  x=-[+@1.618033989f@I1.618033989----f]fz++[--@1.618033989f++++f]fy-
  y=--[+@1.618033989f@I1.6180339898----f]fz++[--@1.618033989f++++f]fy++
  y=[++@1.618033989f----f]fw--
  z=+[-@1.618033989f@I1.618033989++++f]fx--[++@1.618033989f----f]fw+
  f=
  }

w identifies the first triangle above and its replacement string describes how it is dissected. z identifies the second triangle above and its replacement string describes how it is dissected. y is the mirror image of w and x is the mirror image of z.

The stuff in brackets draws two sides of one of the triangles in the dissection and the following f draws the third side of the triangle. Each replacement string describes a drawing that begins at one end of a shortest side of a triangle and ends at the other end of this shortest side. The longest side of each triangle type is 1.618... times as long as its shortest side.

The line "f=" tells FRACTINT to replace f by nothing. Hence when FRACTINT computes the next order, all the stuff in brackets is essentially ignored and the only stuff that survives outside the brackets are the +,-'s.
(drawing of Isocepent)

Not terribly interesting. However, when the bracketed stuff is dropped, the picture looks better. You'll see when we discuss spacefilling curves, a topic we take up now.



On to The next chapter or back to the Tutorial Index

or back to The Fractint Home Page. or back to The Fractint Index Page.

This page maintained by

Noel Giffin,
noel@triumf.ca