Regions from self-intersecting polyline

Hello GH community!

I have a fairly intricate GH definition which outputs one self-intersecting polyline (I didn’t upload the *.gh file because it is needlessly complex for this particular question). What I need to do is retrieve alternating regions from this polyline as per the image below.
Is there a quick and clean solution for defining the regions and sorting/culling them in a checkerboard pattern?
One side note: usually my original polyline has up to 5000 segments.

Rhino file:
question.3dm (118.9 KB)

Thanks

Hello
You could look at that

Hi @laurent_delrieu looks like your C# magic works perfectly!
The only thing that I’ve changed was using the colorIndex output as a culling pattern.
Thank you!