From 5cc88e11e496a3a10d5b2efe90c111d30e64996c Mon Sep 17 00:00:00 2001 From: Clement Jamin Date: Wed, 30 Jul 2014 18:26:44 +0200 Subject: [PATCH] This version of insert_if_in_star seems to work better At least in 2D --- .../include/CGAL/Regular_triangulation.h | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/Triangulation/include/CGAL/Regular_triangulation.h b/Triangulation/include/CGAL/Regular_triangulation.h index 1f339c38d0a..7700abd3ffb 100644 --- a/Triangulation/include/CGAL/Regular_triangulation.h +++ b/Triangulation/include/CGAL/Regular_triangulation.h @@ -273,6 +273,10 @@ public: const Facet &, const Full_cell_handle); + Vertex_handle insert_in_conflicting_cell_if_in_star(const Weighted_point &, + const Vertex_handle, + const Full_cell_handle); + Vertex_handle insert_if_in_star( const Weighted_point & p, const Vertex_handle star_center, const Full_cell_handle start = Full_cell_handle()) @@ -827,9 +831,10 @@ Regular_triangulation break; } default: - if (s->has_vertex(star_center)) + { + if( 1 == current_dimension() ) { - if( 1 == current_dimension() ) + if (s->has_vertex(star_center)) { if( Base::OUTSIDE_CONVEX_HULL == lt ) { @@ -839,15 +844,38 @@ Regular_triangulation v->set_point(p); return v; } - else - return insert_in_conflicting_cell(p, s); } - break; + else + return insert_in_conflicting_cell_if_in_star(p, star_center, s); + break; + } } return Vertex_handle(); } +template< typename RTTraits, typename TDS > +typename Regular_triangulation::Vertex_handle +Regular_triangulation +::insert_in_conflicting_cell_if_in_star(const Weighted_point & p, + const Vertex_handle star_center, + const Full_cell_handle s) +{ + typedef std::vector Full_cell_h_vector; + static Full_cell_h_vector cs; // for storing conflicting full_cells. + cs.clear(); + // cs.reserve(64); + std::back_insert_iterator out(cs); + Facet ft = compute_conflict_zone(p, s, out); + Full_cell_h_vector::const_iterator it = cs.begin(), it_end = cs.end(); + for ( ; it != it_end ; ++it) + { + if ((*it)->has_vertex(star_center)) + return insert_in_hole(p, cs.begin(), cs.end(), ft); + } + return Vertex_handle(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GATHERING CONFLICTING SIMPLICES // NOT DOCUMENTED