seam_edges.h 3.0 KB

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