From c07ae4ba42a86f5b51fb25a076c2e05be0d76899 Mon Sep 17 00:00:00 2001 From: Panagiotis Cheilaris Date: Wed, 20 Feb 2013 12:58:51 +0100 Subject: [PATCH] general oriented_side to also accomodate Linf The oriented_side predicate is used with a face corresponding to the interior of a segment that is split by a vertex contained in the segment. For an infinite such face the code has to become more general in order to accomodate the Linf case. For example, in L2 the number of such infinite faces is 0, 2, or 4, whereas in Linf, it can be any even non-negative integer. Moreover, the existing code for infinite faces is L2 specific and ignores the interior of the segment for its decision. In Linf the interior of the segment is important. For this reason, there is a new case of the predicate that is general enough to also accomodate Linf: // computes the oriented side of the Voronoi vertex of s1, s2, inf // wrt the line that passes through the point p and its direction // is the direction of the supporting line of s, rotated by 90 // degrees counterclockwise. Oriented_side operator()(const Site_2& s1, const Site_2& s2, const Site_2& s, const Site_2& p) const The Oriented_side_C2 class is also adapted for L2 to use the new form of the predicate, which internally calls the old form. --- .../include/CGAL/Segment_Delaunay_graph_2.h | 15 +++++++++------ .../Segment_Delaunay_graph_2/Oriented_side_C2.h | 13 +++++++++++++ .../Segment_Delaunay_graph_2_impl.h | 8 ++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h index 4918683b6b7..79103211ffd 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h @@ -1657,12 +1657,14 @@ protected: } inline Oriented_side - oriented_side(const Storage_site_2& q, const Storage_site_2& supp, + oriented_side(const Storage_site_2& s1, const Storage_site_2& s2, + const Storage_site_2& supp, const Storage_site_2& p) const { - CGAL_precondition( q.is_point() && supp.is_segment() && p.is_point() ); + CGAL_precondition( supp.is_segment() && p.is_point() ); return - geom_traits().oriented_side_2_object()(q.site(), supp.site(), p.site()); + geom_traits().oriented_side_2_object()( + s1.site(), s2.site(), supp.site(), p.site()); } inline Oriented_side @@ -1869,10 +1871,11 @@ protected: } inline Oriented_side - oriented_side(const Site_2& q, const Site_2& supp, const Site_2& p) const + oriented_side(const Site_2& s1, const Site_2&s2, + const Site_2& supp, const Site_2& p) const { - CGAL_precondition( q.is_point() && supp.is_segment() && p.is_point() ); - return geom_traits().oriented_side_2_object()(q, supp, p); + CGAL_precondition( supp.is_segment() && p.is_point() ); + return geom_traits().oriented_side_2_object()(s1, s2, supp, p); } inline Oriented_side diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h index 1dd0fde727c..80f55ac41b5 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h @@ -60,6 +60,19 @@ public: typedef Oriented_side result_type; typedef Site_2 argument_type; + // computes the oriented side of the Voronoi vertex of s1, s2, inf + // wrt the line that passes through the point p and its direction + // is the direction of the supporting line of s, rotated by 90 + // degrees counterclockwise. + Oriented_side operator()(const Site_2& s1, const Site_2& s2, + const Site_2& s, const Site_2& p) const + { + CGAL_precondition(s1.is_point() or s2.is_point()); + CGAL_precondition(s1.is_segment() or s2.is_segment()); + + return this->operator()((s1.is_point()? s1: s2), s, p); + } + // computes the oriented side of the point q // wrt the line that is passes through the point p and its direction // is the direction of the supporting line of s, rotated by 90 diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h index 12eef09d243..247470037f0 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h @@ -527,13 +527,13 @@ find_faces_to_split(const Vertex_handle& v, const Site_2& t) const CGAL_assertion( !is_infinite( ff1->vertex(ccw_v) ) ); CGAL_assertion( ff1->vertex(ccw_v)->site().is_point() ); sv_ep = ff1->vertex(ccw_v)->site(); + os1 = oriented_side(v->site(), sv_ep, sitev_supp, t); } else { CGAL_assertion( !is_infinite( ff1->vertex( cw_v) ) ); CGAL_assertion( ff1->vertex( cw_v)->site().is_point() ); sv_ep = ff1->vertex( cw_v)->site(); + os1 = oriented_side(sv_ep, v->site(), sitev_supp, t); } - - os1 = oriented_side(sv_ep, sitev_supp, t); } else { os1 = oriented_side(fc1->vertex(0)->site(), fc1->vertex(1)->site(), @@ -551,13 +551,13 @@ find_faces_to_split(const Vertex_handle& v, const Site_2& t) const CGAL_assertion( !is_infinite( ff2->vertex(ccw_v) ) ); CGAL_assertion( ff2->vertex(ccw_v)->site().is_point() ); sv_ep = ff2->vertex(ccw_v)->site(); + os2 = oriented_side(v->site(), sv_ep, sitev_supp, t); } else { CGAL_assertion( !is_infinite( ff2->vertex( cw_v) ) ); CGAL_assertion( ff2->vertex( cw_v)->site().is_point() ); sv_ep = ff2->vertex( cw_v)->site(); + os2 = oriented_side(sv_ep, v->site(), sitev_supp, t); } - - os2 = oriented_side(sv_ep, sitev_supp, t); } else { os2 = oriented_side(fc2->vertex(0)->site(), fc2->vertex(1)->site(),