From 4c61153bd4602add6cf8fd5621954b47e84cba2b Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 20 Jul 2016 16:32:20 +0200 Subject: [PATCH] Improve fat line clipping to fix #1088 Only alternate curves in addCurveIntersections() if interval on other curve is not tight enough yet. --- src/path/Curve.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index de49a176..defbfe1e 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -1709,9 +1709,15 @@ new function() { // Scope for intersection using bezier fat-line clipping u, uMax, tMinNew, tMaxNew, !flip, recursion, calls); } } else { // Iterate - calls = addCurveIntersections( - v2, v1, c2, c1, locations, param, + if (uMax - uMin >= /*#=*/Numerical.CLIPPING_EPSILON) { + calls = addCurveIntersections(v2, v1, c2, c1, locations, param, uMin, uMax, tMinNew, tMaxNew, !flip, recursion, calls); + } else { + // The interval on the other curve is already tight enough, + // therefore we keep iterating on the same curve. + calls = addCurveIntersections(v1, v2, c1, c2, locations, param, + tMinNew, tMaxNew, uMin, uMax, flip, recursion, calls); + } } } return calls;