Hello
I could use some help finding and splitting my polyline at the corners that are close to 90 degrees.
The curve has many small kinks, but I need the solution to ignore these.
Tried both using SplitAtCorners from Kangaroo and the solution presented in this topic but they both fail on my curve.
Can anybody help me with this?
My curve is attached:
Polyline_curve.3dm (26.0 KB)
SplitAtCorners is giving the expected result here - your curve does have lots of sharp corners, just with very short segments, and it is splitting at these.
To simplify the curve and collapse these short segments, you could use the topologizer component from here, then do the split.
simplifyCurve.gh (14.7 KB)
2 Likes
It took me a long time to realize that each of your “many small kinks” has two ~90 degree angles!!

When I finally figured that out, I culled duplicate points with a tolerance value of 1, high enough to average the two discontinuity points at each kink into a single point, then rebuilt the closed polyline.
At that point, the code in the white group worked as expected. It was quite baffling that it didn’t work on the original polyline. Very tricky. 
corners_2020May13a.gh (17.2 KB)
3 Likes
That solves the issue for me, I also didn’t realize that there were 90 angles all over there.
I have modified my definition to Include this, but I have another problem. I use this to make many curves along the outside of a mesh and I am most interested in the curves on either side of these meshes to make reinforcement for this structure.
I am able to get the interesting lines, however i want to process the lines from the two sides separately, but right now the lines are not grouped that way in my datatree, is there any way to make the lines on one side be grouped together?
I also welcome any suggestions to improve my solution apart from this.
Polylines_different_sides.gh (69.8 KB)
Are you looking for Flip Matrix?
Thank you for the suggestion, didn’t know a tool like this existed. I don’t really want to rely on many plugins for this, but this might come in handy later.
Indeed since it’s still a proper closed curve you can use the averaging trick Joseph showed here instead. For messier input curves where you have gaps/duplicates/overlaps the topologizer can be useful though.
simplifyCurve2.gh (14.2 KB)
1 Like
Flip matrix would give me the curves on either side, but there are other issues here (maybe from the generation of the lines?) that make the curves not all be on one side.
I don’t know how to make it generate the lines the same way.
flip_matrix.gh (69.5 KB)
I modified a copy of my G-sort cluster (included) to sort by Y instead of Z and to return the whole list instead of just the lowest or highest. Now called G-sortY.
Polylines_different_sides_2020May14a.gh (89.8 KB)
G-sortY cluster (below):
FWIW SplitAtAngles at least is included with Grasshopper natively (because Kangaroo is).
Thanks, that is exactly what i needed!
Really appreciate the help 