selfSplit

Finds the self-intersections (and self-touching vertices) of r and splits it at those points.

This is the single-region analogue of split: that function pushes each operand's curves into its own queue and compares the two queues against each other, which -- when both operands are the same region (as removeSelfIntersections needs) -- means every curve is queued twice and every pair ends up compared twice over. Here a single queue is swept instead, and each newly-opened curve is compared only against the others already active (skipping itself), so every pair of curves is compared exactly once.

Since the result only ever stands in for both operands of a self-union, the resolved region is built once and reused for both SplitResult.a and SplitResult.b.