vec2-fn
    Preparing search index...

    Function negate

    • Negate a vector.

      Type Parameters

      Parameters

      • target: T

        The target vector.

      Returns T

      • A reference to the modified target vector.

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

      negate({ x: 1, y: -2 }); // -> { x: -1, y: 2 }
      
    • Negate a vector.

      Type Parameters

      Parameters

      • target: Vec2Param

        The target vector.

      • dest: 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.

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