Get distance between two point from object surface

I’m trying to calculate the distance between them but I have to consider the geometry of the object.

If you want the direct straight light distance between the points you can use the Vector3.distanceTo function.

If you’re actually interested in the shortest path between the points along the surface of the mesh that’s a much more difficult problem and one you won’t find an easy solution to directly in three.js or most graphics libraries. This is a twitter thread and link to research article I saw recently that discusses how to achieve that:

https://nmwsharp.com/research/flip-geodesics/

1 Like