trim_with_solid.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
  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. // TRIM_WITH_SOLID 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. // Inputs:
  26. // VA #VA by 3 list of mesh vertex positions of A
  27. // FA #FA by 3 list of mesh triangle indices into VA
  28. // VB #VB by 3 list of mesh vertex positions of B
  29. // FB #FB by 3 list of mesh triangle indices into VB
  30. // Outputs:
  31. // V #V by 3 list of mesh vertex positions of output
  32. // F #F by 3 list of mesh triangle indices into V
  33. // D #F list of bools whether face is inside B
  34. // J #F list of indices into FA revealing birth parent
  35. //
  36. template <
  37. typename DerivedVA,
  38. typename DerivedFA,
  39. typename DerivedVB,
  40. typename DerivedFB,
  41. typename DerivedV,
  42. typename DerivedF,
  43. typename DerivedD,
  44. typename DerivedJ>
  45. IGL_INLINE void trim_with_solid(
  46. const Eigen::PlainObjectBase<DerivedVA> & VA,
  47. const Eigen::PlainObjectBase<DerivedFA> & FA,
  48. const Eigen::PlainObjectBase<DerivedVB> & VB,
  49. const Eigen::PlainObjectBase<DerivedFB> & FB,
  50. Eigen::PlainObjectBase<DerivedV> & Vd,
  51. Eigen::PlainObjectBase<DerivedF> & F,
  52. Eigen::PlainObjectBase<DerivedD> & D,
  53. Eigen::PlainObjectBase<DerivedJ> & J);
  54. }
  55. }
  56. }
  57. #ifndef IGL_STATIC_LIBRARY
  58. # include "trim_with_solid.cpp"
  59. #endif
  60. #endif