From 197aa4b4cfcac5fedfbaa0cbf9693e30f35cc74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 16 Sep 2015 02:56:24 +0200 Subject: [PATCH] No need to wrap angles as they're always -PI < a < PI. --- src/path/CurveLocation.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/path/CurveLocation.js b/src/path/CurveLocation.js index a6c9d655..df84267e 100644 --- a/src/path/CurveLocation.js +++ b/src/path/CurveLocation.js @@ -328,11 +328,6 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{ console.log(c1.getValues(), c2.getValues(), c3.getValues(), c4.getValues()); } - function getAngle(tangent) { - var a = tangent.getAngleInRadians(); - return a < -PI ? a + PI_2 : a >= PI ? a - PI_2 : a; - } - function isInRange(angle, min, max) { return min < max ? angle > min && angle < max @@ -341,10 +336,10 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{ } // Calculate angles for all four tangents at the intersection point - var a1 = getAngle(c1.getTangentAt(tMax, true).negate()), - a2 = getAngle(c2.getTangentAt(tMin, true)), - a3 = getAngle(c3.getTangentAt(tMax, true).negate()), - a4 = getAngle(c4.getTangentAt(tMin, true)); + var a1 = c1.getTangentAt(tMax, true).negate().getAngleInRadians(), + a2 = c2.getTangentAt(tMin, true).getAngleInRadians(), + a3 = c3.getTangentAt(tMax, true).negate().getAngleInRadians(), + a4 = c4.getTangentAt(tMin, true).getAngleInRadians(); // Count how many times curve2 angles appear between the curve1 angles // If each pair of angles split the other two, then the edges cross.