int main(int argc, char** argv) { QApplication application(argc,argv); if(argc!=2){ cout << "One argument necessary, given: " << (argc-1) << endl; return EXIT_FAILURE; } SurfaceMesh mesh; bool ok = mesh.read(argv[1]); if(!ok){ cout << "could not open file: " << argv[1] << endl; return EXIT_FAILURE; } ///--- Preprocess mesh.triangulate(); mesh.update_vertex_normals(); ///--- Shutdown on close GUI QObject::connect(&application, &QApplication::lastWindowClosed, &application, &QApplication::quit); Viewer viewer(mesh); viewer.setWindowTitle("OpenGP/apps/qglviewer"); viewer.show(); return application.exec(); }
/// Entry point int main(int argc, char** argv) { if(argc!=2) mFatal("usage: glfwviewer bunny.obj"); int success = mesh.read(argv[1]); if(!success) mFatal() << "File not found"; mesh.triangulate(); mesh.update_vertex_normals(); cout << "input: '" << argv[1] << "' num vertices " << mesh.vertices_size() << endl; cout << "BBOX: " << bounding_box(mesh) << endl; glfwInitWindowSize(_width, _height); if (glfwMakeWindow(__FILE__) == EXIT_FAILURE) return EXIT_FAILURE; glfwDisplayFunc(display); glfwTrackball(update_matrices, update_projection_matrix); init(); glfwMainLoop(); return EXIT_SUCCESS; }
int main(int argc, char** argv){ if(argc!=3){ cout << "usage:" << endl << "isoremesh bunny.obj remeshed.obj" << endl; return EXIT_FAILURE; } std::string input(argv[1]); std::string output(argv[2]); ///--- Load mesh SurfaceMesh mesh; mesh.read(input); if(mesh.n_vertices()==0){ cout << "Input mesh has 0 vertices" << endl; return EXIT_FAILURE; } ///--- Remesher is only for triangulations! mesh.triangulate(); ///--- Compute bounding box Scalar bbox_diag_length = bounding_box(mesh).diagonal().norm(); cout << "#vertices: " << mesh.n_vertices() << endl; cout << "bbox_diag_length: " << bbox_diag_length << endl; ///--- Perform remeshing IsotropicRemesher remesher(mesh); remesher.num_iterations = 10; remesher.sharp_feature_deg = 45; remesher.longest_edge_length = 0.02*bbox_diag_length; remesher.keep_short_edges = false; remesher.reproject_to_surface = true; remesher.myout = &std::cout; ///< print output to... remesher.execute(); ///--- Write to file mesh.write(output); return EXIT_SUCCESS; }