Use variable names that better reflec functionality and original naming.

This commit is contained in:
Jürg Lehni 2013-05-04 09:58:46 -07:00
parent f58f58e406
commit 86a26db2a2

View file

@ -114,9 +114,9 @@ PathItem.inject(new function() {
// // TODO: Don't we need to clear up and remove path1 & path2 again? // // TODO: Don't we need to clear up and remove path1 & path2 again?
// return _cache.intersections = intersections; // return _cache.intersections = intersections;
// } // }
// Now split intersections on both curves, by asking the first call to // Now split intersections on both paths, by asking the first call to
// collect the 'other' intersections for us and passing that on to the // collect the intersections on the other path for us and passing the
// second call. // result of that on to the second call.
splitPath(splitPath(intersections, true)); splitPath(splitPath(intersections, true));
// Do operator specific calculations before we begin // Do operator specific calculations before we begin
if (subtract) { if (subtract) {
@ -160,22 +160,23 @@ PathItem.inject(new function() {
continue; continue;
var path = new Path(), var path = new Path(),
loc = segment._intersection, loc = segment._intersection,
last = loc && loc.getSegment(true); intersection = loc && loc.getSegment(true);
if (segment.getPrevious()._invalid) if (segment.getPrevious()._invalid)
segment.setHandleIn(last ? last._handleIn : Point.create(0, 0)); segment.setHandleIn(intersection ? intersection._handleIn
: Point.create(0, 0));
do { do {
segment._visited = true; segment._visited = true;
if (segment._invalid && segment._intersection) { if (segment._invalid && segment._intersection) {
var other = segment._intersection.getSegment(true); var inter = segment._intersection.getSegment(true);
path.add(new Segment(segment._point, segment._handleIn, path.add(new Segment(segment._point, segment._handleIn,
other._handleOut)); inter._handleOut));
other._visited = true; inter._visited = true;
segment = other; segment = inter;
} else { } else {
path.add(segment.clone()); path.add(segment.clone());
} }
segment = segment.getNext(); segment = segment.getNext();
} while (segment && !segment._visited && segment !== last); } while (segment && !segment._visited && segment !== intersection);
// Avoid stray segments and incomplete paths // Avoid stray segments and incomplete paths
if (path._segments.length > 2) { if (path._segments.length > 2) {
path.setClosed(true); path.setClosed(true);