lscm.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2023 Alec Jacobson
  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_SPECTRA_LSCM_H
  9. #define IGL_SPECTRA_LSCM_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. namespace spectra
  16. {
  17. /// Compute a free-boundary least-squares conformal map parametrization. Equivalently
  18. /// derived in "Intrinsic Parameterizations of Surface Meshes" [Desbrun et al.
  19. /// 2002] and "Least Squares Conformal Maps for Automatic Texture Atlas
  20. /// Generation" [Lévy et al. 2002], though this implementation follows the
  21. /// derivation in: "Spectral Conformal Parameterization" [Mullen et al. 2008]
  22. /// Free boundary version. "Spectral Conformal Parameterization" using Eigen
  23. /// decomposition. Assumes mesh is a single connected component topologically
  24. /// equivalent to a chunk of the plane.
  25. ///
  26. ///
  27. /// @param[in] V #V by 3 list of mesh vertex positions
  28. /// @param[in] F #F by 3 list of mesh faces (must be triangles)
  29. /// @param[out] UV #V by 2 list of 2D mesh vertex positions in UV space
  30. /// @return true only on solver success.
  31. ///
  32. template <
  33. typename DerivedV,
  34. typename DerivedF,
  35. typename DerivedV_uv>
  36. IGL_INLINE bool lscm(
  37. const Eigen::MatrixBase<DerivedV> & V,
  38. const Eigen::MatrixBase<DerivedF> & F,
  39. Eigen::PlainObjectBase<DerivedV_uv> & V_uv);
  40. }
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "lscm.cpp"
  44. #endif
  45. #endif