Derecursify insert_constraint(Vhandle,Vhandle); Increment depth of propagating_flip()

This commit is contained in:
Andreas Fabri 2017-11-23 15:50:26 +00:00
parent 09b3ed55fc
commit 029888f85c
2 changed files with 42 additions and 34 deletions

View File

@ -742,9 +742,9 @@ propagating_flip(Face_handle f,int i, int depth)
Face_handle ni = f->neighbor(i); Face_handle ni = f->neighbor(i);
flip(f, i); // flip for constrained triangulations flip(f, i); // flip for constrained triangulations
propagating_flip(f,i); propagating_flip(f,i, depth+1);
i = ni->index(f->vertex(i)); i = ni->index(f->vertex(i));
propagating_flip(ni,i); propagating_flip(ni,i, depth+1);
#endif #endif
} }
#else #else

View File

@ -649,6 +649,12 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb)
// if a vertex vc of t lies on segment ab // if a vertex vc of t lies on segment ab
// or if ab intersect some constrained edges // or if ab intersect some constrained edges
{ {
std::stack<std::pair<Vertex_handle, Vertex_handle> > stack;
stack.push(std::make_pair(vaa,vbb));
while(! stack.empty()){
boost::tie(vaa,vbb) = stack.top();
stack.pop();
CGAL_triangulation_precondition( vaa != vbb); CGAL_triangulation_precondition( vaa != vbb);
Vertex_handle vi; Vertex_handle vi;
@ -657,9 +663,9 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb)
if(includes_edge(vaa,vbb,vi,fr,i)) { if(includes_edge(vaa,vbb,vi,fr,i)) {
mark_constraint(fr,i); mark_constraint(fr,i);
if (vi != vbb) { if (vi != vbb) {
insert_constraint(vi,vbb); stack.push(std::make_pair(vi,vbb));
} }
return; continue;
} }
List_faces intersected_faces; List_faces intersected_faces;
@ -672,11 +678,13 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb)
vi); vi);
if ( intersection) { if ( intersection) {
if (vi != vaa && vi != vbb) { if (vi != vaa && vi != vbb) {
insert_constraint(vaa,vi); stack.push(std::make_pair(vaa,vi));
insert_constraint(vi,vbb); stack.push(std::make_pair(vi,vbb));
} }
else insert_constraint(vaa,vbb); else{
return; stack.push(std::make_pair(vaa,vbb));
}
continue;
} }
//no intersection //no intersection
@ -685,9 +693,9 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb)
conflict_boundary_ba); conflict_boundary_ba);
if (vi != vbb) { if (vi != vbb) {
insert_constraint(vi,vbb); stack.push(std::make_pair(vi,vbb));
}
} }
return;
} }