Leave one duplicated point among trees

I has been trying to solve this issue for some time and find it quite challenging than I though with my knowledge, it sounds simple but couldn’t figure out how to solve it.

I am trying to kill duplicated points and remain only one that have a shortest distance among 3 points attractors. I even try to flip matrix to compare but at the end it messed up its data structure. Please if there are anyone have a constructive idea to achieve this. Thank you

You have N pts and M attractors. So for each possible attr set (where set.Count should be user controlled … for instance 2,3, …) you need the point with the min sum of distances? If so that’s just a few lines of code but working with components is not my game. So if you want a C# for that notify.

BTW: If attractors are many maybe a more rational approach is some sort of triangulation (case: sets of 3),

in the picture the red points are the attractors? please post your GH file with internalized points to make life easier :upside_down_face:

[edit]

shortest distance among 3 point attractors in my mind means triangles, but it’s not clear if you mean “any 3” point attractors or “closest 3” point attractors…

in case your answer is closest 3 point attractors, then I think a way might be to triangulate those (attractor points are the white ones)

then find the center to the circumscribed circle to each triangle (center is equidistant to each triangle vertex, meaning the perfect spot to find your final point is that location) in blue

at this point, my guess is that the closest point to each circle center might be the point that best reflects the property to be equidistant to each triangle vertex (in yellow)

just_guessing.gh (15.1 KB)

Found something quite similar (but using only triads > as a challenge do the general case > unique combinations and the likes). Try to translate it to … er … something.

Points_Prox_ToAttrTriads_V1.gh (121.5 KB)

Maybe my explanation is not clear, I will try to explain again, sorry English is not my first language, I quite struggle to convey the messages.

  1. I want to find 30 closet points from each 5 attractors points(red) here.
  2. the problem is closet points the grasshopper gave are shared in some location (ones in blue).
  3. I want to animate the movement of 5 branches of 30 closet points to each attractor points (red)
  4. the problem happens because there are overlapping point so it was not animated properly.

My goal is to cull out any points that are overlapping and leave one in based on the closest distance among attractors that they are sharing the closet points (blue points should left only on which is the shortest distance)
cull duplicated.gh (10.7 KB)

I posted grasshopper file here. thank you.

Thank you for helping, Appreciate it. But I think I did not convey what I want well. So you misunderstand what I want to achieve, but here I post again.
Maybe my explanation is not clear, I will try to explain again, sorry English is not my first language, I quite struggle to convey the messages.

  1. I want to find 30 closet points from each 5 attractors points(red) here.
  2. the problem is closet points the grasshopper gave are shared in some location (ones in blue).
  3. I want to animate the movement of 5 branches of 30 closet points to each attractor points (red)
  4. the problem happens because there are overlapping point so it was not animated properly.

My goal is to cull out any points that are overlapping and leave one in based on the closest distance among attractors that they are sharing the closet points (blue points should left only on which is the shortest distance)
cull duplicated.gh (10.7 KB)

I posted grasshopper file here. thank you.

Well … indeed the explanation still is not good (at least if the goal to write a few lines of code for solving this - very easy mind). Try to elaborate further like talking to a very stupid robot.

Start by EXPLICITLY outlining the problem in an abstract way like exposing it in some thesis. For instance: (a) I have N rnd Pts and M attractors (b) the Pts are sampled in a collection of Type (List/Tree) (c) the attractors are sampled in a collection of Type (List/Tree) then (d), (e), (f) … blah, blah.

BTW: notice as well if you want a thread safe // solution (i.e. if N is BIG say some millions etc).

BTW: 5 attractors and 30 points? By what means this is justified?