lscm_hessian.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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. #include "lscm_hessian.h"
  9. #include "vector_area_matrix.h"
  10. #include "cotmatrix.h"
  11. #include "repdiag.h"
  12. template <typename DerivedV, typename DerivedF, typename QScalar>
  13. void igl::lscm_hessian(
  14. const Eigen::MatrixBase<DerivedV> & V,
  15. const Eigen::MatrixBase<DerivedF> & F,
  16. Eigen::SparseMatrix<QScalar> & Q)
  17. {
  18. // Assemble the area matrix (note that A is #Vx2 by #Vx2)
  19. Eigen::SparseMatrix<QScalar> A;
  20. igl::vector_area_matrix(F,A);
  21. // Assemble the cotan laplacian matrix
  22. Eigen::SparseMatrix<QScalar> L;
  23. igl::cotmatrix(V,F,L);
  24. Eigen::SparseMatrix<QScalar> L_flat;
  25. igl::repdiag(L,2,L_flat);
  26. Q = -L_flat - 2.*A;
  27. }
  28. #ifdef IGL_STATIC_LIBRARY
  29. // Explicit template instantiation
  30. // generated by autoexplicit.sh
  31. template void igl::lscm_hessian<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
  32. #endif