mesh_boolean.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. //
  21. // See also: self_intersect
  22. //
  23. template <
  24. typename DerivedVA,
  25. typename DerivedFA,
  26. typename DerivedVB,
  27. typename DerivedFB,
  28. typename DerivedVC,
  29. typename DerivedFC>
  30. IGL_INLINE void mesh_boolean(
  31. const Eigen::PlainObjectBase<DerivedVA > & VA,
  32. const Eigen::PlainObjectBase<DerivedFA > & FA,
  33. const Eigen::PlainObjectBase<DerivedVB > & VB,
  34. const Eigen::PlainObjectBase<DerivedFB > & FB,
  35. const MeshBooleanType & type,
  36. Eigen::PlainObjectBase<DerivedVC > & VC,
  37. Eigen::PlainObjectBase<DerivedFC > & FC);
  38. // Inputs:
  39. // resolve_fun function handle for computing resolve of a
  40. // self-intersections of a mesh and outputting the new mesh.
  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. const std::function<void(
  55. const Eigen::Matrix<typename DerivedVC::Scalar,Eigen::Dynamic,3> &,
  56. const Eigen::Matrix<typename DerivedFC::Scalar, Eigen::Dynamic,3> &,
  57. Eigen::Matrix<typename DerivedVC::Scalar,Eigen::Dynamic,3> &,
  58. Eigen::Matrix<typename DerivedFC::Scalar, Eigen::Dynamic,3> &)>
  59. & resolve_fun,
  60. Eigen::PlainObjectBase<DerivedVC > & VC,
  61. Eigen::PlainObjectBase<DerivedFC > & FC);
  62. }
  63. #ifndef IGL_STATIC_LIBRARY
  64. # include "mesh_boolean.cpp"
  65. #endif
  66. #endif