From cd4554b26fe253ffacb0970db306ebcc8ba53b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 May 2019 08:28:31 +0200 Subject: [PATCH] fix the in-conflict of Voronoi edge in the case the new point is on the Voronoi circle of endpoints in this special case, the circles are identical because the defining sites are the same --- .../Finite_edge_interior_conflict_C2.h | 17 ++++++--- .../Segment_Delaunay_graph_2/sdg_br_case1.cpp | 37 +++++++++++++++++++ 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/sdg_br_case1.cpp diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h index 053db7a9f8e..66d60f086b2 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h @@ -423,12 +423,17 @@ private: #if 1 CGAL_assertion( p.is_segment() || q.is_segment() ); - Voronoi_vertex_2 vpqr(p, q, r); - Voronoi_vertex_2 vqps(q, p, s); - - if ( vpqr.incircle_no_easy(s) == ZERO && - vqps.incircle_no_easy(r) == ZERO ) { - return false; + if ( !(r.is_point() && s.is_point() && r.point()==s.point() ) && + !(r.is_segment() && s.is_segment() && r.source_of_supporting_site()==s.source_of_supporting_site() + && r.target_of_supporting_site()==s.target_of_supporting_site() ) ) + { + Voronoi_vertex_2 vpqr(p, q, r); + Voronoi_vertex_2 vqps(q, p, s); + //check if the edge is degenerate + if ( vpqr.incircle_no_easy(s) == ZERO && + vqps.incircle_no_easy(r) == ZERO ) { + return false; + } } if ( p.is_segment() && q.is_segment() ) { diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/sdg_br_case1.cpp b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/sdg_br_case1.cpp new file mode 100644 index 00000000000..564ce2d5070 --- /dev/null +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/sdg_br_case1.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +#include +#include + +typedef CGAL::Simple_cartesian K; +typedef K::Point_2 Point_2; +typedef K::Segment_2 Segment_2; + +typedef CGAL::Segment_Delaunay_graph_traits_2 Gt; +typedef CGAL::Segment_Delaunay_graph_2 SDG; + +int main(int argc,char**) +{ + SDG sdg; + + SDG::Vertex_handle v0=sdg.insert(Point_2(-118.4357272, 34.2007906)); + SDG::Vertex_handle v1=sdg.insert(Point_2(-118.4357272, 34.2010248)); + SDG::Vertex_handle v2=sdg.insert(Point_2(-118.436231 , 34.2010248)); + SDG::Vertex_handle v3=sdg.insert(Point_2(-118.436231 , 34.2007906)); + + sdg.insert(v0,v1); + sdg.insert(v1,v2); + sdg.insert(v2,v3); + sdg.insert(v3,v0); + + sdg.insert(Point_2(-118.4359811, 34.2008934)); + sdg.insert(Point_2(-118.4359811, 34.200922)); + + sdg.insert(Point_2(-118.4358769, 34.200922)); + sdg.insert(Point_2(-118.4358769, 34.2008934)); + + assert(sdg.is_valid()); +}