code: function angle(a, b) {
    var x1 = a[0],
        y1 = a[1],
        x2 = b[0],
        y2 = b[1];
  
    var len1 = x1 * x1 + y1 * y1;
    if (len1 > 0) {
      //TODO: evaluate use of glm_invsqrt here?
      len1 = 1 / Math.sqrt(len1);
    }
  
    var len2 = x2 * x2 + y2 * y2;
    if (len2 > 0) {
      //TODO: evaluate use of glm_invsqrt here?
      len2 = 1 / Math.sqrt(len2);
    }
  
    var cosine = (x1 * x2 + y1 * y2) * len1 * len2;
  
    if (cosine > 1.0) {
      return 0;
    } else if (cosine < -1.0) {
      return Math.PI;
    } else {
      return Math.acos(cosine);
    }
  }
docs: Get the angle between two 2D vectors
  @param {vec2} a The first operand
  @param {vec2} b The second operand
  @returns {Number} The angle in radians