#undef IGL_STATIC_LIBRARY #include #include #include #include #include #include #include #include #include // Input mesh Eigen::MatrixXd V; Eigen::MatrixXi F; // Face barycenters Eigen::MatrixXd B; // Scale for visualizing the fields double global_scale; // Input constraints Eigen::VectorXi isConstrained; Eigen::MatrixXd constraints; Eigen::MatrixXd smooth_pvf; Eigen::MatrixXd conjugate_pvf; igl::ConjugateFFSolverData *csdata; int conjIter = 2; int totalConjIter = 0; double lambdaOrtho = .1; double lambdaInit = 100; double lambdaMultFactor = 1.01; bool doHardConstraints = true; bool key_down(igl::Viewer& viewer, unsigned char key, int modifier) { using namespace std; using namespace Eigen; if (key <'1' || key >'3') return false; viewer.clear_mesh(); viewer.set_mesh(V, F); viewer.options.show_lines = false; viewer.options.show_texture = false; // Highlight in red the constrained faces MatrixXd C = MatrixXd::Constant(F.rows(),3,1); for (unsigned i=0; i(); constraints = temp.block(0,1,temp.rows(),temp.cols()-1); // Interpolate to get a smooth field igl::n_polyvector(V, F, isConstrained, constraints, smooth_pvf); // Initialize conjugate field with smooth field csdata = new igl::ConjugateFFSolverData(V,F); conjugate_pvf = smooth_pvf; igl::Viewer viewer; // Plot the original mesh with a texture parametrization key_down(viewer,'1',0); // Launch the viewer viewer.callback_key_down = &key_down; viewer.launch(); }