I have always been fascinated by kaleidoscopes. But often the mirrors were not well aligned resulting in disappointing images. Thus created a virtual kaleidoscope on the computer. Then it is easy to have perfect mirrors and to try different geometries. Through this virtual kaleidoscope I can look at images stored in my computer.
The basic setup is simple, see the figure at the left. Three mirrors are put perpendicularly to the viewing plane. They form a triangle, as shown by the black lines. Only the part of the image that lies inside the triangle can be seen. Pixels inside the triangle can simply be copied directly from the original image. For pixels outside we have to do some ray-tracing for the reflections at the mirror, see the green lines.
Fortunately, we can do the ray-tracing in the two-dimensional plane. We need a reference point for the eye. This is actually its projection into the drawing plane and lies inside the triangle. The straight line between this point and the pixel determines the reflection. It occurs at the mirror that intersects this line. Thus we calculate the mirror image of the pixel at this mirror. If the mirror image falls inside the triangle we use the corresponding pixel of the original image in the image of the kaleidoscope. If the mirror image lies outside we have to repeat this procedure. Eventually, a mirror image will always lie inside the triangle, but this may take 10 reflections or more.
For the result shown below I am using a triangle with angles of 30, 60 and 90 degrees. It is shown in orange together with the position of the eye. This triangle is half an equal sided triangle. The kaleidoscope gives a periodic pattern with hexagonal symmetry. To get an idea of the number of reflections I put the reflectivity of the mirrors to 95%. Thus the image is darker if there have been many reflections. We can see that there are a lot of reflections needed to get around the corners of the triangle.