minkowski_sum.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef IGL_COPYLEFT_CGAL_MINKOWSKI_SUM_H
  2. #define IGL_COPYLEFT_CGAL_MINKOWSKI_SUM_H
  3. #include "../../igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. namespace copyleft
  8. {
  9. namespace boolean
  10. {
  11. // Compute the Minkowski sum of a closed triangle mesh (V,F) and a
  12. // segment [s,d] in 3D.
  13. //
  14. // Inputs:
  15. // VA #VA by 3 list of mesh vertices in 3D
  16. // FA #FA by 3 list of triangle indices into VA
  17. // s segment source endpoint in 3D
  18. // d segment source endpoint in 3D
  19. // resolve_overlaps whether or not to resolve self-union. If false
  20. // then result may contain self-intersections if input mesh is
  21. // non-convex.
  22. // Outputs:
  23. // W #W by 3 list of mesh vertices in 3D
  24. // G #G by 3 list of triangle indices into W
  25. // J #G list of indices into [F;#V+F;[s d]] of birth parents
  26. //
  27. template <
  28. typename DerivedVA,
  29. typename DerivedFA,
  30. typename Deriveds,
  31. typename Derivedd,
  32. typename DerivedW,
  33. typename DerivedG,
  34. typename DerivedJ>
  35. IGL_INLINE void minkowski_sum(
  36. const Eigen::PlainObjectBase<DerivedVA> & VA,
  37. const Eigen::PlainObjectBase<DerivedFA> & FA,
  38. const Eigen::PlainObjectBase<Deriveds> & s,
  39. const Eigen::PlainObjectBase<Derivedd> & d,
  40. const bool resolve_overlaps,
  41. Eigen::PlainObjectBase<DerivedW> & W,
  42. Eigen::PlainObjectBase<DerivedG> & G,
  43. Eigen::PlainObjectBase<DerivedJ> & J);
  44. template <
  45. typename DerivedVA,
  46. typename DerivedFA,
  47. typename Deriveds,
  48. typename Derivedd,
  49. typename DerivedW,
  50. typename DerivedG,
  51. typename DerivedJ>
  52. IGL_INLINE void minkowski_sum(
  53. const Eigen::PlainObjectBase<DerivedVA> & VA,
  54. const Eigen::PlainObjectBase<DerivedFA> & FA,
  55. const Eigen::PlainObjectBase<Deriveds> & s,
  56. const Eigen::PlainObjectBase<Derivedd> & d,
  57. Eigen::PlainObjectBase<DerivedW> & W,
  58. Eigen::PlainObjectBase<DerivedG> & G,
  59. Eigen::PlainObjectBase<DerivedJ> & J);
  60. }
  61. }
  62. }
  63. #ifndef IGL_STATIC_LIBRARY
  64. # include "minkowski_sum.cpp"
  65. #endif
  66. #endif