cr_vector_laplacian.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 Oded Stein <[email protected]>
  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_CR_VECTOR_LAPLACIAN_H
  9. #define IGL_CR_VECTOR_LAPLACIAN_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. /// Computes the CR vector Laplacian matrix.
  16. /// See Oded Stein, Max Wardetzky, Alec Jacobson, Eitan Grinspun, 2020.
  17. /// "A Simple Discretization of the Vector Dirichlet Energy"
  18. ///
  19. /// @param[in] V #V by 3 list of mesh vertex positions
  20. /// @param[in] F #F by 3 list of mesh face indices into rows of V
  21. /// @param[in] E #F by 3 a mapping from each halfedge to each edge
  22. /// @param[in] oE #F by 3 the orientation (e.g., -1 or 1) of each halfedge
  23. /// compared to the orientation of the actual edge, as computed with
  24. /// orient_halfedges. will be computed if not provided.
  25. /// @param[out] L 2*|HE| by 2*|HE| computed Laplacian matrix
  26. template <typename DerivedV, typename DerivedF, typename DerivedE,
  27. typename DerivedOE, typename ScalarL>
  28. IGL_INLINE void
  29. cr_vector_laplacian(
  30. const Eigen::MatrixBase<DerivedV>& V,
  31. const Eigen::MatrixBase<DerivedF>& F,
  32. const Eigen::MatrixBase<DerivedE>& E,
  33. const Eigen::MatrixBase<DerivedOE>& oE,
  34. Eigen::SparseMatrix<ScalarL>& L);
  35. /// \overload
  36. ///
  37. /// \brief `E` and `oE` are computed and output.
  38. template <typename DerivedV, typename DerivedF, typename DerivedE,
  39. typename DerivedOE, typename ScalarL>
  40. IGL_INLINE void
  41. cr_vector_laplacian(
  42. const Eigen::MatrixBase<DerivedV>& V,
  43. const Eigen::MatrixBase<DerivedF>& F,
  44. Eigen::PlainObjectBase<DerivedE>& E,
  45. Eigen::PlainObjectBase<DerivedOE>& oE,
  46. Eigen::SparseMatrix<ScalarL>& L);
  47. /// \overload
  48. /// \brief intrinsic version.
  49. ///
  50. /// @param[in] l_sq #F by 3 list of squared edge lengths of each halfedge
  51. /// @param[in] dA #F list of double areas
  52. ///
  53. /// \fileinfo
  54. template <typename DerivedF, typename DerivedL_sq, typename DeriveddA,
  55. typename DerivedE, typename DerivedOE, typename ScalarL>
  56. IGL_INLINE void
  57. cr_vector_laplacian_intrinsic(
  58. const Eigen::MatrixBase<DerivedF>& F,
  59. const Eigen::MatrixBase<DerivedL_sq>& l_sq,
  60. const Eigen::MatrixBase<DeriveddA>& dA,
  61. const Eigen::MatrixBase<DerivedE>& E,
  62. const Eigen::MatrixBase<DerivedOE>& oE,
  63. Eigen::SparseMatrix<ScalarL>& L);
  64. /// \overload
  65. /// \fileinfo
  66. template <typename DerivedF, typename DerivedL_sq, typename DerivedE,
  67. typename DerivedOE, typename ScalarL>
  68. IGL_INLINE void
  69. cr_vector_laplacian_intrinsic(
  70. const Eigen::MatrixBase<DerivedF>& F,
  71. const Eigen::MatrixBase<DerivedL_sq>& l_sq,
  72. const Eigen::MatrixBase<DerivedE>& E,
  73. const Eigen::MatrixBase<DerivedOE>& oE,
  74. Eigen::SparseMatrix<ScalarL>& L);
  75. }
  76. #ifndef IGL_STATIC_LIBRARY
  77. # include "cr_vector_laplacian.cpp"
  78. #endif
  79. #endif