From dd738bf0297ceff9bd71186360661ff0a0891094 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 4 May 2023 09:55:10 +0200 Subject: [PATCH] bug fix for the simplex traverser --- .../Triangulation_segment_traverser_3_impl.h | 1 + .../CGAL/Triangulation_segment_traverser_3.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h b/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h index 663032162a4..f7411f652e8 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h +++ b/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h @@ -241,6 +241,7 @@ walk_to_next() { // The target is inside the cell. _prev = Simplex( cell(), Tr::VERTEX, ti, -1 ); cell() = Cell_handle(); + lt() = Locate_type::VERTEX; return; } diff --git a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h index 76b0f7572e3..49ba25ccd3e 100644 --- a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h @@ -228,6 +228,8 @@ public: */ const Point& target() const { return _target; } + Vertex_handle target_vertex() const { return _t_vertex; } + // gives a handle to the current cell. /* By invariance, this cell is intersected by the segment * between `source()` and `target()`. @@ -809,7 +811,7 @@ public: else ch = _cell_iterator.previous(); - Cell_handle chnext = Cell_handle(_cell_iterator); + const Cell_handle chnext = Cell_handle(_cell_iterator); //_cell_iterator is one step forward _curr_simplex CGAL_assertion(ch != chnext); @@ -834,8 +836,13 @@ public: { if (prev == ch && ltprev == Locate_type::VERTEX) { - CGAL_assertion(prev->vertex(liprev) == get_vertex()); - _curr_simplex = ch; + const auto current_vertex = get_vertex(); + if(current_vertex == _cell_iterator.target_vertex()) { + _curr_simplex = Simplex_3(); + } else { + CGAL_assertion(prev->vertex(liprev) == _cell_iterator.target_vertex()); + _curr_simplex = ch; + } } else {