hausdorff.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_HAUSDORFF_H
  9. #define IGL_HAUSDORFF_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. // HAUSDORFF compute the Hausdorff distance between mesh (VA,FA) and mesh
  15. // (VB,FB). This is the
  16. //
  17. // d(A,B) = max ( max min d(a,b) , max min d(b,a) )
  18. // a∈A b∈B b∈B a∈A
  19. //
  20. // Inputs:
  21. // VA #VA by 3 list of vertex positions
  22. // FA #FA by 3 list of face indices into VA
  23. // VB #VB by 3 list of vertex positions
  24. // FB #FB by 3 list of face indices into VB
  25. // Outputs:
  26. // d hausdorff distance
  27. // pair 2 by 3 list of "determiner points" so that pair(1,:) is from A and
  28. // pair(2,:) is from B
  29. //
  30. template <
  31. typename DerivedVA,
  32. typename DerivedFA,
  33. typename DerivedVB,
  34. typename DerivedFB,
  35. typename Scalar>
  36. IGL_INLINE void hausdorff(
  37. const Eigen::PlainObjectBase<DerivedVA> & VA,
  38. const Eigen::PlainObjectBase<DerivedFA> & FA,
  39. const Eigen::PlainObjectBase<DerivedVB> & VB,
  40. const Eigen::PlainObjectBase<DerivedFB> & FB,
  41. Scalar & d);
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "hausdorff.cpp"
  45. #endif
  46. #endif