About a year ago I explained “how to program an ideal kaleidoscope” to get the same as three mirrors put together. Often, one gets images that are not periodic. They have cut lines with a mismatch between the two sides, see “kaleidoscopic images with local rotational symmetry“. This does not look nice. Periodic images without discontinuities look better. Here I want to show how they arise in kaleidoscopes and how to make them efficiently.

For kaleidoscopes too, periodic images can only have two, three, four or six-fold rotational symmetry. The simplest case has two-fold rotational symmetry and four mirrors put together as a rectangle. We get something like this:

We see that the entire picture is made up of copies of the region inside the mirrors, shown as blue lines. Thus we could simply copy and paste it to complete the entire image. But this method is difficult to program and cannot be used if we want to create distorted images such as in “Nautilus“. A better method simply determines mirror image of each pixel inside this region and uses the color at this point. I used the same idea in “how to program an ideal kaleidoscope” but it is now easier to do for periodic images.

The green lines show the part of the picture which repeats periodically. It is twice as wide and high as the region between the mirrors because a mirror image has opposite handedness or chirality than the original leading to a period doubling. We can easily find a corresponding point inside the green region to any point outside by subtracting integer multiples of the width and height of the green region from its coordinates. Afterwards we have to check if the point is already in the region between the mirrors. If not, we use reflections at the mirrors to get into this region. This replaces the x and y coordinates of a point by the values of triangle functions:

Thus we can rapidly find the color for each pixel.

For four-fold rotational symmetry we put three mirrors together to form a triangle with angles of 90 and 45 degrees. The kaleidoscope then gives such images:

Now the periodically repeated unit cell is a square. As for the first kaleidoscope we map each point into this cell and use horizontal and vertical mirroring. Then additionally, we mirror at the diagonal x=y. Thus for points with coordinates y>x we exchange the x- and y-values. This mixes horizontal and vertical directions and gives four-fold rotational symmetry.

For kaleidoscopes with three and or six fold rotational symmetry we do similarly. Three mirrors put together as an equilateral triangle make this:

I prefer to use a rectangular unit cell, which is easier to use than the smaller hexagonal unit cell. To get every point into the small triangle we need several mirror symmetries and rotations. You will find more details in the code of one of the next posts.

For six-fold rotational symmetry we put the mirrors together as a triangle with angles of 30, 60 and 90 degrees, which results in:

Here I again I use the larger rectangular unit cell. Now, an additional mirror symmetry gives a six-fold rotational symmetry instead of the three-fold one.

The next post explains how I put these kaleidoscopes together.