thedorkknight
thedorkknight

Reputation: 183

Calculate Hausdorff distance between two meshes

I am trying to find the deviation between two meshes. For e.g., the difference between two sets of points defined in 3d space, and I plan to visualize the distance using some 3d visualization tool for e.g., Qt3D or some OpenGL-based library.

I have two sets of meshes, basically two .stl files. I have programmed to read them as inputs. Now, I need to calculate the deviation between the corresponding meshes. For this, I understand that the Hausdorff distance is a possible mathematical tool. Is there any library which calculates the Hausdorff distance between two meshes?

I managed to find one piece of code, but it's more or less a program in itself. It's called M.E.S.H.. I don't want to use it as it is because:

  1. it's written in C;
  2. I want to develop my own application (using a library, of course).

The other questions point towards the mathematical algorithm, I don't plan to implement the algorithm on my own.

I am using Qt5 with MSVC2010 (32 bit).

Upvotes: 4

Views: 8629

Answers (3)

Alec Jacobson
Alec Jacobson

Reputation: 6264

You can use igl::hausdorff in libigl. If your first mesh has vertices in the rows of a matrix VA with face indices FA and likewise VB and FB for your second mesh, then

double d;
igl::hausdorff(VA,FA,VB,FB,d);

will compute the Hausdorff distance d between the two meshes.

Upvotes: 7

sebas
sebas

Reputation: 1085

I am not sure if it can help, but have a look at the dual quadric metric http://www.computingscience.nl/docs/vakken/ddm/slides/papers/garland2.pdf

Upvotes: 0

abenci
abenci

Reputation: 8675

It does not seem so complex to implement: http://vcg.isti.cnr.it/publications/papers/metro.pdf

Upvotes: 4

Related Questions