#include #include #include #include #include #include #include #include #include #include "tutorial_shared_path.h" Eigen::MatrixXd V,U; Eigen::MatrixXi F; int c=0; double bbd = 1; bool twod = 0; int main(int argc, char * argv[]) { using namespace Eigen; using namespace std; using namespace igl; VectorXd D; if(!read_triangle_mesh(TUTORIAL_SHARED_PATH "/beetle.off",V,F)) { cout<<"failed to load mesh"< L,M; cotmatrix(V,F,L); L = (-L).eval(); massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,M); const size_t k = 5; if(!eigs(L,M,k+1,EIGS_TYPE_SM,U,D)) { cout<<"failed."<bool { switch(key) { default: return false; case ' ': { U = U.rightCols(k).eval(); // Rescale eigen vectors for visualization VectorXd Z = bbd*0.5*U.col(c); Eigen::MatrixXd C; igl::parula(U.col(c).eval(),false,C); c = (c+1)%U.cols(); if(twod) { V.col(2) = Z; } viewer.data.set_mesh(V,F); viewer.data.compute_normals(); viewer.data.set_colors(C); return true; } } }; viewer.callback_key_down(viewer,' ',0); viewer.core.show_lines = false; viewer.launch(); }