Merge handling of self-intersection crossings with normal crossings.

Shorter code and no additional glitches.
This commit is contained in:
Jürg Lehni 2015-10-20 23:03:40 +02:00
parent 08122131dc
commit bcd6520e66

View file

@ -737,10 +737,10 @@ PathItem.inject(new function() {
// Just add the first segment and all segments that have no
// intersection.
drawSegment(seg, null, 'add', i, 'black');
} else if (!operator) { // Resolve self-intersections
drawSegment(seg, other, 'self-int', i, 'purple');
// Switch to the intersecting segment, as we need to
// resolving self-Intersections.
} else if (isValid(other)) {
// The other segment is part of the boolean result, and we
// are at crossing, switch over.
drawSegment(seg, other, 'cross', i, 'green');
seg = other;
} else if (inter.isOverlap() && operation !== 'intersect') {
// Switch to the overlapping intersecting segment if it is
@ -756,11 +756,6 @@ PathItem.inject(new function() {
// switch at each crossing.
drawSegment(seg, other, 'exclude-cross', i, 'green');
seg = other;
} else if (isValid(other)) {
// The other segment is part of the boolean result, and we
// are at crossing, switch over.
drawSegment(seg, other, 'cross', i, 'green');
seg = other;
} else {
// Keep on truckin'
drawSegment(seg, null, 'stay', i, 'blue');