class Kaleidoscope

The class Kaleidoscope collects all mappings needed to make the four periodic kaleidoscopes. We first have to create an object with

  kaleidoscope=new Kaleidoscope();

and then we can choose one of the kaleidoscopes. With

kaleidoscope.chooseRectangle(50,120);

we would have a rectangular kaleidoscope of four mirrors. Here they are 50 units apart in horizontal direction and 120 units apart in vertical direction. As discussed in the last post, they periodic unit cell is twice as large in both directions.

To create a kaleidoscopic picture we get the image coordinates for each of its pixels as discussed in “improving the class Coordinates“. This gives us a Vector object “vec”. Then, we apply the translation and mirror symmetries of the kaleidoscope and put

  vec=kaleidoscope.make(vec);

From these new image coordinates we get the position of pixels in another image, using again the class Coordinates. Looking up the colors of these pixels we get the colors for the kaleidoscopic picture. You find more details in “looking up colors“, which tells how to read and interpolate colors from an input image.

The other kaleidoscopes result from

kaleidoscope.chooseSquare(80);  // 80 is the length of the smaller mirrors

giving a kaleidoscope with four-fold rotational symmetry,

kaleidoscope.chooseEquiTriangle(80);

giving three-fold rotational symmetry and

kaleidoscope.chooseRightTriangle(80);  // 80 is the length of the largest mirror

for six-fold rotational symmetry.

You find the code for this class in the next post.

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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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