Join curves by angle

Case 1 Lines:
I have touching lines, I like to join them into polylines but stop at large angles.
So in the below case, I want the red lines to become one polyline, and the yellow and green lines to become others.

Case 2 Nurbs Curves:
Similar to case 1, but it is Nurbs in this case.
Is it possible to determine the angle between touching Nurbs?

Thank you very much!

Join curves by angle(No Plugin inside).gh (15.7 KB)

Hi @Quan_Li,

Two possible methods attached here, comparing the angle of the neighboring segments to get discontinuity within angular tolerance and, secondly, exploiting the offset curve component to detect “hard edges”.

Model Space:

Graph Space (Exploitation Of Offset Curve):

Graph Space (Angular Tolerance):

Hope this helps,

Cheers!

20230719_Join curves by angle(No Plugin inside)_Response_01a.gh (31.3 KB)

1 Like

SplitAtCorners should be enough, but your polyline has some overlapping vertices,
fix it and it should work.
@DanielPiker the split part shouldn’t work with open polylines too?


Join curves by angle(No Plugin inside).gh (16.1 KB)

1 Like

@ThomasE Nice! I had no idea about that component, I haven’t messed around with Kangaroo much.

Probably an easier way but here’s a one method to handle the duplicate points in the polylines:

Graph Space:

Cluster Space:

Model Space:

20230719_Join curves by angle(No Plugin inside)_Response_01d.gh (21.6 KB)

And seperately:

I realize this is outside the scope of what was provided in the input curves but I can’t seem to get the Split At Corners method working with a list of non-planar curves/mix of polylines and nurbs curves, but even though my original method is longer, it does appear to handle this use case as well. Just sharing for what it’s worth.

Here’s a test file with conditions breaking the logic & the updated cluster that solves for all tested conditions (with the caveat of using many more components):

Graph Space:

Cluster Space:

Model Space:

20230719_Join curves by angle(No Plugin inside)_Response_01f.gh (26.9 KB)

3 Likes

Need time to digest, sorry for the late reply.
The Offset Curve move is really genius. I learned a lot from your definition. Thank you!

1 Like

I did not know there is this component in GH. This is really handy. Thank you!

I always glean a bunch of tricks from you @Quan_Li , happy to return help!