intersect_other.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <[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. #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. /// Given a triangle mesh (VA,FA) and another mesh (VB,FB) find all pairs
  20. /// of intersecting faces. Note that self-intersections are ignored.
  21. ///
  22. /// @param[in] VA #V by 3 list of vertex positions
  23. /// @param[in] FA #F by 3 list of triangle indices into VA
  24. /// @param[in] VB #V by 3 list of vertex positions
  25. /// @param[in] FB #F by 3 list of triangle indices into VB
  26. /// @param[in] params whether to detect only and then whether to only
  27. /// find first intersection
  28. /// @param[out] IF #intersecting face pairs by 2 list of intersecting
  29. /// face pairs, indexing FA and FB
  30. /// @param[out] VVAB #VVAB by 3 list of vertex positions
  31. /// @param[out] FFAB #FFAB by 3 list of triangle indices into VVA
  32. /// @param[out] JAB #FFAB list of indices into [FA;FB] denoting birth triangle
  33. /// @param[out] IMAB #VVAB list of indices stitching duplicates
  34. /// (resulting from mesh intersections) together
  35. /// @return true on success
  36. template <
  37. typename DerivedVA,
  38. typename DerivedFA,
  39. typename DerivedVB,
  40. typename DerivedFB,
  41. typename DerivedIF,
  42. typename DerivedVVAB,
  43. typename DerivedFFAB,
  44. typename DerivedJAB,
  45. typename DerivedIMAB>
  46. IGL_INLINE bool intersect_other(
  47. const Eigen::MatrixBase<DerivedVA> & VA,
  48. const Eigen::MatrixBase<DerivedFA> & FA,
  49. const Eigen::MatrixBase<DerivedVB> & VB,
  50. const Eigen::MatrixBase<DerivedFB> & FB,
  51. const RemeshSelfIntersectionsParam & params,
  52. Eigen::PlainObjectBase<DerivedIF> & IF,
  53. Eigen::PlainObjectBase<DerivedVVAB> & VVAB,
  54. Eigen::PlainObjectBase<DerivedFFAB> & FFAB,
  55. Eigen::PlainObjectBase<DerivedJAB> & JAB,
  56. Eigen::PlainObjectBase<DerivedIMAB> & IMAB);
  57. /// \overload
  58. /// @param[in] first_only whether to only find first intersection
  59. template <
  60. typename DerivedVA,
  61. typename DerivedFA,
  62. typename DerivedVB,
  63. typename DerivedFB,
  64. typename DerivedIF>
  65. IGL_INLINE bool intersect_other(
  66. const Eigen::MatrixBase<DerivedVA> & VA,
  67. const Eigen::MatrixBase<DerivedFA> & FA,
  68. const Eigen::MatrixBase<DerivedVB> & VB,
  69. const Eigen::MatrixBase<DerivedFB> & FB,
  70. const bool first_only,
  71. Eigen::PlainObjectBase<DerivedIF> & IF);
  72. }
  73. }
  74. }
  75. #ifndef IGL_STATIC_LIBRARY
  76. # include "intersect_other.cpp"
  77. #endif
  78. #endif