// Don't use static library for this example because of Mosek complications //#define IGL_NO_MOSEK #ifdef IGL_NO_MOSEK #undef IGL_STATIC_LIBRARY #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef std::vector > RotationList; const Eigen::RowVector3d sea_green(70./255.,252./255.,167./255.); int selected = 0; Eigen::MatrixXd V,W,U,C,M; Eigen::MatrixXi T,F,BE; Eigen::VectorXi P; RotationList pose; double anim_t = 1.0; double anim_t_dir = -0.03; bool pre_draw(igl::Viewer & viewer) { using namespace Eigen; using namespace std; if(viewer.options.is_animating) { // Interpolate pose and identity RotationList anim_pose(pose.size()); for(int e = 0;e vT; igl::forward_kinematics(C,BE,P,anim_pose,vQ,vT); const int dim = C.cols(); MatrixXd T(BE.rows()*(dim+1),dim); for(int e = 0;e=1.0 || anim_t<=0.0?-1.0:1.0); } return false; } void set_color(igl::Viewer &viewer) { Eigen::MatrixXd C; igl::jet(W.col(selected).eval(),true,C); viewer.set_colors(C); } bool key_down(igl::Viewer &viewer, unsigned char key, int mods) { switch(key) { case ' ': viewer.options.is_animating = !viewer.options.is_animating; break; case '.': selected++; selected = std::min(std::max(selected,0),(int)W.cols()-1); set_color(viewer); break; case ',': selected--; selected = std::min(std::max(selected,0),(int)W.cols()-1); set_color(viewer); break; } } int main(int argc, char *argv[]) { using namespace Eigen; using namespace std; igl::readMESH("../shared/hand.mesh",V,T,F); U=V; igl::readTGF("../shared/hand.tgf",C,BE); // retrieve parents for forward kinematics P.resize(BE.rows(),1); for(int e = 0;e