diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h index 374f9adb9cd..91f059268f9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h @@ -50,7 +50,8 @@ public: //type of td map items type enum Type { - TD_ACTIVE_TRAPEZOID = 0, + NIL = 0, + TD_ACTIVE_TRAPEZOID, TD_INACTIVE_TRAPEZOID, TD_ACTIVE_EDGE, TD_INACTIVE_EDGE, @@ -104,6 +105,9 @@ public: //MICHAL: in order to compile need to rename typedefs + //struct nil { }; + typedef unsigned char nil; + //! type of Td_active_edge typedef Td_active_edge Td_active_edge; @@ -123,7 +127,8 @@ public: typedef Td_inactive_fictitious_vertex Td_inactive_fictitious_vertex; //! type of td map item (Td_halfedge, Td_vertex or Td_trapezoid) - typedef boost::variant< Td_active_trapezoid, Td_inactive_trapezoid, + typedef boost::variant< nil, + Td_active_trapezoid, Td_inactive_trapezoid, Td_active_edge, Td_inactive_edge, Td_active_vertex, Td_active_fictitious_vertex, Td_inactive_vertex, Td_inactive_fictitious_vertex > Td_map_item; @@ -892,22 +897,6 @@ public: ~Td_traits(void) { - if (m_p_vtx_at_lt_inf) { - delete m_p_vtx_at_lt_inf; - m_p_vtx_at_lt_inf = 0; - } - if (m_p_vtx_at_rt_inf) { - delete m_p_vtx_at_rt_inf; - m_p_vtx_at_rt_inf = 0; - } - if (m_p_he_at_btm_inf) { - delete m_p_he_at_btm_inf; - m_p_he_at_btm_inf = 0; - } - if (m_p_he_at_top_inf) { - delete m_p_he_at_top_inf; - m_p_he_at_top_inf = 0; - } } public: @@ -996,33 +985,33 @@ public: } } - //returns true if the trapezoid is a point or a curve - bool is_degenerate(const Td_map_item& tr) const - { - switch (tr.which()) - { - case TD_ACTIVE_TRAPEZOID: - case TD_INACTIVE_TRAPEZOID: - return false; - default: - return true; - } - } + ////returns true if the trapezoid is a point or a curve + //bool is_degenerate(const Td_map_item& tr) const + //{ + // switch (tr.which()) + // { + // case TD_ACTIVE_TRAPEZOID: + // case TD_INACTIVE_TRAPEZOID: + // return false; + // default: + // return true; + // } + //} - //returns true if the trapezoid is a point - bool is_degenerate_point(const Td_map_item& tr) const //MICHAL: TBR - { - switch (tr.which()) - { - case TD_ACTIVE_VERTEX: - case TD_ACTIVE_FICTITIOUS_VERTEX: - case TD_INACTIVE_VERTEX: - case TD_INACTIVE_FICTITIOUS_VERTEX: - return true; - default: - return false; - } - } + ////returns true if the trapezoid is a point + //bool is_degenerate_point(const Td_map_item& tr) const //MICHAL: TBR + //{ + // switch (tr.which()) + // { + // case TD_ACTIVE_VERTEX: + // case TD_ACTIVE_FICTITIOUS_VERTEX: + // case TD_INACTIVE_VERTEX: + // case TD_INACTIVE_FICTITIOUS_VERTEX: + // return true; + // default: + // return false; + // } + //} //returns true if the map item is a vertex bool is_td_vertex(const Td_map_item& tr) const @@ -1041,18 +1030,18 @@ public: - //returns true if the trapezoid is a curve - bool is_degenerate_curve(const Td_map_item& tr) const //MICHAL: TBR - { - switch (tr.which()) - { - case TD_ACTIVE_EDGE: - case TD_INACTIVE_EDGE: - return true; - default: - return false; - } - } + ////returns true if the trapezoid is a curve + //bool is_degenerate_curve(const Td_map_item& tr) const //MICHAL: TBR + //{ + // switch (tr.which()) + // { + // case TD_ACTIVE_EDGE: + // case TD_INACTIVE_EDGE: + // return true; + // default: + // return false; + // } + //} //returns true if the map item is an edge bool is_td_edge(const Td_map_item& tr) const @@ -1225,22 +1214,15 @@ public: //static Td_map_item blank_item() const { return m_blank; } static Vertex_const_handle empty_vtx_handle() { return m_empty_vtx_handle; } static Halfedge_const_handle empty_he_handle() { return m_empty_he_handle; } - - static Vertex_const_handle vtx_at_left_infinity(); - static Vertex_const_handle vtx_at_right_infinity(); - static Halfedge_const_handle he_at_bottom_infinity(); - static Halfedge_const_handle he_at_top_infinity(); - + //static Td_map_item empty_map_item() { return m_empty_map_item; } + private: //static Td_map_item m_blank; static Vertex_const_handle m_empty_vtx_handle; static Halfedge_const_handle m_empty_he_handle; - - static Vertex_const_handle* m_p_vtx_at_lt_inf; - static Vertex_const_handle* m_p_vtx_at_rt_inf; - static Halfedge_const_handle* m_p_he_at_btm_inf; - static Halfedge_const_handle* m_p_he_at_top_inf; + //static Td_map_item m_empty_map_item; + }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h index fa8726dbb81..090af00ca14 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h @@ -23,45 +23,6 @@ namespace CGAL { -template -typename Td_traits::Vertex_const_handle -Td_traits::vtx_at_left_infinity() -{ - // static Vertex_const_handle* m_p_vtx_at_lt_inf; - if (!m_p_vtx_at_lt_inf) - m_p_vtx_at_lt_inf = new Vertex_const_handle(); - return *m_p_vtx_at_lt_inf; -} - -template -typename Td_traits::Vertex_const_handle -Td_traits::vtx_at_right_infinity() -{ - // static Vertex_const_handle* m_p_vtx_at_rt_inf; - if (!m_p_vtx_at_rt_inf) - m_p_vtx_at_rt_inf = new Vertex_const_handle(); - return *m_p_vtx_at_rt_inf; -} - -template -typename Td_traits::Halfedge_const_handle -Td_traits::he_at_bottom_infinity() -{ - // static Halfedge_const_handle* m_p_he_at_btm_inf; - if (!m_p_he_at_btm_inf) - m_p_he_at_btm_inf = new Halfedge_const_handle(); - return *m_p_he_at_btm_inf; -} - -template -typename Td_traits::Halfedge_const_handle -Td_traits::he_at_top_infinity() -{ - // static Halfedge_const_handle* m_p_he_at_top_inf; - if (!m_p_he_at_top_inf) - m_p_he_at_top_inf = new Halfedge_const_handle(); - return *m_p_he_at_top_inf; -} /* template typename Td_traits::Td_map_item @@ -75,20 +36,8 @@ template typename Td_traits::Halfedge_const_handle Td_traits::m_empty_he_handle = Halfedge_const_handle(); -template -typename Td_traits::Vertex_const_handle * -Td_traits::m_p_vtx_at_lt_inf = 0; - -template -typename Td_traits::Vertex_const_handle * -Td_traits::m_p_vtx_at_rt_inf = 0; - -template -typename Td_traits::Halfedge_const_handle * -Td_traits::m_p_he_at_btm_inf = 0; - -template -typename Td_traits::Halfedge_const_handle * -Td_traits::m_p_he_at_top_inf = 0; +//template +//typename Td_traits::Td_map_item +//Td_traits::m_empty_map_item = Td_map_item(); } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h index 65792bb979e..dfde209b23e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h @@ -110,6 +110,9 @@ public: //type of td_map_item typedef typename Traits::Td_map_item Td_map_item; + //type of nil + typedef typename Traits::nil nil; + //type of Td_active_trapezoid typedef typename Traits::Td_active_trapezoid Td_active_trapezoid; @@ -757,6 +760,12 @@ public: class rb_visitor : public boost::static_visitor< boost::optional > { public: + boost::optional operator()(nil& t) const + { + CGAL_assertion(false); + return boost::none; + } + template < typename T > boost::optional operator()(T& t) const { @@ -769,6 +778,11 @@ public: public: set_rb_visitor (boost::optional rb) : m_rb(rb) {} + void operator()(nil& t) const + { + CGAL_assertion(false); + } + template < typename T > void operator()(T& t) const { @@ -781,6 +795,12 @@ public: class rt_visitor : public boost::static_visitor< boost::optional > { public: + boost::optional operator()(nil& t) const + { + CGAL_assertion(false); + return boost::none; + } + template < typename T > boost::optional operator()(T& t) const { @@ -793,6 +813,11 @@ public: public: set_rt_visitor (boost::optional rt) : m_rt(rt) {} + void operator()(nil& t) const + { + CGAL_assertion(false); + } + template < typename T > void operator()(T& t) const { @@ -805,6 +830,12 @@ public: class lb_visitor : public boost::static_visitor< boost::optional > { public: + boost::optional operator()(nil& t) const + { + CGAL_assertion(false); + return boost::none; + } + template < typename T > boost::optional operator()(T& t) const { @@ -817,6 +848,11 @@ public: public: set_lb_visitor (boost::optional lb) : m_lb(lb) {} + void operator()(nil& t) const + { + CGAL_assertion(false); + } + template < typename T > void operator()(T& t) const { @@ -829,6 +865,12 @@ public: class lt_visitor : public boost::static_visitor< boost::optional > { public: + boost::optional operator()(nil& t) const + { + CGAL_assertion(false); + return boost::none; + } + template < typename T > boost::optional operator()(T& t) const { @@ -840,7 +882,12 @@ public: { public: set_lt_visitor (boost::optional lt) : m_lt(lt) {} - + + void operator()(nil& t) const + { + CGAL_assertion(false); + } + template < typename T > void operator()(T& t) const { @@ -901,6 +948,12 @@ public: class dag_node_visitor : public boost::static_visitor< Dag_node* > { public: + Dag_node* operator()(nil& t) const + { + CGAL_assertion(false); + return NULL; + } + template < typename T > Dag_node* operator()(T& t) const { @@ -913,6 +966,11 @@ public: public: set_dag_node_visitor(Dag_node* node):m_node(node) {} + void operator()(nil& t) const + { + CGAL_assertion(false); + } + template < typename T > void operator()(T& t) const { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h index 1547f953a43..f51461b0de8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h @@ -115,14 +115,14 @@ std::ostream& write(std::ostream &out,const Td_X_trapezoid& t, else pad=true; out << name[j]; // identify neighbours - if (traits.is_degenerate_point(t) && value[j]) + if (traits.is_td_vertex(t) && value[j]) out << "=" << value[j]->top(); } out << ")" << std::flush; if (t.is_active()) { - if (!traits.is_degenerate(t)) + if (traits.is_td_trapezoid(t)) { if (t.is_unbounded()) { @@ -140,7 +140,7 @@ std::ostream& write(std::ostream &out,const Td_X_trapezoid& t, else out << ",T"; } - else if (traits.is_degenerate_curve(t)) + else if (traits.is_td_edge(t)) out << ",C"; else // if (t.is_degenerate_point()) out << ",P"; @@ -226,7 +226,7 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid& t) { out << name[j]; // identify neighbours - if (traits.is_degenerate_point(t) && value[j]) + if (traits.is_td_vertex(t) && value[j]) out << "=" << value[j]->top(); out << " "; } @@ -234,7 +234,7 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid& t) if (t.is_active()) { - if (!traits.is_degenerate(t)) + if (traits.is_td_trapezoid(t)) { if (t.is_unbounded()) { @@ -251,7 +251,7 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid& t) else out << ",T"; } - else if (traits.is_degenerate_curve(t)) + else if (traits.is_td_edge(t)) out << ",C"; else // if (t.is_degenerate_point()) out << ",P";