Cornell University has a beautiful if unfinished kinematics website focusing on gears, here. Be sure to click on Segment 2: Models. You will see cool things.
Such as a triangular gear rotating inside a square, and more goodness.
The mathematics of gears came out in the 14th to 17th centuries, and is old. But with modern computational power and new stronger materials, gear science marches on.