From 01614f2fd3903aee7944b69ca2ffb352d5755ee4 Mon Sep 17 00:00:00 2001 From: Panagiotis Cheilaris Date: Tue, 26 Feb 2013 13:56:05 +0100 Subject: [PATCH] fix for touching parabolas PSS case Fix for the following input start2db.cin: s -250 50 -50 -150 s -100 -50 -60 -50 p -150 50 Signed-off-by: Panagiotis Cheilaris --- .../Voronoi_vertex_sqrt_field_new_C2.h | 58 ++++++++++++++++--- 1 file changed, 50 insertions(+), 8 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 653ab7945be..05bf5ed2da4 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 @@ -1964,14 +1964,56 @@ private: qref = q.point(); } else { // tocheck and tofix - // here q and r are segments - if (is_q_hv and not is_r_hv) { - CGAL_SDG_DEBUG(std::cout << "debug q:ap r:non-ap" - << std::endl;); - } - if (is_r_hv and not is_q_hv) { - CGAL_SDG_DEBUG(std::cout << "debug q:non-ap r:ap" - << std::endl;); + // here q and r are segments and p is point + CGAL_assertion(p.is_point()); + if ((is_q_hv and not is_r_hv) or + (is_r_hv and not is_q_hv) ) { + Line_2 lnap; + Homogeneous_point_2 sref; + bool samex; + if (is_q_hv and not is_r_hv) { + CGAL_SDG_DEBUG(std::cout << "debug q:ap r:non-ap" + << std::endl;); + if (is_p_endp_of_q) { + samex = is_q_ver ? true : false; + lnap = compute_supporting_line(r.supporting_site()); + } else { + return ZERO; + } + } else + { // here, we have: (is_r_hv and not is_q_hv) + CGAL_SDG_DEBUG(std::cout << "debug q:non-ap r:ap" + << std::endl;); + if (is_p_endp_of_r) { + samex = is_r_ver ? true : false; + lnap = compute_supporting_line(q.supporting_site()); + } else { + return ZERO; + } + } + sref = compute_linf_projection_hom(lnap, vv); + CGAL_SDG_DEBUG(std::cout << "debug sref =" + << sref.x() << ' ' << sref.y() << std::endl;); + if (samex) { + CGAL_SDG_DEBUG(std::cout << "debug samex case" << std::endl;); + FT diffdvsy = vv.y() - sref.y(); + if (CGAL::sign(diffdvsy) == CGAL::sign(diffdvty)) { + if (CGAL::compare(CGAL::abs(diffdvtx), + CGAL::abs(diffdvty)) == SMALLER) { + return NEGATIVE; + } + } + } // end of samex case + else { // samey case + CGAL_SDG_DEBUG(std::cout << "debug samey case" << std::endl;); + FT diffdvsx = vv.x() - sref.x(); + if (CGAL::sign(diffdvsx) == CGAL::sign(diffdvtx)) { + if (CGAL::compare(CGAL::abs(diffdvty), + CGAL::abs(diffdvtx)) == SMALLER) { + return NEGATIVE; + } + } + } // end of samey case } return ZERO; }