This article has participated in the Denver Nuggets Creators Camp 3 “More Productive writing” track, see details: Digg project | creators Camp 3 ongoing, “write” personal impact.

Chestnut 5 — Gear

If we had kept the script from the previous example and enabled the Ellipse ruler in default, we would soon see that there was a problem:

Using this script, it is not so easy to get the teeth (or “gear”) aligned when we draw a closed circle. This is because the period parameter does not necessarily evenly divide the circumference of the circle. Fortunately, there is an easy way to solve this problem!

We can also use another predefined distance input variable: DN, which stands for normalized distance. If you look at the description in the script reference, you’ll see: Ellipse: Starts at 0.0 and each circle is +1.0 or -1.0. That’s good, because it means we don’t have to calculate the perimeter of the ellipse ourselves! Since the period of the wave function is designed to be 1, we can simply multiply dn by the number of teeth required for each cycle and pass this to the wave function. Here is the modified script:

offset = amplitude * sine(dn * teeth, thickness); 
ox = x + nx * offset; 
oy = y + ny * offset;
Copy the code

When you compile it, the period argument will be replaced with a new teeth argument. Set the range to [3..20] and make 0 the integer part of the argument. This will result in a perfectly aligned six-tooth gear:

You can find other scripts that work with the Ellipse ruler in the Circular Patterns section of the Mode list.

Chestnut 6 — Calligraphy

Next time

Chestnut 7 — Shake line

Next time

Chestnut 8 — City scenery

Next time

Chestnut 9 — Lightning

Next time

Chestnut 10 – Signal misidentification

Next time

Chestnut 11 — Debugging

Next time