1+ #include " default_types.h"
2+ #include < igl/curved_hessian_energy.h>
3+ #include < nanobind/nanobind.h>
4+ #include < nanobind/ndarray.h>
5+ #include < nanobind/eigen/dense.h>
6+ #include < nanobind/eigen/sparse.h>
7+ #include < nanobind/stl/tuple.h>
8+
9+ namespace nb = nanobind;
10+ using namespace nb ::literals;
11+
12+ namespace pyigl
13+ {
14+ auto curved_hessian_energy (
15+ const nb::DRef<const Eigen::MatrixXN> &V,
16+ const nb::DRef<const Eigen::MatrixXI> &F)
17+ {
18+ Eigen::SparseMatrixN Q;
19+ igl::curved_hessian_energy (V,F,Q);
20+ return Q;
21+ }
22+
23+ }
24+
25+ // Bind the wrapper to the Python module
26+ void bind_curved_hessian_energy (nb::module_ &m)
27+ {
28+ m.def (
29+ " curved_hessian_energy" ,
30+ &pyigl::curved_hessian_energy,
31+ " V" _a,
32+ " F" _a,
33+ R"( Computes the curved Hessian energy using the Crouzeix-Raviart discretization.
34+ See Oded Stein, Alec Jacobson, Max Wardetzky, Eitan Grinspun, 2020.
35+ "A Smoothness Energy without Boundary Distortion for Curved Surfaces"
36+
37+ @tparam DerivedV derived type of eigen matrix for V (e.g. derived from
38+ MatrixXd)
39+ @tparam DerivedF derived type of eigen matrix for F (e.g. derived from
40+ MatrixXi)
41+ @tparam Scalar scalar type for eigen sparse matrix (e.g. double)
42+ @param[in] V #V by dim list of mesh vertex positions
43+ @param[in] F #F by 3 list of mesh elements (must be triangles)
44+ @param[out] Q #V by #V Hessian energy matrix, each row/column i corresponding to V(i,:)" );
45+
46+ }
0 commit comments