11 #include <CGAL/Cartesian.h>
12 #include <CGAL/Polyhedron_3.h>
13 #include <CGAL/Polyhedron_items_with_id_3.h>
16 #include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
20 #define USE_GENERIC_READER_WRITER // when activated you need to link to vtk
22 #ifdef USE_GENERIC_READER_WRITER
27 #include <CGAL/IO/Polyhedron_iostream.h>
44 const std::string &output_file_name)
46 typedef CGAL::Cartesian< double >
Kernel;
47 typedef CGAL::Polyhedron_3< Kernel, CGAL::Polyhedron_items_with_id_3 >
50 typedef boost::graph_traits< Polyhedron > GraphTraits;
51 typedef typename GraphTraits::halfedge_descriptor halfedge_descriptor;
56 #ifdef USE_GENERIC_READER_WRITER
60 std::ifstream toTreat(inputFilePath);
63 std::cout <<
"Unable to read file " << inputFilePath << std::endl;
72 if(h == GraphTraits::null_halfedge())
74 std::cout <<
"Failed to retrieve edge from " << source_index <<
" to "
75 << target_index <<
"." << std::endl;
76 std::cout <<
"Exiting";
80 std::cout <<
"Flipping edge " << source_index <<
" to " << target_index <<
"."
83 #ifdef USE_GENERIC_READER_WRITER
95 main(
int narg,
char **argv)
97 if(narg < 3 || narg > 5)
99 std::cout <<
"Usage: a.out filename_a splitting_case filename_b filename_c";
100 std::cout <<
" - filename_a filename of file to be treated (off format)"
102 std::cout <<
" - splitting_case case: integer specifying the edge to delete"
104 std::cout <<
" 0 for edge 1 --> 2" << std::endl;
105 std::cout <<
" 1 for edge 2 --> 1" << std::endl;
106 std::cout <<
" 2 for edge 3 --> 4" << std::endl;
107 std::cout <<
" 3 for edge 4 --> 3" << std::endl;
109 <<
" - filename_b optional reference off file of output mesh result."
111 std::cout <<
" - filename_c optional reference off file of valid result."
117 int splitting_case = std::stoi(std::string(argv[2]));
118 std::string output_file_name = std::string(argv[3]);
120 if(splitting_case == 0)
125 else if(splitting_case == 1)
129 else if(splitting_case == 2)
133 else if(splitting_case == 3)
139 std::cout <<
"Unknown deletation case " << argv[2] << std::endl;