Fixed boundary tags

This commit is contained in:
Efi Fogel 2017-12-31 18:45:48 +02:00
parent 057d759946
commit 30a92c4dd5
6 changed files with 69 additions and 73 deletions

View File

@ -15,7 +15,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
//
// Author(s) : Idit Haran <haranidi@post.tau.ac.il>
@ -51,7 +51,7 @@ Arr_trapezoid_ric_point_location<Arrangement_2>::locate(const Point_2& p) const
//there are different internal compiler errors if we
// typedef the Locate_type
typename TD::Locate_type td_lt;
typename TD::Locate_type td_lt;
Td_map_item& tr = td.locate(p,td_lt);
@ -63,8 +63,8 @@ Arr_trapezoid_ric_point_location<Arrangement_2>::locate(const Point_2& p) const
CGAL_TRAP_PRINT_DEBUG("UNBOUNDED_TRAPEZOID");
Face_const_handle ubf =
_get_unbounded_face(tr, p, Are_all_sides_oblivious_category());
_get_unbounded_face(tr, p, All_sides_oblivious_category());
//check isolated vertices
Isolated_vertex_const_iterator iso_verts_it;
for (iso_verts_it = ubf->isolated_vertices_begin();
@ -96,12 +96,12 @@ Arr_trapezoid_ric_point_location<Arrangement_2>::locate(const Point_2& p) const
Td_active_edge& e (boost::get<Td_active_edge>(tr));
Halfedge_const_handle h = e.halfedge();
CGAL_TRAP_PRINT_DEBUG("CURVE");
if ( m_traits->is_in_x_range_2_object()(h->curve(),p) &&
if ( m_traits->is_in_x_range_2_object()(h->curve(),p) &&
m_traits->compare_y_at_x_2_object()(p,h->curve()) == EQUAL)
return make_result(h);
else {
//ixx
std::cerr << "curve is: "<< h->curve() <<" point is: "<< p <<std::endl;
std::cerr << "curve is: "<< h->curve() <<" point is: "<< p <<std::endl;
CGAL_error();
}
}
@ -112,7 +112,7 @@ Arr_trapezoid_ric_point_location<Arrangement_2>::locate(const Point_2& p) const
Td_active_trapezoid t (boost::get<Td_active_trapezoid>(tr));
Halfedge_const_handle h = t.top();
CGAL_TRAP_PRINT_DEBUG("TRAPEZOID");
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p))
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p))
&& (m_traits->compare_y_at_x_2_object()
(p, h->curve()) == LARGER) ;
bool is_h_ltr = (h->direction() == ARR_LEFT_TO_RIGHT);
@ -143,14 +143,14 @@ Arr_trapezoid_ric_point_location<Arrangement_2>::locate(const Point_2& p) const
}
CGAL_TRAP_PRINT_DEBUG("EMPTY");
return default_result();
return default_result();
}
/*! gets the unbounded face that contains the point when the trapezoid is unbounded
*/
*/
template <class Arrangement>
typename Arr_trapezoid_ric_point_location<Arrangement>::Face_const_handle
typename Arr_trapezoid_ric_point_location<Arrangement>::Face_const_handle
Arr_trapezoid_ric_point_location<Arrangement>::
_get_unbounded_face(const Td_map_item& /* item */, const Point_2& /* p */,
Arr_all_sides_oblivious_tag) const
@ -162,9 +162,9 @@ _get_unbounded_face(const Td_map_item& /* item */, const Point_2& /* p */,
/*! gets the unbounded face that contains the point when the trapezoid
* is unbounded
*/
*/
template <class Arrangement>
typename Arr_trapezoid_ric_point_location<Arrangement>::Face_const_handle
typename Arr_trapezoid_ric_point_location<Arrangement>::Face_const_handle
Arr_trapezoid_ric_point_location<Arrangement>::
_get_unbounded_face(const Td_map_item& item,const Point_2& p,
Arr_not_all_sides_oblivious_tag) const
@ -184,11 +184,11 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p,
}
else if (!tr.is_on_left_boundary()) {
//if top & bottom edges are not defined but the left() curve end is defined
//there are different internal compiler errors if we
// typedef the Locate_type
typename TD::Locate_type td_lt;
typename TD::Locate_type td_lt;
//locate the degenerate trapezoid containing tr.left()
Td_map_item& left_v_item = td.locate(tr.left(),td_lt);
CGAL_assertion(td_lt == TD::POINT);
@ -203,7 +203,7 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p,
he = v.cw_he();
}
//cw_he() holds the "smallest" curve clockwise starting from 12 o'clock
CGAL_assertion_code(Halfedge_const_handle invalid_he);
CGAL_assertion(he != invalid_he);
@ -216,12 +216,12 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p,
else if (!tr.is_on_right_boundary()) {
//if top, bottom, left edges are not defined but the right() curve end
// is defined
//there are different internal compiler errors if we
// typedef the Locate_type
typename TD::Locate_type td_lt;
//locate the degenerate trapezoid of tr.right().
typename TD::Locate_type td_lt;
//locate the degenerate trapezoid of tr.right().
Td_map_item& right_v_item = td.locate(tr.right(),td_lt);
CGAL_assertion(td_lt == TD::POINT);
Halfedge_const_handle he;
@ -234,19 +234,19 @@ _get_unbounded_face(const Td_map_item& item,const Point_2& p,
v(boost::get<Td_active_fictitious_vertex>(right_v_item));
he = v.cw_he();
}
//its cw_he() holds the "smallest" curve clockwise starting from
//its cw_he() holds the "smallest" curve clockwise starting from
// 12 o'clock
CGAL_assertion_code(Halfedge_handle invalid_he);
CGAL_assertion(he != invalid_he);
//the Halfedge_handle source is right_ee.
// this way the face on it's left is the desired one
//MICHAL: maybe add a verification that the above occures
return he->face();
}
//else, on all boundaries (top, bottom, left, right - are not defined),
// this is the only trapezoid in the map
return this->arrangement()->unbounded_faces_begin();
@ -265,12 +265,12 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const
//trying to workaround internal compiler error
typename TD::Locate_type td_lt;
Halfedge_const_handle invalid_he;
Td_map_item& item = td.vertical_ray_shoot(p, td_lt, shoot_up);
// treat special case, where trapezoid is unbounded.
if (td_lt==TD::UNBOUNDED_TRAPEZOID)
{
{
return (_check_isolated_for_vertical_ray_shoot(invalid_he, p, shoot_up, item));
}
@ -287,7 +287,7 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const
{
Td_active_edge& e (boost::get<Td_active_edge>(item));
Halfedge_const_handle h = e.halfedge();
if ((shoot_up && h->direction() == ARR_LEFT_TO_RIGHT) ||
(!shoot_up && h->direction() == ARR_RIGHT_TO_LEFT))
{
@ -300,8 +300,8 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const
{
Td_active_trapezoid trpz (boost::get<Td_active_trapezoid>(item));
Halfedge_const_handle h = (shoot_up) ? trpz.top() : trpz.bottom();
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p))
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p))
&& (m_traits->compare_y_at_x_2_object()
(p, h->curve()) == LARGER) ;
bool is_h_ltr = (h->direction() == ARR_LEFT_TO_RIGHT);
@ -324,12 +324,12 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const
// In vertical ray shoot, when the closest halfedge is found (or unbounded
// face) we check the isolated vertices inside the face to check whether there
// is an isolated vertex right above/below the query point.
//
//
template <class Arrangement>
typename Arr_trapezoid_ric_point_location<Arrangement>::result_type
Arr_trapezoid_ric_point_location<Arrangement>::
_check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found,
const Point_2& p,
_check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found,
const Point_2& p,
bool shoot_up,
const Td_map_item& tr) const
{
@ -350,7 +350,7 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found,
// If the closest feature is a valid halfedge, take its incident face.
// Otherwise, take the unbounded face.
if (halfedge_found == invalid_he)
face = _get_unbounded_face(tr, p, Are_all_sides_oblivious_category());
face = _get_unbounded_face(tr, p, All_sides_oblivious_category());
else
face = halfedge_found->face();

View File

@ -63,11 +63,11 @@ public:
typedef typename Subcurve_traits_2::Top_side_category Top_side_category;
typedef typename Subcurve_traits_2::Right_side_category Right_side_category;
typedef typename Arr_are_all_sides_oblivious_tag<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
Are_all_sides_oblivious_tag;
typedef typename Arr_all_sides_oblivious_category<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
All_sides_oblivious_category;
typedef typename Arr_two_sides_category<Bottom_side_category,
Top_side_category>::result
@ -181,7 +181,7 @@ public:
Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1,
const Point_2& p2)
{ return operator()(xs1, ce1, p2, Are_all_sides_oblivious_tag()); }
{ return operator()(xs1, ce1, p2, All_sides_oblivious_category()); }
/*! Compare two ends of x-monotone curves in x.
* \param xs1 the first curve.
@ -197,7 +197,7 @@ public:
Arr_curve_end ce1,
const X_monotone_subcurve_2& xs2,
Arr_curve_end ce2)
{ return operator()(xs1, ce1, xs2, ce2, Are_all_sides_oblivious_tag()); }
{ return operator()(xs1, ce1, xs2, ce2, All_sides_oblivious_category()); }
private:
// Oblivious implementation
@ -356,7 +356,7 @@ public:
Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1,
const Point_2& p2)
{ return operator()(xs1, ce1, p2, Are_all_sides_oblivious_tag()); }
{ return operator()(xs1, ce1, p2, All_sides_oblivious_category()); }
/*! Compare two ends of x-monotone curves lexicographically.
* \param xs1 the first curve.
@ -372,7 +372,7 @@ public:
Arr_curve_end ce1,
const X_monotone_subcurve_2& xs2,
Arr_curve_end ce2)
{ return operator()(xs1, ce1, xs2, ce2, Are_all_sides_oblivious_tag()); }
{ return operator()(xs1, ce1, xs2, ce2, All_sides_oblivious_category()); }
private:
// Oblivious implementation
@ -749,7 +749,7 @@ public:
if (! m_poly_traits.is_vertical_2_object()(xcv)) {
// Get the index of the subcurve in xcv containing p.
std::size_t i =
m_poly_traits.locate_impl(xcv, p, Are_all_sides_oblivious_tag());
m_poly_traits.locate_impl(xcv, p, All_sides_oblivious_category());
CGAL_precondition(i != INVALID_INDEX);
// Compare the subcurve xcv[i] and p.
@ -792,7 +792,7 @@ public:
Comparison_result operator()(const X_monotone_subcurve_2& xs1,
Arr_curve_end ce1,
const X_monotone_subcurve_2& xs2) const
{ return operator()(xs1, ce1, xs2, Are_all_sides_oblivious_tag()); }
{ return operator()(xs1, ce1, xs2, All_sides_oblivious_category()); }
};
/*! Obtain a Compare_y_at_x_2 functor object. */
@ -1937,7 +1937,7 @@ public:
*/
void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
const
{ push_back_2_impl<void*>(xcv, seg, Are_all_sides_oblivious_tag()); }
{ push_back_2_impl<void*>(xcv, seg, All_sides_oblivious_category()); }
private:
// Oblivious implementation
@ -2131,7 +2131,7 @@ public:
/* Append a subcurve `seg` to an existing polycurve `xcv` at the front. */
void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
const
{ push_front_2_impl<void*>(xcv, seg, Are_all_sides_oblivious_tag()); }
{ push_front_2_impl<void*>(xcv, seg, All_sides_oblivious_category()); }
private:
// Oblivious implementation

