capsOf function
outline's two caps kept apart (spec 08 D7), in world space: the end
cap, from the wall's right face to its left face, and the start cap,
from its left face to its right face — [...endCap, ...startCap] is
outline's ring before it is simplified. When that ring is not simple
and anticlockwise, both caps are the free caps and fellBack is true,
as outline's fallback. Null for a degenerate wall (07 D2).
Implementation
({List<Vector2> endCap, List<Vector2> startCap, bool fellBack})? capsOf(
WorldWall w, List<WorldWall> others) {
if (w.degenerate) return null;
final ce = cap(End(w, 1), classify(w, 1, others)).points;
final cs = cap(End(w, 0), classify(w, 0, others)).points;
if (!isSimpleCcw(simplifyRing([...ce, ...cs]))) {
return (
endCap: cap(End(w, 1), const Free()).points,
startCap: cap(End(w, 0), const Free()).points,
fellBack: true,
);
}
return (endCap: ce, startCap: cs, fellBack: false);
}