To keep topics separated, opening this topic here for the suggestion to replace the lookup table (an indirection I found difficult to reason about) with straight forward booleans:
(1) first combine myFill and otherFill into a finalFill. (2)
switch (clipType)
{
case ClipType.Union:
finalAbove = above | otherAbove;
finalBelow = below | otherBelow;
break;
case ClipType.Intersection:
finalAbove = above & otherAbove;
finalBelow = below & otherBelow;
break;
case ClipType.Difference:
finalAbove = above & !otherAbove;
finalBelow = below & !otherBelow;
break;
case ClipType.DifferenceRev:
finalAbove = !above & otherAbove;
finalBelow = !below & otherBelow;
break;
case ClipType.Xor:
finalAbove = above ^ otherAbove;
finalBelow = below ^ otherBelow;
break;
}
(2) "Keep" is determined via XOR of finalAbove and finalBelow .
if (finalAbove ^ finalBelow)
{
result.Add(new Segment
{
p0_start = segment.p0_start,
p1_end = segment.p1_end,
above = finalAbove ? FillStatus.Filled : FillStatus.NotFilled,
below = finalBelow ? FillStatus.Filled : FillStatus.NotFilled,
otherAbove = FillStatus.Undefined,
otherBelow = FillStatus.Undefined,
});
}
Reference: https://github.com/Fribur/TextMeshDOTS/blob/fd85270dfe76f80597b4225ac1750665a4f59f9a/Polybool/SegmentSelector.cs#L7
To keep topics separated, opening this topic here for the suggestion to replace the lookup table (an indirection I found difficult to reason about) with straight forward booleans:
(1) first combine myFill and otherFill into a finalFill. (2)
(2) "Keep" is determined via XOR of finalAbove and finalBelow .
Reference: https://github.com/Fribur/TextMeshDOTS/blob/fd85270dfe76f80597b4225ac1750665a4f59f9a/Polybool/SegmentSelector.cs#L7