From 3564dafa93c148d15b3f545299007bdf7b962265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rg=20Lehni?= Date: Sun, 4 Jan 2015 13:23:59 +0100 Subject: [PATCH] Do not keep iterating if the curve was reduced to a point. --- src/path/Curve.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index fcb0d67b..7e28ddf3 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -1152,7 +1152,7 @@ new function() { // Scope for methods that require numerical integration curve1, t1, Curve.evaluate(v1, t1, 0), curve2, t2, Curve.evaluate(v2, t2, 0)); } - } else { // Iterate + } else if (tDiff > 0) { // Iterate addCurveIntersections(v2, v1, curve2, curve1, locations, include, uMin, uMax, tMinNew, tMaxNew, tDiff, !reverse, ++recursion); } @@ -1190,7 +1190,7 @@ new function() { // Scope for methods that require numerical integration var vx = l2x - l1x, vy = l2y - l1y; if (Numerical.isZero(vx)) - return vy >= 0 ? l1x - x : x - l1x; + return vy >= 0 ? l1x - x : x - l1x; var m = vy / vx, // slope b = l1y - m * l1x; // y offset // Distance to the linear equation