intersect_other.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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_INTERSECT_OTHER_H
  9. #define IGL_COPYLEFT_CGAL_INTERSECT_OTHER_H
  10. #include "../../igl_inline.h"
  11. #include "RemeshSelfIntersectionsParam.h"
  12. #include <Eigen/Dense>
  13. namespace igl
  14. {
  15. namespace copyleft
  16. {
  17. namespace cgal
  18. {
  19. // INTERSECT_OTHER Given a triangle mesh (VA,FA) and another mesh (VB,FB)
  20. // find all pairs of intersecting faces. Note that self-intersections are
  21. // ignored.
  22. //
  23. // Inputs:
  24. // VA #V by 3 list of vertex positions
  25. // FA #F by 3 list of triangle indices into VA
  26. // VB #V by 3 list of vertex positions
  27. // FB #F by 3 list of triangle indices into VB
  28. // params whether to detect only and then whether to only find first
  29. // intersection
  30. // Outputs:
  31. // IF #intersecting face pairs by 2 list of intersecting face pairs,
  32. // indexing FA and FB
  33. // VVAB #VVAB by 3 list of vertex positions
  34. // FFAB #FFAB by 3 list of triangle indices into VVA
  35. // JAB #FFAB list of indices into [FA;FB] denoting birth triangle
  36. // IMAB #VVAB list of indices stitching duplicates (resulting from
  37. // mesh intersections) together
  38. template <
  39. typename DerivedVA,
  40. typename DerivedFA,
  41. typename DerivedVB,
  42. typename DerivedFB,
  43. typename DerivedIF,
  44. typename DerivedVVAB,
  45. typename DerivedFFAB,
  46. typename DerivedJAB,
  47. typename DerivedIMAB>
  48. IGL_INLINE bool intersect_other(
  49. const Eigen::PlainObjectBase<DerivedVA> & VA,
  50. const Eigen::PlainObjectBase<DerivedFA> & FA,
  51. const Eigen::PlainObjectBase<DerivedVB> & VB,
  52. const Eigen::PlainObjectBase<DerivedFB> & FB,
  53. const RemeshSelfIntersectionsParam & params,
  54. Eigen::PlainObjectBase<DerivedIF> & IF,
  55. Eigen::PlainObjectBase<DerivedVVAB> & VVAB,
  56. Eigen::PlainObjectBase<DerivedFFAB> & FFAB,
  57. Eigen::PlainObjectBase<DerivedJAB> & JAB,
  58. Eigen::PlainObjectBase<DerivedIMAB> & IMAB);
  59. // Legacy wrapper for detect only using common types.
  60. //
  61. // Inputs:
  62. // VA #V by 3 list of vertex positions
  63. // FA #F by 3 list of triangle indices into VA
  64. // VB #V by 3 list of vertex positions
  65. // FB #F by 3 list of triangle indices into VB
  66. // first_only whether to only detect the first intersection.
  67. // Outputs:
  68. // IF #intersecting face pairs by 2 list of intersecting face pairs,
  69. // indexing FA and FB
  70. // Returns true if any intersections were found
  71. //
  72. // See also: remesh_self_intersections
  73. IGL_INLINE bool intersect_other(
  74. const Eigen::MatrixXd & VA,
  75. const Eigen::MatrixXi & FA,
  76. const Eigen::MatrixXd & VB,
  77. const Eigen::MatrixXi & FB,
  78. const bool first_only,
  79. Eigen::MatrixXi & IF);
  80. }
  81. }
  82. }
  83. #ifndef IGL_STATIC_LIBRARY
  84. # include "intersect_other.cpp"
  85. #endif
  86. #endif