View File

@ -68,8 +68,8 @@ public:
typedef typename Base::Top_side_category Top_side_category;
typedef typename Base::Right_side_category Right_side_category;
typedef typename Base::Are_all_sides_oblivious_tag
Are_all_sides_oblivious_tag;
typedef typename Base::All_sides_oblivious_category
All_sides_oblivious_category;
typedef typename Base::X_monotone_subcurve_2 X_monotone_subcurve_2;
typedef typename Base::Size Size;
@ -484,7 +484,7 @@ public:
public:
template <typename OutputIterator>
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
{ return operator_impl(cv, oi, Are_all_sides_oblivious_tag()); }
{ return operator_impl(cv, oi, All_sides_oblivious_category()); }
};
/*! Obtain a Make_x_monotone_2 functor object. */
@ -749,7 +749,7 @@ public:
// Locate the index i1 of the subcurve in cv1 which contains cv2's
// left endpoint.
i1 = m_poly_traits.locate_impl(cv1, cv2[i2], ARR_MIN_END,
Are_all_sides_oblivious_tag());
All_sides_oblivious_category());
if (i1 == Polycurve_traits_2::INVALID_INDEX) return oi;
if (equal(max_vertex(cv1[i1]), min_vertex(cv2[i2]))) {
@ -771,7 +771,7 @@ public:
// Locate the index i2 of the subcurve in cv2 which contains cv1's
// left endpoint.
i2 = m_poly_traits.locate_impl(cv2, cv1[i1], ARR_MIN_END,
Are_all_sides_oblivious_tag());
All_sides_oblivious_category());
if (i2 == Polycurve_traits_2::INVALID_INDEX) return oi;
if (equal(max_vertex(cv2[i2]), min_vertex(cv1[i1]))) {

View File

@ -77,8 +77,8 @@ public:
typedef typename Base::Top_side_category Top_side_category;
typedef typename Base::Right_side_category Right_side_category;
typedef typename Base::Are_all_sides_oblivious_tag
Are_all_sides_oblivious_tag;
typedef typename Base::All_sides_oblivious_category
All_sides_oblivious_category;
typedef typename Base::X_monotone_subcurve_2 X_monotone_subcurve_2;
typedef typename Base::Subcurve_2 Subcurve_2;

View File

@ -150,18 +150,18 @@ protected:
typedef typename Geom_traits::Top_side_category Top_side_category;
typedef typename Geom_traits::Right_side_category Right_side_category;
typedef typename
CGAL::Arr_are_all_sides_non_open_tag<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
Arr_are_all_sides_non_open_category;
CGAL::Arr_all_sides_non_open_category<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
All_sides_not_open_category;
bool is_open() const
{ return is_open(Arr_are_all_sides_non_open_category()); }
{ return is_open(All_sides_not_open_category()); }
bool is_open(CGAL::Arr_all_sides_non_open_tag) const { return false; }
bool is_open(CGAL::Arr_all_sides_not_open_tag) const { return false; }
bool is_open(CGAL::Arr_not_all_sides_non_open_tag) const { return true; }
bool is_open(CGAL::Arr_not_all_sides_not_open_tag) const { return true; }
};
/*! Constructor */

