straighten_seams.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef IGL_STRAIGHTEN_SEAMS_H
  2. #define IGL_STRAIGHTEN_SEAMS_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // STRAIGHTEN_SEAMS Given a obj-style mesh with (V,F) defining the geometric
  8. // surface of the mesh and (VT,FT) defining the
  9. // parameterization/texture-mapping of the mesh in the uv-domain, find all
  10. // seams and boundaries in the texture-mapping and "straighten" them,
  11. // remapping vertices along the boundary and in the interior. This will be
  12. // careful to consistently straighten multiple seams in the texture-mesh
  13. // corresponding to the same edge chains in the surface-mesh.
  14. //
  15. // [UT] = straighten_seams(V,F,VT,FT)
  16. //
  17. // Inputs:
  18. // V #V by 3 list of vertices
  19. // F #F by 3 list of triangle indices
  20. // VT #VT by 2 list of texture coordinates
  21. // FT #F by 3 list of triangle texture coordinates
  22. // Optional:
  23. // 'Tol' followed by Ramer-Douglas-Peucker tolerance as a fraction of the
  24. // curves bounding box diagonal (see dpsimplify)
  25. // Outputs:
  26. // UE #UE by 2 list of indices into VT of coarse output polygon edges
  27. // UT #VT by 3 list of new texture coordinates
  28. // OT #OT by 2 list of indices into VT of boundary edges
  29. //
  30. // See also: simplify_curve, dpsimplify
  31. template <
  32. typename DerivedV,
  33. typename DerivedF,
  34. typename DerivedVT,
  35. typename DerivedFT,
  36. typename Scalar,
  37. typename DerivedUE,
  38. typename DerivedUT,
  39. typename DerivedOT>
  40. IGL_INLINE void straighten_seams(
  41. const Eigen::MatrixBase<DerivedV> & V,
  42. const Eigen::MatrixBase<DerivedF> & F,
  43. const Eigen::MatrixBase<DerivedVT> & VT,
  44. const Eigen::MatrixBase<DerivedFT> & FT,
  45. const Scalar tol,
  46. Eigen::PlainObjectBase<DerivedUE> & UE,
  47. Eigen::PlainObjectBase<DerivedUT> & UT,
  48. Eigen::PlainObjectBase<DerivedOT> & OT);
  49. }
  50. #ifndef IGL_STATIC_LIBRARY
  51. # include "straighten_seams.cpp"
  52. #endif
  53. #endif