Matched pairs and closest points

Hi,
I’m having some trouble getting the logic working properly on this project that is matching pairs of curves. Ideally, I would like the workflow to identify matched pairs of curves that are within a nominal distance from each other (100mm) and discard the rest. Ultimately I am going to elevate one set and loft between them. Usually the curves are overlapping, but this is not always the case (as you can see from the screen shots).

The first issue is that the two inputs will rarely have the same number of curves, which causes issues when looking for closest points. The first image below shows correct matching, while the second demonstrates a problem where there are two curves in setA that are matching to the same point in setB as they are both within 100mm. So I need to work out how to eliminate the match that is furthest away.

working

not working

Any help pointing me in the right direction would be great!

Thanks.
Pete

matched pairs.gh (19.6 KB)

Hope this helps…



matched pairs_RE.gh (31.3 KB)

1 Like

This sounds remarkably similar to a recent thread about a perforated “LobbyWall”:

Applied to your curves (after moving one set of curves some distance vertically), it looks like this:


matched pairs_2021May11a.gh (30.3 KB)

As you can see, three curve pairs have a common curve at one end… I haven’t figured out yet how to determine which of the two in each of these three pairs is shorter, which logically seems like the correct choice? Better than a manual length slider, eh?

Thanks for the help, it works a treat.
I couldn’t get my head around the sorting/dispatch logic that I needed - too much time looking at the same problem :slight_smile:
Also, the display setting that Human plugin generate are pretty nice. I hadn’t looked at it before.

thanks again
Pete

1 Like

Hi Joseph,
Thanks for the help. The lofting part of it was the easier bit - I was going to do this at the end so I could work out the proximity filter on the same plane.
The thing that I was really stuck on was the common curves problem that you identified. finding the shortest pair was how I was thinking about the problem too, but couldn’t get my head around it.
The wall screen example that you suggested was pretty interesting. It started with surfaces and then extracted the curves, which is the opposite to the way that my geometry works. Will take a deeper look at it and see how it goes.

thanks again

Only the last post in that thread started with holed surfaces. All the earlier models started with a list of hole curves that needed to be matched.

But in all cases, there was better correlation between the pairs, both in number and alignment, than what you have presented here.

Agreed, it had much better correlation with the pairs in the walled screen. I had worked out a system for ordering the curves based on their x position, but it didn’t deal with the different number of curves in each set.
This section of code is a small section of a larger workflow that detects defects in timber boards and generates a 3D representation. It uses images brightness to identify knot features in the timber board (front and back face) and then links them together. the different number curves originates from the fact that the knots don’t always go through the thickness of the board.