fast_find_intersections.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2022 Vladimir S. FONOV <[email protected]>
  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. #pragma once
  9. #ifndef FAST_FIND_MESH_INTERSECT_H
  10. #define FAST_FIND_MESH_INTERSECT_H
  11. #include "igl_inline.h"
  12. #include "AABB.h"
  13. #include <Eigen/Core>
  14. namespace igl {
  15. /// Identify triangles where two meshes interesect
  16. /// using AABBTree and tri_tri_intersection_test_3d.
  17. ///
  18. /// @param[in] V1 #V by 3 list representing vertices on the first mesh
  19. /// @param[in] F1 #F by 3 list representing triangles on the first mesh
  20. /// @param[in] V2 #V by 3 list representing vertices on the second mesh
  21. /// @param[in] F2 #F by 3 list representing triangles on the second mesh
  22. /// @param[out] intersect_pairs correspondance list of intersecting triangles
  23. /// column 0 - mesh 1, column 1 - mesh2
  24. /// @param[out] edges list of pairs of intersection edges
  25. ///
  26. /// \see copyleft::cgal::intersect_other
  27. template <
  28. typename DerivedV1,
  29. typename DerivedF1,
  30. typename DerivedV2,
  31. typename DerivedF2,
  32. typename DerivedI,
  33. typename DerivedE>
  34. IGL_INLINE void fast_find_intersections(
  35. const Eigen::MatrixBase<DerivedV1>& V1,
  36. const Eigen::MatrixBase<DerivedF1>& F1,
  37. const Eigen::MatrixBase<DerivedV2>& V2,
  38. const Eigen::MatrixBase<DerivedF2>& F2,
  39. Eigen::PlainObjectBase<DerivedI>& intersect_pairs,
  40. Eigen::PlainObjectBase<DerivedE>& edges );
  41. /// \overload
  42. /// @param[in] tree - AABB tree bult from the first mesh
  43. template <
  44. typename DerivedV1,
  45. typename DerivedF1,
  46. typename DerivedV2,
  47. typename DerivedF2,
  48. typename DerivedI,
  49. typename DerivedE>
  50. IGL_INLINE void fast_find_intersections(
  51. const AABB<DerivedV1,3> & tree,
  52. const Eigen::MatrixBase<DerivedV1>& V1,
  53. const Eigen::MatrixBase<DerivedF1>& F1,
  54. const Eigen::MatrixBase<DerivedV2>& V2,
  55. const Eigen::MatrixBase<DerivedF2>& F2,
  56. Eigen::PlainObjectBase<DerivedI>& intersect_pairs,
  57. Eigen::PlainObjectBase<DerivedE>& edges );
  58. };
  59. #ifndef IGL_STATIC_LIBRARY
  60. # include "fast_find_intersections.cpp"
  61. #endif
  62. #endif