From 2b5e9296f793df37945c22e3a0d8335f363af729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 30 Apr 2011 23:05:31 +0100 Subject: [PATCH] Simplify Point#getDirectedAngle(). --- src/basic/Point.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/basic/Point.js b/src/basic/Point.js index a1e571e7..0a208935 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -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; }, /**