Function Repository Resource:

SpectreHexagonalTiling

Source Notebook

Generate the hexagonal tiling pattern of the spectre and its supertile

Contributed by: Bowen Ping

ResourceFunction["SpectreHexagonalTiling"][init]

plots the spectre tiling initial conditions for integer init from 1 to 9.

ResourceFunction["SpectreHexagonalTiling"][init,size]

plots the spectre tiling with init as initial conditions for a hexagonal array of integer size layers.

ResourceFunction["SpectreHexagonalTiling"][init,size,"type"]

plots the combinatorial tiling of the given type.

ResourceFunction["SpectreHexagonalTiling"][init,size, typelist]

plots the combinatorial tilings of all types in the typelist.

Details

This combinatorial equivalence is proven in “A Chiral Aperiodic Monotile”. The tiles are the same as shown in Figure 4.1, Figure 4.2 and Figure 5.3.
This function uses combinatorial hexagons to generate tilings depending on a built-in function SatisfiabilityInstances.
Supported tiling types include the following:
"Hexagon"combinatorial hexagons
"Spectre"the Spectre tiles
"Cluster"1-level supertiles of the Spectre
"n-Supertile"n-level supertiles of the Spectre
HatHexagonalTiling has the same options as Graphics, with the following additions:
ColorFunctionAutomaticfunction with inputs from 1 to 9, gives colors as output.
ColorRulesAutomaticlist of rules from integers (from 1 to 9) to colors.
"Count"1required number of possible tilings.
The setting "Count"All generates all possible tilings.
EdgeShapeFunction is used to change the shape of the tiles.

Examples

Basic Examples (4) 

Depict a Mystic tile and a Spectre tile:

