Formula to mesh two gears of arbitrary tooth count/position?
October 25, 2010 1:36 PM   Subscribe

I'm writing a graphics app where I'm generating a simple gear transmission system with a variable number of gears each with variable number of teeth and placed at random orbits around each other. I generate gears in succession, placing and rotating each with respect to its parent/driver gear before moving on to the next. The problem I'm having is how to determine the initial orientation of each subsequent gear such that its teeth are properly meshed with that of its driver.

What I have so far is as follows:

ang = Math.atan2( driver.position().x - gear.position.x, driver.position().y - gear.position.y );

angle = - (driver.angle() + ang) * driver.rootRadius() / gear.rootRadius()
+ Math.PI * ( 1 - 1 / gear.numTeeth() );

"Gear" is the gear for which I'm trying to find the initial orientation and "driver" is its parent. "RootRadius" is just the radius of the gear up to the root circle, the radius minus the teeth. And "numTeeth" is of course the number of teeth in said gear.

The first term is the driver's angle plus the angle of the gear's position wrt its driver multiplied by the gear ratio. The second term is pi minus the angle that subtends an arc which is one half of the tooth thickness measured at the pitch circle.

This works for ang = 0, meaning it works when I set the gears up in a straight line. When I try to put them at various orbits however they just don't mesh properly. I don't really understand why this doesn't work as it seems a simple enough problem. And hopefully the original question is clear if this subsequent explanation was confusing!
posted by Epsilon-minus semi moron to Science & Nature (6 answers total)
 
Can you not do something with changing the orientation of the subsequent gears by modifying the angle by (360degrees divided by number of teeth), or (360deg X Teeth)/2 to offset the second gear by either one or half a tooth?
posted by Brockles at 1:52 PM on October 25, 2010


Have I got the book for you!

"Mathematics meets Technology" by Brian Bolt. All about gear trains, and the mathematics behind why they work.
posted by MisterMo at 2:06 PM on October 25, 2010


Maybe you can glean what info you need from MisterMo's book recommendation via Google's limited preview.
posted by whatisish at 2:48 PM on October 25, 2010


Are you sure you're calculating the angle correctly? Remember that tan(ang) = Δy / Δx -- I think you have it the other way around.
posted by phliar at 3:55 PM on October 25, 2010


And don't forget that you need to check for Δx = 0.
posted by phliar at 3:56 PM on October 25, 2010


atan2 does take y,x for its arguments, but you don't need to check that Δx is not zero; atan2 does that for you.
posted by novalis_dt at 5:38 PM on October 25, 2010


« Older Oxymoronic Instructions   |   Did you find "Time-of-use" metering helpful? Newer »
This thread is closed to new comments.