Points Connection on Partially Overlapping Curve

Hi,
I’ve generated irregular random curves that overlap at a moment. I’d like to connect specific point of them with polylines.
On the screenshot for example connect 4 to 18, 3 to 19, 2 to 20 and 1 to 21.

Any suggestions ?

Thanks !

Do those curves overlap from top view?
By “connect” you mean creating a vertical line?
If both yes, you could extract all the points for curve A and curve B, then projecting all the points in XY plane, and for each point in list A finding the neares in list B, if the distance is less than “something” (hard to use =0 boolean) keep that point and draw a line.
For a better answer please upload your curves.

Hey, thank you for your answer !
Yes this is exactly the case here, they overlap from top view.
I understand what you mean but don’t have any idea how to do it on GH… i’m quite new.

Here is the file where you’ve got the curves, i added one because i’d like to do it with numerous curves if possible.
OverlapingCrv.3dm (3.0 MB)


OverlapingCrv.gh (9.3 KB)

This basically do:

  • get all the segments endpoint (you could also use “Discontinuity points” but result might be diffferent)
  • project to XY plane so we have alist with the same structure of 3d points, but flattened and projected to Z0
  • make another list without duplicate points
  • for each point in last list search for the 2 closest point from the complete (Z0) list, if the distance of BOTH points is smaller thant a given value, retrieve both points (from non-projected list) with dispatch.
  • draw the line
1 Like

Thanks ! but…
It looks like exactly what I want on your picture but it doens’t work as well when I run it on my computer. I’ve got lines that appears on the bottom :

Am I missing something ?

It also seems that my script doesn’t look exactly like yours, I’m missing the doted line you’ve got on your script. Is that a problem ?

Sorry I’ve mistaken the script you give me works perfectly !
The mass multiplication box wasn’t here when I opened the file, I added and its works !

Thank you very much !

You’re welcome.
For the wires, i suggest you to turn on “Draw Fancy Wires” in the “Display” tab.
Useful to distinguish between “single item”, “list of items” and “tree” types of data.

Ok I’ll change that !

I’m wondering now if there is a way to use the lines to draw a surface that connect the closed curves together ?

Like a loft or a sweep maybe ?

Loft.
OverlapingCrv_V2.gh (12.4 KB)

Code was almost the same, but beware, some of you curves intersect eachother; loft works anyway, but you’ll get strange result working with the geometry after this… probably.

Great !
Yes you’re right i’ll pay attention to those messy intersections

Thanks again