Sg2.9
Gearwheels
Recent RSS
Gearwheels
From:  gencha
Date:  13. August 2008, 17:35

I was always missing the easy option to make simple gearwheels. So today i wrote a very simple implementation in Scriptographer.
Hopefully someone finds use for it as well ;)

Suggestions are welcome

http://fuqr.de/dump/gear.js

Re: Gearwheels
Date:  14. August 2008, 16:39

why dont you upload your script to the script-section?

Re: Gearwheels
From:  gencha
Date:  18. August 2008, 20:16

I didn't know i could do that until now ;)

Re: Gearwheels
From:  chris(login vergessen)
Date:  19. August 2008, 10:36

Nice, what do you think about that? :

var numTeeth = 15;
var radius = numTeeth*Math.PI/2;
var thinning = 0.2;
var depth = 5;
function onMouseDrag(event){
var pt=event.point;
var pos= pt.subtract(path.bounds.center);
path.transform(new Matrix().translate(pos));

}

Re: Gearwheels
Date:  19. August 2008, 19:19

I modified your script (with chris' addition) to make a gear drawing tool - the gears are rotated to make it possible for the gears to actually turn (i.e. they don't overlap).

The overlap finding is done brute force - must be possible to do it with pure geometry, but this is a very quick try out..

Let me know if it works for you - I'm using a newer prerelease version of Scriptographer..

Re: Gearwheels
From:  gencha
Date:  19. August 2008, 21:11

Neat :) I actually though about implementing that myself, but at the time the purpose of the script was just to create the outlines to later reuse them in a Flash animation.
Sadly in my version of ScriptoGrapher the gears are placed all over the place, not like in your screenshot.

But, if my assumptions are correct, you could just do something like this:

globalRotation += Math.PI * 2 / numTeeth;
gear.rotate( globalRotation );

Bot most likely that doesn't take the movement vector into account. If i could try with your version of ScriptoGrapher i could definitely fix up the code.

But it runs quite smooth right now anyway :) Good work :D

Re: Gearwheels
Date:  20. August 2008, 01:15

Okay thats happening because the old version of scripto rotates around the 0,0 position - I've put in a small workaround in the script which moves the gears back to the right position, it should work now..

your solution for the rotation doesn't work - would need something with the movement vector indeed..

Re: Gearwheels
Date:  20. August 2008, 15:02

a small update to better balance the fitting of the gear teeth

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Stroke <-> Fill 09.01.08