@rulecad/gears 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/gears.mjs +4 -2
  2. package/package.json +1 -1
package/gears.mjs CHANGED
@@ -462,8 +462,10 @@ export function phase(a, b, angle = 0) {
462
462
  */
463
463
  export function rackPhase(pinion, at = 0) {
464
464
  const r = pinion.pitch / 2, p = Math.PI * pinion.module;
465
- // at angle −90° the pinion's first tooth points down at the rack, and must sit over a space (spaces at x = kp)
466
- const s = at - r * (Math.PI / 2);
465
+ // at angle −90° the pinion's first tooth points down at the rack, and must sit over a space (spaces at x = kp): the
466
+ // travel there, r (−π/2) + phase, is at, so the phase is at + r π/2. (With the sign the other way the rack sat half a
467
+ // tooth out for an odd number of teeth, and right for an even one, where the error is whole pitches.)
468
+ const s = at + r * (Math.PI / 2);
467
469
  return ((s % p) + p) % p;
468
470
  }
469
471
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/gears",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Gears for printed parts: involute spur gears, racks and ring gears drawn from their rules, with their numbers, how a pair meshes (centre distance, ratio, contact ratio, phase) and how they print.",
5
5
  "type": "module",
6
6
  "exports": {