diff --git a/.github/workflows/Remove_labels.yml b/.github/workflows/Remove_labels.yml index 8e9ed55f6bd..0624fe7a1df 100644 --- a/.github/workflows/Remove_labels.yml +++ b/.github/workflows/Remove_labels.yml @@ -2,6 +2,7 @@ name: remove_labels on: pull_request_target: types: [synchronize] + workflow_dispatch: jobs: remove_label: runs-on: ubuntu-latest diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index 6f41cf308c4..a2ee453953d 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -47,7 +47,7 @@ jobs: //get pullrequest url const pr_number = context.payload.issue.number return pr_number - + - name: Emoji-comment uses: actions/github-script@v6 if: steps.get_round.outputs.result != 'stop' @@ -59,14 +59,13 @@ jobs: repo: context.repo.repo, content: 'rocket' }) - + - uses: actions/checkout@v3 name: "checkout branch" if: steps.get_round.outputs.result != 'stop' with: repository: ${{ github.repository }} ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge - token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }} fetch-depth: 2 - name: install dependencies @@ -74,7 +73,7 @@ jobs: run: | set -x sudo apt-get update && sudo apt-get install -y graphviz ssh bibtex2html - sudo pip install lxml==4.6.3 + sudo pip install lxml sudo pip install pyquery wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_8_13_patched/doxygen sudo mv doxygen_exe /usr/bin/doxygen diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b3350371607..0af6e276e6e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,6 +1,6 @@ name: CMake Test Merge Branch -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/cmake-all.yml b/.github/workflows/cmake-all.yml index 1eea5e59aa9..d0507b4d430 100644 --- a/.github/workflows/cmake-all.yml +++ b/.github/workflows/cmake-all.yml @@ -1,6 +1,6 @@ name: CMake Testsuite -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/delete_doc.yml b/.github/workflows/delete_doc.yml index 497013a51eb..38f5ab445ac 100644 --- a/.github/workflows/delete_doc.yml +++ b/.github/workflows/delete_doc.yml @@ -2,7 +2,7 @@ name: Documentation Removal on: pull_request_target: - types: [closed, removed] + types: [closed, removed, workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 07dee615268..123458ebe04 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -1,6 +1,6 @@ name: Test Polyhedron Demo -on: [push, pull_request] +on: [push, pull_request,workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/filter_testsuite.yml b/.github/workflows/filter_testsuite.yml index 9b222b77eb3..48e4f39d65c 100644 --- a/.github/workflows/filter_testsuite.yml +++ b/.github/workflows/filter_testsuite.yml @@ -3,6 +3,7 @@ name: Filter Testsuite on: issue_comment: types: [created] + workflow_dispatch: permissions: {} jobs: diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp index be62a491733..866c66016d1 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp @@ -2,7 +2,6 @@ // A face overlay of two arrangements with unbounded faces. #include -#include #include #include @@ -14,7 +13,7 @@ // Define a functor for creating a label from a character and an integer. struct Overlay_label { std::string operator()(char c, unsigned int i) const - { return c + boost::lexical_cast(i); } + { return c + std::to_string(i); } }; typedef CGAL::Arr_face_extended_dcel Dcel_dlue; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h index c81fafaaeac..169864e1de1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h @@ -153,14 +153,19 @@ public: Dag_node* m_dag_node; //pointer to the search structure (DAG) node /*! Initialize the trapezoid's neighbors. */ - CGAL_TD_INLINE void init_neighbours(Self* lb_ = 0, Self* lt_ = 0, - Self* rb_ = 0, Self* rt_ = 0) + CGAL_TD_INLINE void init_neighbors(Self* lb_ = 0, Self* lt_ = 0, + Self* rb_ = 0, Self* rt_ = 0) { set_lb(lb_); set_lt(lt_); set_rb(rb_); set_rt(rt_); } + /*! \copydoc init_neighbors + * \deprecated please use #init_neighbors */ + CGAL_DEPRECATED CGAL_TD_INLINE void init_neighbours(Self* lb_ = 0, Self* lt_ = 0, + Self* rb_ = 0, Self* rt_ = 0) + { init_neighbors(lb_, lt_, rb_, rt_); } /*! Set the DAG node. */ CGAL_TD_INLINE void set_dag_node(Dag_node* p) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h index 2f400786e75..f901bb72565 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h @@ -145,10 +145,14 @@ public: //Dag_node* m_dag_node; //pointer to the search structure (DAG) node /*! Initialize the trapezoid's neighbors. */ - inline void init_neighbours(boost::optional next) + inline void init_neighbors(boost::optional next) { set_next((next) ? *next : Td_map_item(0)); } + /*! \copydoc init_neighbors + * \deprecated please use #init_neighbors */ + CGAL_DEPRECATED inline void init_neighbours(boost::optional next) + { init_neighbors(next); } /*! Set the DAG node. */ CGAL_TD_INLINE void set_dag_node(Dag_node* p) 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 84ba82d4fff..06b384daed9 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 @@ -163,14 +163,19 @@ private: //Dag_node* m_dag_node; //pointer to the search structure (DAG) node /*! Initialize the trapezoid's neighbors. */ - inline void init_neighbours(boost::optional lb, boost::optional lt, - boost::optional rb, boost::optional rt) + inline void init_neighbors(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)); set_rb((rb) ? *rb : Td_map_item(0)); set_rt((rt) ? *rt : Td_map_item(0)); } + /*! \copydoc init_neighbors + * \deprecated please use #init_neighbors */ + CGAL_DEPRECATED inline void init_neighbours(boost::optional lb, boost::optional lt, + boost::optional rb, boost::optional rt) + { init_neighbors(lb, lt, rb, rt); } /*! Set the DAG node. */ inline void set_dag_node(Dag_node* p) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h index e7d8ae645f6..15c72e81945 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h @@ -72,10 +72,10 @@ split_trapezoid_by_vertex(Dag_node& split_node, CGAL_warning(left_tr.is_on_left_boundary() == tr.is_on_left_boundary()); CGAL_warning(right_tr.is_on_right_boundary() == tr.is_on_right_boundary()); - left_tr.init_neighbours(tr.lb(), tr.lt(), - right_node.get_data(), right_node.get_data()); - right_tr.init_neighbours(left_node.get_data(), left_node.get_data(), - tr.rb(), tr.rt()); + left_tr.init_neighbors(tr.lb(), tr.lt(), + right_node.get_data(), right_node.get_data()); + right_tr.init_neighbors(left_node.get_data(), left_node.get_data(), + tr.rb(), tr.rt()); if (!traits->is_empty_item(tr.lb())) { Td_active_trapezoid& lb(boost::get(tr.lb())); lb.set_rb(left_node.get_data()); @@ -109,10 +109,10 @@ split_trapezoid_by_vertex(Dag_node& split_node, //CGAL_warning(left_e.is_on_left_boundary() == e.is_on_left_boundary()); //CGAL_warning(right_e.is_on_right_boundary() == e.is_on_right_boundary()); - left_e.init_neighbours(boost::none); - //left_e.init_neighbours(e.lb(),e.lt(),Td_map_item(),right_node.get_data()); - right_e.init_neighbours(e.next()); - //right_e.init_neighbours(left_node.get_data(),left_node.get_data(),e.rb(),e.rt()); + left_e.init_neighbors(boost::none); + //left_e.init_neighbors(e.lb(),e.lt(),Td_map_item(),right_node.get_data()); + right_e.init_neighbors(e.next()); + //right_e.init_neighbors(left_node.get_data(),left_node.get_data(),e.rb(),e.rt()); } // left and right are set to the point itself, @@ -307,8 +307,8 @@ split_trapezoid_by_halfedge(Dag_node& split_node, Td_active_trapezoid& top = boost::get(top_node.get_data()); - top.init_neighbours(prev_top_tr, split_tr.lt(), boost::none , split_tr.rt()); - bottom.init_neighbours(split_tr.lb(), prev_bottom_tr, split_tr.rb(), + top.init_neighbors(prev_top_tr, split_tr.lt(), boost::none , split_tr.rt()); + bottom.init_neighbors(split_tr.lb(), prev_bottom_tr, split_tr.rb(), boost::none); if (!traits->is_empty_item(prev_bottom_tr)) { @@ -2340,7 +2340,7 @@ vertical_ray_shoot(const Point & p,Locate_type & lt, // } // else // new_left_t is leftmost representative for he // { -// //set_neighbours_after_split_halfedge_update (new_left_t, t1, he1, he2); //MICHAL: this method does nothing +// //set_neighbors_after_split_halfedge_update (new_left_t, t1, he1, he2); //MICHAL: this method does nothing // } // if (t1.rt()==&old_t) t1.set_rt(&new_left_t); // if (t1.lb()==&old_t) t1.set_lb(&new_left_t); @@ -2366,7 +2366,7 @@ vertical_ray_shoot(const Point & p,Locate_type & lt, // } // else // new_right_t is rightmost representative for te // { -// //set_neighbours_after_split_halfedge_update (new_right_t,t2,he1, he2,false); //MICHAL: this method does nothing +// //set_neighbors_after_split_halfedge_update (new_right_t,t2,he1, he2,false); //MICHAL: this method does nothing // } // if (t2.rt()==&old_t) t2.set_rt(&new_right_t); // if (t2.lb()==&old_t) t2.set_lb(&new_right_t); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index fbe5e059eef..9175587a317 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -215,16 +215,16 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const /*! We identify 2 main cases: * 1. The vertical ray intersects the boundary at a halfedge. In this - * case the x-possition of p is strictly larger than the x-possition of - * the current-curve source, and strictly smaller than x-possition of + * case the x-position of p is strictly larger than the x-position of + * the current-curve source, and strictly smaller than x-position of * the current-curve target, or vice versa. * 2. The vertical ray intersects the boundary at a vertex. In this case: - * a. the x-possition of p is strictly smaller than the x-position of the + * a. the x-position of p is strictly smaller than the x-position of the * current-curve source, and equal to the x-position of the current-curve * target, and - * b. the x-possition of p is equal to the x-position of the next-curve + * b. the x-position of p is equal to the x-position of the next-curve * source (not counting vertical curves in between), and strictly larger - * than the x-possition of the next-curve target, or vice verase (that is, + * than the x-position of the next-curve target, or vice verase (that is, * the "smaller" and "larger" interchanged). */ diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h index 1d74799b4a3..f9551ac46fa 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h @@ -1065,7 +1065,7 @@ void draw_lump(std::vector< Coord_2 >& rev_points, int& last_x, if(set_ready) ready = true; - if(!test_neighbourhood(pix, back_dir, new_dir)) { + if(!test_neighborhood(pix, back_dir, new_dir)) { ux = pix.x; uy = pix.y; if(witness == pix) { // witness subpixel is a pixel itself @@ -1095,7 +1095,7 @@ void draw_lump(std::vector< Coord_2 >& rev_points, int& last_x, stored_prev = prev_pix; } - if(!test_neighbourhood(pix, back_dir, new_dir)) { + if(!test_neighborhood(pix, back_dir, new_dir)) { if(stored_dir != -1) { pix = stored_pix; prev_pix = stored_prev; @@ -1257,7 +1257,7 @@ bool subdivide(Pixel_2& pix, int back_dir, int& new_dir) { pix.sub_y = (pix.sub_y<<1) + (idx>>1); //Gfx_DETAILED_OUT("subpixel index: " << idx << " (" << pix.sub_x << "; " // << pix.sub_y << ")" << std::endl); - if(!test_neighbourhood(pix, back_dir, new_dir)) + if(!test_neighborhood(pix, back_dir, new_dir)) return subdivide(pix,back_dir,new_dir); //Gfx_DETAILED_OUT("new direction found: " << new_dir << " at a pixel:" << //pix << std::endl); @@ -1313,7 +1313,7 @@ bool get_seed_point(const Rational& seed, Pixel_2& start, int *dir, << start.level << std::endl; throw internal::Insufficient_rasterize_precision_exception(); } - //dump_neighbourhood(start); + //dump_neighborhood(start); if(limit(engine.pixel_w/NT(lvl))||limit(engine.pixel_h/NT(lvl))) { std::cerr << "get_seed_point: too small subpixel size: " << @@ -1425,7 +1425,7 @@ bool test_pixel(const Pixel_2& pix, int *dir, int *b_taken, bool& b_coincide) /* Gfx_OUT("test pixel: " << pix << "--------------------------------\n"); - dump_neighbourhood(pix); + dump_neighborhood(pix); Gfx_OUT("----------------------------------------------\n\n");*/ b_coincide = false; @@ -1913,7 +1913,7 @@ inline void get_polynomials(int var, Stripe& stripe) { * if \c CGAL_CKVA_RENDER_WITH_REFINEMENT is set, in case of success \c pix * receives double approximations of intersection point */ -bool test_neighbourhood(Pixel_2& pix, int dir, int& new_dir) +bool test_neighborhood(Pixel_2& pix, int dir, int& new_dir) { NT lvl = NT(one << pix.level); NT inv = NT(1.0) / lvl; @@ -2258,6 +2258,11 @@ Lexit: pix.yv = CGAL::to_double(engine.y_min + y*engine.pixel_h); return ret; } +/*! \copydoc test_neighborhood + * \deprecated please use #test_neighborhood */ +CGAL_DEPRECATED bool test_neighbourhood(Pixel_2& pix, int dir, int& new_dir) +{ return test_neighborhood(pix, new_dir); } + #endif // CGAL_CKVA_RENDER_WITH_REFINEMENT //! \brief returns whether a polynomial has zero over an interval, @@ -2585,7 +2590,7 @@ inline bool is_isolated_pixel(const Pixel_2& /* pix */) { // DEBUG ONLY #ifdef Gfx_USE_OUT -void dump_neighbourhood(const Pixel_2& pix) { +void dump_neighborhood(const Pixel_2& pix) { CGAL::IO::set_mode(std::cerr, CGAL::IO::PRETTY); CGAL::IO::set_mode(std::cout, CGAL::IO::PRETTY); @@ -2764,8 +2769,10 @@ void dump_neighbourhood(const Pixel_2& pix) { Gfx_OUT("sign change at segment 2" << std::endl); } #else -void dump_neighbourhood(const Pixel_2&) { } +void dump_neighborhood(const Pixel_2&) { } #endif // Gfx_USE_OUT +CGAL_DEPRECATED void dump_neighbourhood(const Pixel_2& pix) +{ dump_neighborhood(pix); } //!@} }; // class Curve_renderer_2<> diff --git a/BGL/include/CGAL/draw_face_graph.h b/BGL/include/CGAL/draw_face_graph.h index 02a96433146..7e1de8031ec 100644 --- a/BGL/include/CGAL/draw_face_graph.h +++ b/BGL/include/CGAL/draw_face_graph.h @@ -19,21 +19,32 @@ #include #include -namespace CGAL -{ +namespace CGAL { // Default color functor; user can change it to have its own face color struct DefaultColorFunctorFaceGraph { template - CGAL::IO::Color operator()(const Graph&, - typename boost::graph_traits::face_descriptor fh) const + CGAL::IO::Color operator()(const Graph& /*g*/, + typename boost::graph_traits::face_descriptor /*f*/) const { - if (fh==boost::graph_traits::null_face()) // use to get the mono color - return CGAL::IO::Color(100, 125, 200); // R G B between 0-255 - return get_random_color(CGAL::get_default_random()); } + + // edges and vertices are black by default + template + CGAL::IO::Color operator()(const Graph& /*g*/, + typename boost::graph_traits::edge_descriptor /*e*/) const + { + return IO::black(); + } + + template + CGAL::IO::Color operator()(const Graph& /*g*/, + typename boost::graph_traits::vertex_descriptor /*v*/) const + { + return IO::black(); + } }; class SimpleFaceGraphViewerQt : public Basic_viewer_qt @@ -48,28 +59,28 @@ public: } /// Construct the viewer. - /// @param amesh the surface mesh to view + /// @param g the face graph to view /// @param title the title of the window /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big object where this time could be long) - template + /// useful for very big objects where this time could be long) + template SimpleFaceGraphViewerQt(QWidget* parent, - const SM& amesh, - const char* title="Basic Surface_mesh Viewer", + const Graph& g, + const char* title="Basic Face Graph Viewer", bool anofaces=false) : - SimpleFaceGraphViewerQt(parent, amesh, title, anofaces, DefaultColorFunctorFaceGraph()) + SimpleFaceGraphViewerQt(parent, g, title, anofaces, DefaultColorFunctorFaceGraph()) { } - template + template SimpleFaceGraphViewerQt(QWidget* parent, - const SM& amesh, + const Graph& g, const char* title, bool anofaces, ColorFunctor fcolor) : // First draw: no vertex; edges, faces; mono-color; inverse normal Base(parent, title, false, true, true, true, false), - m_compute_elements_impl(compute_elements_functor(amesh, anofaces, fcolor)) + m_compute_elements_impl(compute_elements_functor(g, anofaces, fcolor)) { } @@ -82,43 +93,42 @@ public: m_compute_elements_impl(); } - template - void set_face_graph(const SM& amesh, + template + void set_face_graph(const Graph& g, bool anofaces, ColorFunctor fcolor) { - m_compute_elements_impl = compute_elements_functor(amesh, anofaces, fcolor); + m_compute_elements_impl = compute_elements_functor(g, anofaces, fcolor); } - template - void set_face_graph(const SM& amesh, + template + void set_face_graph(const Graph& g, bool anofaces=false) { - set_mesh(amesh, anofaces, DefaultColorFunctorFaceGraph()); + set_mesh(g, anofaces, DefaultColorFunctorFaceGraph()); } protected: - template + template std::function - compute_elements_functor(const SM& sm, + compute_elements_functor(const Graph& g, bool anofaces, ColorFunctor fcolor) { - using Point = - typename boost::property_map_value::type; + using Point = typename boost::property_map_value::type; using Kernel = typename CGAL::Kernel_traits::Kernel; using Vector = typename Kernel::Vector_3; - auto vnormals = get(CGAL::dynamic_vertex_property_t(), sm); - auto point_pmap = get(CGAL::vertex_point, sm); - for (auto v : vertices(sm)) + auto vnormals = get(CGAL::dynamic_vertex_property_t(), g); + auto point_pmap = get(CGAL::vertex_point, g); + for (auto v : vertices(g)) { Vector n(NULL_VECTOR); int i=0; - for (auto h : halfedges_around_target(halfedge(v, sm), sm)) + for (auto h : halfedges_around_target(halfedge(v, g), g)) { - if (!is_border(h, sm)) + if (!is_border(h, g)) { Vector ni = CGAL::cross_product( - Vector(get(point_pmap, source(h, sm)), get(point_pmap, target(h, sm))), - Vector(get(point_pmap, target(h, sm)), get(point_pmap, target(next(h, sm), sm)))); + Vector(get(point_pmap, source(h, g)), get(point_pmap, target(h, g))), + Vector(get(point_pmap, target(h, g)), get(point_pmap, target(next(h, g), g)))); if (ni != NULL_VECTOR) { n+=ni; @@ -131,41 +141,41 @@ protected: // This function return a lambda expression, type-erased in a // `std::function` object. - return [this, &sm, vnormals, anofaces, fcolor, point_pmap]() + return [this, &g, vnormals, anofaces, fcolor, point_pmap]() { this->clear(); if (!anofaces) { - for (auto fh: faces(sm)) + for (auto fh: faces(g)) { - if (fh!=boost::graph_traits::null_face()) - { - CGAL::IO::Color c=fcolor(sm, fh); - face_begin(c); - auto hd=halfedge(fh, sm); - const auto first_hd = hd; - do - { - auto v = source(hd, sm); - add_point_in_face(get(point_pmap, v), get(vnormals, v)); - hd=next(hd, sm); - } - while(hd!=first_hd); - face_end(); - } + const CGAL::IO::Color& c = fcolor(g, fh); + face_begin(c); + auto hd=halfedge(fh, g); + const auto first_hd = hd; + do + { + auto v = source(hd, g); + add_point_in_face(get(point_pmap, v), get(vnormals, v)); + hd=next(hd, g); + } + while(hd!=first_hd); + face_end(); } } - for (auto e: edges(sm)) + for (auto e: edges(g)) { - add_segment(get(point_pmap, source(halfedge(e, sm), sm)), - get(point_pmap, target(halfedge(e, sm), sm))); + const CGAL::IO::Color& c = fcolor(g, e); + add_segment(get(point_pmap, source(halfedge(e, g), g)), + get(point_pmap, target(halfedge(e, g), g)), + c); } - for (auto v: vertices(sm)) + for (auto v: vertices(g)) { - this->add_point(get(point_pmap, v)); + const CGAL::IO::Color& c = fcolor(g, v); + this->add_point(get(point_pmap, v), c); } }; } diff --git a/CGAL_ipelets/doc/CGAL_ipelets/Doxyfile.in b/CGAL_ipelets/doc/CGAL_ipelets/Doxyfile.in index f6220befcac..2d21e2d68fc 100644 --- a/CGAL_ipelets/doc/CGAL_ipelets/Doxyfile.in +++ b/CGAL_ipelets/doc/CGAL_ipelets/Doxyfile.in @@ -1,4 +1,4 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - CGAL Ipelets" -EXAMPLE_PATH += ${CGAL_PACKAGE_DIR}/demo +EXAMPLE_PATH = ${CGAL_PACKAGE_DIR}/demo diff --git a/CGAL_ipelets/doc/CGAL_ipelets/examples.txt b/CGAL_ipelets/doc/CGAL_ipelets/examples.txt index 25666965dd8..0a084d7a1f5 100644 --- a/CGAL_ipelets/doc/CGAL_ipelets/examples.txt +++ b/CGAL_ipelets/doc/CGAL_ipelets/examples.txt @@ -1,4 +1,3 @@ /*! -\example CGAL_ipelets/test_grabbers.cpp \example CGAL_ipelets/simple_triangulation.cpp */ diff --git a/CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt similarity index 92% rename from CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt rename to CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt index 634bc854f59..8acaf9834e4 100644 --- a/CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. cmake_minimum_required(VERSION 3.1...3.23) -project(CGAL_ipelets_Examples) +project(CGAL_ipelets_Tests) find_package(CGAL REQUIRED) diff --git a/CGAL_ipelets/examples/CGAL_ipelets/test_grabbers.cpp b/CGAL_ipelets/test/CGAL_ipelets/test_grabbers.cpp similarity index 100% rename from CGAL_ipelets/examples/CGAL_ipelets/test_grabbers.cpp rename to CGAL_ipelets/test/CGAL_ipelets/test_grabbers.cpp diff --git a/Classification/examples/Classification/example_ethz_random_forest.cpp b/Classification/examples/Classification/example_ethz_random_forest.cpp index 64d4688a360..a538faa3014 100644 --- a/Classification/examples/Classification/example_ethz_random_forest.cpp +++ b/Classification/examples/Classification/example_ethz_random_forest.cpp @@ -140,7 +140,7 @@ int main (int argc, char** argv) classifier.save_configuration(fconfig); // Write result - std::ofstream f ("classification.ply"); + std::ofstream f ("classification_ethz_random_forest.ply"); f.precision(18); f << pts; diff --git a/Classification/examples/Classification/example_opencv_random_forest.cpp b/Classification/examples/Classification/example_opencv_random_forest.cpp index 99fa9fb6497..e01ede689e5 100644 --- a/Classification/examples/Classification/example_opencv_random_forest.cpp +++ b/Classification/examples/Classification/example_opencv_random_forest.cpp @@ -128,7 +128,7 @@ int main (int argc, char** argv) } // Write result - std::ofstream f ("classification.ply"); + std::ofstream f ("classification_opencv_random_forest.ply"); f.precision(18); f << pts; diff --git a/Classification/examples/Classification/gis_tutorial_example.cpp b/Classification/examples/Classification/gis_tutorial_example.cpp index ba3c15d3825..cfd263dc7bc 100644 --- a/Classification/examples/Classification/gis_tutorial_example.cpp +++ b/Classification/examples/Classification/gis_tutorial_example.cpp @@ -473,7 +473,8 @@ int main (int argc, char** argv) // Fill all holes except the bigest (which is the outer hull of the mesh) for (Mesh::Halfedge_index hi : holes) if (hi != outer_hull) - CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole (dtm_mesh, hi); + CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole + (dtm_mesh, hi, CGAL::parameters::fairing_continuity(0)); // Save DTM with holes filled std::ofstream dtm_filled_ofile ("dtm_filled.ply", std::ios_base::binary); @@ -735,7 +736,7 @@ int main (int argc, char** argv) points.range(label_map)).mean_intersection_over_union() << std::endl; // Save the classified point set - std::ofstream classified_ofile ("classified.ply"); + std::ofstream classified_ofile ("classification_gis_tutorial.ply"); CGAL::IO::set_binary_mode (classified_ofile); classified_ofile << points; classified_ofile.close(); diff --git a/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp b/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp index 4096cf1c71f..3b49478f47f 100644 --- a/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp +++ b/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -79,7 +78,7 @@ int main(int argc, char ** argv) // obtain the number of vertices in the constructed graph boost::graph_traits::vertices_size_type n = boost::num_vertices(g); // generate gnuplot files for plotting this graph - std::string file_prefix = "t" + boost::lexical_cast(k) + "n" + boost::lexical_cast(n); + std::string file_prefix = "t" + std::to_string(k) + "n" + std::to_string(n); CGAL::gnuplot_output_2(g, file_prefix); return 0; diff --git a/Cone_spanners_2/test/Cone_spanners_2/theta_exact.cpp b/Cone_spanners_2/test/Cone_spanners_2/theta_exact.cpp index 0173c9798ac..6bdb2e0eb8d 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/theta_exact.cpp +++ b/Cone_spanners_2/test/Cone_spanners_2/theta_exact.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -70,7 +69,7 @@ int main(int argc, char ** argv) // obtain the number of vertices in the constructed graph boost::graph_traits::vertices_size_type n = boost::num_vertices(g); // generate gnuplot files for plotting this graph - std::string file_prefix = "t" + boost::lexical_cast(k) + "n" + boost::lexical_cast(n); + std::string file_prefix = "t" + std::to_string(k) + "n" + std::to_string(n); CGAL::gnuplot_output_2(g, file_prefix); return 0; diff --git a/Cone_spanners_2/test/Cone_spanners_2/theta_inexact.cpp b/Cone_spanners_2/test/Cone_spanners_2/theta_inexact.cpp index 4d305d0fb30..f62d9d34dc9 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/theta_inexact.cpp +++ b/Cone_spanners_2/test/Cone_spanners_2/theta_inexact.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -71,7 +70,7 @@ int main(int argc, char ** argv) // obtain the number of vertices in the constructed graph boost::graph_traits::vertices_size_type n = boost::num_vertices(g); // generate gnuplot files for plotting this graph - std::string file_prefix = "t" + boost::lexical_cast(k) + "n" + boost::lexical_cast(n); + std::string file_prefix = "t" + std::to_string(k) + "n" + std::to_string(n); CGAL::gnuplot_output_2(g, file_prefix); return 0; diff --git a/Cone_spanners_2/test/Cone_spanners_2/yao_exact.cpp b/Cone_spanners_2/test/Cone_spanners_2/yao_exact.cpp index 9b6c3668777..4e19687de49 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/yao_exact.cpp +++ b/Cone_spanners_2/test/Cone_spanners_2/yao_exact.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -72,7 +71,7 @@ int main(int argc, char ** argv) boost::graph_traits::vertices_size_type n = boost::num_vertices(g); // generate gnuplot files for plotting this graph - std::string fileprefix = "y" + boost::lexical_cast(k) + "n" + boost::lexical_cast(n); + std::string fileprefix = "y" + std::to_string(k) + "n" + std::to_string(n); CGAL::gnuplot_output_2(g, fileprefix); return 0; diff --git a/Cone_spanners_2/test/Cone_spanners_2/yao_inexact.cpp b/Cone_spanners_2/test/Cone_spanners_2/yao_inexact.cpp index 8f6221935ed..5ddf1a2c3f8 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/yao_inexact.cpp +++ b/Cone_spanners_2/test/Cone_spanners_2/yao_inexact.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -72,7 +71,7 @@ int main(int argc, char ** argv) boost::graph_traits::vertices_size_type n = boost::num_vertices(g); // generate gnuplot files for plotting this graph - std::string fileprefix = "y" + boost::lexical_cast(k) + "n" + boost::lexical_cast(n); + std::string fileprefix = "y" + std::to_string(k) + "n" + std::to_string(n); CGAL::gnuplot_output_2(g, fileprefix); return 0; diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/External_structure_builder.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/External_structure_builder.h index 823a9b7c4ce..8c4c546590d 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/External_structure_builder.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/External_structure_builder.h @@ -17,6 +17,7 @@ #include +#include #include #undef CGAL_NEF_DEBUG diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h index ffc0868e952..2768f43ce72 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h @@ -17,6 +17,7 @@ #include #include +#include #include #include diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SFace_separator.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SFace_separator.h index 2c42e64fe72..cd9ed4851d0 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SFace_separator.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SFace_separator.h @@ -14,8 +14,9 @@ #include - +#include #include +#include #include namespace CGAL { diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h index 27a1c4f697a..e1c5b099414 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h @@ -14,6 +14,8 @@ #include +#include +#include #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 227 diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h index bd4d22bac38..954138100e5 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h @@ -14,10 +14,12 @@ #include - +#include #include +#include #include #include +#include #include #undef CGAL_NEF_DEBUG diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h index fc26c54ceb0..2277f58d5cf 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h @@ -14,10 +14,12 @@ #include - +#include #include +#include #include #include +#include #include #undef CGAL_NEF_DEBUG diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h index 0db21512f4c..e43ef7d92d3 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h @@ -14,8 +14,9 @@ #include - -#include +#include +#include +#include #include #include diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h index 5a881e30331..9409c04846c 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h @@ -14,6 +14,8 @@ #include +#include +#include #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 239 diff --git a/Convex_hull_2/doc/Convex_hull_2/Convex_hull_2.txt b/Convex_hull_2/doc/Convex_hull_2/Convex_hull_2.txt index 16b2a60610d..bca9d0f275f 100644 --- a/Convex_hull_2/doc/Convex_hull_2/Convex_hull_2.txt +++ b/Convex_hull_2/doc/Convex_hull_2/Convex_hull_2.txt @@ -143,6 +143,10 @@ check whether a given sequence of 2D points forms a (counter)clockwise strongly convex polygon. These are used in postcondition testing of the two-dimensional convex hull functions. +In case you want to keep collinear points you can use the 2D Delaunay triangulation as +in the following example. This sequence is then not strongly convex. + +\cgalExample{Convex_hull_2/ch_delaunay_2.cpp} + */ } /* namespace CGAL */ - diff --git a/Convex_hull_2/doc/Convex_hull_2/examples.txt b/Convex_hull_2/doc/Convex_hull_2/examples.txt index 8439df4a923..63515ecab88 100644 --- a/Convex_hull_2/doc/Convex_hull_2/examples.txt +++ b/Convex_hull_2/doc/Convex_hull_2/examples.txt @@ -6,4 +6,5 @@ \example Convex_hull_2/ch_timing.cpp \example Convex_hull_2/iostream_convex_hull_2.cpp \example Convex_hull_2/vector_convex_hull_2.cpp +\example Convex_hull_2/ch_delaunay_2.cpp */ diff --git a/Convex_hull_2/examples/Convex_hull_2/ch_delaunay_2.cpp b/Convex_hull_2/examples/Convex_hull_2/ch_delaunay_2.cpp new file mode 100644 index 00000000000..0b80ee4c3de --- /dev/null +++ b/Convex_hull_2/examples/Convex_hull_2/ch_delaunay_2.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef K::Point_2 Point_2; +typedef CGAL::Delaunay_triangulation_2 Delaunay_triangulation_2; + + +int main() +{ + std::vector input = { Point_2(0, 0), Point_2(1,1), Point_2(2,0), Point_2(2,2), Point_2(1,2), Point_2(0,2) }; + + Delaunay_triangulation_2 dt(input.begin(), input.end()); + + std::list result; + Delaunay_triangulation_2::Vertex_circulator vc = dt.incident_vertices(dt.infinite_vertex()), done(vc); + do{ + std ::cout << vc->point() << std::endl; + // push_front in order to obtain the counterclockwise sequence + result.push_front(vc->point()); + ++vc; + }while(vc != done); + + return 0; +} diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp index bb9bccab77c..8d45ac9aaf1 100644 --- a/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp +++ b/Convex_hull_2/test/Convex_hull_2/ch_test_CH.cpp @@ -27,9 +27,5 @@ int main() CGAL::ch__batch_test(cch_H_gmp); #endif - CGAL::Convex_hull_constructive_traits_2< CGAL::Homogeneous > cch_H_double; - std::cout << "Homogeneous:" << std::endl; - CGAL::ch__batch_test(cch_H_double); - return EXIT_SUCCESS; } diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp index 26a2c4dca9d..8c6c3863845 100644 --- a/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp +++ b/Convex_hull_2/test/Convex_hull_2/ch_test_SC.cpp @@ -25,9 +25,5 @@ int main() CGAL::ch__batch_test(ch_C_Qgmp); #endif - CGAL::Cartesian ch_C_double; - std::cout << "Cartesian:" << std::endl; - CGAL::ch__batch_test(ch_C_double); - return EXIT_SUCCESS; } diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp index d8318360621..eee56d0f901 100644 --- a/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp +++ b/Convex_hull_2/test/Convex_hull_2/ch_test_SH.cpp @@ -25,9 +25,5 @@ int main() CGAL::ch__batch_test( ch_H_gmp ); #endif - CGAL::Homogeneous ch_H_double; - std::cout << "Homogeneous:" << std::endl; - CGAL::ch__batch_test( ch_H_double ); - return EXIT_SUCCESS; } diff --git a/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp b/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp index 521f1b41b5a..35864f1f260 100644 --- a/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp +++ b/Convex_hull_2/test/Convex_hull_2/ch_test_SS.cpp @@ -25,9 +25,5 @@ int main() CGAL::ch__batch_test( ch_S_Qgmp ); #endif - CGAL::Simple_cartesian ch_S_double; - std::cout << "SimpleCartesian:" << std::endl; - CGAL::ch__batch_test( ch_S_double ); - return EXIT_SUCCESS; } diff --git a/Documentation/doc/CMakeLists.txt b/Documentation/doc/CMakeLists.txt index a885f8ecea2..bec8ffbb22f 100644 --- a/Documentation/doc/CMakeLists.txt +++ b/Documentation/doc/CMakeLists.txt @@ -26,14 +26,9 @@ else() set(CGAL_ROOT "${CMAKE_SOURCE_DIR}") endif() -find_package(Doxygen) +find_package(Doxygen REQUIRED) find_package(Python3 REQUIRED COMPONENTS Interpreter) -if(NOT DOXYGEN_FOUND) - message(WARNING "Cannot build the documentation without Doxygen!") - return() -endif() - #starting from cmake 3.9 the usage of DOXYGEN_EXECUTABLE is deprecated if(TARGET Doxygen::doxygen) get_property( @@ -131,6 +126,10 @@ function(configure_doxygen_package CGAL_PACKAGE_NAME) endif() endif() endif() + if(EXISTS "${CGAL_PACKAGE_DIR}/include/CGAL/${CGAL_PACKAGE_NAME}/internal") + file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} + "EXCLUDE += ${CGAL_PACKAGE_DIR}/include/CGAL/${CGAL_PACKAGE_NAME}/internal\n") + endif() # IMAGE_PATH is set by default. For Documentation, we generate the extra path using packages.txt set(IMAGE_PATHS "${CGAL_PACKAGE_DOC_DIR}/fig") diff --git a/Documentation/doc/Documentation/windows.txt b/Documentation/doc/Documentation/windows.txt index 02596bcd35d..c4daa8fc380 100644 --- a/Documentation/doc/Documentation/windows.txt +++ b/Documentation/doc/Documentation/windows.txt @@ -45,11 +45,11 @@ of `vcpkg` if you want to compile for an older version of a compiler. Because of a bug with gmp in vcpkg for windows, you need to install `yasm-tool` in 32 bits to be able to correctly build gmp 64bits, needed for cgal: - C:\dev\vcpkg> ./vcpkg.exe install yasm-tool:x86-windows + C:\dev\vcpkg> .\vcpkg.exe install yasm-tool:x86-windows You are now ready to install \cgal: - C:\dev\vcpkg> ./vcpkg.exe install cgal + C:\dev\vcpkg> .\vcpkg.exe install cgal This will take several minutes as it downloads \gmp, \mpfr, all boost header files, and it will compile \gmp and \mpfr, as well @@ -114,14 +114,14 @@ not depend on `Qt`. However, one of the examples in the Triangulation_2 package for visualization purposes. If you already have `Qt` installed, you can simply fill in the requested CMake variables and paths. Otherwise, you can also install it using `vcpkg`: - C:\dev\vcpkg> ./vcpkg.exe install qt5 + C:\dev\vcpkg> .\vcpkg.exe install qt5 Remember to specify `--triplet` or the related environment variable in case you target 64-bit applications. As Qt5 is modular and as the \cgal examples and demos use only some of these modules you can save download and compilation time by specifying an *installation option*: - C:\dev\vcpkg> ./vcpkg.exe install cgal[qt] + C:\dev\vcpkg> .\vcpkg.exe install cgal[qt] In both cases, when you start `cmake-gui` again and hit the *Configure* button, the CMake variables and paths concerning Qt should now be filled. diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 5e75ed15f30..c16f83d01f6 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -32,6 +32,17 @@ pages = "39--61" } +@article{cgal:al-otmnn-08, + title={On the most normal normal}, + author={Aubry, Romain and L{\"o}hner, Rainald}, + journal={Communications in Numerical Methods in Engineering}, + volume={24}, + number={12}, + pages={1641--1652}, + year={2008}, + publisher={Wiley Online Library} +} + @manual{ cgal:a-cclga-94 ,author = {Avnaim, F.} ,title = "{C}{\tt ++}{GAL}: {A} {C}{\tt ++} Library for Geometric diff --git a/Documentation/doc/biblio/geom.bib b/Documentation/doc/biblio/geom.bib index 26c34ce172a..969a1a79b5b 100644 --- a/Documentation/doc/biblio/geom.bib +++ b/Documentation/doc/biblio/geom.bib @@ -137313,7 +137313,7 @@ Contains C code." @inproceedings{ss-kaud-88 , author = "Th. Strothotte and J.-R. Sack" -, title = "Knowledge Aquisition using Diagrams" +, title = "Knowledge Acquisition using Diagrams" , booktitle = "Proc. 3rd IFIP Conference on Man-Machine Systems" , site = "Oulo, Finland" , year = 1988 diff --git a/Documentation/doc/scripts/html_output_post_processing.py b/Documentation/doc/scripts/html_output_post_processing.py index 82734adb98d..11b49c0378a 100755 --- a/Documentation/doc/scripts/html_output_post_processing.py +++ b/Documentation/doc/scripts/html_output_post_processing.py @@ -57,7 +57,7 @@ def write_out_html(d, fn): f.write('\n') f.write('') if d.html() is not None: - f.write(d.html()) + f.write(d.html(method='html')) f.write('\n') f.write('\n') f.close() diff --git a/Documentation/doc/scripts/pkglist_filter b/Documentation/doc/scripts/pkglist_filter index 2ec8ce96c9b..7912564df56 100755 --- a/Documentation/doc/scripts/pkglist_filter +++ b/Documentation/doc/scripts/pkglist_filter @@ -1,3 +1,3 @@ #!/bin/sh -exec ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/pkglist_filter.py "$1" +exec ${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/pkglist_filter.py "$1" diff --git a/Documentation/doc/scripts/pkglist_filter.bat b/Documentation/doc/scripts/pkglist_filter.bat index 83dff1aa121..1e716921c65 100644 --- a/Documentation/doc/scripts/pkglist_filter.bat +++ b/Documentation/doc/scripts/pkglist_filter.bat @@ -1,6 +1,6 @@ @echo off :go -${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/pkglist_filter.py %1 +${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/pkglist_filter.py %1 @echo on diff --git a/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp b/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp index 012ef71d3e5..67e4f336075 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp +++ b/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp @@ -98,6 +98,8 @@ public Q_SLOTS: void on_actionClear_triggered(); + void on_actionOpen_triggered(); + void processInput(CGAL::Object); void on_actionRecenter_triggered(); @@ -105,7 +107,7 @@ public Q_SLOTS: void on_actionGeneratePointsInSquare_triggered(); void on_actionGeneratePointsInDisc_triggered(); void clear(); - + void open(QString fileName); void update_largest_empty_rectangle(); Q_SIGNALS: @@ -229,6 +231,50 @@ MainWindow::on_actionClear_triggered() Q_EMIT( changed()); } +void +MainWindow::on_actionOpen_triggered() +{ + QString fileName = QFileDialog::getOpenFileName(this, + tr("Open points file"), + "." + ,tr("xy files (*.xy)") + ); + if(! fileName.isEmpty()){ + open(fileName); + } + +} + +void +MainWindow::open(QString fileName) +{ + // wait cursor + QApplication::setOverrideCursor(Qt::WaitCursor); + std::ifstream ifs(qPrintable(fileName)); + + clear(); + + Point_2 p; + while(ifs >> p){ + points.push_back(p); + } + + CGAL::Bbox_2 bbox = CGAL::bbox_2(points.begin(), points.end()); + square = Iso_rectangle_2(bbox); + + ler = Largest_empty_iso_rectangle_2(square); + ler.insert(points.begin(), points.end()); + + frame[0]->setLine(convert(Segment_2(square.vertex(0),square.vertex(1)))); + frame[1]->setLine(convert(Segment_2(square.vertex(1), square.vertex(2)))); + frame[2]->setLine(convert(Segment_2(square.vertex(2), square.vertex(3)))); + frame[3]->setLine(convert(Segment_2(square.vertex(3), square.vertex(0)))); + + QApplication::restoreOverrideCursor(); + on_actionRecenter_triggered(); + Q_EMIT( changed()); +} + void MainWindow::on_actionRecenter_triggered() { diff --git a/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui b/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui index 19c46f07374..a6ddf170ca2 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui +++ b/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui @@ -80,7 +80,7 @@ 0 0 500 - 26 + 22 @@ -90,6 +90,7 @@ + @@ -199,6 +200,11 @@ Generate Segment Fans + + + Open + + diff --git a/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp index 30556ef405c..5da75ee41da 100644 --- a/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp @@ -554,87 +554,32 @@ void MainWindow::loadWKT(QString filename) { std::ifstream ifs(qPrintable(filename)); - do - { - typedef CGAL::Polygon_with_holes_2 Polygon; - typedef CGAL::Point_2 Point; - std::vector mps; - CGAL::IO::read_multi_polygon_WKT(ifs, mps); - for(const Polygon& p : mps) - { - if(p.outer_boundary().is_empty()) - continue; - for(Point point : p.outer_boundary().container()) - cdt.insert(point); - for(Polygon::General_polygon_2::Edge_const_iterator - e_it=p.outer_boundary().edges_begin(); e_it != p.outer_boundary().edges_end(); ++e_it) - cdt.insert_constraint(e_it->source(), e_it->target()); + typedef CGAL::Polygon_with_holes_2 Polygon; + typedef CGAL::Point_2 Point; - for(Polygon::Hole_const_iterator h_it = - p.holes_begin(); h_it != p.holes_end(); ++h_it) - { - for(Point point : h_it->container()) - cdt.insert(point); - for(Polygon::General_polygon_2::Edge_const_iterator - e_it=h_it->edges_begin(); e_it != h_it->edges_end(); ++e_it) - { - cdt.insert_constraint(e_it->source(), e_it->target()); - } - } - } - }while(ifs.good() && !ifs.eof()); - //Edges - ifs.clear(); - ifs.seekg(0, ifs.beg); - do - { - typedef std::vector LineString; - std::vector mls; - CGAL::IO::read_multi_linestring_WKT(ifs, mls); - for(const LineString& ls : mls) - { - if(ls.empty()) - continue; - K::Point_2 p,q, qold(0,0); // initialize to avoid maybe-uninitialized warning from GCC6 - bool first = true; - CDT::Vertex_handle vp, vq, vqold; - LineString::const_iterator it = - ls.begin(); - for(; it != ls.end(); ++it) { - p = *it++; - q = *it; - if(p == q){ - continue; - } - if((!first) && (p == qold)){ - vp = vqold; - } else { - vp = cdt.insert(p); - } - vq = cdt.insert(q, vp->face()); - if(vp != vq) { - cdt.insert_constraint(vp,vq); - } - qold = q; - vqold = vq; - first = false; - } - } - }while(ifs.good() && !ifs.eof()); + std::deque points; + std::deque> linestrings; + std::deque polygons; - //Points - ifs.clear(); - ifs.seekg(0, ifs.beg); - do - { - std::vector mpts; - CGAL::IO::read_multi_point_WKT(ifs, mpts); - for(const K::Point_2& p : mpts) - { - cdt.insert(p); + CGAL::IO::read_WKT(ifs, points, linestrings, polygons); + + cdt.insert(points.begin(),points.end()); + + for(const std::vector& line : linestrings){ + cdt.insert_constraint(line.begin(), line.end()); + } + + for(const Polygon& p : polygons){ + if(p.outer_boundary().is_empty()) + continue; + + cdt.insert_constraint(p.outer_boundary().vertices_begin(), p.outer_boundary().vertices_end(),true); + + for(Polygon::Hole_const_iterator h_it = p.holes_begin(); h_it != p.holes_end(); ++h_it){ + cdt.insert_constraint(h_it->vertices_begin(), h_it->vertices_end(),true); } - }while(ifs.good() && !ifs.eof()); + } discoverComponents(cdt, m_seeds); Q_EMIT( changed()); diff --git a/Inscribed_areas/doc/Inscribed_areas/CGAL/Largest_empty_iso_rectangle_2.h b/Inscribed_areas/doc/Inscribed_areas/CGAL/Largest_empty_iso_rectangle_2.h index f11af4ccdf1..080fc203bfb 100644 --- a/Inscribed_areas/doc/Inscribed_areas/CGAL/Largest_empty_iso_rectangle_2.h +++ b/Inscribed_areas/doc/Inscribed_areas/CGAL/Largest_empty_iso_rectangle_2.h @@ -142,9 +142,11 @@ Iso_rectangle_2 get_bounding_box(); /// @{ /*! -Inserts point `p` in the point set, if it is not already in the set. +Inserts point `p` in the point set, if it is not already in the set +and on the bounded side of the bounding rectangle. +\note Points on the boundary can be ignored as they lead to the same result. */ -void +bool insert(const Point_2& p); /*! diff --git a/Inscribed_areas/examples/Inscribed_areas/largest_empty_rectangle.cpp b/Inscribed_areas/examples/Inscribed_areas/largest_empty_rectangle.cpp index 5128e958d84..bbf8989b7b8 100644 --- a/Inscribed_areas/examples/Inscribed_areas/largest_empty_rectangle.cpp +++ b/Inscribed_areas/examples/Inscribed_areas/largest_empty_rectangle.cpp @@ -1,8 +1,7 @@ #include -#include #include -#include +#include typedef double Number_Type; typedef CGAL::Simple_cartesian K; diff --git a/Inscribed_areas/include/CGAL/Largest_empty_iso_rectangle_2.h b/Inscribed_areas/include/CGAL/Largest_empty_iso_rectangle_2.h index 95391cd85a5..4ef236892ab 100644 --- a/Inscribed_areas/include/CGAL/Largest_empty_iso_rectangle_2.h +++ b/Inscribed_areas/include/CGAL/Largest_empty_iso_rectangle_2.h @@ -762,7 +762,7 @@ bool Largest_empty_iso_rectangle_2::insert(const Point_2& _p) { // check that the point is inside the bounding box - if(bbox_p.has_on_unbounded_side(_p)) { + if(! bbox_p.has_on_bounded_side(_p)) { return(false); } diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index a8e5332db23..c5106c6f430 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -20,8 +20,8 @@ Release date: June 2023 `CGAL::Polygon_mesh_processing::triangulate_and_refine_hole()`, and `CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole()` which have output iterators for vertices and faces as parameter. They are replaced by overloads with two additional named parameters. -- Added the function `CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing()`, that remeshes a surface triangle mesh following the -CGAL tetrahedral Delaunay refinement algorithm. +- Added the function `CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing()`, that remeshes a surface triangle mesh using + the Delaunay refinement algorithm from the 3D Mesh Generation package. - Added the function `CGAL::Polygon_mesh_processing::remove_almost_degenerate_faces()` to remove badly shaped triangles faces in a mesh. @@ -67,6 +67,9 @@ CGAL tetrahedral Delaunay refinement algorithm. - The stop predicates `Count_stop_predicate` and `Count_ratio_stop_predicate` are renamed to `Edge_count_stop_predicate` and `Edge_count_ratio_stop_predicate`. Older versions have been deprecated. - Introduce `Face_count_stop_predicate` and `Face_count_ratio_stop_predicate` that can be used to stop the simplification algorithm based on a desired number of faces in the output, or a ratio between input and output face numbers. +### [2D Minkowski Sums](https://doc.cgal.org/5.6/Manual/packages.html#PkgMinkowskiSum2) +- Fixed a bug that made holes in the Minkowski sum disappear + [Release 5.5](https://github.com/CGAL/cgal/releases/tag/v5.5) ----------- diff --git a/Installation/cmake/modules/CGAL_GeneratorSpecificSettings.cmake b/Installation/cmake/modules/CGAL_GeneratorSpecificSettings.cmake index 96329f11c0b..70dc4de3e56 100644 --- a/Installation/cmake/modules/CGAL_GeneratorSpecificSettings.cmake +++ b/Installation/cmake/modules/CGAL_GeneratorSpecificSettings.cmake @@ -41,11 +41,7 @@ if ( NOT CGAL_GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED ) IF (APPLE) exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION) string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) - message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}") - if (DARWIN_VERSION GREATER 8) - message(STATUS "Mac Leopard detected") - set(CGAL_APPLE_LEOPARD 1) - endif() + message(STATUS "Running in macOS DARWIN_VERSION=${DARWIN_VERSION}") endif() if ( NOT "${CMAKE_CFG_INTDIR}" STREQUAL "." ) diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index 57f2e31b5bb..28d7920bd2a 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -435,6 +435,22 @@ Segment_2_Segment_2_pair::intersection_type() const : CGAL::make_array( _seg2->point(s2s2_id[c][2]), _seg2->point(s2s2_id[c][3]), _seg1->point(s2s2_id[c][0]), _seg1->point(s2s2_id[c][1]) ); + // special case for vertical and horizontal segments + if (std::is_floating_point::value && + std::is_same::value) + { + if (pts[0].x()==pts[1].x() && pts[2].y()==pts[3].y()) + { + _intersection_point = K().construct_point_2_object()(pts[0].x(), pts[2].y()); + return _result; + } + if (pts[0].y()==pts[1].y() && pts[2].x()==pts[3].x()) + { + _intersection_point = K().construct_point_2_object()(pts[2].x(), pts[0].y()); + return _result; + } + } + typename K::FT alpha = s2s2_alpha(pts[0].x(), pts[0].y(), pts[1].x(), pts[1].y(), pts[2].x(), pts[2].y(), pts[3].x(), pts[3].y()); _intersection_point = K().construct_barycenter_2_object()(pts[0], alpha, pts[1]); diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_intersection.h index 7f76c9d6000..d16b33d6570 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_intersection.h @@ -18,6 +18,7 @@ #include #include +#include namespace CGAL { namespace Intersections { @@ -141,7 +142,7 @@ intersection(const typename K::Plane_3& plane, CGAL_kernel_assertion(pts.size() == 2); return intersection_return( - k.construct_segment_3_object()(*pts.begin(), *boost::prior(pts.end()))); + k.construct_segment_3_object()(*pts.begin(), *std::prev(pts.end()))); } template diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index fa148adcba2..424e1fc9361 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -51,7 +51,7 @@ void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p, for (Iterator it=inter_pts.begin();it!=inter_pts.end();++it) orientations[ &(*it) ]=orient(p,q,r,*it); - int pt_added = 0; + CGAL_kernel_assertion_code(int pt_added = 0;) const typename Kernel::Point_3* prev = &(*boost::prior(inter_pts.end())); Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : boost::prior(inter_pts.end()); @@ -75,7 +75,7 @@ void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p, prev = &(*inter_pts.insert(it,*inter)); orientations[prev] = COLLINEAR; - ++pt_added; + CGAL_kernel_assertion_code(++pt_added;) } prev = &(*it); diff --git a/Intersections_3/test/Intersections_3/intersection_test_helper.h b/Intersections_3/test/Intersections_3/intersection_test_helper.h index 7a57839f3df..a38e2bad55f 100644 --- a/Intersections_3/test/Intersections_3/intersection_test_helper.h +++ b/Intersections_3/test/Intersections_3/intersection_test_helper.h @@ -237,8 +237,8 @@ public: const auto ires12 = CGAL::intersection(o1, o2); - Res tmp; - if(has_exact_p) + Res tmp; + if(has_exact_c) { assert(CGAL::assign(tmp, ires12)); assert(approx_equal(tmp, result)); @@ -246,7 +246,7 @@ public: else { if(CGAL::assign(tmp, ires12)) - assert(approx_equal(tmp, result)); + CGAL_warning(approx_equal(tmp, result)); else CGAL_warning_msg(false, "Expected an intersection, but it was not found!"); } diff --git a/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf_rings.h b/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf_rings.h index 6690a0874fa..a5866bee2ad 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf_rings.h +++ b/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf_rings.h @@ -25,7 +25,7 @@ protected: //i >= 1; from a start vertex on the current i-1 ring, push non-visited neighbors //of start in the nextRing and set indices to i. Also add these vertices in all. - static void push_neighbours_of(Vertex * start, int ith, + static void push_neighbors_of(Vertex * start, int ith, std::vector < Vertex * >&nextRing, std::vector < Vertex * >&all, VertexPropertyMap& vpm); @@ -58,10 +58,10 @@ protected: template < class TPoly , class VertexPropertyMap> void T_PolyhedralSurf_rings :: -push_neighbours_of(Vertex * start, int ith, - std::vector < Vertex * >&nextRing, - std::vector < Vertex * >&all, - VertexPropertyMap& vpm) +push_neighbors_of(Vertex * start, int ith, + std::vector < Vertex * >&nextRing, + std::vector < Vertex * >&all, + VertexPropertyMap& vpm) { Vertex *v; Halfedge_around_vertex_circulator @@ -88,7 +88,7 @@ collect_ith_ring(int ith, std::vector < Vertex * >¤tRing, typename std::vector < Vertex * >::iterator itb = currentRing.begin(), ite = currentRing.end(); - CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all, vpm); + CGAL_For_all(itb, ite) push_neighbors_of(*itb, ith, nextRing, all, vpm); } template diff --git a/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h b/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h index 0300279b5ee..4bd99fa3771 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h @@ -107,7 +107,7 @@ approximates the rotation over the angle indicated by direction `d`, such that the differences between the sines and cosines of the rotation given by d and the approximating rotation are at most \f$ num/den\f$ each. -\pre \f$ num/den>0\f$ and \f$ d != 0\f$. +\pre `num/den > 0` and `d != 0`. */ Aff_transformation_2(const Rotation, const Direction_2 &d, @@ -116,7 +116,7 @@ const Kernel::RT &den = RT(1)); /*! introduces a rotation by the angle `rho`. -\pre \f$ sine\_rho^2 + cosine\_rho^2 == hw^2\f$. +\pre sine\_rho2 + cosine\_rho2 == hw2. */ Aff_transformation_2(const Rotation, const Kernel::RT &sine_rho, diff --git a/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h b/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h index 61267300f39..ec861b9cb72 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h @@ -77,13 +77,13 @@ double ymax() const; /*! Returns `xmin()` if `i==0` or `ymin()` if `i==1`. -\pre i==0 or i==1 +\pre `i==0` or `i==1` */ double min(int i) const; /*! Returns `xmax()` if `i==0` or `ymax()` if `i==1`. -\pre i==0 or i==1 +\pre `i==0` or `i==1` */ double max(int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h b/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h index ad69f1d00aa..a61d5e339af 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h @@ -90,14 +90,14 @@ double zmax() const; /*! Returns `xmin()` if `i==0` or `ymin()` if `i==1` or `zmin()` if `i==2`. -\pre i>=0 and i<=2 +\pre `i>=0` and `i<=2` */ double min(int i) const; /*! Returns `xmax()` if `i==0` or `ymax()` if `i==1` or `zmax()` if `i==2`. -\pre i>=0 and i<=2 +\pre `i>=0` and `i<=2` */ double max(int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Circle_2.h b/Kernel_23/doc/Kernel_23/CGAL/Circle_2.h index 01238a5f044..1e9eacdeb0e 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Circle_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Circle_2.h @@ -28,7 +28,7 @@ introduces a variable `c` of type `Circle_2`. It is initialized to the circle with center `center`, squared radius `squared_radius` and orientation `ori`. -\pre `ori` \f$ \neq\f$ `COLLINEAR`, and further, `squared_radius` \f$ \geq\f$ 0. +\pre `ori != COLLINEAR` and `squared_radius >= 0`. */ Circle_2(const Point_2 ¢er, const Kernel::FT &squared_radius, @@ -52,7 +52,7 @@ const Point_2 &r); introduces a variable `c` of type `Circle_2`. It is initialized to the circle with diameter \f$ \overline{pq}\f$ and orientation `ori`. -\pre `ori` \f$ \neq\f$ `COLLINEAR`. +\pre `ori != COLLINEAR`. */ Circle_2( const Point_2 &p, const Point_2 &q, @@ -63,7 +63,7 @@ const Orientation &ori = COUNTERCLOCKWISE); introduces a variable `c` of type `Circle_2`. It is initialized to the circle with center `center`, squared radius zero and orientation `ori`. -\pre `ori` \f$ \neq\f$ `COLLINEAR`. +\pre `ori != COLLINEAR`. \post `c.is_degenerate()` = `true`. */ Circle_2( const Point_2 ¢er, diff --git a/Kernel_23/doc/Kernel_23/CGAL/Circle_3.h b/Kernel_23/doc/Kernel_23/CGAL/Circle_3.h index 96063004383..1fcdcab6e68 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Circle_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Circle_3.h @@ -21,7 +21,7 @@ public: introduces a variable `c` of type `Circle_3`. It is initialized to the circle of center `center` and squared radius `sq_r` in plane `plane`. -\pre `center` lies in `plane` and `sq_r` \f$ \geq\f$ 0. +\pre `center` lies in `plane` and `sq_r >= 0`. */ Circle_3(const Point_3 ¢er, const Kernel::FT &sq_r, @@ -32,7 +32,7 @@ introduces a variable `c` of type `Circle_3`. It is initialized to the circle of center `center` and squared radius `sq_r` in a plane normal to the vector `n`. -\pre `sq_r` \f$ \geq\f$ 0. +\pre `sq_r >= 0`. */ Circle_3(const Point_3 & center, const Kernel::FT & sq_r, diff --git a/Kernel_23/doc/Kernel_23/CGAL/Direction_2.h b/Kernel_23/doc/Kernel_23/CGAL/Direction_2.h index 5b2843b994e..00a2e8d74a5 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Direction_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Direction_2.h @@ -60,7 +60,7 @@ Direction_2(const Kernel::RT &x, const Kernel::RT &y); /*! returns values, such that `d``== Direction_2(delta(0),delta(1))`. -\pre \f$ 0 \leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::RT delta(int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Direction_3.h b/Kernel_23/doc/Kernel_23/CGAL/Direction_3.h index f11bf023cb3..81b096ac359 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Direction_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Direction_3.h @@ -57,7 +57,7 @@ Direction_3(const Kernel::RT &x, const Kernel::RT &y, const Kernel::RT &z); /*! returns values, such that `d``== Direction_3(delta(0),delta(1),delta(2))`. -\pre \f$ 0 \leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::RT delta(int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Iso_cuboid_3.h b/Kernel_23/doc/Kernel_23/CGAL/Iso_cuboid_3.h index 8cbbd395085..a32da1d2490 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Iso_cuboid_3.h @@ -39,7 +39,7 @@ const Point_3 &q); introduces an iso-oriented cuboid `c` with diagonal opposite vertices `p` and `q`. The `int` argument value is only used to distinguish the two overloaded functions. -\pre `p.x()<=q.x()`, `p.y()<=q.y()`and `p.z()<=q.z()`. +\pre `p.x()<=q.x()`, `p.y()<=q.y()` and `p.z()<=q.z()`. */ Iso_cuboid_3(const Point_3 &p, const Point_3 &q, int); @@ -65,7 +65,7 @@ introduces an iso-oriented cuboid `c` with diagonal opposite vertices (`min_hx/hw`, `min_hy/hw`, `min_hz/hw`) and (`max_hx/hw`, `max_hy/hw`, `max_hz/hw`). -\pre `hw` \f$ \neq\f$ 0. +\pre `hw != 0`. */ Iso_cuboid_3( const Kernel::RT& min_hx, const Kernel::RT& min_hy, const Kernel::RT& min_hz, @@ -156,14 +156,14 @@ Kernel::FT zmax() const; /*! returns `i`-th %Cartesian coordinate of the smallest vertex of `c`. -\pre \f$ 0 \leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::FT min_coord(int i) const; /*! returns `i`-th %Cartesian coordinate of the largest vertex of `c`. -\pre \f$ 0 \leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::FT max_coord(int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Iso_rectangle_2.h b/Kernel_23/doc/Kernel_23/CGAL/Iso_rectangle_2.h index 175d1261bea..d7228803e0e 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Iso_rectangle_2.h @@ -62,7 +62,7 @@ const Point_2 &top); introduces an iso-oriented rectangle `r` with diagonal opposite vertices (`min_hx/hw`, `min_hy/hw`) and (`max_hx/hw`, `max_hy/hw`). -\pre `hw` \f$ \neq\f$ 0. +\pre `hw != 0`. */ Iso_rectangle_2(const Kernel::RT& min_hx, const Kernel::RT& min_hy, const Kernel::RT& max_hx, const Kernel::RT& max_hy, @@ -134,14 +134,14 @@ Kernel::FT ymax() const; /*! returns the `i`'th %Cartesian coordinate of the lower left vertex of `r`. -\pre \f$ 0 \leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::FT min_coord(int i) const; /*! returns the `i`'th %Cartesian coordinate of the upper right vertex of `r`. -\pre \f$ 0 \leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::FT max_coord(int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h b/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h index 3e4bba13a43..45c56fe7710 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h @@ -89,7 +89,7 @@ Angle angle(const CGAL::Point_3&p, /*! returns an approximation of the angle between `p-q` and `r-q`. The angle is given in degrees. -\pre `p` and `r` are not equal to `q`. +\pre `p != q` and `r != q`. */ template Kernel::FT approximate_angle(const CGAL::Point_3& p, @@ -341,7 +341,7 @@ const CGAL::Point_3& p4, const Kernel::FT&w4); /*! constructs the bisector line of the two points `p` and `q`. The bisector is oriented in such a way that `p` lies on its -positive side. \pre `p` and `q` are not equal. +positive side. \pre `p != q`. */ template CGAL::Line_2 bisector(const CGAL::Point_2 &p, @@ -367,7 +367,7 @@ const CGAL::Line_2 &l2); /*! constructs the bisector plane of the two points `p` and `q`. The bisector is oriented in such a way that `p` lies on its -positive side. \pre `p` and `q` are not equal. +positive side. \pre `p != q'. */ template CGAL::Plane_3 bisector(const CGAL::Point_3 &p, diff --git a/Kernel_23/doc/Kernel_23/CGAL/Point_2.h b/Kernel_23/doc/Kernel_23/CGAL/Point_2.h index 8ac3eff82d6..00ea07ef2fb 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Point_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Point_2.h @@ -71,7 +71,7 @@ Point_2(double x, double y); /*! introduces a point `p` initialized to `(hx/hw,hy/hw)`. -\pre `hw` \f$ \neq\f$ `Kernel::RT(0)`. +\pre `hw != Kernel::RT(0)`. */ Point_2(const Kernel::RT &hx, const Kernel::RT &hy, const Kernel::RT &hw = RT(1)); @@ -159,19 +159,19 @@ Kernel::FT y() const; /*! returns the i'th homogeneous coordinate of `p`. -\pre \f$ 0\leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::RT homogeneous(int i) const; /*! returns the i'th %Cartesian coordinate of `p`. -\pre \f$ 0\leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::FT cartesian(int i) const; /*! returns `cartesian(i)`. -\pre \f$ 0\leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::FT operator[](int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Point_3.h b/Kernel_23/doc/Kernel_23/CGAL/Point_3.h index deed3e522d7..0babd70a4c8 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Point_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Point_3.h @@ -56,7 +56,7 @@ Point_3(double x, double y, double z); /*! introduces a point `p` initialized to `(hx/hw,hy/hw, hz/hw)`. -\pre `hw` \f$ \neq\f$ 0. +\pre `hw != 0`. */ Point_3(const Kernel::RT &hx, const Kernel::RT &hy, const Kernel::RT &hz, const Kernel::RT &hw = RT(1)); @@ -154,19 +154,19 @@ Kernel::FT z() const; /*! returns the i'th homogeneous coordinate of `p`. -\pre \f$ 0\leq i \leq3\f$. +\pre `0 <= i <= 3`. */ Kernel::RT homogeneous(int i) const; /*! returns the i'th %Cartesian coordinate of `p`. -\pre \f$ 0\leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::FT cartesian(int i) const; /*! returns `cartesian(i)`. -\pre \f$ 0\leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::FT operator[](int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Ray_2.h b/Kernel_23/doc/Kernel_23/CGAL/Ray_2.h index 87cd676cde9..c153b0f9ee3 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Ray_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Ray_2.h @@ -65,7 +65,7 @@ Point_2 source() const; /*! returns a point on `r`. `point(0)` is the source, `point(i)`, with `i>0`, is different from the -source. \pre \f$ i \geq0\f$. +source. \pre `i >= 0`. */ Point_2 point(const Kernel::FT i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Ray_3.h b/Kernel_23/doc/Kernel_23/CGAL/Ray_3.h index dd6926c3565..86e6efce248 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Ray_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Ray_3.h @@ -65,7 +65,7 @@ Point_3 source() const; /*! returns a point on `r`. `point(0)` is the source. `point(i)`, with `i>0`, is different from the -source. \pre \f$ i \geq0\f$. +source. \pre `i >= 0`. */ Point_3 point(const Kernel::FT i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Sphere_3.h b/Kernel_23/doc/Kernel_23/CGAL/Sphere_3.h index 053bac81119..f8541de6dd3 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Sphere_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Sphere_3.h @@ -28,7 +28,7 @@ introduces a variable `c` of type `Sphere_3`. It is initialized to the sphere with center `center`, squared radius `squared_radius` and orientation `orientation`. -\pre `orientation` \f$ \neq\f$ \ref COPLANAR, and furthermore, `squared_radius` \f$ \geq\f$ 0. +\pre `orientation != COPLANAR` and `squared_radius >= 0`. */ Sphere_3( const Point_3 & center, const Kernel::FT & squared_radius, @@ -53,7 +53,7 @@ const Point_3 & s); introduces a variable `c` of type `Sphere_3`. It is initialized to the smallest sphere which passes through the points `p`, `q`, and `r`. The orientation of -the sphere is `o`. \pre `o` is not \ref COPLANAR. +the sphere is `o`. \pre `o != COPLANAR`. */ Sphere_3( const Point_3 & p, const Point_3 & q, @@ -65,7 +65,7 @@ const Orientation& o = COUNTERCLOCKWISE); introduces a variable `c` of type `Sphere_3`. It is initialized to the smallest sphere which passes through the points `p` and `q`. The orientation of -the sphere is `o`. \pre `o` is not \ref COPLANAR. +the sphere is `o`. \pre `o != COPLANAR`. */ Sphere_3( const Point_3 & p, const Point_3 & q, @@ -76,7 +76,7 @@ const Orientation& o = COUNTERCLOCKWISE); introduces a variable `c` of type `Sphere_3`. It is initialized to the sphere with center `center`, squared radius zero and orientation `orientation`. -\pre `orientation` \f$ \neq\f$ \ref COPLANAR. +\pre `orientation != COPLANAR`. \post `c.is_degenerate()` = `true`. */ Sphere_3( const Point_3 & center, diff --git a/Kernel_23/doc/Kernel_23/CGAL/Vector_2.h b/Kernel_23/doc/Kernel_23/CGAL/Vector_2.h index 42176a6daed..eaeab03a882 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Vector_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Vector_2.h @@ -71,7 +71,7 @@ Vector_2(double x, double y); /*! introduces a vector `v` initialized to `(hx/hw,hy/hw)`. -\pre \f$ hw\neq0\f$. +\pre `hw != 0`. */ Vector_2(const Kernel::RT &hx, const Kernel::RT &hy, const Kernel::RT &hw = RT(1)); @@ -126,19 +126,19 @@ Kernel::FT y() const; /*! returns the i'th homogeneous coordinate of `v`. -\pre \f$ 0\leq i \leq2\f$. +\pre `0 <= i <= 2`. */ Kernel::RT homogeneous(int i) const; /*! returns the i'th Cartesian coordinate of `v`. -\pre \f$ 0\leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::FT cartesian(int i) const; /*! returns `cartesian(i)`. -\pre \f$ 0\leq i \leq1\f$. +\pre `0 <= i <= 1`. */ Kernel::FT operator[](int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Vector_3.h b/Kernel_23/doc/Kernel_23/CGAL/Vector_3.h index 036dafdc8f2..d126bd97740 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Vector_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Vector_3.h @@ -137,19 +137,19 @@ Kernel::FT z() const; /*! returns the i'th homogeneous coordinate of `v`. -\pre \f$ 0\leq i \leq3\f$. +\pre `0 <= i <= 3`. */ Kernel::RT homogeneous(int i) const; /*! returns the i'th %Cartesian coordinate of `v`. -\pre \f$ 0\leq i \leq2\f$. +\pre `0 <= i <= 2` */ Kernel::FT cartesian(int i) const; /*! returns `cartesian(i)`. -\pre \f$ 0\leq i \leq2\f$. +\pre `0 <= i <= 2` */ Kernel::FT operator[](int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h b/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h index 4c2d0a15cbc..01a147e6d64 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h @@ -147,19 +147,19 @@ public: /*! returns the i'th homogeneous coordinate of `p`. - \pre \f$ 0\leq i \leq2\f$. + \pre `0 <= i <= 2` */ Kernel::RT homogeneous(int i) const; /*! returns the i'th %Cartesian coordinate of `p`. - \pre \f$ 0\leq i \leq1\f$. + \pre `0 <= i <= 1` */ Kernel::FT cartesian(int i) const; /*! returns `cartesian(i)`. - \pre \f$ 0\leq i \leq1\f$. + \pre `0 <= i <= 1` */ Kernel::FT operator[](int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_3.h b/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_3.h index e652a47049d..3dcb39e1786 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_3.h @@ -157,19 +157,19 @@ public: /*! returns the i'th homogeneous coordinate of `p`. - \pre \f$ 0\leq i \leq3\f$. + \pre `0 <= i <= 3` */ Kernel::RT homogeneous(int i) const; /*! returns the i'th %Cartesian coordinate of `p`. - \pre \f$ 0\leq i \leq2\f$. + \pre `0 <= i <= 2` */ Kernel::FT cartesian(int i) const; /*! returns `cartesian(i)`. - \pre \f$ 0\leq i \leq2\f$. + \pre `0 <= i <= 2` */ Kernel::FT operator[](int i) const; diff --git a/Kernel_23/doc/Kernel_23/CGAL/rational_rotation.h b/Kernel_23/doc/Kernel_23/CGAL/rational_rotation.h index 38dab692034..c56d44465fe 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/rational_rotation.h +++ b/Kernel_23/doc/Kernel_23/CGAL/rational_rotation.h @@ -7,7 +7,7 @@ computes integers `sin_num`, `cos_num` and `denom`, such that `sin_num`/`denom` approximates the sine of direction \f$ (\f$`dirx`,`diry`\f$ )\f$. The difference between the sine and the approximating rational is bounded by `eps_num`/`eps_den`. -\pre `eps_num` \f$ \neq0\f$. +\pre `eps_num != 0`. \cgalHeading{Implementation} diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index c770d0b7b40..ac8e47c1e54 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -3879,7 +3879,7 @@ public: /*! constructs the bisector of `p` and `q`. The bisector is oriented in such a way that `p` lies on its - positive side. \pre `p` and `q` are not equal. + positive side. \pre `p != q`. */ Kernel::Line_2 operator()(const Kernel::Point_2&p, const Kernel::Point_2&q ); @@ -3920,7 +3920,7 @@ public: /*! constructs the bisector plane of `p` and `q`. The bisector is oriented in such a way that `p` lies on its - positive side. \pre `p` and `q` are not equal. + positive side. \pre `p != q`. */ Kernel::Plane_3 operator()(const Kernel::Point_3&p, const Kernel::Point_3&q ); @@ -4200,7 +4200,7 @@ public: It is initialized to the circle with center `center`, squared radius `squared_radius` and orientation `orientation`. - \pre `orientation` \f$ \neq\f$ \ref CGAL::COLLINEAR, and further, `squared_radius` \f$ \geq\f$ 0. + \pre `orientation != CGAL::COLLINEAR` and `squared_radius >= 0`. */ Kernel::Circle_2 operator()( Kernel::Point_2 const& center, Kernel::FT const& squared_radius, @@ -4225,7 +4225,7 @@ public: introduces a variable of type `Kernel::Circle_2`. It is initialized to the circle with diameter `pq` and orientation `orientation`. - \pre `orientation` \f$ \neq\f$ \ref CGAL::COLLINEAR. + \pre `orientation != CGAL::COLLINEAR`. */ Kernel::Circle_2 operator()( Kernel::Point_2 const& p, Kernel::Point_2 const& q, @@ -4237,7 +4237,7 @@ public: introduces a variable of type `Kernel::Circle_2`. It is initialized to the circle with center `center`, squared radius zero and orientation `orientation`. - \pre `orientation` \f$ \neq\f$ \ref CGAL::COLLINEAR. + \pre `orientation != CGAL::COLLINEAR`. \post .`is_degenerate()` = `true`. */ Kernel::Circle_2 operator()( Kernel::Point_2 const& center, @@ -4269,7 +4269,7 @@ public: introduces a variable of type `Kernel::Circle_3`. It is initialized to the circle with center `center`, and squared radius `sq_r` in the plane `plane`. - \pre `center` lies in `plane` and `sq_r` \f$ \geq\f$ 0. + \pre `center` lies in `plane` and `sq_r >= 0`. */ Kernel::Circle_3 operator() ( Kernel::Point_3 const& center, @@ -4281,7 +4281,7 @@ public: It is initialized to the circle with center `center`, and squared radius `sq_r` in the plane containing `center` and normal to `n`. - \pre `sq_r` \f$ \geq\f$ 0. + \pre `sq_r >= 0`. */ Kernel::Circle_3 operator() ( Kernel::Point_3 const& center, @@ -5637,7 +5637,7 @@ public: introduces a direction orthogonal to `d`. If `o` is \ref CGAL::CLOCKWISE, `d` is rotated clockwise; if `o` is \ref CGAL::COUNTERCLOCKWISE, `d` is rotated counterclockwise. - \pre `o` is not \ref CGAL::COLLINEAR. + \pre `o != CGAL::COLLINEAR.` */ Kernel::Direction_2 operator()(const Kernel::Direction_2& d, Orientation o); @@ -5753,8 +5753,7 @@ public: /*! returns `v` rotated clockwise by 90 degrees, if `o` is \ref CGAL::CLOCKWISE, and rotated counterclockwise otherwise. - \pre `o` is not \ref CGAL::COLLINEAR. - + \pre `o != CGAL::COLLINEAR`. */ Kernel::Vector_2 operator()(const Kernel::Vector_2& v, Orientation o); @@ -6580,7 +6579,7 @@ public: introduces a sphere initialized to the sphere with center `center`, squared radius `squared_radius` and orientation `orientation`. - \pre `orientation` \f$ \neq\f$ \ref CGAL::COPLANAR, and furthermore, `squared_radius` \f$ \geq\f$ 0. + \pre `orientation != CGAL::COPLANAR` and `squared_radius >= 0`. */ Kernel::Sphere_3 operator()(const Kernel::Point_3 & center, const Kernel::FT & squared_radius, @@ -6601,7 +6600,7 @@ public: /*! introduces a sphere initialized to the smallest sphere which passes through the points `p`, `q`, and `r`. The orientation of - the sphere is `o`. \pre `o` is not \ref CGAL::COPLANAR. + the sphere is `o`. \pre `o != CGAL::COPLANAR`. */ Kernel::Sphere_3 operator()(const Kernel::Point_3 & p, const Kernel::Point_3 & q, @@ -6611,7 +6610,7 @@ public: /*! introduces a sphere initialized to the smallest sphere which passes through the points `p` and `q`. The orientation of - the sphere is `o`. \pre `o` is not \ref CGAL::COPLANAR. + the sphere is `o`. \pre `o != CGAL::COPLANAR`. */ Kernel::Sphere_3 operator()(const Kernel::Point_3 & p, const Kernel::Point_3 & q, @@ -6620,7 +6619,7 @@ public: /*! introduces a sphere `s` initialized to the sphere with center `center`, squared radius zero and orientation `orientation`. - \pre `orientation` \f$ \neq\f$ \ref CGAL::COPLANAR. + \pre `orientation != CGAL::COPLANAR`. \post `s.is_degenerate()` = `true`. */ Kernel::Sphere_3 operator()( const Kernel::Point_3 & center, diff --git a/Kernel_23/include/CGAL/Projection_traits_xy_3.h b/Kernel_23/include/CGAL/Projection_traits_xy_3.h index e1e779f7955..301a8348df3 100644 --- a/Kernel_23/include/CGAL/Projection_traits_xy_3.h +++ b/Kernel_23/include/CGAL/Projection_traits_xy_3.h @@ -14,6 +14,7 @@ #define CGAL_PROJECTION_TRAITS_XY_3_H #include +#include namespace CGAL { @@ -22,6 +23,11 @@ class Projection_traits_xy_3 : public internal::Projection_traits_3 {}; +template < class R > +struct Triangulation_structural_filtering_traits > { + typedef typename Triangulation_structural_filtering_traits::Use_structural_filtering_tag Use_structural_filtering_tag; +}; + } //namespace CGAL #endif // CGAL_PROJECTION_TRAITS_XY_3_H diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h index 4db9a3f3baf..98c2f96b0af 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h @@ -268,7 +268,7 @@ _test_cls_aff_transformation_2(const R& ) assert( pnt.transform(gat3).transform(gat2) == pnt.transform(co1) ); assert( dir.transform(gat3).transform(gat2) == dir.transform(co1) ); assert( vec.transform(gat3).transform(gat2) == vec.transform(co1) ); - assert( lin.transform(gat3).transform(gat2) == lin.transform(co1) ); + assert( lin.transform(gat3).transform(gat2) == lin.transform(co1) || nonexact); co1 = ident * gat1; assert( vec.transform(gat1) == vec.transform(co1) ); assert( dir.transform(gat1) == dir.transform(co1) ); @@ -281,7 +281,7 @@ _test_cls_aff_transformation_2(const R& ) assert( lin.transform(gat1) == lin.transform(co1) ); co1 = gat1 * gat1.inverse() ; assert( vec == vec.transform(co1) ); - assert( pnt == pnt.transform(co1) ); + assert( pnt == pnt.transform(co1) || nonexact); assert( dir == dir.transform(co1) ); assert( lin == lin.transform(co1) ); @@ -619,7 +619,7 @@ _test_cls_aff_transformation_2(const R& ) CGAL::Point_2(1,3), CGAL::Point_2(2,1))); CGAL::Point_2 p(4,2); - assert(p.transform(refl) == CGAL::Point_2(0,0)); + assert(p.transform(refl) == CGAL::Point_2(0,0) || nonexact); //with translation @@ -642,7 +642,7 @@ _test_cls_aff_transformation_2(const R& ) assert(p1 == p.transform(comp1)); p1 = p.transform(refl); p1 = p1.transform(scal); - assert(p1 == p.transform(comp2)); + assert(p1 == p.transform(comp2) || nonexact); //with rotation CGAL::Aff_transformation_2 rot(CGAL::ROTATION, 1, 0); comp1 = refl*rot; @@ -652,7 +652,7 @@ _test_cls_aff_transformation_2(const R& ) assert(p1 == p.transform(comp1)); p1 = p.transform(refl); p1 = p1.transform(rot); - assert(p1 == p.transform(comp2)); + assert(p1 == p.transform(comp2) || nonexact); //with reflection CGAL::Aff_transformation_2 refl2(CGAL::REFLECTION, CGAL::Line_2( CGAL::Point_2(0,0), @@ -664,7 +664,7 @@ _test_cls_aff_transformation_2(const R& ) assert(p1 == p.transform(comp1)); p1 = p.transform(refl); p1 = p1.transform(refl2); - assert(p1 == p.transform(comp2)); + assert(p1 == p.transform(comp2) || nonexact); //with transformation CGAL::Aff_transformation_2 afft(1,2,3,4,5,6); comp1 = refl*afft; @@ -674,7 +674,7 @@ _test_cls_aff_transformation_2(const R& ) assert(p1 == p.transform(comp1)); p1 = p.transform(refl); p1 = p1.transform(afft); - assert(p1 == p.transform(comp2)); + assert(p1 == p.transform(comp2) || nonexact); //equality CGAL::Aff_transformation_2 a2(0,1,0,1), diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h index c71651a9439..bf825032dcc 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h @@ -88,11 +88,11 @@ _test_cls_sphere_3(const R& ) assert( cc != c8 ); assert( cc == c7 ); - assert( c5.center() == p3 ); + assert( c5.center() == p3 || nonexact); assert( cc.center() == p3 ); assert( c5.squared_radius() == FT( n9 ) ); assert( c4.squared_radius() == cc.squared_radius() ); - assert( c4 == c5 ); + assert( c4 == c5 || nonexact); assert( c4 == c7 ); assert( c4 != c8 ); assert( cn == cp.opposite() ); @@ -114,7 +114,7 @@ _test_cls_sphere_3(const R& ) std::cout << '.'; assert( c4.center() == p3 ); - assert( c5.center() == p3 ); + assert( c5.center() == p3 || nonexact); assert( c4.squared_radius() == FT( n9 ) ); assert( c5.squared_radius() == FT( n9 ) ); assert( c8.squared_radius() == FT( n9 ) ); diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_points_implicit_sphere.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_points_implicit_sphere.h index 137c092f1c7..b67aa0330ac 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_points_implicit_sphere.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_points_implicit_sphere.h @@ -92,7 +92,7 @@ _test_fct_points_implicit_sphere(const R&) assert( CGAL::squared_distance( r, org ) == FT1 ); tpt = r.transform(rot_z); - assert( CGAL::squared_distance( tpt, org ) == FT1 ); + assert( CGAL::squared_distance( tpt, org ) == FT1 || nonexact); r = tpt.transform(rot_y); assert( CGAL::squared_distance( r, org ) == FT1 || nonexact ); diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_mf_plane_3_to_2d.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_mf_plane_3_to_2d.h index 15ec54556b8..a9dfa26d2f4 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_mf_plane_3_to_2d.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_mf_plane_3_to_2d.h @@ -68,11 +68,11 @@ _test_mf_plane_3_to_2d(const R& ) Point_3 p6( n4, n5, n0, n8); Plane_3 pl3( p4, p5, p6); assert( p4 == pl3.to_3d( pl3.to_2d( p4)) || nonexact ); - assert( p5 == pl3.to_3d( pl3.to_2d( p5)) ); + assert( p5 == pl3.to_3d( pl3.to_2d( p5)) || nonexact); assert( p6 == pl3.to_3d( pl3.to_2d( p6)) || nonexact ); Plane_3 pl4( p4, p6, p5); assert( p4 == pl4.to_3d( pl4.to_2d( p4)) || nonexact ); - assert( p5 == pl4.to_3d( pl4.to_2d( p5)) ); + assert( p5 == pl4.to_3d( pl4.to_2d( p5)) || nonexact); assert( p6 == pl4.to_3d( pl4.to_2d( p6)) || nonexact ); Point_3 p7 = CGAL::midpoint( p1, p2); diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index 2663b352f08..c66d416841c 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -740,7 +740,11 @@ template class Compact_mesh_cell_base_3 { public: +#ifdef DOXYGEN_RUNNING + typedef unspecified_type Triangulation_data_structure; +#else typedef internal::Dummy_tds_3 Triangulation_data_structure; +#endif typedef Triangulation_data_structure::Vertex_handle Vertex_handle; typedef Triangulation_data_structure::Cell_handle Cell_handle; template @@ -761,7 +765,11 @@ template diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index 714430116f6..7b83d8b05bc 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -974,7 +974,7 @@ update_mesh(const Moves_vector& moves, { FT size = std::get<2>(*it); -#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE +#ifdef CGAL_MESH_3_OPTIMIZER_VERY_VERBOSE std::cerr << "Moving #" << it - moves.begin() << " addr: " << &*v << " pt: " << tr_.point(v) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index e8f105cd241..185efe6229c 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -575,7 +575,7 @@ refine_mesh(std::string dump_after_refine_surface_prefix) nbsteps = 0; facets_visitor_.activate(); - dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix); + std::cerr << "Start volume scan..."; CGAL_MESH_3_TASK_BEGIN(scan_cells_task_handle); cells_mesher_.scan_triangulation(); @@ -584,6 +584,7 @@ refine_mesh(std::string dump_after_refine_surface_prefix) std::cerr << "end scan. [Bad tets:" << cells_mesher_.size() << "]"; std::cerr << std::endl << std::endl; elapsed_time += timer.time(); + dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix); timer.stop(); timer.reset(); timer.start(); std::cerr << "Refining...\n"; @@ -690,7 +691,8 @@ initialize() # ifdef CGAL_CONCURRENT_MESH_3_VERBOSE std::cerr << "Adding points on a far sphere (radius = " << radius <<")..."; # endif - Random_points_on_sphere_3 random_point(radius); + CGAL::Random rnd(0); + Random_points_on_sphere_3 random_point(radius, rnd); const int NUM_PSEUDO_INFINITE_VERTICES = static_cast( float(std::thread::hardware_concurrency()) * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core); diff --git a/Mesh_3/include/CGAL/Mesh_3/config.h b/Mesh_3/include/CGAL/Mesh_3/config.h index 6fc06788902..cc2e5187f9b 100644 --- a/Mesh_3/include/CGAL/Mesh_3/config.h +++ b/Mesh_3/include/CGAL/Mesh_3/config.h @@ -57,4 +57,10 @@ # endif #endif +#ifdef CGAL_MESH_3_VERY_VERBOSE +# ifndef CGAL_MESH_3_OPTIMIZER_VERY_VERBOSE +# define CGAL_MESH_3_OPTIMIZER_VERY_VERBOSE 1 +# endif +#endif + #endif // CGAL_MESH_3_CONFIG_H diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index d8a8804edb5..d2dfef196e0 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -152,7 +152,9 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, const Subdomain seed_label = domain.is_in_domain_object()(seed_point); const Subdomain seed_cell_label - = (seed_cell == Cell_handle() || tr.is_infinite(seed_cell)) + = ( tr.dimension() < 3 + || seed_cell == Cell_handle() + || tr.is_infinite(seed_cell)) ? Subdomain() //seed_point is OUTSIDE_AFFINE_HULL : domain.is_in_domain_object()( seed_cell->weighted_circumcenter(tr.geom_traits())); diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index cb683ae7850..47b9bf495ad 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -549,11 +549,15 @@ public: typedef int Curve_index; typedef int Corner_index; +#ifdef DOXYGEN_RUNNING + typedef unspecified_type Index; +#else typedef typename Mesh_3::internal::Index_generator_with_features< typename MeshDomain_3::Subdomain_index, Surface_patch_index, Curve_index, Corner_index>::type Index; +#endif typedef CGAL::Tag_true Has_features; typedef typename MeshDomain_3::R::FT FT; diff --git a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h index 3ab58a03384..1dbfac05a50 100644 --- a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h @@ -317,7 +317,11 @@ template > struct Mesh_vertex_base_3 { +#ifdef DOXYGEN_RUNNING + using Triangulation_data_structure = unspecified_type; +#else using Triangulation_data_structure = internal::Dummy_tds_3; +#endif using Vertex_handle = typename Triangulation_data_structure::Vertex_handle; using Cell_handle = typename Triangulation_data_structure::Cell_handle; @@ -335,7 +339,11 @@ template > struct Mesh_vertex_generator_3 { +#ifdef DOXYGEN_RUNNING + using Triangulation_data_structure = unspecified_type; +#else using Triangulation_data_structure = internal::Dummy_tds_3; +#endif using Vertex_handle = typename Triangulation_data_structure::Vertex_handle; using Cell_handle = typename Triangulation_data_structure::Cell_handle; diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 3f91ea357bd..a776e87da72 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -48,6 +48,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_meshing_unit_tetrahedron.cpp" ) create_single_source_cgal_program( "test_meshing_with_default_edge_size.cpp" ) create_single_source_cgal_program( "test_meshing_determinism.cpp" ) + create_single_source_cgal_program( "test_meshing_without_features_determinism.cpp" ) create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" ) create_single_source_cgal_program( "test_meshing_with_one_step.cpp" ) @@ -76,6 +77,7 @@ if ( CGAL_FOUND ) test_meshing_unit_tetrahedron test_meshing_with_default_edge_size test_meshing_determinism + test_meshing_without_features_determinism test_mesh_3_issue_1554 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 @@ -97,6 +99,8 @@ if ( CGAL_FOUND ) test_meshing_polyhedron test_meshing_polyhedral_complex test_mesh_capsule_var_distance_bound + test_meshing_determinism + test_meshing_without_features_determinism test_mesh_3_issue_1554 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 diff --git a/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp b/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp index ef92a338025..ade0505bca7 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp @@ -68,7 +68,10 @@ void test() // iterate std::vector output_c3t3; std::vector output_surfaces; - output_c3t3.reserve(5 * nb_runs); + + const std::size_t nb_operations = 5; + + output_c3t3.reserve(nb_operations * nb_runs); for(std::size_t i = 0; i < nb_runs; ++i) { std::cout << "------- Iteration " << (i+1) << " -------" << std::endl; @@ -133,14 +136,16 @@ void test() if(i == 0) continue; //else check - for(std::size_t j = 0; j < 5; ++j) + for(std::size_t j = 0; j < nb_operations; ++j) { - if(0 != output_c3t3[5*(i-1)+j].compare(output_c3t3[5*i+j])) + std::size_t id1 = nb_operations * (i - 1) + j; + std::size_t id2 = nb_operations * i + j; + if(0 != output_c3t3[id1].compare(output_c3t3[id2])) { std::cerr << "Meshing operation " << j << " is not deterministic.\n"; assert(false); } - if (0 != output_surfaces[5 * (i - 1) + j].compare(output_surfaces[5 * i + j])) + if (0 != output_surfaces[id1].compare(output_surfaces[id2])) { std::cerr << "Output surface after operation " << j << " is not deterministic.\n"; assert(false); @@ -151,8 +156,11 @@ void test() int main(int, char*[]) { + std::cout << "Sequential test" << std::endl; test(); + #ifdef CGAL_LINKED_WITH_TBB + std::cout << "\n\nParallel with 1 thread test" << std::endl; tbb::global_control c(tbb::global_control::max_allowed_parallelism, 1); test(); #endif diff --git a/Mesh_3/test/Mesh_3/test_meshing_without_features_determinism.cpp b/Mesh_3/test/Mesh_3/test_meshing_without_features_determinism.cpp new file mode 100644 index 00000000000..0dd8fb46888 --- /dev/null +++ b/Mesh_3/test/Mesh_3/test_meshing_without_features_determinism.cpp @@ -0,0 +1,160 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#ifdef CGAL_LINKED_WITH_TBB +#define TBB_PREVIEW_GLOBAL_CONTROL 1 +# include +#endif + +// To avoid verbose function and named parameters call +using namespace CGAL::parameters; + +template +void test() +{ + // Collect options + std::size_t nb_runs = 2; + unsigned int nb_lloyd = 2; + unsigned int nb_odt = 2; + double perturb_bound = 10.; + double exude_bound = 15.; + + // Domain + typedef CGAL::Exact_predicates_inexact_constructions_kernel K; + typedef CGAL::Mesh_polyhedron_3::type Polyhedron; + typedef CGAL::Polyhedral_mesh_domain_3 Mesh_domain; + + // Triangulation + typedef typename CGAL::Mesh_triangulation_3::type Tr; + typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + + // Mesh Criteria + typedef CGAL::Mesh_criteria_3 Mesh_criteria; + + // Domain + std::cout << "\tSeed is\t 0" << std::endl; + std::ifstream input(CGAL::data_file_path("meshes/cube.off")); + Polyhedron polyhedron; + input >> polyhedron; + Mesh_domain domain(polyhedron); + //no random generator is given, so CGAL::Random(0) is used + + + // Mesh criteria + Mesh_criteria criteria(edge_size = 0.2, + facet_angle = 25, + facet_size = 0.2, + facet_distance = 0.002, + cell_radius_edge_ratio = 3, + cell_size = 0.2); + + // iterate + std::vector output_c3t3; + std::vector output_surfaces; + output_c3t3.reserve(5 * nb_runs); + for(std::size_t i = 0; i < nb_runs; ++i) + { + std::cout << "------- Iteration " << (i+1) << " -------" << std::endl; + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + no_perturb(), + no_exude()); + std::ostringstream oss; + CGAL::IO::write_MEDIT(oss, c3t3); + output_c3t3.push_back(oss.str()); //[5*i] + oss.clear(); + Polyhedron out_poly; + CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, out_poly); + oss << out_poly; + output_surfaces.push_back(oss.str());//[5*i] + out_poly.clear(); + oss.clear(); + + //LLOYD (1) + CGAL::lloyd_optimize_mesh_3(c3t3, domain, max_iteration_number = nb_lloyd); + CGAL::IO::write_MEDIT(oss, c3t3); + output_c3t3.push_back(oss.str());//[i*5+1] + oss.clear(); + CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, out_poly); + oss << out_poly; + output_surfaces.push_back(oss.str());//[i*5+1] + out_poly.clear(); + oss.clear(); + + //ODT (2) + CGAL::odt_optimize_mesh_3(c3t3, domain, max_iteration_number = nb_odt); + CGAL::IO::write_MEDIT(oss, c3t3); + output_c3t3.push_back(oss.str());//[i*5+2] + oss.clear(); + CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, out_poly); + oss << out_poly; + output_surfaces.push_back(oss.str());//[i*5+2] + out_poly.clear(); + oss.clear(); + + //PERTURB (3) + CGAL::perturb_mesh_3(c3t3, domain, sliver_bound=perturb_bound); + CGAL::IO::write_MEDIT(oss, c3t3); + output_c3t3.push_back(oss.str());//[i*5+3] + oss.clear(); + CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, out_poly); + oss << out_poly; + output_surfaces.push_back(oss.str());//[i*5+3] + out_poly.clear(); + oss.clear(); + + //EXUDE (4) + CGAL::exude_mesh_3(c3t3, sliver_bound=exude_bound); + CGAL::IO::write_MEDIT(oss, c3t3); + output_c3t3.push_back(oss.str());//[i*5+4] + oss.clear(); + CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, out_poly); + oss << out_poly; + output_surfaces.push_back(oss.str());//[i*5+4] + out_poly.clear(); + oss.clear(); + + if(i == 0) + continue; + //else check + for(std::size_t j = 0; j < 5; ++j) + { + if(0 != output_c3t3[5*(i-1)+j].compare(output_c3t3[5*i+j])) + { + std::cerr << "Meshing operation " << j << " is not deterministic.\n"; + assert(false); + } + if (0 != output_surfaces[5 * (i - 1) + j].compare(output_surfaces[5 * i + j])) + { + std::cerr << "Output surface after operation " << j << " is not deterministic.\n"; + assert(false); + } + } + } +} + +int main(int, char*[]) +{ + std::cout << "Sequential test" << std::endl; + test(); + +#ifdef CGAL_LINKED_WITH_TBB + std::cout << "\n\nParallel with 1 thread test" << std::endl; + tbb::global_control c(tbb::global_control::max_allowed_parallelism, 1); + test(); +#endif +} diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h index ece0d7788d7..22720565399 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h @@ -32,8 +32,7 @@ namespace CGAL { // This implementation is based on Alon Baram's 2013 master's thesis "Polygonal // Minkowski Sums via Convolution: Theory and Practice" at Tel-Aviv University. template -class Minkowski_sum_by_reduced_convolution_2 -{ +class Minkowski_sum_by_reduced_convolution_2 { private: typedef Kernel_ Kernel; typedef Container_ Container; @@ -56,14 +55,14 @@ private: // Arrangement-related types: typedef Arrangement_with_history_2 Arrangement_history_2; - typedef typename Arrangement_history_2::Halfedge_handle Halfedge_handle; - typedef typename Arrangement_history_2::Face_iterator Face_iterator; - typedef typename Arrangement_history_2::Face_handle Face_handle; - typedef typename Arrangement_history_2::Ccb_halfedge_circulator - Ccb_halfedge_circulator; - typedef typename Arrangement_history_2::Originating_curve_iterator - Originating_curve_iterator; - typedef typename Arrangement_history_2::Inner_ccb_iterator Inner_ccb_iterator; + typedef typename Arrangement_history_2::Halfedge_const_handle + Halfedge_const_handle; + typedef typename Arrangement_history_2::Face_const_handle + Face_const_handle; + typedef typename Arrangement_history_2::Ccb_halfedge_const_circulator + Ccb_halfedge_const_circulator; + typedef typename Arrangement_history_2::Inner_ccb_const_iterator + Inner_ccb_const_iterator; // Function object types: typename Kernel::Construct_translated_point_2 f_add; @@ -74,8 +73,8 @@ private: typename Kernel::Counterclockwise_in_between_2 f_ccw_in_between; public: - Minkowski_sum_by_reduced_convolution_2() - { + //! \brief constructs. + Minkowski_sum_by_reduced_convolution_2() { // Obtain kernel functors Kernel ker; f_add = ker.construct_translated_point_2_object(); @@ -86,10 +85,10 @@ public: f_ccw_in_between = ker.counterclockwise_in_between_2_object(); } + //! \brief applies the Minkowski sum reduced-convolution operator. template void operator()(const Polygon_2& pgn1, const Polygon_2& pgn2, - Polygon_2& outer_boundary, OutputIterator holes) const - { + Polygon_2& outer_boundary, OutputIterator holes) const { CGAL_precondition(pgn1.is_simple()); CGAL_precondition(pgn2.is_simple()); CGAL_precondition(pgn1.orientation() == COUNTERCLOCKWISE); @@ -101,19 +100,17 @@ public: common_operator(pwh1, pwh2, outer_boundary, holes); } + //! \brief applies the Minkowski sum reduced-convolution operator. template void operator()(const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, Polygon_2& outer_boundary, OutputIterator holes) const - { - common_operator(pgn1, pgn2, outer_boundary, holes); - } + { common_operator(pgn1, pgn2, outer_boundary, holes); } + //! \brief applies the Minkowski sum reduced-convolution operator. template - void operator()(const Polygon_2& pgn1, - const Polygon_with_holes_2& pgn2, - Polygon_2& outer_boundary, OutputIterator holes) const - { + void operator()(const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, + Polygon_2& outer_boundary, OutputIterator holes) const { CGAL_precondition(pgn1.is_simple()); CGAL_precondition(pgn1.orientation() == COUNTERCLOCKWISE); const Polygon_with_holes_2 pwh1(pgn1); @@ -121,11 +118,11 @@ public: } private: + //! \brief applies the Minkowski sum reduced-convolution operator. template void common_operator(const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, - Polygon_2& outer_boundary, OutputIterator holes) const - { + Polygon_2& outer_boundary, OutputIterator holes) const { // If the outer boundaries of both summands are empty the Minkowski sum is // the entire plane. if (pgn1.outer_boundary().is_empty() && pgn2.outer_boundary().is_empty()) @@ -157,7 +154,7 @@ private: // Check for each face whether it is a hole in the M-sum. If it is, add it // to 'holes'. See chapter 3 of of Alon's master's thesis. - for (Face_iterator fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) { + for (auto fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) { // Check whether the face is on the M-sum's border. // The unbounded face cannot contribute to the Minkowski sum @@ -169,8 +166,8 @@ private: // The face needs to be orientable if (! test_face_orientation(arr, fit)) continue; - // When the reversed polygon 1, translated by a point inside of this face, - // collides with polygon 2, this cannot be a hole + // When the reversed polygon 1, translated by a point inside of this + // face, collides with polygon 2, this cannot be a hole Point_2 inner_point = get_point_in_face(fit); if (collision_detector.check_collision(inner_point)) continue; @@ -178,56 +175,52 @@ private: } } - // Builds the reduced convolution for each pair of loop in the two - // polygons-with-holes. + /*! \brief builds the reduced convolution for each pair of loops in the two + * polygons-with-holes. + */ void build_reduced_convolution(const Polygon_with_holes_2& pgnwh1, const Polygon_with_holes_2& pgnwh2, - Segment_list& reduced_convolution) const - { - for (std::size_t x = 0; x < 1+pgnwh1.number_of_holes(); ++x) - { - for (std::size_t y = 0; y < 1+pgnwh2.number_of_holes(); ++y) - { - if ((x != 0) && (y != 0)) - { - continue; - } - - Polygon_2 pgn1, pgn2; - + Segment_list& reduced_convolution) const { + for (std::size_t x = 0; x < 1+pgnwh1.number_of_holes(); ++x) { + for (std::size_t y = 0; y < 1+pgnwh2.number_of_holes(); ++y) { + if ((x != 0) && (y != 0)) continue; if (x == 0) { - pgn1 = pgnwh1.outer_boundary(); + const auto& pgn1 = pgnwh1.outer_boundary(); + if (y == 0) { + const auto& pgn2 = pgnwh2.outer_boundary(); + build_reduced_convolution(pgn1, pgn2, reduced_convolution); + } + else { + auto it2 = pgnwh2.holes_begin(); + for (std::size_t count = 0; count < y-1; ++count) ++it2; + build_reduced_convolution(pgn1, *it2, reduced_convolution); + } } else { - typename Polygon_with_holes_2::Hole_const_iterator it1 = - pgnwh1.holes_begin(); - for (std::size_t count = 0; count < x-1; count++) { it1++; } - pgn1 = *it1; + auto it1 = pgnwh1.holes_begin(); + for (std::size_t count = 0; count < x-1; ++count) ++it1; + if (y == 0) { + const auto& pgn2 = pgnwh2.outer_boundary(); + build_reduced_convolution(*it1, pgn2, reduced_convolution); + } + else { + auto it2 = pgnwh2.holes_begin(); + for (std::size_t count = 0; count < y-1; ++count) ++it2; + build_reduced_convolution(*it1, *it2, reduced_convolution); + } } - - if (y == 0) { - pgn2 = pgnwh2.outer_boundary(); - } - else { - typename Polygon_with_holes_2::Hole_const_iterator it2 = - pgnwh2.holes_begin(); - for (std::size_t count = 0; count < y-1; count++) { it2++; } - pgn2 = *it2; - } - - build_reduced_convolution(pgn1, pgn2, reduced_convolution); } } } - // Builds the reduced convolution using a fiber grid approach. For each - // starting vertex, try to add two outgoing next states. If a visited - // vertex is reached, then do not explore further. This is a BFS-like - // iteration beginning from each vertex in the first column of the fiber - // grid. + /*! \brief builds the reduced convolution using a fiber grid approach. For + * each starting vertex, try to add two outgoing next states. If a visited + * vertex is reached, then do not explore further. This is a BFS-like + * iteration beginning from each vertex in the first column of the fiber + * grid. + */ void build_reduced_convolution(const Polygon_2& pgn1, const Polygon_2& pgn2, - Segment_list& reduced_convolution) const - { + Segment_list& reduced_convolution) const { int n1 = static_cast(pgn1.size()); int n2 = static_cast(pgn2.size()); if ((n1 == 0) || (n2 == 0)) return; @@ -244,13 +237,9 @@ private: // Init the queue with vertices from the first column std::queue state_queue; - for (int i = n1-1; i >= 0; --i) - { - state_queue.push(State(i, 0)); - } + for (int i = n1-1; i >= 0; --i) state_queue.push(State(i, 0)); - while (state_queue.size() > 0) - { + while (state_queue.size() > 0) { State curr_state = state_queue.front(); state_queue.pop(); @@ -258,10 +247,7 @@ private: int i2 = curr_state.second; // If this state was already visited, skip it - if (visited_states.count(curr_state) > 0) - { - continue; - } + if (visited_states.count(curr_state) > 0) continue; visited_states.insert(curr_state); int next_i1 = (i1+1) % n1; @@ -271,16 +257,13 @@ private: // Try two transitions: From (i,j) to (i+1,j) and to (i,j+1). Add // the respective segments, if they are in the reduced convolution. - for(int step_in_pgn1 = 0; step_in_pgn1 <= 1; step_in_pgn1++) - { + for (int step_in_pgn1 = 0; step_in_pgn1 <= 1; ++step_in_pgn1) { int new_i1, new_i2; - if (step_in_pgn1) - { + if (step_in_pgn1) { new_i1 = next_i1; new_i2 = i2; } - else - { + else { new_i1 = i1; new_i2 = next_i2; } @@ -289,39 +272,33 @@ private: // the other polygon's vertex' ingoing and outgoing directions, // the segment belongs to the full convolution. bool belongs_to_convolution; - if (step_in_pgn1) - { + if (step_in_pgn1) { belongs_to_convolution = f_ccw_in_between(p1_dirs[i1], p2_dirs[prev_i2], p2_dirs[i2]) || p1_dirs[i1] == p2_dirs[i2]; } - else - { + else { belongs_to_convolution = f_ccw_in_between(p2_dirs[i2], p1_dirs[prev_i1], p1_dirs[i1]) || p2_dirs[i2] == p1_dirs[prev_i1]; } - if (belongs_to_convolution) - { + if (belongs_to_convolution) { state_queue.push(State(new_i1, new_i2)); // Only edges added to convex vertices can be on the M-sum's boundary. // This filter only leaves the *reduced* convolution. bool convex; - if (step_in_pgn1) - { + if (step_in_pgn1) { convex = is_convex(p2_vertices[prev_i2], p2_vertices[i2], p2_vertices[next_i2]); } - else - { + else { convex = is_convex(p1_vertices[prev_i1], p1_vertices[i1], p1_vertices[next_i1]); } - if (convex) - { + if (convex) { Point_2 start_point = get_point(i1, i2, p1_vertices, p2_vertices); Point_2 end_point = get_point(new_i1, new_i2, p1_vertices, p2_vertices); @@ -334,27 +311,21 @@ private: // Returns a vector of the polygon's vertices, in case that Container // is std::list and we cannot use vertex(i). - std::vector vertices_of_polygon(const Polygon_2& p) const - { + std::vector vertices_of_polygon(const Polygon_2& p) const { std::vector vertices; - for (typename Polygon_2::Vertex_const_iterator it = p.vertices_begin(); - it != p.vertices_end(); it++) - { + for (auto it = p.vertices_begin(); it != p.vertices_end(); it++) vertices.push_back(*it); - } return vertices; } // Returns a sorted list of the polygon's edges - std::vector directions_of_polygon( - const std::vector& points) const - { + std::vector + directions_of_polygon(const std::vector& points) const { std::vector directions; std::size_t n = points.size(); - for (std::size_t i = 0; i < n-1; ++i) - { + for (std::size_t i = 0; i < n-1; ++i) { directions.push_back(f_direction(f_vector(points[i], points[i+1]))); } directions.push_back(f_direction(f_vector(points[n-1], points[0]))); @@ -362,69 +333,59 @@ private: return directions; } + /*! \brief determines whether three vertices on the outer CCB of a face are + * locally convex. + */ bool is_convex(const Point_2& prev, const Point_2& curr, const Point_2& next) const - { - return f_orientation(prev, curr, next) == LEFT_TURN; - } + { return f_orientation(prev, curr, next) == LEFT_TURN; } - // Returns the point corresponding to a state (i,j). + //! \brief obtains the point corresponding to a state (i,j). Point_2 get_point(int i1, int i2, const std::vector& pgn1, const std::vector& pgn2) const - { + { return f_add(pgn1[i1], Vector_2(Point_2(ORIGIN), pgn2[i2])); } - return f_add(pgn1[i1], Vector_2(Point_2(ORIGIN), pgn2[i2])); - } + //! \brief puts the outer loop of the arrangement in 'outer_boundary' + void get_outer_loop(const Arrangement_history_2& arr, + Polygon_2& outer_boundary) const { + Inner_ccb_const_iterator icit = arr.unbounded_face()->inner_ccbs_begin(); + Ccb_halfedge_const_circulator circ_start = *icit; + Ccb_halfedge_const_circulator circ = circ_start; - // Put the outer loop of the arrangement in 'outer_boundary' - void get_outer_loop(Arrangement_history_2& arr, - Polygon_2& outer_boundary) const - { - Inner_ccb_iterator icit = arr.unbounded_face()->inner_ccbs_begin(); - Ccb_halfedge_circulator circ_start = *icit; - Ccb_halfedge_circulator circ = circ_start; - - do - { - outer_boundary.push_back(circ->source()->point()); - } + do outer_boundary.push_back(circ->source()->point()); while (--circ != circ_start); } - // Determine whether the face orientation is consistent. + //! \brief determines whether the face orientation is consistent. bool test_face_orientation(const Arrangement_history_2& arr, - const Face_handle face) const - { + const Face_const_handle face) const { // The face needs to be orientable - Ccb_halfedge_circulator start = face->outer_ccb(); - Ccb_halfedge_circulator circ = start; + Ccb_halfedge_const_circulator start = face->outer_ccb(); + Ccb_halfedge_const_circulator circ = start; do if (!do_original_edges_have_same_direction(arr, circ)) return false; while (++circ != start); return true; } - // Add a face to 'holes'. + //! \brief adds a face to 'holes'. template - void add_face(const Face_handle face, OutputIterator holes) const - { + void add_face(Face_const_handle face, OutputIterator holes) const { Polygon_2 pgn_hole; - Ccb_halfedge_circulator start = face->outer_ccb(); - Ccb_halfedge_circulator circ = start; + Ccb_halfedge_const_circulator start = face->outer_ccb(); + Ccb_halfedge_const_circulator circ = start; do pgn_hole.push_back(circ->source()->point()); while (--circ != start); *holes = pgn_hole; ++holes; } - // Check whether the convolution's original edge(s) had the same direction as - // the arrangement's half edge + /*! \brief checks whether the convolution's original edge(s) had the same + * direction as the arrangement's half edge. + */ bool do_original_edges_have_same_direction(const Arrangement_history_2& arr, - const Halfedge_handle he) const - { - Originating_curve_iterator segment_itr; - - for (segment_itr = arr.originating_curves_begin(he); + Halfedge_const_handle he) const { + for (auto segment_itr = arr.originating_curves_begin(he); segment_itr != arr.originating_curves_end(he); ++segment_itr) { if (f_compare_xy(segment_itr->source(), segment_itr->target()) == @@ -437,41 +398,34 @@ private: return true; } - // Return a point in the face's interior by finding a diagonal - Point_2 get_point_in_face(const Face_handle face) const - { - Ccb_halfedge_circulator current_edge = face->outer_ccb(); - Ccb_halfedge_circulator next_edge = current_edge; - next_edge++; + //! \brief obtains a point in the face's interior by finding a diagonal + Point_2 get_point_in_face(Face_const_handle face) const { + Ccb_halfedge_const_circulator next = face->outer_ccb(); + Ccb_halfedge_const_circulator curr = next++; - Point_2 a, v, b; - - // Move over the face's vertices until a convex corner is encountered: - do - { - a = current_edge->source()->point(); - v = current_edge->target()->point(); - b = next_edge->target()->point(); - - current_edge++; - next_edge++; + // Move over the face's vertices until a convex corner is encountered. + // Observe that the outer ccb of a hole is clockwise oriented. + while (! is_convex(curr->source()->point(), + curr->target()->point(), + next->target()->point())) { + curr = next; + ++next; } - while (!is_convex(a, v, b)); + const auto& a = curr->source()->point(); + const auto& v = curr->target()->point(); + const auto& b = next->target()->point(); Triangle_2 ear(a, v, b); FT min_distance = -1; - const Point_2* min_q = 0; + const Point_2* min_q = nullptr; // Of the remaining vertices, find the one inside of the "ear" with minimal // distance to v: - while (++next_edge != current_edge) - { - const Point_2& q = next_edge->target()->point(); - if (ear.has_on_bounded_side(q)) - { + while (++next != curr) { + const Point_2& q = next->target()->point(); + if (ear.has_on_bounded_side(q)) { FT distance = squared_distance(q, v); - if ((min_q == 0) || (distance < min_distance)) - { + if ((min_q == 0) || (distance < min_distance)) { min_distance = distance; min_q = &q; } @@ -483,15 +437,14 @@ private: return (min_q == 0) ? centroid(ear) : midpoint(v, *min_q); } + //! \brief transforms a polygon with holes. template Polygon_with_holes_2 transform(const Transformation& t, - const Polygon_with_holes_2& p) const - { + const Polygon_with_holes_2& p) const { Polygon_with_holes_2 result(CGAL::transform(t, p.outer_boundary())); - typename Polygon_with_holes_2::Hole_const_iterator it = p.holes_begin(); - while (it != p.holes_end()) - { + auto it = p.holes_begin(); + while (it != p.holes_end()) { Polygon_2 p2(it->vertices_begin(), it->vertices_end()); result.add_hole(CGAL::transform(t, p2)); ++it; diff --git a/Nef_3/include/CGAL/Nef_3/Binary_operation.h b/Nef_3/include/CGAL/Nef_3/Binary_operation.h index 558e3e09f1c..fa26c870f77 100644 --- a/Nef_3/include/CGAL/Nef_3/Binary_operation.h +++ b/Nef_3/include/CGAL/Nef_3/Binary_operation.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,7 @@ class Binary_operation : public CGAL::SNC_decorator { typedef typename SNC_structure::Items Items; typedef typename Map::Sphere_map Sphere_map; typedef CGAL::SNC_decorator SNC_decorator; + typedef CGAL::SNC_const_decorator SNC_const_decorator; typedef SNC_decorator Base; typedef CGAL::SNC_constructor SNC_constructor; typedef CGAL::SNC_external_structure @@ -82,10 +84,13 @@ class Binary_operation : public CGAL::SNC_decorator { typedef CGAL::SNC_SM_overlayer SM_overlayer; typedef CGAL::SM_point_locator SM_point_locator; typedef CGAL::SNC_point_locator SNC_point_locator; + typedef CGAL::SNC_point_locator SNC_const_point_locator; typedef typename SNC_structure::Vertex_handle Vertex_handle; typedef typename SNC_structure::Halfedge_handle Halfedge_handle; + typedef typename SNC_structure::Halfedge_const_handle Halfedge_const_handle; typedef typename SNC_structure::Halffacet_handle Halffacet_handle; + typedef typename SNC_structure::Halffacet_const_handle Halffacet_const_handle; typedef typename SNC_structure::Volume_handle Volume_handle; typedef typename SNC_structure::SVertex_handle SVertex_handle; typedef typename SNC_structure::SHalfedge_handle SHalfedge_handle; @@ -144,12 +149,12 @@ class Binary_operation : public CGAL::SNC_decorator { return v01; } - Vertex_handle create_local_view_on( const Point_3& p, Halfedge_handle e) { + Vertex_handle create_local_view_on( const Point_3& p, Halfedge_const_handle e) { SNC_constructor C(*this->sncp()); return C.create_from_edge( e, p); } - Vertex_handle create_local_view_on( const Point_3& p, Halffacet_handle f) { + Vertex_handle create_local_view_on( const Point_3& p, Halffacet_const_handle f) { SNC_constructor C(*this->sncp()); return C.create_from_facet( f, p); } @@ -167,14 +172,14 @@ class Binary_operation : public CGAL::SNC_decorator { typename Selection, typename Association> class Intersection_call_back : - public SNC_point_locator::Intersection_call_back + public SNC_const_point_locator::Intersection_call_back { typedef typename SNC_decorator::Decorator_traits Decorator_traits; typedef typename Decorator_traits::Halfedge_handle Halfedge_handle; typedef typename Decorator_traits::Halffacet_handle Halffacet_handle; public: - Intersection_call_back( SNC_structure& s0, SNC_structure& s1, + Intersection_call_back( const SNC_structure& s0, const SNC_structure& s1, const Selection& _bop, SNC_structure& r, bool invert_order, Association& Ain) : snc0(s0), snc1(s1), bop(_bop), result(r), @@ -456,12 +461,10 @@ class Binary_operation : public CGAL::SNC_decorator { // CGAL_NEF_SETDTHREAD(19*509*43*131); - Intersection_call_back call_back0 - ( const_cast(snc1), const_cast(snc2), - BOP, *this->sncp(), false, A); - Intersection_call_back call_back1 - ( const_cast(snc2), const_cast(snc2), - BOP, *this->sncp(), true, A); + Intersection_call_back call_back0 + ( snc1, snc2, BOP, *this->sncp(), false, A); + Intersection_call_back call_back1 + ( snc2, snc2, BOP, *this->sncp(), true, A); #ifdef CGAL_NEF3_TIMER_INTERSECTION double split_intersection = timer_overlay.time(); @@ -503,10 +506,8 @@ class Binary_operation : public CGAL::SNC_decorator { << this->sncp()->number_of_vertices()); #else CGAL_NEF_TRACEN("intersection by fast box intersection"); - binop_intersection_test_segment_tree binop_box_intersection; - binop_box_intersection(call_back0, call_back1, - const_cast(snc1), - const_cast(snc2)); + binop_intersection_test_segment_tree binop_box_intersection; + binop_box_intersection(call_back0, call_back1, snc1, snc2); #endif #ifdef CGAL_NEF3_TIMER_INTERSECTION diff --git a/Nef_3/include/CGAL/Nef_3/Halfedge.h b/Nef_3/include/CGAL/Nef_3/Halfedge.h index b0c21962585..b4fc7065740 100644 --- a/Nef_3/include/CGAL/Nef_3/Halfedge.h +++ b/Nef_3/include/CGAL/Nef_3/Halfedge.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h index 05aabb0edd2..b1eb8d6b9ee 100644 --- a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h +++ b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h @@ -24,6 +24,7 @@ #include #include +#include namespace CGAL { diff --git a/Nef_3/include/CGAL/Nef_3/K3_tree.h b/Nef_3/include/CGAL/Nef_3/K3_tree.h index e147621b163..81eb55e4c4a 100644 --- a/Nef_3/include/CGAL/Nef_3/K3_tree.h +++ b/Nef_3/include/CGAL/Nef_3/K3_tree.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/Nef_3/include/CGAL/Nef_3/Mark_bounded_volumes.h b/Nef_3/include/CGAL/Nef_3/Mark_bounded_volumes.h index f5af77cf1d5..0ce560af241 100644 --- a/Nef_3/include/CGAL/Nef_3/Mark_bounded_volumes.h +++ b/Nef_3/include/CGAL/Nef_3/Mark_bounded_volumes.h @@ -15,8 +15,8 @@ #include - -#include +#include +#include namespace CGAL { diff --git a/Nef_3/include/CGAL/Nef_3/Nef_box.h b/Nef_3/include/CGAL/Nef_3/Nef_box.h index 03a3a883ba8..c05d1e6c9ea 100644 --- a/Nef_3/include/CGAL/Nef_3/Nef_box.h +++ b/Nef_3/include/CGAL/Nef_3/Nef_box.h @@ -16,7 +16,11 @@ #include #include +#include +#include #include +#include +#include namespace CGAL { diff --git a/Nef_3/include/CGAL/Nef_3/SHalfedge.h b/Nef_3/include/CGAL/Nef_3/SHalfedge.h index 31694604135..19339312f20 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfedge.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfedge.h @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/Nef_3/include/CGAL/Nef_3/SHalfloop.h b/Nef_3/include/CGAL/Nef_3/SHalfloop.h index 59c449c150f..c611bfeb85d 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfloop.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfloop.h @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/Nef_3/include/CGAL/Nef_3/SNC_constructor.h b/Nef_3/include/CGAL/Nef_3/SNC_constructor.h index c79d68de6d5..f0c67661879 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_constructor.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_constructor.h @@ -24,12 +24,13 @@ #include #include #include -#include +#include #include #include +#include #include +#include #include -#include #ifdef SM_VISUALIZOR #include #endif // SM_VISUALIZOR diff --git a/Nef_3/include/CGAL/Nef_3/SNC_external_structure.h b/Nef_3/include/CGAL/Nef_3/SNC_external_structure.h index 038843e9fa1..336981c8385 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_external_structure.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_external_structure.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -40,77 +40,6 @@ namespace CGAL { -struct int_lt { - bool operator()(const int& i1, const int& i2) const { return i1 -struct Halfedge_key_lt4 { - - bool operator()(const Edge_handle& e1, const Edge_handle& e2) const { - if(CGAL::sign(e1->point().x()) != 0) { - if(e1->source() != e2->source()) - return CGAL::compare_x(e1->source()->point(), e2->source()->point()) < 0; - else - return e1->point().x() < 0; - } - if(CGAL::sign(e1->point().y()) != 0) { - if(e1->source() != e2->source()) - return CGAL::compare_y(e1->source()->point(), e2->source()->point()) < 0; - else - return e1->point().y() < 0; - } - if(e1->source() != e2->source()) - return CGAL::compare_z(e1->source()->point(), e2->source()->point()) < 0; - return e1->point().z() < 0; - } -}; - -template -struct Halfedge_key_lt3 { - - bool operator()(const Edge_handle& e1, const Edge_handle& e2) const { - if(e1->source() != e2->source()) - return CGAL::lexicographically_xyz_smaller(e1->source()->point(), e2->source()->point()); - if(CGAL::sign(e1->point().x()) != 0) - return e1->point().x() < 0; - if(CGAL::sign(e1->point().y()) != 0) - return e1->point().y() < 0; - return e1->point().z() < 0; - } -}; - -template -struct Halfedge_key { - typedef Halfedge_key Self; - Point p; int i; Edge e; - Halfedge_key(Point pi, int ii, Edge ei) : - p(pi), i(ii), e(ei) {} - Halfedge_key(const Self& k) : p(k.p), i(k.i), e(k.e) {} - Self& operator=(const Self& k) { p=k.p; i=k.i; e=k.e; return *this; } - bool operator==(const Self& k) const { return p==k.p && i==k.i; } - bool operator!=(const Self& k) const { return !operator==(k); } -}; - -template -struct Halfedge_key_lt { - typedef Halfedge_key Key; - typedef typename Point::R R; - typedef typename R::Vector_3 Vector; - typedef typename R::Direction_3 Direction; - bool operator()( const Key& k1, const Key& k2) const { - if( k1.e->source() == k2.e->source()) - return (k1.i < k2.i); - Direction l(k1.e->vector()); - if( k1.i < 0) l = -l; - return (Direction( k2.p - k1.p) == l); - } -}; - -template -std::ostream& operator<<(std::ostream& os, - const Halfedge_key& k ) -{ os << k.p << " " << k.i; return os; } - template int sign_of(const CGAL::Plane_3& h) { if ( h.c() != 0 ) return CGAL_NTS sign(h.c()); diff --git a/Nef_3/include/CGAL/Nef_3/SNC_halfedge_key.h b/Nef_3/include/CGAL/Nef_3/SNC_halfedge_key.h new file mode 100644 index 00000000000..4c2738e63f8 --- /dev/null +++ b/Nef_3/include/CGAL/Nef_3/SNC_halfedge_key.h @@ -0,0 +1,95 @@ +// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Peter Hachenberger + +#ifndef CGAL_SNC_HALFEDGE_KEY_H +#define CGAL_SNC_HALFEDGE_KEY_H + +#include + +#include + +namespace CGAL { + +struct int_lt { + bool operator()(const int& i1, const int& i2) const { return i1 +struct Halfedge_key_lt4 { + + bool operator()(const Edge_handle& e1, const Edge_handle& e2) const { + if(CGAL::sign(e1->point().x()) != 0) { + if(e1->source() != e2->source()) + return CGAL::compare_x(e1->source()->point(), e2->source()->point()) < 0; + else + return e1->point().x() < 0; + } + if(CGAL::sign(e1->point().y()) != 0) { + if(e1->source() != e2->source()) + return CGAL::compare_y(e1->source()->point(), e2->source()->point()) < 0; + else + return e1->point().y() < 0; + } + if(e1->source() != e2->source()) + return CGAL::compare_z(e1->source()->point(), e2->source()->point()) < 0; + return e1->point().z() < 0; + } +}; + +template +struct Halfedge_key_lt3 { + + bool operator()(const Edge_handle& e1, const Edge_handle& e2) const { + if(e1->source() != e2->source()) + return CGAL::lexicographically_xyz_smaller(e1->source()->point(), e2->source()->point()); + if(CGAL::sign(e1->point().x()) != 0) + return e1->point().x() < 0; + if(CGAL::sign(e1->point().y()) != 0) + return e1->point().y() < 0; + return e1->point().z() < 0; + } +}; + +template +struct Halfedge_key { + typedef Halfedge_key Self; + Point p; int i; Edge e; + Halfedge_key(Point pi, int ii, Edge ei) : + p(pi), i(ii), e(ei) {} + Halfedge_key(const Self& k) : p(k.p), i(k.i), e(k.e) {} + Self& operator=(const Self& k) { p=k.p; i=k.i; e=k.e; return *this; } + bool operator==(const Self& k) const { return p==k.p && i==k.i; } + bool operator!=(const Self& k) const { return !operator==(k); } +}; + +template +struct Halfedge_key_lt { + typedef Halfedge_key Key; + typedef typename Point::R R; + typedef typename R::Vector_3 Vector; + typedef typename R::Direction_3 Direction; + bool operator()( const Key& k1, const Key& k2) const { + if( k1.e->source() == k2.e->source()) + return (k1.i < k2.i); + Direction l(k1.e->vector()); + if( k1.i < 0) l = -l; + return (Direction( k2.p - k1.p) == l); + } +}; + +template +std::ostream& operator<<(std::ostream& os, + const Halfedge_key& k ) +{ os << k.p << " " << k.i; return os; } + +} +#endif //CGAL_SNC_HALFEDGE_KEY_H diff --git a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h index aab28de6795..9aa445f38a1 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/Nef_3/include/CGAL/Nef_3/SNC_sphere_map.h b/Nef_3/include/CGAL/Nef_3/SNC_sphere_map.h index dbdb461db60..0b84b289122 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_sphere_map.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_sphere_map.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #undef CGAL_NEF_DEBUG diff --git a/Nef_3/include/CGAL/Nef_3/SNC_structure.h b/Nef_3/include/CGAL/Nef_3/SNC_structure.h index c6dccf530a3..27a3c5c414d 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_structure.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_structure.h @@ -56,6 +56,7 @@ void merge_sets( Object o1, Object o2, Hash_map& hash, Union_find& uf) { template class SNC_sphere_map; template class SM_decorator; template class SNC_decorator; +template class SNC_io_parser; /*{\Manpage {SNC_structure}{Items}{Selective Nef Complex}{C}}*/ diff --git a/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h b/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h index 03773258a68..b64fe1e99d2 100644 --- a/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h +++ b/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h @@ -17,9 +17,8 @@ #include #include +#include #include -#include -#include namespace CGAL { @@ -41,21 +40,6 @@ struct binop_intersection_test_segment_tree { struct Bop_edge0_face1_callback { Callback &cb; - struct Pair_hash_function { - typedef std::size_t result_type; - - template - std::size_t - operator() (const H& h) const { - return - std::size_t(&*(h.first)) / sizeof - (typename std::iterator_traits::value_type) - + - std::size_t(&*(h.second)) / sizeof - (typename std::iterator_traits::value_type); - } - }; - Bop_edge0_face1_callback(Callback &cb) : cb(cb) {} @@ -76,7 +60,6 @@ struct binop_intersection_test_segment_tree { } }; - template struct Bop_edge1_face0_callback { Callback &cb; @@ -126,55 +109,40 @@ struct binop_intersection_test_segment_tree { template void operator()(Callback& cb0, Callback& cb1, - SNC_structure& sncp, - SNC_structure& snc1i) + const SNC_structure& snc0, + const SNC_structure& snc1) { Halfedge_iterator e0, e1; Halffacet_iterator f0, f1; - std::vector a, b; + std::vector e0boxes, e1boxes, f0boxes, f1boxes; + + e0boxes.reserve(snc0.number_of_halfedges()); + e1boxes.reserve(snc1.number_of_halfedges()); + f0boxes.reserve(snc0.number_of_halffacets()); + f1boxes.reserve(snc1.number_of_halffacets()); + + CGAL_forall_edges( e0, snc0) e0boxes.push_back( Nef_box( e0 ) ); + CGAL_forall_edges( e1, snc1) e1boxes.push_back( Nef_box( e1 ) ); + CGAL_forall_facets( f0, snc0) f0boxes.push_back( Nef_box( f0 ) ); + CGAL_forall_facets( f1, snc1) f1boxes.push_back( Nef_box( f1 ) ); CGAL_NEF_TRACEN("start edge0 edge1"); Bop_edge0_edge1_callback callback_edge0_edge1( cb0 ); - CGAL_forall_edges( e0, sncp) a.push_back( Nef_box( e0 ) ); - CGAL_forall_edges( e1, snc1i) b.push_back( Nef_box( e1 ) ); -#ifdef CGAL_NEF3_BOX_INTERSECTION_CUTOFF - box_intersection_d( a.begin(), a.end(), b.begin(), b.end(), - callback_edge0_edge1, - CGAL_NEF3_BOX_INTERSECTION_CUTOFF,); -#else - box_intersection_d( a.begin(), a.end(), b.begin(), b.end(), + box_intersection_d( e0boxes.begin(), e0boxes.end(), + e1boxes.begin(), e1boxes.end(), callback_edge0_edge1); -#endif - a.clear(); - b.clear(); CGAL_NEF_TRACEN("start edge0 face1"); Bop_edge0_face1_callback callback_edge0_face1( cb0 ); - CGAL_forall_edges( e0, sncp ) a.push_back( Nef_box( e0 ) ); - CGAL_forall_facets( f1, snc1i) b.push_back( Nef_box( f1 ) ); -#ifdef CGAL_NEF3_BOX_INTERSECTION_CUTOFF - box_intersection_d( a.begin(), a.end(), b.begin(), b.end(), - callback_edge0_face1, - CGAL_NEF3_BOX_INTERSECTION_CUTOFF); -#else - box_intersection_d( a.begin(), a.end(), b.begin(), b.end(), + box_intersection_d( e0boxes.begin(), e0boxes.end(), + f1boxes.begin(), f1boxes.end(), callback_edge0_face1); -#endif - a.clear(); - b.clear(); CGAL_NEF_TRACEN("start edge1 face0"); Bop_edge1_face0_callback callback_edge1_face0( cb1 ); - CGAL_forall_edges( e1, snc1i) a.push_back( Nef_box( e1 ) ); - CGAL_forall_facets( f0, sncp ) b.push_back( Nef_box( f0 ) ); -#ifdef CGAL_NEF3_BOX_INTERSECTION_CUTOFF - box_intersection_d( a.begin(), a.end(), b.begin(), b.end(), - callback_edge1_face0, - CGAL_NEF3_BOX_INTERSECTION_CUTOFF); -#else - box_intersection_d( a.begin(), a.end(), b.begin(), b.end(), + box_intersection_d( e1boxes.begin(), e1boxes.end(), + f0boxes.begin(), f0boxes.end(), callback_edge1_face0); -#endif } }; diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index c0076cfbca5..a20a6643f50 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -19,10 +19,13 @@ #include - +#include #include #include #include +#include +#include +#include #include #undef CGAL_NEF_DEBUG diff --git a/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h index 1b7426fee5a..750fcf86ffe 100644 --- a/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h @@ -28,10 +28,7 @@ #include // Nef polyhedra -#include -#include -#include -#include +#include namespace CGAL { diff --git a/Optimal_bounding_box/doc/Optimal_bounding_box/Doxyfile.in b/Optimal_bounding_box/doc/Optimal_bounding_box/Doxyfile.in index 660c20cc18a..daea5f5aca5 100644 --- a/Optimal_bounding_box/doc/Optimal_bounding_box/Doxyfile.in +++ b/Optimal_bounding_box/doc/Optimal_bounding_box/Doxyfile.in @@ -5,7 +5,6 @@ EXTRACT_ALL = false HIDE_UNDOC_CLASSES = true WARN_IF_UNDOCUMENTED = true -EXCLUDE = ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Optimal_bounding_box/internal EXCLUDE_SYMBOLS += experimental HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/aabb_vs_obb.jpg \ diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp index 54065018429..d970d7410a7 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/render.cpp @@ -172,9 +172,9 @@ void R_s_k_2::draw_edge_footpoints(const Triangulation& mesh, Sample_vector::const_iterator it; for (it = samples.begin(); it != samples.end(); ++it) { - Sample_* sample = *it; - Point p = sample->point(); - FT m = 0.5*(1.0 - sample->mass()); + const Sample_& sample = this->m_samples[* it]; + Point p = sample.point(); + FT m = 0.5*(1.0 - sample.mass()); Point q; if (mesh.get_plan(edge) == 0) @@ -188,7 +188,7 @@ void R_s_k_2::draw_edge_footpoints(const Triangulation& mesh, else { viewer->glColor3f(red + m, green + m, blue + m); - FT t = sample->coordinate(); + FT t = sample.coordinate(); q = CGAL::ORIGIN + (1.0 - t)*(a - CGAL::ORIGIN) + t*(b - CGAL::ORIGIN); } draw_segment(p, q); @@ -395,8 +395,8 @@ void R_s_k_2::draw_bins_plan0(const Edge& edge) Sample_vector_const_iterator it; for (it = samples.begin(); it != samples.end(); ++it) { - Sample_* sample = *it; - const Point& ps = sample->point(); + const Sample_& sample = this->m_samples[* it]; + const Point& ps = sample.point(); Point q = pa; FT Da = CGAL::squared_distance(ps, pa); @@ -422,8 +422,8 @@ void R_s_k_2::draw_bins_plan1(const Edge& edge) PSample psample = queue.top(); queue.pop(); - const FT m = psample.sample()->mass(); - const Point& ps = psample.sample()->point(); + const FT m = this->m_samples[psample.sample()].mass(); + const Point& ps = this->m_samples[psample.sample()].point(); FT bin = m/M; FT alpha = start + 0.5*bin; @@ -510,7 +510,7 @@ void R_s_k_2::draw_one_ring(const float point_size, const float line_width, cons bool ok = locate_edge(query, edge); if (!ok) return; - Triangulation copy; + Triangulation copy(this->m_samples); Edge copy_edge = copy_star(edge, copy); draw_mesh_one_ring(point_size, line_width, copy, copy_edge); } @@ -549,7 +549,7 @@ void R_s_k_2::draw_blocking_edges(const float point_size, const float line_width bool ok = locate_edge(query, edge); if (!ok) return; - Triangulation copy; + Triangulation copy(this->m_samples); Edge copy_edge = copy_star(edge, copy); draw_mesh_blocking_edges(point_size, line_width, copy, copy_edge); } @@ -589,7 +589,7 @@ void R_s_k_2::draw_collapsible_edge(const float point_size, bool ok = locate_edge(query, edge); if (!ok) return; - Triangulation copy; + Triangulation copy(this->m_samples); Edge copy_edge = copy_star(edge, copy); Vertex_handle copy_src = copy.source_vertex(copy_edge); @@ -611,7 +611,7 @@ void R_s_k_2::draw_cost_stencil(const float point_size, bool ok = locate_edge(query, edge); if (!ok) return; - Triangulation copy; + Triangulation copy(this->m_samples); Edge copy_edge = copy_star(edge, copy); Vertex_handle copy_src = copy.source_vertex(copy_edge); @@ -708,7 +708,7 @@ void R_s_k_2::draw_push_queue_stencil(const float point_size, it++; } - Triangulation copy; + Triangulation copy(this->m_samples); Edge_vector copy_hull; Edge_vector copy_stencil; Edge copy_edge = copy_star(edge, copy); diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h index c7f14a626da..fde1549a865 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h @@ -74,8 +74,8 @@ public: typedef R_s_2::Edge_vector Edge_vector; typedef R_s_2::Sample_ Sample_; - typedef R_s_2::Sample_vector Sample_vector; - typedef R_s_2::Sample_vector_const_iterator Sample_vector_const_iterator; + typedef std::vector Sample_vector; + typedef Sample_vector::const_iterator Sample_vector_const_iterator; typedef R_s_2::PSample PSample; typedef R_s_2::SQueue SQueue; @@ -452,7 +452,7 @@ public: for (std::vector::iterator it = m_samples.begin(); it != m_samples.end(); ++it) { Sample_& s = *it; - samples.push_back(&s); + samples.push_back(s); } if (filename.contains(".xy", Qt::CaseInsensitive)) { @@ -469,8 +469,8 @@ public: std::ofstream ofs(qPrintable(filename)); for (Sample_vector_const_iterator it = samples.begin(); it != samples.end(); ++it) { - Sample_* sample = *it; - ofs << sample->point() << std::endl; + const Sample_& sample = *it; + ofs << sample.point() << std::endl; } ofs.close(); } @@ -505,12 +505,12 @@ public: Sample_vector_const_iterator it; for (it = vertices.begin(); it != vertices.end(); it++) { vertices_mass_list.push_back( - std::make_pair((*it)->point(), (*it)->mass())); + std::make_pair((*it).point(), (*it).mass())); } PointMassList samples_mass_list; for (it = samples.begin(); it != samples.end(); it++) { samples_mass_list.push_back( - std::make_pair((*it)->point(), (*it)->mass())); + std::make_pair((*it).point(), (*it).mass())); } Point_property_map point_pmap; @@ -551,10 +551,10 @@ public: for (it = m_samples.begin(); it != m_samples.end(); ++it) { Sample_& s = *it; - samples.push_back(&s); + samples.push_back(s); FT rv = random.get_double(0.0, 1.0); if (rv <= percentage) - vertices.push_back(&s); + vertices.push_back(s); } } diff --git a/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp index cef2ecc34b0..a9f49e12d7b 100644 --- a/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp +++ b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp @@ -16,6 +16,7 @@ typedef CGAL::Optimal_transportation_reconstruction_2 Otr; int main () { + CGAL::get_default_random() = CGAL::Random(1671586136); // Generate a set of random points on the boundary of a square. std::vector points; CGAL::Random_points_on_square_2 point_generator(1.); diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Cost.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Cost.h index 937de05c73a..0c60d82e830 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Cost.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Cost.h @@ -50,13 +50,13 @@ public: const FT total_weight() const { return m_total_weight; } - template - void set_total_weight(const SampleContainer& samples) + template + void set_total_weight(const Samples& m_samples, const SampleContainer& samples) { m_total_weight = (FT)0; for (typename SampleContainer::const_iterator it = samples.begin(); it != samples.end(); ++ it) - m_total_weight += (*it)->mass(); + m_total_weight += m_samples[*it].mass(); } FT finalize(const FT alpha = FT(0.5)) const diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_face_base_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_face_base_2.h index 6903891e6a4..39c994d671d 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_face_base_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_face_base_2.h @@ -16,7 +16,6 @@ #include -#include #include #include @@ -51,7 +50,7 @@ public: typedef typename Traits_::FT FT; typedef OTR_2::Cost Cost_; typedef OTR_2::Sample Sample_; - typedef std::vector Sample_vector; + typedef std::vector Sample_vector; private: Sample_vector m_samples[3]; @@ -176,7 +175,7 @@ public: const Sample_vector& samples(int edge) const { return m_samples[edge]; } Sample_vector& samples(int edge) { return m_samples[edge]; } - void add_sample(int edge, Sample_* sample) + void add_sample(int edge, int sample) { m_samples[edge].push_back(sample); } diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h index f952c9232e8..16fe600bb34 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h @@ -110,7 +110,7 @@ public: typedef OTR_2::Cost Cost_; typedef OTR_2::Sample Sample_; - typedef std::vector Sample_vector; + typedef std::vector Sample_vector; typedef typename Sample_vector::const_iterator Sample_vector_const_iterator; typedef OTR_2::Sample_with_priority PSample; @@ -135,12 +135,13 @@ public: > > MultiIndex; + std::vector& m_samples; FT m_factor; // ghost vs solid mutable Random rng; public: - Reconstruction_triangulation_2(Traits_ traits = Traits_()) - : Base(traits), m_factor(1.) + Reconstruction_triangulation_2(std::vector& samples, Traits_ traits = Traits_()) + : Base(traits), m_samples(samples), m_factor(1.) { } @@ -360,11 +361,11 @@ public: if (cleanup) face->clean_all_samples(); } - Sample_* sample = vertex->sample(); - if (sample) + int sample = vertex->sample(); + if (sample != -1) samples.push_back(sample); if (cleanup) - vertex->set_sample(nullptr); + vertex->set_sample(-1); } void collect_all_samples(Sample_vector& samples) const { @@ -391,7 +392,7 @@ public: } for (Finite_vertices_iterator vi = Base::finite_vertices_begin(); vi != Base::finite_vertices_end(); ++vi) { - vi->set_sample(nullptr); + vi->set_sample(-1); } } @@ -465,15 +466,15 @@ public: typename Sample_vector::const_iterator it; const Sample_vector& samples0 = edge.first->samples(edge.second); for (it = samples0.begin(); it != samples0.end(); ++it) { - Sample_* sample = *it; - mass += sample->mass(); + const Sample_ & sample = m_samples[* it]; + mass += sample.mass(); } Edge twin = twin_edge(edge); const Sample_vector& samples1 = twin.first->samples(twin.second); for (it = samples1.begin(); it != samples1.end(); ++it) { - Sample_* sample = *it; - mass += sample->mass(); + const Sample_& sample = m_samples[* it]; + mass += sample.mass(); } set_mass(edge, mass); @@ -511,15 +512,15 @@ public: typename Sample_vector::const_iterator it; const Sample_vector& samples0 = edge.first->samples(edge.second); for (it = samples0.begin(); it != samples0.end(); ++it) { - Sample_* sample = *it; - squeue.push(PSample(sample, sample->coordinate())); + const Sample_& sample = m_samples[* it]; + squeue.push(PSample(*it, sample.coordinate())); } Edge twin = twin_edge(edge); const Sample_vector& samples1 = twin.first->samples(twin.second); for (it = samples1.begin(); it != samples1.end(); ++it) { - Sample_* sample = *it; - squeue.push(PSample(sample, 1.0 - sample->coordinate())); + const Sample_& sample = m_samples[* it]; + squeue.push(PSample(*it, 1.0 - sample.coordinate())); } } @@ -537,13 +538,13 @@ public: PSample psample = squeue.top(); squeue.pop(); - FT mass = psample.sample()->mass(); + FT mass = m_samples[psample.sample()].mass(); FT coord = psample.priority() * L; FT bin = mass * coef; FT center = start + FT(0.5) * bin; FT pos = coord - center; - FT norm2 = psample.sample()->distance2(); + FT norm2 = m_samples[psample.sample()].distance2(); FT tang2 = bin * bin / 12 + pos * pos; sum.add(Cost_(norm2, tang2), mass); @@ -566,15 +567,15 @@ public: Cost_ sum; for (Sample_vector_const_iterator it = samples.begin(); it != samples.end(); ++it) { - Sample_* sample = *it; - FT mass = sample->mass(); - const Point& query = sample->point(); + const Sample_& sample = m_samples[* it]; + FT mass = sample.mass(); + const Point& query = sample.point(); FT Ds = geom_traits().compute_squared_distance_2_object()(query, ps); FT Dt = geom_traits().compute_squared_distance_2_object()(query, pt); FT dist2 = ((std::min))(Ds, Dt); - FT norm2 = sample->distance2(); + FT norm2 = sample.distance2(); FT tang2 = dist2 - norm2; sum.add(Cost_(norm2, tang2), mass); @@ -589,7 +590,7 @@ public: template // value_type = Sample_* void assign_samples(Iterator begin, Iterator end) { for (Iterator it = begin; it != end; ++it) { - Sample_* sample = *it; + int sample = *it; assign_sample(sample); } } @@ -597,13 +598,13 @@ public: template // value_type = Sample_* void assign_samples_brute_force(Iterator begin, Iterator end) { for (Iterator it = begin; it != end; ++it) { - Sample_* sample = *it; + int sample = *it; assign_sample_brute_force(sample); } } - bool assign_sample(Sample_* sample) { - const Point& point = sample->point(); + bool assign_sample(int sample) { + const Point& point = m_samples[sample].point(); Face_handle face = Base::locate(point); if (face == Face_handle() || Base::is_infinite(face)) { @@ -622,8 +623,9 @@ public: return true; } - bool assign_sample_brute_force(Sample_* sample) { - const Point& point = sample->point(); + bool assign_sample_brute_force(int sample_index) { + const Sample_& sample = m_samples[sample_index]; + const Point& point = sample.point(); Face_handle nearest_face = Face_handle(); for (Finite_faces_iterator fi = Base::finite_faces_begin(); fi != Base::finite_faces_end(); ++fi) { @@ -641,12 +643,12 @@ public: Vertex_handle vertex = find_nearest_vertex(point, nearest_face); if (vertex != Vertex_handle()) { - assign_sample_to_vertex(sample, vertex); + assign_sample_to_vertex(sample_index, vertex); return true; } Edge edge = find_nearest_edge(point, nearest_face); - assign_sample_to_edge(sample, edge); + assign_sample_to_edge(sample_index, edge); return true; } @@ -688,23 +690,24 @@ public: return nearest; } - void assign_sample_to_vertex(Sample_* sample, Vertex_handle vertex) const { + void assign_sample_to_vertex(int sample_index, Vertex_handle vertex) const { /*if (vertex->sample()) { std::cout << "assign to vertex: vertex already has sample" << std::endl; }*/ - - sample->distance2() = FT(0); - sample->coordinate() = FT(0); - vertex->set_sample(sample); + Sample_& sample = m_samples[sample_index]; + sample.distance2() = FT(0); + sample.coordinate() = FT(0); + vertex->set_sample(sample_index); } - void assign_sample_to_edge(Sample_* sample, const Edge& edge) const { + void assign_sample_to_edge(int sample_index, const Edge& edge) const { + Sample_& sample = m_samples[sample_index]; Segment segment = get_segment(edge); - const Point& query = sample->point(); - sample->distance2() = compute_distance2(query, segment); - sample->coordinate() = compute_coordinate(query, segment); - edge.first->add_sample(edge.second, sample); + const Point& query = sample.point(); + sample.distance2() = compute_distance2(query, segment); + sample.coordinate() = compute_coordinate(query, segment); + edge.first->add_sample(edge.second, sample_index); } FT compute_distance2(const Point& query, const Segment& segment) const { diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h index 6155f65e5fe..7df7b10b047 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h @@ -37,7 +37,7 @@ class Reconstruction_vertex_base_2 : public Vb public: typedef Vb Base; typedef typename Traits_::FT FT; - typedef OTR_2::Sample Sample_; + typedef OTR_2::Sample Sample_; typedef typename Traits_::Point_2 Point; typedef typename Base::Face_handle Face_handle; @@ -50,7 +50,7 @@ public: private: int m_id; bool m_pinned; - Sample_* m_sample; + int m_sample; Point m_relocated; FT m_relevance; @@ -60,7 +60,7 @@ public: : Base(), m_id(-1), m_pinned(false), - m_sample(nullptr), + m_sample(-1), m_relevance(0) { } @@ -69,7 +69,7 @@ public: : Base(p), m_id(-1), m_pinned(false), - m_sample(nullptr), + m_sample(-1), m_relevance(0) { } @@ -78,7 +78,7 @@ public: : Base(f), m_id(-1), m_pinned(false), - m_sample(nullptr), + m_sample(-1), m_relevance(0) { } @@ -87,7 +87,7 @@ public: : Base(p, f), m_id(-1), m_pinned(false), - m_sample(nullptr), + m_sample(-1), m_relevance(0) { } @@ -103,13 +103,13 @@ public: FT relevance() const { return m_relevance; } void set_relevance(FT relevance) { m_relevance = relevance; } - Sample_* sample() const { return m_sample; } - void set_sample(Sample_* sample) { m_sample = sample; } + int sample() const { return m_sample; } + void set_sample(int sample) { m_sample = sample; } const Point& relocated() const { return m_relocated; } Point& relocated() { return m_relocated; } - bool has_sample_assigned() const { return sample() != nullptr; } + bool has_sample_assigned() const { return sample() != -1; } }; //---------------STRUCT LESS VERTEX_HANDLE--------------------- template diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Sample.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Sample.h index 7972b69f02c..fee340a5914 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Sample.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Sample.h @@ -39,6 +39,9 @@ private: FT m_backup_coord; public: + Sample() + {} + Sample(const Point& point, const FT mass = FT(1)) : m_point(point), @@ -94,23 +97,20 @@ public: typedef typename Sample_::FT FT; private: - Sample_* m_sample; + int m_sample; FT m_priority; public: - Sample_with_priority(Sample_* sample, const FT priority = FT(0)) - { - m_sample = sample; - m_priority = priority; - } + Sample_with_priority(int sample, const FT priority = FT(0)) + : m_sample(sample), m_priority(priority) + {} Sample_with_priority(const Sample_with_priority& psample) - { - m_sample = psample.sample(); - m_priority = psample.priority(); - } + : m_sample(psample.sample()), m_priority(psample.priority()) + {} - ~Sample_with_priority() { } + ~Sample_with_priority() + {} Sample_with_priority& operator = (const Sample_with_priority& psample) { @@ -119,7 +119,7 @@ public: return *this; } - Sample_* sample() const { return m_sample; } + int sample() const { return m_sample; } const FT priority() const { return m_priority; } }; diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h index 810adde69a2..d1840743412 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h @@ -117,7 +117,6 @@ public: The Output simplex. */ typedef OTR_2::Reconstruction_triangulation_2 Triangulation; - typedef typename Triangulation::Vertex Vertex; typedef typename Triangulation::Vertex_handle Vertex_handle; typedef typename Triangulation::Vertex_iterator Vertex_iterator; @@ -159,6 +158,7 @@ public: /// @} protected: + std::vector m_samples; Triangulation m_dt; Traits const& m_traits; MultiIndex m_mindex; @@ -175,7 +175,6 @@ protected: MassPMap mass_pmap; public: - /// \name Initialization /// @{ @@ -212,7 +211,8 @@ public: unsigned int relocation = 2, int verbose = 0, Traits traits = Traits()) - : m_dt(traits), + : m_samples(), + m_dt(m_samples, traits), m_traits(m_dt.geom_traits()), m_ignore(0), m_verbose(verbose), @@ -318,8 +318,9 @@ public: /// \cond SKIP_IN_MANUAL + Optimal_transportation_reconstruction_2() - : m_traits(m_dt.geom_traits()) + : m_samples(), m_dt(m_samples), m_traits(m_dt.geom_traits()) { initialize_parameters(); } @@ -369,14 +370,18 @@ public: insert_loose_bbox(bbox); init(start, beyond); - std::vector m_samples; + m_samples.reserve(std::distance(start,beyond)); for (InputIterator it = start; it != beyond; it++) { Point point = get(point_pmap, *it); FT mass = get( mass_pmap, *it); - Sample_* s = new Sample_(point, mass); + Sample_ s(point, mass); m_samples.push_back(s); } - assign_samples(m_samples.begin(), m_samples.end()); + Sample_vector sv(m_samples.size()); + for(int i = 0; i < static_cast(sv.size()); ++i){ + sv[i] = i; + } + assign_samples(sv.begin(), sv.end()); } template @@ -398,7 +403,7 @@ public: insert_loose_bbox(bbox); init(vertices_start, vertices_beyond); - std::vector m_samples; + m_samples.reserve(std::distance(samples_start, samples_beyond)); for (InputIterator it = samples_start; it != samples_beyond; it++) { #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 Point point = get(point_pmap, it); @@ -407,10 +412,14 @@ public: Point point = get(point_pmap, *it); FT mass = get( mass_pmap, *it); #endif - Sample_* s = new Sample_(point, mass); + Sample_ s(point, mass); m_samples.push_back(s); } - assign_samples(m_samples.begin(), m_samples.end()); + Sample_vector sv(m_samples.size()); + for(int i = 0; i < static_cast(sv.size()); ++i){ + sv[i] = i; + } + assign_samples(sv.begin(), sv.end()); } @@ -422,16 +431,8 @@ public: return m_traits.construct_vector_2_object()(dx, dy); } - void clear() { - Sample_vector samples; - m_dt.collect_all_samples(samples); - // Deallocate samples - for (Sample_vector_const_iterator s_it = samples.begin(); - s_it != samples.end(); ++s_it) - { - delete *s_it; - } - } + void clear() + {} // INIT // @@ -494,7 +495,7 @@ public: m_dt.cleanup_assignments(); } - template // value_type = Sample_* + template // value_type = int void assign_samples(Iterator begin, Iterator end) { CGAL::Real_timer timer; if (m_verbose > 0) @@ -587,7 +588,7 @@ public: << s->id() << "->" << t->id() << ") ... " << std::endl; } - Triangulation copy; + Triangulation copy(m_samples); Edge copy_edge = copy_star(edge, copy); Vertex_handle copy_source = copy.source_vertex(copy_edge); @@ -632,7 +633,7 @@ public: copy.assign_samples_brute_force(samples.begin(), samples.end()); copy.reset_all_costs(); cost = copy.compute_total_cost(); - cost.set_total_weight (samples); + cost.set_total_weight (m_samples, samples); restore_samples(samples.begin(), samples.end()); if (m_verbose > 1) { @@ -643,18 +644,18 @@ public: } template // value_type = Sample_* - void backup_samples(Iterator begin, Iterator end) const { + void backup_samples(Iterator begin, Iterator end) { for (Iterator it = begin; it != end; ++it) { - Sample_* sample = *it; - sample->backup(); + Sample_& sample = m_samples[* it]; + sample.backup(); } } template // value_type = Sample_* - void restore_samples(Iterator begin, Iterator end) const { + void restore_samples(Iterator begin, Iterator end) { for (Iterator it = begin; it != end; ++it) { - Sample_* sample = *it; - sample->restore(); + Sample_& sample = m_samples[* it]; + sample.restore(); } } @@ -1089,7 +1090,7 @@ public: m_dt.collect_samples_from_edge(twin, samples); copy_twin.first->samples(copy_twin.second) = samples; } - copy_vertex->set_sample(nullptr); + copy_vertex->set_sample(-1); } Edge get_copy_edge( @@ -1230,10 +1231,10 @@ public: void compute_relocation_for_vertex( Vertex_handle vertex, FT& coef, Vector& rhs) const { - Sample_* sample = vertex->sample(); - if (sample) { - const FT m = sample->mass(); - const Point& ps = sample->point(); + if (vertex->sample() != -1) { + const Sample_& sample = m_samples[vertex->sample()]; + const FT m = sample.mass(); + const Point& ps = sample.point(); rhs = m_traits.construct_sum_of_vectors_2_object()(rhs, m_traits.construct_scaled_vector_2_object()( m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps), m)); @@ -1253,9 +1254,9 @@ public: Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0)); Sample_vector_const_iterator it; for (it = samples.begin(); it != samples.end(); ++it) { - Sample_* sample = *it; - const FT m = sample->mass(); - const Point& ps = sample->point(); + const Sample_& sample = m_samples[* it]; + const FT m = sample.mass(); + const Point& ps = sample.point(); FT Da = m_traits.compute_squared_distance_2_object()(ps, pa); FT Db = m_traits.compute_squared_distance_2_object()(ps, pb); @@ -1281,9 +1282,9 @@ public: Sample_vector_const_iterator it; for (it = samples.begin(); it != samples.end(); ++it) { - Sample_* sample = *it; - const FT m = sample->mass(); - const Point& ps = sample->point(); + const Sample_& sample = m_samples[* it]; + const FT m = sample.mass(); + const Point& ps = sample.point(); FT Da = m_traits.compute_squared_distance_2_object()(ps, pa); FT Db = m_traits.compute_squared_distance_2_object()(ps, pb); @@ -1311,8 +1312,8 @@ public: PSample psample = queue.top(); queue.pop(); - const FT m = psample.sample()->mass(); - const Point& ps = psample.sample()->point(); + const FT m = this->m_samples[psample.sample()].mass(); + const Point& ps = this->m_samples[psample.sample()].point(); // normal + tangnetial const FT coord = psample.priority(); @@ -1357,8 +1358,8 @@ public: PSample psample = queue.top(); queue.pop(); - const FT m = psample.sample()->mass(); - const Point& ps = psample.sample()->point(); + const FT m = m_samples[psample.sample()].mass(); + const Point& ps = m_samples[psample.sample()].point(); const FT coord = psample.priority(); const FT one_minus_coord = 1.0 - coord; diff --git a/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/test_reconstruction_until.cpp b/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/test_reconstruction_until.cpp index 841e782301c..39e3d45d391 100644 --- a/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/test_reconstruction_until.cpp +++ b/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/test_reconstruction_until.cpp @@ -17,7 +17,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point; typedef K::FT FT; -typedef K::Segment_2 Segment; +typedef K::Segment_2 Segment; int main () { @@ -37,8 +37,14 @@ int main () std::back_inserter(isolated_points), std::back_inserter(edges)); std::cout << "Isolated_points: " << isolated_points.size() << std::endl; - std::cout << "Edges: " << edges.size() << std::endl; + for(Point p : isolated_points){ + std::cout << p << std::endl; + } + std::cout << "Edges: " << edges.size() << std::endl; + for(Segment s : edges){ + std::cout << s << std::endl; + } assert(isolated_points.size() == 0); assert(edges.size() == 8); } diff --git a/Orthtree/test/Orthtree/test_octree_grade.cpp b/Orthtree/test/Orthtree/test_octree_grade.cpp index 76421fd474f..a0a574bd9ef 100644 --- a/Orthtree/test/Orthtree/test_octree_grade.cpp +++ b/Orthtree/test/Orthtree/test_octree_grade.cpp @@ -56,7 +56,6 @@ void test(std::size_t dataset_size) { // Count the jumps in depth auto jumps = count_jumps(octree); std::cout << "un-graded octree has " << jumps << " jumps" << std::endl; - assert(jumps > 0); // Grade the octree octree.grade(); diff --git a/Polygon/include/CGAL/Polygon_2.h b/Polygon/include/CGAL/Polygon_2.h index e4305cccfed..b2b7ab7340a 100644 --- a/Polygon/include/CGAL/Polygon_2.h +++ b/Polygon/include/CGAL/Polygon_2.h @@ -242,8 +242,11 @@ class Polygon_2 { /// Erases the vertex pointed to by `i`. Vertex_circulator erase(Vertex_circulator i) { - return Vertex_circulator(&d_container, - d_container.erase(i.mod_iterator())); + auto it = d_container.erase(i.mod_iterator()); + if(it == d_container.end()){ + it = d_container.begin(); + } + return Vertex_circulator(&d_container, it); } /// Erases the vertices in the range `[first, last)`. diff --git a/Polygon/test/Polygon/issue7228.cpp b/Polygon/test/Polygon/issue7228.cpp new file mode 100644 index 00000000000..623a8633130 --- /dev/null +++ b/Polygon/test/Polygon/issue7228.cpp @@ -0,0 +1,29 @@ +#include +#include + +#include +#include +#include + +typedef CGAL::Simple_cartesian K; +typedef K::Point_2 Point; +typedef CGAL::Polygon_2 Polygon_2; +typedef Polygon_2::Vertex_circulator Vertex_circulator; + +int main() +{ + std::array points = { Point(0,0), Point(1,0), Point(1,1), Point(0,1) }; + Polygon_2 poly(points.begin(), points.end()); + + Vertex_circulator vc = poly.vertices_circulator(); + + ++vc; + ++vc; + ++vc; + + vc = poly.erase(vc); + + assert(*vc == Point(0,0)); + + return 0; +} diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Doxyfile.in b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Doxyfile.in index fa3b8b8f1bf..52bde2b920c 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Doxyfile.in +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Doxyfile.in @@ -16,7 +16,6 @@ ALIASES += "cgalDescribePolylineType=A polyline is defined as a sequence of poin EXAMPLE_PATH += ${CGAL_Poisson_surface_reconstruction_3_EXAMPLE_DIR} -EXCLUDE = ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polygon_mesh_processing/internal EXCLUDE_SYMBOLS += experimental HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/selfintersections.jpg \ diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp index 048739c136f..159ff7cd708 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) } double target_edge_length = (argc > 2) ? std::stod(std::string(argv[2])) : 0.04; - unsigned int nb_iter = 3; + unsigned int nb_iter = (argc > 3) ? std::stoi(std::string(argv[3])) : 10; std::cout << "Split border..."; @@ -59,6 +59,8 @@ int main(int argc, char* argv[]) CGAL::parameters::number_of_iterations(nb_iter) .protect_constraints(true)); //i.e. protect border, here + CGAL::IO::write_polygon_mesh("out.off", mesh, CGAL::parameters::stream_precision(17)); + std::cout << "Remeshing done." << std::endl; return 0; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h index 0332bb1fc90..4532279b891 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h @@ -616,7 +616,12 @@ compute_vertex_normal_as_sum_of_weighted_normals(typename boost::graph_traits - -#include -#include -#include -#include - #include #ifdef CGAL_PMP_FAIR_DEBUG #include @@ -30,8 +24,14 @@ #include #include #include +#include #include +#include +#include +#include +#include + namespace CGAL { namespace Polygon_mesh_processing { @@ -49,15 +49,28 @@ class Refine_Polyhedron_3 { typedef Halfedge_around_face_circulator Halfedge_around_facet_circulator; typedef Halfedge_around_target_circulator Halfedge_around_vertex_circulator; + typedef typename CGAL::Kernel_traits::type Traits; + private: PolygonMesh& pmesh; VertexPointMap vpmap; + Traits traits = {}; - bool flippable(halfedge_descriptor h) { + bool flippable(halfedge_descriptor h) + { // this check is added so that edge flip does not break manifoldness // it might happen when there is an edge where flip_edge(h) will be placed (i.e. two edges collide after flip) vertex_descriptor v_tip_0 = target(next(h,pmesh),pmesh); vertex_descriptor v_tip_1 = target(next(opposite(h,pmesh),pmesh),pmesh); + +#ifdef CGAL_PMP_REFINE_DEBUG_PP + std::cout << "flippable() " << h << std::endl; + std::cout << "\t" << source(h, pmesh) << ": " << pmesh.point(source(h, pmesh)) << std::endl; + std::cout << "\t" << target(h, pmesh) << ": " << pmesh.point(target(h, pmesh)) << std::endl; + std::cout << "\t" << v_tip_0 << ": " << pmesh.point(v_tip_0) << std::endl; + std::cout << "\t" << v_tip_1 << ": " << pmesh.point(v_tip_1) << std::endl; +#endif + Halfedge_around_vertex_circulator v_cir(next(h,pmesh), pmesh), v_end(v_cir); do { if(target(opposite(*v_cir, pmesh),pmesh) == v_tip_1) { return false; } @@ -74,13 +87,21 @@ private: bool relax(halfedge_descriptor h) { +#ifdef CGAL_PMP_REFINE_DEBUG_PP typedef typename boost::property_traits::reference Point_3_ref; - Point_3_ref p = get(vpmap, target(h,pmesh)); - Point_3_ref q = get(vpmap, target(opposite(h,pmesh),pmesh)); + Point_3_ref p = get(vpmap, source(h,pmesh)); + Point_3_ref q = get(vpmap, target(h,pmesh)); Point_3_ref r = get(vpmap, target(next(h,pmesh),pmesh)); Point_3_ref s = get(vpmap, target(next(opposite(h,pmesh),pmesh),pmesh)); - if( (CGAL::ON_UNBOUNDED_SIDE != CGAL::side_of_bounded_sphere(p,q,r,s)) || - (CGAL::ON_UNBOUNDED_SIDE != CGAL::side_of_bounded_sphere(p,q,s,r)) ) + + std::cout << "relax() " << h << std::endl; + std::cout << "\t" << source(h, pmesh) << ": " << p << std::endl; + std::cout << "\t" << target(h, pmesh) << ": " << q << std::endl; + std::cout << "\t" << target(next(h,pmesh),pmesh) << ": " << r << std::endl; + std::cout << "\t" << target(next(opposite(h,pmesh),pmesh),pmesh) << ": " << s << std::endl; +#endif + + if(internal::should_flip(edge(h, pmesh), pmesh, vpmap, traits)) { if(flippable(h)) { Euler::flip_edge(h,pmesh); @@ -238,8 +259,7 @@ private: Halfedge_around_face_circulator circ(halfedge(fd,pmesh),pmesh), done(circ); do { vertex_descriptor v = target(*circ,pmesh); - std::pair::iterator, bool> v_insert - = scale_attribute.insert(std::make_pair(v, 0)); + auto v_insert = scale_attribute.emplace(v, 0); if(!v_insert.second) { continue; } // already calculated v_insert.first->second = average_length(v, interior_map, accept_internal_facets); } while(++circ != done); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h index 2340993b99d..ac5a340d816 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -24,6 +24,7 @@ #include #include +#include #include // needed for CGAL::exact(FT)/CGAL::exact(Lazy_exact_nt) @@ -31,6 +32,7 @@ #include #include +#include #include #include #include @@ -308,6 +310,7 @@ face_border_length(typename boost::graph_traits::halfedge_descripto * - `first`: a halfedge on the longest border. * The return type `halfedge_descriptor` is a halfedge descriptor. It is * deduced from the graph traits corresponding to the type `PolygonMesh`. + * `first` is among the halfedges reported by `extract_boundary_cycles()`. * - `second`: the length of the longest border * The return type `FT` is a number type either deduced from the `geom_traits` * \ref bgl_namedparameters "Named Parameters" if provided, @@ -318,6 +321,7 @@ face_border_length(typename boost::graph_traits::halfedge_descripto * will be performed approximately. * * @see `face_border_length()` + * @see `extract_boundary_cycles()` */ template @@ -334,28 +338,18 @@ longest_border(const PolygonMesh& pmesh, typename property_map_value::type>::Kernel::FT FT; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - std::unordered_set visited; + std::vector boundary_cycles; + extract_boundary_cycles(pmesh, std::back_inserter(boundary_cycles)); halfedge_descriptor result_halfedge = boost::graph_traits::null_halfedge(); FT result_len = 0; - for(halfedge_descriptor h : halfedges(pmesh)) + for(halfedge_descriptor h : boundary_cycles) { - if(visited.find(h)== visited.end()) - { - if(is_border(h, pmesh)) - { - FT len = 0; - for(halfedge_descriptor haf : halfedges_around_face(h, pmesh)) - { - len += edge_length(haf, pmesh, np); - visited.insert(haf); - } + FT len = face_border_length(h, pmesh, np); - if(result_len < len) - { - result_len = len; - result_halfedge = h; - } - } + if(result_len < len) + { + result_len = len; + result_halfedge = h; } } return std::make_pair(result_halfedge, result_len); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index bb7e48292a6..798499f430b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -294,7 +294,6 @@ get_best_edge_orientation(typename boost::graph_traits::edge_descr return boost::graph_traits::null_halfedge(); } -// adapted from triangulate_faces template bool should_flip(typename boost::graph_traits::edge_descriptor e, const TriangleMesh& tmesh, @@ -303,49 +302,23 @@ bool should_flip(typename boost::graph_traits::edge_descriptor e, { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename Traits::FT FT; + typedef typename Traits:: FT FT; typedef typename boost::property_traits::reference Point_ref; - typedef typename Traits::Vector_3 Vector_3; CGAL_precondition(!is_border(e, tmesh)); - halfedge_descriptor h = halfedge(e, tmesh); + typename Traits::Compute_approximate_angle_3 angle = gt.compute_approximate_angle_3_object(); - Point_ref p0 = get(vpm, target(h, tmesh)); - Point_ref p1 = get(vpm, target(next(h, tmesh), tmesh)); - Point_ref p2 = get(vpm, source(h, tmesh)); - Point_ref p3 = get(vpm, target(next(opposite(h, tmesh), tmesh), tmesh)); + const halfedge_descriptor h = halfedge(e, tmesh); - /* Chooses the diagonal that will split the quad in two triangles that maximize - * the scalar product of of the un-normalized normals of the two triangles. - * The lengths of the un-normalized normals (computed using cross-products of two vectors) - * are proportional to the area of the triangles. - * Maximize the scalar product of the two normals will avoid skinny triangles, - * and will also taken into account the cosine of the angle between the two normals. - * In particular, if the two triangles are oriented in different directions, - * the scalar product will be negative. - */ + const Point_ref p0 = get(vpm, target(h, tmesh)); + const Point_ref p1 = get(vpm, target(next(h, tmesh), tmesh)); + const Point_ref p2 = get(vpm, source(h, tmesh)); + const Point_ref p3 = get(vpm, target(next(opposite(h, tmesh), tmesh), tmesh)); -// CGAL::cross_product(p2-p1, p3-p2) * CGAL::cross_product(p0-p3, p1-p0); -// CGAL::cross_product(p1-p0, p1-p2) * CGAL::cross_product(p3-p2, p3-p0); - - const Vector_3 v01 = gt.construct_vector_3_object()(p0, p1); - const Vector_3 v12 = gt.construct_vector_3_object()(p1, p2); - const Vector_3 v23 = gt.construct_vector_3_object()(p2, p3); - const Vector_3 v30 = gt.construct_vector_3_object()(p3, p0); - - const FT p1p3 = gt.compute_scalar_product_3_object()( - gt.construct_cross_product_vector_3_object()(v12, v23), - gt.construct_cross_product_vector_3_object()(v30, v01)); - - const Vector_3 v21 = gt.construct_opposite_vector_3_object()(v12); - const Vector_3 v03 = gt.construct_opposite_vector_3_object()(v30); - - const FT p0p2 = gt.compute_scalar_product_3_object()( - gt.construct_cross_product_vector_3_object()(v01, v21), - gt.construct_cross_product_vector_3_object()(v23, v03)); - - return p0p2 <= p1p3; + const FT ap1 = angle(p0,p1,p2); + const FT ap3 = angle(p2,p3,p0); + return (ap1 + ap3 > FT(180)); } template diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h index 3f1e8bc6a68..584358ccefa 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h @@ -1941,6 +1941,7 @@ remove_self_intersections_one_step(std::set) const { return false; } @@ -2488,7 +2491,7 @@ bool remove_self_intersections(const FaceRange& face_range, internal::remove_self_intersections_one_step( faces_to_treat, working_face_range, tmesh, step, preserve_genus, treat_all_CCs, strong_dihedral_angle, weak_dihedral_angle, - containment_epsilon, projector, vpm, gt, visitor); + use_smoothing, containment_epsilon, projector, vpm, gt, visitor); #ifdef CGAL_PMP_REMOVE_SELF_INTERSECTION_DEBUG if(all_fixed && topology_issue) diff --git a/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h b/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h index f5faa7b08d7..c8a311a37ae 100644 --- a/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h +++ b/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h @@ -1032,7 +1032,7 @@ private: bool - is_two_facets_neighbouring(const unsigned int & pid, const unsigned int &i, const unsigned int &j)const + is_two_facets_neighboring(const unsigned int & pid, const unsigned int &i, const unsigned int &j)const { std::size_t facesize = halfspace[pid].size(); if (i == j) return false; @@ -1046,6 +1046,9 @@ private: if (j == 2 && i == facesize - 1) return true; return false; } + CGAL_DEPRECATED bool + is_two_facets_neighbouring(const unsigned int & pid, const unsigned int &i, const unsigned int &j)const + { return is_two_facets_neighboring(pid, i, j); } int @@ -1187,7 +1190,7 @@ private: continue; if (true /* USE_ADJACENT_INFORMATION*/ ) { - bool neib = is_two_facets_neighbouring(cindex, cutp[i], cutp[j]); + bool neib = is_two_facets_neighboring(cindex, cutp[i], cutp[j]); if (neib == false) continue; } @@ -1295,7 +1298,7 @@ private: const int &prismid, const unsigned int &faceid)const { for (unsigned int i = 0; i < halfspace[prismid].size(); i++) { - /*bool neib = is_two_facets_neighbouring(prismid, i, faceid);// this works only when the polyhedron is convex and no two neighbor facets are coplanar + /*bool neib = is_two_facets_neighboring(prismid, i, faceid);// this works only when the polyhedron is convex and no two neighbor facets are coplanar if (neib == false) continue;*/ if (i == faceid) continue; if(oriented_side(halfspace[prismid][i].eplane, ip) == ON_POSITIVE_SIDE){ @@ -1722,11 +1725,11 @@ private: idlist.emplace_back(filtered_intersection[queue[0]]);// idlist contains the id in prismid//it is fine maybe it is not really intersected coverlist[queue[0]] = 1 ;//when filtered_intersection[i] is already in the cover list, coverlist[i]=true - std::vector neighbours;//local id + std::vector neighbors;//local id std::vector list; - std::vector*> neighbour_facets; + std::vector*> neighbor_facets; std::vector> idlistorder; - std::vector neighbour_cover; + std::vector neighbor_cover; idlistorder.emplace_back(intersect_face[queue[0]]); for (unsigned int i = 0; i < queue.size(); i++) { @@ -1810,14 +1813,14 @@ private: localtree.all_intersected_primitives(bounding_boxes[jump1], std::back_inserter(list)); - neighbours.resize(list.size()); - neighbour_facets.resize(list.size()); - neighbour_cover.resize(list.size()); + neighbors.resize(list.size()); + neighbor_facets.resize(list.size()); + neighbor_cover.resize(list.size()); for (unsigned int j = 0; j < list.size(); j++) { - neighbours[j] = filtered_intersection[list[j]]; - neighbour_facets[j] = &(intersect_face[list[j]]); - if (coverlist[list[j]] == 1) neighbour_cover[j] = 1; - else neighbour_cover[j] = 0; + neighbors[j] = filtered_intersection[list[j]]; + neighbor_facets[j] = &(intersect_face[list[j]]); + if (coverlist[list[j]] == 1) neighbor_cover[j] = 1; + else neighbor_cover[j] = 0; } for (unsigned int j = 0; j < i; j++) { @@ -1864,7 +1867,7 @@ private: if (inter == 1) { - inter = Implicit_Tri_Facet_Facet_interpoint_Out_Prism_return_local_id_with_face_order_jump_over(ip, neighbours, neighbour_facets, neighbour_cover, jump1, jump2, check_id); + inter = Implicit_Tri_Facet_Facet_interpoint_Out_Prism_return_local_id_with_face_order_jump_over(ip, neighbors, neighbor_facets, neighbor_cover, jump1, jump2, check_id); if (inter == 1) { diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_compute_normals_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_compute_normals_test.cpp index f0dc91bd25e..88a70ee95c0 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_compute_normals_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_compute_normals_test.cpp @@ -98,8 +98,11 @@ void test(const Mesh& mesh, // tests on non triangular meshes are @todo if(CGAL::is_triangle(halfedge(f, mesh), mesh)) { - if(PMP::is_degenerate_triangle_face(f, mesh)) - assert(get(fnormals, f) == CGAL::NULL_VECTOR); + if (PMP::is_degenerate_triangle_face(f, mesh)) + { + if (std::is_same()) + assert(get(fnormals, f) == CGAL::NULL_VECTOR); + } else assert(get(fnormals, f) != CGAL::NULL_VECTOR); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp index 9102d733047..2767dad9338 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp @@ -173,8 +173,10 @@ void test_constructions(const G& g, // --------------------------------------------------------------------------- bar = PMP::barycentric_coordinates(p, q, r, p, K()); assert(is_equal(bar[0], FT(1)) && is_equal(bar[1], FT(0)) && is_equal(bar[2], FT(0))); + bar = PMP::barycentric_coordinates(p, q, r, q, K()); assert(is_equal(bar[0], FT(0)) && is_equal(bar[1], FT(1)) && is_equal(bar[2], FT(0))); + bar = PMP::barycentric_coordinates(p, q, r, r, K()); assert(is_equal(bar[0], FT(0)) && is_equal(bar[1], FT(0)) && is_equal(bar[2], FT(1))); @@ -217,6 +219,7 @@ void test_constructions(const G& g, loc = std::make_pair(f, CGAL::make_array(FT(1), FT(0), FT(0))); assert(PMP::is_on_vertex(loc, source(halfedge(f, g), g), g)); + dv = PMP::get_descriptor_from_location(loc, g); if(const vertex_descriptor* v = boost::get(&dv)) { } else { assert(false); } @@ -251,22 +254,23 @@ void test_random_entities(const G& g, CGAL::Random& rnd) loc = PMP::random_location_on_mesh(g, rnd); assert(loc.first != boost::graph_traits::null_face()); assert(loc.second[0] >= FT(0) && loc.second[0] <= FT(1) && - loc.second[1] >= FT(0) && loc.second[1] <= FT(1) && - loc.second[2] >= FT(0) && loc.second[2] <= FT(1)); + loc.second[1] >= FT(0) && loc.second[1] <= FT(1) && + loc.second[2] >= FT(0) && loc.second[2] <= FT(1)); loc = PMP::random_location_on_face(f, g, rnd); assert(loc.first == f); assert(loc.second[0] >= FT(0) && loc.second[0] <= FT(1) && - loc.second[1] >= FT(0) && loc.second[1] <= FT(1) && - loc.second[2] >= FT(0) && loc.second[2] <= FT(1)); + loc.second[1] >= FT(0) && loc.second[1] <= FT(1) && + loc.second[2] >= FT(0) && loc.second[2] <= FT(1)); loc = PMP::random_location_on_halfedge(h, g, rnd); assert(loc.first == face(h, g)); assert(loc.second[0] >= FT(0) && loc.second[0] <= FT(1) && - loc.second[1] >= FT(0) && loc.second[1] <= FT(1) && - loc.second[2] >= FT(0) && loc.second[2] <= FT(1)); + loc.second[1] >= FT(0) && loc.second[1] <= FT(1) && + loc.second[2] >= FT(0) && loc.second[2] <= FT(1)); int h_id = CGAL::halfedge_index_in_face(h, g); - assert(loc.second[(h_id+2)%3] == FT(0)); + + assert(loc.second[(h_id + 2) % 3] == FT(0)); } } @@ -313,8 +317,8 @@ void test_helpers(const G& g, CGAL::Random& rnd) std::vector vec; PMP::internal::incident_faces(loc, g, std::back_inserter(vec)); assert(PMP::is_on_vertex(loc, source(h, g), g) || - PMP::is_on_vertex(loc, target(h, g), g) || - vec.size() == 2); + PMP::is_on_vertex(loc, target(h, g), g) || + vec.size() == 2); } template @@ -432,9 +436,10 @@ void test_locate_in_face(const G& g, Point_reference p = get(vpm, v); loc = PMP::locate_vertex(v, g); + assert(is_equal(loc.second[CGAL::vertex_index_in_face(v, loc.first, g)], FT(1))); - assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g)+1)%3], FT(0))); - assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g)+2)%3], FT(0))); + assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g) + 1) % 3], FT(0))); + assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g) + 2) % 3], FT(0))); loc = PMP::locate_vertex(v, f, g); assert(loc.first == f); @@ -442,7 +447,7 @@ void test_locate_in_face(const G& g, loc = PMP::locate_on_halfedge(h, a, g); const int h_id = CGAL::halfedge_index_in_face(h, g); - assert(loc.first == f && is_equal(loc.second[(h_id+2)%3], FT(0))); + assert(loc.first == f && is_equal(loc.second[(h_id + 2) % 3], FT(0))); loc = PMP::locate_in_face(p, f, g, CGAL::parameters::vertex_point_map(vpm).geom_traits(K())); int v_id = CGAL::vertex_index_in_face(v, f, g); @@ -475,10 +480,11 @@ void test_locate_in_face(const G& g, neigh_loc.second[(neigh_hd_id+2)%3] = FT(0); PMP::locate_in_adjacent_face(loc, neigh_f, g); - assert(PMP::locate_in_common_face(loc, neigh_loc, g)); - assert(PMP::locate_in_common_face(loc, p, neigh_loc, g, CGAL::parameters::vertex_point_map(vpm).geom_traits(K()))); + if (std::is_same()) { + assert(PMP::locate_in_common_face(loc, p, neigh_loc, g, CGAL::parameters::vertex_point_map(vpm).geom_traits(K()))); + } assert(PMP::locate_in_common_face(loc, p, neigh_loc, g, CGAL::parameters::vertex_point_map(vpm).geom_traits(K()), 1e-7)); } } @@ -536,11 +542,10 @@ struct Locate_with_AABB_tree_Tester // 2D case // sanitize otherwise some test platforms fail PMP::internal::snap_location_to_border(loc, g, FT(1e-7)); - - assert(PMP::is_on_vertex(loc, v, g)); // might fail du to precision issues... + assert(PMP::is_on_vertex(loc, v, g)); // might fail due to precision issues... assert(is_equal(loc.second[CGAL::vertex_index_in_face(v, loc.first, g)], FT(1))); - assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g)+1)%3], FT(0))); - assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g)+2)%3], FT(0))); + assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g) + 1) % 3], FT(0))); + assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g) + 2) % 3], FT(0))); assert(is_equal(CGAL::squared_distance(to_p3( PMP::construct_point(loc, g, CGAL::parameters::vertex_point_map(vpm))), p3_a), FT(0))); @@ -552,18 +557,25 @@ struct Locate_with_AABB_tree_Tester // 2D case loc = PMP::locate(p_a, g, CGAL::parameters::vertex_point_map(vpm)); assert(is_equal(CGAL::squared_distance(to_p3( PMP::construct_point(loc, g, CGAL::parameters::vertex_point_map(vpm))), p3_a), FT(0))); - assert(PMP::is_in_face(loc, g)); + + if (std::is_same()) { + assert(PMP::is_in_face(loc, g)); + } loc = PMP::locate_with_AABB_tree(CGAL::ORIGIN, tree_b, g, CGAL::parameters::vertex_point_map(vpm_b)); - assert(PMP::is_in_face(loc, g)); + if (std::is_same()) { + assert(PMP::is_in_face(loc, g)); + } loc = PMP::locate(CGAL::ORIGIN, g, CGAL::parameters::vertex_point_map(vpm_b)); - assert(PMP::is_in_face(loc, g)); + if (std::is_same()) { + assert(PMP::is_in_face(loc, g)); + } // --------------------------------------------------------------------------- Ray_2 r2 = random_2D_ray >(tree_a, rnd); loc = PMP::locate_with_AABB_tree(r2, tree_a, g, CGAL::parameters::vertex_point_map(vpm)); - if(loc.first != boost::graph_traits::null_face()) + if(loc.first != boost::graph_traits::null_face() && std::is_same()) assert(PMP::is_in_face(loc, g)); Ray_3 r3 = random_3D_ray >(tree_b, rnd); @@ -654,25 +666,35 @@ struct Locate_with_AABB_tree_Tester // 3D assert(tree_b.size() == num_faces(g)); Face_location loc = PMP::locate_with_AABB_tree(p3_a, tree_a, g, CGAL::parameters::vertex_point_map(vpm)); - assert(is_equal(loc.second[CGAL::vertex_index_in_face(v, loc.first, g)], FT(1))); - assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g)+1)%3], FT(0))); - assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g)+2)%3], FT(0))); - assert(is_equal(CGAL::squared_distance(PMP::construct_point(loc, g), p3_a), FT(0))); + if (std::is_same()) { + assert(is_equal(loc.second[CGAL::vertex_index_in_face(v, loc.first, g)], FT(1))); + assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g) + 1) % 3], FT(0))); + assert(is_equal(loc.second[(CGAL::vertex_index_in_face(v, loc.first, g) + 2) % 3], FT(0))); + assert(is_equal(CGAL::squared_distance(PMP::construct_point(loc, g), p3_a), FT(0))); + } loc = PMP::locate_with_AABB_tree(p3_a, tree_a, g, CGAL::parameters::vertex_point_map(vpm)); - assert(is_equal(CGAL::squared_distance(PMP::construct_point(loc, g), p3_a), FT(0))); + if (std::is_same()) { + assert(is_equal(CGAL::squared_distance(PMP::construct_point(loc, g), p3_a), FT(0))); + } // --------------------------------------------------------------------------- loc = PMP::locate(p3_a, g, CGAL::parameters::snapping_tolerance(1e-7)); - assert(is_equal(CGAL::squared_distance(PMP::construct_point(loc, g), p3_a), FT(0))); - assert(PMP::is_in_face(loc, g)); + if (std::is_same()) { + assert(is_equal(CGAL::squared_distance(PMP::construct_point(loc, g), p3_a), FT(0))); + assert(PMP::is_in_face(loc, g)); + } loc = PMP::locate_with_AABB_tree(CGAL::ORIGIN, tree_b, g, CGAL::parameters::vertex_point_map(custom_vpm_3D)); - assert(PMP::is_in_face(loc, g)); + if (std::is_same()) { + assert(PMP::is_in_face(loc, g)); + } // Doesn't necessarily have to wrap with a P_to_P3: it can be done automatically internally loc = PMP::locate(CGAL::ORIGIN, g, CGAL::parameters::vertex_point_map(custom_vpm)); - assert(PMP::is_in_face(loc, g)); + if (std::is_same()) { + assert(PMP::is_in_face(loc, g)); + } // --------------------------------------------------------------------------- Ray_3 r3 = random_3D_ray >(tree_b, rnd); @@ -848,7 +870,7 @@ void test(CGAL::Random& rnd) { test_2D_triangulation("data/stair.xy", rnd); // test_2D_surface_mesh("data/blobby_2D.off", rnd); // temporarily disabled, until Surface_mesh's IO is "fixed" - test_surface_mesh_3D(CGAL::data_file_path("meshes/mech-holes-shark.off"), rnd); + test_surface_mesh_3D("meshes/mech-holes-shark.off", rnd); test_surface_mesh_projection("data/unit-grid.off", rnd); test_polyhedron("data-coref/elephant_split_2.off", rnd); } diff --git a/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Doxyfile.in b/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Doxyfile.in index 4c7ea4aaaa7..abdec8dc417 100644 --- a/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Doxyfile.in +++ b/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Doxyfile.in @@ -1,3 +1,2 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Polygonal Surface Reconstruction" -EXCLUDE = ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polygonal_surface_reconstruction/internal diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp index e132d62975d..cf1ce77b8b1 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp @@ -39,9 +39,9 @@ typedef CGAL::Nth_of_tuple_property_map<2, PNI> * candidate generation are cached and reused. */ -int main() +int main(int argc, char* argv[]) { - const std::string& input_file(CGAL::data_file_path("points_3/building.ply")); + const std::string input_file = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/building.ply"); std::ifstream input_stream(input_file.c_str()); std::vector points; // store points diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp index 2f2ed2df2c9..5db8d3f3700 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp @@ -39,9 +39,9 @@ typedef CGAL::Nth_of_tuple_property_map<2, PNI> * the point is not assigned to a plane). */ -int main() +int main(int argc, char* argv[]) { - const std::string& input_file(CGAL::data_file_path("points_3/ball.ply")); + const std::string input_file = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/ball.ply"); std::ifstream input_stream(input_file.c_str()); std::vector points; // store points diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp index 493c8c138aa..530d1422de4 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp @@ -83,13 +83,13 @@ private: * the surface model from the planes. */ -int main() +int main(int argc, char* argv[]) { Point_vector points; // Load point set from a file. - const std::string input_file(CGAL::data_file_path("points_3/cube.pwn")); - std::ifstream input_stream(input_file.c_str()); + const std::string input_file = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/cube.pwn"); + std::ifstream input_stream(input_file.c_str()); if (input_stream.fail()) { std::cerr << "Failed open file \'" << input_file << "\'" << std::endl; return EXIT_FAILURE; diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp index 4b2ed8f91a4..d14411babd1 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp @@ -52,13 +52,13 @@ typedef CGAL::Surface_mesh * the surface model from the planes. */ -int main() +int main(int argc, char* argv[]) { Point_vector points; // Loads point set from a file. - const std::string input_file(CGAL::data_file_path("points_3/cube.pwn")); - std::ifstream input_stream(input_file.c_str()); + const std::string input_file = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/cube.pwn"); + std::ifstream input_stream(input_file.c_str()); if (input_stream.fail()) { std::cerr << "failed open file \'" < void { diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index ee9c3fa0e69..a15e1f14dfd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -347,8 +347,7 @@ public Q_SLOTS: } // Create dialog box QDialog dialog(mw); - Ui::Isotropic_remeshing_dialog ui - = remeshing_dialog(&dialog, poly_item, selection_item); + initialize_remeshing_dialog(&dialog, poly_item, selection_item); // Get values int i = dialog.exec(); @@ -357,6 +356,7 @@ public Q_SLOTS: std::cout << "Remeshing aborted" << std::endl; return; } + bool edges_only = ui.splitEdgesOnly_checkbox->isChecked(); bool preserve_duplicates = ui.preserveDuplicates_checkbox->isChecked(); double target_length = ui.edgeLength_dspinbox->value(); @@ -710,7 +710,7 @@ public Q_SLOTS: if (target_length == 0.)//parameters have not been set yet { QDialog dialog(mw); - Ui::Isotropic_remeshing_dialog ui = remeshing_dialog(&dialog, poly_item); + initialize_remeshing_dialog(&dialog, poly_item); ui.objectName->setText(QString::number(scene->selectionIndices().size()) .append(QString(" items to be remeshed"))); int i = dialog.exec(); @@ -937,32 +937,73 @@ private: }; #endif - Ui::Isotropic_remeshing_dialog - remeshing_dialog(QDialog* dialog, - Scene_facegraph_item* poly_item, - Scene_polyhedron_selection_item* selection_item = nullptr) +public Q_SLOTS: + void update_after_protect_checkbox_click() + { + if(ui.protect_checkbox->isChecked()) + { + ui.smooth1D_label->setEnabled(false); + ui.smooth1D_checkbox->setEnabled(false); + ui.smooth1D_checkbox->setChecked(false); + } + else + { + ui.smooth1D_label->setEnabled(true); + ui.smooth1D_checkbox->setEnabled(true); + } + } + + void update_after_splitEdgesOnly_click() + { + if(ui.splitEdgesOnly_checkbox->isChecked()) + { + ui.nbIterations_label->setEnabled(false); + ui.nbIterations_spinbox->setEnabled(false); + ui.nbSmoothing_label->setEnabled(false); + ui.nbSmoothing_spinbox->setEnabled(false); + + ui.protect_label->setEnabled(false); + ui.protect_checkbox->setEnabled(false); + ui.protect_checkbox->setChecked(false); + + ui.smooth1D_label->setEnabled(false); + ui.smooth1D_checkbox->setEnabled(false); + ui.smooth1D_checkbox->setChecked(false); + } + else + { + ui.nbIterations_label->setEnabled(true); + ui.nbIterations_spinbox->setEnabled(true); + ui.nbSmoothing_label->setEnabled(true); + ui.nbSmoothing_spinbox->setEnabled(true); + + ui.protect_label->setEnabled(true); + ui.protect_checkbox->setEnabled(true); + + ui.smooth1D_label->setEnabled(true); + ui.smooth1D_checkbox->setEnabled(true); + } + } + +public: + void + initialize_remeshing_dialog(QDialog* dialog, + Scene_facegraph_item* poly_item, + Scene_polyhedron_selection_item* selection_item = nullptr) { - Ui::Isotropic_remeshing_dialog ui; ui.setupUi(dialog); connect(ui.buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); //connect checkbox to spinbox - connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), - ui.nbIterations_spinbox, SLOT(setDisabled(bool))); - connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), - ui.protect_checkbox, SLOT(setDisabled(bool))); - connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), - ui.smooth1D_checkbox, SLOT(setDisabled(bool))); - connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), - ui.nbSmoothing_spinbox, SLOT(setDisabled(bool))); - connect(ui.protect_checkbox, SIGNAL(toggled(bool)), - ui.smooth1D_checkbox, SLOT(setDisabled(bool))); connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)), ui.protect_checkbox, SLOT(setChecked(bool))); connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)), ui.protect_checkbox, SLOT(setDisabled(bool))); + connect(ui.protect_checkbox, SIGNAL(clicked(bool)), this, SLOT(update_after_protect_checkbox_click())); + connect(ui.splitEdgesOnly_checkbox, SIGNAL(clicked(bool)), this, SLOT(update_after_splitEdgesOnly_click())); + //Set default parameters Scene_interface::Bbox bbox = poly_item != nullptr ? poly_item->bbox() : (selection_item != nullptr ? selection_item->bbox() @@ -1003,14 +1044,12 @@ private: ui.preserveDuplicates_checkbox->setDisabled(true); ui.preserveDuplicates_checkbox->setChecked(false); } - - return ui; } private: QAction* actionIsotropicRemeshing_; - + Ui::Isotropic_remeshing_dialog ui; }; // end Polyhedron_demo_isotropic_remeshing_plugin #include "Isotropic_remeshing_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index b148e8df46b..c70929ab4a5 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -1928,6 +1928,7 @@ void Scene::removeViewer(Viewer_interface *viewer) if(viewer->property("is_destroyed").toBool()) return; + viewer->makeCurrent(); vaos[viewer]->destroy(); vaos[viewer]->deleteLater(); vaos.remove(viewer); diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h b/Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h index 82a081b8083..fcb98812e87 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h +++ b/Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h @@ -50,7 +50,6 @@ void compute_angles(Mesh* poly,Tester tester , double& mini, double& maxi, doubl typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::property_map::type VPMap; typedef typename CGAL::Kernel_traits< typename boost::property_traits::value_type >::Kernel Traits; - double rad_to_deg = 180. / CGAL_PI; accumulator_set< double, features< tag::min, tag::max, tag::mean > > acc; @@ -67,12 +66,8 @@ void compute_angles(Mesh* poly,Tester tester , double& mini, double& maxi, doubl typename Traits::Point_3 b = get(vpmap, target(h, *poly)); typename Traits::Point_3 c = get(vpmap, target(next(h, *poly), *poly)); - typename Traits::Vector_3 ba(b, a); - typename Traits::Vector_3 bc(b, c); - double cos_angle = (ba * bc) - / std::sqrt(ba.squared_length() * bc.squared_length()); - - acc(std::acos(cos_angle) * rad_to_deg); + typename Traits::FT ang = CGAL::approximate_angle(b,a,c); + acc(CGAL::to_double(ang)); } mini = extract_result< tag::min >(acc); @@ -281,4 +276,3 @@ void faces_aspect_ratio(Mesh* poly, faces_aspect_ratio(poly, faces(*poly), min_altitude, mini, maxi, mean); } #endif // POLYHEDRON_DEMO_STATISTICS_HELPERS_H - diff --git a/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h b/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h index f512f71cd9d..0b11736513c 100644 --- a/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h +++ b/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h @@ -30,9 +30,9 @@ protected: //i >= 1; from a start vertex on the current i-1 ring, push non-visited neighbors //of start in the nextRing and set indices to i. Also add these vertices in all. - void push_neighbours_of(const Vertex_const_handle start, const int ith, - std::vector < Vertex_const_handle > &nextRing, - std::vector < Vertex_const_handle > &all); + void push_neighbors_of(const Vertex_const_handle start, const int ith, + std::vector < Vertex_const_handle > &nextRing, + std::vector < Vertex_const_handle > &all); //i >= 1, from a currentRing i-1, collect all neighbors, set indices //to i and store them in nextRing and all. @@ -70,7 +70,7 @@ T_PolyhedralSurf_rings(const TPoly& P) template < class TPoly > void T_PolyhedralSurf_rings :: -push_neighbours_of(const Vertex_const_handle start, const int ith, +push_neighbors_of(const Vertex_const_handle start, const int ith, std::vector < Vertex_const_handle > &nextRing, std::vector < Vertex_const_handle > &all) { @@ -98,7 +98,7 @@ collect_ith_ring(const int ith, std::vector < Vertex_const_handle > ¤tRing typename std::vector < Vertex_const_handle >::const_iterator itb = currentRing.begin(), ite = currentRing.end(); - CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all); + CGAL_For_all(itb, ite) push_neighbors_of(*itb, ith, nextRing, all); } template diff --git a/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h b/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h index 9cea6526bb8..0b11736513c 100644 --- a/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h +++ b/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h @@ -30,9 +30,9 @@ protected: //i >= 1; from a start vertex on the current i-1 ring, push non-visited neighbors //of start in the nextRing and set indices to i. Also add these vertices in all. - void push_neighbours_of(const Vertex_const_handle start, const int ith, - std::vector < Vertex_const_handle > &nextRing, - std::vector < Vertex_const_handle > &all); + void push_neighbors_of(const Vertex_const_handle start, const int ith, + std::vector < Vertex_const_handle > &nextRing, + std::vector < Vertex_const_handle > &all); //i >= 1, from a currentRing i-1, collect all neighbors, set indices //to i and store them in nextRing and all. @@ -44,7 +44,7 @@ protected: public: T_PolyhedralSurf_rings(const TPoly& P); - //collect i>=1 rings : all neighbours up to the ith ring, + //collect i>=1 rings : all neighbors up to the ith ring, void collect_i_rings(const Vertex_const_handle v, const int ring_i, std::vector < Vertex_const_handle >& all); @@ -70,7 +70,7 @@ T_PolyhedralSurf_rings(const TPoly& P) template < class TPoly > void T_PolyhedralSurf_rings :: -push_neighbours_of(const Vertex_const_handle start, const int ith, +push_neighbors_of(const Vertex_const_handle start, const int ith, std::vector < Vertex_const_handle > &nextRing, std::vector < Vertex_const_handle > &all) { @@ -98,7 +98,7 @@ collect_ith_ring(const int ith, std::vector < Vertex_const_handle > ¤tRing typename std::vector < Vertex_const_handle >::const_iterator itb = currentRing.begin(), ite = currentRing.end(); - CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all); + CGAL_For_all(itb, ite) push_neighbors_of(*itb, ith, nextRing, all); } template diff --git a/SMDS_3/doc/SMDS_3/Doxyfile.in b/SMDS_3/doc/SMDS_3/Doxyfile.in index 78025668400..73a16fd9c50 100644 --- a/SMDS_3/doc/SMDS_3/Doxyfile.in +++ b/SMDS_3/doc/SMDS_3/Doxyfile.in @@ -7,6 +7,3 @@ EXTRACT_ALL = false HIDE_UNDOC_CLASSES = true HIDE_UNDOC_MEMBERS = true WARN_IF_UNDOCUMENTED = false - -EXCLUDE = ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/internal/SMDS_3 - diff --git a/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h b/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h index 17d9759018b..8a9cb795d3f 100644 --- a/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h +++ b/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h @@ -419,7 +419,8 @@ bool build_triangulation_impl(Tr& tr, if(finite_cells.empty()) { - std::cout << "WARNING: No finite cells were provided. Only the points will be loaded."<(tr, incident_cells_map, verbose, allow_non_manifold)) { if(verbose) std::cout << "build_infinite_cells went wrong" << std::endl; success = false; } else - std::cout << "build infinite cells done" << std::endl; + if (verbose) std::cout << "build infinite cells done" << std::endl; tr.tds().set_dimension(3); if (!CGAL::SMDS_3::assign_neighbors(tr, incident_cells_map, allow_non_manifold)) { @@ -453,7 +454,7 @@ bool build_triangulation_impl(Tr& tr, success = false; } else - std::cout << "assign neighbors done" << std::endl; + if (verbose) std::cout << "assign neighbors done" << std::endl; if (verbose) { std::cout << "built triangulation : " << std::endl; diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index b6b7c46efb8..e22b5d6063a 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -159,6 +159,7 @@ CGAL_add_named_parameter(random_seed_t, random_seed, random_seed) CGAL_add_named_parameter(do_lock_mesh_t, do_lock_mesh, do_lock_mesh) CGAL_add_named_parameter(do_simplify_border_t, do_simplify_border, do_simplify_border) CGAL_add_named_parameter(algorithm_t, algorithm, algorithm) +CGAL_add_named_parameter(use_smoothing_t, use_smoothing, use_smoothing) //internal CGAL_add_named_parameter(weight_calculator_t, weight_calculator, weight_calculator) diff --git a/STL_Extension/include/CGAL/exceptions.h b/STL_Extension/include/CGAL/exceptions.h index edb926383f9..3b269aea302 100644 --- a/STL_Extension/include/CGAL/exceptions.h +++ b/STL_Extension/include/CGAL/exceptions.h @@ -14,22 +14,9 @@ #ifndef CGAL_EXCEPTIONS_H #define CGAL_EXCEPTIONS_H -#include #include #include -// Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' -// lexical_cast.hpp includes files from boost/preprocessor -// This concerns boost 1_67_0 -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable: 4003) -#endif -#include -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - namespace CGAL { @@ -87,7 +74,7 @@ public: std::logic_error( lib + std::string( " ERROR: ") + kind + std::string( "!") + ((expr.empty()) ? (std::string("")) : (std::string("\nExpr: ")+expr)) + std::string( "\nFile: ") + file - + std::string( "\nLine: ") + boost::lexical_cast(line) + + std::string( "\nLine: ") + std::to_string(line) + ((msg.empty()) ? (std::string("")) : (std::string("\nExplanation: ") + msg))), m_lib( lib), diff --git a/Set_movable_separability_2/examples/Set_movable_separability_2/is_pullout_direction_single_mold_trans_cast.cpp b/Set_movable_separability_2/examples/Set_movable_separability_2/is_pullout_direction_single_mold_trans_cast.cpp index f6661d3ca81..30e71e543b2 100644 --- a/Set_movable_separability_2/examples/Set_movable_separability_2/is_pullout_direction_single_mold_trans_cast.cpp +++ b/Set_movable_separability_2/examples/Set_movable_separability_2/is_pullout_direction_single_mold_trans_cast.cpp @@ -12,6 +12,17 @@ typedef CGAL::Polygon_2 Polygon_2; namespace SMS = CGAL::Set_movable_separability_2; namespace casting = SMS::Single_mold_translational_casting; +template +inline std::pair +get_segment_outer_circle(const typename Kernel::Segment_2 seg, + const CGAL::Orientation orientation) +{ + typename Kernel::Direction_2 forward( seg); + typename Kernel::Direction_2 backward(-forward); + return (orientation == CGAL::CLOCKWISE) ? + std::make_pair(backward, forward) : std::make_pair(forward, backward); +} + // The main program: int main(int argc, char* argv[]) { @@ -33,8 +44,7 @@ int main(int argc, char* argv[]) ++index) { auto orientation = polygon.orientation(); - auto segment_outer_circle = - SMS::internal::get_segment_outer_circle(*e_it, orientation); + auto segment_outer_circle = get_segment_outer_circle(*e_it, orientation); auto d = segment_outer_circle.first; d = d.perpendicular(CGAL::CLOCKWISE); auto res = casting::is_pullout_direction(polygon, e_it, d); diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.h b/Solver_interface/include/CGAL/Eigen_solver_traits.h index 93820b7b827..428c33bad73 100644 --- a/Solver_interface/include/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/include/CGAL/Eigen_solver_traits.h @@ -242,7 +242,12 @@ class Eigen_solver_traits::EigenType public: typedef EigenSolverT Solver; typedef Scalar NT; +#ifdef DOXYGEN_RUNNING + typedef unspecified_type Matrix; +#else typedef internal::Get_eigen_matrix::type Matrix; +#endif + typedef Eigen_vector Vector; // Public operations diff --git a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp index 03664cace1b..3dd0b399892 100644 --- a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp +++ b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp @@ -413,8 +413,8 @@ namespace nanoflann checks(checks_IGNORED_), eps(eps_), sorted(sorted_) {} int checks; //!< Ignored parameter (Kept for compatibility with the FLANN interface). - float eps; //!< search for eps-approximate neighbours (default: 0) - bool sorted; //!< only for radius search, require neighbours sorted by distance (default: true) + float eps; //!< search for eps-approximate neighbors (default: 0) + bool sorted; //!< only for radius search, require neighbors sorted by distance (default: true) }; /** @} */ @@ -823,7 +823,7 @@ namespace nanoflann }; /** - * Array of k-d trees used to find neighbours. + * Array of k-d trees used to find neighbors. */ NodePtr root_node; typedef BranchStruct BranchSt; diff --git a/Spatial_searching/doc/Spatial_searching/examples.txt b/Spatial_searching/doc/Spatial_searching/examples.txt index 597aa1893f9..defc30a2079 100644 --- a/Spatial_searching/doc/Spatial_searching/examples.txt +++ b/Spatial_searching/doc/Spatial_searching/examples.txt @@ -6,6 +6,7 @@ \example Spatial_searching/fuzzy_range_query.cpp \example Spatial_searching/general_neighbor_searching.cpp \example Spatial_searching/iso_rectangle_2_query.cpp +\example Spatial_searching/iso_rectangle_2_query_projection.cpp \example Spatial_searching/nearest_neighbor_searching.cpp \example Spatial_searching/searching_with_circular_query.cpp \example Spatial_searching/searching_surface_mesh_vertices.cpp diff --git a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt index 811774b5ed5..ab2d67334d4 100644 --- a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt @@ -28,6 +28,8 @@ create_single_source_cgal_program("distance_browsing.cpp") create_single_source_cgal_program("iso_rectangle_2_query.cpp") +create_single_source_cgal_program("iso_rectangle_2_query_projection.cpp") + create_single_source_cgal_program("nearest_neighbor_searching.cpp") create_single_source_cgal_program("searching_with_circular_query.cpp") diff --git a/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query.cpp b/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query.cpp index a8ecbd13a50..bbd1fd035a6 100644 --- a/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query.cpp +++ b/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query.cpp @@ -46,7 +46,7 @@ int main() // using value 0.1 for fuzziness parameter Fuzzy_iso_box approximate_range(p, q, 0.1); tree.search(std::back_inserter( result ), approximate_range); - std::cout << "The points in the fuzzy box [[0.1, 0.3], [0.6, 0.9]]^2 are: " << std::endl; + std::cout << "The points in the fuzzy box [[0.1, 0.3], [0.6, 0.8]]^2 are: " << std::endl; std::copy (result.begin(), result.end(), std::ostream_iterator(std::cout,"\n") ); std::cout << std::endl; return 0; diff --git a/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query_projection.cpp b/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query_projection.cpp new file mode 100644 index 00000000000..c50c2853a0d --- /dev/null +++ b/Spatial_searching/examples/Spatial_searching/iso_rectangle_2_query_projection.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include + +#include + +// Point_3 to Point_2 projection on the fly +template +struct Projection_xy_property_map +{ + typedef typename K::Point_3 key_type; + typedef typename K::Point_2 value_type; + typedef value_type reference; + typedef boost::readable_property_map_tag category; + + friend value_type get(Projection_xy_property_map, const key_type& k) + { + return value_type(k.x(), k.y()); + } +}; + +typedef CGAL::Simple_cartesian K; +typedef K::Point_2 Point_2; +typedef K::Point_3 Point_3; + +typedef CGAL::Random_points_in_cube_3 Random_points_iterator; +typedef CGAL::Counting_iterator N_Random_points_iterator; + +typedef CGAL::Search_traits_2Traits_base; +typedef CGAL::Search_traits_adapter, Traits_base> Traits; +typedef CGAL::Kd_tree Tree; +typedef CGAL::Fuzzy_iso_box Fuzzy_iso_box; + +int main() +{ + const int N = 1000; + + std::list points; + points.push_back(Point_3(0, 0, 0)); + + Tree tree; + Random_points_iterator rpg; + for(int i = 0; i < N; i++) + tree.insert(*rpg++); + + std::list result; + + // define 2D range query + Point_2 p(0.2, 0.2); + Point_2 q(0.7, 0.7); + + // Searching an exact range + // using default value 0.0 for epsilon fuzziness paramater + Fuzzy_iso_box exact_range(p,q); + tree.search( std::back_inserter( result ), exact_range); + std::cout << "The points in the box [0.2, 0.7]^2 are: " << std::endl; + std::copy (result.begin(), result.end(), std::ostream_iterator(std::cout,"\n") ); + std::cout << std::endl; + + result.clear(); + + // Searching a fuzzy range + // using value 0.1 for fuzziness paramater + Fuzzy_iso_box approximate_range(p, q, 0.1); + tree.search(std::back_inserter( result ), approximate_range); + std::cout << "The points in the fuzzy box [[0.1, 0.3], [0.6, 0.8]]^2 are: " << std::endl; + std::copy (result.begin(), result.end(), std::ostream_iterator(std::cout,"\n") ); + std::cout << std::endl; + return 0; +} diff --git a/Spatial_searching/include/CGAL/Incremental_neighbor_search.h b/Spatial_searching/include/CGAL/Incremental_neighbor_search.h index eb329488266..66738159d27 100644 --- a/Spatial_searching/include/CGAL/Incremental_neighbor_search.h +++ b/Spatial_searching/include/CGAL/Incremental_neighbor_search.h @@ -264,7 +264,7 @@ namespace CGAL { FT distance_to_root; - bool search_nearest_neighbour; + bool search_nearest_neighbor; FT rd; @@ -278,8 +278,8 @@ namespace CGAL { bool search_nearest; - Priority_higher(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) + Priority_higher(bool search_the_nearest_neighbor) + : search_nearest(search_the_nearest_neighbor) {} //highest priority is smallest distance @@ -296,8 +296,8 @@ namespace CGAL { bool search_nearest; - Distance_smaller(bool search_the_nearest_neighbour) - :search_nearest(search_the_nearest_neighbour) + Distance_smaller(bool search_the_nearest_neighbor) + :search_nearest(search_the_nearest_neighbor) {} //highest priority is smallest distance @@ -325,19 +325,19 @@ namespace CGAL { int number_of_internal_nodes_visited; int number_of_leaf_nodes_visited; int number_of_items_visited; - int number_of_neighbours_computed; + int number_of_neighbors_computed; // constructor Iterator_implementation(const Tree& tree, const Query_item& q,const Distance& tr, FT Eps, bool search_nearest) - : query_point(q), search_nearest_neighbour(search_nearest), + : query_point(q), search_nearest_neighbor(search_nearest), m_distance_helper(tr, tree.traits()), m_tree(tree), PriorityQueue(Priority_higher(search_nearest)), Item_PriorityQueue(Distance_smaller(search_nearest)), distance(tr), reference_count(1), number_of_internal_nodes_visited(0), number_of_leaf_nodes_visited(0), number_of_items_visited(0), - number_of_neighbours_computed(0) + number_of_neighbors_computed(0) { if (tree.empty()) return; @@ -365,7 +365,7 @@ namespace CGAL { // rd is the distance of the top of the priority queue to q rd=The_Root->second; - Compute_the_next_nearest_neighbour(); + Compute_the_next_nearest_neighbor(); } // * operator @@ -380,7 +380,7 @@ namespace CGAL { operator++() { Delete_the_current_item_top(); - Compute_the_next_nearest_neighbour(); + Compute_the_next_nearest_neighbor(); return *this; } @@ -405,7 +405,7 @@ namespace CGAL { s << "Number of points visited:" << number_of_items_visited << std::endl; s << "Number of neighbors computed:" << - number_of_neighbours_computed << std::endl; + number_of_neighbors_computed << std::endl; return s; } @@ -459,21 +459,21 @@ namespace CGAL { // old top of PriorityQueue has been processed, // hence update rd - bool next_neighbour_found; + bool next_neighbor_found; if (!(PriorityQueue.empty())) { rd = PriorityQueue.top()->second; - next_neighbour_found = (search_furthest ? + next_neighbor_found = (search_furthest ? multiplication_factor*rd < Item_PriorityQueue.top()->second : multiplication_factor*rd > Item_PriorityQueue.top()->second); } - else // priority queue empty => last neighbour found + else // priority queue empty => last neighbor found { - next_neighbour_found = true; + next_neighbor_found = true; } - number_of_neighbours_computed++; - return next_neighbour_found; + number_of_neighbors_computed++; + return next_neighbor_found; } // Without cache @@ -494,37 +494,37 @@ namespace CGAL { // old top of PriorityQueue has been processed, // hence update rd - bool next_neighbour_found; + bool next_neighbor_found; if (!(PriorityQueue.empty())) { rd = PriorityQueue.top()->second; - next_neighbour_found = (search_furthest ? + next_neighbor_found = (search_furthest ? multiplication_factor*rd < Item_PriorityQueue.top()->second : multiplication_factor*rd > Item_PriorityQueue.top()->second); } - else // priority queue empty => last neighbour found + else // priority queue empty => last neighbor found { - next_neighbour_found = true; + next_neighbor_found = true; } - number_of_neighbours_computed++; - return next_neighbour_found; + number_of_neighbors_computed++; + return next_neighbor_found; } void - Compute_the_next_nearest_neighbour() + Compute_the_next_nearest_neighbor() { // compute the next item - bool next_neighbour_found=false; + bool next_neighbor_found=false; if (!(Item_PriorityQueue.empty())) { - if (search_nearest_neighbour) - next_neighbour_found = + if (search_nearest_neighbor) + next_neighbor_found = (multiplication_factor*rd > Item_PriorityQueue.top()->second); else - next_neighbour_found = + next_neighbor_found = (rd < multiplication_factor*Item_PriorityQueue.top()->second); } - while ((!next_neighbour_found) && (!PriorityQueue.empty())) { + while ((!next_neighbor_found) && (!PriorityQueue.empty())) { Cell_with_distance* The_node_top = PriorityQueue.top(); Node_const_handle N = The_node_top->first->node(); @@ -544,7 +544,7 @@ namespace CGAL { Node_box* upper_box = new Node_box(*B); lower_box->split(*upper_box,new_cut_dim, new_cut_val); delete B; - if (search_nearest_neighbour) { + if (search_nearest_neighbor) { FT distance_to_box_lower = distance.min_distance_to_rectangle(query_point, *lower_box); FT distance_to_box_upper = @@ -597,12 +597,15 @@ namespace CGAL { number_of_leaf_nodes_visited++; if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; - next_neighbour_found = search_in_leaf(node, dummy, !search_nearest_neighbour); + next_neighbor_found = search_in_leaf(node, dummy, !search_nearest_neighbor); } - } // next_neighbour_found or priority queue is empty + } // next_neighbor_found or priority queue is empty // in the latter case also the item priority queue is empty } + + CGAL_DEPRECATED void Compute_the_next_nearest_neighbour() + { void Compute_the_next_nearest_neighbor(); } }; // class Iterator_implementation }; // class iterator }; // class diff --git a/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h b/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h index 549e904c8ab..791676defb0 100644 --- a/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h +++ b/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h @@ -65,7 +65,7 @@ namespace CGAL { SearchTraits traits; public: - int number_of_neighbours_computed; + int number_of_neighbors_computed; int number_of_internal_nodes_visited; int number_of_leaf_nodes_visited; int number_of_items_visited; @@ -85,7 +85,7 @@ namespace CGAL { FT distance_to_root; - bool search_nearest_neighbour; + bool search_nearest_neighbor; FT rd; @@ -97,8 +97,8 @@ namespace CGAL { bool search_nearest; - Priority_higher(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) + Priority_higher(bool search_the_nearest_neighbor) + : search_nearest(search_the_nearest_neighbor) {} //highest priority is smallest distance @@ -115,8 +115,8 @@ namespace CGAL { bool search_nearest; - Distance_smaller(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) + Distance_smaller(bool search_the_nearest_neighbor) + : search_nearest(search_the_nearest_neighbor) {} //highest priority is smallest distance @@ -144,12 +144,12 @@ namespace CGAL { // constructor Iterator_implementation(const Tree& tree,const Query_item& q, const Distance& tr, FT Eps=FT(0.0), bool search_nearest=true) - : traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0), + : traits(tree.traits()),number_of_neighbors_computed(0), number_of_internal_nodes_visited(0), number_of_leaf_nodes_visited(0), number_of_items_visited(0), orthogonal_distance_instance(tr), m_distance_helper(orthogonal_distance_instance, traits), multiplication_factor(orthogonal_distance_instance.transformed_distance(FT(1.0)+Eps)), - query_point(q), search_nearest_neighbour(search_nearest), + query_point(q), search_nearest_neighbor(search_nearest), m_tree(tree), PriorityQueue(Priority_higher(search_nearest)), Item_PriorityQueue(Distance_smaller(search_nearest)), reference_count(1) @@ -175,7 +175,7 @@ namespace CGAL { // rd is the distance of the top of the priority queue to q rd=std::get<1>(*The_Root); - Compute_the_next_nearest_neighbour(); + Compute_the_next_nearest_neighbor(); } else{ distance_to_root= @@ -187,7 +187,7 @@ namespace CGAL { // rd is the distance of the top of the priority queue to q rd=std::get<1>(*The_Root); - Compute_the_next_furthest_neighbour(); + Compute_the_next_furthest_neighbor(); } @@ -205,10 +205,10 @@ namespace CGAL { operator++() { Delete_the_current_item_top(); - if(search_nearest_neighbour) - Compute_the_next_nearest_neighbour(); + if(search_nearest_neighbor) + Compute_the_next_nearest_neighbor(); else - Compute_the_next_furthest_neighbour(); + Compute_the_next_furthest_neighbor(); return *this; } @@ -233,7 +233,7 @@ namespace CGAL { s << "Number of items visited:" << number_of_items_visited << std::endl; s << "Number of neighbors computed:" - << number_of_neighbours_computed << std::endl; + << number_of_neighbors_computed << std::endl; return s; } @@ -287,21 +287,21 @@ namespace CGAL { // old top of PriorityQueue has been processed, // hence update rd - bool next_neighbour_found; + bool next_neighbor_found; if (!(PriorityQueue.empty())) { rd = std::get<1>(*PriorityQueue.top()); - next_neighbour_found = (search_furthest ? + next_neighbor_found = (search_furthest ? multiplication_factor*rd < Item_PriorityQueue.top()->second : multiplication_factor*rd > Item_PriorityQueue.top()->second); } else // priority queue empty => last neighbor found { - next_neighbour_found = true; + next_neighbor_found = true; } - number_of_neighbours_computed++; - return next_neighbour_found; + number_of_neighbors_computed++; + return next_neighbor_found; } // Without cache @@ -322,37 +322,37 @@ namespace CGAL { // old top of PriorityQueue has been processed, // hence update rd - bool next_neighbour_found; + bool next_neighbor_found; if (!(PriorityQueue.empty())) { rd = std::get<1>(*PriorityQueue.top()); - next_neighbour_found = (search_furthest ? + next_neighbor_found = (search_furthest ? multiplication_factor*rd < Item_PriorityQueue.top()->second : multiplication_factor*rd > Item_PriorityQueue.top()->second); } - else // priority queue empty => last neighbour found + else // priority queue empty => last neighbor found { - next_neighbour_found=true; + next_neighbor_found=true; } - number_of_neighbours_computed++; - return next_neighbour_found; + number_of_neighbors_computed++; + return next_neighbor_found; } void - Compute_the_next_nearest_neighbour() + Compute_the_next_nearest_neighbor() { // compute the next item - bool next_neighbour_found=false; + bool next_neighbor_found=false; if (!(Item_PriorityQueue.empty())) { - next_neighbour_found= + next_neighbor_found= (multiplication_factor*rd > Item_PriorityQueue.top()->second); } typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point); // otherwise browse the tree further - while ((!next_neighbour_found) && (!PriorityQueue.empty())) { + while ((!next_neighbor_found) && (!PriorityQueue.empty())) { Node_with_distance* The_node_top=PriorityQueue.top(); Node_const_handle N= std::get<0>(*The_node_top); dists = std::get<2>(*The_node_top); @@ -398,26 +398,29 @@ namespace CGAL { number_of_leaf_nodes_visited++; if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; - next_neighbour_found = search_in_leaf(node, dummy, false); + next_neighbor_found = search_in_leaf(node, dummy, false); } - } // next_neighbour_found or priority queue is empty + } // next_neighbor_found or priority queue is empty // in the latter case also the item priority queue is empty } + CGAL_DEPRECATED void Compute_the_next_nearest_neighbour() + { Compute_the_next_nearest_neighbor(); } + void - Compute_the_next_furthest_neighbour() + Compute_the_next_furthest_neighbor() { // compute the next item - bool next_neighbour_found=false; + bool next_neighbor_found=false; if (!(Item_PriorityQueue.empty())) { - next_neighbour_found= + next_neighbor_found= (rd < multiplication_factor*Item_PriorityQueue.top()->second); } typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point); // otherwise browse the tree further - while ((!next_neighbour_found) && (!PriorityQueue.empty())) { + while ((!next_neighbor_found) && (!PriorityQueue.empty())) { Node_with_distance* The_node_top=PriorityQueue.top(); Node_const_handle N= std::get<0>(*The_node_top); dists = std::get<2>(*The_node_top); @@ -462,11 +465,14 @@ namespace CGAL { number_of_leaf_nodes_visited++; if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; - next_neighbour_found = search_in_leaf(node, dummy, true); + next_neighbor_found = search_in_leaf(node, dummy, true); } - } // next_neighbour_found or priority queue is empty + } // next_neighbor_found or priority queue is empty // in the latter case also the item priority queue is empty } + + CGAL_DEPRECATED void Compute_the_next_furthest_neighbour() + { Compute_the_next_furthest_neighbor(); } }; // class Iterator_implementaion diff --git a/Spatial_searching/include/CGAL/Search_traits_adapter.h b/Spatial_searching/include/CGAL/Search_traits_adapter.h index aee69ca254c..f93fc340b7a 100644 --- a/Spatial_searching/include/CGAL/Search_traits_adapter.h +++ b/Spatial_searching/include/CGAL/Search_traits_adapter.h @@ -138,14 +138,14 @@ public: typedef typename boost::property_traits::value_type Point; - std::shared_ptr point; - std::size_t idx; + Point point; + std::size_t idx = 0; public: - No_lvalue_iterator() : point(NULL), idx(0) { } - No_lvalue_iterator(const Point& point) : point(new Point(point)), idx(0) { } - No_lvalue_iterator(const Point& point, int) : point(new Point(point)), idx(Base::Dimension::value) { } + No_lvalue_iterator() : point() { } + No_lvalue_iterator(const Point& point) : point(point) { } + No_lvalue_iterator(const Point& point, int) : point(point), idx(Base::Dimension::value) { } private: @@ -153,18 +153,15 @@ public: void increment() { ++idx; - CGAL_assertion(point != std::shared_ptr()); } void decrement() { --idx; - CGAL_assertion(point != std::shared_ptr()); } void advance(std::ptrdiff_t n) { idx += n; - CGAL_assertion(point != std::shared_ptr()); } std::ptrdiff_t distance_to(const No_lvalue_iterator& other) const @@ -181,7 +178,7 @@ public: dereference() const { // Point::operator[] takes an int as parameter... - return const_cast((*point)[static_cast(idx)]); + return const_cast(point[static_cast(idx)]); } }; diff --git a/Spatial_searching/include/CGAL/Spatial_searching/internal/K_neighbor_search.h b/Spatial_searching/include/CGAL/Spatial_searching/internal/K_neighbor_search.h index 514246c14dc..afb198848e5 100644 --- a/Spatial_searching/include/CGAL/Spatial_searching/internal/K_neighbor_search.h +++ b/Spatial_searching/include/CGAL/Spatial_searching/internal/K_neighbor_search.h @@ -60,8 +60,8 @@ protected: public: - Distance_larger(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) + Distance_larger(bool search_the_nearest_neighbor) + : search_nearest(search_the_nearest_neighbor) {} bool operator()(const Point_ptr_with_transformed_distance& p1, diff --git a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp index 58e8febe495..ddce5124c4e 100644 --- a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp +++ b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp @@ -71,21 +71,21 @@ void run() typename K_search::iterator it = oins.begin(); typename K_search::Point_with_transformed_distance pd = *it; points2.push_back(get_point(pd.first)); - if(CGAL::squared_distance(query,get_point(pd.first)) != pd.second){ + if(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) >= 0.000000001){ std::cout << "different distances: " << CGAL::squared_distance(query,get_point(pd.first)) << " != " << pd.second << std::endl; } - assert(CGAL_IA_FORCE_TO_DOUBLE(CGAL::squared_distance(query,get_point(pd.first))) == pd.second); + assert(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) < 0.000000001); it++; for(; it != oins.end();it++){ typename K_search::Point_with_transformed_distance qd = *it; assert(pd.second <= qd.second); pd = qd; points2.push_back(get_point(pd.first)); - if(CGAL_IA_FORCE_TO_DOUBLE(CGAL::squared_distance(query,get_point(pd.first))) != pd.second){ + if(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) >= 0.000000001){ std::cout << "different distances: " << CGAL::squared_distance(query,get_point(pd.first)) << " != " << pd.second << std::endl; } - assert(CGAL_IA_FORCE_TO_DOUBLE(CGAL::squared_distance(query,get_point(pd.first))) == pd.second); + assert(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) < 0.000000001); } @@ -176,6 +176,7 @@ bool search(bool nearest) int main() { + std::cout << std::setprecision(17); bool OK=true; std::cout << "Testing Incremental_neighbor_search\n"; run(); diff --git a/Spatial_searching/test/Spatial_searching/Splitters.cpp b/Spatial_searching/test/Spatial_searching/Splitters.cpp index eb79416c6ca..9bde600fefa 100644 --- a/Spatial_searching/test/Spatial_searching/Splitters.cpp +++ b/Spatial_searching/test/Spatial_searching/Splitters.cpp @@ -60,20 +60,23 @@ struct Splitter_test { typename Orthogonal_incremental_neighbor_search::iterator it = oins.begin(); Point_with_transformed_distance pd = *it; points2.push_back(get_point(pd.first)); - if(CGAL::squared_distance(query,get_point(pd.first)) != pd.second){ + + std::cout << std::setprecision(17); + + if(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) >= 0.000000001){ std::cout << CGAL::squared_distance(query,get_point(pd.first)) << " != " << pd.second << std::endl; } - assert(CGAL_IA_FORCE_TO_DOUBLE(CGAL::squared_distance(query,get_point(pd.first))) == pd.second); + assert(abs(CGAL::squared_distance(query,get_point(pd.first)) - pd.second) < 0.000000001); it++; for(; it != oins.end();it++){ Point_with_transformed_distance qd = *it; assert(pd.second <= qd.second); pd = qd; points2.push_back(get_point(pd.first)); - if(CGAL_IA_FORCE_TO_DOUBLE(CGAL::squared_distance(query,get_point(pd.first))) != pd.second){ + if(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) >= 0.000000001){ std::cout << CGAL::squared_distance(query,get_point(pd.first)) << " != " << pd.second << std::endl; } - assert(CGAL_IA_FORCE_TO_DOUBLE(CGAL::squared_distance(query,get_point(pd.first))) == pd.second); + assert(abs(CGAL::squared_distance(query, get_point(pd.first)) - pd.second) < 0.000000001); } std::sort(points.begin(),points.end()); std::sort(points2.begin(),points2.end()); diff --git a/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h b/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h index ac11053935d..14077a3aaa4 100644 --- a/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h @@ -101,7 +101,7 @@ Uncertain are_parallel_edges_equally_orientedC2( Segment_2_with_ID cons } -// Returns true IFF segments e0,e1 share the same supporting line but do not overlap except at the vetices, and have the same orientation. +// Returns true IFF segments e0,e1 share the same supporting line but do not overlap except at the vertices, and have the same orientation. // NOTE: If e1 goes back over e0 (a degenerate antenna or alley) this returns false. template Uncertain are_edges_orderly_collinearC2( Segment_2_with_ID const& e0, Segment_2_with_ID const& e1 ) @@ -170,7 +170,7 @@ Uncertain certified_trisegment_collinearity ( Segment_2 // is well defined, In that case, the degenerate vertex can be even a contour vertex or a skeleton node. If it is a skeleton // node, it is properly defined by the trisegment tree that corresponds to the node. // A trisegment tree stores not only the "current event" trisegment but also the trisegments for the left/right seed vertices, -// recursivey in case the seed vertices are skeleton nodes as well. +// recursively in case the seed vertices are skeleton nodes as well. // Those seeds are used to determine the actual position of the degenerate vertex in case of collinear edges (since that point is // not given by the collinear edges alone) // @@ -371,14 +371,14 @@ is_edge_facing_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2> t; - - for(std::size_t pos=0; pos < t.length(); ++pos) - { - char c = t[pos]; - if(c == '(') - break; - - type.push_back(c); + std::string::size_type header_end = line.find("("); // } + if(header_end == std::string::npos){ + continue; } + std::string type=""; + const std::string header = line.substr(0,header_end); + const std::string types[6] = { "MULTIPOLYGON", "MULTILINESTRING", "MULTIPOINT", "POLYGON", "LINESTRING", "POINT"}; + for(int i= 0; i < 6; ++i){ + if(header.find(types[i]) != std::string::npos){ + type = types[i]; + break; + } + } + if(type == ""){ + continue; + } + std::istringstream iss(line); - is.seekg(input_pos); if(type == "POINT") { Point p; - CGAL::IO::read_point_WKT(is, p); + CGAL::IO::read_point_WKT(iss, p); points.push_back(p); } else if(type == "LINESTRING") { LineString l; - CGAL::IO::read_linestring_WKT(is, l); + CGAL::IO::read_linestring_WKT(iss, l); polylines.push_back(l); } else if(type == "POLYGON") { Polygon p; - CGAL::IO::read_polygon_WKT(is, p); + CGAL::IO::read_polygon_WKT(iss, p); if(!p.outer_boundary().is_empty()) polygons.push_back(p); } else if(type == "MULTIPOINT") { MultiPoint mp; - CGAL::IO::read_multi_point_WKT(is, mp); + CGAL::IO::read_multi_point_WKT(iss, mp); for(const Point& point : mp) points.push_back(point); } else if(type == "MULTILINESTRING") { MultiLineString mls; - CGAL::IO::read_multi_linestring_WKT(is, mls); + CGAL::IO::read_multi_linestring_WKT(iss, mls); for(const LineString& ls : mls) polylines.push_back(ls); } else if(type == "MULTIPOLYGON") { MultiPolygon mp; - CGAL::IO::read_multi_polygon_WKT(is, mp); + CGAL::IO::read_multi_polygon_WKT(iss, mp); for(const Polygon& poly : mp) polygons.push_back(poly); } } - while(is.good() && !is.eof()); + return !is.fail(); } diff --git a/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp b/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp index cbd42788fcc..488282915ba 100644 --- a/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp +++ b/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp @@ -20,6 +20,25 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } + // Internal color property maps are used if they exist and are called "v:color", "e:color" and "f:color". + auto vcm = sm.add_property_map("v:color").first; + auto ecm = sm.add_property_map("e:color").first; + auto fcm = sm.add_property_map("f:color", CGAL::IO::white() /*default*/).first; + + for(auto v : vertices(sm)) + { + if(v.idx()%2) + put(vcm, v, CGAL::IO::black()); + else + put(vcm, v, CGAL::IO::blue()); + } + + for(auto e : edges(sm)) + put(ecm, e, CGAL::IO::gray()); + + CGAL_USE(fcm); + + // Draw! CGAL::draw(sm); return EXIT_SUCCESS; diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 3e3194e4f19..290eb6ba0a6 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2718,6 +2718,7 @@ collect_garbage(Visitor &visitor) garbage_ = false; } +#ifndef DOXYGEN_RUNNING namespace collect_garbage_internal { struct Dummy_visitor{ template @@ -2726,6 +2727,7 @@ struct Dummy_visitor{ }; } +#endif template void diff --git a/Surface_mesh/include/CGAL/draw_surface_mesh.h b/Surface_mesh/include/CGAL/draw_surface_mesh.h index 3459392aec1..8dd25acd5b2 100644 --- a/Surface_mesh/include/CGAL/draw_surface_mesh.h +++ b/Surface_mesh/include/CGAL/draw_surface_mesh.h @@ -36,8 +36,58 @@ void draw(const SM& asm); #include #include #include -namespace CGAL +#include + +namespace CGAL { + +// Check if there are any color maps that could be used, random otherwise +template +struct Surface_mesh_basic_viewer_color_map + : DefaultColorFunctorFaceGraph { + using Base = DefaultColorFunctorFaceGraph; + + using SM = ::CGAL::Surface_mesh; + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using edge_descriptor = typename boost::graph_traits::edge_descriptor; + using face_descriptor = typename boost::graph_traits::face_descriptor; + + using vertex_colors = typename SM::template Property_map; + using edge_colors = typename SM::template Property_map; + using face_colors = typename SM::template Property_map; + + Surface_mesh_basic_viewer_color_map(const SM& amesh) + { + bool found = false; + std::tie(vcolors, found) = amesh.template property_map("v:color"); + std::tie(ecolors, found) = amesh.template property_map("e:color"); + std::tie(fcolors, found) = amesh.template property_map("f:color"); + CGAL_USE(found); + } + + CGAL::IO::Color operator()(const Surface_mesh& amesh, + const vertex_descriptor v) const + { + return vcolors ? get(vcolors, v) : Base::operator()(amesh, v); + } + + CGAL::IO::Color operator()(const Surface_mesh& amesh, + const edge_descriptor e) const + { + return ecolors ? get(ecolors, e) : Base::operator()(amesh, e); + } + + CGAL::IO::Color operator()(const Surface_mesh& amesh, + const face_descriptor f) const + { + return fcolors ? get(fcolors, f) : Base::operator()(amesh, f); + } + +private: + vertex_colors vcolors; + edge_colors ecolors; + face_colors fcolors; +}; // Specialization of draw function. template @@ -57,8 +107,8 @@ void draw(const Surface_mesh& amesh, int argc=1; const char* argv[2]={"surface_mesh_viewer", nullptr}; QApplication app(argc,const_cast(argv)); - SimpleFaceGraphViewerQt mainwindow(app.activeWindow(), amesh, title, - nofill); + SimpleFaceGraphViewerQt mainwindow(app.activeWindow(), amesh, title, nofill, + Surface_mesh_basic_viewer_color_map(amesh)); mainwindow.show(); app.exec(); } diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Doxyfile.in b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Doxyfile.in index 68d97d18eb7..3ae452842bf 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/Doxyfile.in +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/Doxyfile.in @@ -6,5 +6,3 @@ PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Triangulated Surface Mesh Approximati EXTRACT_ALL = false HIDE_UNDOC_MEMBERS = true HIDE_UNDOC_CLASSES = true - -EXCLUDE = ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Surface_mesh_approximation/internal diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h index ff9101e4f35..f7be5ec4a90 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h @@ -485,7 +485,7 @@ public: } /*! Check if the two curves are negihbors to the left of the event. */ - bool are_left_neighbours(Subcurve* c1, Subcurve* c2) + bool are_left_neighbors(Subcurve* c1, Subcurve* c2) { Subcurve_iterator left_iter = m_left_curves.begin(); for (; left_iter != m_left_curves.end(); ++left_iter) { @@ -506,6 +506,10 @@ public: return false; } + /*! \copydoc are_left_neighbors + * \deprecated please use #are_left_neighbors */ + CGAL_DEPRECATED bool are_left_neighbours(Subcurve* c1, Subcurve* c2) + { return are_left_neighbors(c1, c2); } #ifdef CGAL_SS_VERBOSE void Print() const; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index ff6e5caf280..52f2dde71b1 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -349,7 +349,7 @@ void Surface_sweep_2::_handle_right_curves() // If the two curves used to be neighbors before, we do not need to // intersect them again. - if (!this->m_currentEvent->are_left_neighbours(*currentOne, *prevOne)) + if (!this->m_currentEvent->are_left_neighbors(*currentOne, *prevOne)) _intersect(*prevOne, *currentOne); prevOne = currentOne; diff --git a/Tetrahedral_remeshing/doc/Tetrahedral_remeshing/Doxyfile.in b/Tetrahedral_remeshing/doc/Tetrahedral_remeshing/Doxyfile.in index a3841240c16..6b76fa680b1 100644 --- a/Tetrahedral_remeshing/doc/Tetrahedral_remeshing/Doxyfile.in +++ b/Tetrahedral_remeshing/doc/Tetrahedral_remeshing/Doxyfile.in @@ -5,5 +5,3 @@ PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Tetrahedral Remeshing" EXTRACT_ALL = false HIDE_UNDOC_CLASSES = true WARN_IF_UNDOCUMENTED = false - -EXCLUDE = ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Tetrahedral_remeshing/internal diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 0d68c959ccb..4c8fac7609c 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -417,7 +417,10 @@ private: if (!input_is_c3t3()) { for (int i = 0; i < 4; ++i) - cit->vertex(i)->set_dimension(3); + { + if (cit->vertex(i)->in_dimension() == -1) + cit->vertex(i)->set_dimension(3); + } } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG else if (input_is_c3t3() && m_c3t3.is_in_complex(cit)) @@ -446,7 +449,8 @@ private: for (int j = 0; j < 3; ++j) { Vertex_handle vij = f.first->vertex(Tr::vertex_triple_index(i, j)); - vij->set_dimension(2); + if (vij->in_dimension() == -1 || vij->in_dimension() > 2) + vij->set_dimension(2); } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbf; @@ -478,10 +482,12 @@ private: m_c3t3.add_to_complex(e, 1); Vertex_handle v = e.first->vertex(e.second); - v->set_dimension(1); + if (v->in_dimension() == -1 || v->in_dimension() > 1) + v->set_dimension(1); v = e.first->vertex(e.third); - v->set_dimension(1); + if (v->in_dimension() == -1 || v->in_dimension() > 1) + v->set_dimension(1); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbe; @@ -502,7 +508,8 @@ private: if(!m_c3t3.is_in_complex(vit)) m_c3t3.add_to_complex(vit, ++corner_id); - vit->set_dimension(0); + if (vit->in_dimension() == -1 || vit->in_dimension() > 0) + vit->set_dimension(0); vit->set_index(corner_id); diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index 353539b9fc9..1cd06e3afbf 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -269,12 +269,14 @@ public: const Point& p0 = *first; Point p = p0; Vertex_handle v0 = insert(p0), v(v0), w(v0); + Face_handle hint = v0->face(); ++first; for(; first!=last; ++first){ const Point& q = *first; if(p != q){ - w = insert(q); + w = insert(q,hint); insert_constraint(v,w); + hint = w->face(); v = w; p = q; } diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 042a4ca06c7..ac11e5182e2 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -307,11 +307,11 @@ public: #if 1 template - static const Point& get_source(const Segment_2& segment){ + static decltype(auto) get_source(const Segment_2& segment){ return segment.source(); } template - static const Point& get_target(const Segment_2& segment){ + static decltype(auto) get_target(const Segment_2& segment){ return segment.target(); } @@ -428,12 +428,14 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) const Point& p0 = *first; Point p = p0; Vertex_handle v0 = insert(p0), v(v0), w(v0); + Face_handle hint = v0->face(); ++first; for(; first!=last; ++first){ const Point& q = *first; if(p != q){ - w = insert(q); + w = insert(q,hint); insert_constraint(v,w); + hint = w->face(); v = w; p = q; } diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h index ccc193bad99..fe5d3b5a262 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h @@ -57,7 +57,6 @@ _test_cls_const_Del_triangulation(const Triangul&) typedef std::list list_constraints; CGAL_USE_TYPE(Gt); - CGAL_USE_TYPE(Segment); CGAL_USE_TYPE(Triangle); CGAL_USE_TYPE(Locate_type); @@ -81,6 +80,19 @@ _test_cls_const_Del_triangulation(const Triangul&) assert( T2.number_of_vertices() == 20); assert( T2.is_valid() ); +{ + // alternative build method + std::vector l; + for (int m=0; m<19; m++) + l.push_back(Segment(lpt[m],lpt[m+1])); + + Triangul T2_bis; + T2_bis.insert_constraints(l.begin(), l.end()); + assert( T2_bis.dimension() == 2 ); + assert( T2_bis.number_of_vertices() == 20); + assert( T2_bis.is_valid() ); +} + // test get_conflicts std:: cout << " get conflicts" << std::endl; std::list conflicts; diff --git a/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp b/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp index 0cd3828976c..a1852062240 100644 --- a/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp +++ b/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp @@ -22,6 +22,7 @@ #include +#include #include #include @@ -33,8 +34,10 @@ int main() std::cout << "Testing constrained_Delaunay_triangulation "<< std::endl; std::cout << " with No_constraint_intersection_requiring_constructions_tag : " << std::endl; typedef CGAL::Constrained_Delaunay_triangulation_2 CDt2; + typedef CGAL::Constrained_Delaunay_triangulation_2 EPECK_CDt2; _test_cls_const_Del_triangulation(CDt2()); + _test_cls_const_Del_triangulation(EPECK_CDt2()); //Testing insertion of a range of constraints std::vector points;