vec2-fn
    Preparing search index...

    Function angleTo

    • Calculate the angle in radians of the direction from the from vector to the to vector, measured from the positive x axis in the atan2 range of -π to π.

      Parameters

      • to: Vec2Param

        Vector to calculate to.

      • from: Vec2Param = ZERO

        Vector to calculate from. Defaults to ZERO.

      Returns number

      • Number angle result.
      angleTo({ x: 0, y: 1 }); // -> 1.5707963267948966 (Math.PI / 2)
      angleTo({ x: 2, y: 2 }, { x: 1, y: 1 }); // -> 0.7853981633974483 (Math.PI / 4)