lscm.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>
  4. // 2015 Alec Jacobson
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla Public License
  7. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  8. // obtain one at http://mozilla.org/MPL/2.0/.
  9. #ifndef IGL_LSCM_H
  10. #define IGL_LSCM_H
  11. #include "igl_inline.h"
  12. #include <Eigen/Dense>
  13. #include <Eigen/Sparse>
  14. namespace igl
  15. {
  16. // Compute a Least-squares conformal map parametrization (equivalently
  17. // derived in "Intrinsic Parameterizations of Surface Meshes" [Desbrun et al.
  18. // 2002] and "Least Squares Conformal Maps for Automatic Texture Atlas
  19. // Generation" [Lévy et al. 2002]), though this implementation follows the
  20. // derivation in: "Spectral Conformal Parameterization" [Mullen et al. 2008]
  21. // (note, this does **not** implement the Eigen-decomposition based method in
  22. // [Mullen et al. 2008], which is not equivalent). Input should be a manifold
  23. // mesh (also no unreferenced vertices) and "boundary" (fixed vertices) `b`
  24. // should contain at least two vertices per connected component.
  25. //
  26. // Inputs:
  27. // V #V by 3 list of mesh vertex positions
  28. // F #F by 3 list of mesh faces (must be triangles)
  29. // b #b boundary indices into V
  30. // bc #b by 3 list of boundary values
  31. // Outputs:
  32. // UV #V by 2 list of 2D mesh vertex positions in UV space
  33. // Returns true only on solver success.
  34. //
  35. IGL_INLINE bool lscm(
  36. const Eigen::MatrixXd& V,
  37. const Eigen::MatrixXi& F,
  38. const Eigen::VectorXi& b,
  39. const Eigen::MatrixXd& bc,
  40. Eigen::MatrixXd& V_uv);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "lscm.cpp"
  44. #endif
  45. #endif