seam_edges.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Yotam Gingold <yotam@yotamgingold.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_SEAM_EDGES_H
  9. #define IGL_SEAM_EDGES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Finds all UV-space boundaries of a mesh.
  15. //
  16. // Inputs:
  17. // V #V by dim list of positions of the input mesh.
  18. // TC #TC by 2 list of 2D texture coordinates of the input mesh
  19. // F #F by 3 list of triange indices into V representing a
  20. // manifold-with-boundary triangle mesh
  21. // FTC #F by 3 list of indices into TC for each corner
  22. // Outputs:
  23. // seams Edges where the forwards and backwards directions have different
  24. // texture coordinates, as a #seams-by-4 matrix of indices. Each row is
  25. // organized as [ forward_face_index, forward_face_vertex_index,
  26. // backwards_face_index, backwards_face_vertex_index ] such that one side
  27. // of the seam is the edge:
  28. // F[ seams( i, 0 ), seams( i, 1 ) ], F[ seams( i, 0 ), (seams( i, 1 ) + 1) % 3 ]
  29. // and the other side is the edge:
  30. // F[ seams( i, 2 ), seams( i, 3 ) ], F[ seams( i, 2 ), (seams( i, 3 ) + 1) % 3 ]
  31. // boundaries Edges with only one incident triangle, as a #boundaries-by-2
  32. // matrix of indices. Each row is organized as
  33. // [ face_index, face_vertex_index ]
  34. // such that the edge is:
  35. // F[ boundaries( i, 0 ), boundaries( i, 1 ) ], F[ boundaries( i, 0 ), (boundaries( i, 1 ) + 1) % 3 ]
  36. // foldovers Edges where the two incident triangles fold over each other
  37. // in UV-space, as a #foldovers-by-4 matrix of indices.
  38. // Each row is organized as [ forward_face_index, forward_face_vertex_index,
  39. // backwards_face_index, backwards_face_vertex_index ]
  40. // such that one side of the foldover is the edge:
  41. // F[ foldovers( i, 0 ), foldovers( i, 1 ) ], F[ foldovers( i, 0 ), (foldovers( i, 1 ) + 1) % 3 ]
  42. // and the other side is the edge:
  43. // F[ foldovers( i, 2 ), foldovers( i, 3 ) ], F[ foldovers( i, 2 ), (foldovers( i, 3 ) + 1) % 3 ]
  44. template <
  45. typename DerivedV,
  46. typename DerivedTC,
  47. typename DerivedF,
  48. typename DerivedFTC,
  49. typename Derivedseams,
  50. typename Derivedboundaries,
  51. typename Derivedfoldovers>
  52. IGL_INLINE void seam_edges(
  53. const Eigen::PlainObjectBase<DerivedV>& V,
  54. const Eigen::PlainObjectBase<DerivedTC>& TC,
  55. const Eigen::PlainObjectBase<DerivedF>& F,
  56. const Eigen::PlainObjectBase<DerivedFTC>& FTC,
  57. Eigen::PlainObjectBase<Derivedseams>& seams,
  58. Eigen::PlainObjectBase<Derivedboundaries>& boundaries,
  59. Eigen::PlainObjectBase<Derivedfoldovers>& foldovers);
  60. }
  61. #ifndef IGL_STATIC_LIBRARY
  62. # include "seam_edges.cpp"
  63. #endif
  64. #endif