In[1]:=
ResourceFunction["SpectreHexagonalTiling"][#, 0] & /@ {1, 2}
Out[1]=

Generate a tiling made of Mystic and Spectre tiles:

In[2]:=
ResourceFunction["SpectreHexagonalTiling"][9, 3, ImageSize -> 300]
Out[2]=

Plot the tilings of combinatorial hexagons, the Spectre tiles and supertiles:

In[3]:=
ResourceFunction["SpectreHexagonalTiling"][5, 1, #] & /@ {"Hexagon", "Spectre", "Cluster", "2-Supertile"} // Partition[#, 2] & // Grid
Out[3]=

Make a curved spectre tiling:

In[4]:=
ResourceFunction["SpectreHexagonalTiling"][1, 3, EdgeShapeFunction -> Automatic, ImageSize -> 300]
Out[4]=

Scope (3) 

There are 9 different initial conditions, corresponding to 9 kinds of hexagons:

In[5]:=
Grid[Partition[#, UpTo[5]], Frame -> True, FrameStyle -> Gray] & /@ Outer[ResourceFunction["SpectreHexagonalTiling"][#2, #1, ImageSize -> 100] &, {"Hexagon", "Spectre", "Cluster"}, Range[9]] // Column
Out[5]=

Curve the spectre tiles and supertiles:

In[6]:=
Outer[
  Function[{tile, curvature},
   ResourceFunction["SpectreHexagonalTiling"][5, 0, tile,
    EdgeShapeFunction -> Function[curvature Sin[Pi #]], ImageSize -> 100]
   ],
  {"Spectre", "Cluster"},
  Range[0, 0.4, 0.1]
  ] // Grid
Out[6]=

Any higher-level supertiles are available:

In[7]:=
Grid[Transpose[
  {#, ResourceFunction["SpectreHexagonalTiling"][4, 0, #]} & /@ {"0-Supertile", "1-Supertile", "2-Supertile", "3-Supertile"}
  ], Frame -> All, FrameStyle -> LightGray]
Out[7]=

Options (8) 

Count (2) 

Use "Count" to give more possible tilings:

In[8]:=
ResourceFunction["SpectreHexagonalTiling"][9, 2, "Count" -> 3]
Out[8]=

Generate all valid one layer surroundings:

In[9]:=
Grid[Partition[
  ResourceFunction["SpectreHexagonalTiling"][3, 1, "Count" -> All, ImageSize -> 150], UpTo[4]]]
Out[9]=

Colors (3) 

Color the tiling using GrayLevel:

In[10]:=
ResourceFunction["SpectreHexagonalTiling"][1, 2, ColorRules -> (x_ :> GrayLevel[x/12]), ImageSize -> 300]
Out[10]=

Add blue EdgeForm in a tiling:

In[11]:=
ResourceFunction["SpectreHexagonalTiling"][1, 2, ColorRules -> (x_ :> {EdgeForm[Blue], Lighter[Green, x/12]}), ImageSize -> 300]
Out[11]=

The same style can be set by ColorFunction:

In[12]:=
ResourceFunction["SpectreHexagonalTiling"][1, 2, ColorFunction -> Function[{EdgeForm[Blue], Lighter[Green, #/12]}], ImageSize -> 300]
Out[12]=

EdgeShapeFunction (2) 

Set EdgeShapeFunction to be Automatic to plot curved tilings:

In[13]:=
ResourceFunction["SpectreHexagonalTiling"][9, 3, ImageSize -> 300, EdgeShapeFunction -> Automatic]
Out[13]=

Plot the curved Spectre tiling with different edges function:

In[14]:=
ResourceFunction["SpectreHexagonalTiling"][1, 3, ImageSize -> 300, EdgeShapeFunction -> #] & /@ {
  Function[0.3 Sin[Pi #]],
  Function[Sqrt[(0.25 - (# - 0.5)^2)]]
  }
Out[14]=

InterpolationPoints (1) 

The function uses interpolation to make curved boundary. Interpolation options can be set manually:

In[15]:=
ResourceFunction["SpectreHexagonalTiling"][1, 1, "Spectre", EdgeShapeFunction -> Automatic, InterpolationPoints -> #] & /@ Range[2, 5]
Out[15]=

Properties and Relations (1) 

It is faster to use a list of types than to map over a list:

In[16]:=
RepeatedTiming[
 tiling1 = ResourceFunction["SpectreHexagonalTiling"][1, 5, {"Spectre", "Cluster"}, "Count" -> 3];]
Out[16]=
In[17]:=
RepeatedTiming[
 tiling2 = ResourceFunction["SpectreHexagonalTiling"][1, 5, #, "Count" -> 3] & /@ {"Spectre", "Cluster"};]
Out[17]=

They give exactly the same result, even if the option "Count" is not 1.

In[18]:=
SameQ[tiling1, tiling2]
Out[18]=

Possible Issues (2) 

EdgeShapeFunction doesn’t work on hexagons:

In[19]:=
ResourceFunction["SpectreHexagonalTiling"][1, 3, "Hexagon", EdgeShapeFunction -> Function[Sin[Pi #]], ImageSize -> 300]
Out[19]=

The EdgeShapeFunction should be continuous from 0 to 1, and equal to zero at both 0 and 1. Otherwise, the shape would collapse. Also, if the value of the function increase to a large value, it may cause self-intersection:

In[20]:=
With[{f1 = Function[#], f2 = Function[0.3 Sin[Pi #]], f3 = Function[Sin[Pi #]]},
   {
      Labeled[
       Plot[#[x], {x, 0, 1}, PlotRange -> {0, 1}, PlotTheme -> "Scientific"],
       Style["EdgeShapeFunction: " <> ToString[TraditionalForm[#[x]]],
         12]
       ],
      ResourceFunction["SpectreHexagonalTiling"][7, 0,
       EdgeShapeFunction -> #, ImageSize -> 150
       ]
      } & /@ {f1, f2, f3}
   ] // Transpose // Grid[#, Frame -> {All, True}] &
Out[20]=

Neat Examples (1) 

Plot a large patch of spectre tiling, coloring Mystic purple and one of its neighboring tiles green:

In[21]:=
ResourceFunction["SpectreHexagonalTiling"][3, 8,
 EdgeShapeFunction -> Function[0.25 Sin[Pi #]],
 ColorRules -> {1 -> Lighter[Purple, 1/4], 7 -> Lighter[Green, 1/3], i_ :> GrayLevel[Mod[40 - i, 40]/40]},
 ImageSize -> 600
 ]
Out[21]=

Publisher

Bowen Ping

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 08 May 2024

Source Metadata

Related Resources

License Information