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}
190326
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);
    }
1025369
public static final double angle(Atom a, Atom b){

		Vector3d va = new Vector3d(a.getCoordsAsPoint3d());
		Vector3d vb = new Vector3d(b.getCoordsAsPoint3d());

		return Math.toDegrees(va.angle(vb));

	}
1072072
function( ax, ay,
								   bx, by,
								   cx, cy,
								   px, py ) {

		  var aX, aY, bX, bY;
		  var cX, cY, apx, apy;
		  var bpx, bpy, cpx, cpy;
		  var cCROSSap, bCROSScp, aCROSSbp;

		  aX = cx - bx;  aY = cy - by;
		  bX = ax - cx;  bY = ay - cy;
		  cX = bx - ax;  cY = by - ay;
		  apx= px  -ax;  apy= py - ay;
		  bpx= px - bx;  bpy= py - by;
		  cpx= px - cx;  cpy= py - cy;

		  aCROSSbp = aX*bpy - aY*bpx;
		  cCROSSap = cX*apy - cY*apx;
		  bCROSScp = bX*cpy - bY*cpx;

		  return ( (aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0) );

	}
440093
def pmag_angle(D1,D2): # use this 
    
    D1 = numpy.array(D1)
    if len(D1.shape) > 1:
        D1 = D1[:,0:2] # strip off intensity
    else: D1 = D1[:2]
    D2 = numpy.array(D2)
    if len(D2.shape) > 1:
        D2 = D2[:,0:2] # strip off intensity
    else: D2 = D2[:2]
    X1 = dir2cart(D1) # convert to cartesian from polar
    X2 = dir2cart(D2)
    angles = [] # set up a list for angles
    for k in range(X1.shape[0]): # single vector
        angle = numpy.arccos(numpy.dot(X1[k],X2[k]))*180./numpy.pi # take the dot product
        angle = angle%360.
        angles.append(angle)
    return numpy.array(angles)
301566
def _opbend_angle_low(a, b, c, deriv=0):
    """"""
    result = _opbend_cos_low(a, b, c, deriv)
    sign = np.sign(np.linalg.det([a, b, c]))
    return _cos_to_angle(result, deriv, sign)
946904
function(i, a, d) {

      this.index = i;
      this.angle = a;
      this.distance = d;
   
      this.compare = function(p) {
         if (this.angle<p.angle)
            return -1;
         else if (this.angle>p.angle)
            return 1;
         else {
            if (this.distance<p.distance)
               return -1;
            else if (this.distance>p.distance)
               return 1;
         }
         return 0;
      }
   }
1189926
function getDirection(coord1, coord2) {
  if (Math.abs(coord1.x - coord2.x) >= Math.abs(coord1.y - coord2.y)) {
    return getTheDirection(
      coord1.x, coord2.x, Direction.LEFT,
      Direction.RIGHT, Direction.NONE,
    );
  }

  return getTheDirection(
    coord1.y, coord2.y, Direction.UP,
    Direction.DOWN, Direction.NONE,
  );
}
454995
function(n, a, b) { // Check if an angle n is between a and b

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

      if (a < b)
        return a <= n && n <= b;
      // return 0 <= n && n <= b || a <= n && n < 360;
      return a <= n || n <= b;
    }
198019
double interpolateAngle(int index0, int index1, int index2, double offset) {
		double angle1 = Math.atan2(histogramY[index1],histogramX[index1]);
		double deltaAngle;
		if( offset < 0 ) {
			double angle0 = Math.atan2(histogramY[index0],histogramX[index0]);
			deltaAngle = UtilAngle.dist(angle0,angle1);

		} else {
			double angle2 = Math.atan2(histogramY[index2], histogramX[index2]);
			deltaAngle = UtilAngle.dist(angle2,angle1);
		}
		return UtilAngle.bound(angle1 + deltaAngle*offset);
	}
1198984
def get_angle_difference(v1, v2):
    """"""
    v1 = numpy.array(v1)
    v2 = numpy.array(v2)
    angle=numpy.arccos(old_div((numpy.dot(v1, v2) ), (numpy.sqrt(math.fsum(v1**2)) * numpy.sqrt(math.fsum(v2**2)))))    
    return math.degrees(angle)
574565
function getDirectionChange(angle1, angle2) {

        var directionChange = Math.abs(angle1 - angle2);
        return (directionChange > 180) ? (360 - directionChange) : directionChange;
    }
1105537
function angleTo(e) {
         var a = this.getBounds();
         var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
         // we have to use here the center of both entities

         var ax = b.pos.x + b.width / 2 - (a.pos.x + a.width / 2);
         var ay = b.pos.y + b.height / 2 - (a.pos.y + a.height / 2);
         return Math.atan2(ay, ax);
       }
612603
function lerpW(a, wa, b, wb) {
  var d = wb - wa
  var t = -wa / d
  if(t < 0.0) {
    t = 0.0
  } else if(t > 1.0) {
    t = 1.0
  }
  var ti = 1.0 - t
  var n = a.length
  var r = new Array(n)
  for(var i=0; i<n; ++i) {
    r[i] = t * a[i] + ti * b[i]
  }
  return r
}
189131
function getSqDist(p1, p2) {

    var dx = p1.x - p2.x,
        dy = p1.y - p2.y;

    return dx * dx + dy * dy;
}
963842
function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) {
		return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x);
	}
509697
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy)
{
    var v0x = cx-ax;
    var v0y = cy-ay;
    var v1x = bx-ax;
    var v1y = by-ay;
    var v2x = px-ax;
    var v2y = py-ay;

    var dot00 = v0x*v0x+v0y*v0y;
    var dot01 = v0x*v1x+v0y*v1y;
    var dot02 = v0x*v2x+v0y*v2y;
    var dot11 = v1x*v1x+v1y*v1y;
    var dot12 = v1x*v2x+v1y*v2y;

    var invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
    var u = (dot11 * dot02 - dot01 * dot12) * invDenom;
    var v = (dot00 * dot12 - dot01 * dot02) * invDenom;

    // Check if point is in triangle
    return (u >= 0) && (v >= 0) && (u + v < 1);
}
22231
function getAngle(p1, p2, props) {
  if (!props) {
    props = PROPS_XY;
  }
  var x = p2[props[0]] - p1[props[0]];
  var y = p2[props[1]] - p1[props[1]];
  return Math.atan2(y, x) * 180 / Math.PI;
}