Eric Weeks - personal pages - software

# How to make a quasicrystal

weeks@physics.emory.edu ### I wrote a program to make quasi-crystalline patterns which has proven to be a popular program (about 40-50 people each month download it). This page explains what my program does.

This program makes Penrose tesselation pictures using a method I learned in a class I took, taught by Mike Marder. Using this program, you can make a picture like these:   The method: I'm not completely sure what this method is called; it might be called the generalized dual method but I might be wrong.

The idea behind the method is to lay down five sets of equally spaced parallel lines, each set rotated 2 pi/5 radians from the other sets, as shown here: These are imaginary lines which are used to generate the actual quasicrystal; you don't actually draw them. The sets shown above each have four lines, but generally you'd use maybe 50 lines per set. The placement of these lines is arbitrary, although you want them to overlap each other as shown above. I have labeled the sets A-E just for reference.

Once you have your lines formed, you number the strips between the lines as shown above. Each set of lines has its own numbers, and (as can be seen below) it is reasonably arbitrary which strip is numbered "1", as long as the numbering proceeds in order.

To locate a vertex of the quasi crystal, you consider a polygon formed by these intersecting lines. The polygon lies within the strips formed by the sets of lines. Consider the polygon marked in the above picture with a big blue dot. This polygon lies within strip 3 of lines A, strip 1 of lines B, strip 1 of lines C, strip 2 of lines D, and strip 3 of lines E. We assign this polygon the "indices" (3,1,1,2,3) to indicate which strips it lies within. Now, the actual coordinates for the vertex corresponding to this polygon are found by performing the following sum:

coordinate = indexA*vectorA + indexB*vectorB + indexC*vectorC + indexD*vectorD + indexE*vectorE

The indexA, indexB... are the indices found as described above. The vectorA, vectorB... are vectors which point parallel to each set of lines. Another way to put it would be:

x_coordinate = indexA*cos(0) + indexB*cos(2 pi/5) + indexC*cos(4 pi/5) + indexD*cos(6 pi/5) + indexE*cos(8 pi/5)
y_coordinate = indexA*sin(0) + indexB*sin(2 pi/5) + indexC*sin(4 pi/5) + indexD*sin(6 pi/5) + indexE*sin(8 pi/5)

So, by examining all of the polygons, you can locate the verticies of your quasicrystal. However, this is only the beginning: it would be nice to know which vertices are connected, so that you can draw in the lines to create the tiles.

Consider the intersection of any two lines in your sets of lines. This point is the corner of four polygons. Some of these polygons may be very tiny, some larger. Each polygon corresponds to a vertex of the quasicrystal you are trying to make. In fact, the indices of these four polygons are very similar, and these four polygons correspond to the four vertices of a single tile in your quasicrystal. Thus the intersection of lines corresponds to a tile in the quasi-crystal.

Thus, to plot a tile, you locate where two lines intersect, then figure out the coordinates of those four polygons sharing that intersection point as a corner, determine the vertices as described above from the polygons, and connect them to form your tile. You don't actually figure out the shape of the polygons; you really just need the indices of the polygon, which you can obtain using some math.

A reminder at this point: The sets of lines are IMAGINARY. You don't actually draw them; I drew them above just for illustration. They exist only in the mind of the computer, and are used as a tool to determine the tiles which you actually draw. The program I wrote generates these imaginary lines, then runs through all of the possible pairs of lines to find intersections, determines the vertices of the tile corresponding to the intersection, and then plots the tile if it appears on the page. Since in principle these imaginary sets of lines can be infinitely big, the program stops at some arbitrary point (basically some point past when the page is filled with a quasicrystal). The program doesn't worry about polygons at all.

One last point: it's important that only two lines meet at an intersection; if three lines meet at a single point, it makes a mess. In practice, this is easy to take care of just by adding some random offset to each set of lines (rather than having every line go through the origin, for example.) NOTE: I just typed this in at one sitting. If this is unclear, please let me know and I will try to clarify this. If you have a question about what I wrote here, probably other people do too. Thanks! My email address is below. 