lscm.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. //
  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_LSCM_H
  9. #define IGL_LSCM_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. // Compute a Least-squares conformal map parametrization following the algorithm
  16. // presented in: Spectral Conformal Parameterization,
  17. // Patrick Mullen, Yiying Tong, Pierre Alliez and Mathieu Desbrun
  18. //
  19. // Inputs:
  20. // V #V by 3 list of mesh vertex positions
  21. // F #F by 3 list of mesh faces (must be triangles)
  22. // b #b boundary indices into V
  23. // bc #b by 3 list of boundary values
  24. // Outputs:
  25. // UV #V by 2 list of 2D mesh vertex positions in UV space
  26. //
  27. // X Note: if b and bc are empty, lscm automatically removes the null space
  28. // X by fixing two farthest points on the boundary
  29. // Boundary conditions are part of the api. It would be strange to secretly
  30. // use other boundary conditions. This is also weird if there's more than one
  31. // boundary loop.
  32. // X Note: (V,F) must be a genus-0 mesh, with a single boundary
  33. // No longer the case. Should probably just be manifold.
  34. IGL_INLINE void lscm(
  35. const Eigen::MatrixXd& V,
  36. const Eigen::MatrixXi& F,
  37. const Eigen::VectorXi& b,
  38. const Eigen::MatrixXd& bc,
  39. Eigen::MatrixXd& V_uv);
  40. }
  41. #ifndef IGL_STATIC_LIBRARY
  42. # include "lscm.cpp"
  43. #endif
  44. #endif