What would be the best way to simplify these two curves into rectangles?

I’m using a workflow that takes floor plan imports, extracting their curves, getting offsets, and drawing lines from the original curve vertices to the offset curve vertices. These plans are generally orthagonal. I’m trying to automate this using Grasshopper.

However, sometimes the imports either have very slight protrusions that I would like to ignore (example A), or they have an extra control point that is offset from the curve by a very small distance, that creates an extra segment (Type B) and cannot be removed by SimplifyCrv. This means the offset often has a different number of vertices than the original.

For Type B, I am thinking I can somehow query each vertice to find out the angle between segments there, and delete it if it is 0<a<5 or 175<a<180, and then create a polyline using the leftover vertices, but i’m not sure how to do the first step.

Thank you in advance.

Indeed this is the way to cut the mustard. Very easy via code. Notify if you want an indicative demo (any valid open/closed - planar or not - polyline) in C#.

1 Like

that would be absolutely amazing

Not at all: very entry level code is required for that one.

Polyline_ClearColinearPoints_V1B.gh (125.5 KB)

BTW: this can’t deal with the general case (PolyCurves). Notify if you need to add some lines more (C 0/1/2 Continuity and the likes)… if Lewis can deliver in his home GP (forza Lewis).

Maybe with Polyline collapse and try Bounding box with plane input

2 Likes