Wolfram Library Archive

Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings

The Occasional Image: A Kaleidoscope

M. Ehrhardt
Journal / Anthology

Interex Enterprise Solutions
Year: 2001
Issue: January/February
Page range: 103-110

We start the new year, and Volume 3 of Interex Enterprise Solutions, with the revival of the Graphics column that appeared in TC Interface and, from time to time, in Interact. The name of the column reflects its nature: it will be devoted to graphics - generated by and on computer- and it will appear from time to time, not every issues, popping up in the magazine when a pleasing computer graphics catches the eye. The object is not only to present interesting computer images but also to tackle the techniques and algorithms necessary to produce them. That's half the fun, right? Long time readers of TC Interface, hp-ux/usr, and Interact will recall, possibly, my predilection for the computer artistry of Clifford A. Pickover. Indeed, his biomorphs were the basis of the graphics program I created for Windows -- a challenge that provided materials for several articles. When I visited his website (http://sprott.physics.wisc.edu/pickove/home.htm) several months ago, I found a page devoted to kaleidoscopes. He provides a straightforward algorithm for generating a kaleidoscope-like pattern using triangles. He also includes circles, but I opted to stick with triangles. The basis idea is simple: we start by generating 20 to 40 randomly sized triangles, all in the first quadrant (x and y both positive) and above the line x=y. Then, by interchanging and negating x and y values of the vertices of the triangles, in the various permutations, we create symmetric reflections of our triangles about the origin and about the y=x and y=-x lines displaying all eight sets of triangles gives us our kaleidoscopic image. I have introduced two refinements to the triangle generation. First, we order the triangles from largest to smallest, so that when they are drawn, smaller triangles are always on top of larger ones. Second, we create additional sets of triangles in which each triangle is rotated about its midpoint -- the point where lines from vertices to the middle of opposite sides meet. That produces some striking views, and if we animate series of such rotated triangle sets, the visual effect is very kaleidoscope-like. Animation: how do we do that? Well, Mathematica has a built in animation feature that fits the bill. Mathematica also has an arsenal of list manipulation functions that make handling our sets of triangles very easy. I figured it was time to hone my rusty Mathematica skills anyway, so I have done the programming in Mathematica 4.0, on an NT machine. I realize that not everyone has Mathematica, but that should not present a problem. I will explain the Mathematica functions as we go. The full notebook is available on the Web page for the issue of the magazine. And if you go to www.wolfram.com, you can download a free copy of MathReader, which enables you to run the animation in the notebook. Besides, perhaps a demonstration of just how handy the Mathematica functions are will induce those of you who have not taken the plunge to dive in and give it a try.

*Arts and Humanities > Visual Art
*Mathematics > Geometry > Plane Geometry
*Mathematics > Recreational Mathematics