MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / main

Function main

Tools/SurfaceSampling/main.cpp:39–175  ·  view source on GitHub ↗

main

Source from the content-addressed store, hash-verified

37
38// main
39int main( int argc, char **argv )
40{
41 REPORT_MEMORY_LEAKS;
42
43 std::cout << "Git refspec: " << GIT_REFSPEC << std::endl;
44 std::cout << "Git SHA1: " << GIT_SHA1 << std::endl;
45 std::cout << "Git status: " << GIT_LOCAL_STATUS << std::endl;
46
47 try
48 {
49 cxxopts::Options options(argv[0], "SurfaceSampling - Sample a surface geometry given by an OBJ file.");
50
51 options.add_options()
52 ("h,help", "Print help")
53 ("i,input", "Input file (obj or ply)", cxxopts::value<std::string>())
54 ("o,output", "Output file (bgeo)", cxxopts::value<std::string>())
55 ("r,radius", "Particle radius", cxxopts::value<Real>()->default_value("0.025"))
56 ("s,scale", "Scaling of input geometry (e.g. --scale 1,2,3)", cxxopts::value<std::vector<Real>>())
57 ("m,mode", "Sampling mode 0 Poisson disk, 1 Regular, 2 2D sampling", cxxopts::value<unsigned int>()->default_value("1"))
58 ("t,translation", "Translation for 2D sampling (default: 0,0,0)", cxxopts::value<std::vector<Real>>())
59 ("rotationAxis", "Rotation axis for 2D sampling (default: 0,1,0)", cxxopts::value<std::vector<Real>>())
60 ("a,angle", "Rotation angle for 2D simulation", cxxopts::value<Real>()->default_value("0"))
61 ;
62
63 auto result = options.parse(argc, argv);
64
65 if (result.count("help"))
66 {
67 std::cout << options.help({ "", "Group" }) << std::endl;
68 exit(0);
69 }
70
71 if (result.count("input") && result.count("output"))
72 {
73 inputFile = result["input"].as<std::string>();
74 std::cout << "Input = " << inputFile << std::endl;
75 outputFile = result["output"].as<std::string>();
76 std::cout << "Output = " << outputFile << std::endl;
77 }
78 else
79 {
80 std::cout << "Input or output missing!" << std::endl;
81 std::cout << options.help({ "", "Group" }) << std::endl;
82 exit(1);
83 }
84
85 if (result.count("radius"))
86 particleRadius = result["radius"].as<Real>();
87 std::cout << "Radius: " << particleRadius << std::endl;
88
89 if (result.count("scale"))
90 scale = Vector3r(result["scale"].as<std::vector<Real>>().data());
91 std::cout << "Scale: [" << scale.transpose() << "]^T" << std::endl;
92
93 if (result.count("mode"))
94 samplingMode = result["mode"].as<unsigned int>();
95 std::cout << "Sampling mode: " << samplingMode << std::endl;
96

Callers

nothing calls this directly

Calls 13

add_optionsMethod · 0.80
default_valueMethod · 0.80
helpMethod · 0.80
numVerticesMethod · 0.80
numFacesMethod · 0.80
parseMethod · 0.45
countMethod · 0.45
dataMethod · 0.45
transposeMethod · 0.45
whatMethod · 0.45
sampleMeshMethod · 0.45
toRotationMatrixMethod · 0.45

Tested by

no test coverage detected