#include #include #include #include #include #include #include // Mesh Eigen::MatrixXd V; Eigen::MatrixXi F; // Constrained faces id Eigen::VectorXi b; // Cosntrained faces representative vector Eigen::MatrixXd bc; // Degree of the N-RoSy field int N = 4; // Converts a representative vector per face in the full set of vectors that describe // an N-RoSy field void representative_to_nrosy( const Eigen::MatrixXd& V, const Eigen::MatrixXi& F, const Eigen::MatrixXd& R, const int N, Eigen::MatrixXd& Y) { using namespace Eigen; using namespace std; MatrixXd B1, B2, B3; igl::local_basis(V,F,B1,B2,B3); Y.resize(F.rows()*N,3); for (unsigned i=0;i 0.001) viewer.data().add_points(V.row(i),RowVector3d(1,0,0)); } // Highlight in red the constrained faces MatrixXd C = MatrixXd::Constant(F.rows(),3,1); for (unsigned i=0; i= '1' && key <= '9') N = key - '0'; MatrixXd R; VectorXd S; igl::copyleft::comiso::nrosy(V,F,b,bc,VectorXi(),VectorXd(),MatrixXd(),N,0.5,R,S); plot_mesh_nrosy(viewer,V,F,N,R,S,b); return false; } int main(int argc, char *argv[]) { using namespace std; using namespace Eigen; // Load a mesh in OFF format igl::readOFF(TUTORIAL_SHARED_PATH "/bumpy.off", V, F); // Threshold faces with high anisotropy b.resize(1); b << 0; bc.resize(1,3); bc << 1,1,1; igl::opengl::glfw::Viewer viewer; // Interpolate the field and plot key_down(viewer, '4', 0); // Plot the mesh viewer.data().set_mesh(V, F); viewer.callback_key_down = &key_down; // Disable wireframe viewer.data().show_lines = false; // Launch the viewer viewer.launch(); }