# Sort parts based on intersection size

Hello,
I am struggling to organize some parts based on ‘how much’ they intersect with other geometry.

Summary for simplicity:
I have these ‘grapple’-like gussets (triangles marked yellow) near the the corners of a 3D puzzle:

Sometimes the triangles intersect more than one facet at a time, as in ‘grabbing’ the corner, marked here:

Given the case, the intersection ‘amount’ per triangle is larger relative to a facet versus the others - as I now mark below, where a single triangle meets two facets but with the area marked green intersecting a facet more than the area marked red intersecting the adjacent facet:

What this means is that this triangle would be ‘matched’ to the facet it intersects the most:

And same goes for the other triangles that also intersect that same facet the most:

(pardon the ugly sketch)

Hoping that explains it well enough - where I need your help is on how to sort said triangles according to the facet they intersect with the most. How would you go about it?
*One thought is going ‘by plane’ (facet plane) using an endpoint at one edge of each triangle gusset.

I’m attaching a simplified part of the file:
buckypuzzle.gh (227.0 KB)

Thank you in advance for taking a look.

not sure I have understood the problem correctly… what I got is to identify which triangle belongs to which facet, considering that for a triangle to belong to a facet its longest bottom-edge should lie on the facet itself (so we can just plainly ignore its shortest in case a triangle has more than one bottom edge)

if that is right, I would do something like this, I believe the only external component is `create tree` from elefront… but anything that creates branches based on a list of integers to indicate which branch the items should be assigned to should work?

buckypuzzle_Re.gh (235.0 KB)

it measures the closest distance-point between the center point of the longest bottom-edge of each triangle, and each facet, so for each triangle you get a list of distances among which only ones says 0 (well… it says “very little” )
then with item index you retrieve the index of that distance (which is equal to the index of the facet it belongs to) and assign each triangle to that branch

1 Like

Thank you @inno ! I will check this asap - visually I think you did exactly what I am after. Very grateful - I’ll let you know soon.

1 Like

Ok @inno, thank you once more - you’ve taught me some tricks lately and I’m grateful! I have checked what you’ve done and it is what I was after.

Right, I couldn’t have worded it like you did, thank you - I’m curious about this and now I must go through the {new} challenge of figuring it out without elefront (nothing against the plug-in, just need to make sure I achieve it natively as well). A quick first look into things points at using ReplacePaths, smilar to what’s discussed here I think?

1 Like

yes, 100% on spot

buckypuzzle_Re_ReplacePaths.gh (232.8 KB)

1 Like

You beat me to it!

Let me know where I can send you money for a beer or a coffee!

Especially for making you work as I’ve taken another approach! I wish I could give you multiple ‘solution’ checkmarks still for your work and teachings.

Long story short:

Studying the system made me realize a more effective way to order these parts based on which direction they face as opposed to how much they intersect – this means that if the triangle “faces” the facet, then it belongs to that facet; and to solve that I use Plane Coordinates.

Example:

While the previous goal sounded smarter relative to intersections, I believe this new goal will facilitate the assembly process in the shop relative to labels and perception versus human error.

We end up with similar structure with the difference that number of items within each branch changes based on the new plane coordinate goal:

Now I can use both methods for different tasks.

Cheers!

1 Like