From 28ce2a5240e432f5845a33ad9ee1dff0c29d550d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 11 Jan 2019 12:29:40 +0100 Subject: [PATCH] Fixed stack order in non recursive conflict walking Edges must be output in a CCW order, which is achieved by walking ccw-ly first. In the recursive function, we correctly call 'propagate(..., ccw(j))' first. For the non-recursive version which uses a stack, then we must add 'ccw(j)' last since the stack is a LIFO structure. --- Triangulation_2/include/CGAL/Delaunay_triangulation_2.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index bf45a49f793..ad22e75d9ca 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -503,8 +503,11 @@ private: } else { *(pit.first)++ = fn; int j = fn->index(fh); - stack.push(std::make_pair(fn,ccw(j))); + + // In the non-recursive version, we walk via 'ccw(j)' first. Here, we are filling the stack + // and the order is thus the opposite (we want the last element of the stack to be 'ccw(j)') stack.push(std::make_pair(fn,cw(j))); + stack.push(std::make_pair(fn,ccw(j))); } } return pit;