From 6edb602729f35fd3d869f29e39fd8e4cf603fcfc Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 19 Jun 2023 17:11:19 +0200 Subject: [PATCH] factorize code when cells are traversed --- .../CGAL/Triangulation_segment_traverser_3.h | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h index bb987c3ef99..f27ab9f757c 100644 --- a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h @@ -727,10 +727,17 @@ public: int li_prev, lj_prev; _cell_iterator.exit(lt_prev, li_prev, lj_prev); - switch(_curr_simplex.dimension()) { - case 3: { /*Cell_handle*/ + if(_curr_simplex.dimension() == 3) { set_curr_simplex_to_entry(); - } break; + return *this; + } + if(lt_prev == Locate_type::CELL) { + CGAL_assertion(ch_next == Cell_handle()); + _curr_simplex = ch_prev; + return *this; + } + + switch(_curr_simplex.dimension()) { case 2: { /*Facet*/ CGAL_assertion((ch_next == Cell_handle()) == (_cell_iterator == _cell_iterator.end())); @@ -759,10 +766,6 @@ public: } else _curr_simplex = ch_prev; } break; - case Locate_type::CELL: { // facet-cell then end - CGAL_assertion(ch_next == Cell_handle()); - _curr_simplex = ch_prev; - } break; default: CGAL_unreachable(); } @@ -801,10 +804,6 @@ public: else _curr_simplex = ch_prev; //query goes through the cell } break; - case Locate_type::CELL: - CGAL_assertion(ch_next == Cell_handle()); - _curr_simplex = ch_prev; //edge-cell-outside - break; default: CGAL_unreachable(); } @@ -833,10 +832,6 @@ public: else // vertex-cell-facet-outside _curr_simplex = ch_prev; } break; - case Locate_type::CELL: { - CGAL_assertion(ch_next == Cell_handle()); - _curr_simplex = ch_prev; - } break; default: CGAL_unreachable(); }