Multiple curves intersection from offset: remove stray segments

I have been tinkering with offsets and intersections for a while now. I realised I need something faster than combining closed regions and I need clean curves so neither of these work as a solution:

Basically, what I want is to get rid of these stray segments, manually crossed out in red.


I can fairly consistently filter these out by segment length, though I do need to preserve the horizontal segments to the right (short segments that are the result of other intersections):

There is one method to solve this problem: each curve that I need to remove is in between two sets of offset curves: the original offset and the offset curves that intersect. If i can test for midpoint inclusion of each curve to be within two sets of offsets, I can safely remove it.
The segments I need to keep are only on the original offset and are not inside a set of offsets.
So I was tinkering with Curve Side and Point in curve.


Remove offset intersected segments by midpoint.gh (34.8 KB)

This seems to do the trick, though I’m not sure yet whether the point oriented may flip in the wrong direction.
Remove offset intersected segments by midpoint.gh (34.8 KB)

Try this solution too.
Remove offset a.gh (10.6 KB)

if you are ok with transforming curves to polylines, Clipper/Clipper 2 is lightning fast

Remove offset intersected segments by midpoint_Clipper2.gh (16.4 KB)


in case this thing was not supposed to be joined:

Remove offset intersected segments by midpoint_unjoined_Clipper2.gh (22.0 KB)