int main(int argc, char *argv[]) { if (argc != 1) { err_msg("Usage: %s < input.sm", argv[0]); return 1; } BMESHptr mesh = BMESH::read_jot_stream(cin); if (!mesh || mesh->empty()) return 1; // didn't work mesh->print(); return 0; }
int main(int argc, char *argv[]) { if (argc != 1) { err_msg("Usage: %s < mesh.sm > mesh.iv", argv[0]); return 1; } BMESHptr mesh = BMESH::read_jot_stream(cin); if (!mesh || mesh->empty()) return 1; // didn't work // Write it out write_mesh(*mesh, cout); return 0; }
int main(int argc, char *argv[]) { // See note above about -c option: bool do_components = false; if (argc == 2 && string(argv[1]) == string("-c")) { do_components = true; } else if (argc != 1) { err_msg("Usage: %s [ -c ] < input.sm > output.sm", argv[0]); return 1; } BMESHptr mesh = BMESH::read_jot_stream(cin); if (!mesh || mesh->empty()) return 1; // didn't work if (do_components) { // Reverse separate components as needed: bool changed = false; vector<Bface_list> components = mesh->get_components(); for (auto & component : components) { if (component.volume() < 0) { err_msg("reversing component: %d faces", component.size()); reverse_faces(component); changed = true; } } if (changed) { mesh->changed(); } else { err_msg("%s: nothing changed", argv[0]); } } else { // Do the whole thing mesh->reverse(); } mesh->write_stream(cout); return 0; }
int main(int argc, char *argv[]) { if (argc != 1) { cerr << "Usage: " << argv[0] << " < input.sm > output.sm" << endl; return 1; } BMESHptr mesh = BMESH::read_jot_stream(cin); if (!mesh || mesh->empty()) return 1; // didn't work Wtransf xf = compute_xf(mesh->verts().pts()); MOD::tick(); mesh->transform(xf, MOD()); mesh->write_stream(cout); return 0; }
int main(int argc, char *argv[]) { // -s option writes "simple" format, meaning faces are written as: // // f 1 3 2 // // instead of: // // f 1//1 3//3 2//2 bool do_simple = false; if (argc == 2 && string(argv[1]) == "-s") { do_simple = true; } else if (argc != 1) { err_msg("Usage: %s [ -s ] < input.sm > output.sm", argv[0]); return 1; } BMESHptr mesh = BMESH::read_jot_stream(cin); if (!mesh || mesh->empty()) return 1; // didn't work if (Config::get_var_bool("JOT_RECENTER")) mesh->recenter(); if (Config::get_var_bool("JOT_PRINT_MESH")) mesh->print(); // write verts write_verts(*mesh, cout); // write faces write_faces(*mesh, cout, do_simple); return 0; }
int main(int argc, char *argv[]) { if (argc != 1) { err_msg("Usage: %s < input.sm > output.sm", argv[0]); return 1; } BMESHptr mesh = BMESH::read_jot_stream(cin); if (!mesh || mesh->empty()) return 1; // didn't work // Remove duplicate vertices mesh->remove_duplicate_vertices(false); // don't keep the bastards if (Config::get_var_bool("JOT_PRINT_MESH")) mesh->print(); color_verts(mesh->verts()); mesh->write_stream(cout); return 0; }