Contest 2013/2014
Contest 2011
Contest 2009
Contest 2008
Kaleidoscope 1.1
Simple kaleidoscope. Just like with the original one, you can turn the display and the image changes instantly.

Code size:6352 Author:zjanosy
Source files included:yes Version:1.1
Use circleOS:yes (1.7) Creation date:2008-02-14 19:31:38
Hardware modification:no Modification date:2009-01-22 11:06:03
Based on the STM32 Primer:All
Downloads:2202 Views:23581
Average ratings:3.07/5 (926 rates)

Download: (153 KB)


Revision 1.1 by Raisonance :

Project source(s) were modified to ensure compatability with Primer2. The archive is updated with a Ride project adapted to Primer2. 
(Replace specific low level functions by standard API for LCD access).


This program creates symmetrical random images usually seen in the optical kaleidoscope. In the original kaleidoscope the arrangement of the mirrors creates a multiply reflected image, which has a special symmetry determined by the number and configuration of the mirrors. The most common kaleidoscope has 2 or 3 mirrors, arranged in 60 degrees relation to each other. This creates a double hexagonal symmetry, something like you see on the display of this electronic kaleidoscope.

The image is constructed of rotated and mirrored versions of a single triangle. The triangles are rasterized, and at the same time clipped to create a hexagonal symmetry. The resulting images are multiplied and shifted to simulate the infinite reflections of the mirrors.

The picture can be changed by slowly rotating/shaking the Primer. At each step a number of triangles are drawn on the screen. Their color, position and rotation are chosen randomly. The resulting image shows an infinite variety of symmetrical configurations.

The program contains several general purpose and reusable components. There is a 2D transformation engine for rotating and translating the triangles (includes an efficient fixpoint sin/cos implementation); a simple random number generator; an efficient span-based software triangle rasterizer which can be used either in a 2D or a 3D rendering engine; and a moving average filter for smoothing the MEMS data.