vec2-fn
    Preparing search index...

    Function divide

    • Divide two vectors.

      Type Parameters

      Parameters

      • target: T

        Target vector.

      • value: number | Vec2Param

        The vector to divide 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.

      divide({ x: 4, y: 2 }, 2); // -> { x: 2, y: 1 }
      
    • Divide two vectors.

      Type Parameters

      Parameters

      • target: Vec2Param

        Target vector.

      • value: number | Vec2Param

        The vector to divide 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 };
      divide({ x: 4, y: 2 }, 2, result); // result -> { x: 2, y: 1 }