#include #include #include #include #include #include #include #include #include template IGL_INLINE double igl::polyvector_field_poisson_reconstruction( const Eigen::PlainObjectBase &Vcut, const Eigen::PlainObjectBase &Fcut, const Eigen::PlainObjectBase &sol3D_combed, Eigen::PlainObjectBase &scalars, Eigen::PlainObjectBase &sol3D_recon, Eigen::PlainObjectBase &max_error ) { Eigen::SparseMatrix gradMatrix; igl::grad(Vcut, Fcut, gradMatrix); Eigen::VectorXd FAreas; igl::doublearea(Vcut, Fcut, FAreas); FAreas = FAreas.array() * .5; int nf = FAreas.rows(); Eigen::SparseMatrix M,M1; Eigen::VectorXi II = igl::colon(0, nf-1); igl::sparse(II, II, FAreas, M1); igl::repdiag(M1, 3, M) ; int half_degree = sol3D_combed.cols()/3; sol3D_recon.setZero(sol3D_combed.rows(),sol3D_combed.cols()); int numF = Fcut.rows(); scalars.setZero(Vcut.rows(),half_degree); Eigen::SparseMatrix Q = gradMatrix.transpose()* M *gradMatrix; //fix one point at Ik=fix, value at fixed xk=0 int fix = 0; Eigen::VectorXi Ik(1);Ik<(0, fix-1), igl::colon(fix+1,Vcut.rows()-1); Eigen::SparseMatrix Quu, Quk; igl::slice(Q, Iu, Iu, Quu); igl::slice(Q, Iu, Ik, Quk); Eigen::SimplicialLDLT > solver; solver.compute(Quu); Eigen::VectorXd vec; vec.setZero(3*numF,1); for (int i =0; i()); } return max_error.mean(); } #ifdef IGL_STATIC_LIBRARY // Explicit template specialization template double igl::polyvector_field_poisson_reconstruction, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif