remesh_intersections.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <qnzhou@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. //
  9. #ifndef IGL_COPYLEFT_CGAL_REMESH_INTERSECTIONS_H
  10. #define IGL_COPYLEFT_CGAL_REMESH_INTERSECTIONS_H
  11. #include "../../igl_inline.h"
  12. #include <Eigen/Dense>
  13. #include "CGAL_includes.hpp"
  14. namespace igl
  15. {
  16. namespace copyleft
  17. {
  18. namespace cgal
  19. {
  20. // Remesh faces according to results of intersection detection and
  21. // construction (e.g. from `igl::copyleft::cgal::intersect_other` or
  22. // `igl::copyleft::cgal::SelfIntersectMesh`)
  23. //
  24. // Inputs:
  25. // V #V by 3 list of vertex positions
  26. // F #F by 3 list of triangle indices into V
  27. // T #F list of cgal triangles
  28. // offending #offending map taking face indices into F to pairs of order
  29. // of first finding and list of intersection objects from all
  30. // intersections
  31. // edge2faces #edges <= #offending*3 to incident offending faces
  32. // Outputs:
  33. // VV #VV by 3 list of vertex positions
  34. // FF #FF by 3 list of triangle indices into V
  35. // IF #intersecting face pairs by 2 list of intersecting face pairs,
  36. // indexing F
  37. // J #FF list of indices into F denoting birth triangle
  38. // IM #VV list of indices into VV of unique vertices.
  39. //
  40. template <
  41. typename DerivedV,
  42. typename DerivedF,
  43. typename Kernel,
  44. typename DerivedVV,
  45. typename DerivedFF,
  46. typename DerivedJ,
  47. typename DerivedIM>
  48. IGL_INLINE void remesh_intersections(
  49. const Eigen::PlainObjectBase<DerivedV> & V,
  50. const Eigen::PlainObjectBase<DerivedF> & F,
  51. const std::vector<CGAL::Triangle_3<Kernel> > & T,
  52. const std::map<
  53. typename DerivedF::Index,
  54. std::vector<
  55. std::pair<typename DerivedF::Index, CGAL::Object> > > & offending,
  56. const std::map<
  57. std::pair<typename DerivedF::Index,typename DerivedF::Index>,
  58. std::vector<typename DerivedF::Index> > & edge2faces,
  59. Eigen::PlainObjectBase<DerivedVV> & VV,
  60. Eigen::PlainObjectBase<DerivedFF> & FF,
  61. Eigen::PlainObjectBase<DerivedJ> & J,
  62. Eigen::PlainObjectBase<DerivedIM> & IM);
  63. }
  64. }
  65. }
  66. #ifndef IGL_STATIC_LIBRARY
  67. # include "remesh_intersections.cpp"
  68. #endif
  69. #endif