I’d like to know the method getting nearest point.
I’ve checked and used prior methods but speed issues and memory out issues exist
There are many methods to get the distance from a point to a triangle. The problem might be in the scales of this algorithm. like geometry - Fastest way to compute point to triangle distance in 3D? - Stack Overflow
For a few hundreds triangle mesh, brute force is enough.
For multi thousands one, you will have to use BVH on top. Or any other algorithm that fits better your data and your needs.
There was some good discussion about it - Get the closest point on a mesh surface from a free point in space