Simplify Point#getDirectedAngle().

This commit is contained in:
Jürg Lehni 2011-04-30 23:05:31 +01:00
parent ab634f2391
commit 2b5e9296f7

View file

@ -273,13 +273,7 @@ var Point = this.Point = Base.extend({
getDirectedAngle: function(point) {
point = Point.read(arguments);
var angle = this.getAngle() - point.getAngle();
var bounds = 180;
if (angle < - bounds) {
return angle + bounds * 2;
} else if (angle > bounds) {
return angle - bounds * 2;
}
return angle;
return angle < -180 ? angle + 360 : angle > 180 ? angle - 360 : angle;
},
/**