14 #include <boost/graph/graph_traits.hpp>
15 #include <boost/graph/properties.hpp>
17 #include <CGAL/boost/graph/helpers.h>
37 typename HalfedgeGraph,
41 typename halfedge_descriptor =
42 typename boost::graph_traits< HalfedgeGraph >::halfedge_descriptor,
43 typename edge_iterator =
44 typename boost::graph_traits< HalfedgeGraph >::edge_iterator,
45 typename vertex_iterator =
46 typename boost::graph_traits< HalfedgeGraph >::vertex_iterator,
67 std::clog <<
"process_mesh_before_quantization: does the mesh has borders ? " << has_border << std::endl;
80 std::clog <<
"Warning: process_mesh_after_quantization: there are still duplicates "
89 vertex_iterator vi = iterator_pair.first;
90 vertex_iterator vi_end = iterator_pair.second;
91 std::vector< vertex_descriptor > isolated_vertices;
92 std::vector< halfedge_descriptor > isolated_hedges;
94 for( ; vi != vi_end; ++vi)
97 typename boost::graph_traits< HalfedgeGraph >::degree_size_type
99 boost::degree_property_map< HalfedgeGraph > degree_property_map(
_g);
100 value_type = degree_property_map[*vi];
105 isolated_vertices.push_back(*vi);
114 auto itE = isolated_hedges.begin(),
115 itEe = isolated_hedges.end();
116 for( ; itE != itEe; ++itE)
119 auto itV = isolated_vertices.begin(),
120 itVe = isolated_vertices.end();
121 for( ; itV != itVe; ++itV)
127 auto iterator_pair =
edges(
_g);
128 edge_iterator ei = iterator_pair.first;
129 edge_iterator ei_end = iterator_pair.second;
131 for( ; ei != ei_end; ++ei)
143 vertex_iterator vi = iterator_pair.first;
144 vertex_iterator vi_end = iterator_pair.second;
145 std::pair<
typename std::map<
Point,
147 std::less< Point > >::iterator,
151 for( ; vi != vi_end; ++vi)
156 while(!(
_position.insert(std::pair< Point, vertex_descriptor >(pos, *vi)))
159 pos =
Point(pos[0], pos[1], pos[2] + 1.0);
170 vertex_iterator vi = iterator_pair.first;
171 vertex_iterator vi_end = iterator_pair.second;
173 std::map< Point, vertex_descriptor > map_pos;
174 std::pair< typename std::map< Point, vertex_descriptor >::iterator,
bool >
177 for( ; vi != vi_end; ++vi)
180 ret = map_pos.insert(std::pair< Point, vertex_descriptor >(pos, *vi));
183 if(ret.second ==
false)
195 int px =
static_cast< int >(gt.get_x(pos));
196 int py =
static_cast< int >(gt.get_y(pos));
197 int pz =
static_cast< int >(gt.get_z(pos));
202 new_pos =
Point(px, py, pz - 1);
206 new_pos =
Point(px, py, pz + 1);
210 new_pos =
Point(px, py - 1, pz);
214 new_pos =
Point(px, py + 1, pz);
218 new_pos =
Point(px - 1, py, pz);
222 new_pos =
Point(px + 1, py, pz);
240 return std::tie(
x,
y,
z) < std::tie(q.
x, q.
y, q.
z);
245 void get_new_pos(
const std::vector< vertex_descriptor > &doublons,
247 std::set< P > &new_pos)
250 int x_min = gt.get_x(
get(
_pm, doublons.front())) + 1;
251 int x_max = gt.get_x(
get(
_pm, doublons.back())) - 1;
252 int y_min = gt.get_y(
get(
_pm, doublons.front()));
253 int y_max = gt.get_y(
get(
_pm, doublons.back()));
254 int z_min = gt.get_z(
get(
_pm, doublons.front()));
255 int z_max = gt.get_z(
get(
_pm, doublons.back()));
262 P value{gt.get_x(
get(
_pm, doublons[1])),
263 gt.get_y(
get(
_pm, doublons[1])),
264 gt.get_z(
get(
_pm, doublons[1]))};
265 new_pos.insert(value);
269 typename std::set< P >::iterator it_new_pos = new_pos.begin();
271 while(counter != size_doublons)
273 const P& pos = *it_new_pos;
282 if(x_pos + 1 != x_max)
284 value = {x_pos + 1, y_pos, z_pos};
285 new_pos.insert(value);
291 value = {x_pos, y_pos + 1, z_pos};
292 new_pos.insert(value);
297 value = {x_pos, y_pos, z_pos + 1};
298 new_pos.insert(value);
303 if(x_pos - 1 != x_min)
305 value = {x_pos - 1, y_pos, z_pos};
306 new_pos.insert(value);
312 value = {x_pos, y_pos - 1, z_pos};
313 new_pos.insert(value);
318 value = {x_pos, y_pos, z_pos - 1};
319 new_pos.insert(value);
336 std::map< Point, vertex_descriptor, std::less< Point > >
_position;