curved_hessian_energy.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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_CURVED_HESSIAN_ENERGY_H
  9. #define IGL_CURVED_HESSIAN_ENERGY_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. /// Computes the curved Hessian energy using the Crouzeix-Raviart
  16. /// discretization.
  17. /// See Oded Stein, Alec Jacobson, Max Wardetzky, Eitan Grinspun, 2020.
  18. /// "A Smoothness Energy without Boundary Distortion for Curved Surfaces"
  19. ///
  20. /// @param[in] V #V by 3 list of mesh vertex positions
  21. /// @param[in] F #F by 3 list of mesh faces (must be triangles)
  22. /// @param[out] Q #V by #V Hessian energy matrix
  23. template <typename DerivedV, typename DerivedF, typename ScalarQ>
  24. IGL_INLINE void
  25. curved_hessian_energy(
  26. const Eigen::MatrixBase<DerivedV>& V,
  27. const Eigen::MatrixBase<DerivedF>& F,
  28. Eigen::SparseMatrix<ScalarQ>& Q);
  29. /// Computes the curved Hessian energy using the Crouzeix-Raviart
  30. /// discretization.
  31. /// See Oded Stein, Alec Jacobson, Max Wardetzky, Eitan Grinspun, 2020.
  32. /// "A Smoothness Energy without Boundary Distortion for Curved Surfaces"
  33. ///
  34. /// @param[in] V #V by 3 list of mesh vertex positions
  35. /// @param[in] F #F by 3 list of mesh faces (must be triangles)
  36. /// @param[in] E #F by 3 a mapping from each halfedge to each edge
  37. /// @param[in] oE #F by 3 the orientation (e.g., -1 or 1) of each halfedge
  38. /// @param[out] Q #V by #V Hessian energy matrix
  39. template <typename DerivedV, typename DerivedF, typename DerivedE,
  40. typename DerivedOE, typename ScalarQ>
  41. IGL_INLINE void
  42. curved_hessian_energy(
  43. const Eigen::MatrixBase<DerivedV>& V,
  44. const Eigen::MatrixBase<DerivedF>& F,
  45. const Eigen::MatrixBase<DerivedE>& E,
  46. const Eigen::MatrixBase<DerivedOE>& oE,
  47. Eigen::SparseMatrix<ScalarQ>& Q);
  48. /// Computes the curved Hessian energy using the Crouzeix-Raviart
  49. /// discretization.
  50. /// See Oded Stein, Alec Jacobson, Max Wardetzky, Eitan Grinspun, 2020.
  51. /// "A Smoothness Energy without Boundary Distortion for Curved Surfaces"
  52. ///
  53. /// @param[in] V #V by 3 list of mesh vertex positions
  54. /// @param[in] F #F by 3 list of mesh faces (must be triangles)
  55. /// @param[out] E #F by 3 a mapping from each halfedge to each edge
  56. /// @param[out] oE #F by 3 the orientation (e.g., -1 or 1) of each halfedge
  57. /// @param[out] Q #V by #V Hessian energy matrix
  58. template <typename DerivedV, typename DerivedF, typename DerivedE,
  59. typename DerivedOE, typename ScalarQ>
  60. IGL_INLINE void
  61. curved_hessian_energy(
  62. const Eigen::MatrixBase<DerivedV>& V,
  63. const Eigen::MatrixBase<DerivedF>& F,
  64. Eigen::PlainObjectBase<DerivedE>& E,
  65. Eigen::PlainObjectBase<DerivedOE>& oE,
  66. Eigen::SparseMatrix<ScalarQ>& Q);
  67. /// Computes the curved Hessian energy using the Crouzeix-Raviart
  68. /// discretization.
  69. /// See Oded Stein, Alec Jacobson, Max Wardetzky, Eitan Grinspun, 2020.
  70. /// "A Smoothness Energy without Boundary Distortion for Curved Surfaces"
  71. ///
  72. /// @param[in] F #F by 3 list of mesh face indices into rows of V
  73. /// @param[in] l_sq #F by 3 list of squared edge lengths of each halfedge
  74. /// @param[in] E #F by 3 a mapping from each halfedge to each edge
  75. /// @param[in] oE #F by 3 the orientation (e.g., -1 or 1) of each halfedge
  76. /// compared to the orientation of the actual edge, as computed with
  77. /// orient_halfedges. will be computed if not provided.
  78. /// @param[out] Q #V by #V Hessian energy matrix
  79. template <typename DerivedF, typename DerivedL_sq, typename DerivedE,
  80. typename DerivedOE, typename ScalarQ>
  81. IGL_INLINE void
  82. curved_hessian_energy_intrinsic(
  83. const Eigen::MatrixBase<DerivedF>& F,
  84. const Eigen::MatrixBase<DerivedL_sq>& l_sq,
  85. const Eigen::MatrixBase<DerivedE>& E,
  86. const Eigen::MatrixBase<DerivedOE>& oE,
  87. Eigen::SparseMatrix<ScalarQ>& Q);
  88. /// Computes the curved Hessian energy using the Crouzeix-Raviart
  89. /// discretization.
  90. /// See Oded Stein, Alec Jacobson, Max Wardetzky, Eitan Grinspun, 2020.
  91. /// "A Smoothness Energy without Boundary Distortion for Curved Surfaces"
  92. ///
  93. /// @param[in] F #F by 3 list of mesh face indices into rows of V
  94. /// @param[in] l_sq #F by 3 list of squared edge lengths of each halfedge
  95. /// @param[in] dA #F list of double areas
  96. /// @param[in] E #F by 3 a mapping from each halfedge to each edge
  97. /// @param[in] oE #F by 3 the orientation (e.g., -1 or 1) of each halfedge
  98. /// compared to the orientation of the actual edge, as computed with
  99. /// orient_halfedges. will be computed if not provided.
  100. /// @param[out] Q #V by #V Hessian energy matrix
  101. template <typename DerivedF, typename DerivedL_sq, typename DeriveddA,
  102. typename DerivedE, typename DerivedOE, typename ScalarQ>
  103. IGL_INLINE void
  104. curved_hessian_energy_intrinsic(
  105. const Eigen::MatrixBase<DerivedF>& F,
  106. const Eigen::MatrixBase<DerivedL_sq>& l_sq,
  107. const Eigen::MatrixBase<DeriveddA>& dA,
  108. const Eigen::MatrixBase<DerivedE>& E,
  109. const Eigen::MatrixBase<DerivedOE>& oE,
  110. Eigen::SparseMatrix<ScalarQ>& Q);
  111. }
  112. #ifndef IGL_STATIC_LIBRARY
  113. # include "curved_hessian_energy.cpp"
  114. #endif
  115. #endif