Now we present several examples, using the EscherTiling function from the Escher package in the electronic supplement, which has many more options than we have described above. The ColorInstructions option is how we have arranged that the four key color-use lists are entered: it accepts a 2×2 array of four 5-lists. Although we found many of these instructions by trial and error, an excruciating task, we later figured out how to automate this process (see section 5). Still, it is essential to understand how one might search for a proper coloring by hand, and we describe that here. Note that the weaving options can be ignored during the seach for a proper coloring.
The first example is a simple pattern generated by the signature , but with some opposite weaves added to enhance the weaving effect. This example uses only two colors, so the Colors option is set to a list of length two. The color instructions then refer only to the indices 1 and 2. In this atypical case, the four instruction lists are the same: {2, 1, 2, 1, 2}. When fed a single color-instruction-list, as in this case, the package automatically transforms it to a 2×2 matrix. We reload the package now because that will erase the instructional versions of EscherTiling and MakeTile from Section 3.
Figure 10. The pattern corresponding to the signature .
Here’s a pretty example based on , a signature that disobeys Escher’s restrictions. Again, weaving considerations leads us to use .
Figure 11. The pattern corresponding to the signature .
And here is another signature that disobeys Escher’s rules: .
Figure 12. The pattern corresponding to the signature .
Here’s a three-strand example based on .
Figure 13. The pattern corresponding to the signature ; this one has three strands, and so uses three distinct colors.
Very often it will not be possible to just color the tile and use it to periodically generate a proper coloring. Typically the colors will have to be switched as we proceed from tile to tile. A simple way to view the situation is that we desire a properly colored big tile, which can be used to generate a pattern periodically. Here is an example where the big tile is .
Figure 14. The tile for the signature . In this case the colors on the left and right fail to match up.
Now, note how the shade at middle left is light while that at middle right is dark! Set Size to 4 and the problem, as well as its solution, will become evident. The top-bottom colors do match, however. So flipping colors as we move right will generate a proper coloring. Recall that Thread moves a function (Rule in this case) inside its arguments.
The following is how we use Thread and Reverse to switch colors as we move right. Note that Translate, as defined in the package, can also take a list of translation vectors as its second argument, though that is not necessary here.
Figure 15. By switching colors we can form a larger 4×2 tile that can be used to generate the proper pattern.
Now we have a periodic big tile; the colors match up properly on all sides, and we can easily tile with bigTile to get a large, properly colored pattern. But instead of doing it by hand, we can call on the package, which has automation capabilities built in. They will be explained more fully later; briefly, if we provide a BigTileSize setting of {4, 2} and delete the explicit coloring instructions (causing the default of Automatic to kick in), EscherTiling will find the correct color scheme and output a properly colored pattern. Size must be a multiple of BigTileSize in each coordinate (so a Size
of 8×8 is compatible with the BigTileSize
of 4×2 in this example).
Figure 16. Using the right big tile size — 4×2 in this case — yields a properly colored pattern.
Finally, the signature looks harmless enough, but getting the coloring right is quite a chore. Five colors are required, and if one wants to generate the pattern by periodically repeating a large tile, then the size of the big tile must be 10×10. It took several hours to manually work out the correct color instructions for the tile and the color switches for the big tile. But the automation capabilities of the package mean that one can simply use trial-and-error to discover the correct big tile size. Incorrect values yield colorings that are imperfect in that strands that cross might get the same color. (Of course, that is unavoidable if the strand is self-crossing. The reader has by now probably correctly surmised that by a strand we mean a contiguous sequence of polygons.) The automation algorithm will be discussed further in section 5, but to give a flavor of what it does, here is a synopsis. Typically the user would not see this, as he or she would just set ColorInstructions to Automatic in the call to EscherTiling.
First, here is the tile, with the first polygon colored dark gray throughout, the second shaded a less-dark gray, and so on. The package interprets NiceGrays as a request for the Grays[n] function defined earlier.
Figure 17. The tile for the signature .
Now we can begin to describe the scheme that underlies the automated coloring part of the Escher package. When ColorInstructions is set to Automatic and MinimumColoring is True (the defaults), several things happen:
1. A nice color set, called NiceColors, is used; you can see our choice (and of course change it or use your own list if you prefer) by looking at NiceColorNames, which uses names from the Graphics`Colors` package (the first five are DodgerBlue, LemonChiffon, PaleGreen, DarkOrchid, and Cyan).
2. An algorithm (discussed in section 5) is called to generate a setting for ColorInstructions and the switching rules for the big tile. This assumes that a BigTileSize is given (default is {2, 2}); if an incorrect BigTileSize is given, the coloring may be imperfect. Thus the process is not truly automated, as the user must figure out the big tile size (though we have done and included all 154 cases for Escher's five-piece motif!).
3. The MinimumColoring option calls upon some algorithms of graph theory to further refine the instructions to use the minimal number of colors.
For the present example, assuming that the correct big tile size of 10×10 has been provided, the algorithms generate the following 5×5 array of 2×2 matrices.
Each 2×2 matrix is used as the coloring instructions for one of the copies of the tile that make up the big tile (it takes 25 2×2 tiles to form the 10×10 big tile). If you wish to see all 25, you wll need to use AutoColorAlgorithm (available globally) and MinColor (not declared for global visibility, so its full context is needed) as follows.
One could then set ColorInstructions to mca to get the colored pattern. This underscores the modular nature of our package design: we developed specific algorithms to produce complicated option settings for the EscherTiling function. Of course, the simplest way to view the correct pattern is to just let the automatic defaults take over. The work takes a minute or more, but it takes hours to work out the proper coloring instructions by hand. Incidentally, this example has the largest color-period of any of the 154 signatures (assuming the motif is EscherMotif).
Figure 18. The shaded pattern produced when automatic coloring is used on the signatureThis 10×10 big tile is color-periodic: the colors on opposite edges match up and so the tile can be repeated to cover the entire plane.
As noted, there are 154 different signatures (when weaving order is ignored). We have gathered these in the AllSignatures list, which the user can access. Moreover, we have made a database of the proper color-periods (big tile sizes) for all of them, for the case of Escher’s five-piece motif. So the user can see any of the 154 properly colored Escher patterns by using the Lookup setting as illustrated below. Currently, the database has been computed only for the 5-piece Escher motif. If a reader cares to make such a database for the other motifs we have included in the package (see section 6), we would be pleased to add it to our package. That is a good way to discover some especially pleasing patterns! A setting of ScaleUp[n] to the Size option yields an image that is n times the big tile size.
Figure 19. An example where a precomputed database, called on by Lookup, provides the correct big tile size.
An interesting aesthetic question is whether it is a good idea to use the minimum number of colors. The user can try setting MinimumColoring to False in the preceding example for a comparison.
If one has a signature in mind and wishes to know which of the 154 it corresponds to, that can be learned as follows.
And here is the equivalent signature.
Although SignatureIndex
provides the identity of an equivalent signature, it is part of a more sophisticated function that can tell how to transform the signatures. In fact, the package contains the line SignatureIndex[sig_] := Captain[sig]⟦1⟧
, where the function Captain
(named for historical reasons) gives a bit more information.
This tells us that not only is equivalent to AllSignatures⟦115⟧
which is itself equal to (modulo weaving) but also that it can be converted to that signature by rotating counterclockwise by 90°, flipping about the horizontal axis, swapping rows and then swapping columns. (Note: a simpler sequence of transformations might suffice.) The four functions RotateSig
, FlipSig
, RowShiftSig
and ColumnShiftSig
each transform a signature in what, it is hoped, is an obvious way. All of these functions are made available globally by the package for the user's convenience and/or amusement, and allow some customization of tilings.
Finding the signatures that give rise to the largest color-period, which are 10×10 for Escher’s motif, can be done as follows. There are five such interesting cases.