trim_with_solid.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_COPYLEFT_CGAL_TRIM_WITH_SOLID_H
  9. #define IGL_COPYLEFT_CGAL_TRIM_WITH_SOLID_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace copyleft
  15. {
  16. namespace cgal
  17. {
  18. /// Given an arbitrary mesh (VA,FA) and the boundary mesh
  19. /// (VB,FB) of a solid (as defined in [Zhou et al. 2016]), Resolve intersections
  20. /// between A and B subdividing faces of A so that intersections with B exists
  21. /// only along edges and vertices (and coplanar faces). Then determine whether
  22. /// each of these faces is inside or outside of B. This can be used to extract
  23. /// the part of A inside or outside of B.
  24. ///
  25. /// @param[in] VA #VA by 3 list of mesh vertex positions of A
  26. /// @param[in] FA #FA by 3 list of mesh triangle indices into VA
  27. /// @param[in] VB #VB by 3 list of mesh vertex positions of B
  28. /// @param[in] FB #FB by 3 list of mesh triangle indices into VB
  29. /// @param[out] V #V by 3 list of mesh vertex positions of output
  30. /// @param[out] F #F by 3 list of mesh triangle indices into V
  31. /// @param[out] D #F list of bools whether face is inside B
  32. /// @param[out] J #F list of indices into FA revealing birth parent
  33. ///
  34. template <
  35. typename DerivedVA,
  36. typename DerivedFA,
  37. typename DerivedVB,
  38. typename DerivedFB,
  39. typename DerivedV,
  40. typename DerivedF,
  41. typename DerivedD,
  42. typename DerivedJ>
  43. IGL_INLINE void trim_with_solid(
  44. const Eigen::PlainObjectBase<DerivedVA> & VA,
  45. const Eigen::PlainObjectBase<DerivedFA> & FA,
  46. const Eigen::PlainObjectBase<DerivedVB> & VB,
  47. const Eigen::PlainObjectBase<DerivedFB> & FB,
  48. Eigen::PlainObjectBase<DerivedV> & Vd,
  49. Eigen::PlainObjectBase<DerivedF> & F,
  50. Eigen::PlainObjectBase<DerivedD> & D,
  51. Eigen::PlainObjectBase<DerivedJ> & J);
  52. }
  53. }
  54. }
  55. #ifndef IGL_STATIC_LIBRARY
  56. # include "trim_with_solid.cpp"
  57. #endif
  58. #endif