Fix Point#getDirectedAngle, which was measured the wrong way round, and could be optimised using Math.atan2().

This commit is contained in:
Jürg Lehni 2011-06-14 11:14:26 +01:00
parent 8d0bb3d2ae
commit 0cda1aa9dd

View file

@ -590,8 +590,7 @@ var Point = this.Point = Base.extend({
*/
getDirectedAngle: function(point) {
point = Point.read(arguments);
var angle = this.getAngle() - point.getAngle();
return angle < -180 ? angle + 360 : angle > 180 ? angle - 360 : angle;
return Math.atan2(this.cross(point), this.dot(point)) * 180 / Math.PI;
},
/**