Identifying and Separating Straight and Curved Segments in a Curve

Hi all,

I’m working on a curve and trying to identify the straight and curved segments. Specifically, I’d like to “explode” the curve to separate its components.

Any suggestions?


Curve.gh (5.2 KB)

Thanks,
Franco

Have you tried the native GH component called discontinuity? That will solve your problem :slight_smile:

Yes, I did. It does not split all the segments.

I found a way extracting the data from the construction of the line back in the script but I was wondering if exist a component that does it instead to go back and forward in the script.

Thanks!

the way Discontinuity → Analytic finds very well-distributed discontinuity points reminds me of curves rebuilt using something like Divide Curve + Interpolate

if you filter the discontinuity pieces in Lines (white) and Arcs (green), just a few of those are recognized as such

Curve_Re.gh (17.8 KB)

checking the Control points drives me in the very same “interpolate on divide curve” direction :upside_down_face: which is a sort of destructive step for which there’s no way back?

Here is a tool that split a curve at at given curvature value. The lowest value, the more straight it is


It uses geometry to find the position at a given curvature threshold.
Curve (1) LD.gh (16.3 KB)

Or you can convert your curve to line and arcs (Nautilus plugin), take the lines and filters the arcs


Curve (1) LD2.gh (18.2 KB)

2 Likes

If you analyse the curvature graph of the inputs provided you can see that there is no lines in the two curves provided… that is the reason discontinuity component does not show you what you want

The only possibility is what @laurent_delrieu said, to apply a tolerance to get segments similar to lines