Small World Engine API Reference - v0.46.1
    Preparing search index...

    Class GearMath

    Utility class for mechanical gear calculations based on DIN 780 (Module system). Ensures gears perfectly mesh with each other.

    Index

    Constructors

    Methods

    • Calculates the exact distance required between the centers of two meshing gears.

      Parameters

      • module: number

        The module of both gears.

      • teeth1: number

        Number of teeth of the first gear.

      • teeth2: number

        Number of teeth of the second gear.

      Returns number

      The exact distance between their centers.

    • Calculates the relative rotation speed (gear ratio) for a driven gear.

      Parameters

      • speed1: number

        The rotation speed of the driving gear.

      • teeth1: number

        The number of teeth of the driving gear.

      • teeth2: number

        The number of teeth of the driven gear.

      • internal: boolean = false

        Set to true if gear2 is an internal ring gear (rotation direction stays the same).

      Returns number

      The rotation speed of the driven gear.

    • Calculates all necessary physical parameters for a gear.

      Parameters

      • module: number

        The module (size of the teeth). Must be the same for all meshing gears.

      • teeth: number

        The number of teeth on the gear.

      Returns GearParameters

      GearParameters object containing values to feed into the Gear geometry.

    • Calculates the exact Z-rotation required for gear2 to perfectly interlock with gear1. Assumes both gears lie on the same XY plane and rotate around the Z axis.

      Parameters

      • pos1: Vector3D

        The position of the first gear.

      • rotZ1: number

        The current Z-rotation of the first gear (in radians).

      • params1: GearParameters

        The parameters of the first gear.

      • pos2: Vector3D

        The position of the second gear.

      • params2: GearParameters

        The parameters of the second gear.

      Returns number

      The required Z-rotation for gear2 (in radians).