Smartest way to group touching polylines

I’m trying to figure out a way to group lines or polylines that intersect in Y and X shapes. the method I was attempting was by retrieving control points and doing a set intersection. this path kind of died when I realised that the intersection component is limited to two sets.
Ideas?

Post geometry.

GroupingConnectedLines.gh (8.6 KB)

I don´t really get the X and Y logic in this definition. But if your initial issue was the intersections, here is a solution. You should get rid of any lines which are on top of each other, though.

GroupingConnectedLines.gh (30.0 KB)

It kind of looks like some sort of a satanic ritual to me :smiley:

1 Like

What you are looking for is a classic Ccx clustering. See attached.

Clusters_CCX_Curves_EntryLevel_V1.3dm (71.1 KB)
Clusters_CCX_Curves_EntryLevel_V1.gh (118.0 KB)

2 Likes

:smiling_imp: :japanese_ogre: :smiling_imp:

1 Like

Did this do the trick for you btw?
And Pfotiad0 is usually right so maybe try his method.

1 Like

Thanks Peter, that’s exactly what I was after!
it works perfectly with la flattened input but it doesn’t seem to support operations in multiple branches.
Not a dig deal, I can work around that.

1 Like

Well … I can easily add DataTree support (it’s an Entry Level C# after all): thus the conn would become a 2 dimension tree: branch, cluster.

BTW: I have various other builds as well that do more things like ccx events connectivity: via a 4 dimension tree : branch, cluster, crvA, crvB. Notify is you need that type of stuff.

I’m not entirely sure what you mean by 2+ dimensional data trees.
3 being {A;B;C}?

Well … imagine that we have ccx events and we want a ccxConn tree for these. If we have curve branches (i.e. DataTree support) meaning a cTree instead of cList (I’ll do that ASAP) and we have clusters (per branch) and we have curve A and curve B … then the path in the ccxConn tree would be {branch;cluster;curvAIndex; curvBIndex} (indices point to a ccxList of type Point3d that holds all the ccx Points),

See the most compact (NO cluster respect) ccxConn tree (in some other C# build than the one that you have). If I add DataTree support the max dimensions would be obviously 4.

And the explicit option:

1 Like

Get the DataTree support. Have in mind that demo is using the branch var to access cTree branches (meaning that you should use a single dimension policy in your cTree - if not … er … I need to add a line or two more).

Clusters_CCX_Curves_EntryLevel_V1A.3dm (67.0 KB)
Clusters_CCX_Curves_EntryLevel_V1A.gh (124.8 KB)

Note: Obviously you get a 2 dimension conn tree: {branch; cluster}

BTW: V1B (no R file required) does a more challenging dynamic random demo (but in general and having high performance (and big N of curves) in mind one requires various other ways [one is using RTrees] to cut the mustard fast with regard ccx clustering matters).

Clusters_CCX_Curves_EntryLevel_V1B.gh (125.0 KB)

1 Like