mesh_boolean.h 3.0 KB

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