Mesh Closest Point

Hi all.

I am interested about complexity of the GetClosestPoint function on Mesh. I wander if this function goes through all faces of the Mesh to find closest point or …??


Without insider information from McNeel this is hard to say - it is a proprietary algorithm. You could time the operation and see how it scales with the number of faces, it should give you some info in the big-O order of the operation.

We use a search tree data structure to perform searches. Of course the initial search will require the tree to be built which is essentially the same as walking through all of the faces in the mesh, but subsequent searches should be fast.


I have a question about speed of GetClosestPoint of mesh, why is faster than GetClosestPoint of pointcloud? I have tested the speed with meshes and pointcloud with the same points, and on meshes are notably faster. Could it be because in cloudpoints every time that GetClosestPoint it’s called recreates the tree, while in meshes you have the tree on his topology and doesn’t need to recreate it every time?

Thanks in advance