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.
This commit is contained in:
Panagiotis Cheilaris 2013-02-20 12:58:51 +01:00
parent 88bc8d9458
commit c07ae4ba42
3 changed files with 26 additions and 10 deletions

View File

@ -1657,12 +1657,14 @@ protected:
} }
inline Oriented_side 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 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 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 inline Oriented_side
@ -1869,10 +1871,11 @@ protected:
} }
inline Oriented_side 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() ); CGAL_precondition( supp.is_segment() && p.is_point() );
return geom_traits().oriented_side_2_object()(q, supp, p); return geom_traits().oriented_side_2_object()(s1, s2, supp, p);
} }
inline Oriented_side inline Oriented_side

View File

@ -60,6 +60,19 @@ public:
typedef Oriented_side result_type; typedef Oriented_side result_type;
typedef Site_2 argument_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 // computes the oriented side of the point q
// wrt the line that is passes through the point p and its direction // 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 // is the direction of the supporting line of s, rotated by 90

View File

@ -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( !is_infinite( ff1->vertex(ccw_v) ) );
CGAL_assertion( ff1->vertex(ccw_v)->site().is_point() ); CGAL_assertion( ff1->vertex(ccw_v)->site().is_point() );
sv_ep = ff1->vertex(ccw_v)->site(); sv_ep = ff1->vertex(ccw_v)->site();
os1 = oriented_side(v->site(), sv_ep, sitev_supp, t);
} else { } else {
CGAL_assertion( !is_infinite( ff1->vertex( cw_v) ) ); CGAL_assertion( !is_infinite( ff1->vertex( cw_v) ) );
CGAL_assertion( ff1->vertex( cw_v)->site().is_point() ); CGAL_assertion( ff1->vertex( cw_v)->site().is_point() );
sv_ep = ff1->vertex( cw_v)->site(); 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 { } else {
os1 = oriented_side(fc1->vertex(0)->site(), os1 = oriented_side(fc1->vertex(0)->site(),
fc1->vertex(1)->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( !is_infinite( ff2->vertex(ccw_v) ) );
CGAL_assertion( ff2->vertex(ccw_v)->site().is_point() ); CGAL_assertion( ff2->vertex(ccw_v)->site().is_point() );
sv_ep = ff2->vertex(ccw_v)->site(); sv_ep = ff2->vertex(ccw_v)->site();
os2 = oriented_side(v->site(), sv_ep, sitev_supp, t);
} else { } else {
CGAL_assertion( !is_infinite( ff2->vertex( cw_v) ) ); CGAL_assertion( !is_infinite( ff2->vertex( cw_v) ) );
CGAL_assertion( ff2->vertex( cw_v)->site().is_point() ); CGAL_assertion( ff2->vertex( cw_v)->site().is_point() );
sv_ep = ff2->vertex( cw_v)->site(); 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 { } else {
os2 = oriented_side(fc2->vertex(0)->site(), os2 = oriented_side(fc2->vertex(0)->site(),
fc2->vertex(1)->site(), fc2->vertex(1)->site(),