From 390d3a97c643b3b40d80cd8cb81e348dd4873655 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sat, 30 Jun 2012 22:51:10 +0000 Subject: [PATCH 1/4] cleanup --- .../Arrangement_on_surface_2/Point_location_test.h | 4 ++-- .../test/Arrangement_on_surface_2/Traits_base_test.h | 12 ++++++------ .../test/Arrangement_on_surface_2/point_location.cpp | 6 +++--- .../point_location_dynamic.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h index b24c667bcd9..be627e64b2c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h @@ -135,7 +135,7 @@ public: bool allocate_arrangement(); - bool deallocate_arrangement(); + void deallocate_arrangement(); bool construct_arrangement(); @@ -326,7 +326,7 @@ bool Point_location_test::allocate_arrangement() } template -bool Point_location_test::deallocate_arrangement() +void Point_location_test::deallocate_arrangement() { if (m_arr) { delete m_arr; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h index bf625e77b95..44c4efab1b2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h @@ -240,7 +240,7 @@ bool Traits_base_test::perform() this->m_eol_printed = true; std::string line; char buff[1024]; - bool abort = false; + // bool abort = false; int counter = 0; while (this->skip_comments(is, line)) { std::istringstream str_stream(line, std::istringstream::in); @@ -289,7 +289,7 @@ bool Traits_base_test::perform() { //violation is expected but it did not occur result = false; - if (m_abort_on_error) abort = true; + // if (m_abort_on_error) abort = true; } this->print_result(result); test_result &= result; @@ -297,25 +297,25 @@ bool Traits_base_test::perform() catch (CGAL::Precondition_exception /* e */) { if (m_violation_tested != PRECONDITION) { test_result = false; - if (m_abort_on_error) abort = true; + // if (m_abort_on_error) abort = true; } } catch (CGAL::Postcondition_exception /* e */) { if (m_violation_tested != POSTCONDITION) { test_result = false; - if (m_abort_on_error) abort = true; + // if (m_abort_on_error) abort = true; } } catch (CGAL::Warning_exception /* e */) { if (m_violation_tested != WARNING) { test_result = false; - if (m_abort_on_error) abort = true; + // if (m_abort_on_error) abort = true; } } catch (CGAL::Assertion_exception /* e */) { if (m_violation_tested != ASSERTION) { test_result = false; - if (m_abort_on_error) abort = true; + // if (m_abort_on_error) abort = true; } } } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp index 6c4f9fd1b78..1a74700cf7a 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) int success = 0; // Test 1 - for (unsigned int i = 1; i < argc; i += 4) { + for (int i = 1; i < argc; i += 4) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; @@ -168,7 +168,7 @@ int main(int argc, char* argv[]) std::cout << "ERROR : allocating point location strategies!" << std::endl; return -1; } - for (unsigned int i = 1; i < argc; i += 4) { + for (int i = 1; i < argc; i += 4) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) #if TEST_TRAITS == SEGMENT_TRAITS // Test 3 - for (unsigned int i = 1; i < argc; i += 4) { + for (int i = 1; i < argc; i += 4) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_dynamic.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_dynamic.cpp index bff9e1ebf24..ab889d70a6c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_dynamic.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_dynamic.cpp @@ -108,7 +108,7 @@ int main(int argc, char * argv[]) int success = 0; // Test 1 - for (unsigned int i = 1; i < argc; i += 5) { + for (int i = 1; i < argc; i += 5) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; From 349cb198d9d88f7d4e02f9a26423bc4388daadb4 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sat, 30 Jun 2012 22:52:28 +0000 Subject: [PATCH 2/4] cleanup --- .../Arr_point_location/Trapezoidal_decomposition_2.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 c7218e621e9..be1fa40451e 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 @@ -1271,10 +1271,11 @@ protected: public: Trapezoidal_decomposition_2(bool with_guarantees = true) : - m_arr(0), - traits(0), m_largest_leaf_depth(0), - m_number_of_curves(0), + m_largest_leaf_depth(0), m_number_of_dag_nodes(1), + m_number_of_curves(0), + traits(0), + m_arr(0), m_depth_threshold(CGAL_TD_DEFAULT_DEPTH_THRESHOLD), m_size_threshold(CGAL_TD_DEFAULT_SIZE_THRESHOLD) { @@ -1284,11 +1285,11 @@ public: Trapezoidal_decomposition_2(const double& depth_th, const double& size_th, bool with_guarantees = true) : - m_arr(0), - traits(0), m_largest_leaf_depth(0), m_number_of_curves(0), m_number_of_dag_nodes(1), + traits(0), + m_arr(0), m_depth_threshold(depth_th), m_size_threshold(size_th) { From 6aa13f3091ab0ea247d9631ba6eb5d9228c6155b Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sat, 30 Jun 2012 23:16:06 +0000 Subject: [PATCH 3/4] Added missing test --- .../test/Arrangement_on_surface_2/cgal_test_base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index 84b7cbdc465..a95145e32e5 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -1270,9 +1270,9 @@ compile_and_run test_rational_function_traits_2 compile_and_run test_removal compile_and_run test_iso_verts -compile_and_run test_iso_verts compile_and_run test_vert_ray_shoot_vert_segments compile_and_run test_construction +compile_and_run test_overlay test_point_location_segments test_point_location_circle_segments From 29491b5f56b8bdeba6d45cec63cba4145de36dad Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sat, 30 Jun 2012 23:35:30 +0000 Subject: [PATCH 4/4] cleanup --- .../Arr_lm_generator_base.h | 2 +- .../Arr_point_location/Td_active_trapezoid.h | 167 +++++++----------- .../Trapezoidal_decomposition_2_misc.h | 2 +- .../CGAL/Arrangement_2/Arr_traits_adaptor_2.h | 12 +- 4 files changed, 72 insertions(+), 111 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h index 1b07127ac0e..c03d3efa18e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h @@ -151,7 +151,7 @@ public: * arrangement (a vertex, halfedge, or face handle). * \return The nearest landmark point. */ - virtual Point_2 closest_landmark (Point_2 p, Object &obj) + virtual Point_2 closest_landmark (const Point_2 p, Object &obj) { CGAL_assertion(updated); return (nn.find_nearest_neighbor(p, obj)); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h index 004cc5cac82..2eb41f82b00 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h @@ -51,42 +51,42 @@ namespace CGAL { * when one of the four sides is on the parameter space boundary. * Each trapezoid has at most four neighbouring trapezoids. */ -template +template class Td_active_trapezoid : public Handle { public: //type of traits class - typedef Td_traits_ Traits; + typedef Td_traits_ Traits; //type of point (Point_2) - typedef typename Traits::Point Point; + typedef typename Traits::Point Point; //type of X_monotone_curve_2 - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; //type of Curve_end - typedef typename Traits::Curve_end Curve_end; + typedef typename Traits::Curve_end Curve_end; //type of Halfedge_const_handle (trapezoid edge) - typedef typename Traits::Halfedge_const_handle Halfedge_const_handle; + typedef typename Traits::Halfedge_const_handle Halfedge_const_handle; //type of Vertex_const_handle (trapezoid vertex) - typedef typename Traits::Vertex_const_handle Vertex_const_handle; + typedef typename Traits::Vertex_const_handle Vertex_const_handle; //type of Td_active_trapezoid (Self) - typedef typename Traits::Td_active_trapezoid Self; + typedef typename Traits::Td_active_trapezoid Self; - typedef typename Traits::Td_map_item Td_map_item; + typedef typename Traits::Td_map_item Td_map_item; //type of Trapezoidal decomposition - typedef Trapezoidal_decomposition_2 TD; + typedef Trapezoidal_decomposition_2 TD; //type of In face iterator - typedef typename TD::In_face_iterator In_face_iterator; + typedef typename TD::In_face_iterator In_face_iterator; //type of Trapezoidal map search structure - typedef typename TD::Dag_node Dag_node; + typedef typename TD::Dag_node Dag_node; //friend class declarations: @@ -128,8 +128,9 @@ public: const Td_map_item& _rb, const Td_map_item& _rt, Dag_node* _p_node) - : left_v(_left_v),right_v(_right_v),bottom_he(_bottom_he),top_he(_top_he), - lb(_lb),lt(_lt),rb(_rb),rt(_rt),p_node(_p_node) + : left_v(_left_v), right_v(_right_v), + bottom_he(_bottom_he), top_he(_top_he), + lb(_lb), lt(_lt), rb(_rb), rt(_rt), p_node(_p_node) { } ~Data() { } @@ -150,24 +151,23 @@ public: Data* ptr() const { return (Data*)(PTR); } - - - #ifndef CGAL_TD_DEBUG #ifdef CGAL_PM_FRIEND_CLASS - protected: +protected: #else - public: // workaround +public: // workaround #endif #else //CGAL_TD_DEBUG - public: +public: #endif //CGAL_TD_DEBUG //Dag_node* m_dag_node; //pointer to the search structure (DAG) node /*! Initialize the trapezoid's neighbours. */ - inline void init_neighbours(boost::optional lb, boost::optional lt, - boost::optional rb, boost::optional rt) + inline void init_neighbours(boost::optional lb, + boost::optional lt, + boost::optional rb, + boost::optional rt) { set_lb((lb) ? *lb : Td_map_item(0)); set_lt((lt) ? *lt : Td_map_item(0)); @@ -185,27 +185,19 @@ public: // // CGAL_assertion(!p || **p == *this); // -//#endif - +//#endif } /*! Set the trapezoid's left (Vertex_const_handle). */ - inline void set_left(Vertex_const_handle v) - { - ptr()->left_v = v; - } + inline void set_left(Vertex_const_handle v) { ptr()->left_v = v; } /*! Set the trapezoid's right (Vertex_const_handle). */ - inline void set_right(Vertex_const_handle v) - { - ptr()->right_v = v; - } + inline void set_right(Vertex_const_handle v) { ptr()->right_v = v; } /*! Set the trapezoid's bottom (Halfedge_const_handle). */ inline void set_bottom(Halfedge_const_handle he) { - if (!is_on_bottom_boundary() && - bottom()->direction() != he->direction()) + if (!is_on_bottom_boundary() && (bottom()->direction() != he->direction())) { ptr()->bottom_he = he->twin(); } @@ -218,8 +210,7 @@ public: /*! Set the trapezoid's top (Halfedge_const_handle). */ inline void set_top(Halfedge_const_handle he) { - if (!is_on_top_boundary() && - top()->direction() != he->direction()) + if (!is_on_top_boundary() && (top()->direction() != he->direction())) { ptr()->top_he = he->twin(); } @@ -252,27 +243,28 @@ public: { //define the initial trapezoid: left, right, btm, top are at infinity. // has no neighbours - PTR = new Data - (Traits::empty_vtx_handle(), - Traits::empty_vtx_handle(), - Traits::empty_he_handle(), - Traits::empty_he_handle(), - Td_map_item(0), Td_map_item(0) , Td_map_item(0) , Td_map_item(0), NULL); + PTR = new Data(Traits::empty_vtx_handle(), + Traits::empty_vtx_handle(), + Traits::empty_he_handle(), + Traits::empty_he_handle(), + Td_map_item(0), Td_map_item(0) , + Td_map_item(0), Td_map_item(0), NULL); //m_dag_node = 0; } /*! Constructor given Vertex & Halfedge handles. */ Td_active_trapezoid (Vertex_const_handle l, Vertex_const_handle r, - Halfedge_const_handle b, Halfedge_const_handle t, - boost::optional lb = boost::none, - boost::optional lt = boost::none, - boost::optional rb = boost::none, - boost::optional rt = boost::none, - Dag_node* node = 0) + Halfedge_const_handle b, Halfedge_const_handle t, + boost::optional lb = boost::none, + boost::optional lt = boost::none, + boost::optional rb = boost::none, + boost::optional rt = boost::none, + Dag_node* node = 0) { - PTR = new Data (l, r, b, t, (lb) ? *lb : Td_map_item(0), (lt) ? *lt : Td_map_item(0), - (rb) ? *rb : Td_map_item(0), (rt) ? *rt : Td_map_item(0), node); + PTR = new Data(l, r, b, t, (lb) ? *lb : Td_map_item(0), + (lt) ? *lt : Td_map_item(0), (rb) ? *rb : Td_map_item(0), + (rt) ? *rt : Td_map_item(0), node); //m_dag_node = node; } @@ -292,20 +284,20 @@ public: * operator= should not copy m_dag_node (or otherwise update * Dag_node::replace) */ - inline Self& operator= (const Self& t2) + inline Self& operator=(const Self& t2) { - Handle::operator=(t2); - return *this; + Handle::operator=(t2); + return *this; } /*! Operator==. */ - inline bool operator== (const Self& t2) const + inline bool operator==(const Self& t2) const { return (ptr() == t2.ptr()); } /*! Operator!=. */ - inline bool operator!= (const Self& t2) const + inline bool operator!=(const Self& t2) const { return !(operator==(t2)); } @@ -316,99 +308,70 @@ public: /// \name Access methods. //@{ - inline Self& self() - { - return *this; - } + inline Self& self() { return *this; } - inline const Self& self() const - { - return *this; - } + inline const Self& self() const { return *this; } /*! Access the trapezoid id (PTR). */ - inline unsigned long id() const - { - return (unsigned long) PTR; - } + inline unsigned long id() const { return (unsigned long) PTR; } /*! Access trapezoid left. * filters out the infinite case which returns predefined dummy values */ - inline Vertex_const_handle left() const - { - return ptr()->left_v; - } + inline Vertex_const_handle left() const { return ptr()->left_v; } /*! Access trapezoid right. * filters out the infinite case which returns predefined dummy values */ - inline Vertex_const_handle right () const - { - return ptr()->right_v; - } + inline Vertex_const_handle right() const { return ptr()->right_v; } /*! Access trapezoid bottom. * filters out the infinite case which returns predefined dummy values */ - inline Halfedge_const_handle bottom () const - { - return ptr()->bottom_he; - } + inline Halfedge_const_handle bottom() const { return ptr()->bottom_he; } /*! Access trapezoid top. * filters out the infinite case which returns predefined dummy values */ - inline Halfedge_const_handle top () const - { - return ptr()->top_he; - } + inline Halfedge_const_handle top() const { return ptr()->top_he; } /*! Access is on left boundary. */ inline bool is_on_left_boundary() const - { - return (left() == Traits::empty_vtx_handle()); - } + { return (left() == Traits::empty_vtx_handle()); } /*! Access is on right boundary. */ inline bool is_on_right_boundary() const - { - return (right() == Traits::empty_vtx_handle()); - } + { return (right() == Traits::empty_vtx_handle()); } /*! Access is on bottom boundary. */ inline bool is_on_bottom_boundary() const - { - return (bottom() == Traits::empty_he_handle()); - } + { return (bottom() == Traits::empty_he_handle()); } /*! Access is on top boundary. */ inline bool is_on_top_boundary() const - { - return (top() == Traits::empty_he_handle()); - } + { return (top() == Traits::empty_he_handle()); } /*! Access is on at least one boundary. */ inline bool is_on_boundaries() const { return (is_on_left_boundary() || is_on_right_boundary() || - is_on_bottom_boundary() || is_on_top_boundary() ); + is_on_bottom_boundary() || is_on_top_boundary()); } /*! Access left bottom neighbour. */ - Td_map_item& lb() const { return ptr()->lb; } + Td_map_item& lb() const { return ptr()->lb; } /*! Access left top neighbour. */ - Td_map_item& lt() const { return ptr()->lt; } + Td_map_item& lt() const { return ptr()->lt; } /*! Access right bottom neighbour. */ - Td_map_item& rb() const { return ptr()->rb; } + Td_map_item& rb() const { return ptr()->rb; } /*! Access right top neighbour. */ - Td_map_item& rt() const { return ptr()->rt; } + Td_map_item& rt() const { return ptr()->rt; } /*! Access DAG node. */ - Dag_node* dag_node() const {return ptr()->p_node; } + Dag_node* dag_node() const {return ptr()->p_node; } void clear_neighbors() { @@ -459,8 +422,6 @@ public: } CGAL_assertion(is_on_right_boundary() == right.is_on_right_boundary()); } - - }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h index 76a6a5fe323..f2e47dbbb4b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h @@ -51,7 +51,7 @@ #define CGAL_TD_DEFAULT_SIZE_THRESHOLD 12 #ifndef _MSC_VER -#if !defined __GNUC__ || __GNUC__>2 || __GNUC__==2 && __GNUC_MINOR__>=95 +#if !defined __GNUC__ || __GNUC__> 3 || ((__GNUC__== 3) && (__GNUC_MINOR__> 4)) #define CGAL_PM_FRIEND_CLASS #endif #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index ca6d9194b21..d01efa3c953 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -1135,8 +1135,8 @@ public: } Comparison_result comp_x_on_bnd(const Point_2&, - const X_monotone_curve_2& xcv, - Arr_curve_end ce, + const X_monotone_curve_2& /* xcv */, + Arr_curve_end /* ce */, Arr_use_dummy_tag) const { CGAL_error(); @@ -1153,10 +1153,10 @@ public: return m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); } - Comparison_result comp_x_on_bnd(const X_monotone_curve_2& - xcv1, Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce2, + Comparison_result comp_x_on_bnd(const X_monotone_curve_2& /* xcv1 */, + Arr_curve_end /* ce1 */, + const X_monotone_curve_2& /* xcv2 */, + Arr_curve_end /* ce2 */, Arr_use_dummy_tag) const { CGAL_error();