Go to the documentation of this file.
26 std::cout <<
"Apply boolean union, intersection or subtraction"
29 std::cout <<
"Usage: "
31 <<
" union|inter|minus mesh_file_1 mesh_file_2"
32 " [reference_mesh_file]"
34 std::cout <<
"Example: "
37 " ../Testing/Data/CubeTriangleFaces.off"
38 " ../Testing/Data/tetra.off"
39 " ../Testing/Data/boolean_operations/mepp1_cube_tetra_union.off"
46 int main(
int argc,
const char **argv)
49 if(argc < 4 || argc > 5)
53 std::string operation = argv[1];
54 if(operation !=
"union" && operation !=
"inter" && operation !=
"minus")
58 std::string input_file_1 = argv[2];
59 std::string input_file_2 = argv[3];
60 std::string reference_file;
62 reference_file = argv[4];
63 std::string output_file =
64 "test_boolean_operations_polyhedron_" + operation +
".off";
67 std::cout <<
"\nParameters summary:" << std::endl;
68 std::cout <<
" - operation : " << operation << std::endl;
69 std::cout <<
" - input file 1 : " << input_file_1 << std::endl;
70 std::cout <<
" - input file 2 : " << input_file_2 << std::endl;
71 std::cout <<
" - reference file: " << reference_file << std::endl;
72 std::cout <<
"\nOutput in " << output_file << std::endl;
87 std::cout <<
"Running boolean operation" + operation +
"..." << std::endl;
88 if(operation ==
"union")
90 else if(operation ==
"inter")
99 if(reference_file.empty())
101 std::cout <<
"No reference file provided, skipping result check."
106 std::cout <<
"Checking result with reference file..." << std::endl;
114 std::cout <<
"Boolean operation " + operation +
" successfully tested."
119 std::cout <<
"Boolean operation " + operation +
" FAILED!" << std::endl;
void boolean_union(HalfedgeGraph &gA, HalfedgeGraph &gB, HalfedgeGraph &g_out, const GeometryTraits &)
Computes the union of two polyhedra.
bool are_meshes_equal(std::string filename_a, std::string filename_b, bool verbose)
std::map< std::string, boost::any > PMapsContainer
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
void boolean_inter(HalfedgeGraph &gA, HalfedgeGraph &gB, HalfedgeGraph &g_out, const GeometryTraits &)
Computes the intersection of two polyhedra.
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
int main(int argc, const char **argv)
void boolean_minus(HalfedgeGraph &gA, HalfedgeGraph &gB, HalfedgeGraph &g_out, const GeometryTraits &)
Computes the subtraction of two polyhedra.
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
int usage_and_exit(const char **argv)