Understanding how KNearestSearch works

I have a surface in three-dimensional space composed of triangles generated by Meshes.jl. Given a point in space, the function ‘search’ in Meshes.jl can find the closest triangle to this point. I want to know how this distance is measured, how the algorithm is implemented, and it would be even better if someone could provide some reference materials.

Everything is open-source, you can read the source code to learn more, it is simple Julia code:

We use the NearestNeighbors.jl package and compute the distance to the centroid of the triangles. There are options to control the distance used, number of neighbors, etc.

Thanks! I will check that.

Feel free to ask these user questions in our Zulip channel. We sometimes miss posts in Discourse.

OK. I am glad to join the channel.