#include #include #include #include #include #include #include #include #include #include igl::opengl::glfw::Viewer viewer; Eigen::MatrixXd V; std::vector C(2); std::vector RGBcolors(2); Eigen::MatrixXi F; std::vector FF(2); bool is_showing_reoriented = false; bool facetwise = false; int main(int argc, char * argv[]) { using namespace std; cout<()/(double)C[pass].maxCoeff(); HSV.rightCols(2).setConstant(1.0); igl::hsv_to_rgb(HSV,RGBcolors[pass]); } viewer.data().set_colors(RGBcolors[facetwise]); }; viewer.callback_key_pressed = [&scramble_colors] (igl::opengl::glfw::Viewer& /*viewer*/, unsigned int key, int mod)->bool { switch(key) { default: return false; case 'F': case 'f': { facetwise = !facetwise; break; } case 'S': case 's': { scramble_colors(); return true; } case ' ': { is_showing_reoriented = !is_showing_reoriented; break; } } viewer.data().clear(); viewer.data().set_mesh(V,is_showing_reoriented?FF[facetwise]:F); viewer.data().set_colors(RGBcolors[facetwise]); return true; }; // Compute patches for(int pass = 0;pass<2;pass++) { Eigen::VectorXi I; igl::embree::reorient_facets_raycast( V,F,F.rows()*100,10,pass==1,false,false,I,C[pass]); // apply reorientation FF[pass].conservativeResize(F.rows(),F.cols()); for(int i = 0;i