Smooth closed curve automatically

Hello,
I have many closed curves with these kind of indent that I would like to remove/smooth it out. Is there a way to do it automatically in grasshopper without manually removing the vertex in Rhino? Maybe something based on distances and angles?

Curve_example.gh (2.4 KB)

Thanks in advance for any help,
Matteo

Exactly what does “smooth it out” mean? You’ll have more luck avoiding these “indents” in the first place rather than dealing with them after the fact.

Probably doing something wrong.

Curve_example Edited v0.gh (36.9 KB)

1 Like

You can measure the angle at each point and suppress point if angle is less that a threshold (22° here)


Polyline_suppress_pikes LD.gh (15.0 KB)

3 Likes

Great solution @laurent_delrieu !
Thank you so much for the quick and effective reply

Isn’t that just an in-built function of Kinky Curve anyhow?


Polyline_suppress_pikes vr.gh (23.9 KB)

180° - 22° = 158°


Edit:


Polyline_suppress_pikes vr3.gh (23.3 KB)

Unfortunately, Kinky Curve cannot create periodic curves, and Discontinuity recognizes endpoints as discontinuities. So, in order to recognize if a cusp exists at the start/endpoint, the curve has to be extended to overlap itself at that point and endpoints need to be culled from the discontinuity assessment.

This all makes the script loses its brevity and it the definition needs to be called recursively just as Laurents cluster. So just use his.

3 Likes

Very good catch, I never used Kinky curve, wording didn’t means a lot for me. Now it is a bit more clear.

I like your approach. Much more direct. You’d have to remember Kinky Curve exists.