I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
See the animated gif:
The biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);
for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint.
EDIT:
I am using radians for rotations and I think this is OK.
My main problem is that I want to achieve a perfect joint between teeth like this example. My teeth are overlapping in some odd way.
EDIT
a working example can be found here: http://www.openprocessing.org/sketch/83665