From 7404485f96ca7634f19abd633b621422bb3a6dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 12 Jun 2016 17:43:10 +0200 Subject: [PATCH] Simplify isInRange() check a bit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to check against ±180 as that condition will always be met. --- src/path/CurveLocation.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/path/CurveLocation.js b/src/path/CurveLocation.js index 1001b0df..9aa3fe3f 100644 --- a/src/path/CurveLocation.js +++ b/src/path/CurveLocation.js @@ -443,9 +443,9 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{ function isInRange(angle, min, max) { return min < max - ? angle > min && angle < max - // The range wraps around -180 / 180 degrees: - : angle > min && angle <= 180 || angle >= -180 && angle < max; + ? angle > min && angle < max + // min > max: the range wraps around -180 / 180 degrees + : angle > min || angle < max; } // Calculate angles for all four tangents at the intersection point, @@ -469,9 +469,9 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{ a2 = v2.getAngle(), a3 = v3.getAngle(), a4 = v4.getAngle(); - // Count how many times curve2 angles appear between the curve1 angles + // Count how many times curve2 angles appear between the curve1 angles. // If each pair of angles split the other two, then the edges cross. - // Use t*Inside to decide which angle pair to check against. + // Use t1Inside to decide which angle pair to check against. // If t1 is inside the curve, check against a3 & a4, othrwise a1 & a2. return !!(t1Inside ? (isInRange(a1, a3, a4) ^ isInRange(a2, a3, a4)) &&