remesh_intersections.h 2.4 KB

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