28 #include <console_bridge/console.h>
29 #include <boost/program_options.hpp>
45 int main(
int argc,
char** argv)
52 namespace po = boost::program_options;
53 po::options_description desc(
"Options");
54 desc.add_options()(
"help,h",
"Print help messages")(
55 "input,i", po::value<std::string>(&input)->required(),
"File path to mesh used to create a convex hull.")(
56 "output,o", po::value<std::string>(&output)->required(),
"File path to save the generated convex hull as a ply.")(
58 po::value<double>(&shrink),
59 "If positive, the convex hull is shrunken by that amount (each face is moved by 'shrink' length units towards "
60 "the center along its normal).")(
"clamp,c",
61 po::value<double>(&
clamp),
62 "If positive, 'shrink' is clamped to not exceed 'clamp * innerRadius', where "
63 "'innerRadius' is the minimum distance of a face to the center of the convex "
69 po::store(po::parse_command_line(argc, argv, desc), vm);
72 if (vm.count(
"help") != 0U)
74 std::cout <<
"Basic Command Line Parameter App\n" << desc <<
"\n";
83 std::cerr <<
"ERROR: " << e.what() <<
"\n\n";
84 std::cerr << desc <<
"\n";
88 std::ifstream file(input, std::ios::binary | std::ios::ate);
89 std::streamsize size = file.tellg();
92 CONSOLE_BRIDGE_logError(
"Failed to locate input file!");
97 Eigen::VectorXi mesh_faces;
101 CONSOLE_BRIDGE_logError(
"Failed to read mesh from file!");
106 Eigen::VectorXi ch_faces;
109 if (ch_num_faces < 0)
111 CONSOLE_BRIDGE_logError(
"Failed to create convex hull!");
117 CONSOLE_BRIDGE_logError(
"Failed to write convex hull to file!");