#include "catmull_clark.h" #include "QuadViewer.h" #include //#include int main(int argc, char * argv[]) { // parse command line arguments std::string path_to_obj; if (argc == 2) { std::string args = argv[1]; // check if ends with .obj if (args.size() > 4 && args.substr(args.size() - 3, 3) == "obj") { path_to_obj = args; } } if (argc != 2 || path_to_obj.empty()) { printf( "Error: received unexpected command line arguments. \n" "Correct usage: \n" " Linux: ./quad_subdivision \n" " Windows: quad_subdivision.exe \n" "For example: \n" " Linux: ./quad_subdivision ../data/cube.obj \n" " Windows: quad_subdivision.exe ../../../data/cube.obj \n" ); return -1; } Eigen::MatrixXd V; Eigen::MatrixXi F; igl::readOBJ(path_to_obj,V,F); if(F.cols() != 4 || F.minCoeff()<0) { std::cerr<<"Error: only pure quad meshes supported."<bool { switch(key) { default: return false; case 'R': case 'r': // reset to input mesh V = OV; F = OF; v.set_mesh(V,F); break; case '3': // carry out three subdivisions catmull_clark(Eigen::MatrixXd(V),Eigen::MatrixXi(F),3,V,F); v.set_mesh(V,F); break; case ' ': // carry out one subdivision catmull_clark(Eigen::MatrixXd(V),Eigen::MatrixXi(F),1,V,F); v.set_mesh(V,F); break; } return true; }; v.launch(); }