polyvector_field_comb_from_matchings_and_cuts.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Olga Diamanti <[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_POLYVECTOR_FIELD_COMB_FROM_MATCHINGS_AND_CUTS
  9. #define IGL_POLYVECTOR_FIELD_COMB_FROM_MATCHINGS_AND_CUTS
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl {
  14. // Given an mesh, an N- polyvector field with given matchings between
  15. // the vector sets across interior edges, and corresponding mesh cuts,
  16. // compute a "combed" polyvector field, i.e.
  17. // separate the vector set field into N vector fields, where the separation is defined
  18. // by the matchings. The cuts have previously been generated based on the field
  19. // singularities, see igl::polyvector_field_cut_mesh_with_singularities.
  20. // Inputs:
  21. // V #V by 3 list of the vertex positions
  22. // F #F by 3 list of the faces (must be triangles)
  23. // TT #F by 3 triangle to triangle adjacent matrix (e.g. computed
  24. // via igl:triangle_triangle_adjacency).
  25. // E2F #E by 2 list of the edge-to-face relation (e.g. computed
  26. // via igl::edge_topology)
  27. // F2E #F by 3 list of the face-to-edge relation (e.g. computed
  28. // via igl::edge_topology)
  29. // sol3D #F by 3n list of the 3D coordinates of the per-face vectors of the input vector set field
  30. // (stacked horizontally for each triangle). Vector #1 in one face does not necessarily match
  31. // vector #1 in the adjacent face.
  32. // match_ab #E by N matrix, describing for each edge the matching a->b, where a
  33. // and b are the faces adjacent to the edge (i.e. vector #i of
  34. // the vector set in a is matched to vector #mab[i] in b)
  35. // match_ba #E by N matrix, describing for each edge the matching b->a, where a
  36. // and b are the faces adjacent to the edge (i.e. vector #mba[i] of
  37. // the vector set in a is matched to vector #i in b)
  38. // cuts #F by 3 list of boolean flags, indicating the edges that need to be cut
  39. // Outputs:
  40. // sol3D_combed #F by 3n list of the 3D coordinates of the per-face vectors of the combed vector set field
  41. // (stacked horizontally for each triangle). Vector #1 in one face will match vector #1 in
  42. // the adjacent face.
  43. //
  44. template <typename DerivedV, typename DerivedF, typename DerivedTT, typename DerivedS, typename DerivedM, typename DerivedC>
  45. IGL_INLINE void polyvector_field_comb_from_matchings_and_cuts(
  46. const Eigen::PlainObjectBase<DerivedV> &V,
  47. const Eigen::PlainObjectBase<DerivedF> &F,
  48. const Eigen::PlainObjectBase<DerivedTT> &TT,
  49. const Eigen::MatrixXi &E2F,
  50. const Eigen::MatrixXi &F2E,
  51. const Eigen::PlainObjectBase<DerivedS> &sol3D,
  52. const Eigen::PlainObjectBase<DerivedM> &match_ab,
  53. const Eigen::PlainObjectBase<DerivedM> &match_ba,
  54. const Eigen::PlainObjectBase<DerivedC> &cuts,
  55. Eigen::PlainObjectBase<DerivedS> &sol3D_combed);
  56. //Wrapper with only the mesh as input
  57. template <typename DerivedV, typename DerivedF, typename DerivedS, typename DerivedM, typename DerivedC>
  58. IGL_INLINE void polyvector_field_comb_from_matchings_and_cuts(
  59. const Eigen::PlainObjectBase<DerivedV> &V,
  60. const Eigen::PlainObjectBase<DerivedF> &F,
  61. const Eigen::PlainObjectBase<DerivedS> &sol3D,
  62. const Eigen::PlainObjectBase<DerivedM> &match_ab,
  63. const Eigen::PlainObjectBase<DerivedM> &match_ba,
  64. const Eigen::PlainObjectBase<DerivedC> &cuts,
  65. Eigen::PlainObjectBase<DerivedS> &sol3D_combed);
  66. };
  67. #ifndef IGL_STATIC_LIBRARY
  68. #include "polyvector_field_comb_from_matchings_and_cuts.cpp"
  69. #endif
  70. #endif /* defined(IGL_POLYVECTOR_FIELD_COMB_FROM_MATCHINGS_AND_CUTS) */