mesh_boolean.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef MESH_BOOLEAN_H
  2. #define MESH_BOOLEAN_H
  3. #include <igl/igl_inline.h>
  4. #include "MeshBooleanType.h"
  5. #include <Eigen/Core>
  6. namespace igl
  7. {
  8. // MESH_BOOLEAN Compute boolean csg operations on "solid", consistently oriented
  9. // meshes.
  10. //
  11. // Inputs:
  12. // V #V by 3 list of vertex positions of first mesh
  13. // F #F by 3 list of triangle indices into V
  14. // U #U by 3 list of vertex positions of second mesh
  15. // G #G by 3 list of triangle indices into U
  16. // type type of boolean operation
  17. // Outputs:
  18. // W #W by 3 list of vertex positions of boolean result mesh
  19. // H #H by 3 list of triangle indices into W
  20. // J #H list of indices into [FA;FB] revealing "birth" facet
  21. //
  22. // See also: self_intersect
  23. //
  24. template <
  25. typename DerivedVA,
  26. typename DerivedFA,
  27. typename DerivedVB,
  28. typename DerivedFB,
  29. typename DerivedVC,
  30. typename DerivedFC,
  31. typename DerivedJ>
  32. IGL_INLINE void mesh_boolean(
  33. const Eigen::PlainObjectBase<DerivedVA > & VA,
  34. const Eigen::PlainObjectBase<DerivedFA > & FA,
  35. const Eigen::PlainObjectBase<DerivedVB > & VB,
  36. const Eigen::PlainObjectBase<DerivedFB > & FB,
  37. const MeshBooleanType & type,
  38. Eigen::PlainObjectBase<DerivedVC > & VC,
  39. Eigen::PlainObjectBase<DerivedFC > & FC,
  40. Eigen::PlainObjectBase<DerivedJ > & J);
  41. template <
  42. typename DerivedVA,
  43. typename DerivedFA,
  44. typename DerivedVB,
  45. typename DerivedFB,
  46. typename DerivedVC,
  47. typename DerivedFC>
  48. IGL_INLINE void mesh_boolean(
  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 MeshBooleanType & type,
  54. Eigen::PlainObjectBase<DerivedVC > & VC,
  55. Eigen::PlainObjectBase<DerivedFC > & FC);
  56. // Inputs:
  57. // resolve_fun function handle for computing resolve of a
  58. // self-intersections of a mesh and outputting the new mesh.
  59. template <
  60. typename DerivedVA,
  61. typename DerivedFA,
  62. typename DerivedVB,
  63. typename DerivedFB,
  64. typename DerivedVC,
  65. typename DerivedFC,
  66. typename DerivedJ>
  67. IGL_INLINE void mesh_boolean(
  68. const Eigen::PlainObjectBase<DerivedVA > & VA,
  69. const Eigen::PlainObjectBase<DerivedFA > & FA,
  70. const Eigen::PlainObjectBase<DerivedVB > & VB,
  71. const Eigen::PlainObjectBase<DerivedFB > & FB,
  72. const MeshBooleanType & type,
  73. const std::function<void(
  74. const Eigen::Matrix<typename DerivedVC::Scalar,Eigen::Dynamic,3> &,
  75. const Eigen::Matrix<typename DerivedFC::Scalar,Eigen::Dynamic,3> &,
  76. Eigen::Matrix<typename DerivedVC::Scalar,Eigen::Dynamic,3> &,
  77. Eigen::Matrix<typename DerivedFC::Scalar,Eigen::Dynamic,3> &,
  78. Eigen::Matrix<typename DerivedJ::Scalar,Eigen::Dynamic,1>&)>
  79. & resolve_fun,
  80. Eigen::PlainObjectBase<DerivedVC > & VC,
  81. Eigen::PlainObjectBase<DerivedFC > & FC,
  82. Eigen::PlainObjectBase<DerivedJ > & J);
  83. }
  84. #ifndef IGL_STATIC_LIBRARY
  85. # include "mesh_boolean.cpp"
  86. #endif
  87. #endif