From 1239eb55ec0c732e768f6f44a87dd73ce20fde60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rg=20Lehni?= Date: Sun, 4 Jan 2015 17:47:41 +0100 Subject: [PATCH] Minor clean up in Curve.filterIntersections(). --- src/path/Curve.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index 09924a9c..a5a649f5 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -1408,11 +1408,11 @@ new function() { // Scope for methods that require numerical integration }, filterIntersections: function(locations, _expand) { - var max = locations.length - 1, + var last = locations.length - 1, tMax = 1 - /*#=*/Numerical.TOLERANCE; // Merge intersections very close to the end of a curve to the // beginning of the next curve. - for (var i = max; i >= 0; i--) { + for (var i = last; i >= 0; i--) { var loc = locations[i], next = loc._curve.getNext(), next2 = loc._curve2.getNext(); @@ -1439,18 +1439,18 @@ new function() { // Scope for methods that require numerical integration : path1._id - path2._id; } - if (max > 0) { + if (last > 0) { locations.sort(compare); - // Filter out duplicate locations - for (var i = max; i >= 1; i--) { - if (locations[i].equals(locations[i === 0 ? max : i - 1])) { + // Filter out duplicate locations. + for (var i = last; i > 0; i--) { + if (locations[i].equals(locations[i - 1])) { locations.splice(i, 1); - max--; + last--; } } } if (_expand) { - for (var i = max; i >= 0; i--) + for (var i = last; i >= 0; i--) locations.push(locations[i].getIntersection()); locations.sort(compare); }