11 #include <CGAL/basic.h>
12 #include <CGAL/Kernel/global_functions.h>
13 #include <CGAL/Cartesian.h>
14 #include <CGAL/Polyhedron_3.h>
15 #include <CGAL/IO/Polyhedron_iostream.h>
16 #include <CGAL/Polyhedron_items_with_id_3.h>
18 #include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
42 const std::string &output_file_name)
44 typedef CGAL::Cartesian< double >
Kernel;
45 typedef CGAL::Polyhedron_3< Kernel, CGAL::Polyhedron_items_with_id_3 >
52 typedef boost::graph_traits< Polyhedron > GraphTraits;
53 typedef typename GraphTraits::halfedge_descriptor halfedge_descriptor;
56 if(h == GraphTraits::null_halfedge())
58 std::cout <<
"Failed to retrieve edge from " << source_index <<
" to "
59 << target_index <<
"." << std::endl;
60 std::cout <<
"Exiting";
64 std::cout <<
"Collapsing edge " << source_index <<
" to " << target_index
70 std::ofstream os(output_file_name);
77 main(
int narg,
char **argv)
79 if(narg < 3 || narg > 4)
97 std::cout <<
"Usage: a.out filename_a deletion_case filename_b";
98 std::cout <<
" - filename_a filename of file to be treated (off format)"
100 std::cout <<
" - deletion case: integer specifying the edge to delete"
102 std::cout <<
" 0 for unspecified edge" << std::endl;
103 std::cout <<
" 1 for edge 3 --> 4" << std::endl;
104 std::cout <<
" 2 for edge 4 --> 3" << std::endl;
105 std::cout <<
" 3 for edge 6 --> 3" << std::endl;
106 std::cout <<
" 4 for edge 6 --> 7" << std::endl;
107 std::cout <<
" - filename_b optional reference off file of valid result."
114 std::ifstream to_treat(argv[1]);
117 std::cout <<
"Unable to read file " << argv[1] << std::endl;
121 int deletion_case = std::stoi(std::string(argv[2]));
122 std::string output_file_name = std::string(argv[0]) + argv[2] +
".off";
124 if(deletion_case == 0)
127 to_treat, 0, 1, output_file_name);
129 else if(deletion_case == 1)
133 else if(deletion_case == 2)
137 else if(deletion_case == 3)
141 else if(deletion_case == 4)
147 std::cout <<
"Unknown deletation case " << argv[2] << std::endl;