How to program an ideal kaleidoscope

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.


Setup for the kaleidoscope

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.


Kaleidoscopic image. The orange lines show the position of the mirrors. The dot corresponds to the position of the eye. The reflectivity of the mirrors is set to 95%.

This entry was posted in Kaleidoscopes and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s