angles.js
function(a, b, p, dir) {

      var s = this['SCALE'];
      a = mod(a, s);
      b = mod(b, s);

      if (a === b)
        return a;

      // dir becomes an offset if we have to add a full revolution (=scale)
      if (!dir)
        dir =-s;
      else if ((dir === 1) === (a < b))
        dir*= s;
      else
        dir = 0;

      return mod(a + p * (b - a - dir), s);
    }
function(a, b, p, dir) {

      var s = this['SCALE'];
      a = mod(a, s);
      b = mod(b, s);

      if (a === b)
        return a;

      // dir becomes an offset if we have to add a full revolution (=scale)
      if (!dir)
        dir =-s;
      else if ((dir === 1) === (a < b))
        dir*= s;
      else
        dir = 0;

      return mod(a + p * (b - a - dir), s);
    }
function ( a , b , p , dir ) { var s = this [ 'SCALE' ] ; a = mod ( a , s ) ; b = mod ( b , s ) ; if ( a === b ) return a ; // dir becomes an offset if we have to add a full revolution (=scale) if ( ! dir ) dir = - s ; else if ( ( dir === 1 ) === ( a < b ) ) dir *= s ; else dir = 0 ; return mod ( a + p * ( b - a - dir ) , s ) ; }
Calculates the linear interpolation of two angles

@param {number} a Angle one
@param {number} b Angle two
@param {number} p Percentage
@param {number} dir Direction (either 1 [=CW] or -1 [=CCW])
@returns {number}
Calculates the linear interpolation of two angles