intersect_with_half_space.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef IGL_COPYLEFT_CGAL_INTERSECT_WITH_HALF_SPACE_H
  2. #define IGL_COPYLEFT_CGAL_INTERSECT_WITH_HALF_SPACE_H
  3. #include "../../igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. namespace copyleft
  8. {
  9. namespace cgal
  10. {
  11. // Intersect a PWN mesh with a half-space. Point on plane, normal pointing
  12. // outward.
  13. //
  14. // Inputs:
  15. // V #V by 3 list of mesh vertex positions
  16. // p 3d point on plane
  17. // n 3d vector of normal of plane pointing away from inside
  18. // Outputs:
  19. // VC #VC by 3 list of vertex positions of boolean result mesh
  20. // FC #FC by 3 list of triangle indices into VC
  21. // J #FC list of indices into [F;F.rows()+[1;2]] revealing "birth" facet
  22. template <
  23. typename DerivedV,
  24. typename DerivedF,
  25. typename Derivedp,
  26. typename Derivedn,
  27. typename DerivedVC,
  28. typename DerivedFC,
  29. typename DerivedJ>
  30. IGL_INLINE bool intersect_with_half_space(
  31. const Eigen::PlainObjectBase<DerivedV > & V,
  32. const Eigen::PlainObjectBase<DerivedF > & F,
  33. const Eigen::PlainObjectBase<Derivedp > & p,
  34. const Eigen::PlainObjectBase<Derivedn > & n,
  35. Eigen::PlainObjectBase<DerivedVC > & VC,
  36. Eigen::PlainObjectBase<DerivedFC > & FC,
  37. Eigen::PlainObjectBase<DerivedJ > & J);
  38. // Intersect a PWN mesh with a half-space. Plane equation.
  39. //
  40. // Inputs:
  41. // V #V by 3 list of mesh vertex positions
  42. // equ plane equation: a*x+b*y+c*z + d = 0
  43. // Outputs:
  44. // VC #VC by 3 list of vertex positions of boolean result mesh
  45. // FC #FC by 3 list of triangle indices into VC
  46. // J #FC list of indices into [F;F.rows()+[1;2]] revealing "birth" facet
  47. template <
  48. typename DerivedV,
  49. typename DerivedF,
  50. typename Derivedequ,
  51. typename DerivedVC,
  52. typename DerivedFC,
  53. typename DerivedJ>
  54. IGL_INLINE bool intersect_with_half_space(
  55. const Eigen::PlainObjectBase<DerivedV > & V,
  56. const Eigen::PlainObjectBase<DerivedF > & F,
  57. const Eigen::PlainObjectBase<Derivedequ > & equ,
  58. Eigen::PlainObjectBase<DerivedVC > & VC,
  59. Eigen::PlainObjectBase<DerivedFC > & FC,
  60. Eigen::PlainObjectBase<DerivedJ > & J);
  61. }
  62. }
  63. }
  64. #ifndef IGL_STATIC_LIBRARY
  65. # include "intersect_with_half_space.cpp"
  66. #endif
  67. #endif