Search code examples
meshlab

How is "distance from reference mesh" computed?


I checked out meshlab code but I didn't understand exactly how is "distance from reference mesh" computed. Can anyone explain it to me, please? Thanks in advance.


Solution

  • You measure the (minimum) distance from each vertex of one mesh to nearest point on the surface of reference mesh. So you iterate vertexes of the first mesh and triangles of the reference mesh, projecting each vertex on every triangle and taking the minimum distance for each vertex-triangle pair. In practice, this can be accelerated using octrees or other spatial hashing structures to avoid protections on triangles far of the vertex.

    When you have computed the distance from each vertex, you store it as the quality value of the vertex, so you can color the mesh or save distance values to a file.

    Also, not sure of this, but maybe that the "measure" code is not in meshlab source code, but in Vcglib. This is the library used to store and operate on meshes, meamwhile meshlab does the GUI work.