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 <<
"Splitting edge " << source_index <<
" to " << target_index
83 #ifdef USE_GENERIC_READER_WRITER
95 main(
int narg,
char **argv)
97 if(narg < 3 || narg > 5)
115 std::cout <<
"Usage: a.out filename_a splitting_case filename_b filename_c";
116 std::cout <<
" - filename_a filename of file to be treated (off format)"
118 std::cout <<
" - splitting_case case: integer specifying the edge to delete"
120 std::cout <<
" 0 for edge 1 --> 2" << std::endl;
121 std::cout <<
" 1 for edge 2 --> 1" << std::endl;
122 std::cout <<
" 2 for edge 3 --> 4" << std::endl;
123 std::cout <<
" 3 for edge 4 --> 3" << std::endl;
125 <<
" - filename_b optional reference off file of output mesh result."
127 std::cout <<
" - filename_c optional reference off file of valid result."
133 int splitting_case = std::stoi(std::string(argv[2]));
134 std::string output_file_name = std::string(argv[3]);
136 if(splitting_case == 0)
141 else if(splitting_case == 1)
145 else if(splitting_case == 2)
149 else if(splitting_case == 3)
155 std::cout <<
"Unknown deletation case " << argv[2] << std::endl;