vec2-fn
    Preparing search index...

    Function modo

    • Apply a floored modulo to the target vector, so results take the sign of the modulo value rather than the target.

      Type Parameters

      Parameters

      • target: T

        Target vector.

      • value: number | Vec2Param

        The value to modo by.

      Returns T

      • A reference to the modified target object.

      Error - When a component of value is zero.

      Error - When a computed component is NaN or non-finite.

      modo({ x: 5, y: -5 }, 3); // -> { x: 2, y: 1 }
      
    • Apply a floored modulo to the target vector, so results take the sign of the modulo value rather than the target.

      Type Parameters

      Parameters

      • target: Vec2Param

        Target vector.

      • value: number | Vec2Param

        The value to modo by.

      • dest: D

        Destination object to store the result.

      Returns D

      • A reference to the modified destination object.

      Error - When a component of value is zero.

      Error - When a computed component is NaN or non-finite.

      const result = { x: 0, y: 0 };
      modo({ x: 5, y: -5 }, 3, result); // result -> { x: 2, y: 1 }