Closest Point / Distance Calculation from Point Cloud

Hi there,

I think I have a very basic problem, but I am missing a component/crucial data tree step somewhere.

From the attached point of clouds, I want to be able to find out what the distance from each point in the cloud, to it’s closest neighbour out of the same cloud, is. So in this case, I need 162 distances as an output.

It seems like I would need some recursion perhaps to take each point to search out of the cloud, before performing the search.

The end goal is to cull points of a certain proximity to their neighbour.

points-to-test.3dm (91.1 KB)

“Cull Duplicates (CullPt)” component does exactly what you are asking for, have you tried it?

Hi Riccardo,

This worked well as part of my algorithm - but not for the underlying logic.

Really, the best thing that I would want to obtain from the definition as an output is the distance to the closest circle, from the random circles I am populating. This would be in such a way that no circle is more than a set distance from another. That’s the end goal - populate random circles, and ensure circles are a minimum distance of 1.3mm from each other.

I managed to generate something, using all permutations of lines between all points and culling any less than a certain distance. It’s definitely not slick though.

Maybe there’s some kind of different underlying logic I can use, such as circles inside of polygonal cells?

This is my hack so far - that I could just cull some of the points connected to problem lines (which are too short) (27.9 KB)

Your solution is not using the radiuses, but only the center-center distances…

…what you want to happen when 2 circles are too much close each-other?
Delete one? Delete both? Change radius of one/both? Move the circles?
If you are ok with the last option, a circle packing with kangaroo would be the best and simplest solution.

(if you remove some point/circle you’ll see empty spaces probably…)

Hi Riccardo,

That’s right - so far I only have centre/centre, which isn’t really a full story.

When two are too close together, their radius could maybe change to another option from rList (0.75, 0.9, 1.0, 1.1), or move in such a way that the minimum distance is abided by.

Exactly! The Culling at the end is not a good solution IMHO.

Could a circle packing be performed, then using the radius of each packed circle, perform an offset/scaling to each circle, so each one is half the minimum distance away from the original circle (i.e. the minimum distance away from each other, albeit they would be densely packed and not spaced so nicely in a random manner.

I guess though, you could control by Multiplacation/Division a minimum offset and then others can be offset only by more. So in effect you are left with the point cloud still controlling circle location. There would also need to be a maximum offset so the end size of circles (eventually spheres) are within my control (they don’t have to be discrete values from a list)

I 've never tried Kangaroo however so am at a bit of a loss as to where to start - help would be greatly appreciated!

You can add half of your minimum distance to each radius and do circle packing with those radiuses.
2019-05-16%2014_19_52-Window (27.1 KB)
Open it and reset and restart the simulation…

1 Like

i feel like this logic isn’t too bad.

Wow, that’s exceptional! Thank you so much for the quick help. Damn, another plugin that I ought to learn :weary: i mean it’s perfect!

One more thought… How about solving from an already existing point set… :thinking:

Isn’t that… what is happening with kangaroo?
Can you explain further?

Hi Riccardo,

Thank you so much for this, you’re right!I disconnected my PopulateGeometry and attached my point collection and the deformation maintained integrity of points that didn’t need to move too much. Thank you!

Do you have ay personal recommendations for where to start with learning Kangaroo? I’ve only seen some beginner videos so far. I love the definition but haven’t quite managed to logically understand it yet!

I, personally, just “messed around” in the forum and learned bit by bit how to use it…
look at all the discussions under
… you can find a lot of small definition and try to get the logic with them.

Hi Riccardo,

Thanks again so much for your definition. I wonder if there is a way for the packed circles to be kept on the surface/mesh, whereas currently it is the centre points only that are definitely on the mesh. (which still works absolutely great!)

I can do an offset curve equal to the biggest radius of circle I am using, but then when smaller circles are close to the offset, there is of course a wider more noticeable gap. I would still need the controlled distance between circles.

I am thinking whether it could be with something like Pull Point or… perhaps just need like another iteration to the definition? (38.7 KB)
It become more complex in a blink… sadly…

Incredible work in a blink of an eye :astonished: