13 #include <boost/graph/graph_traits.hpp>
34 template<
typename MutableFaceInc
identGraph >
37 MutableFaceIncidentGraph >::face_descriptor
face,
38 const typename boost::graph_traits<
39 MutableFaceIncidentGraph >::edge_descriptor old_edge,
40 const typename boost::graph_traits<
41 MutableFaceIncidentGraph >::edge_descriptor new_edge,
42 MutableFaceIncidentGraph &g)
47 auto iter_e = edges_range_pair.first;
48 for(; iter_e != edges_range_pair.second; ++iter_e)
49 if(*iter_e == old_edge)
67 template<
typename MutableFaceInc
identGraph >
70 typename boost::graph_traits< MutableFaceIncidentGraph >::edge_descriptor
72 typename boost::graph_traits< MutableFaceIncidentGraph >::edge_descriptor
74 MutableFaceIncidentGraph &g)
76 auto faces_range_pair =
in_edges(e_to_remove, g);
77 auto iter_f = faces_range_pair.first;
78 for(; iter_f != faces_range_pair.second;
100 template<
typename MutableFaceInc
identGraph >
105 MutableFaceIncidentGraph &g)
108 typename boost::graph_traits< MutableFaceIncidentGraph >::edge_descriptor
110 std::vector< edge_descriptor > edges_to_remove;
112 auto edges_range_pair =
in_edges(v_to_keep, g);
113 auto iter_e = edges_range_pair.first;
114 for(; iter_e != edges_range_pair.second; ++iter_e)
116 auto iter_e_bis = iter_e;
118 for(; iter_e_bis != edges_range_pair.second; ++iter_e_bis)
122 edges_to_remove.push_back(*iter_e_bis);
128 typename std::vector< edge_descriptor >::iterator it_e(
129 edges_to_remove.begin()),
130 it_ee(edges_to_remove.end());
131 for(; it_e != it_ee; ++it_e)
133 edges_to_remove.clear();
148 template<
typename MutableFaceInc
identGraph >
153 MutableFaceIncidentGraph &g,
154 bool take_into_account_face_rientation =
false)
157 typename boost::graph_traits< MutableFaceIncidentGraph >::face_descriptor
159 std::vector< face_descriptor > faces_to_remove;
160 std::set< face_descriptor > incident_faces;
162 auto edges_range_pair =
in_edges(v_to_keep, g);
163 auto iter_e = edges_range_pair.first;
164 for(; iter_e != edges_range_pair.second; ++iter_e)
166 auto faces_range_pair =
in_edges(*iter_e, g);
167 incident_faces.insert(faces_range_pair.first, faces_range_pair.second);
170 auto iter_f = incident_faces.begin();
171 for(; iter_f != incident_faces.end(); ++iter_f)
173 if(std::find(faces_to_remove.begin(), faces_to_remove.end(), *iter_f) !=
174 faces_to_remove.end())
176 auto iter_f_bis = iter_f;
178 for(; iter_f_bis != incident_faces.end(); ++iter_f_bis)
181 *iter_f, *iter_f_bis, g, take_into_account_face_rientation))
184 faces_to_remove.begin(), faces_to_remove.end(), *iter_f_bis) ==
187 faces_to_remove.push_back(*iter_f_bis);
192 typename std::vector< face_descriptor >::iterator it_f(
193 faces_to_remove.begin()),
194 it_fe(faces_to_remove.end());
195 for(; it_f != it_fe; ++it_f)
197 faces_to_remove.clear();
214 template<
typename MutableFaceInc
identGraph>
215 static std::vector<std::pair<typename boost::graph_traits<MutableFaceIncidentGraph>::face_descriptor,
bool>>
217 MutableFaceIncidentGraph& g,
218 const std::set<
typename boost::graph_traits<MutableFaceIncidentGraph>::face_descriptor>&
219 faces_to_preserve_range,
220 bool take_into_account_face_rientation)
223 typename boost::graph_traits< MutableFaceIncidentGraph >::face_descriptor
225 std::vector< face_descriptor > faces_to_remove;
226 std::set< face_descriptor > incident_faces;
228 auto edges_range_pair =
in_edges(v_to_keep, g);
229 auto iter_e = edges_range_pair.first;
230 for(; iter_e != edges_range_pair.second; ++iter_e)
232 auto faces_range_pair =
in_edges(*iter_e, g);
233 incident_faces.insert(faces_range_pair.first, faces_range_pair.second);
236 std::vector< std::pair<face_descriptor, bool> > faces_to_duplicate ;
237 auto iter_f = incident_faces.begin();
238 for (; iter_f != incident_faces.end(); ++iter_f)
240 if (std::find(faces_to_remove.begin(), faces_to_remove.end(), *iter_f) != faces_to_remove.end())
242 auto iter_f_bis = iter_f;
244 for (; iter_f_bis != incident_faces.end(); ++iter_f_bis)
249 if (std::find(faces_to_remove.begin(), faces_to_remove.end(), *iter_f_bis) == faces_to_remove.end())
252 if (std::find(faces_to_preserve_range.begin(), faces_to_preserve_range.end(), *iter_f_bis) == faces_to_preserve_range.end())
254 faces_to_duplicate.push_back(std::make_pair(*iter_f, inverse_orientation));
255 faces_to_remove.push_back(*iter_f_bis);
259 faces_to_duplicate.push_back(std::make_pair(*iter_f_bis, inverse_orientation));
260 faces_to_remove.push_back(*iter_f);
267 typename std::vector<face_descriptor>::iterator itF(faces_to_remove.begin()),
268 itFe(faces_to_remove.end());
269 unsigned int cpt = 0;
270 for (; itF != itFe; ++itF)
275 faces_to_remove.clear();
277 return faces_to_duplicate;