vec2-fn
    Preparing search index...

    Function subtract

    • Subtract one vector from another.

      Type Parameters

      Parameters

      • target: T

        The target vector.

      • value: number | Vec2Param

        The vector to subtract.

      Returns T

      • A reference to the modified target vector.

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

      subtract({ x: 1, y: 1 }, { x: 1, y: 1 }); // -> { x: 0, y: 0 }
      
    • Subtract one vector from another.

      Type Parameters

      Parameters

      • target: Vec2Param

        The target vector.

      • value: number | Vec2Param

        The vector to subtract.

      • Optionaldest: D

        Destination object to store the result.

      Returns D

      • A reference to the modified destination vector.

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

      let result = { x: 0, y: 0 };
      subtract({ x: 1, y: 1 }, { x: 1, y: 1 }, result); // -> { x: 0, y: 0 }