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
This commit is contained in:
Sébastien Loriot 2019-05-15 08:28:31 +02:00
parent 6cff0987ad
commit cd4554b26f
2 changed files with 48 additions and 6 deletions

View File

@ -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() ) {

View File

@ -0,0 +1,37 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <cassert>
#include <vector>
typedef CGAL::Simple_cartesian<CGAL::Exact_rational> K;
typedef K::Point_2 Point_2;
typedef K::Segment_2 Segment_2;
typedef CGAL::Segment_Delaunay_graph_traits_2<K> Gt;
typedef CGAL::Segment_Delaunay_graph_2<Gt> 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());
}