From 1979efd08f37afbe8b561b232bfbbcb5fba7459f Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Dey Date: Fri, 28 Sep 2012 18:52:34 +0200 Subject: [PATCH] BasicPred intersects_segment_interior_inf_wedge_sp This predicate returns true if and only if the interior of t has non-empty intersection with the interior of the following infinite box: the only finite corner of the infinite box is p and this infinite box is a 90 degree wedge defined by the intersection of the halfplanes with supporting lines lhor and lver through p, where the halfplanes are both on the positive or negative sides of the supporting lines. The positive or negative side depends on the relative position of p with respect to s --- .../Basic_predicates_C2.h | 74 ++++++++++++++++++- .../Finite_edge_interior_conflict_C2.h | 8 ++ 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h b/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h index 1d6c65e6150..724bbd8b5ea 100644 --- a/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h +++ b/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h @@ -885,9 +885,8 @@ public: } } } // end of intersects_segment_interior_inf_box - - - + + // returns true if and only if // the interior of s has non-empty intersection // with the interior of the following infinite box: @@ -1028,7 +1027,74 @@ public: s, lhor, lver, ON_NEGATIVE_SIDE); } - + // returns true if and only if + // the interior of t has non-empty intersection + // with the interior of the following infinite box: + // the only finite corner of the infinite box is p + // and this infinite box is a 90 degree wedge defined + // by the intersection of the halfplanes + // with supporting lines lhor and lver through p, where + // the halfplanes are both on the positive or negative + // sides of the supporting lines. The positive or negative + // side depends on the relative position of p with respect to s + + static + Boolean + intersects_segment_interior_inf_wedge_sp(const Site_2 & s, + const Point_2 & p, + const Site_2 & t) + { + CGAL_assertion(s.is_segment()); + Segment_2 seg = s.segment(); + + Point_2 ssrc = seg.source(); + Point_2 strg = seg.target(); + + Sign dxs = CGAL::sign(strg.x() - ssrc.x()); + Sign dys = CGAL::sign(strg.y() - ssrc.y()); + + Line_2 lseg = compute_supporting_line(seg); + Oriented_side os_lseg_p = oriented_side_of_line(lseg, p); + + //sandeep: lhor, lver remains same for left turn and right turn + + if (dxs == NEGATIVE and dys == NEGATIVE) { + + Line_2 lhor = Line_2(0,1,-p.y()); + Line_2 lver = Line_2(-1,0,p.x()); + + return intersects_segment_side_of_wedge(t, + lhor, lver, + os_lseg_p); + } else if (dxs == POSITIVE and dys == NEGATIVE) { + + Line_2 lhor = Line_2(0,-1,p.y()); + Line_2 lver = Line_2(-1,0,p.x()); + + return intersects_segment_side_of_wedge(t, + lhor, lver, + os_lseg_p); + } else if (dxs == POSITIVE and dys == POSITIVE) { + + Line_2 lhor = Line_2(0,-1,p.y()); + Line_2 lver = Line_2(1,0,-p.x()); + + return intersects_segment_side_of_wedge(t, + lhor, lver, + os_lseg_p); + } else {//dxs == NEGATIVE and dys == POSITIVE + + Line_2 lhor = Line_2(0,1,-p.y()); + Line_2 lver = Line_2(1,0,-p.x()); + + return intersects_segment_side_of_wedge(t, + lhor, lver, + os_lseg_p); + } + + } // end of intersects_segment_interior_inf_wedge_sp + + // returns true if and only if // the interior of s has non-empty intersection // with the interior of the bounding box of q, p diff --git a/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h b/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h index b80ca003ccb..a3c4abda33a 100644 --- a/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h +++ b/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h @@ -55,6 +55,9 @@ public: using Base::compute_vertical_projection; using Base::compute_horizontal_projection; using Base::intersects_segment_interior_bbox; + using Base::intersects_segment_positive_of_wedge; + using Base::intersects_segment_negative_of_wedge; + using Base::intersects_segment_interior_inf_box; private: @@ -874,6 +877,11 @@ public: (not same_points(q, p.target_site()))) ) ; + //sandeep: if t is segment and it not intersects the positive wedge + // then return false + /*if (t.is_segment()) { + TO DO + }*/ // philaris: tocheck std::cout << "debug finite-edge-int-cf tocheck (p,q,r,t,sgn)= (" << p << ") (" << q << ") (" << r << " (r ignored)) ("