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[]) { 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; }