View File

@ -13,11 +13,11 @@ private:
typedef typename Traits::Top_side_category Top_side_category;
typedef typename Traits::Right_side_category Right_side_category;
typedef typename
CGAL::Arr_are_all_sides_oblivious_tag<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
Are_all_sides_oblivious_category;
CGAL::Arr_all_sides_oblivious_category<Left_side_category,
Bottom_side_category,
Top_side_category,
Right_side_category>::result
All_sides_oblivious_category;
typedef typename CGAL::Arr_has_identified_sides<Left_side_category,
Bottom_side_category>::result
@ -31,7 +31,7 @@ public:
Point_compare(const Traits& traits) : m_traits(traits) {}
bool operator()(const Point_2& p1, const Point_2& p2) const
{ return operator()(p1, p2, Are_all_sides_oblivious_category()); }
{ return operator()(p1, p2, All_sides_oblivious_category()); }
private:
// The following set of operators is incomplete, but for now there are
@ -43,9 +43,7 @@ private:
// are oblivious.
bool operator()(const Point_2& p1, const Point_2& p2,
CGAL::Arr_all_sides_oblivious_tag) const
{
return (m_traits.compare_xy_2_object()(p1, p2) == CGAL::SMALLER);
}
{ return (m_traits.compare_xy_2_object()(p1, p2) == CGAL::SMALLER); }
bool operator()(const Point_2& p1, const Point_2& p2,
CGAL::Arr_not_all_sides_oblivious_tag) const
@ -55,9 +53,7 @@ private:
// boundary is not oblivious and all boundaries are not identified.
bool operator()(const Point_2& p1, const Point_2& p2,
boost::mpl::bool_<false>) const
{
return (m_traits.compare_xy_2_object()(p1, p2) == CGAL::SMALLER);
}
{ return (m_traits.compare_xy_2_object()(p1, p2) == CGAL::SMALLER); }
// This function should be invoked for traits classes where at least one
// boundary is identified.