intersect_with_half_space.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "intersect_with_half_space.h"
  2. #include "mesh_boolean.h"
  3. #include "half_space_box.h"
  4. template <
  5. typename DerivedV,
  6. typename DerivedF,
  7. typename Derivedp,
  8. typename Derivedn,
  9. typename DerivedVC,
  10. typename DerivedFC,
  11. typename DerivedJ>
  12. IGL_INLINE bool igl::copyleft::cgal::intersect_with_half_space(
  13. const Eigen::PlainObjectBase<DerivedV > & V,
  14. const Eigen::PlainObjectBase<DerivedF > & F,
  15. const Eigen::PlainObjectBase<Derivedp > & p,
  16. const Eigen::PlainObjectBase<Derivedn > & n,
  17. Eigen::PlainObjectBase<DerivedVC > & VC,
  18. Eigen::PlainObjectBase<DerivedFC > & FC,
  19. Eigen::PlainObjectBase<DerivedJ > & J)
  20. {
  21. Eigen::Matrix<CGAL::Epeck::FT,8,3> BV;
  22. Eigen::Matrix<int,12,3> BF;
  23. half_space_box(p,n,V,BV,BF);
  24. // Disturbingly, (BV,BF) must be first argument
  25. return mesh_boolean(BV,BF,V,F,MESH_BOOLEAN_TYPE_INTERSECT,VC,FC,J);
  26. }
  27. template <
  28. typename DerivedV,
  29. typename DerivedF,
  30. typename Derivedequ,
  31. typename DerivedVC,
  32. typename DerivedFC,
  33. typename DerivedJ>
  34. IGL_INLINE bool igl::copyleft::cgal::intersect_with_half_space(
  35. const Eigen::PlainObjectBase<DerivedV > & V,
  36. const Eigen::PlainObjectBase<DerivedF > & F,
  37. const Eigen::PlainObjectBase<Derivedequ > & equ,
  38. Eigen::PlainObjectBase<DerivedVC > & VC,
  39. Eigen::PlainObjectBase<DerivedFC > & FC,
  40. Eigen::PlainObjectBase<DerivedJ > & J)
  41. {
  42. Eigen::Matrix<CGAL::Epeck::FT,8,3> BV;
  43. Eigen::Matrix<int,12,3> BF;
  44. half_space_box(equ,V,BV,BF);
  45. // Disturbingly, (BV,BF) must be first argument
  46. return mesh_boolean(BV,BF,V,F,MESH_BOOLEAN_TYPE_INTERSECT,VC,FC,J);
  47. }
  48. #ifdef IGL_STATIC_LIBRARY
  49. // Explicit template specialization
  50. template bool igl::copyleft::cgal::intersect_with_half_space<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  51. #endif