Geometry Closest Point To - how it works

Hey, I have a question regarding the way Geometry.ClosestPoint node works.

I assume it compares two lists of points, checks distances and returns the one with minimal value. And I think if two points are close to one point and there is no other point, these two points will have same closest point attached?

Is there a way for it to work like this that each point needs to have a unique pair, taking into consideration that point with smallest value has priority to “reserve” point closest to it - so that point next to it needs to find some other point that is not actually closest to it, but next one not “reserved”.

It may sound complicated but I think you get the point:)

thanks for any tips

Geometry.ClosestPointTo does not actually compare points. It takes a geometry and finds the closest point on that geometry to the second geometry. What you’re talking about is using Geometry.DistanceTo to compare distances between points. Then analyzing those “matches” to remove duplicate points. There are a ton of considerations to take into account here, but I’d start by getting your distances and using SortByKey to sort them.