// depends on common.js: QQ
QQ.Math = function(){

  return {
  	// calculate angle between two objects by giving their x and y coordinate differences
  	getDegrees: function (x,y){
			var ratio =  y / Math.sqrt(x*x+y*y);
			var angle = (Math.asin(ratio)*180/Math.PI + 360) % 360;
		
			if(x >= 0 && y >= 0){
				angle = 90 - angle;
			}else if(x >= 0 && y <= 0){
				angle = 450 - angle;
			}else if(x <= 0 && y <= 0){
				angle -= 90;
			}else if(x <= 0 && y >= 0){
				angle += 270;
			}
			return angle;
		},
		round: function (num,precision){
			if (precision === undefined) precision = 0;
			var t = Math.pow(10,precision);
			return Math.ceil(num*t)/t;
		}
		
  };
}();
