From bd94d902fe429cbf7007fd64d3b9df42c24f9e05 Mon Sep 17 00:00:00 2001 From: Panagiotis Cheilaris Date: Mon, 25 Aug 2014 22:09:25 +0300 Subject: [PATCH] fix for endpoint of axis-parallel segment Related to input n21.cin: s 25.914984 70.968903 25.912687 70.97624999999999 s 25.987635 70.97238900000001 26.000231 70.97238900000001 Vertex_conflict (pqrt)= (p 25.914984 70.968903) (p 26.000231 70.972389) (s 25.987635 70.972389 26.000231 70.972389) (p 25.987635 70.972389) now returns POSITIVE Signed-off-by: Panagiotis Cheilaris --- .../Voronoi_vertex_sqrt_field_new_C2.h | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h index 06ff1d6cf2e..2ae9d74e9d9 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h @@ -3047,17 +3047,23 @@ private: return ZERO; } - // if t is an endpoint of r, then t is necessarily outside the - // Voronoi circle of p, q and r and thus the result is POSITIVE - // philaris: In Linf, we are partially sure of the above only for a - // non-axis-parallel segment, in the sense that the possible return - // values are either ZERO or POSITIVE. In the non-axis-parallel case, - // the point t can be at the corner of the Linf-square and thus the - // possibility of ZERO cannot be excluded. However, this code seems - // to be reached only in validations and POSITIVE seems to be - // acceptable. - if ( is_endpoint_of(t, r) and not is_site_h_or_v(r) ) { - return POSITIVE; + const bool endp_t_of_r = is_endpoint_of(t, r); + if (endp_t_of_r) { + if (not is_site_h_or_v(r)) { + // For a non-axis-parallel segment, the possible return values + // are either ZERO or POSITIVE. In the non-axis-parallel case, + // the point t can be at the corner of the Linf-square and thus the + // possibility of ZERO cannot be excluded. However, this code seems + // to be reached only in validations and POSITIVE seems to be + // acceptable. + return POSITIVE; + } else { + // here r is axis-parallel: + // if p or q are endpoints of r, return POSITIVE + if (is_endpoint_of(p, r) or is_endpoint_of(q, r)) { + return POSITIVE; + } + } } // easy degeneracies --- end