| 179 | |
| 180 | |
| 181 | int main(int argc, char** argv) { |
| 182 | |
| 183 | // Configure the argument parser |
| 184 | args::ArgumentParser parser("15-458 HW4"); |
| 185 | args::Positional<std::string> inputFilename(parser, "mesh", "A mesh file."); |
| 186 | |
| 187 | // Parse args |
| 188 | try { |
| 189 | parser.ParseCLI(argc, argv); |
| 190 | } catch (args::Help&) { |
| 191 | std::cout << parser; |
| 192 | return 0; |
| 193 | } catch (args::ParseError& e) { |
| 194 | std::cerr << e.what() << std::endl; |
| 195 | std::cerr << parser; |
| 196 | return 1; |
| 197 | } |
| 198 | |
| 199 | // If a mesh name was not given, use default mesh. |
| 200 | std::string filepath = "../../../input/face.obj"; |
| 201 | if (inputFilename) { |
| 202 | filepath = args::get(inputFilename); |
| 203 | } |
| 204 | |
| 205 | MESHNAME = polyscope::guessNiceNameFromPath(filepath); |
| 206 | |
| 207 | // Load mesh |
| 208 | std::tie(mesh_uptr, geometry_uptr) = readManifoldSurfaceMesh(filepath); |
| 209 | mesh = mesh_uptr.release(); |
| 210 | geometry = geometry_uptr.release(); |
| 211 | |
| 212 | if (mesh->nBoundaryLoops() == 0) { |
| 213 | std::cerr << "Please load a mesh with at least 1 boundary loop" << std::endl; |
| 214 | return EXIT_SUCCESS; |
| 215 | } |
| 216 | |
| 217 | // Visualization stuff |
| 218 | CoM = geometry->centerOfMass(); |
| 219 | geometry->normalize(CoM, true); // rescale to unit radius |
| 220 | |
| 221 | // Initialize polyscope |
| 222 | polyscope::init(); |
| 223 | |
| 224 | // Set the callback function |
| 225 | polyscope::state::userCallback = functionCallback; |
| 226 | |
| 227 | // Add mesh to GUI |
| 228 | psMesh = polyscope::registerSurfaceMesh(MESHNAME, geometry->inputVertexPositions, mesh->getFaceVertexList(), |
| 229 | polyscopePermutations(*mesh)); |
| 230 | |
| 231 | // Set up mesh for viewing |
| 232 | flipZ(); |
| 233 | psMesh->setSmoothShade(true); |
| 234 | psMesh->setSurfaceColor({1.0, 0.45, 0.0}); // orange |
| 235 | |
| 236 | initializeParameterizations(); |
| 237 | addCheckerboard(SCP_FLATTENING); |
| 238 |
nothing calls this directly
no test coverage detected