Sunday, December 10, 2006

Programmer's Almanac: Dec 11, 2006

On this day in 1871, David Brewster, the Scottish inventor of the Kaleidoscope was born. If you're not familar with this toy, the Kaleidoscope is a short tube containing lenses, mirrors, and small, multicolored objects. When you look into one one end of the tube and twist it, you can see some beautiful geometrical patterns. In the late 1800's and the 1970's, this toy was extremly popular -- although Brewster never made a dime during these fads.

Many computer programs and screensavers to simulate Kaleidoscopes have been written, and are available for download. There are also some web based Kaleidoscopes, where you can view these images online.

If you want to make your own Kaleidoscope simulation, Dr. Cliff Pickover shows some simple pseudocode for a Kaleidoscope on his website:

DO FOR i = 1 to 40
x1 = random; y1 = random
x2 = random; y2 = random
x3 = random; y3 = random
/* Confine initial pattern to lower right quadrant */
if ( x1 > y1 ) then (save=x1; x1=y1; y1=save;)
if ( x2 > y2 ) then (save=x2; x2=y2; y2=save;)
if ( x3 > y3 ) then (save=x3; x3=y3; y3=save;)
DrawTriangleAt(x1,y1,x2,y2,x3,y3)
/* Create 7 reflected images /
DO FOR j = 1 to 7
Flip (x,y) Points as Described in Text
DrawTriangleAt (x1,y1,x2,y2,x3,y3)
END
END
Today many folks spend their days staring at a "tube" with ever-changing mulitcolored pixels -- we call it a television. In the Victorian era, choices were a bit more limited. And maybe the revival of the fad in the 1970's says something about the quality of the TV shows, then.

(c) 2006, Jorge Monasterio

No comments: