Bugfix: Increment of invalidated iterator.

This commit is contained in:
Andreas Haas 2015-05-01 00:53:59 +02:00
parent ce20aba740
commit 0fe13eb749
3 changed files with 31 additions and 49 deletions

View File

@ -381,7 +381,7 @@ public:
(geom_traits, q, polygon_out, arr_out);
}
conditional_regularize(arr_out, Regularization_category());
Visibility_2::conditional_regularize(arr_out, Regularization_category());
if (arr_out.faces_begin()->is_unbounded())
return ++arr_out.faces_begin();
@ -405,7 +405,7 @@ public:
Visibility_2::report_while_handling_needles<Rotational_sweep_visibility_2>
(geom_traits, q, polygon, arr_out);
conditional_regularize(arr_out, Regularization_category());
Visibility_2::conditional_regularize(arr_out, Regularization_category());
if (arr_out.faces_begin()->is_unbounded())
return ++arr_out.faces_begin();
@ -920,26 +920,6 @@ private:
}
}
template <typename VARR>
void conditional_regularize(VARR& arr_out, CGAL::Tag_true) const {
regularize_output(arr_out);
}
template <typename VARR>
void conditional_regularize(VARR&, CGAL::Tag_false) const {
//do nothing
}
template <typename VARR>
void regularize_output(VARR& arr_out) const {
typename VARR::Edge_iterator e_itr;
for (e_itr = arr_out.edges_begin();
e_itr != arr_out.edges_end();
e_itr++) {
if (e_itr->face() == e_itr->twin()->face())
arr_out.remove_edge(e_itr);
}
}
};
} // end namespace CGAL

View File

@ -222,32 +222,6 @@ private:
mutable bool query_pt_is_vertex;
mutable bool query_pt_is_on_halfedge;
/*! Regularize output if flag is set to true*/
template <typename VARR>
void conditional_regularize(VARR& out_arr, CGAL::Tag_true) const {
regularize_output(out_arr);
}
/*! No need to regularize output if flag is set to false*/
template <typename VARR>
void conditional_regularize(VARR&, CGAL::Tag_false) const {
//do nothing
}
/*! Regularizes the output - removes edges that have the same face on both
sides */
template <typename VARR>
void regularize_output(VARR& out_arr) const {
typename VARR::Edge_iterator e_itr;
for (e_itr = out_arr.edges_begin(); e_itr != out_arr.edges_end(); ++e_itr) {
if (e_itr->face() == e_itr->twin()->face()) {
out_arr.remove_edge(e_itr);
}
}
}
/*! Initialized the constrained Delaunay triangulation using the edges of
the outer boundary of 'face' */
@ -306,7 +280,7 @@ private:
CGAL_postcondition(out_arr.number_of_isolated_vertices() == 0);
CGAL_postcondition(s.empty());
conditional_regularize(out_arr, Regularization_category());
Visibility_2::conditional_regularize(out_arr, Regularization_category());
vertices.clear();
if (out_arr.faces_begin()->is_unbounded()) {

View File

@ -401,6 +401,34 @@ void report_while_handling_needles(
}
}
template <typename VARR>
void regularize_output(VARR& arr_out) {
typename VARR::Edge_iterator it = arr_out.edges_begin();
while(it != arr_out.edges_end()) {
if (it->face() == it->twin()->face()) {
typename VARR::Halfedge_handle he = it;
++it;
arr_out.remove_edge(he);
}
else {
++it;
}
}
}
template <typename VARR>
void conditional_regularize(VARR& arr_out, CGAL::Tag_true) {
regularize_output(arr_out);
}
template <typename VARR>
void conditional_regularize(VARR&, CGAL::Tag_false) {
//do nothing
}
} // end namespace Visibility_2
} // end namespace CGAL