hausdorff.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_COPYLEFT_CGAL_HAUSDORFF_H
  9. #define IGL_COPYLEFT_CGAL_HAUSDORFF_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include "CGAL_includes.hpp"
  13. #include <vector>
  14. namespace igl
  15. {
  16. namespace copyleft
  17. {
  18. namespace cgal
  19. {
  20. // Compute lower and upper bounds (l,u) on the Hausdorff distance between a triangle
  21. // (V) and a pointset (e.g., mesh, triangle soup) given by a distance function
  22. // handle (dist_to_B).
  23. //
  24. // Inputs:
  25. // V 3 by 3 list of corner positions so that V.row(i) is the position of the
  26. // ith corner
  27. // treeB CGAL's AABB tree containing triangle soup (VB,FB)
  28. // TB list of CGAL triangles in order of FB (for determining which was found
  29. // in computation)
  30. // Outputs:
  31. // l lower bound on Hausdorff distance
  32. // u upper bound on Hausdorff distance
  33. //
  34. template <
  35. typename DerivedV,
  36. typename Kernel,
  37. typename Scalar>
  38. IGL_INLINE void hausdorff(
  39. const Eigen::MatrixBase<DerivedV>& V,
  40. const CGAL::AABB_tree<
  41. CGAL::AABB_traits<Kernel,
  42. CGAL::AABB_triangle_primitive<Kernel,
  43. typename std::vector<CGAL::Triangle_3<Kernel> >::iterator
  44. >
  45. >
  46. > & treeB,
  47. const std::vector<CGAL::Triangle_3<Kernel> > & TB,
  48. Scalar & l,
  49. Scalar & u);
  50. }
  51. }
  52. }
  53. #ifndef IGL_STATIC_LIBRARY
  54. # include "hausdorff.cpp"
  55. #endif
  56. #endif