Reduce closed polyline to remove stems

I am trying to take a closed polyline with some thin “stems” and simplify it into rectilinear regions. Best understood as the attached image with the polylines represented as surfaces: the imagined result would have a coarseness parameter to control how sparse the resulting polylines are.
My first crack at starting this was to make a bounding rectangle around the surface, fill it with points, then check for containment. Afterward, presumably, you could build your regions approximately from the points. But I suspect there is a nicer way to do this, maybe with a graph representation and using python or csharp?


reduction-example.gh (18.1 KB)
surface-reduction.3dm (134.4 KB)

Hi!
Maybe an offset is exactly what you need.
Making an internal offset wider than (half of) the small peninsulas/stripes/bridges you want to remove will make them become “negative”, and so you can remove them.
Usually in rhino the offset command, when the offset “split” a shape two or more, it will do the offset only for one of the areas, depending of where you click with the cursor.
By doing “offset loose” you’ll get everything. (red)
Then I’ve fragmented the result and kept only the segments that are at the correct distance from the starting curve.
(In each step I did some “cleaning” to make it work)
Then offset back to original size. (green)
offset
reduction-example_re.gh (21.1 KB)

You can get “result 1” or “result 2” by using a proper offset value.

Surely it can be done in c# or else, as always… this is just an idea… maybe you’ll have to test and refine it…

Cya!

3 Likes