Revert "Remove special handling of winding contribution on overlaps"

This reverts commit c6a38589e9.
The special handling seems to be still necessary in some edge cases, e.g. in BooleanOperations.html
This commit is contained in:
Jürg Lehni 2015-09-18 21:10:58 +02:00
parent 10eafccd1a
commit 8cf562c57b

View file

@ -415,7 +415,26 @@ PathItem.inject(new function() {
// Assign the average winding to the entire curve chain.
var winding = Math.round(windingSum / 3);
for (var j = chain.length - 1; j >= 0; j--) {
chain[j].segment._winding = winding;
var seg = chain[j].segment,
inter = seg._intersection,
wind = winding;
// We need to handle the edge cases of overlapping curves
// differently based on the type of operation, and adjust the
// winding number accordingly:
if (inter && inter._overlap) {
switch (operation) {
case 'unite':
if (wind === 1)
wind = 2;
break;
case 'intersect':
if (wind === 2)
wind = 1;
break;
}
}
seg._originalWinding = winding;
seg._winding = wind;
}
}
@ -532,7 +551,7 @@ PathItem.inject(new function() {
&& /^(unite|subtract)$/.test(operation)) {
// Switch to the overlapping intersecting segment if it is
// part of the boolean result.
if (operator(other._winding)) {
if (operator(other._originalWinding)) {
drawSegment(seg, 'overlap-cross', i, 'orange');
seg = other;
} else {