settinger / pygear

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pygear

Let's make gears that look like whatever we want!

NOTA BENE: this is a gear maker based on the video "How to make Organically-Shaped Gears" by Clayton Boyer. This approach is not suited to gears that drastically change their gear ratios, for example nautilus gears.

Gear Demos: one success, one failure

Dependencies

Requires numpy and PIL. Written in Python 2.7.

Operation

Run main.py and select your input gear shape. The program assumes the center of the image is the center of the gear. After some calculation time, the program will prompt you to save your output gear as an image file. It will then prompt you to save a "crossbar" image. So, for an input that looks like this:

...you'll get two outputs:

If you want to change the gear generation parameters, edit the following variables at the start of main.py:

  • gearRatio is the gear ratio. For example, a ratio of 2 means the input gear completes two rotations in the time it takes the output gear to complete one rotation. Right now, this has to be an integer value.
  • gearOverlap controls how close the gears' axes are. It should be between 0.0 and 1.0. I'd say 1.0 is a good value to start with.
  • computationSteps is the number of steps in the image processing process. Too few steps and you'll be left with lots of speckles and noise outside output gear perimeter. Too many steps and you'll waste computer time without seeing much of an effect. 1000 is a good value to start with.

TODO:

  • Set up animation (there is an aborted attempt in the file animate.py)
  • Make a GUI (probably in someting other than python?)

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%