ixfx
    Preparing search index...
    • Returns the angle in radians between a and b.

      Eg if a is the origin, and b is another point, in degrees one would get 0 to -180 when b was above a. -180 would be b in line with a. Same for under a.

      Providing a third point c gives the interior angle, where b is the middle point.

      See also angleRadianCircle which returns coordinates on 0..Math.Pi*2 range. This avoids negative numbers.

      Parameters

      Returns number

      const canvasEl = document.querySelector('canvas');
      const middle = { x: canvasEl.width/2, y: canvasEl.height /2 }

      canvasEl.addEventListener(`pointermove`, event => {
      const cursor = {
      x: event.offsetX,
      y: event.offsetY
      }
      const a = G.Points.angleRadian(middle, cursor);
      });