**Raspberry Pi stacks collection #69 = Gears.livecode**

My goal was to make gears with polygons only. The animation is again a rotation of the polygons, no use of images. This is a mathematical "prototype" approach for the simplest case, it's much more complicated in mechanical engeneering (for a first good overview see https://en.wikipedia.org/wiki/Gear).

You can adjust (also while the animation is running)

- N = the num of teeth (2,4,6,8,12,16,24,48) for each of the three gears.

The radius is then set to keep the ratio radius/N = constant (here constant=10). - the "rotation speed" of millisecs per rotation-step (step is here 48/N degrees).

The average needed times per loop are

- On a Raspberry Pi 2: Around 35|65 ms on LC 6|LC 7,
- On a Raspi B: Around 135|255 ms on LC 6|LC 7.
- On a 2.5 GHz machine: Around 3|7 ms on LC 6|LC 7.

**( g*cos(t), g*sin(t) )**where t is the angle (

**t=degree*pi/180**)

**N2 = N/2**and

**g = 10*(N2 + tanh(N2*cos(N2*t)*sin(N2*t)))**]

Use it for fun, explore and change the (medium difficult) script.

*The stack runs on Mac/Win/Linux using LC 6-8, and on RaspberryPi using (the only available) LC 6.5.1 or 7.0.4*