half_space_box.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef IGL_COPYLEFT_CGAL_HALF_SPACE_BOX_H
  2. #define IGL_COPYLEFT_CGAL_HALF_SPACE_BOX_H
  3. #include "../../igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
  6. #include <CGAL/Plane_3.h>
  7. namespace igl
  8. {
  9. namespace copyleft
  10. {
  11. namespace cgal
  12. {
  13. /// Construct a mesh of box (BV,BF) so that it contains the intersection of
  14. /// the half-space under the plane (P) and the bounding box of V, and does not
  15. /// contain any of the half-space above (P).
  16. ///
  17. /// @param[in] P plane so that normal points away from half-space
  18. /// @param[in] V #V by 3 list of vertex positions
  19. /// @param[out] BV #BV by 3 list of box vertex positions
  20. /// @param[out] BF #BF b3 list of box triangle indices into BV
  21. template <typename DerivedV, typename Index>
  22. IGL_INLINE void half_space_box(
  23. const CGAL::Plane_3<CGAL::Epeck> & P,
  24. const Eigen::MatrixBase<DerivedV> & V,
  25. Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
  26. Eigen::Matrix<Index,12,3> & BF);
  27. /// \overload
  28. /// @param[in] p 3d point on plane
  29. /// @param[in] n 3d vector of normal of plane pointing away from inside
  30. template <typename Derivedp, typename Derivedn, typename DerivedV, typename Index>
  31. IGL_INLINE void half_space_box(
  32. const Eigen::MatrixBase<Derivedp> & p,
  33. const Eigen::MatrixBase<Derivedn> & n,
  34. const Eigen::MatrixBase<DerivedV> & V,
  35. Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
  36. Eigen::Matrix<Index,12,3> & BF);
  37. /// \overload
  38. /// @param[in] equ plane equation: a*x+b*y+c*z + d = 0
  39. template <typename Derivedequ, typename DerivedV, typename Index>
  40. IGL_INLINE void half_space_box(
  41. const Eigen::MatrixBase<Derivedequ> & equ,
  42. const Eigen::MatrixBase<DerivedV> & V,
  43. Eigen::Matrix<CGAL::Epeck::FT,8,3> & BV,
  44. Eigen::Matrix<Index,12,3> & BF);
  45. }
  46. }
  47. }
  48. #ifndef IGL_STATIC_LIBRARY
  49. # include "half_space_box.cpp"
  50. #endif
  51. #endif