diff --git a/.github/install.sh b/.github/install.sh index e06328da401..32b8552aa8f 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -sudo add-apt-repository ppa:mikhailnov/pulseeffects -y sudo apt-get update sudo apt-get install -y libmpfr-dev \ libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \ diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index b15b2658b6c..3d2f2941c95 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -47,15 +47,7 @@ jobs: //get pullrequest url const pr_number = context.payload.issue.number return pr_number - - 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: Emoji-comment uses: actions/github-script@v6 if: steps.get_round.outputs.result != 'stop' @@ -67,6 +59,16 @@ 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 if: steps.get_round.outputs.result != 'stop' run: | @@ -151,11 +153,13 @@ jobs: }); - name: Post error + env: + ERRORMSG: ${{steps.build_and_run.outputs.DoxygenError}} uses: actions/github-script@v6 if: ${{ failure() && steps.get_round.outputs.result != 'stop' }} with: script: | - const error = "${{steps.build_and_run.outputs.DoxygenError}}" + const error = process.env.ERRORMSG const msg = "There was an error while building the doc: \n"+error github.rest.issues.createComment({ owner: "CGAL", diff --git a/AABB_tree/demo/AABB_tree/resources/about.html b/AABB_tree/demo/AABB_tree/resources/about.html index 8d2c41d1ea0..1ab9dc84c1b 100644 --- a/AABB_tree/demo/AABB_tree/resources/about.html +++ b/AABB_tree/demo/AABB_tree/resources/about.html @@ -2,8 +2,8 @@

AABB Tree Demo

Copyright ©2009 - INRIA Sophia Antipolis - Mediterranee

-

This application illustrates the AABB tree component + INRIA Sophia Antipolis - Mediterranee

+

This application illustrates the AABB tree component of CGAL, applied to polyhedron facets and edges.

See also the following chapters of the manual: diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h index 3e4d8ba7df9..c7f5e1325b2 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h @@ -370,19 +370,19 @@ namespace CGAL { coord_type K, min_K; const coord_type eps; const coord_type inv_eps_2; // 1/(eps^2) - const coord_type eps_3; // test de ^3 donc points tel 1e-7 soit petit + const coord_type eps_3; // tests using cubed eps so points such that 1e-7 is small const criteria STANDBY_CANDIDATE; const criteria STANDBY_CANDIDATE_BIS; const criteria NOT_VALID_CANDIDATE; //--------------------------------------------------------------------- - //Pour une visu correcte - //pour retenir les facettes selectionnees + // For a correct visualization + // to retain the selected facets int _vh_number; int _facet_number; //--------------------------------------------------------------------- - //Pour le post traitement + // For post-processing mutable int _postprocessing_counter; int _size_before_postprocessing; @@ -501,9 +501,8 @@ namespace CGAL { } //------------------------------------------------------------------- - // pour gerer certaines aretes interieures: a savoir celle encore connectee au - // bord (en fait seule, les aretes interieures reliant 2 bords nous - // interressent...) + // to handle certain interior edges, meaning those still connected to the boundary + // (actually, only the interior edges linking two boundaries are relevant) inline void set_interior_edge(Vertex_handle w, Vertex_handle v) { @@ -806,7 +805,7 @@ namespace CGAL { if ((number_of_facets() > static_cast(T.number_of_vertices()))&& (NB_BORDER_MAX > 0)) - // en principe 2*nb_sommets = nb_facettes: y a encore de la marge!!! + // in theory 2*vertices_n = facets_n: plenty of room!!! { while(postprocessing()){ extend2_timer.start(); @@ -1068,9 +1067,8 @@ namespace CGAL { //--------------------------------------------------------------------- bool is_interior_edge(const Edge_like& key) const - // pour gerer certaines aretes interieures: a savoir celle encore connectee au - // bord (en fait seule, les aretes interieures reliant 2 bords nous - // interressent...) + // to handle certain interior edges, meaning those still connected to the boundary + // (actually, only the interior edges linking two boundaries are relevant) { return (is_interior_edge(key.first, key.second)|| is_interior_edge(key.second, key.first)); @@ -1299,7 +1297,6 @@ namespace CGAL { #ifdef AFSR_LAZY value = lazy_squared_radius(cc); #else - // qualified with CGAL, to avoid a compilation error with clang if(volume(pp0, pp1, pp2, pp3) != 0){ value = T.geom_traits().compute_squared_radius_3_object()(pp0, pp1, pp2, pp3); } else { @@ -1337,7 +1334,6 @@ namespace CGAL { { value = compute_scalar_product(Vc, Vc) - ac*ac/norm_V; if ((value < 0)||(norm_V > inv_eps_2)){ - // qualified with CGAL, to avoid a compilation error with clang value = T.geom_traits().compute_squared_radius_3_object()(cp1, cp2, cp3); } } @@ -1365,7 +1361,7 @@ namespace CGAL { /// @} //--------------------------------------------------------------------- - // For a border edge e we determine the incident facet which has the highest + // For a border edge e, we determine the incident facet which has the highest // chance to be a natural extension of the surface Radius_edge_type @@ -1425,8 +1421,7 @@ namespace CGAL { P2Pn = construct_vector(p2, pn); v2 = construct_cross_product(P2P1,P2Pn); - //pas necessaire de normer pour un bon echantillon: - // on peut alors tester v1*v2 >= 0 + // no need to normalize for a correct sampling: one can then test v1*v2 >= 0 norm = sqrt(norm1 * compute_scalar_product(v2,v2)); pscal = v1*v2; // check if the triangle will produce a sliver on the surface @@ -1437,7 +1432,8 @@ namespace CGAL { if (tmp < min_valueA) { PnP1 = p1-pn; - // DELTA represente la qualite d'echantillonnage du bord + // DELTA encodes the quality of the border sampling + // // We skip triangles having an internal angle along e // whose cosinus is smaller than -DELTA // that is the angle is larger than arcos(-DELTA) @@ -1462,37 +1458,36 @@ namespace CGAL { if ((min_valueA == infinity()) || border_facet) // bad facets case { - min_facet = Facet(c, i); // !!! sans aucune signification.... - value = NOT_VALID_CANDIDATE; // Attention a ne pas inserer dans PQ + min_facet = Facet(c, i); // !!! without any meaning.... + value = NOT_VALID_CANDIDATE; // Do not insert in the PQ } else { min_facet = min_facetA; - //si on considere seulement la pliure value appartient a [0, 2] - //value = coord_type(1) - min_valueP; - - // si la pliure est bonne on note suivant le alpha sinon on prend en compte la - // pliure seule... pour discriminer entre les bons slivers... - // si on veut discriminer les facettes de bonnes pliures plus finement - // alors -(1+1/min_valueA) app a [-inf, -1] - // -min_valueP app a [-1, 1] + // If we only consider the fold value belongs to [0, 2] + // value = coord_type(1) - min_valueP; + // If the fold is OK, we rate based on the alpha value. Otherwise, take only the fold into account + // to discriminate between good slivers. + // + // If we wish to discriminate the facets with good folds more finely, + // then: + // -(1+1/min_valueA) is within [-inf, -1] + // -min_valueP is within [-1, 1] + // if (min_valueP > COS_BETA) value = -(coord_type(1) + coord_type(1)/min_valueA); else { - //on refuse une trop grande non-uniformite + // reject overly non-uniform values coord_type tmp = priority (*this, c, i); if (min_valueA <= K * tmp) value = - min_valueP; else { - value = STANDBY_CANDIDATE; // tres mauvais candidat mauvaise pliure - // + grand alpha... a traiter plus tard.... - min_K = - (std::min)(min_K, - min_valueA/tmp); + value = STANDBY_CANDIDATE; // extremely bad candidate, bad fold + large alpha; handle later + min_K = (std::min)(min_K, min_valueA/tmp); } } } @@ -1597,7 +1592,7 @@ namespace CGAL { } //--------------------------------------------------------------------- - // test de reciprocite avant de recoller une oreille anti-singularite + // reciprocity test before glueing anti-singularity ear int test_merge(const Edge_like& ordered_key, const Border_elt& result, const Vertex_handle& v, const coord_type& ear_alpha) @@ -1622,12 +1617,12 @@ namespace CGAL { coord_type norm = sqrt(compute_scalar_product(v1, v1) * compute_scalar_product(v2, v2)); if (v1*v2 > COS_BETA*norm) - return 1; // label bonne pliure sinon: + return 1; // mark as good fold if (ear_alpha <= K * priority(*this, neigh, n_ind)) - return 2; // label alpha coherent... + return 2; // mark alpha consistent - return 0; //sinon oreille a rejeter... + return 0; // ear to be rejected } @@ -1753,7 +1748,7 @@ namespace CGAL { Edge_like ordered_key(v1,v2); if (!is_border_elt(ordered_key, result12)) - std::cerr << "+++probleme coherence bord " << std::endl; + std::cerr << "+++issue with border consistency " << std::endl; bool is_border_el1 = is_border_elt(ordered_el1, result1), is_border_el2 = is_border_elt(ordered_el2, result2); @@ -1782,8 +1777,7 @@ namespace CGAL { return FINAL_CASE; } //--------------------------------------------------------------------- - //on peut alors marquer v1 et on pourrait essayer de merger - //sans faire de calcul inutile??? + // we can then mark v1 and could try to merge without any useless computation??? if (is_border_el1) { Edge_incident_facet edge_Ifacet_2(Edge(c, i, edge_Efacet.first.third), @@ -1796,7 +1790,7 @@ namespace CGAL { return EAR_CASE; } //--------------------------------------------------------------------- - //idem pour v2 + //idem for v2 if (is_border_el2) { Edge_incident_facet edge_Ifacet_1(Edge(c, i, edge_Efacet.first.second), @@ -1852,9 +1846,9 @@ namespace CGAL { // border incident to a point... _mark<1 even if th orientation // may be such as one vh has 2 successorson the same border... { - // a ce niveau on peut tester si le recollement se fait en - // maintenant la compatibilite d'orientation des bords (pour - // surface orientable...) ou si elle est brisee... + // at this level, we can test if glueing can be done while keeping + // compatible orientations for the borders (for an orientable surface...) + // or if it is broken Edge_incident_facet edge_Ifacet_1(Edge(c, i, edge_Efacet.first.second), edge_Efacet.second); Edge_incident_facet edge_Ifacet_2(Edge(c, i, edge_Efacet.first.third), @@ -1884,8 +1878,8 @@ namespace CGAL { Border_elt result_ear2; Edge_like ear1_e, ear2_e; - // pour maintenir la reconstruction d'une surface orientable : - // on verifie que les bords se recollent dans des sens opposes + // to preserve the reconstruction of an orientable surface, we check that + // borders glue to one another in opposite directions if (ordered_key.first==v1) { ear1_e = Edge_like(c->vertex(i), ear1_c ->vertex(ear1_i)); @@ -1897,7 +1891,7 @@ namespace CGAL { ear2_e = Edge_like(c->vertex(i), ear2_c ->vertex(ear2_i)); } - //maintient la surface orientable + // preserves orientability of the surface bool is_border_ear1 = is_ordered_border_elt(ear1_e, result_ear1); bool is_border_ear2 = is_ordered_border_elt(ear2_e, result_ear2); bool ear1_valid(false), ear2_valid(false); @@ -1931,8 +1925,7 @@ namespace CGAL { { Validation_case res = validate(ear1, e1.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing: case " << res << std::endl; e2 = compute_value(edge_Ifacet_2); if (ordered_key.first == v1) @@ -1948,8 +1941,7 @@ namespace CGAL { { Validation_case res = validate(ear2, e2.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing : case " << res << std::endl; e1 = compute_value(edge_Ifacet_1); if (ordered_key.first == v1) @@ -1962,25 +1954,23 @@ namespace CGAL { _ordered_border.insert(Radius_ptr_type(e1.first, p1)); } } - else// les deux oreilles ne se recollent pas sur la meme arete... + else // both ears do not glue on the same edge { - // on resoud la singularite. + // resolve the singularity if (ear1_valid) { Validation_case res = validate(ear1, e1.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing: case " << res << std::endl; } if (ear2_valid) { Validation_case res = validate(ear2, e2.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing : case " << res << std::endl; } - // on met a jour la PQ s'il y a lieu... mais surtout pas - // avant la resolution de la singularite + + // Update the PQ if needed, but not before resolving the singularity if (!ear1_valid) { _ordered_border.insert(Radius_ptr_type(e1.first, p1)); @@ -2020,7 +2010,7 @@ namespace CGAL { if (new_candidate.first == STANDBY_CANDIDATE) { - // a garder pour un K un peu plus grand... + // put aside for a slightly larger K new_candidate.first = STANDBY_CANDIDATE_BIS; } @@ -2042,8 +2032,8 @@ namespace CGAL { void extend() { - // initilisation de la variable globale K: qualite d'echantillonnage requise - K = K_init; // valeur d'initialisation de K pour commencer prudemment... + // Initialize the global variable K: required sampling quality + K = K_init; // initial value of K to start carefully coord_type K_prev = K; Vertex_handle v1, v2; @@ -2052,7 +2042,7 @@ namespace CGAL { } do { - min_K = infinity(); // pour retenir le prochain K necessaire pour progresser... + min_K = infinity(); // to store the next K required to progress do { @@ -2095,7 +2085,7 @@ namespace CGAL { { new_candidate = compute_value(mem_Ifacet); if ((new_candidate != mem_e_it)) - // &&(new_candidate.first < NOT_VALID_CANDIDATE)) + // &&(new_candidate.first < NOT_VALID_CANDIDATE)) { IO_edge_type* pnew = set_again_border_elt(key_tmp.first, key_tmp.second, @@ -2111,8 +2101,7 @@ namespace CGAL { (_ordered_border.begin()->first < STANDBY_CANDIDATE_BIS)); K_prev = K; K += (std::max)(K_step, min_K - K + eps); - // on augmente progressivement le K mais on a deja rempli sans - // faire des betises auparavant... + // Progressively increase K, but having already filled without issue beforehand } while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity())&&(K!=K_prev)); @@ -2125,9 +2114,8 @@ namespace CGAL { //--------------------------------------------------------------------- - // En principe, si l'allocateur de cellules etait bien fait on aurait pas besoin - // de mettre a jour les valeurs rajoutees pour les cellules a la main... - + // In theory, if the cell allocator were properly made, one would not need to manually update + // the values added for the cells void re_init_for_free_cells_cache(const Vertex_handle& vh) { @@ -2152,9 +2140,8 @@ namespace CGAL { int index = c->index(vh); Cell_handle neigh = c->neighbor(index); int n_ind = neigh->index(c); - neigh->set_smallest_radius(n_ind, -1); // pour obliger le recalcul - // si c est selectionnee c'est qu'elle est aussi le mem_IFacet renvoye par - // compute_value... donc a swapper aussi + neigh->set_smallest_radius(n_ind, -1); // forces recomputation + // if c is selected, then it is also the mem_IFacet returned by compute_value... so to be swapped too if (c->is_selected_facet(index)) { int fn = c->facet_number(index); @@ -2214,8 +2201,8 @@ namespace CGAL { circ = next(circ); } while(circ.first.first != c); - // si on passe par la, alors y a eu un probleme.... - std::cerr << "+++probleme dans la MAJ avant remove..." << std::endl; + // if we are here, something went wrong + std::cerr << "+++issue in the update before removal..." << std::endl; return Facet(c, start.second); } @@ -2237,7 +2224,7 @@ namespace CGAL { ordered_map_erase(border_elt.second.first.first, border_IO_elt(vh, vh_succ)); remove_border_edge(vh, vh_succ); - // 1- a virer au cas ou car vh va etre detruit + // 1- remove just in case since vh is about to be destroyed remove_interior_edge(vh_succ, vh); bool while_cond(true); do @@ -2266,14 +2253,14 @@ namespace CGAL { { ordered_map_erase(result.first.first, border_IO_elt(vh_int, vh)); remove_border_edge(vh_int, vh); - // 1- a virer au cas ou car vh va etre detruit + // 1- remove just in case since vh is about to be destroyed remove_interior_edge(vh_int, vh); while_cond = false; } - // a titre preventif... on essaye de s'assurer de marquer les aretes - // interieures au sens large... - // 2- a virer a tout pris pour que maintenir le sens de interior edge + // As a preventive measure, we try to ensure marking the interior edges in a broad sense + + // 2- remove to preserve the interior edge remove_interior_edge(vh_int, vh_succ); remove_interior_edge(vh_succ, vh_int); @@ -2304,16 +2291,16 @@ namespace CGAL { bool create_singularity(const Vertex_handle& vh) { - // Pour reperer le cas de triangle isole + // To detect the isolated triangle case if (vh->is_on_border()) { - // vh sommet 0 + // vh vertex 0 Next_border_elt border_elt = *(vh->first_incident()); - Vertex_handle vh_1 = border_elt.first;// sommet 1 + Vertex_handle vh_1 = border_elt.first;// vertex 1 border_elt = *(vh_1->first_incident()); - Vertex_handle vh_2 = border_elt.first;// sommet 2 + Vertex_handle vh_2 = border_elt.first;// vertex 2 border_elt = *(vh_2->first_incident()); - Vertex_handle vh_3 = border_elt.first;// sommet 0 ??? + Vertex_handle vh_3 = border_elt.first;// vertex 0 ??? Cell_handle c; int i, j, k; if ((vh_3 == vh)&&(T.is_facet(vh, vh_1, vh_2, c, i ,j ,k))) @@ -2328,7 +2315,7 @@ namespace CGAL { } - // Reperer le cas d'aretes interieures... + // Detect the interior edges case std::list vh_list; T.incident_vertices(vh, std::back_inserter(vh_list)); @@ -2402,9 +2389,9 @@ namespace CGAL { std::list L_v; - // Pour controler les sommets choisis sur le bord... + // To control vertices chosen on the boundary - // nombre d'aretes a partir duquel on considere que c'est irrecuperable NB_BORDER_MAX + // NB_BORDER_MAX: number of edges from which we consider that things are irrecoverable int vh_on_border_inserted(0); for(Finite_vertices_iterator v_it = T.finite_vertices_begin(); @@ -2445,7 +2432,7 @@ namespace CGAL { std::size_t itmp, L_v_size_mem; L_v_size_mem = L_v.size(); - if ((vh_on_border_inserted != 0)&& // pour ne post-traiter que les bords + if ((vh_on_border_inserted != 0)&& // to post-process only the borders (L_v.size() < .1 * _size_before_postprocessing)) { { @@ -2460,7 +2447,7 @@ namespace CGAL { } #ifdef VERBOSE if(L_v.size() > 0){ - std::cout << " " << L_v.size() << " non regular points." << std::endl; + std::cout << " " << L_v.size() << " non-regular points." << std::endl; } #endif // VERBOSE re_compute_values(); @@ -2469,7 +2456,7 @@ namespace CGAL { postprocess_timer.stop(); return false; } - // we stop if we removed more than 10% of points or after 20 rounds + // we stop if we removed more than 10% of points, or after 20 rounds if ((L_v_size_mem == L_v.size())|| ((_size_before_postprocessing - T.number_of_vertices()) > .1 * _size_before_postprocessing)|| @@ -2479,7 +2466,6 @@ namespace CGAL { } min_K = infinity(); - // fin-- // if (_postprocessing_counter < 5) // return true; postprocess_timer.stop(); diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h index a8c2bf4b2b4..bbecac5c757 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h @@ -220,7 +220,7 @@ namespace CGAL { else { if (m_incident_border->second->first != nullptr) - std::cerr << "+++probleme de MAJ du bord " << std::endl; + std::cerr << "+++issue while updating border " << std::endl; *m_incident_border->second = elt; } } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index 9e2c0398fe2..d385b481a33 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -356,10 +356,10 @@ public: const OuterFunctor& outer) : _inner(inner), _outer(outer) {} - Unary_compose(const Unary_compose& other) - : _inner(other._inner), _outer(other._outer) {} + Unary_compose(const Unary_compose& other) = default; + Unary_compose& operator=(const Unary_compose& other) = default; - Unary_compose() : _inner(::boost::none),_outer(::boost::none) {} + Unary_compose() : _inner(::boost::none),_outer(::boost::none) {} typedef typename InnerFunctor::argument_type argument_type; typedef typename OuterFunctor::result_type result_type; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h index 19f447c08f2..18b7fa805dd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h @@ -45,7 +45,7 @@ namespace internal { * @Unpublished{abbott-quadratic, * author = {John Abbott}, * title = {Quadratic Interval Refinement for Real Roots}, - * url = {http://www.dima.unige.it/~abbott/}, + * url = {https://www.dima.unige.it/~abbott/}, * note = {Poster presented at the 2006 Internat. Sympos. on Symbolic and Algebraic Computation (ISSAC 2006)} * } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h index f1f45aab56c..974e26d0a57 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h @@ -1147,8 +1147,8 @@ public: Bitstream_descartes() : Base(new Rep()) {} //! Copy constructor - Bitstream_descartes(const Self& other) : Base(static_cast(other)) - {} + Bitstream_descartes(const Self& other) = default; + Bitstream_descartes& operator=(const Self& other) = default; /*! * \brief Constructor for a polynomial \c f diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h index d78d50acfd0..50ae06acee9 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h @@ -436,6 +436,9 @@ public: friend class CGAL::internal::Bitstream_descartes_E08_tree; friend class CGAL::internal::Bitstream_descartes_E08_tree_rep; + Bitstream_descartes_E08_node(const Self&) = default; + Self& operator= (const Self&) = delete; + private: // "node data" (set individually in subdivision) Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead @@ -466,8 +469,6 @@ private: log_eps_ = n.log_eps_; log_C_eps_ = n.log_C_eps_; } - - Self& operator= (const Self&) = delete; }; // struct Bitstream_descartes_E08_node diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h index 869b758cb12..9d1084414cd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h @@ -525,6 +525,9 @@ public: friend class internal::Bitstream_descartes_rndl_tree; friend class internal::Bitstream_descartes_rndl_tree_rep; + Bitstream_descartes_rndl_node(const Self&) = default; + Self& operator= (const Self&) = delete; + private: // "node data" (set individually in subdivision) Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead @@ -557,8 +560,6 @@ private: log_eps_ = n.log_eps_; log_C_eps_ = n.log_C_eps_; } - - Self& operator= (const Self&)=delete; }; // struct Bitstream_descartes_rndl_node diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h index b79e47262b3..ce3d7b3fda1 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h @@ -187,7 +187,7 @@ void test_real_root_isolator() { assert( n == number_of_roots); }{ //std::cout << "Kameny 3\n"; - // from http://www-sop.inria.fr/saga/POL/BASE/1.unipol + // from https://www-sop.inria.fr/saga/POL/BASE/1.unipol/ NT c = CGAL::ipower(NT(10),12); Polynomial P(NT(-3),NT(0),c); @@ -202,7 +202,7 @@ void test_real_root_isolator() { assert(3 == internal::check_intervals_real_root_isolator(P)); }{ //std::cout << "Kameny 4\n"; - // from http://www-sop.inria.fr/saga/POL/BASE/1.unipol + // from https://www-sop.inria.fr/saga/POL/BASE/1.unipol NT z(0); NT a = CGAL::ipower(NT(10),24); // a = 10^{24} @@ -218,7 +218,7 @@ void test_real_root_isolator() { assert( 4 == internal::check_intervals_real_root_isolator(P)); }{ //std::cout << "Polynomial with large and small clustered roots\n"; - // from http://www-sop.inria.fr/saga/POL/BASE/1.unipol + // from https://www-sop.inria.fr/saga/POL/BASE/1.unipol // there seems to be some error or misunderstanding NT z(0); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp index 2de4a0d6e28..ee1772a644b 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp @@ -19,7 +19,7 @@ ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements - ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -31,7 +31,7 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be - ** met: http://www.gnu.org/copyleft/gpl.html. + ** met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h index 13c6c13b06e..ea1a2ba7a47 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h @@ -19,7 +19,7 @@ ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements - ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -31,7 +31,7 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be - ** met: http://www.gnu.org/copyleft/gpl.html. + ** met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h index f95817735da..5ad5f86b400 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h @@ -316,7 +316,7 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const // face) we check the isolated vertices inside the face to check whether there // is an isolated vertex right above/below the query point. // -template +template typename Arr_trapezoid_ric_point_location::result_type Arr_trapezoid_ric_point_location:: _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, @@ -324,40 +324,36 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, bool shoot_up, const Td_map_item& tr) const { + const auto* gt = this->arrangement()->geometry_traits(); const Comparison_result point_above_under = (shoot_up ? SMALLER : LARGER); - typename Geometry_traits_2::Compare_x_2 compare_x = - this->arrangement()->traits()->compare_x_2_object(); - typename Geometry_traits_2::Compare_xy_2 compare_xy = - this->arrangement()->traits()->compare_xy_2_object(); - typename Geometry_traits_2::Compare_y_at_x_2 compare_y_at_x = - this->arrangement()->traits()->compare_y_at_x_2_object(); + auto compare_x = gt->compare_x_2_object(); + auto compare_xy = gt->compare_xy_2_object(); + auto compare_y_at_x = gt->compare_y_at_x_2_object(); - Isolated_vertex_const_iterator iso_verts_it; - Vertex_const_handle closest_iso_v; - const Vertex_const_handle invalid_v; - const Halfedge_const_handle invalid_he; - Face_const_handle face; + Vertex_const_handle closest_iso_v; + const Vertex_const_handle invalid_v; + const Halfedge_const_handle invalid_he; // If the closest feature is a valid halfedge, take its incident face. // Otherwise, take the unbounded face. - if (halfedge_found == invalid_he) - face = _get_unbounded_face(tr, p, All_sides_oblivious_category()); - else - face = halfedge_found->face(); + Face_const_handle face = (halfedge_found == invalid_he) ? + _get_unbounded_face(tr, p, All_sides_oblivious_category()) : + halfedge_found->face(); // Go over the isolated vertices in the face. + // The following statement pacifies MSVC. Without it the implicit conversion + // from the iterator to the corresponding handle fails! + Isolated_vertex_const_iterator iso_verts_it; for (iso_verts_it = face->isolated_vertices_begin(); iso_verts_it != face->isolated_vertices_end(); ++iso_verts_it) { // The current isolated vertex should have the same x-coordinate as the // query point in order to be below or above it. - if (compare_x (p, iso_verts_it->point()) != EQUAL) - continue; + if (compare_x (p, iso_verts_it->point()) != EQUAL) continue; // Make sure the isolated vertex is above the query point (if we shoot up) // or below it (if we shoot down). - if (compare_xy (p, iso_verts_it->point()) != point_above_under) - continue; + if (compare_xy (p, iso_verts_it->point()) != point_above_under) continue; // Check if the current isolated vertex lies closer to the query point than // the closest feature so far. @@ -379,12 +375,10 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, // If we found an isolated vertex above (or under) the query point, return // a handle to this vertex. - if (closest_iso_v != invalid_v) - return make_result(closest_iso_v); + if (closest_iso_v != invalid_v) return make_result(closest_iso_v); // If we are inside the unbounded face, return this face. - if (halfedge_found == invalid_he) - return make_result(face); + if (halfedge_found == invalid_he) return make_result(face); // Return the halfedge lying above (or below) the query point. return make_result(halfedge_found); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h index ca5e8ce1447..dab9ffa9248 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h @@ -1114,7 +1114,7 @@ public: // model of this concept. // // The following implementation is inspired by - // http://stackoverflow.com/a/11816999/1915421 + // https://stackoverflow.com/a/11816999/1915421 template struct Void { diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h index 0a89ec038a3..5fd87bc4e7b 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h @@ -164,7 +164,7 @@ enum Fig_depth /*! * \class A class for writing geometric objects in a FIG format (version 3.2). - * For more details, see: http://www.xfig.org/userman/fig-format.html + * For more details, see: https://mcj.sourceforge.net/ */ template class Fig_stream diff --git a/BGL/examples/BGL_LCC/normals_lcc.cpp b/BGL/examples/BGL_LCC/normals_lcc.cpp index c5d1e671ff0..da1177a7062 100644 --- a/BGL/examples/BGL_LCC/normals_lcc.cpp +++ b/BGL/examples/BGL_LCC/normals_lcc.cpp @@ -74,7 +74,7 @@ int main(int argc, char** argv) // Ad hoc property_map to store normals. Face_index_map is used to // map face_descriptors to a contiguous range of indices. See - // http://www.boost.org/libs/property_map/doc/vector_property_map.html + // https://www.boost.org/libs/property_map/doc/vector_property_map.html // for details. boost::vector_property_map normals(static_cast(num_faces(lcc)), get(CGAL::face_index, lcc)); diff --git a/BGL/examples/BGL_polyhedron_3/normals.cpp b/BGL/examples/BGL_polyhedron_3/normals.cpp index 9a67ba42b2d..711800cb8ab 100644 --- a/BGL/examples/BGL_polyhedron_3/normals.cpp +++ b/BGL/examples/BGL_polyhedron_3/normals.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) // Ad hoc property_map to store normals. Face_index_map is used to // map face_descriptors to a contiguous range of indices. See - // http://www.boost.org/libs/property_map/doc/vector_property_map.html + // https://www.boost.org/libs/property_map/doc/vector_property_map.html // for details. boost::vector_property_map normals(static_cast(num_faces(P)), get(CGAL::face_index, P)); diff --git a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h index a6e5bfe287d..5127f692a24 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h @@ -11,7 +11,7 @@ #ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H #define CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H -// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html +// https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02182.html #include #include #include diff --git a/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h index 863dc50b075..512a4991e76 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h @@ -11,7 +11,7 @@ #ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H #define CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H -// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html +// https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02182.html #include #include #include diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 303ab8c9ba1..b70872a7334 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -335,10 +335,10 @@ struct Point_set_processing_3_np_helper return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map() + static constexpr bool has_normal_map(const PointRange&, const NamedParameters&) { - return !std::is_same< typename internal_np::Get_param::type, - internal_np::Param_not_found> ::value; + using CGAL::parameters::is_default_parameter; + return !(is_default_parameter::value); } }; diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index 0740602e64f..861f5aea98b 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -130,16 +130,16 @@ public: }; -template +template class OM_edge_weight_pmap { public: typedef boost::readable_property_map_tag category; - typedef typename OpenMesh::Scalar value_type; + typedef typename OM_Mesh::Scalar value_type; typedef value_type reference; - typedef typename boost::graph_traits::edge_descriptor key_type; + typedef typename boost::graph_traits::edge_descriptor key_type; - OM_edge_weight_pmap(const OpenMesh& sm) + OM_edge_weight_pmap(const OM_Mesh& sm) : sm_(sm) {} @@ -151,7 +151,7 @@ public: friend inline value_type get(const OM_edge_weight_pmap& m, const key_type& k) { return m[k]; } private: - const OpenMesh& sm_; + const OM_Mesh& sm_; }; template @@ -175,26 +175,26 @@ public: }; -template +template class OM_point_pmap { public: #if defined(CGAL_USE_OM_POINTS) typedef boost::lvalue_property_map_tag category; - typedef typename OpenMesh::Point value_type; - typedef const typename OpenMesh::Point& reference; + typedef typename OM_Mesh::Point value_type; + typedef const typename OM_Mesh::Point& reference; #else typedef boost::read_write_property_map_tag category; typedef P value_type; typedef P reference; #endif - typedef typename boost::graph_traits::vertex_descriptor key_type; + typedef typename boost::graph_traits::vertex_descriptor key_type; OM_point_pmap() : sm_(nullptr) {} - OM_point_pmap(const OpenMesh& sm) + OM_point_pmap(const OM_Mesh& sm) : sm_(&sm) {} @@ -208,36 +208,37 @@ public: return sm_->point(v); #else CGAL_assertion(sm_!=nullptr); - typename OpenMesh::Point const& omp = sm_->point(v); + typename OM_Mesh::Point const& omp = sm_->point(v); return value_type(omp[0], omp[1], omp[2]); #endif } - inline friend reference get(const OM_point_pmap& pm, key_type v) + inline friend reference get(const OM_point_pmap& pm, key_type v) { CGAL_precondition(pm.sm_!=nullptr); #if defined(CGAL_USE_OM_POINTS) return pm.sm_->point(v); #else CGAL_assertion(pm.sm_!=nullptr); - typename OpenMesh::Point const& omp = pm.sm_->point(v); + typename OM_Mesh::Point const& omp = pm.sm_->point(v); return value_type(omp[0], omp[1], omp[2]); #endif } - inline friend void put(const OM_point_pmap& pm, key_type v, const value_type& p) + inline friend void put(const OM_point_pmap& pm, key_type v, const value_type& p) { CGAL_precondition(pm.sm_!=nullptr); #if defined(CGAL_USE_OM_POINTS) - const_cast(*pm.sm_).set_point(v,p); + const_cast(*pm.sm_).set_point(v,p); #else - const_cast(*pm.sm_).set_point - (v, typename OpenMesh::Point((float)p[0], (float)p[1], (float)p[2])); + typedef typename OpenMesh::vector_traits::value_type Scalar; + const_cast(*pm.sm_).set_point + (v, typename OM_Mesh::Point(Scalar(p[0]), Scalar(p[1]), Scalar(p[2]))); #endif } private: - const OpenMesh* sm_; + const OM_Mesh* sm_; }; } // CGAL #endif // CGAL_BOOST_GRAPH_PROPERTIES_OPENMESH_H diff --git a/BGL/include/CGAL/boost/graph/selection.h b/BGL/include/CGAL/boost/graph/selection.h index b0ea97d89dd..46f36e27839 100644 --- a/BGL/include/CGAL/boost/graph/selection.h +++ b/BGL/include/CGAL/boost/graph/selection.h @@ -543,7 +543,7 @@ regularize_face_selection_borders( (face_index_map)); for (mesh_face_descriptor fd : faces(mesh)) - put(is_selected, fd, graph.labels[get(face_index_map,fd)]); + put(is_selected, fd, (graph.labels[get(face_index_map,fd)] != 0)); } /// \cond SKIP_IN_MANUAL diff --git a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt index 547eb21203d..d5d5974e3b3 100644 --- a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Barycentric_coordinates_2_Examples) - cmake_minimum_required(VERSION 3.1...3.23) +project(Barycentric_coordinates_2_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("segment_coordinates.cpp") diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h index 8e7efbd5fc3..164861dc6aa 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h @@ -587,8 +587,7 @@ namespace Barycentric_coordinates { const auto& p0 = m_domain.vertex(neighbors[jm]); const auto& p1 = m_domain.vertex(neighbors[j]); const auto& p2 = m_domain.vertex(neighbors[jp]); - const FT w = -Weights::cotangent_weight( - p0, p1, p2, query, m_traits) / FT(2); + const FT w = -Weights::cotangent_weight(p0, p1, p2, query, m_traits) / FT(2); W -= w; if (m_domain.is_on_boundary(idx)) { diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt index 8dfd74dd75c..8884394ec83 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Barycentric_coordinates_2_Tests) - cmake_minimum_required(VERSION 3.1...3.23) +project(Barycentric_coordinates_2_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("test_almost_degenerate_segment.cpp") diff --git a/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h b/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h index d986acfd860..d1c2305c2dd 100644 --- a/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h +++ b/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h @@ -58,7 +58,7 @@ public: {} /*! Constructor with traits object. */ - Polygon_set_2 (Traits_2& tr) : + Polygon_set_2 (const Traits_2& tr) : Base(tr) {} diff --git a/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h b/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h index c3dcc29c393..e30576790c5 100644 --- a/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h +++ b/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h @@ -42,7 +42,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static double result() { @@ -55,7 +55,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static float result() { @@ -68,7 +68,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static double result() { @@ -81,7 +81,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static float result() { diff --git a/CGAL_Core/include/CGAL/CORE/BigFloat.h b/CGAL_Core/include/CGAL/CORE/BigFloat.h index 97183f63e50..6c7a8abff4c 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloat.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloat.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigFloatRep.h b/CGAL_Core/include/CGAL/CORE/BigFloatRep.h index 7439ce025a9..da8cb6967c8 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloatRep.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloatRep.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h b/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h index aa029b5c51b..dc828ae9379 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h @@ -23,7 +23,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigInt.h b/CGAL_Core/include/CGAL/CORE/BigInt.h index 7b16a960ac3..f88a5877c9b 100644 --- a/CGAL_Core/include/CGAL/CORE/BigInt.h +++ b/CGAL_Core/include/CGAL/CORE/BigInt.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigRat.h b/CGAL_Core/include/CGAL/CORE/BigRat.h index 29b99509d40..d57e4e44cd9 100644 --- a/CGAL_Core/include/CGAL/CORE/BigRat.h +++ b/CGAL_Core/include/CGAL/CORE/BigRat.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CORE.h b/CGAL_Core/include/CGAL/CORE/CORE.h index 3fb78af5f83..a3e0b2ef83d 100644 --- a/CGAL_Core/include/CGAL/CORE/CORE.h +++ b/CGAL_Core/include/CGAL/CORE/CORE.h @@ -15,7 +15,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreAux.h b/CGAL_Core/include/CGAL/CORE/CoreAux.h index 9d75668be3a..fdb6c5de7cf 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreAux.h +++ b/CGAL_Core/include/CGAL/CORE/CoreAux.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h b/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h index 3f22a4cdfa1..9b335c393b2 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h @@ -15,7 +15,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs.h b/CGAL_Core/include/CGAL/CORE/CoreDefs.h index 57c3da34645..e10ea21ec1a 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs.h @@ -17,7 +17,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h index d28326496f3..ecc29261130 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h b/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h index 0e4a2044e74..59f4a7a63f6 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h @@ -11,7 +11,7 @@ * Zilin Du * Chee Yap * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Expr.h b/CGAL_Core/include/CGAL/CORE/Expr.h index 5cd5092d7e9..94b086e24d3 100644 --- a/CGAL_Core/include/CGAL/CORE/Expr.h +++ b/CGAL_Core/include/CGAL/CORE/Expr.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/ExprRep.h b/CGAL_Core/include/CGAL/CORE/ExprRep.h index 7920485fff7..bc142c77b6c 100644 --- a/CGAL_Core/include/CGAL/CORE/ExprRep.h +++ b/CGAL_Core/include/CGAL/CORE/ExprRep.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Expr_impl.h b/CGAL_Core/include/CGAL/CORE/Expr_impl.h index 5e3806024fa..69ccc73b616 100644 --- a/CGAL_Core/include/CGAL/CORE/Expr_impl.h +++ b/CGAL_Core/include/CGAL/CORE/Expr_impl.h @@ -16,7 +16,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Filter.h b/CGAL_Core/include/CGAL/CORE/Filter.h index ea0a02da1fa..56649b80c86 100644 --- a/CGAL_Core/include/CGAL/CORE/Filter.h +++ b/CGAL_Core/include/CGAL/CORE/Filter.h @@ -17,7 +17,7 @@ * Zilin Du * Chee Yap * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/MemoryPool.h b/CGAL_Core/include/CGAL/CORE/MemoryPool.h index 606b9223b2b..60a95c862e2 100644 --- a/CGAL_Core/include/CGAL/CORE/MemoryPool.h +++ b/CGAL_Core/include/CGAL/CORE/MemoryPool.h @@ -14,7 +14,7 @@ * Chee Yap * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Promote.h b/CGAL_Core/include/CGAL/CORE/Promote.h index 62a98e434ef..d882b6abcf3 100644 --- a/CGAL_Core/include/CGAL/CORE/Promote.h +++ b/CGAL_Core/include/CGAL/CORE/Promote.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Real.h b/CGAL_Core/include/CGAL/CORE/Real.h index b79503eb4c2..11174960dd2 100644 --- a/CGAL_Core/include/CGAL/CORE/Real.h +++ b/CGAL_Core/include/CGAL/CORE/Real.h @@ -18,7 +18,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/RealRep.h b/CGAL_Core/include/CGAL/CORE/RealRep.h index 5a18d2748d1..85f7818a884 100644 --- a/CGAL_Core/include/CGAL/CORE/RealRep.h +++ b/CGAL_Core/include/CGAL/CORE/RealRep.h @@ -16,7 +16,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Real_impl.h b/CGAL_Core/include/CGAL/CORE/Real_impl.h index 8a6a4899c64..e7ac7379f4c 100644 --- a/CGAL_Core/include/CGAL/CORE/Real_impl.h +++ b/CGAL_Core/include/CGAL/CORE/Real_impl.h @@ -17,7 +17,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/RefCount.h b/CGAL_Core/include/CGAL/CORE/RefCount.h index 91fafbf074f..ba1c8416a4b 100644 --- a/CGAL_Core/include/CGAL/CORE/RefCount.h +++ b/CGAL_Core/include/CGAL/CORE/RefCount.h @@ -35,7 +35,7 @@ * Zilin Du * Chee Yap * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Timer.h b/CGAL_Core/include/CGAL/CORE/Timer.h index a0f2ce9f152..0e998c0b020 100644 --- a/CGAL_Core/include/CGAL/CORE/Timer.h +++ b/CGAL_Core/include/CGAL/CORE/Timer.h @@ -23,7 +23,7 @@ * Written by * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/extLong.h b/CGAL_Core/include/CGAL/CORE/extLong.h index d20caf05589..52ba91e321a 100644 --- a/CGAL_Core/include/CGAL/CORE/extLong.h +++ b/CGAL_Core/include/CGAL/CORE/extLong.h @@ -17,7 +17,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/extLong_impl.h b/CGAL_Core/include/CGAL/CORE/extLong_impl.h index 0baeb58fbcd..69d92131839 100644 --- a/CGAL_Core/include/CGAL/CORE/extLong_impl.h +++ b/CGAL_Core/include/CGAL/CORE/extLong_impl.h @@ -21,7 +21,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/linearAlgebra.h b/CGAL_Core/include/CGAL/CORE/linearAlgebra.h index 16da34e461a..3d760cc629b 100644 --- a/CGAL_Core/include/CGAL/CORE/linearAlgebra.h +++ b/CGAL_Core/include/CGAL/CORE/linearAlgebra.h @@ -22,7 +22,7 @@ * Written by * Shubin Zhao (shubinz@cs.nyu.edu) (2001) * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $Id$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Curves.h b/CGAL_Core/include/CGAL/CORE/poly/Curves.h index 65d1422d255..f1c9172e3e9 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Curves.h +++ b/CGAL_Core/include/CGAL/CORE/poly/Curves.h @@ -49,7 +49,7 @@ * Author: Vikram Sharma and Chee Yap * Date: April 12, 2004 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc index d9be84796c0..f21ddfec3a8 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc +++ b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc @@ -16,7 +16,7 @@ * Author: Vikram Sharma and Chee Yap * Date: April 12, 2004 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Poly.h b/CGAL_Core/include/CGAL/CORE/poly/Poly.h index bd56376a5b2..50ec728b685 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Poly.h +++ b/CGAL_Core/include/CGAL/CORE/poly/Poly.h @@ -36,7 +36,7 @@ * Author: Chee Yap * Date: May 28, 2002 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc b/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc index 325f64d528c..604a86ad6e1 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc +++ b/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc @@ -30,7 +30,7 @@ * Author: Chee Yap, Sylvain Pion and Vikram Sharma * Date: May 28, 2002 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Sturm.h b/CGAL_Core/include/CGAL/CORE/poly/Sturm.h index 57fe5b26b7f..77ceab8c9ae 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Sturm.h +++ b/CGAL_Core/include/CGAL/CORE/poly/Sturm.h @@ -37,7 +37,7 @@ * Author: Chee Yap and Sylvain Pion, Vikram Sharma * Date: July 20, 2002 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/export/CORE.h b/CGAL_Core/include/CGAL/export/CORE.h index 440239528a1..651387e610d 100644 --- a/CGAL_Core/include/CGAL/export/CORE.h +++ b/CGAL_Core/include/CGAL/export/CORE.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_ImageIO/include/CGAL/ImageIO.h b/CGAL_ImageIO/include/CGAL/ImageIO.h index 9c6b4281cc6..26ada2cfd76 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO.h @@ -24,7 +24,7 @@ #ifdef CGAL_USE_ZLIB #include -/* see http://www.gzip.org/zlib/ +/* see https://zlib.net/ for details and documentation */ #endif @@ -342,8 +342,8 @@ CGAL_IMAGEIO_EXPORT _image *_createImage(std::size_t x, std::size_t y, std::size GIS (CEA, IRISA, ENST 3D image format). See also: - http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html and - http://www.gzip.org/zlib/ + https://www.martinreddy.net/gfx/2d-hi.html and + https://zlib.net/ @param name image file name or nullptr for stdin */ diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/convert.h b/CGAL_ImageIO/include/CGAL/ImageIO/convert.h index 4cb73637c49..0119d73736d 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/convert.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/convert.h @@ -19,7 +19,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h b/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h index 4fba58fb19b..9e35ebd637b 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h @@ -23,7 +23,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/recline.h b/CGAL_ImageIO/include/CGAL/ImageIO/recline.h index b8ae7b398a3..588bd8d6434 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/recline.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/recline.h @@ -23,7 +23,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h b/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h index c4c612cc6e3..a77de031f64 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h @@ -19,7 +19,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt b/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt index e5c3467650f..922e4e8f9bd 100644 --- a/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt +++ b/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt @@ -9,7 +9,7 @@ namespace CGAL { \section CGAL_ipeletsIntroduction Introduction -The Ipe extensible drawing editor (http://ipe.otfried.org) \cgalCite{schwarzkopf1995ede}, \cgalCite{ipe:man-09} +The Ipe extensible drawing editor (https://ipe.otfried.org/) \cgalCite{schwarzkopf1995ede}, \cgalCite{ipe:man-09} is a tool used by computational geometry researchers to produce 2D figures for inclusion in articles or presentations. The extensible adjective sheds a light on an important feature: the possibility for users to write small extensions (called ipelets) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index a93004ad293..737a52dfc14 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -17,6 +17,7 @@ #ifndef CGAL_CARTESIAN_FUNCTION_OBJECTS_H #define CGAL_CARTESIAN_FUNCTION_OBJECTS_H +#include #include #include #include @@ -445,14 +446,14 @@ namespace CartesianKernelFunctors { } template - result_type + Needs_FT operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - result_type + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -591,14 +592,14 @@ namespace CartesianKernelFunctors { } template - result_type + Needs_FT operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - result_type + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -668,28 +669,34 @@ namespace CartesianKernelFunctors { result_type operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const { - return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z(), - s.x(), s.y(), s.z() ), - ft); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + s.x(), s.y(), s.z(), + num, den); + return CGAL::compare(num, den * ft); } result_type operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const { - return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z()), - ft); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + num, den); + return CGAL::compare(num, den * ft); } result_type operator()(const Point_3& p, const Point_3& q, const FT& ft) const { - return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z() ), - ft); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + num, den); + return CGAL::compare(num, den * ft); } result_type @@ -1234,26 +1241,35 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q) const { - return squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z()); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + num, den); + return num / den; } result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r) const { - return squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z()); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + num, den); + return num / den; } result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { - return squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z(), - s.x(), s.y(), s.z()); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + s.x(), s.y(), s.z(), + num, den); + return num / den; } }; @@ -2505,7 +2521,7 @@ namespace CartesianKernelFunctors { FT rsy = psz*qsx-psx*qsz; FT rsz = psx*qsy-psy*qsx; - // The following determinants can be developped and simplified. + // The following determinants can be developed and simplified. // // FT num_x = determinant(psy,psz,ps2, // qsy,qsz,qs2, @@ -3961,7 +3977,7 @@ namespace CartesianKernelFunctors { operator()(const Circle_3 &a, const Point_3 &p) const { return a.rep().has_on(p); } - result_type + Needs_FT operator()(const Sphere_3 &a, const Circle_3 &p) const { return a.rep().has_on(p); } @@ -4205,8 +4221,7 @@ namespace CartesianKernelFunctors { public: typedef typename K::Orientation result_type; - result_type - operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h index 77fe5d05e7c..dbc973138c5 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h @@ -142,11 +142,12 @@ centroidC3( const FT &px, const FT &py, const FT &pz, template < class FT > CGAL_KERNEL_MEDIUM_INLINE -FT +void squared_radiusC3(const FT &px, const FT &py, const FT &pz, - const FT &qx, const FT &qy, const FT &qz, - const FT &rx, const FT &ry, const FT &rz, - const FT &sx, const FT &sy, const FT &sz) + const FT &qx, const FT &qy, const FT &qz, + const FT &rx, const FT &ry, const FT &rz, + const FT &sx, const FT &sy, const FT &sz, + FT &num, FT &den) { // Translate p to origin to simplify the expression. FT qpx = qx-px; @@ -163,29 +164,30 @@ squared_radiusC3(const FT &px, const FT &py, const FT &pz, FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz); FT num_x = determinant(qpy,qpz,qp2, - rpy,rpz,rp2, - spy,spz,sp2); + rpy,rpz,rp2, + spy,spz,sp2); FT num_y = determinant(qpx,qpz,qp2, - rpx,rpz,rp2, - spx,spz,sp2); + rpx,rpz,rp2, + spx,spz,sp2); FT num_z = determinant(qpx,qpy,qp2, - rpx,rpy,rp2, - spx,spy,sp2); - FT den = determinant(qpx,qpy,qpz, - rpx,rpy,rpz, - spx,spy,spz); - CGAL_kernel_assertion( ! CGAL_NTS is_zero(den) ); + rpx,rpy,rp2, + spx,spy,sp2); + FT dden = determinant(qpx,qpy,qpz, + rpx,rpy,rpz, + spx,spy,spz); + CGAL_kernel_assertion( ! CGAL_NTS is_zero(dden) ); - return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) - + CGAL_NTS square(num_z)) / CGAL_NTS square(2 * den); + num = CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z); + den = CGAL_NTS square(2 * dden); } template < class FT > CGAL_KERNEL_MEDIUM_INLINE -FT +void squared_radiusC3(const FT &px, const FT &py, const FT &pz, - const FT &qx, const FT &qy, const FT &qz, - const FT &sx, const FT &sy, const FT &sz) + const FT &qx, const FT &qy, const FT &qz, + const FT &sx, const FT &sy, const FT &sz, + FT &num, FT &den) { // Translate s to origin to simplify the expression. FT psx = px-sx; @@ -207,14 +209,14 @@ squared_radiusC3(const FT &px, const FT &py, const FT &pz, FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy) - qs2 * determinant(psx,psy,rsx,rsy); - FT den = determinant(psx,psy,psz, - qsx,qsy,qsz, - rsx,rsy,rsz); + FT dden = determinant(psx,psy,psz, + qsx,qsy,qsz, + rsx,rsy,rsz); - CGAL_kernel_assertion( den != 0 ); + CGAL_kernel_assertion( dden != 0 ); - return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) - + CGAL_NTS square(num_z)) / CGAL_NTS square(2 * den); + num = CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z); + den = CGAL_NTS square(2 * dden); } template @@ -305,11 +307,13 @@ squared_distanceC3( const FT &px, const FT &py, const FT &pz, template < class FT > CGAL_KERNEL_INLINE -FT +void squared_radiusC3( const FT &px, const FT &py, const FT &pz, - const FT &qx, const FT &qy, const FT &qz) + const FT &qx, const FT &qy, const FT &qz, + FT &num, FT &den) { - return squared_distanceC3(px, py, pz, qx, qy, qz) / 4; + num = squared_distanceC3(px, py, pz, qx, qy, qz); + den = FT(4); } template < class FT > diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index 8765d0cb587..0bb67083388 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -754,7 +754,7 @@ power_side_of_bounded_power_sphereC3( } // return the sign of the power test of weighted point (rx,ry,rz,rw) - // with respect to the smallest sphere orthogoanal to + // with respect to the smallest sphere orthogonal to // p,q template< class FT > typename Same_uncertainty_nt::type @@ -764,20 +764,19 @@ power_side_of_bounded_power_sphereC3( const FT &rx, const FT &ry, const FT &rz, const FT &rw) { FT FT2(2); - FT FT4(4); FT dpx = px - qx; FT dpy = py - qy; FT dpz = pz - qz; FT dpw = pw - qw; FT dp2 = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + CGAL_NTS square(dpz); - FT drx = rx - (px + qx)/FT2; - FT dry = ry - (py + qy)/FT2; - FT drz = rz - (pz + qz)/FT2; - FT drw = rw - (pw + qw)/FT2; + FT drx = FT2 * rx - (px + qx); + FT dry = FT2 * ry - (py + qy); + FT drz = FT2 * rz - (pz + qz); + FT drw = FT2 * rw - (pw + qw); FT dr2 = CGAL_NTS square(drx) + CGAL_NTS square(dry) + CGAL_NTS square(drz); FT dpr = dpx*drx + dpy*dry +dpz*drz; return enum_cast( - - CGAL_NTS sign (dr2 - dp2/FT4 + dpr*dpw/dp2 - drw )); + - CGAL_NTS sign (dr2*dp2 - dp2*dp2 + FT2*dpr*dpw - FT2*drw*dp2 )); } } // namespace CGAL diff --git a/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt b/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt index 41a5e7b9db4..740788d9b14 100644 --- a/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt +++ b/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt @@ -90,7 +90,7 @@ also added more functionality in 2008. This work was partially supported by the IST Programme of the EU as a Shared-cost RTD (FET Open) Project under Contract No IST-2000-26473 -(ECG - Effective +(ECG - Effective Computational Geometry for Curves and Surfaces) and by the IST Programme of the 6th Framework Programme of the EU as a STREP (FET Open Scheme) Project under Contract No IST-006413 diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h b/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h index bf00857272b..a66bd69bf63 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h @@ -16,7 +16,7 @@ // (ACS -- Algorithms for Complex Shapes) // Description of the file format can be found at the following address: -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_READER_H #define CGAL_IO_DXF_READER_H diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h b/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h index 4da1adc4c96..900dd9aed87 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h @@ -16,8 +16,7 @@ // (ACS -- Algorithms for Complex Shapes) // Descriptions of the file format can be found at -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ -// http://www.tnt.uni-hannover.de/soft/compgraph/fileformats/docs/DXF.ascii +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_READER_DOUBLES_H #define CGAL_IO_DXF_READER_DOUBLES_H diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h b/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h index 84672c295f7..d0ace79c85c 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h @@ -17,7 +17,7 @@ // (ACS -- Algorithms for Complex Shapes) // Description of the file format can be found at the following address: -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_VARIANT_READER_H #define CGAL_IO_DXF_VARIANT_READER_H diff --git a/Classification/doc/Classification/Classification.txt b/Classification/doc/Classification/Classification.txt index 2c4c11eee49..10157e274ff 100644 --- a/Classification/doc/Classification/Classification.txt +++ b/Classification/doc/Classification/Classification.txt @@ -528,7 +528,10 @@ The following example: \section Classification_history History -This package is based on a research code by [Florent Lafarge](https://www-sop.inria.fr/members/Florent.Lafarge/) that was generalized, extended and packaged by [Simon Giraudot](http://geometryfactory.com/who-we-are/) in \cgal 4.12. %Classification of surface meshes and of clusters were introduced in \cgal 4.13. The Neural Network classifier was introduced in \cgal 4.14. +This package is based on a research code by [Florent Lafarge](https://www-sop.inria.fr/members/Florent.Lafarge/) +that was generalized, extended and packaged by [Simon Giraudot](https://geometryfactory.com/who-we-are/) +in \cgal 4.12. %Classification of surface meshes and of clusters were introduced in \cgal 4.13. +The Neural Network classifier was introduced in \cgal 4.14. diff --git a/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt b/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt index 58ada384336..423f49aae1c 100644 --- a/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt +++ b/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt @@ -542,7 +542,7 @@ Let d0\f$ \in \f$ D be a dart. Given i, 1 \f$ \leq \f$ i \section Combinatorial_mapDesign Design and Implementation History -The code of this package is inspired by Moka, a 3D topological modeler mainly developed by Frédéric Vidil and Guillaume Damiand (http://moka-modeller.sourceforge.net/). However, Moka was based on Generalized maps (and not Combinatorial maps), and the design was not \cgal "compatible". Thus, Guillaume Damiand started to develop a totally new package by mixing ideas taken from Moka with the design of the Halfedge data structure package of \cgal. Andreas Fabri and Sébastien Loriot contributed to the design, the coding, and to the documentation of the package, and Laurent Rineau helped for the design. Emma Michel contributed to the manual. Monique Teillaud and Bernd Gärtner contributed to the manual by giving useful remarks, really numerous and detailed for Monique. Ken Arroyo Ohori contributed to the two reverse orientation functions. +The code of this package is inspired by Moka, a 3D topological modeler mainly developed by Frédéric Vidil and Guillaume Damiand (https://moka-modeller.sourceforge.net/). However, Moka was based on Generalized maps (and not Combinatorial maps), and the design was not \cgal "compatible". Thus, Guillaume Damiand started to develop a totally new package by mixing ideas taken from Moka with the design of the Halfedge data structure package of \cgal. Andreas Fabri and Sébastien Loriot contributed to the design, the coding, and to the documentation of the package, and Laurent Rineau helped for the design. Emma Michel contributed to the manual. Monique Teillaud and Bernd Gärtner contributed to the manual by giving useful remarks, really numerous and detailed for Monique. Ken Arroyo Ohori contributed to the two reverse orientation functions. */ } /* namespace CGAL */ diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index 37d555793b6..a87122500fc 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -752,9 +752,12 @@ public: return false; } - bool owns_dereferencable(const_iterator cit) const + bool owns_dereferenceable(const_iterator cit) const { return cit!=end() && owns(cit); } + CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const + { return owns_dereferenceable(cit); } + /** Reserve method to ensure that the capacity of the Compact_container be * greater or equal than a given value n. */ diff --git a/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt b/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt index 73cd228cf95..0583952c360 100644 --- a/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt +++ b/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt @@ -185,7 +185,7 @@ MSVC][msvc-assume], or [`__builtin_unreachable`][builtin-unreachable] recognized by both clang and g++. [msvc-assume]: https://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx -[builtin-unreachable]: http://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable +[builtin-unreachable]: https://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable \section secexception_handling Exception handling @@ -193,7 +193,7 @@ Some parts of the library use exceptions, but there is no general specific policy concerning exception handling in \cgal. It is nevertheless good to target exception safety, as much as possible. Good references on exception safety are: Appendix E of \cgalCite{cgal:s-cpl-97} (also available at -http://www.stroustrup.com/3rd_safe0.html), +https://www.stroustrup.com/3rd_safe0.html), and \cgalCite{cgal:a-esgc-98} (also available at https://www.boost.org/community/exception_safety.html). Any destructor which might throw an exception, including a destructor which diff --git a/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt b/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt index b7450d5cd3d..bb7567c4858 100644 --- a/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt +++ b/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt @@ -42,7 +42,7 @@ Thus we will not give a full description of these concept here but only a few hints about how to use and write handle, iterators and circulators in \cgal. Developers should consult the above-mentioned references to become familiar with the iterator, circulator and handle concepts. In particular, the notions of iterator and circulator ranges, -dereferencable and past-the-end values, +dereferenceable and past-the-end values, mutable and constant iterators and circulators, and the different categories (forward, bidirectional, random-access, etc.) of iterators and circulators, are fundamental. diff --git a/Documentation/doc/Documentation/License.txt b/Documentation/doc/Documentation/License.txt index cb272b4180f..1eaf49026dd 100644 --- a/Documentation/doc/Documentation/License.txt +++ b/Documentation/doc/Documentation/License.txt @@ -19,7 +19,7 @@ based on GPLed \cgal data structures, obliges you to distribute the source code of your software under the GPL. The exact license terms can be found at the Free Software Foundation -web site: http://www.gnu.org/copyleft/gpl.html. +web site: https://www.gnu.org/licenses/gpl-3.0.html. \section licensesLGPL GNU LGPL @@ -29,7 +29,7 @@ In contrast to the GPL, there is no obligation to distribute the source code of software you build on top of LGPLed \cgal data structures. The exact license terms can be found at the Free Software Foundation web site: -http://www.gnu.org/copyleft/lesser.html. +https://www.gnu.org/licenses/lgpl-3.0.html. \section licensesRationale Rationale of the License Choice @@ -46,7 +46,7 @@ The package overview states for each package under which license it is distribut Users who cannot comply with the Open Source license terms can buy individual data structures under various commercial licenses from GeometryFactory: -http://www.geometryfactory.com/. License fees paid by commercial +https://www.geometryfactory.com/. License fees paid by commercial customers are reinvested in R\&D performed by the \cgal project partners, as well as in evolutive maintenance. diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index d74dcdaf7b9..b981472df6a 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -11,11 +11,11 @@ supporting C++14 or later. | Operating System | Compiler | | :---------- | :--------------- | -| Linux | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{http://gcc.gnu.org/}} | -| | `Clang` \cgalFootnote{\cgalFootnoteCode{http://clang.llvm.org/}} compiler version 13.0.1 | -| \ms Windows | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{http://gcc.gnu.org/}} | +| Linux | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | +| | `Clang` \cgalFootnote{\cgalFootnoteCode{https://clang.llvm.org/}} compiler version 13.0.1 | +| \ms Windows | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | | | \ms Visual `C++` 14.0, 15.9, 16.10, 17.0 (\visualstudio 2015, 2017, 2019, and 2022)\cgalFootnote{\cgalFootnoteCode{https://visualstudio.microsoft.com/}} | -| MacOS X | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{http://gcc.gnu.org/}} | +| MacOS X | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | | | Apple `Clang` compiler versions 10.0.1, 12.0.5, and 13.0.0 | @@ -131,7 +131,7 @@ Overview page. In order to use Eigen in \cgal programs, the executables should be linked with the CMake imported target `CGAL::Eigen3_support` provided in `CGAL_Eigen3_support.cmake`. -The \eigen web site is `http://eigen.tuxfamily.org`. +The \eigen web site is `https://eigen.tuxfamily.org`. \subsection thirdpartyOpenGR OpenGR @@ -213,7 +213,7 @@ the handling of \pdb data. In \cgal, the \esbtl is used in an example of the \ref PkgSkinSurface3 package. -It can be downloaded from `http://esbtl.sourceforge.net/`. +It can be downloaded from `https://esbtl.sourceforge.net/`. \subsection thirdpartyTBB Intel TBB @@ -309,7 +309,7 @@ The \glpk web site is `https://www. In \cgal, \scip provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package. In order to use \scip in \cgal programs, the executables should be linked with the CMake imported target `CGAL::SCIP_support` provided in `CGAL_SCIP_support.cmake`. -The \scip web site is `http://scip.zib.de/`. +The \scip web site is `https://www.scipopt.org/`. \subsection thirdpartyOSQP OSQP diff --git a/Documentation/doc/Documentation/main.txt b/Documentation/doc/Documentation/main.txt index 085a2ad83b6..2026356b76c 100644 --- a/Documentation/doc/Documentation/main.txt +++ b/Documentation/doc/Documentation/main.txt @@ -35,7 +35,7 @@ Head over to \ref general_intro to learn how to obtain, install, and use \cgal. \cgal is distributed under a dual-license scheme. \cgal can be used together with Open Source software free of charge. Using \cgal in other contexts can be done by obtaining a commercial license from -[GeometryFactory](http://www.geometryfactory.com). For more details +[GeometryFactory](https://www.geometryfactory.com). For more details see the \ref license "License" page.

Acknowledgement

diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 1c49fe6ffd2..34858e1e6b3 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -8,7 +8,7 @@ % - Entries are sorted alphabetically by their key % % - The key is created following the same rules as geombib, see -% http://compgeom.cs.uiuc.edu/~jeffe/compgeom/biblios.html +% https://jeffe.cs.illinois.edu/teaching/compgeom/ % % Here are roughly the rules: % initials of authors' last names '-' initials of 5 first title words @@ -264,7 +264,7 @@ Boissonnat} pages = {67--91}, volume = {4}, issue = {1}, - url = {http://dx.doi.org/10.1007/s11786-010-0043-4}, + url = {https://dx.doi.org/10.1007/s11786-010-0043-4}, year = {2010} } @@ -279,7 +279,7 @@ Boissonnat} pages = {45--66}, volume = {4}, issue = {1}, - url = {http://dx.doi.org/10.1007/s11786-010-0042-5}, + url = {https://dx.doi.org/10.1007/s11786-010-0042-5}, year = {2010} } @@ -335,8 +335,8 @@ Boissonnat} ,author = {Gavin Bell and Anthony Parisi and Mark Pesce} ,title = {VRML The Virtual Reality Modeling Language: Version 1.0 Specification} - ,howpublished = {\url{http://www.web3d.org/standards}} - ,url = "http://www.web3d.org/standards" + ,howpublished = {\url{https://www.web3d.org/standards}} + ,url = "https://www.web3d.org/standards" ,month = {May 26} ,year = 1995 ,update = "13.04 lrineau" @@ -674,7 +674,7 @@ Mourrain and Monique Teillaud" year = "1996", issn = "0377-2217", doi = "DOI: 10.1016/0377-2217(94)00366-1", - url = "http://www.sciencedirect.com/science/article/B6VCT-3VW8NPR-11/2/3cf4525c68d79c055676541418264043", + url = "https://www.sciencedirect.com/science/article/abs/pii/0377221794003661", keywords = "Convex hull problem, Frame, Linear programming, Data envelopment analysis, Redundancy" } @@ -791,7 +791,7 @@ Teillaud" @Misc{ cgal:e-esmr, title = {{EPFL} statue model repository}, howpublished = {{EPFL} Computer Graphics and Geometry Laboratory}, - url = {http://lgg.epfl.ch/statues_dataset.php} + url = {https://lgg.epfl.ch/statues_dataset.php} } @inproceedings{ cgal:eddhls-maam-95 @@ -995,7 +995,7 @@ Teillaud" ,number = {B 98-05} ,year = 1998 ,month = apr - ,url = {http://www.inf.fu-berlin.de/inst/pubs/tr-b-98-05.abstract.html} + ,url = {https://www.inf.fu-berlin.de/inst/pubs/tr-b-98-05.abstract.html} ,update = "98.06 schoenherr" } @@ -1008,7 +1008,7 @@ Teillaud" ,number = {B 98-04} ,year = 1998 ,month = apr - ,url = {http://www.inf.fu-berlin.de/inst/pubs/tr-b-98-04.abstract.html} + ,url = {https://www.inf.fu-berlin.de/inst/pubs/tr-b-98-04.abstract.html} ,update = "98.06 schoenherr" } @@ -1020,7 +1020,7 @@ Teillaud" ,number = {B 97-03} ,year = 1997 ,month = jun - ,url = {http://www.inf.fu-berlin.de/inst/pubs/tr-b-97-03.abstract.html} + ,url = {https://www.inf.fu-berlin.de/inst/pubs/tr-b-97-03.abstract.html} ,update = "97.06 schoenherr, 98.02 schoenherr, 98.06 schoenherr" } @@ -1061,7 +1061,7 @@ Teillaud" ,edition = {1.0.1} ,month = {June} ,year = {1999} - ,url = {http://clisp.cons.org/~haible/packages-cln.html} + ,url = {https://www.ginac.de/CLN/} ,update = "99.06 pion" } @@ -1297,7 +1297,7 @@ Teillaud" (full paper will be available shortly)}, YEAR = {2005}, MONTH = {November}, - URL = {http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics} + URL = {https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics} } @Article{ cgal:l-tmbrc-91, @@ -1555,7 +1555,7 @@ TITLE = {Intersecting Quadrics\,: An Efficient and Exact Implementation}, BOOKTITLE = {{ACM Symposium on Computational Geometry - SoCG'2004, Brooklyn, NY}}, YEAR ={ 2004}, MONTH ={ Jun}, -URL = {http://www.loria.fr/publications/2004/A04-R-021/A04-R-021.ps}, +URL = {https://www.loria.fr/publications/2004/A04-R-021/A04-R-021.ps}, ABSTRACT = {We present the first complete, exact and efficient C++ implementation of a method for parameterizing the intersection of two implicit quadrics with integer coefficients of arbitrary size. It is based on the near-optimal algorithm recently introduced by Dupont et al.~\cite{dupont03a}. Unlike existing implementations, it correctly identifies and parameterizes all the connected components of the intersection in all the possible cases, returning parameterizations with rational functions whenever such parameterizations exist. In addition, the coefficient field of the parameterizations is either minimal or involves one possibly unneeded square root.}, } @@ -1567,9 +1567,9 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio booktitle = {SEA}, year = {2009}, pages = {209-220}, - ee = {http://dx.doi.org/10.1007/978-3-642-02011-7_20}, + ee = {https://link.springer.com/chapter/10.1007/978-3-642-02011-7_20}, crossref = {cgal:v-ea-09}, - bibsource = {DBLP, http://dblp.uni-trier.de}, + bibsource = {DBLP, https://dblp.org/}, update = "09.11 penarand" } @@ -1582,8 +1582,8 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio year = "2011", note = "Advances in \{LIDAR\} Data Processing and Applications ", issn = "0924-2716", - doi = "http://dx.doi.org/10.1016/j.isprsjprs.2011.09.008", - url = "http://www.sciencedirect.com/science/article/pii/S0924271611001055", + doi = "https://dx.doi.org/10.1016/j.isprsjprs.2011.09.008", + url = "https://www.sciencedirect.com/science/article/abs/pii/S0924271611001055?via%3Dihub", author = "Clément Mallet and Frédéric Bretar and Michel Roux and Uwe Soergel and Christian Heipke" } @@ -1688,7 +1688,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio volume = {33}, number = {5}, issn = {1467-8659}, - url = {http://dx.doi.org/10.1111/cgf.12446}, + url = {https://onlinelibrary.wiley.com/doi/10.1111/cgf.12446}, doi = {10.1111/cgf.12446}, pages = {205--215}, year = {2014} @@ -1715,7 +1715,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,title = {The {LEDA} {U}ser {M}anual} ,organization = {Max-Planck-Insitut f\"ur Informatik} ,address = {66123 Saarbr\"ucken, Germany} - ,url = {http://www.mpi-sb.mpg.de/LEDA/leda.html} + ,url = {https://domino.mpi-inf.mpg.de/internet/reports.nsf/efc044f1568a0058c125642e0064c817/cff150e000ddc461c12562a80045cb82/$FILE/MPI-I-95-1-002.pdf} ,update = "99.05 schirra, 00.09 hert" } @@ -1724,7 +1724,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,title = {The {LEDA} {U}ser {M}anual} ,organization = {Algorithmic Solutions} ,address = {66123 Saarbr\"ucken, Germany} - ,url = {http://www.algorithmic-solutions.info/leda_manual/MANUAL.html} + ,url = {https://www.algorithmic-solutions.info/leda_manual/MANUAL.html} } @article{ cgal:mog-vbcfe-11 @@ -1979,7 +1979,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio title = {{MPFI} - The Multiple Precision Floating-Point Interval Library}, howpublished = {{R}evol, {N}athalie and {R}ouillier, {F}abrice}, - url = {http://perso.ens-lyon.fr/nathalie.revol/software.html}, + url = {https://perso.ens-lyon.fr/nathalie.revol/software.html}, update = "09.11 penarand" } @@ -2022,7 +2022,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,journal = "Comput. Geom. Theory Appl." , volume = 38 , pages = "100--110" - , url = "http://dx.doi.org/10.1016/j.comgeo.2006.11.008" + , url = "https://www.sciencedirect.com/science/article/pii/S0925772107000193?via%3Dihub" , publisher = "Elsevier Science Publishers B. V." ,update = "09.02 lrineau" } @@ -2298,8 +2298,8 @@ location = {Salt Lake City, Utah, USA} volume = {5526}, year = {2009}, isbn = {978-3-642-02010-0}, - ee = {http://dx.doi.org/10.1007/978-3-642-02011-7}, - bibsource = {DBLP, http://dblp.uni-trier.de}, + ee = {https://link.springer.com/book/10.1007/978-3-642-02011-7}, + bibsource = {DBLP, https://dblp.org/}, update = "09.11 penarand" } @@ -2368,7 +2368,7 @@ location = {Salt Lake City, Utah, USA} ,key = {VRML2} ,title = {The Virtual Reality Modeling Language Specification: Version 2.0, {ISO}/{IEC} {CD} 14772} - ,url = {http://www.web3d.org/documents/specifications/14772/V2.0/index.html} + ,url = {https://www.web3d.org/documents/specifications/14772/V2.0/index.html} ,month = {December} ,year = 1997 ,update = "13.04 lrineau" @@ -2503,7 +2503,6 @@ location = {Salt Lake City, Utah, USA} editor = "L{\'{a}}szl{\'{o}} Szirmay Kalos", pages = "210--218", year = "1998", - url = "http://citeseer.ist.psu.edu/article/felkel98straight.html" } @inproceedings{ cgal:ee-rrccpp-98, @@ -2512,7 +2511,7 @@ location = {Salt Lake City, Utah, USA} booktitle = "Symposium on Computational Geometry", pages = "58--67", year = "1998", - url = "http://citeseer.ist.psu.edu/eppstein98raising.html" + url = "https://jeffe.cs.illinois.edu/pubs/cycles.html" } @inproceedings{ cgal:ld-agrm-03, @@ -2525,11 +2524,9 @@ booktitle = {The 11-th International Conference in Central Europe year = 2003, volume = 11, issn = {ISSN 1213-6972}, -url = "http://wscg.zcu.cz/wscg2003/Papers_2003/G67.pdf" +url = "https://wscg.zcu.cz/wscg2003/Papers_2003/G67.pdf" } - - @InProceedings{cgal:k-vdc-06, author = {Menelaos I. Karavelas}, title = {Voronoi diagrams in {\sc Cgal}}, @@ -2576,7 +2573,7 @@ year = {1998}, pages = {69-79}, ee = {http://link.springer.de/link/service/series/0558/bibs/1766/17660069.htm}, crossref = {cgal:jlm-isgp-98}, -bibsource = {DBLP, http://dblp.uni-trier.de}, +bibsource = {DBLP, https://dblp.org/}, url = "https://www.boost.org/community/exception_safety.html" } @@ -2624,7 +2621,7 @@ url = "https://www.boost.org/community/exception_safety.html" volume = {1766}, year = {2000}, isbn = {3-540-41090-2}, - bibsource = {DBLP, http://dblp.uni-trier.de} + bibsource = {DBLP, https://dblp.org/} } @inproceedings{Kazhdan06, @@ -2719,14 +2716,14 @@ author = "Pedro M.M. de Castro and Frederic Cazals and Sebastien Loriot and Moni AUTHOR = {Otfried Cheong}, EDITION = {6.0pre32}, YEAR = {2009}, - URL = {http://ipe.otfried.org/} + URL = {https://ipe.otfried.org/} } @misc{cgal:t-ocdl-05, key = "opcode", author = {P. Terdiman}, title = "{{OPCODE 3D} Collision Detection library}", - note = "http://www.codercorner.com/Opcode.htm", + note = "https://www.codercorner.com/Opcode.htm", year = {2005} } @@ -2806,7 +2803,7 @@ ADDRESS = "Saarbr{\"u}cken, Germany" @misc{abbott-qir-06, author = "J. Abbott", title = "Quadratic Interval Refinement for Real Roots", - URL = "http://www.dima.unige.it/~abbott/", + URL = "https://www.dima.unige.it/~abbott/", year= "2006", note = "Poster presented at the 2006 Int.\ Symp.\ on Symb.\ and Alg.\ Comp.\ (ISSAC 2006)"} @@ -3035,9 +3032,9 @@ pages = "458--473" booktitle = {FOCS}, year = {1985}, pages = {155-164}, - ee = {http://doi.ieeecomputersociety.org/10.1109/SFCS.1985.65}, + ee = {https://doi.ieeecomputersociety.org/10.1109/SFCS.1985.65}, crossref = {DBLP:conf/focs/FOCS26}, - bibsource = {DBLP, http://dblp.uni-trier.de} + bibsource = {DBLP, https://dblp.org/} } @article{dtl-voasp-83, @@ -3061,8 +3058,8 @@ pages = "207--221" volume = {abs/1403.3905}, url = {https://arxiv.org/abs/1403.3905}, timestamp = {Wed, 17 Sep 2014 16:30:16 +0200}, - biburl = {http://dblp.uni-trier.de/rec/bib/journals/corr/BungiuHHHK14}, - bibsource = {dblp computer science bibliography, http://dblp.org} + biburl = {https://dblp.uni-trier.de/rec/bib/journals/corr/BungiuHHHK14}, + bibsource = {dblp computer science bibliography, https://dblp.org/} } @book{botsch2010PMP, diff --git a/Documentation/doc/biblio/geom.bib b/Documentation/doc/biblio/geom.bib index 270f537e139..3a19d0dccbb 100644 --- a/Documentation/doc/biblio/geom.bib +++ b/Documentation/doc/biblio/geom.bib @@ -78,7 +78,7 @@ , title = "IRIT $6.0$ User's Manual" , organization = "Technion" , year = 1996 -, url = "http://www.cs.technion.ac.il/~irit" +, url = "https://www.cs.technion.ac.il/~irit" , update = "98.07 bibrelex" } @@ -1925,7 +1925,7 @@ cell neighborhood in $O(m)$ time." , type = "Project Proposal (U. S. Army Research Office grant DAAH04-96-1-0013)" , institution = "Center for Geometric Computing" , year = 1995 -, url = "http://www.cs.brown.edu/cgc/" +, url = "https://www.cs.brown.edu/cgc/" , update = "98.07 bibrelex, 97.03 tamassia" } @@ -6908,7 +6908,7 @@ cell neighborhood in $O(m)$ time." @misc{a-dcgs- , author = "Nina Amenta" , title = "Directory of Computational Geometry Software" -, url = "http://www.geom.umn.edu/software/cglist/" +, url = "https://www.geom.uiuc.edu/software/cglist/" , update = "97.03 tamassia" } @@ -13110,7 +13110,6 @@ It is highly suitable for parallelization." , institution = "INRIA" , address = "BP93, 06902 Sophia-Antipolis, France" , year = 1994 -, url = "http://www.inria.fr/RRRT/RR-2306" , precedes = "abdpy-esdus-97" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" , abstract = "We propose a method to evaluate signs of $2\times 2$ and @@ -14473,7 +14472,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , number = 4 , year = 1995 , pages = "568--572" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-nmaaw-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-nmaaw-95.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, graph drawing, CGC, Brown" , update = "97.03 tamassia, 96.09 tamassia" } @@ -14485,7 +14484,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , nickname = "AVI '96" , year = 1996 , pages = "203--212" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-aawww-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-aawww-96.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, CGC, Brown" , update = "97.03 tamassia, 96.09 tamassia" } @@ -14496,7 +14495,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , booktitle = "Proc. 12th Annu. ACM Sympos. Comput. Geom." , year = 1996 , pages = "C3--C4" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-agaow-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-agaow-96.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, CGC, Brown" , cites = "bclt-nmaaw-95, ZZZ" , update = "97.11 bibrelex, 97.03 tamassia, 96.09 tamassia, 96.05 efrat" @@ -14509,7 +14508,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , nickname = "AVI '96" , year = 1996 , pages = "248--250" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-maas-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-maas-96.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, CGC, Brown" , update = "97.03 tamassia, 96.09 tamassia" } @@ -18585,7 +18584,6 @@ the interior. Contains pseudocode." , institution = "INRIA" , address = "BP93, 06902 Sophia-Antipolis, France" , year = 1995 -, url = "http://www.inria.fr/RRRT/RR-2626" , precedes = "bdds-cscot-97" , update = "99.11 bibrelex, 99.07 devillers, 98.11 devillers, 97.03 devillers, 96.01 devillers" , abstract = "This note presents a non trivial combination of two techniques previously used with randomized incremental algorithms: the lazy cleaning scheme \cite{bds-lric-94} to maintain structures with `non local' definition and the $O(n\log^{\star}n)$ acceleration when some additional information about the data is known \cite{s-sfira-91,cct-rpatd-92,d-rysoa-92}. Authors assume that the reader is somehow familiar with this techniques. @@ -21935,7 +21933,7 @@ where $d > 3 \sqrt 3$ denotes the distance between S and T." , number = 7 , year = 1998 , pages = "1--31" -, url = "http://www.cs.brown.edu/publications/jgaa/accepted/98/Biedl98.2.7.ps.gz" +, url = "https://www.cs.brown.edu/publications/jgaa/accepted/98/Biedl98.2.7.ps.gz" , succeeds = "b-nlbog-96" , update = "00.03 vismara" } @@ -23872,7 +23870,6 @@ In [BSBL93], the synthesis problem has been solved for a , address = "Valbonne, France" , month = apr , year = 1991 -, url = "http://www.inria.fr/RRRT/RR-1415" , keywords = "Delaunay triangulation, Voronoi diagrams, output-sensitive algorithms, shape reconstructions, shelling, tomography" , precedes = "bcdt-osc3d-91i, bcdt-oscdt-96" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.05 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" @@ -23930,7 +23927,6 @@ of the output, and the extra storage is {$O(n)$}." , number = 2160 , institution = "INRIA" , year = 1994 -, url = "http://www-sop.inria.fr/RRRT/RR-2160.html" , precedes = "bcdkl-sppbd-99" , update = "99.11 devillers, 99.07 devillers, 98.03 mitchell" } @@ -24176,7 +24172,6 @@ must lie in the halfplanes delimited by the query lines." , address = "Sophia-Antipolis, France" , month = oct , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1293" , precedes = "bdp-cu3ct-91" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers, 93.09 milone+mitchell" } @@ -24203,7 +24198,6 @@ must lie in the halfplanes delimited by the query lines." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1285" , succeeds = "bt-hrodt-86" , precedes = "bdsty-olgag-91i" , update = "99.11 bibrelex, 99.07 devillers, 98.07 bibrelex, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers, 93.09 milone+mitchell" @@ -24271,7 +24265,6 @@ arrangements of curves in the plane and others." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1207" , keywords = "randomized algorithms, higher order Voronoi diagrams, dynamic algorithms" , succeeds = "bdt-olcho-90, bt-hrodt-86" , precedes = "bdt-schov-93" @@ -24430,7 +24423,7 @@ the computational geometry algorithms library CGAL." , address = "Valbonne, France" , month = apr , year = 1992 -, url = "http://www-sop.inria.fr/cgi-bin/wais_ra_sophia?question=1697" +, url = "https://www-sop.inria.fr/cgi-bin/wais_ra_sophia?question=1697" , keywords = "shape reconstruction, medical images, Delaunay triangulation" , update = "99.07 devillers, 95.09 devillers, 95.01 devillers, 93.09 held" } @@ -24643,7 +24636,6 @@ present a polynomial-time exact algorithm to solve this problem." , number = 3825 , institution = "INRIA" , year = 1999 -, url = "http://www.inria.fr/RRRT/RR-3825" , cites = "b-oafsi-95, bo-arcgi-79, bs-ealcs-99, bp-rpsis-, c-stsar-94, ce-oails-92, cs-arscg-89, afl-rracg-98, k-ah-92, lpt-rpqid-99, p-iaeia-99, ps-cgi-90, s-ri-99, y-tegc-97, y-rgc-97" , update = "00.03 devillers" , abstract = "We propose several @@ -25563,7 +25555,7 @@ present a polynomial-time exact algorithm to solve this problem." , number = "RT-INF-9-96" , institution = "Dip. Discipline Scientifiche, Sez. Informatica, Univ. Roma III" , year = 1996 -, url = "http://www.cs.brown.edu/cgc/papers/bdll-pcrt-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bdll-pcrt-96.ps.gz" , keywords = "graph drawing, proximity, CGC, Brown" , update = "97.03 tamassia" } @@ -26988,7 +26980,7 @@ and solids on dynamically evolving grids without remeshing." , title = "Optimal Compaction of Orthogonal Representations" , booktitle = "CGC Workshop on Geometric Computing" , year = 1998 -, url = "http://www.cs.brown.edu/cgc/cgc98/" +, url = "https://www.cs.brown.edu/cgc/cgc98/" , keywords = "graph drawing, planar, orthogonal" , update = "98.11 tamassia" } @@ -27016,7 +27008,7 @@ and solids on dynamically evolving grids without remeshing." , publisher = "Springer-Verlag" , year = 1997 , pages = "45--52" -, url = "http://www.cs.brown.edu/cgc/papers/bgt-gdtsw-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bgt-gdtsw-97.ps.gz" , keywords = "graph drawing, system, WWW, orthogonal, planarization, CGC, Brown" , update = "98.07 vismara, 97.03 tamassia" } @@ -27448,7 +27440,6 @@ and solids on dynamically evolving grids without remeshing." , number = 3758 , institution = "INRIA" , year = 1999 -, url = "http://www.inria.fr/RRRT/RR-3758" , archive = "XXX:cs.CG/9907025" , cites = "h-bevv-56, bcddy-acchs-96" , update = "99.11 devillers" @@ -31078,7 +31069,7 @@ determinants." , publisher = "Springer-Verlag" , year = 1997 , pages = "63--75" -, url = "http://www.cs.brown.edu/cgc/papers/cgkt-oaars-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cgkt-oaars-97.ps.gz" , keywords = "graph drawing, upward, tree, planar, straight-line, orthogonal, CGC, Brown" , update = "98.07 agarwal, 98.03 smid, 97.11 bibrelex, 97.03 tamassia" } @@ -31421,7 +31412,7 @@ determinants." , site = "Waterloo, Canada" , year = 1993 , pages = "67--72" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, exact arithmetic" , cites = "m-cacau-89, dbs-gttd-92, fm-nsala-91, fv-eeacg-93, h-gsm-89, kln-edtur-91, m-vigau-88t, m-cacau-89, m-rfldd-90, m-rflp-89, fw-lnum-93, si-cvdom-89, f-pcg-93, ZZZ" , update = "98.11 bibrelex, 97.03 daniels, 93.09 milone+mitchell" @@ -31730,7 +31721,7 @@ determinants." , title = "Finding Basis Functions for Pyramidal Finite Elements" , booktitle = "CGC Workshop on Geometric Computing" , year = 1998 -, url = "http://www.cs.brown.edu/cgc/cgc98/" +, url = "https://www.cs.brown.edu/cgc/cgc98/" , update = "98.11 tamassia" } @@ -35104,7 +35095,7 @@ The algorithms can be extended to 3D with more complex data structures." , booktitle = "Proc. 6th ACM-SIAM Sympos. Discrete Algorithms" , year = 1995 , pages = "139--149" -, url = "http://www.cs.brown.edu/cgc/papers/cggtvv-emga-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cggtvv-emga-95.ps.gz" , update = "97.03 tamassia, 95.05 tamassia, 95.01 tamassia" } @@ -35159,7 +35150,7 @@ The algorithms can be extended to 3D with more complex data structures." , volume = 25 , year = 1996 , pages = "207--233" -, url = "http://www.cs.brown.edu/cgc/papers/cpt-uadpl-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cpt-uadpl-96.ps.gz" , succeeds = "cpt-uadpl-93" , update = "97.03 tamassia, 96.05 smid, 95.01 tamassia" } @@ -35259,7 +35250,7 @@ The algorithms can be extended to 3D with more complex data structures." , volume = 7 , year = 1997 , pages = "85--121" -, url = "http://www.cs.brown.edu/cgc/papers/ct-ospml-.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ct-ospml-.ps.gz" , keywords = "Shortest Path, Minimum-Link Path, dynamic algorithm, CGC, Brown" , succeeds = "ct-ospml-94i" , update = "98.07 mitchell, 97.11 bibrelex, 97.07 devillers, 97.03 tamassia, 96.09 tamassia, 95.01 tamassia" @@ -36242,7 +36233,7 @@ avoids overlap. This is useful in cartography." , booktitle = "Proc. 12th Annu. ACM Sympos. Comput. Geom." , year = 1996 , pages = "319--328" -, url = "http://www.cs.brown.edu/cgc/papers/cgt-cdgtt-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cgt-cdgtt-96.ps.gz" , keywords = "graph drawing, straight-line, 3D, convex, CGC, Brown" , cites = "a-lbvsc-63, bh-olpgf-87, bo-lwbl-87, con-dpgn-85, cyn-lacdp-84, ck-cgd3c-93, cn-mwgdp-95, cp-ltadp-95, celr-tdgd-95, c-re-82, cw-mmap-90, cw-sfmps-82, dg-caitd-95, fpp-sssfe-88, fpp-hdpgg-90, dett-adgab-94, dtt-arsdp-92, dtv-olcpt-95, ds-ltati-92, eg-dspg-96, esw-tkbtd-95, f-slrpg-48, fhhklsww-dgphr-93, gt-pdara-94, gt-anda-87, g-cp-67, hr-udfs-94, hrs-cchpc-92, ht-dgtc-73, ht-ept-74, hk-prga-92, jj-3dlrg-95, k-dpguc-96, k-dpgul-92, ls-cavg-92, ld-cpdt3-95, lrt-gnd-79, lt-apst-80, mp-arpg-94, m-orfdf-64, ps-cgi-85, r-3dvpi-95, r-e3vpi-95, s-epgg-90, st-ce3cp-92, s-cm-51, sr-vudtd-34, t-pdfip-80, t-prg-84, t-crg-60, t-hdg-63, w-mspp-82, ZZZ" , update = "98.11 bibrelex, 97.11 bibrelex, 97.03 tamassia, 96.09 tamassia" @@ -37879,7 +37870,7 @@ data. Contains C code." , number = 5 , year = 1995 , pages = "970--1001" -, url = "http://www.cs.brown.edu/cgc/papers/cdtt-dgdts-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cdtt-dgdts-95.ps.gz" , keywords = "graph drawing, dynamic, planar, trees, series-parallel" , succeeds = "cdttb-fdgd-92" , update = "97.03 tamassia, 96.09 tamassia, 95.09 tamassia, 95 tamassia" @@ -37972,7 +37963,7 @@ data. Contains C code." , volume = 13 , year = 1995 , pages = "245--265" -, url = "http://www.cs.brown.edu/cgc/papers/ct-det-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ct-det-95.ps.gz" , succeeds = "ct-detta-91" , update = "97.03 tamassia, 95.01 tamassia, 95.01 tamassia" } @@ -41130,7 +41121,7 @@ Contains C code." , booktitle = "Proc. 1st ACM Workshop on Appl. Comput. Geom." , year = 1996 , pages = "33--38" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, nesting, placement, Minkowski sum, configuration space" , comments = "to appear in Lecture Notes in Computer Science; submitted to Internat. J. Comput. Geom. Appl." @@ -41143,7 +41134,7 @@ Contains C code." , booktitle = "Proc. 6th Canad. Conf. Comput. Geom." , year = 1994 , pages = "225--230" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, packing, nesting, placement, reachability, Minkowski sum, configuration space, decomposition" , cites = "dmr-fmaap-93, f-savd-87, l-tdvdl-80, lm-ccp-93, ZZZ" , update = "98.11 bibrelex, 97.03 daniels, 94.09 jones" @@ -41155,7 +41146,7 @@ Contains C code." , booktitle = "Proc. 6th ACM-SIAM Sympos. Discrete Algorithms" , year = 1995 , pages = "205--214" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "packing, layout, placement, nesting, Minkowski sum, configuration space" , update = "97.03 daniels, 96.09 agarwal, 96.05 mitchell" } @@ -41208,7 +41199,7 @@ Contains C code." , site = "Waterloo, Canada" , year = 1993 , pages = "322--327" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "optimization, monotone matrices, polygons, inclusion" , precedes = "dmr-flaap -97" , cites = "akmsw-gamsa-87, as-facle-87, aw-cg-88, c-tsplt-90i, cdl-cler-86, kk-altag-90, mos-fmrio-85, mdl-amm-91, mdl-pcnpc-92, ow-rv-88, ps-cgi-85, srw-gsv-cccg-91, nhl-merp-84, wy-ocsp-88, ZZZ" @@ -41221,7 +41212,7 @@ Contains C code." , booktitle = "Proc. 8th Canad. Conf. Comput. Geom." , year = 1996 , pages = "196--201" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "concave, polygons, decomposition" , update = "97.03 agarwal+daniels, 96.09 mitchell" } @@ -43601,7 +43592,7 @@ Contains C code." , month = aug , year = 2000 , pages = "??--??" -, url = "http://cs.smith.edu/~orourke/papers.html" +, url = "https://www.science.smith.edu/~jorourke/papers.php" , cites = "ddo-ppnph2d-00" , update = "01.04 icking, 00.11 smid, 00.07 orourke" } @@ -43682,7 +43673,7 @@ Contains C code." , month = jan , year = 1999 , pages = "891--892" -, url = "http://www.siam.org/meetings/da99/" +, url = "https://archive.siam.org/meetings/da99/" , update = "99.07 orourke" } @@ -43759,7 +43750,7 @@ Contains C code." , address = "Northampton, MA, USA" , month = oct , year = 2001 -, url = "http://arXiv.org/abs/cs/0110054/" +, url = "https://arxiv.org/abs/cs/0110054" , succeeds = "deeho-vusp-01" , update = "01.11 orourke" } @@ -43773,7 +43764,7 @@ Contains C code." , address = "Northampton, MA, USA" , month = jul , year = 2001 -, url = "http://arXiv.org/abs/cs/0107023/" +, url = "https://arXiv.org/abs/cs/0107023/" , update = "01.11 orourke" } @@ -44318,7 +44309,6 @@ Contains C code." , number = 3451 , institution = "INRIA" , year = 1998 -, url = "http://www.inria.fr/RRRT/RR-3451" , precedes = "d-ddt-99" , update = "99.11 bibrelex, 99.07 devillers, 98.11 devillers" , abstract = "This paper present how space of spheres and shelling can be used to delete efficiently a point from d-dimensional triangulation. In 2-dimension, if k is the degree of the deleted vertex, the complexity is $O(k\log k)$, but we notice that this number apply only to low cost operations; time consuming computations are done only a linear number of times. This algorithm can be viewed as a variation of Heller algorithm which is popular in the geographic information system community. Unfortunately Heller algorithm is false as explained in this paper." @@ -44382,7 +44372,6 @@ minimum spanning tree)." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1992 -, url = "http://www.inria.fr/RRRT/RR-1619" , keywords = "randomized algorithms, Delaunay triangulation, practical issue, degenerate cases" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" } @@ -44408,7 +44397,6 @@ minimum spanning tree)." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1179" , keywords = "polygon placement, contact configurations" , precedes = "d-scspa-93" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers, 94.05 devillers" @@ -44740,7 +44728,6 @@ respectively, we obtain a speedup of $\frac p{\log p}$." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1992 -, url = "http://www.inria.fr/RRRT/RR-1620" , precedes = "dmt-ssgtu-92i" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" } @@ -45657,7 +45644,7 @@ dimensions. Constants are small, and are given in the paper." , publisher = "Springer-Verlag" , year = 1997 , pages = "76--91" -, url = "http://www.cs.brown.edu/cgc/papers/dglpttvv-ddges-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglpttvv-ddges-97.ps.gz" , keywords = "graph drawing, upward, experiments, CGC, Brown" , update = "98.07 patrignani+tamassia+vismara, 97.11 bibrelex, 97.03 tamassia" } @@ -45680,7 +45667,7 @@ dimensions. Constants are small, and are given in the paper." , type = "Manuscript" , institution = "Dept. of Computer Sci., Brown University" , year = 1996 -, url = "http://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" , keywords = "graph drawing, experiments, orthogonal" , precedes = "dglttv-ecfgd-97" , update = "97.03 tamassia, 96.09 tamassia" @@ -45694,7 +45681,7 @@ dimensions. Constants are small, and are given in the paper." , volume = 7 , year = 1997 , pages = "303--325" -, url = "http://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" , keywords = "graph drawing, experiments, orthogonal, CGC, Brown" , succeeds = "dglttv-ecfgd-96" , update = "98.07 patrignani+tamassia+vismara, 97.07 devillers, 97.03 tamassia, 96.09 tamassia" @@ -45706,7 +45693,7 @@ dimensions. Constants are small, and are given in the paper." , booktitle = "Proc. 11th Annu. ACM Sympos. Comput. Geom." , year = 1995 , pages = "306--315" -, url = "http://www.cs.brown.edu/cgc/papers/dglttv-ectgd-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglttv-ectgd-95.ps.gz" , keywords = "graph drawing, experiments, orthogonal" , cites = "bcn-cdder-92, bfn-wigdp-85, bnt-ladfd-86, bbdl-tealf-91, bk-bhogd-94, con-dpgn-85, cp-ltadp-90, celr-tdgd-95, dh-dgnus-89, fpp-sssfe-88, fr-scpdt-84, dett-adgab-94, dgst-ads-90, dlv-sorod-93, dlt-pepg-84, eg-rpdfb-94, eg-glbdb-95, fr-gdfdp-91, gs-ssa-79, gnv-dptdd-88, h-celag-94, h-ggpig-95, jemwdt-npgda-91, jm-mpsne-96, k-vaor-89, kk-adgug-89, k-dpgul-92, k-adpg-93, k-mcvr-93, kb-pgap-92, l-aeglv-80, lmp-sbeac-94, lmps-trm1b-90, lms-gtrre-91, lms-la3be-93, nt-fapsd-84, pt-iabod-95, r-nmdpg-87, rt-rplbo-86, s-mncpe-84, stt-mvuhs-81, t-eggmn-87, tdb-agdrd-88, tt-uavrp-86, tt-pgelt-89, tt-gd-95, t-dgds-88, t-hdg-63, v-ucvc-81, w-npagt-90, w-cblsg-85, w-dpg-82, ZZZ" , update = "01.04 icking, 98.11 bibrelex, 98.03 bibrelex, 97.03 tamassia, 96.09 tamassia, 95.05 tamassia" @@ -45820,7 +45807,7 @@ dimensions. Constants are small, and are given in the paper." , publisher = "Springer-Verlag" , year = 1996 , pages = "178--189" -, url = "http://www.cs.brown.edu/cgc/papers/dlw-swp-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dlw-swp-96.ps.gz" , keywords = "graph drawing" , update = "98.11 bibrelex, 97.11 bibrelex, 97.03 tamassia, 96.09 tamassia" } @@ -45842,7 +45829,7 @@ dimensions. Constants are small, and are given in the paper." , journal = "J. Graph Algorithms Appl." , volume = "3:4" , year = 1999 -, url = "http://www.cs.brown.edu/publications/jgaa/papers.html" +, url = "https://www.cs.brown.edu/publications/jgaa/papers.html" , update = "00.03 vismara" } @@ -46114,7 +46101,7 @@ dimensions. Constants are small, and are given in the paper." , publisher = "Springer-Verlag" , year = 1996 , pages = "81--91" -, url = "http://www.cs.brown.edu/cgc/papers/dtv-osrdp-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dtv-osrdp-96.ps.gz" , update = "99.11 bibrelex, 98.07 vismara, 97.03 tamassia" } @@ -48478,7 +48465,7 @@ conjecture posed by O'Rourke and Supowit \cite{os-snhpd-83}." , address = "Northampton, MA, USA" , month = oct , year = 2001 -, url = "http://arXiv.org/abs/cs/0110059/" +, url = "https://arXiv.org/abs/cs/0110059/" , comments = "Answers a question posed in bls-wcnfp-99" , update = "01.11 orourke" } @@ -49693,7 +49680,7 @@ library." , author = "E. Durand" , title = "Quasitiler 3.0 documentation" , year = 1994 -, url = "http//www.geom.umn.edu/apps/quasitiler/about.html" +, url = "http://www.geom.uiuc.edu/apps/quasitiler/about.html" , update = "97.11 bibrelex" } @@ -50766,7 +50753,7 @@ library." , volume = 6 , year = 1996 , pages = "145--156" -, url = "http://www.cs.brown.edu/cgc/papers/elt-adhg-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/elt-adhg-96.ps.gz" , succeeds = "elt-adhg-92" , update = "97.03 tamassia, 96.09 devillers" } @@ -54611,7 +54598,7 @@ algebraic geometry." @misc{e-ga- , author = "David Eppstein" , title = "Geometry in Action" -, url = "http://www.ics.uci.edu/~eppstein/geom.html" +, url = "https://www.ics.uci.edu/~eppstein/geom.html" , update = "97.03 tamassia" } @@ -55925,7 +55912,7 @@ between all the vertices of the polygons." , site = "Pacific Grove, CA" , year = 1994 , pages = "498--502" -, url = "http://ptolemy.eecs.berkeley.edu" +, url = "https://ptolemy.berkeley.edu/" , update = "98.03 bibrelex" } @@ -59800,7 +59787,7 @@ reflection formula and derives a surprising relationship between them." , month = jun , year = 1991 , pages = "334--341" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "arrangements, implementing algorithms, robust geometric computation" , cites = "cgl-pgd-83, eg-tsa-86, eos-calha-86, f-smpst-90, gt-tgt-87, g-as-72, gss-egbra-89, gs-pmgsc-85, h-pargc-89, hhk-tirgc-88, hk-prga-89, k-rmrs-89, lm-cschu-90, m-dpggt-89, m-vigau-88p, m-vigau-88a, m-utcpc-89, si-gafpa-88, si-cvd10-89, ZZZ" , update = "98.11 bibrelex, 97.11 bibrelex, 97.03 daniels" @@ -63930,7 +63917,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , volume = 6 , year = 1996 , pages = "333--356" -, url = "http://www.cs.brown.edu/cgc/papers/ggt-aoutd-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ggt-aoutd-96.ps.gz" , keywords = "graph drawing, tree, planar, upward" , succeeds = "ggt-aeutd-93" , update = "97.03 devillers+tamassia" @@ -63956,7 +63943,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1997 , pages = "201--216" -, url = "http://www.cs.brown.edu/cgc/papers/gt-nmcfa-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-nmcfa-97.ps.gz" , keywords = "graph drawing, planar, orthogonal, grid" , update = "99.03 vismara, 97.03 tamassia, 96.09 tamassia" } @@ -63971,7 +63958,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1994 , pages = "12--21" -, url = "http://www.cs.brown.edu/cgc/papers/gt-agd-94.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-agd-94.ps.gz" , keywords = "graph drawing" , update = "97.11 bibrelex, 97.03 tamassia, 94.05 tamassia" } @@ -63991,8 +63978,8 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , type = "Manuscript" , institution = "Dept. of Computer Sci., Brown University" , year = 1996 -, note = "Available at \url{http://www.cs.brown.edu/people/rt/fadiva/giotto3d.html}" -, url = "http://www.cs.brown.edu/people/rt/fadiva/giotto3d.html" +, note = "Available at \url{https://www.cs.brown.edu/people/rt/fadiva/giotto3d.html}" +, url = "https://www.cs.brown.edu/people/rt/fadiva/giotto3d.html" , keywords = "graph drawing, 3D" , update = "97.03 tamassia, 96.09 tamassia" } @@ -64015,7 +64002,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , series = "Lecture Notes Comput. Sci." , publisher = "Springer-Verlag" , year = 1997 -, url = "http://www.cs.brown.edu/cgc/papers/gt-gsvhs-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-gsvhs-97.ps.gz" , keywords = "graph drawing, upward, 3D, CGC, Brown" , update = "99.11 bibrelex, 97.03 tamassia" } @@ -64059,7 +64046,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1995 , pages = "286--297" -, url = "http://www.cs.brown.edu/cgc/papers/gt-ccurp-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-ccurp-95.ps.gz" , keywords = "graph drawing, planar, upward, rectilinear, orthogonal, NP-hardness" , update = "97.03 tamassia, 95.01 tamassia" } @@ -64085,7 +64072,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , volume = 12 , year = 1995 , pages = "109--133" -, url = "http://www.cs.brown.edu/cgc/papers/gt-upt-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-upt-95.ps.gz" , keywords = "graph drawing, planar, upward, survey" , update = "97.03 tamassia, 96.09 tamassia, 95.09 tamassia, 95.05 tamassia" } @@ -64100,7 +64087,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1996 , pages = "12--26" -, url = "http://www.cs.brown.edu/cgc/papers/gtv-dc-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gtv-dc-96.ps.gz" , keywords = "graph drawing, 3D, straight-line" , update = "97.03 smid+tamassia" } @@ -68869,7 +68856,7 @@ generated in O(dn2d+1) time. We present a simple proof that the (d - , title = "{GMP}, The {GNU} Multiple Precision Arithmetic Library" , edition = "2.0.2" , year = 1996 -, url = "http://gmplib.org/" +, url = "https://gmplib.org/" , update = "02.03 devillers, 00.03 devillers" } @@ -70364,7 +70351,7 @@ cos, etc." , number = "Report B 96-11" , institution = "Institut {f\"ur} Informatik, Freie Universit{\"a}t Berlin" , year = 1996 -, url = "http://www.inf.fu-berlin.de/pub/reports/tr-b-96-11.ps.gz, http://www.inf.fu-berlin.de/inst/pubs/tr-b-96-11.abstract.html" +, url = "https://www.inf.fu-berlin.de/pub/reports/tr-b-96-11.ps.gz, https://www.inf.fu-berlin.de/inst/pubs/tr-b-96-11.abstract.html" , update = "98.03 mitchell" } @@ -73908,7 +73895,7 @@ useful for geometric modeling or for ray tracing." , title = "Algebraic Topology" , publisher = "Cambridge University Press" , year = 2001 -, url = "http://www.math.cornell.edu/~hatcher/" +, url = "https://www.math.cornell.edu/~hatcher/" , update = "01.11 orourke" } @@ -76153,7 +76140,7 @@ processing. Contains C code." , type = "Manuscript" , institution = "Universit{\"a}t Passau, Innstra\ss e 33, 94030 Passau, Germany" , year = 1996 -, url = "http://www.uni-passau.de/~himsolt/Graphlet/GML" +, url = "https://www.uni-passau.de/~himsolt/Graphlet/GML" , keywords = "graph drawing" , update = "96.09 tamassia" } @@ -84058,7 +84045,7 @@ fitting method." , number = 1 , year = 1997 , pages = "1--25" -, url = "http://www.cs.brown.edu/publications/jgaa/accepted/97/JuengerMutzel97.1.1.ps.gz" +, url = "https://www.cs.brown.edu/publications/jgaa/accepted/97/JuengerMutzel97.1.1.ps.gz" , keywords = "graph drawing, straight-line, planarization, crossings, experiments" , succeeds = "jm-eha2s-96" , update = "99.07 vismara, 98.07 tamassia+vismara" @@ -84900,7 +84887,7 @@ fitting method." , month = aug , year = 2000 , pages = "139--146" -, url = "http://cs.smith.edu/~orourke/ShortestPaths/" +, url = "https://www.science.smith.edu/~jorourke/ShortestPaths//" , keywords = "shortest paths" , update = "02.03 icking, 01.11 orourke, 01.04 icking+orourke, 00.11 smid, 00.07 orourke" } @@ -85234,7 +85221,7 @@ fitting method." , number = 2 , year = 1997 , pages = "81--88" -, url = "http://www.cs.brown.edu/cgc/papers/kltt-arvrt-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/kltt-arvrt-97.ps.gz" , keywords = "graph drawing, visibility, tree, CGC, Brown" , update = "98.11 tamassia, 97.03 tamassia" } @@ -86661,7 +86648,6 @@ the R*-tree." , number = 2874 , institution = "INRIA" , year = 1996 -, url = "http://www.inria.fr/rrrt/rr-2874.html" , update = "02.03 devillers, 97.11 bibrelex" , abstract = "A set of objects is $k$-pierceable if there exists a set of $k$ poin ts such that each object is pierced by (contains) at least one of these points. Finding the smallest integer $k$ such that a set is $k$-pierceable is NP-complete. In this technical report, we present efficient algorithms for findi ng a piercing set (i.e., a set of $k$ points as above) for several classes of convex objects and small values of $k$. In some of the cases, our algorithms imply known as well as new Helly-type theorems, thus adding to previous results of Danzer and Gr{\"u}nbaum who studied the case of axis-parallel boxes. The problems studied here are related to the collection of optimization problems in which one seeks the smallest scaling factor of a centrally symmetric convex object $K$, so that a set of points can be covered by $k$ congruent homothets of $K$." } @@ -91777,7 +91763,7 @@ some 2 curves cross exponentially many times." , nickname = "WAFR '98" , year = 1998 , pages = "to appear" -, url = "http://www.cs.unc.edu/~dm/collision.html" +, url = "https://www.cs.unc.edu/~dm/collision.html" , update = "98.11 bibrelex, 98.07 bibrelex, 98.03 mitchell" } @@ -95357,7 +95343,7 @@ addition to their own purposes before conducting the conversion." , number = 5 , year = 1996 , pages = "253--260" -, url = "http://www.cs.brown.edu/cgc/papers/ll-domwt-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ll-domwt-96.ps.gz" , keywords = "graph drawing, planar, minimum weight triangulation" , update = "98.11 tamassia, 97.03 tamassia, 96.01 liotta" } @@ -95372,7 +95358,7 @@ addition to their own purposes before conducting the conversion." , publisher = "Springer-Verlag" , year = 1996 , pages = "373--384" -, url = "http://www.cs.brown.edu/cgc/papers/ll-hdomw-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ll-hdomw-96.ps.gz" , keywords = "graph drawing" , update = "97.03 tamassia, 96.09 tamassia" } @@ -95399,7 +95385,7 @@ addition to their own purposes before conducting the conversion." , publisher = "Springer-Verlag" , year = 1997 , pages = "286--302" -, url = "http://www.cs.brown.edu/cgc/papers/ll-pdog-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ll-pdog-97.ps.gz" , keywords = "graph drawing, proximity, CGC, Brown" , update = "98.07 tamassia, 97.03 tamassia" } @@ -96347,7 +96333,7 @@ addition to their own purposes before conducting the conversion." , booktitle = "Proc. 9th Annu. ACM Sympos. Comput. Geom." , year = 1993 , pages = "153--162" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "optimization, CAD, CAM, packing, layout, linear programming, motion planning, separation, configuration space, Minkowski sum" , cites = "aks-oa1dt-90, b-amdsn-89, bb-msbdc-88, c-crmp-87, dhks-isccd-90, grs-kfcg-83, hss-cmpmi-84, kos-cmsrp-91i, l-sisri-84, m-hphc-90, mdl-amm-91, mdl-pcnpc-92, mw-cdrca-88, mfs-2dcmc-87, p-ccmsp-87, pb-cmfm-88, sss-tdczr-86, sp-cppca-92, w-otdcs-85, ZZZ" , update = "98.07 bibrelex, 98.03 bibrelex, 97.03 daniels, 93.09 rote" @@ -96360,7 +96346,7 @@ addition to their own purposes before conducting the conversion." , volume = 84 , year = 1995 , pages = "539--561" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, packing, placement, linear programming, motion planning, Minkowski sum, configuration space" , update = "97.03 daniels" } @@ -96371,7 +96357,7 @@ addition to their own purposes before conducting the conversion." , booktitle = "Proc. 6th Annu. ACM Sympos. Comput. Geom." , year = 1990 , pages = "235--243" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , precedes = "lm-cschu-92" , cites = "f-smpst-89, g-eadch-72, gss-egbra-89, m-cacau-89, m-dpggt-89, m-vigau-88p, si-cvd10-89, ZZZ" @@ -96385,7 +96371,7 @@ addition to their own purposes before conducting the conversion." , volume = 8 , year = 1992 , pages = "345--364" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , succeeds = "lm-cschu-90" , update = "97.03 daniels" @@ -96398,7 +96384,7 @@ addition to their own purposes before conducting the conversion." , site = "Waterloo, Canada" , year = 1993 , pages = "7--11" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "packing, layout, motion planning, PSPACE" , cites = "cosw-cds-84, hss-cmpmi-84, lm-cancp-93, ZZZ" , update = "98.11 bibrelex, 98.03 mitchell, 97.03 daniels, 93.09 milone+mitchell" @@ -97363,7 +97349,7 @@ rectilinear polygon." , publisher = "Springer-Verlag" , year = 1997 , pages = "135--146" -, url = "http://www.cs.brown.edu/cgc/papers/lttv-argd-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/lttv-argd-97.ps.gz" , keywords = "graph drawing, proximity, CGC, Brown" , update = "98.07 tamassia, 97.03 tamassia" } @@ -104690,7 +104676,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 5th Annu. ACM Sympos. Comput. Geom." , year = 1989 , pages = "197--207" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , cites = "acm-aacad-88, acm-cad1b-84, acm-cad2a-84, c-qercf-75, cr-tlcra-88, em-sstcd-87, gy-frcg-86, hhk-tirgc-88, hhk-rsops-87, h-pargc-88, k-rmrs-89, kln-edtur-89, m-vigau-88a, m-vigau-88t, otu-nsga-87, r-paff-80, gss-egbra-89, ss-pmp2g-83, ss-ccsm-85, ss-pponp-88, s-aefsm-87, t-dmeag-51, y-gctsp-88, ZZZ" , update = "98.03 bibrelex, 97.03 daniels" @@ -104702,7 +104688,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 30th Annu. IEEE Sympos. Found. Comput. Sci." , year = 1989 , pages = "500--505" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , update = "98.03 agarwal, 97.03 daniels" } @@ -104713,7 +104699,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 7th Canad. Conf. Comput. Geom." , year = 1995 , pages = "79--84" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "computer graphics, simulation, physically-based modeling, linear programming, Minkowski sum, configuration space" , update = "97.03 daniels, 95.09 jones" } @@ -104725,7 +104711,7 @@ used in many computational geometry algorithms. Contains C++ code." , year = 1996 , pages = "129--136" , note = "Proc. SIGGRAPH '96" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "computer graphics, animation, physically-based modeling, linear programming, Minkowski sum, configuration space" , update = "97.03 daniels" } @@ -104737,7 +104723,7 @@ used in many computational geometry algorithms. Contains C++ code." , site = "Waterloo, Canada" , year = 1993 , pages = "473--478" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , cites = "ck-acp-70, b-tends-67, cs-arscg-89, e-acg-87, f-smpst-90, f-savd-87, fm-nsala-91, ghms-apsml-91, hhk-tirgc-88, iss-nriac-92, l-knnvd-82, ld-gvdp-81, lm-cschu-90, m-vigau-88a, m-cacau-89, ms-saps-92, sh-cpp-75, si-cvd10-89, ls-ippvd-87, ls-pptmc-87, m-dpggt-89, ZZZ" , update = "98.11 bibrelex, 97.03 daniels, 93.09 milone+mitchell" @@ -104750,7 +104736,7 @@ used in many computational geometry algorithms. Contains C++ code." , volume = 25 , number = 9 , year = 1993 -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "algorithms, polygons, geometric modeling" , update = "98.03 agarwal, 97.03 daniels, 96.05 pascucci" } @@ -104771,7 +104757,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 2nd Canad. Conf. Comput. Geom." , year = 1990 , pages = "40--45" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, geometric rounding" , cites = "ZZZ" , update = "98.07 bibrelex, 97.03 daniels" @@ -104783,7 +104769,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Abstracts 1st Canad. Conf. Comput. Geom." , year = 1989 , pages = 12 -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, geometric rounding" , update = "97.03 daniels" } @@ -104794,7 +104780,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 28th Annu. ACM Sympos. Theory Comput." , year = 1996 , pages = "109--118" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, packing, placement, nesting, concave, polygons, Minkowski sum, configuration space" , update = "97.03 daniels" } @@ -104857,7 +104843,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 3rd Canad. Conf. Comput. Geom." , year = 1991 , pages = "243--246" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, nesting, placement, optimization" , update = "97.03 daniels" } @@ -104868,7 +104854,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 4th Canad. Conf. Comput. Geom." , year = 1992 , pages = "236--243" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "concave, polygons, layout, nesting, packing, optimization, Minkowski sum, configuration space" , cites = "dhks-isccd-90, g-ctfsr-86, grs-kfcg-83, kos-cmsrp-91i, ml-sipat-91, mdl-amm-91, s-iamm-82, tw-cmm-73, nh-aplpg-84, s-iamm-88, ZZZ" , update = "98.07 bibrelex, 97.03 daniels" @@ -104881,7 +104867,7 @@ used in many computational geometry algorithms. Contains C++ code." , site = "Waterloo, Canada" , year = 1993 , pages = "485--490" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "geometric modeling, quaternion arithmetic, basis reduction, integer programming, exact arithmetic" , precedes = "mm-roaom-97" , cites = "cdr-rrmrg-92, c-sede-92, crss-igbra-91, e-sap-80, fw-eeacg-92, h-eq-69, kln-edtur-89, mn-fccrp-90a, m-rfldd-90, r-srsrf-77, lll-fprc-82, l-atngc-86, ls-gbra-92, m-rflp-89, s-qrm-78" @@ -104894,7 +104880,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 6th Annu. ACM Sympos. Comput. Geom." , year = 1990 , pages = "244--252" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , precedes = "mn-fccrp-90a" , cites = "gj-cigtn-79, gps-crotr-89, h-gsm-89, m-rflp-89, mn-fccrp-90a, m-utcpc-89, s-fprgo-89, tt-pgelt-89, ZZZ" @@ -104910,7 +104896,7 @@ used in many computational geometry algorithms. Contains C++ code." , month = sep , year = 1990 , pages = "753--769" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , succeeds = "mn-fccrp-90i" , update = "98.11 bibrelex, 97.03 daniels" @@ -104943,7 +104929,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 7th Canad. Conf. Comput. Geom." , year = 1995 , pages = "55--60" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, shortest-path rounding, nonuniform grids, geometric modeling, geometric rounding" , update = "97.03 daniels, 95.09 jones" } @@ -104989,7 +104975,7 @@ used in many computational geometry algorithms. Contains C++ code." , volume = 37 , year = 1988 , pages = "377--401" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , succeeds = "m-vigau-88p, m-vigau-88t" , update = "98.11 bibrelex, 97.03 daniels, 95.01 devillers" @@ -105010,7 +104996,7 @@ used in many computational geometry algorithms. Contains C++ code." , volume = 7 , year = 1997 , pages = "25--35" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "geometric modeling, quaternion arithmetic, basis reduction, integer programming, exact arithmetic" , succeeds = "mm-roaom-93" , update = "97.03 daniels" @@ -109344,11 +109330,11 @@ problems in computational geometry is presented." , update = "96.01 held+mitchell" } -@article{nan2017polyfit, - title = {PolyFit: Polygonal Surface Reconstruction from Point Clouds}, - author = {Nan, Liangliang and Wonka, Peter}, - journal = {ICCV}, - year = {2017} +@article{nan2017polyfit, + title = {PolyFit: Polygonal Surface Reconstruction from Point Clouds}, + author = {Nan, Liangliang and Wonka, Peter}, + journal = {ICCV}, + year = {2017} } @article{nhl-merp-84 @@ -110721,7 +110707,6 @@ envelope of line segments." , number = 1 , year = 1998 , pages = "39--66" -, url = "http://www.inria.fr/RRRT/RR-2575" , succeeds = "ny-oscha-94" , update = "99.11 bibrelex, 99.07 devillers, 98.07 devillers" , abstract = "A set of planar objects is said to be of type $m$ if the @@ -111527,7 +111512,6 @@ encapsulated PostScript" , address = "France" , year = 1998 , note = "TU-0606" -, url = "http://www.inria.fr/RRRT/TU-0606" , keywords = "doctoral thesis" , update = "00.03 devillers" } @@ -113167,7 +113151,7 @@ small) triangulation of a convex polyhedron is NP-complete. Their 3SAT-reduction , edition = "2nd" , publisher = "Cambridge University Press" , year = 1998 -, url = "http://cs.smith.edu/~orourke/books/compgeom.html" +, url = "https://www.science.smith.edu/~jorourke/books/compgeom.html" , comments = "Printed 28 Sep 1998" , update = "01.11 orourke, 99.11 bibrelex, 98.11 orourke" , annote = "Textbook" @@ -113362,8 +113346,8 @@ small) triangulation of a convex polyhedron is NP-complete. Their 3SAT-reduction , month = jun , year = 2000 , note = "LANL arXiv cs.CG/0006035 v3, - \url{http://cs.smith.edu/~orourke/papers.html}" -, url = "http://cs.smith.edu/~orourke/papers.html" + \url{https://www.science.smith.edu/~jorourke/papers.php}" +, url = "https://www.science.smith.edu/~jorourke/papers.php" , archive = "LANL arXiv cs.CG/0006035 v3" , keywords = "polygonal chains, polytopes, polyhedra" , cites = "c-cses-89, s-usedkkk-21" @@ -117683,7 +117667,6 @@ both for rendering and for modeling. Contains C code." , address = "France" , year = 1999 , note = "TU-0619" -, url = "http://www.inria.fr/rrrt/tu-0619.html" , keywords = "doctoral thesis" , update = "02.03 devillers, 00.03 devillers" } @@ -128644,7 +128627,7 @@ Contains C code." , type = "Technical {Report}" , institution = "Courant Institute, New York University" , year = 1996 -, url = "http://cs.nyu.edu" +, url = "https://cs.nyu.edu/" , update = "97.11 bibrelex" } @@ -136211,7 +136194,7 @@ Contains C code." , number = 9 , year = 1990 , pages = "27--39" -, url = "http://www.cc.gatech.edu/gvu/softviz/algoanim/xtango.html" +, url = "https://www.cc.gatech.edu/gvu/ii/softvis/algoanim/xtango.html" , update = "96.01 tamassia" } @@ -139116,7 +139099,7 @@ code." , number = 1 , year = 1996 , pages = "23--26" -, url = "http://www.cs.brown.edu/cgc/papers/t-ds-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/t-ds-96.ps.gz" , keywords = "data structures, survey" , update = "97.03 tamassia" } @@ -139145,7 +139128,7 @@ code." @misc{t-gd- , author = "Roberto Tamassia" , title = "Graph Drawing" -, url = "http://www.cs.brown.edu/people/rt/gd.html" +, url = "http://graphdrawing.org/index.html" , update = "98.07 tamassia" } @@ -139159,7 +139142,7 @@ code." , address = "Boca Raton, FL" , year = 1997 , pages = "815--832" -, url = "http://www.cs.brown.edu/cgc/papers/t-gd-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/t-gd-97.ps.gz" , keywords = "graph drawing, survey" , update = "97.11 orourke, 97.07 orourke, 97.03 tamassia" } @@ -139254,7 +139237,7 @@ code." , publisher = "CRC Press" , year = 1997 , pages = "86--110" -, url = "http://www.cs.brown.edu/cgc/papers/tc-ds-.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/tc-ds-.ps.gz" , keywords = "data structures, survey" , update = "97.03 tamassia" } @@ -139289,7 +139272,7 @@ code." , number = 4 , year = 1996 , pages = "591--606" -, url = "http://www.cs.brown.edu/people/rt/sdcr/report.html" +, url = "https://www.cs.brown.edu/people/rt/sdcr/report.html" , update = "98.07 tamassia+vismara, 97.03 tamassia" , annote = "short form of taacddfdhopsstvw-sdcg-96" } @@ -141035,7 +141018,7 @@ code." , title = "Hexahedral decomposition of polyhedra" , month = oct , year = 1993 -, url = "http://www.ics.uci.edu/~eppstein/gina/Thurston-hexahedra" +, url = "https://www.ics.uci.edu/~eppstein/gina/Thurston-hexahedra" , update = "97.11 bibrelex" } @@ -144105,7 +144088,7 @@ of geometric optics." @misc{v-qfemg-95 , author = "S. Vavasis" , title = "QMG: a finite element mesh generation package" -, url = "http://www.cs.cornell.edu/Info/People/vavasis/qmg-home.html" +, url = "https://www.cs.cornell.edu/info/people/vavasis/qmg-home.html" , update = "97.11 bibrelex" } @@ -151845,7 +151828,7 @@ amplification and suppression of local contrast. Contains C code." , keywords = {Computer Science - Computational Geometry, Computer Science - Data Structures and Algorithms} , year = 2012 , month = may -, adsurl = {http://adsabs.harvard.edu/abs/2012arXiv1205.5434H} +, adsurl = {https://ui.adsabs.harvard.edu/abs/2012arXiv1205.5434H/abstract} , adsnote = {Provided by the SAO/NASA Astrophysics Data System} } @@ -152040,7 +152023,7 @@ pages = {179--189} Booktitle = {24rd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA)}, Year = {2013}, Pages = {1646--1655}, - Url = {http://jeffe.cs.illinois.edu/pubs/pdf/dehn.pdf} + Url = {https://jeffe.cs.illinois.edu/pubs/pdf/dehn.pdf} } @InProceedings{lr-hts-12, @@ -152059,7 +152042,7 @@ pages = {179--189} Volume = {45}, Pages = {215--224}, Year = {2012}, - Url = {http://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf} + Url = {https://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf} @inproceedings{tang2009interactive, title={Interactive Hausdorff distance computation for general polygonal models}, diff --git a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in index 7d6685977cf..3d749fa16b6 100644 --- a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -20,7 +20,7 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# built into libc) for the transcoding. See https://www.gnu.org/software/libiconv/ # for the list of possible encodings. # The default value is: UTF-8. @@ -409,7 +409,7 @@ EXTENSION_MAPPING = txt=C++ # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -451,7 +451,7 @@ BUILTIN_STL_SUPPORT = YES CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -834,7 +834,7 @@ LAYOUT_FILE = ${CGAL_DOC_RESOURCE_DIR}/DoxygenLayoutPackage.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -922,7 +922,7 @@ INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -1138,7 +1138,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1283,7 +1283,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1342,7 +1342,7 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in @@ -1387,7 +1387,7 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# (see: https://www.microsoft.com/en-us/download/default.aspx) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output @@ -1463,7 +1463,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1471,8 +1471,7 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: https//doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1480,23 +1479,21 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1601,7 +1598,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1613,7 +1610,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1628,7 +1625,7 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. +# MathJax from https://www.mathjax.org before deployment. # The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1644,7 +1641,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1691,7 +1688,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1704,7 +1701,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1891,7 +1888,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -2074,7 +2071,7 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures the # structure of the code including all documentation. Note that this feature is # still experimental and incomplete at the moment. # The default value is: NO. @@ -2271,7 +2268,7 @@ CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the +# https://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. @@ -2293,7 +2290,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2448,7 +2445,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.8.13/footer.html b/Documentation/doc/resources/1.8.13/footer.html index a1ef3c24ea8..9aab1a87eea 100644 --- a/Documentation/doc/resources/1.8.13/footer.html +++ b/Documentation/doc/resources/1.8.13/footer.html @@ -8,14 +8,14 @@ move the footer to the bottom of the page. --> diff --git a/Documentation/doc/resources/1.8.13/header.html b/Documentation/doc/resources/1.8.13/header.html index 8c8b86f5b9d..aaa5e95ea30 100644 --- a/Documentation/doc/resources/1.8.13/header.html +++ b/Documentation/doc/resources/1.8.13/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.13/header_package.html b/Documentation/doc/resources/1.8.13/header_package.html index 544fd3ced7f..9e6fe125d50 100644 --- a/Documentation/doc/resources/1.8.13/header_package.html +++ b/Documentation/doc/resources/1.8.13/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in index 44a6b9f72b3..1a59e5d2d97 100644 --- a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -404,7 +404,7 @@ EXTENSION_MAPPING = txt=C++ # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -1333,7 +1333,7 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in @@ -1601,7 +1601,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1632,7 +1632,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -2062,7 +2062,7 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2266,7 +2266,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2421,7 +2421,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.8.14/footer.html b/Documentation/doc/resources/1.8.14/footer.html index a1ef3c24ea8..379470c59e2 100644 --- a/Documentation/doc/resources/1.8.14/footer.html +++ b/Documentation/doc/resources/1.8.14/footer.html @@ -8,14 +8,14 @@ move the footer to the bottom of the page. --> diff --git a/Documentation/doc/resources/1.8.14/header.html b/Documentation/doc/resources/1.8.14/header.html index 8c8b86f5b9d..aaa5e95ea30 100644 --- a/Documentation/doc/resources/1.8.14/header.html +++ b/Documentation/doc/resources/1.8.14/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.14/header_package.html b/Documentation/doc/resources/1.8.14/header_package.html index 89f76a8a441..f429c63135d 100644 --- a/Documentation/doc/resources/1.8.14/header_package.html +++ b/Documentation/doc/resources/1.8.14/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in index 7f258d33a4b..f950a6836db 100644 --- a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.20 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -1683,7 +1683,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1714,7 +1714,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -2146,7 +2146,7 @@ DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2350,7 +2350,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2505,7 +2505,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.8.20/footer.html b/Documentation/doc/resources/1.8.20/footer.html index cd9ad4553bc..28e5afe0f39 100644 --- a/Documentation/doc/resources/1.8.20/footer.html +++ b/Documentation/doc/resources/1.8.20/footer.html @@ -7,13 +7,13 @@ move the footer to the bottom of the page. --> diff --git a/Documentation/doc/resources/1.8.20/header.html b/Documentation/doc/resources/1.8.20/header.html index 50e4e4dcb49..c0530eec8bf 100644 --- a/Documentation/doc/resources/1.8.20/header.html +++ b/Documentation/doc/resources/1.8.20/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.20/header_package.html b/Documentation/doc/resources/1.8.20/header_package.html index 007d84e7b10..d2a1ed6051b 100644 --- a/Documentation/doc/resources/1.8.20/header_package.html +++ b/Documentation/doc/resources/1.8.20/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in index 45d422384df..10f3050a8f3 100644 --- a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.4 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed # in front of the TAG it is preceding . @@ -20,7 +20,7 @@ # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 @@ -409,7 +409,7 @@ EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. @@ -754,7 +754,7 @@ LAYOUT_FILE = ${CGAL_DOC_RESOURCE_DIR}/DoxygenLayoutPackage.xml # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# https://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. Do not use # file names with spaces, bibtex cannot handle them. @@ -827,7 +827,7 @@ INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# into libc) for the transcoding. See https://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 @@ -1005,7 +1005,7 @@ REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# tagging system (see https://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO @@ -1110,7 +1110,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. +# see https://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. @@ -1251,25 +1251,25 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see -# +# # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = @@ -1277,7 +1277,7 @@ QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. -# +# # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = @@ -1361,7 +1361,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the +# (see https://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and @@ -1384,7 +1384,7 @@ MATHJAX_FORMAT = HTML-CSS # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. +# copy of MathJax from https://www.mathjax.org before deployment. MATHJAX_RELPATH = ../../MathJax/ @@ -1560,7 +1560,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. +# https://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain @@ -1850,7 +1850,7 @@ CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# https://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. diff --git a/Documentation/doc/resources/1.8.4/footer.html b/Documentation/doc/resources/1.8.4/footer.html index 8b23c63651f..5c8bc85e026 100644 --- a/Documentation/doc/resources/1.8.4/footer.html +++ b/Documentation/doc/resources/1.8.4/footer.html @@ -5,14 +5,14 @@ diff --git a/Documentation/doc/resources/1.8.4/header.html b/Documentation/doc/resources/1.8.4/header.html index a98007ec2a5..8ffa7e46ea8 100644 --- a/Documentation/doc/resources/1.8.4/header.html +++ b/Documentation/doc/resources/1.8.4/header.html @@ -1,5 +1,5 @@ - + @@ -46,8 +46,8 @@ $mathjax onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
diff --git a/Documentation/doc/resources/1.8.4/header_package.html b/Documentation/doc/resources/1.8.4/header_package.html index 4b3ae0e7cc2..e47f3e9a158 100644 --- a/Documentation/doc/resources/1.8.4/header_package.html +++ b/Documentation/doc/resources/1.8.4/header_package.html @@ -1,5 +1,5 @@ - + @@ -63,8 +63,8 @@ $mathjax onmouseout="return searchBox.OnSearchSelectHide()" alt=""/>
@@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../Manual/search",false,'Search');
-
diff --git a/Documentation/doc/resources/1.9.3/BaseDoxyfile.in b/Documentation/doc/resources/1.9.3/BaseDoxyfile.in index d95cfc9dd5a..775ba2ce757 100644 --- a/Documentation/doc/resources/1.9.3/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.9.3/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.9.3 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -1688,7 +1688,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1719,7 +1719,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -2151,7 +2151,7 @@ DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2261,7 +2261,7 @@ PREDEFINED = DOXYGEN_RUNNING \ "CGAL_NP_TEMPLATE_PARAMETERS_2=NamedParameters2 = CGAL::parameters::Default_named_parameter" \ "CGAL_NP_CLASS_2=NamedParameters2" \ CGAL_DEPRECATED - + # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2347,7 +2347,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2507,7 +2507,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.9.3/footer.html b/Documentation/doc/resources/1.9.3/footer.html index cd9ad4553bc..28e5afe0f39 100644 --- a/Documentation/doc/resources/1.9.3/footer.html +++ b/Documentation/doc/resources/1.9.3/footer.html @@ -7,13 +7,13 @@ move the footer to the bottom of the page. --> diff --git a/Documentation/doc/resources/1.9.3/header.html b/Documentation/doc/resources/1.9.3/header.html index 50e4e4dcb49..c0530eec8bf 100644 --- a/Documentation/doc/resources/1.9.3/header.html +++ b/Documentation/doc/resources/1.9.3/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.9.3/header_package.html b/Documentation/doc/resources/1.9.3/header_package.html index 007d84e7b10..d2a1ed6051b 100644 --- a/Documentation/doc/resources/1.9.3/header_package.html +++ b/Documentation/doc/resources/1.9.3/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/scripts/generate_how_to_cite.py b/Documentation/doc/scripts/generate_how_to_cite.py index e1108d6a51f..470c71d4e45 100644 --- a/Documentation/doc/scripts/generate_how_to_cite.py +++ b/Documentation/doc/scripts/generate_how_to_cite.py @@ -46,7 +46,7 @@ software. If you want to cite the \cgal Library or project as a whole, please -- cite: \cgal, Computational Geometry Algorithms Library, https://www.cgal.org +- cite: \cgal, Computational Geometry Algorithms Library, https://www.cgal.org - use the first bibtex entry from the file how_to_cite_cgal.bib. ## Citing the User and Reference Manual ## @@ -65,7 +65,7 @@ If you want to refer to \cgal manual, please cite the appropriate The \cgal Project. \cgal User and Reference Manual. \cgal Editorial Board, ${CGAL_CREATED_VERSION_NUM} edition, ${CGAL_BUILD_YEAR4}. -[ bib | +[ bib | http ] @@ -80,7 +80,7 @@ result_txt_footer=r""" """ pre_html=r""" - + diff --git a/Documentation/doc/scripts/html_output_post_processing.py b/Documentation/doc/scripts/html_output_post_processing.py index 44d15aa6d70..5402d7bc50f 100755 --- a/Documentation/doc/scripts/html_output_post_processing.py +++ b/Documentation/doc/scripts/html_output_post_processing.py @@ -55,7 +55,7 @@ def write_out_html(d, fn): f = codecs.open(fn, 'w', encoding='utf-8') # this is the normal doxygen doctype, which is thrown away by pyquery f.write('\n') - f.write('') + f.write('') if d.html() is not None: f.write(d.html()) f.write('\n') @@ -85,7 +85,7 @@ def clean_doc(): for fn in duplicate_files: os.remove(fn) -# from http://stackoverflow.com/a/1597755/105672 +# from https://stackoverflow.com/a/1597755/105672 def re_replace_in_file(pat, s_after, fname): # first, see if the pattern is even in the file. with codecs.open(fname, encoding='utf-8') as f: diff --git a/Filtered_kernel/TODO b/Filtered_kernel/TODO index 477746d7bce..7e1b5441ad9 100644 --- a/Filtered_kernel/TODO +++ b/Filtered_kernel/TODO @@ -140,7 +140,7 @@ except we could merge stuff with Olivier's Fixed ! So the good choice seems to be to have data stored in each predicate object, and having the kernel store a predicate object for each predicate. Then the orientation_2_object() simply returns a reference to it. - + Then it means algorithms should use one "global" object per predicate (e.g. one orientation object for a whole Triangulation). Except for cases where they actually want different contexts. diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel.h b/Filtered_kernel/include/CGAL/Filtered_kernel.h index 7e7c21ef79f..182ba3c4d99 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel.h @@ -81,13 +81,16 @@ struct Filtered_kernel_base Approximate_kernel approximate_kernel() const { return {}; } // We change the predicates. -#define CGAL_Kernel_pred(P, Pf) \ - typedef Filtered_predicate P; \ +#define CGAL_Kernel_pred_RT_or_FT(P, Pf) \ + typedef Filtered_predicate_RT_FT P; \ P Pf() const { return P(); } -#define CGAL_Kernel_pred_RT(P, Pf) \ - typedef Filtered_predicate P; \ - P Pf() const { return P(); } +#define CGAL_Kernel_pred(P, Pf) CGAL_Kernel_pred_RT_or_FT(P, Pf) // We don't touch the constructions. #define CGAL_Kernel_cons(Y,Z) diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h index ac57decb63e..e9428fd2917 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h @@ -21,7 +21,7 @@ #include #include -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf namespace CGAL { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h index 3b94f56663c..2b0ef97d7fc 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h @@ -26,7 +26,7 @@ #include -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf namespace CGAL { diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 2adad47f329..8cbcaa2835a 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -19,6 +19,8 @@ #include #include +#include + namespace CGAL { // This template class is a wrapper that implements the filtering for any @@ -84,15 +86,8 @@ public: template result_type - operator()(const Args&... args) const; -}; - -template - template -typename Filtered_predicate::result_type -Filtered_predicate:: operator()(const Args&... args) const -{ + { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG { @@ -109,8 +104,76 @@ Filtered_predicate:: Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); return ep(c2e(args)...); -} + } +}; -} //namespace CGAL +template +class Filtered_predicate_RT_FT +{ + C2E_RT c2e_rt; + C2E_FT c2e_ft; + C2A c2a; + EP_RT ep_rt; + EP_FT ep_ft; + AP ap; + + using Ares = typename Remove_needs_FT::Type; + +public: + using result_type = typename Remove_needs_FT::Type; + +private: + template + struct Call_operator_needs_FT + { + using Actual_approx_res = decltype(ap(c2a(std::declval())...)); + using Approx_res = std::remove_cv_t >; + enum { value = std::is_same >::value }; + }; + + template ::value>* = nullptr> + result_type call(const Args&... args) const { return ep_ft(c2e_ft(args)...); } + + template ::value>* = nullptr> + result_type call(const Args&... args) const { return ep_rt(c2e_rt(args)...); } + +public: + // ## Important note + // + // If you want to remove of rename that member function template `needs_FT`, + // please also change the lines with + // `CGAL_GENERATE_MEMBER_DETECTOR(needs_FT);` + // or `has_needs_FT` in + // the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h`. + template + bool needs_FT(const Args&...) const { return Call_operator_needs_FT::value; } + + template + result_type + operator()(const Args&... args) const + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG + { + Protect_FPU_rounding p; + try + { + Ares res = ap(c2a(args)...); + if (is_certain(res)) + return get_certain(res); + } + catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding p(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + + return call(args...); + } +}; + +} // namespace CGAL #endif // CGAL_FILTERED_PREDICATE_H diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index c88f93e3acf..08a6ebb41a0 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -89,7 +89,7 @@ protected: // Exact_kernel = exact kernel that will be made lazy // Kernel = lazy kernel -// the Generic base simplies applies the generic magic functor stupidly. +// the Generic base simply applies the generic magic functor stupidly. // then the real base fixes up a few special cases. template < typename EK_, typename AK_, typename E2A_, typename Kernel_ > class Lazy_kernel_generic_base : protected internal::Enum_holder diff --git a/Generalized_map/doc/Generalized_map/Generalized_map.txt b/Generalized_map/doc/Generalized_map/Generalized_map.txt index 09ad37a4946..0b08884f40a 100644 --- a/Generalized_map/doc/Generalized_map/Generalized_map.txt +++ b/Generalized_map/doc/Generalized_map/Generalized_map.txt @@ -551,7 +551,7 @@ Let d0 \f$ \in \f$ D be a dart. Given i, 0 \f$ \leq \f$ \section Generalized_mapDesign Design and Implementation History -The code of this package followed the code of Combinatorial maps and was inspired by Moka, a 3D topological modeler that uses 3D generalized maps (http://moka-modeller.sourceforge.net/). +The code of this package followed the code of Combinatorial maps and was inspired by Moka, a 3D topological modeler that uses 3D generalized maps (https://moka-modeller.sourceforge.net/). */ } /* namespace CGAL */ diff --git a/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml b/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml index b4d866c7279..39d1878397c 100644 --- a/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml +++ b/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml @@ -1,5 +1,5 @@ - + diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index b257c53843d..0dead11c3ca 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -529,22 +529,19 @@ private: pj = p_j; pk = p_k; - const double cotan_i = CGAL::to_double( - CGAL::Weights::cotangent(pk, pi, pj, traits)); + const double cotan_i = CGAL::to_double(CGAL::Weights::cotangent(pk, pi, pj, traits)); m_cotan_matrix.add_coef(j, k, -(1./2) * cotan_i); m_cotan_matrix.add_coef(k, j, -(1./2) * cotan_i); m_cotan_matrix.add_coef(j, j, (1./2) * cotan_i); m_cotan_matrix.add_coef(k, k, (1./2) * cotan_i); - const double cotan_j = CGAL::to_double( - CGAL::Weights::cotangent(pk, pj, pi, traits)); + const double cotan_j = CGAL::to_double(CGAL::Weights::cotangent(pk, pj, pi, traits)); m_cotan_matrix.add_coef(i, k, -(1./2) * cotan_j); m_cotan_matrix.add_coef(k, i, -(1./2) * cotan_j); m_cotan_matrix.add_coef(i, i, (1./2) * cotan_j); m_cotan_matrix.add_coef(k, k, (1./2) * cotan_j); - const double cotan_k = CGAL::to_double( - CGAL::Weights::cotangent(pj, pk, pi, traits)); + const double cotan_k = CGAL::to_double(CGAL::Weights::cotangent(pj, pk, pi, traits)); m_cotan_matrix.add_coef(i, j, -(1./2) * cotan_k); m_cotan_matrix.add_coef(j, i, -(1./2) * cotan_k); m_cotan_matrix.add_coef(i, i, (1./2) * cotan_k); @@ -553,8 +550,7 @@ private: const Vector_3 v_ij = construct_vector(p_i, p_j); const Vector_3 v_ik = construct_vector(p_i, p_k); const Vector_3 cross = cross_product(v_ij, v_ik); - const double norm_cross = CGAL::sqrt( - CGAL::to_double(scalar_product(cross, cross))); + const double norm_cross = CGAL::sqrt(CGAL::to_double(scalar_product(cross, cross))); //double area_face = CGAL::Polygon_mesh_processing::face_area(f,tm); //cross is 2*area diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html index 6b2b2a5d943..f2f0fb9318b 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html @@ -3,6 +3,6 @@

Computational Geometry Algorithms Library

CGAL provides efficient and reliable geometric algorithms in the form of a C++ library.

-

For more information visit www.cgal.org

+

For more information visit www.cgal.org

diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 6f0523005e2..30e31329e62 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -59,6 +59,10 @@ CGAL tetrahedral Delaunay refinement algorithm. described by the concept `TriangulationDataStructure_2::Face`. The model `CGAL::Hyperbolic_triangulation_face_base_2` has been adapted correspondingly. +### [Surface Mesh Simplification](https://doc.cgal.org/5.6/Manual/packages.html#PkgSurfaceMeshSimplification) +- 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. + [Release 5.5](https://github.com/CGAL/cgal/releases/tag/v5.5) ----------- @@ -3187,7 +3191,7 @@ Release date: October 2012 - Added more general script to create CMakeLists.txt files: `cgal_create_CMakeLists` - Availability tests for C++11 features are now performed with the - help of [Boost.Config](http://www.boost.org/libs/config). A Boost + help of [Boost.Config](https://www.boost.org/libs/config). A Boost version of 1.40.0 or higher is needed to use C++11 features. ### 2D Arrangement @@ -3679,7 +3683,7 @@ CGAL 3.7 offers the following improvements and new functionality : - Some demos now require a version of Qt4 >= 4.3. - CGAL\_PDB is no longer provided with CGAL. An alternative solution for people interested in reading PDB files is to use ESBTL - (http://esbtl.sourceforge.net/). + (https://esbtl.sourceforge.net/). - Fix issues of the CGAL wrappers around the CORE library, on 64 bits platforms. diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 5f506634ba8..8d48e93b39f 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -354,7 +354,7 @@ include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) include(${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake) cgal_setup_module_path() -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) message(STATUS "Operating system:") execute_process( COMMAND uname -a @@ -392,7 +392,7 @@ if(MSVC) uniquely_add_flags(CGAL_CXX_FLAGS "/fp:except-") uniquely_add_flags(CGAL_CXX_FLAGS "/bigobj") # Use /bigobj by default - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) set(CMAKE_CXX_WARNING_LEVEL 2 CACHE STRING "MSVC C++ compiler warning level" FORCE) @@ -445,7 +445,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) if(GCC_FOUND) - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) uniquely_add_flags(CGAL_CXX_FLAGS "-Wall") # Remove -g from the relevant CMAKE_CXX_FLAGS. This will also # propagate to the rest of the tests, since we overwrite those @@ -482,7 +482,7 @@ message("== Generate version files (DONE) ==\n") # #-------------------------------------------------------------------------------------------------- -if(CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST) +if(CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) message("== Set up flags ==") # Ugly hack to be compatible with current CGAL testsuite process (as of @@ -1254,4 +1254,4 @@ if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) if(Qt5_FOUND) message(STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'") endif()#Qt5_FOUND -endif()#RUNNING_CGAL_AUTO_TEST +endif()#RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE diff --git a/Installation/LICENSE.GPL b/Installation/LICENSE.GPL index 94a9ed024d3..ae0725d8014 100644 --- a/Installation/LICENSE.GPL +++ b/Installation/LICENSE.GPL @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/Installation/LICENSE.LGPL b/Installation/LICENSE.LGPL index 65c5ca88a67..1cd6ad68146 100644 --- a/Installation/LICENSE.LGPL +++ b/Installation/LICENSE.LGPL @@ -1,7 +1,7 @@ GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. diff --git a/Installation/cmake/modules/CGAL_Common.cmake b/Installation/cmake/modules/CGAL_Common.cmake index 92de4630099..ce99da6489e 100644 --- a/Installation/cmake/modules/CGAL_Common.cmake +++ b/Installation/cmake/modules/CGAL_Common.cmake @@ -4,7 +4,7 @@ option(CGAL_DEV_MODE "Activate the CGAL developers mode. See https://github.com/CGAL/cgal/wiki/CGAL_DEV_MODE" $ENV{CGAL_DEV_MODE}) -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # Just to avoid a warning from CMake if that variable is set on the command line... endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 790b13331b1..08cdc568ab6 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -97,8 +97,7 @@ function(CGAL_setup_CGAL_dependencies target) target_compile_definitions(${target} INTERFACE CGAL_TEST_SUITE=1) endif() - # CGAL now requires C++14. `decltype(auto)` is used as a marker of - # C++14. + # CGAL now requires C++14. `decltype(auto)` is used as a marker of C++14. target_compile_features(${target} INTERFACE cxx_decltype_auto) use_CGAL_Boost_support(${target} INTERFACE) @@ -152,7 +151,7 @@ function(CGAL_setup_CGAL_dependencies target) "-features=extensions;-library=stlport4;-D_GNU_SOURCE") target_link_libraries(${target} INTERFACE "-library=stlport4") elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - if ( RUNNING_CGAL_AUTO_TEST ) + if ( RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) target_compile_options(${target} INTERFACE "-Wall") endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) diff --git a/Installation/cmake/modules/CGAL_SetupFlags.cmake b/Installation/cmake/modules/CGAL_SetupFlags.cmake index 514ad5c58c8..3693e29724e 100644 --- a/Installation/cmake/modules/CGAL_SetupFlags.cmake +++ b/Installation/cmake/modules/CGAL_SetupFlags.cmake @@ -46,7 +46,7 @@ uniquely_add_flags( CMAKE_EXE_LINKER_FLAGS_DEBUG ${CGAL_EXE_LINKER_FLAGS_DE # Set a default build type if none is given if ( NOT CMAKE_BUILD_TYPE ) - if( RUNNING_CGAL_AUTO_TEST ) + if( RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) typed_cache_set ( STRING "Build type: Release, Debug, RelWithDebInfo or MinSizeRel" CMAKE_BUILD_TYPE Debug ) else () typed_cache_set ( STRING "Build type: Release, Debug, RelWithDebInfo or MinSizeRel" CMAKE_BUILD_TYPE Release ) diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake index 6a792ab5c91..70716d226c2 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -84,7 +84,7 @@ function(CGAL_hook_check_CMAKE_BUILD_TYPE) if(DEFINED CMAKE_BUILD_TYPE AND ( NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") ) set(keyword WARNING) set(type warning) - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # No warning in the CMake test suite, but a status message set(keyword) set(type notice) diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 3cbea03d9b9..8b7aa08a92b 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -43,7 +43,7 @@ #------------------------------------------------------------------- # This file is part of the CMake build system for OGRE # (Object-oriented Graphics Rendering Engine) -# For the latest info, see http://www.ogre3d.org/ +# For the latest info, see https://www.ogre3d.org/ # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index 4d44ca90219..43449b85e51 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -13,7 +13,7 @@ if(NOT USE_CGAL_FILE_INCLUDED) set(USE_CGAL_FILE_INCLUDED 1) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Common.cmake) - if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST ) + if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupFlags.cmake) else() include(${CMAKE_CURRENT_LIST_DIR}/CGAL_display_flags.cmake) diff --git a/Installation/doc_html/Manual/index.html b/Installation/doc_html/Manual/index.html index ce6b70c0d9a..446d46ff910 100644 --- a/Installation/doc_html/Manual/index.html +++ b/Installation/doc_html/Manual/index.html @@ -1,10 +1,10 @@ - + CGAL - Computational Geometry Algorithms Library - + diff --git a/Installation/doc_html/Manual/packages.html b/Installation/doc_html/Manual/packages.html index ce6b70c0d9a..446d46ff910 100644 --- a/Installation/doc_html/Manual/packages.html +++ b/Installation/doc_html/Manual/packages.html @@ -1,10 +1,10 @@ - + CGAL - Computational Geometry Algorithms Library - + diff --git a/Installation/doc_html/index.html b/Installation/doc_html/index.html index 24cd53e0c23..5638303fdc9 100644 --- a/Installation/doc_html/index.html +++ b/Installation/doc_html/index.html @@ -1,10 +1,10 @@ - + CGAL - Computational Geometry Algorithms Library - + @@ -19,7 +19,7 @@

-The goal of the CGAL Open Source Project is to provide +The goal of the CGAL Open Source Project is to provide easy access to efficient and reliable geometric algorithms in the form of a C++ library.

@@ -36,7 +36,7 @@ You can access the CGAL Online Manual from the @@ -46,7 +46,7 @@ You can access the CGAL Online Manual from the

CGAL is distributed under a dual-license scheme. CGAL can be used together with Open Source software free of charge. Using CGAL in other contexts can be done by obtaining a commercial license from -GeometryFactory. +GeometryFactory. For more details see the License page.

diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 4242ec3c985..a82c5be43b7 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -52,7 +52,7 @@ #endif // CGAL_TEST_SUITE and NDEBUG // See [[Small features/Visual_Leak_Detector]] in CGAL developers wiki -// See also: http://vld.codeplex.com/ +// See also: https://kinddragon.github.io/vld/ #if defined(CGAL_ENABLE_VLD) # include #endif // CGAL_ENABLE_VLD @@ -296,7 +296,7 @@ using std::max; // Macros to detect features of clang. We define them for the other // compilers. -// See http://clang.llvm.org/docs/LanguageExtensions.html +// See https://clang.llvm.org/docs/LanguageExtensions.html // See also https://en.cppreference.com/w/cpp/experimental/feature_test #ifndef __has_feature #define __has_feature(x) 0 // Compatibility with non-clang compilers. @@ -479,7 +479,7 @@ namespace cpp11{ // The fallthrough attribute // See for clang: -// http://clang.llvm.org/docs/AttributeReference.html#statement-attributes +// https://clang.llvm.org/docs/AttributeReference.html#statement-attributes // See for gcc: // https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) diff --git a/Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h b/Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h new file mode 100644 index 00000000000..cf07529839b --- /dev/null +++ b/Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h @@ -0,0 +1,60 @@ +// Copyright (c) 2016 GeometryFactory SARL (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Andreas Fabri +// +// Warning: this file is generated, see include/CGAL/licence/README.md +// not entirely true due to the backward compatibility issue + +#ifndef CGAL_LICENSE_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_H +#define CGAL_LICENSE_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_H + +#include +#include + +// backward compatibility +#ifdef CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#define CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#endif + +#ifdef CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE + +# if CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE + +# if defined(CGAL_LICENSE_WARNING) + + CGAL_pragma_warning("Your commercial license for CGAL does not cover " + "this release of the Polygon Mesh Processing - Combinatorial Repair package.") +# endif + +# ifdef CGAL_LICENSE_ERROR +# error "Your commercial license for CGAL does not cover this release \ + of the Polygon Mesh Processing - Combinatorial Repair package. \ + You get this error, as you defined CGAL_LICENSE_ERROR." +# endif // CGAL_LICENSE_ERROR + +# endif // CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE + +#else // no CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE + +# if defined(CGAL_LICENSE_WARNING) + CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE is not defined." + "\nYou use the CGAL Polygon Mesh Processing - Combinatorial Repair package under " + "the terms of the GPLv3+.") +# endif // CGAL_LICENSE_WARNING + +# ifdef CGAL_LICENSE_ERROR +# error "The macro CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE is not defined.\ + You use the CGAL Polygon Mesh Processing - Combinatorial Repair package under the terms of \ + the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR." +# endif // CGAL_LICENSE_ERROR + +#endif // no CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE + +#endif // CGAL_LICENSE_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_H diff --git a/Installation/include/CGAL/license/Polygon_mesh_processing/repair.h b/Installation/include/CGAL/license/Polygon_mesh_processing/geometric_repair.h similarity index 53% rename from Installation/include/CGAL/license/Polygon_mesh_processing/repair.h rename to Installation/include/CGAL/license/Polygon_mesh_processing/geometric_repair.h index 7481b75ff73..2d77d99530c 100644 --- a/Installation/include/CGAL/license/Polygon_mesh_processing/repair.h +++ b/Installation/include/CGAL/license/Polygon_mesh_processing/geometric_repair.h @@ -11,44 +11,44 @@ // // Warning: this file is generated, see include/CGAL/license/README.md -#ifndef CGAL_LICENSE_POLYGON_MESH_PROCESSING_REPAIR_H -#define CGAL_LICENSE_POLYGON_MESH_PROCESSING_REPAIR_H +#ifndef CGAL_LICENSE_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_H +#define CGAL_LICENSE_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_H #include #include -#ifdef CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#ifdef CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE -# if CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE +# if CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE # if defined(CGAL_LICENSE_WARNING) CGAL_pragma_warning("Your commercial license for CGAL does not cover " - "this release of the Polygon Mesh Processing - Repair package.") + "this release of the Polygon Mesh Processing - Geometric Repair package.") # endif # ifdef CGAL_LICENSE_ERROR # error "Your commercial license for CGAL does not cover this release \ - of the Polygon Mesh Processing - Repair package. \ + of the Polygon Mesh Processing - Geometric Repair package. \ You get this error, as you defined CGAL_LICENSE_ERROR." # endif // CGAL_LICENSE_ERROR -# endif // CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE +# endif // CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE -#else // no CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#else // no CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE # if defined(CGAL_LICENSE_WARNING) - CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE is not defined." - "\nYou use the CGAL Polygon Mesh Processing - Repair package under " + CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE is not defined." + "\nYou use the CGAL Polygon Mesh Processing - Geometric Repair package under " "the terms of the GPLv3+.") # endif // CGAL_LICENSE_WARNING # ifdef CGAL_LICENSE_ERROR -# error "The macro CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE is not defined.\ - You use the CGAL Polygon Mesh Processing - Repair package under the terms of \ +# error "The macro CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE is not defined.\ + You use the CGAL Polygon Mesh Processing - Geometric Repair package under the terms of \ the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR." # endif // CGAL_LICENSE_ERROR -#endif // no CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#endif // no CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE -#endif // CGAL_LICENSE_POLYGON_MESH_PROCESSING_REPAIR_H +#endif // CGAL_LICENSE_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_H diff --git a/Installation/include/CGAL/license/gpl_package_list.txt b/Installation/include/CGAL/license/gpl_package_list.txt index f023d48f375..ee177d9ae77 100644 --- a/Installation/include/CGAL/license/gpl_package_list.txt +++ b/Installation/include/CGAL/license/gpl_package_list.txt @@ -55,7 +55,8 @@ Polygon_mesh_processing/measure Polygon Mesh Processing - Geometric Measure Polygon_mesh_processing/meshing_hole_filling Polygon Mesh Processing - Meshing and Hole Filling Polygon_mesh_processing/orientation Polygon Mesh Processing - Orientation Polygon_mesh_processing/predicate Polygon Mesh Processing - Predicate -Polygon_mesh_processing/repair Polygon Mesh Processing - Repair +Polygon_mesh_processing/combinatorial_repair Polygon Mesh Processing - Combinatorial Repair +Polygon_mesh_processing/geometric_repair Polygon Mesh Processing - Geometric Repair Polygon_mesh_processing/miscellaneous Polygon Mesh Processing - Miscellaneous Polygon_mesh_processing/detect_features Polygon Mesh Processing - Feature Detection Polygon_mesh_processing/collision_detection Polygon Mesh Processing - Collision Detection diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index 0d2399605c9..b807ad3c412 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -89,7 +89,7 @@ if (NOT CGAL_DATA_DIR) if (EXISTS "${CMAKE_SOURCE_DIR}/../../data") set(CGAL_DATA_DIR "${CMAKE_SOURCE_DIR}/../../data") else() - if(CGAL_TEST_SUITE) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) message(WARNING "CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the default value of CGAL::data_file_path()") endif() endif() @@ -196,7 +196,7 @@ cgal_setup_module_path() set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) include(${CGAL_MODULES_DIR}/CGAL_target_use_TBB.cmake) -if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST ) +if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) # Do not use -isystem for CGAL include paths set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE) endif() diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 6f0f260a594..9cc25059be9 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -62,19 +62,19 @@ #define CGAL_DO_INTERSECT_FUNCTION(A, B, DIM) \ template \ - inline bool \ + inline typename K::Boolean \ do_intersect(const A& a, const B& b) { \ return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } \ template \ - inline bool \ + inline typename K::Boolean \ do_intersect(const B& b, const A& a) { \ return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(b, a))); \ } #define CGAL_DO_INTERSECT_FUNCTION_SELF(A, DIM) \ template \ - inline bool \ + inline typename K::Boolean \ do_intersect(const A & a, const A & b) { \ return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } @@ -152,21 +152,21 @@ intersection_impl(const A& a, const B& b, Dynamic_dimension_tag) { } template -inline bool +inline auto // K::Boolean do_intersect_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_2_object()(a, b); } template -inline bool +inline auto // K::Boolean do_intersect_impl(const A& a, const B& b, Dimension_tag<3>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_3_object()(a, b); } template -inline bool +inline auto // K::Boolean do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_d_object()(a, b); @@ -188,7 +188,7 @@ do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { // template // inline -// bool +// auto // K::Boolean // do_intersect(const A& a, const B& b) { // CGAL_static_assertion_msg((std::is_same::value), // "do_intersect with objects of different dimensions not supported"); diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h index c47b04b035c..399c9ac7046 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h @@ -24,18 +24,19 @@ namespace Intersections { namespace internal { template -bool do_intersect(const CGAL::Bbox_2& bbox, - const typename K::Circle_2& circle, - const K&) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const typename K::Circle_2& circle, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, bbox, K()); } - template -bool do_intersect(const typename K::Circle_2& circle, - const CGAL::Bbox_2& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Circle_2& circle, + const CGAL::Bbox_2& bbox, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, bbox, K()); } @@ -44,15 +45,17 @@ bool do_intersect(const typename K::Circle_2& circle, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& a, - const Circle_2& b) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& a, + const Circle_2& b) { return K().do_intersect_2_object()(a, b); } template -bool do_intersect(const Circle_2& a, - const CGAL::Bbox_2& b) +typename K::Boolean +do_intersect(const Circle_2& a, + const CGAL::Bbox_2& b) { return K().do_intersect_2_object()(a, b); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h index 1ada75030d3..1c389664308 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h @@ -21,15 +21,19 @@ namespace CGAL { template -inline bool do_intersect(const Iso_rectangle_2 &rect, - const Bbox_2 &box) +inline +typename K::Boolean +do_intersect(const Iso_rectangle_2& rect, + const Bbox_2& box) { return do_intersect(K::Iso_rectangle_2(box), rect); } template -inline bool do_intersect(const Bbox_2 &box, - const Iso_rectangle_2 &rect) +inline +typename K::Boolean +do_intersect(const Bbox_2 &box, + const Iso_rectangle_2 &rect) { return do_intersect(rect, box); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h index 3b762f0882e..76a4cf316a0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h @@ -27,18 +27,20 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Line_2& line, - const CGAL::Bbox_2& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Line_2& line, + const CGAL::Bbox_2& bbox, + const K& k) { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; return Intersections::internal::do_intersect(line, Iso_rectangle_2(bbox), k); } template -bool do_intersect(const CGAL::Bbox_2& bbox, - const typename K::Line_2& line, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const typename K::Line_2& line, + const K& k) { return Intersections::internal::do_intersect(line, bbox, k); } @@ -47,13 +49,17 @@ bool do_intersect(const CGAL::Bbox_2& bbox, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& bbox, const Line_2& line) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const Line_2& line) { return K().do_intersect_2_object()(bbox, line); } template -bool do_intersect(const Line_2& line, const CGAL::Bbox_2& bbox) +typename K::Boolean +do_intersect(const Line_2& line, + const CGAL::Bbox_2& bbox) { return K().do_intersect_2_object()(line, bbox); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h index 237407c60ba..1c214d44a4d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h @@ -24,9 +24,11 @@ namespace Intersections { namespace internal { template -inline bool do_intersect(const Bbox_2 &bbox, - const Point_2 &pt, - const K& k) +inline +typename K::Boolean +do_intersect(const Bbox_2 &bbox, + const Point_2 &pt, + const K& k) { Point_2 bl(bbox.xmin(), bbox.ymin()), tr(bbox.xmax(), bbox.ymax()); @@ -36,9 +38,11 @@ inline bool do_intersect(const Bbox_2 &bbox, } template -inline bool do_intersect(const Point_2 &pt, - const Bbox_2& bbox, - const K& k) +inline +typename K::Boolean +do_intersect(const Point_2 &pt, + const Bbox_2& bbox, + const K& k) { return do_intersect(bbox, pt, k); } @@ -69,15 +73,17 @@ intersection(const CGAL::Bbox_2& b, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& a, - const Point_2& b) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& a, + const Point_2& b) { return Intersections::internal::do_intersect(a,b,K()); } template -bool do_intersect(const Point_2& a, - const CGAL::Bbox_2& b) +typename K::Boolean +do_intersect(const Point_2& a, + const CGAL::Bbox_2& b) { return Intersections::internal::do_intersect(b,a,K()); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h index 75b2e71ebf7..ca5c4411e7e 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h @@ -27,18 +27,20 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Ray_2& ray, - const CGAL::Bbox_2& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Ray_2& ray, + const CGAL::Bbox_2& bbox, + const K& k) { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; return Intersections::internal::do_intersect(ray, Iso_rectangle_2(bbox), k); } template -bool do_intersect(const CGAL::Bbox_2& bbox, - const typename K::Ray_2& ray, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const typename K::Ray_2& ray, + const K& k) { return Intersections::internal::do_intersect(ray, bbox, k); } @@ -47,13 +49,17 @@ bool do_intersect(const CGAL::Bbox_2& bbox, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& bbox, const Ray_2& ray) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const Ray_2& ray) { return K().do_intersect_2_object()(bbox, ray); } template -bool do_intersect(const Ray_2& ray, const CGAL::Bbox_2& bbox) +typename K::Boolean +do_intersect(const Ray_2& ray, + const CGAL::Bbox_2& bbox) { return K().do_intersect_2_object()(ray, bbox); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h index 1bb05d61c91..25834353eb8 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h @@ -20,20 +20,21 @@ namespace CGAL { - template -inline bool do_intersect( - const Segment_2 &seg, - const Bbox_2 &box) +inline +typename K::Boolean +do_intersect(const Segment_2& seg, + const Bbox_2& box) { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return do_intersect(rec, seg); } template -inline bool do_intersect( - const Bbox_2 &box, - const Segment_2 &seg) +inline +typename K::Boolean +do_intersect(const Bbox_2& box, + const Segment_2& seg) { return do_intersect(seg, box); } @@ -41,7 +42,8 @@ inline bool do_intersect( template typename Intersection_traits::result_type intersection(const CGAL::Bbox_2& box, - const Segment_2& seg) { + const Segment_2& seg) + { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return intersection(rec, seg); } @@ -49,9 +51,11 @@ intersection(const CGAL::Bbox_2& box, template typename Intersection_traits::result_type intersection(const Segment_2& seg, - const CGAL::Bbox_2& box) { + const CGAL::Bbox_2& box) +{ return intersection(box, seg); } -} +} // namespace CGAL + #endif // CGAL_INTERSECTIONS_BBOX_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h index 854499c7151..0cf76cbff32 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h @@ -20,20 +20,21 @@ namespace CGAL { - template -inline bool do_intersect( - const Triangle_2 &tr, - const Bbox_2 &box) +inline +typename K::Boolean +do_intersect(const Triangle_2& tr, + const Bbox_2& box) { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return do_intersect(rec, tr); } template -inline bool do_intersect( - const Bbox_2 &box, - const Triangle_2 &tr) +inline +typename K::Boolean +do_intersect(const Bbox_2& box, + const Triangle_2& tr) { return do_intersect(tr, box); } @@ -41,7 +42,8 @@ inline bool do_intersect( template typename Intersection_traits::result_type intersection(const Bbox_2& box, - const Triangle_2& tr) { + const Triangle_2& tr) +{ typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return intersection(rec, tr); } @@ -49,9 +51,11 @@ intersection(const Bbox_2& box, template typename Intersection_traits::result_type intersection(const Triangle_2& tr, - const Bbox_2& box) { + const Bbox_2& box) +{ return intersection(box, tr); } -} +} // namespace CGAL + #endif // CGAL_INTERSECTIONS_BBOX_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h index 4f24b27c2de..ee7e48255a0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h @@ -27,9 +27,9 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Circle_2 & circ1, - const typename K::Circle_2& circ2, - const K&) +typename K::Boolean do_intersect(const typename K::Circle_2& circ1, + const typename K::Circle_2& circ2, + const K&) { typedef typename K::FT FT; diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h index c1ab3dbc4e1..37a41c0b66d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h @@ -24,9 +24,9 @@ namespace internal { // Circle_2 is not a disk, thus if the box is contained within the circle, there is no intersection. template -bool do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle, - const typename K::Iso_rectangle_2& rec, - const K&) +typename K::Boolean do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle, + const typename K::Iso_rectangle_2& rec, + const K&) { typedef typename K::FT FT; typedef typename K::Point_2 Point; @@ -92,18 +92,17 @@ bool do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle, } template -bool do_intersect(const typename K::Iso_rectangle_2& rec, - const typename K::Circle_2& circle, - const K&) +typename K::Boolean do_intersect(const typename K::Iso_rectangle_2& rec, + const typename K::Circle_2& circle, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, rec, K()); } - template -bool do_intersect(const typename K::Circle_2& circle, - const typename K::Iso_rectangle_2& rec, - const K&) +typename K::Boolean do_intersect(const typename K::Circle_2& circle, + const typename K::Iso_rectangle_2& rec, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, rec, K()); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h index a850baa2253..2d2ac26fc56 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h @@ -29,8 +29,8 @@ namespace Intersections { namespace internal { template -bool -do_intersect(const typename K::Circle_2 & c, +typename K::Boolean +do_intersect(const typename K::Circle_2& c, const typename K::Line_2& l, const K&) { @@ -38,9 +38,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Line_2& l, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return squared_distance(c.center(), l) <= c.squared_radius(); @@ -53,4 +53,4 @@ CGAL_DO_INTERSECT_FUNCTION(Circle_2, Line_2, 2) } // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_CIRCLE_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h index 3d908c6a26b..ac88c867d12 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h @@ -25,20 +25,19 @@ namespace internal { template inline -bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Circle_2 &circle, +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Circle_2& circle, const K&) { return circle.has_on_boundary(pt); } - template inline -bool -do_intersect(const typename K::Circle_2 &circle, - const typename K::Point_2 &pt, +typename K::Boolean +do_intersect(const typename K::Circle_2& circle, + const typename K::Point_2& pt, const K&) { return circle.has_on_boundary(pt); @@ -48,8 +47,8 @@ do_intersect(const typename K::Circle_2 &circle, template typename CGAL::Intersection_traits ::result_type -intersection(const typename K::Point_2 &pt, - const typename K::Circle_2 &circle, +intersection(const typename K::Point_2& pt, + const typename K::Circle_2& circle, const K& k) { if (do_intersect(pt,circle, k)) @@ -60,8 +59,8 @@ intersection(const typename K::Point_2 &pt, template typename CGAL::Intersection_traits ::result_type -intersection(const typename K::Circle_2 &circle, - const typename K::Point_2 &pt, +intersection(const typename K::Circle_2& circle, + const typename K::Point_2& pt, const K& k) { return internal::intersection(pt, circle, k); @@ -73,5 +72,6 @@ intersection(const typename K::Circle_2 &circle, CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2) -} //namespace CGAL +} // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h index 18c19fd8466..0bb6c56f331 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h @@ -24,8 +24,8 @@ namespace Intersections { namespace internal { template -bool -do_intersect(const typename K::Circle_2 & c, +typename K::Boolean +do_intersect(const typename K::Circle_2& c, const typename K::Ray_2& r, const K&) { @@ -33,9 +33,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Ray_2& r, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return squared_distance(c.center(), r) <= c.squared_radius(); @@ -47,4 +47,5 @@ do_intersect(const typename K::Ray_2& r, CGAL_DO_INTERSECT_FUNCTION(Circle_2, Ray_2, 2) } // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_CIRCLE_2_RAY_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h index 71384fcc4e6..d884d520332 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h @@ -24,8 +24,8 @@ namespace Intersections { namespace internal { template -bool -do_intersect(const typename K::Circle_2 & c, +typename K::Boolean +do_intersect(const typename K::Circle_2& c, const typename K::Segment_2& s, const K&) { @@ -33,9 +33,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Segment_2& s, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return squared_distance(c.center(), s) <= c.squared_radius(); @@ -47,4 +47,5 @@ do_intersect(const typename K::Segment_2& s, CGAL_DO_INTERSECT_FUNCTION(Circle_2, Segment_2, 2) } // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_CIRCLE_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h index 9353da936ba..e74f1e80e8d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h @@ -25,7 +25,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Circle_2 & c, const typename K::Triangle_2& t, const K&) @@ -48,9 +48,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Triangle_2& t, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return do_intersect(c,t); @@ -62,4 +62,5 @@ do_intersect(const typename K::Triangle_2& t, CGAL_DO_INTERSECT_FUNCTION(Circle_2, Triangle_2, 2) } // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_CIRCLE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h index a097eab4250..0b73db82b88 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h @@ -74,20 +74,20 @@ intersection( } template -inline bool -do_intersect(const typename K::Iso_rectangle_2 &irect1, - const typename K::Iso_rectangle_2 &irect2, - const K&) { +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& irect1, + const typename K::Iso_rectangle_2& irect2, + const K&) +{ return bool(intersection(irect1, irect2)); } } // namespace internal } // namespace Intersections - CGAL_INTERSECTION_FUNCTION_SELF(Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Iso_rectangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_ISO_RECTANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h index a8d188a7a42..74bb8ff2f82 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h @@ -58,25 +58,27 @@ protected: }; template -inline bool do_intersect(const typename K::Line_2 &p1, - const typename K::Iso_rectangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Iso_rectangle_2& ir, + const K&) { - typedef Line_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Line_2_Iso_rectangle_2_pair pair_t; + pair_t pair(&l, &ir); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect(const typename K::Iso_rectangle_2 &p2, - const typename K::Line_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Line_2& l, + const K& k) { - return internal::do_intersect(p1, p2, k); + return internal::do_intersect(l, ir, k); } - - template typename Line_2_Iso_rectangle_2_pair::Intersection_results Line_2_Iso_rectangle_2_pair::intersection_type() const @@ -217,4 +219,4 @@ CGAL_DO_INTERSECT_FUNCTION(Line_2, Iso_rectangle_2, 2) #include -#endif +#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h index 853dcc54600..011eacf8e36 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h @@ -30,22 +30,22 @@ namespace internal { template inline -bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Iso_rectangle_2 &iso, +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Iso_rectangle_2& iso, const K&) { - return !iso.has_on_unbounded_side(pt); + return !iso.has_on_unbounded_side(pt); } template inline -bool -do_intersect(const typename K::Iso_rectangle_2 &iso, - const typename K::Point_2 &pt, +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& iso, + const typename K::Point_2& pt, const K&) { - return !iso.has_on_unbounded_side(pt); + return !iso.has_on_unbounded_side(pt); } template @@ -77,6 +77,6 @@ intersection(const typename K::Iso_rectangle_2 &iso, CGAL_INTERSECTION_FUNCTION(Point_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Iso_rectangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_ISO_RECTANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h index 5f2b52a311a..6d9bb8e6e91 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h @@ -55,21 +55,25 @@ protected: }; template -inline bool do_intersect(const typename K::Ray_2 &p1, - const typename K::Iso_rectangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Iso_rectangle_2& ir, + const K&) { - typedef Ray_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Iso_rectangle_2_pair pair_t; + pair_t pair(&r, &ir); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect(const typename K::Iso_rectangle_2 &p2, - const typename K::Ray_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Ray_2& r, + const K& k) { - return do_intersect(p1, p2, k); + return do_intersect(r, ir, k); } template @@ -200,9 +204,8 @@ Ray_2_Iso_rectangle_2_pair::intersection_point() const CGAL_INTERSECTION_FUNCTION(Ray_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Iso_rectangle_2, 2) - -} //namespace CGAL +} // namespace CGAL #include -#endif // CGAL_RAY_2_iSO_RECTANGLE_2_INTERSECTION_H +#endif // CGAL_RAY_2_ISO_RECTANGLE_2_INTERSECTION_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h index 28121109d10..be4c309f0df 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h @@ -54,21 +54,6 @@ protected: _max; }; -template -inline bool do_intersect( - const typename K::Segment_2 &p1, - const typename K::Iso_rectangle_2 &p2, - const K&) -{ - typedef Segment_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} - - - - - template typename CGAL::Intersection_traits ::result_type @@ -208,17 +193,26 @@ intersection_point() const return translated_point(_ref_point, construct_scaled_vector(_dir,_min)); } - +template +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Iso_rectangle_2& ir, + const K&) +{ + typedef Segment_2_Iso_rectangle_2_pair pair_t; + pair_t pair(&s, &ir); + return pair.intersection_type() != pair_t::NO_INTERSECTION; +} template -inline bool do_intersect( - const typename K::Iso_rectangle_2 &p1, - const typename K::Segment_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Segment_2& s, + const K& k) { - typedef Segment_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + return do_intersect(s, ir, k); } } // namespace internal @@ -227,7 +221,7 @@ inline bool do_intersect( CGAL_INTERSECTION_FUNCTION(Segment_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Iso_rectangle_2, 2) -} //namespace CGAL +} // namespace CGAL #include diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h index 1409a6c7db8..0fb171e7b92 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h @@ -292,10 +292,10 @@ namespace internal { } template - bool do_intersect( - const typename K::Triangle_2 &tr, - const typename K::Iso_rectangle_2 &ir, - const K& k) + typename K::Boolean + do_intersect(const typename K::Triangle_2& tr, + const typename K::Iso_rectangle_2& ir, + const K& k) { //1) check if at least one vertex of tr is not outside ir //2) if not, check if at least on vertex of tr is not outside tr @@ -318,20 +318,21 @@ namespace internal { } template - inline bool do_intersect( - const typename K::Iso_rectangle_2 &ir, - const typename K::Triangle_2 &tr, - const K& k) + inline + typename K::Boolean + do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Triangle_2& tr, + const K& k) { - return do_intersect(tr,ir,k); + return do_intersect(tr, ir, k); } -} //namespace internal +} // namespace internal } // namespace Intersections CGAL_INTERSECTION_FUNCTION(Triangle_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Triangle_2, Iso_rectangle_2, 2) -}//end namespace +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h index 8d2d3e6ae0d..6a48b777594 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h @@ -52,17 +52,18 @@ protected: mutable typename K::Point_2 _intersection_point; }; -template -inline bool do_intersect( - const typename K::Line_2 &p1, - const typename K::Line_2 &p2, - const K&) -{ - typedef Line_2_Line_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} +template +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l1, + const typename K::Line_2& l2, + const K&) +{ + typedef Line_2_Line_2_pair pair_t; + pair_t pair(&l1, &l2); + return pair.intersection_type() != pair_t::NO_INTERSECTION; +} template @@ -200,7 +201,6 @@ Line_2_Line_2_pair::intersection_line() const CGAL_INTERSECTION_FUNCTION_SELF(Line_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Line_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_LINE_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h index 9e3c2525b44..96ede987ac4 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h @@ -29,21 +29,23 @@ namespace Intersections { namespace internal { template -inline bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Line_2 &line, +inline +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Line_2& line, const K&) { - return line.has_on(pt); + return line.has_on(pt); } template -inline bool -do_intersect(const typename K::Line_2 &line, - const typename K::Point_2 &pt, +inline +typename K::Boolean +do_intersect(const typename K::Line_2& line, + const typename K::Point_2& pt, const K&) { - return line.has_on(pt); + return line.has_on(pt); } template @@ -76,6 +78,6 @@ intersection(const typename K::Line_2 &line, CGAL_INTERSECTION_FUNCTION(Point_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Line_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h index 87f59d8a45a..8ea0cff4cd4 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h @@ -55,17 +55,26 @@ protected: }; template -inline bool do_intersect( - const typename K::Ray_2 &p1, - const typename K::Line_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Line_2& l, + const K&) { - typedef Ray_2_Line_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Line_2_pair pair_t; + pair_t pair(&r, &l); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } - +template +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Ray_2& r, + const K& k) +{ + return do_intersect(r, l, k); +} template typename Intersection_traits @@ -99,20 +108,6 @@ intersection(const typename K::Line_2 &line, return internal::intersection(ray, line, k); } - -template -inline bool do_intersect( - const typename K::Line_2 &p1, - const typename K::Ray_2 &p2, - const K&) -{ - typedef Ray_2_Line_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} - - - template typename Ray_2_Line_2_pair::Intersection_results Ray_2_Line_2_pair::intersection_type() const diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h index 5c2850af7a8..f61d38c2a06 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h @@ -51,14 +51,25 @@ protected: }; template -inline bool do_intersect( - const typename K::Segment_2 &p1, - const typename K::Line_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Line_2& l, + const K& ) { - typedef Segment_2_Line_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Segment_2_Line_2_pair pair_t; + pair_t pair(&s, &l); + return pair.intersection_type() != pair_t::NO_INTERSECTION; +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Segment_2& s, + const K& k) +{ + return internal::do_intersect(s, l, k); } template @@ -92,17 +103,6 @@ intersection(const typename K::Line_2 &line, return internal::intersection(seg, line, k); } - -template -inline bool do_intersect( - const typename K::Line_2 &line, - const typename K::Segment_2 &seg, - const K& k) -{ - return internal::do_intersect(seg, line, k); -} - - template typename Segment_2_Line_2_pair::Intersection_results Segment_2_Line_2_pair::intersection_type() const @@ -156,7 +156,6 @@ Segment_2_Line_2_pair::intersection_segment() const CGAL_INTERSECTION_FUNCTION(Segment_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Line_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h index 9f514030f8a..158ede462b6 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h @@ -55,24 +55,24 @@ protected: template inline -bool -do_intersect(const typename K::Line_2 &p1, - const typename K::Triangle_2 &p2, +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Triangle_2& tr, const K&) { - typedef Line_2_Triangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Line_2_Triangle_2_pair pair_t; + pair_t pair(&l, &tr); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template inline -bool -do_intersect(const typename K::Triangle_2 &p2, - const typename K::Line_2 &p1, +typename K::Boolean +do_intersect(const typename K::Triangle_2& tr, + const typename K::Line_2& l, const K& k) { - return internal::do_intersect(p1, p2, k); + return internal::do_intersect(l, tr, k); } template @@ -190,6 +190,6 @@ intersection(const typename K::Triangle_2 &tr, CGAL_INTERSECTION_FUNCTION(Line_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Line_2, Triangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_LINE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h index 7c67f3c4cf5..3b13b6a461e 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h @@ -28,34 +28,33 @@ namespace Intersections { namespace internal { template -inline bool -do_intersect(const typename K::Point_2 &pt1, - const typename K::Point_2 &pt2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Point_2& pt1, + const typename K::Point_2& pt2, + const K& k) { - return pt1 == pt2; + return k.equal_2_object()(pt1, pt2); } template -typename CGAL::Intersection_traits -::result_type -intersection(const typename K::Point_2 &pt1, - const typename K::Point_2 &pt2, - const K&) +typename CGAL::Intersection_traits::result_type +intersection(const typename K::Point_2& pt1, + const typename K::Point_2& pt2, + const K& k) { - if (pt1 == pt2) { - return intersection_return(pt1); - } - return intersection_return(); + if (k.equal_2_object()(pt1, pt2)) + return intersection_return(pt1); + + return intersection_return(); } -}// namespace internal +} // namespace internal } // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Point_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Point_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_POINT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h index ae67b94c503..271e86184cf 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h @@ -30,9 +30,9 @@ namespace internal { template inline -bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Ray_2 &ray, +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Ray_2& ray, const K&) { return ray.has_on(pt); @@ -41,9 +41,9 @@ do_intersect(const typename K::Point_2 &pt, template inline -bool -do_intersect(const typename K::Ray_2 &ray, - const typename K::Point_2 &pt, +typename K::Boolean +do_intersect(const typename K::Ray_2& ray, + const typename K::Point_2& pt, const K&) { return ray.has_on(pt); @@ -51,8 +51,7 @@ do_intersect(const typename K::Ray_2 &ray, template -typename CGAL::Intersection_traits -::result_type +typename CGAL::Intersection_traits::result_type intersection(const typename K::Point_2 &pt, const typename K::Ray_2 &ray, const K& k) @@ -64,8 +63,7 @@ intersection(const typename K::Point_2 &pt, } template -typename CGAL::Intersection_traits -::result_type +typename CGAL::Intersection_traits::result_type intersection(const typename K::Ray_2 &ray, const typename K::Point_2 &pt, const K& k) @@ -79,7 +77,6 @@ intersection(const typename K::Ray_2 &ray, CGAL_INTERSECTION_FUNCTION(Point_2, Ray_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Ray_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_RAY_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h index 3486d58896f..8a48c10b6e3 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h @@ -30,7 +30,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_2 &pt, const typename K::Segment_2 &seg, const K&) @@ -40,7 +40,7 @@ do_intersect(const typename K::Point_2 &pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_2 &seg, const typename K::Point_2 &pt, const K&) @@ -77,10 +77,9 @@ intersection( const typename K::Segment_2 &seg, } // namespace internal } // namespace Intersections - CGAL_INTERSECTION_FUNCTION(Point_2, Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Segment_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h index ba496198cd9..1d70d3b7d54 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h @@ -50,9 +50,11 @@ protected: }; template -inline bool do_intersect(const typename K::Point_2 &p1, - const typename K::Triangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Point_2& p1, + const typename K::Triangle_2& p2, + const K&) { typedef Point_2_Triangle_2_pair pair_t; pair_t pair(&p1, &p2); @@ -60,9 +62,11 @@ inline bool do_intersect(const typename K::Point_2 &p1, } template -inline bool do_intersect(const typename K::Triangle_2 &p2, - const typename K::Point_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Triangle_2& p2, + const typename K::Point_2& p1, + const K& k) { return internal::do_intersect(p1, p2, k); } @@ -133,6 +137,6 @@ intersection(const typename K::Triangle_2 &tr, CGAL_INTERSECTION_FUNCTION(Point_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Triangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h index 2b0c166797b..850f3e364b0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h @@ -54,14 +54,15 @@ protected: }; template -inline bool do_intersect( - const typename K::Ray_2 &p1, - const typename K::Ray_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r1, + const typename K::Ray_2& r2, + const K&) { - typedef Ray_2_Ray_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Ray_2_pair pair_t; + pair_t pair(&r1, &r2); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } @@ -252,7 +253,6 @@ intersection(const typename K::Ray_2 &ray1, CGAL_INTERSECTION_FUNCTION_SELF(Ray_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Ray_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_RAY_2_RAY_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h index 2cdebe84a13..acc6d4a41df 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h @@ -54,21 +54,25 @@ protected: }; template -inline bool do_intersect(const typename K::Ray_2 &p1, - const typename K::Segment_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Segment_2& s, + const K&) { - typedef Ray_2_Segment_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Segment_2_pair pair_t; + pair_t pair(&r, &s); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect(const typename K::Segment_2 &p2, - const typename K::Ray_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Ray_2& r, + const K& k) { - return internal::do_intersect(p1, p2, k); + return internal::do_intersect(r, s, k); } template @@ -265,6 +269,6 @@ intersection(const typename K::Segment_2 &seg, CGAL_INTERSECTION_FUNCTION(Ray_2, Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Segment_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_RAY_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h index 6db56586c55..cb915a1020b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h @@ -165,26 +165,26 @@ intersection(const typename K::Triangle_2&tr, template -inline bool do_intersect( - const typename K::Ray_2 &p1, - const typename K::Triangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Triangle_2& tr, + const K&) { - typedef Ray_2_Triangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Triangle_2_pair pair_t; + pair_t pair(&r, &tr); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect( - const typename K::Triangle_2 &p1, - const typename K::Ray_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Triangle_2& tr, + const typename K::Ray_2& r, + const K& k) { - typedef Ray_2_Triangle_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + return do_intersect(r, tr, k); } } // namespace internal @@ -193,7 +193,6 @@ inline bool do_intersect( CGAL_INTERSECTION_FUNCTION(Ray_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Triangle_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_RAY_2_TRIANGLE_2_H 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 5fd1545cc38..57f2e31b5bb 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 @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace CGAL { @@ -326,7 +325,7 @@ do_intersect_with_info(const typename K::Segment_2 &seg1, template -bool +typename K::Boolean do_intersect(const typename K::Segment_2 &seg1, const typename K::Segment_2 &seg2, const K& k) @@ -492,6 +491,6 @@ intersection(const typename K::Segment_2 &seg1, CGAL_INTERSECTION_FUNCTION_SELF(Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Segment_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h index 4d2b93c05cf..f747ac083cf 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h @@ -52,19 +52,26 @@ protected: }; template -inline bool do_intersect( - const typename K::Segment_2 &p1, - const typename K::Triangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Triangle_2& tr, + const K&) { - typedef Segment_2_Triangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Segment_2_Triangle_2_pair pair_t; + pair_t pair(&s, &tr); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } - - - +template +inline +typename K::Boolean +do_intersect(const typename K::Triangle_2& tr, + const typename K::Segment_2& s, + const K& k) +{ + return do_intersect(s, tr, k); +} template typename Segment_2_Triangle_2_pair::Intersection_results @@ -174,24 +181,12 @@ intersection(const typename K::Triangle_2&tr, return internal::intersection(seg, tr, k); } - -template -inline bool do_intersect( - const typename K::Triangle_2 &p1, - const typename K::Segment_2 &p2, - const K&) -{ - typedef Segment_2_Triangle_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} - } // namespace internal } // namespace Intersections CGAL_INTERSECTION_FUNCTION(Segment_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Triangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h index 27b2d9f8f67..405d6499696 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h @@ -22,8 +22,10 @@ #include namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_2, 2) CGAL_INTERSECTION_FUNCTION_SELF(Triangle_2, 2) + } // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_TRIANGLE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h index 36cc7e06486..88176280301 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h @@ -14,7 +14,6 @@ // // Author(s) : Geert-Jan Giezeman - #ifndef CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H #define CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H @@ -346,6 +345,6 @@ collinear_order(typename K::Point_2 const &pt1, typename K::Point_2 const & pt2) } // namespace internal } // namespace Intersections -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h index e5db80f33e1..774abba6178 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h @@ -23,15 +23,15 @@ namespace Intersections { namespace internal { template -bool intersection_test_vertex(const typename K::Point_2 * P1, - const typename K::Point_2 * Q1, - const typename K::Point_2 * R1, - const typename K::Point_2 * P2, - const typename K::Point_2 * Q2, - const typename K::Point_2 * R2, - const K & k ){ - - +typename K::Boolean +intersection_test_vertex(const typename K::Point_2* P1, + const typename K::Point_2* Q1, + const typename K::Point_2* R1, + const typename K::Point_2* P2, + const typename K::Point_2* Q2, + const typename K::Point_2* R2, + const K& k) +{ CGAL_kernel_precondition( k.orientation_2_object() (*P1,*Q1,*R1) == POSITIVE); CGAL_kernel_precondition( k.orientation_2_object() (*P2,*Q2,*R2) @@ -65,16 +65,15 @@ bool intersection_test_vertex(const typename K::Point_2 * P1, template -bool intersection_test_edge(const typename K::Point_2 * P1, - const typename K::Point_2 * Q1, - const typename K::Point_2 * R1, - const typename K::Point_2 * P2, - const typename K::Point_2 * - CGAL_kernel_precondition_code(Q2), - const typename K::Point_2 * R2, - const K & k ){ - - +typename K::Boolean +intersection_test_edge(const typename K::Point_2* P1, + const typename K::Point_2* Q1, + const typename K::Point_2* R1, + const typename K::Point_2* P2, + const typename K::Point_2* CGAL_kernel_precondition_code(Q2), + const typename K::Point_2* R2, + const K& k) +{ CGAL_kernel_precondition( k.orientation_2_object() (*P1,*Q1,*R1) == POSITIVE); CGAL_kernel_precondition( k.orientation_2_object() (*P2,*Q2,*R2) @@ -99,12 +98,12 @@ bool intersection_test_edge(const typename K::Point_2 * P1, } - template -bool do_intersect(const typename K::Triangle_2 &t1, - const typename K::Triangle_2 &t2, - const K & k ){ - +typename K::Boolean +do_intersect(const typename K::Triangle_2& t1, + const typename K::Triangle_2& t2, + const K& k) +{ CGAL_kernel_precondition( ! k.is_degenerate_2_object() (t1) ); CGAL_kernel_precondition( ! k.is_degenerate_2_object() (t2) ); @@ -164,6 +163,6 @@ bool do_intersect(const typename K::Triangle_2 &t1, } // namespace internal } // namespace Intersections -} //namespace CGAL +} // namespace CGAL -#endif //CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H +#endif // CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h index f497eb4527f..bb244628c5a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h @@ -64,7 +64,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean inline do_intersect(const CGAL::Bbox_3& c, const CGAL::Bbox_3& bbox, diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h index fae76f0d787..9e509f0f405 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Iso_cuboid_3& ic) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Iso_cuboid_3& ic) { return K().do_intersect_3_object()(box, ic); } template -bool do_intersect(const Iso_cuboid_3& ic, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Iso_cuboid_3& ic, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(ic, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h index 20a9e5e3d2a..d0aa3a8ddd3 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h @@ -24,15 +24,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Line_3& l) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Line_3& l) { return K().do_intersect_3_object()(box, l); } template -bool do_intersect(const Line_3& l, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Line_3& l, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(l, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h index ce7888e7539..1b83a30290f 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Plane_3& pl) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Plane_3& pl) { return K().do_intersect_3_object()(box, pl); } template -bool do_intersect(const Plane_3& pl, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Plane_3& pl, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(pl, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h index 5737a04dba5..316e5ffc003 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h @@ -30,8 +30,9 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Point_3& p) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Point_3& p) { Point_3 bl(box.xmin(), box.ymin(), box.zmin()), tr(box.xmax(), box.ymax(), box.zmax()); @@ -40,8 +41,9 @@ bool do_intersect(const CGAL::Bbox_3& box, } template -bool do_intersect(const Point_3& a, - const CGAL::Bbox_3& b) +typename K::Boolean +do_intersect(const Point_3& a, + const CGAL::Bbox_3& b) { return do_intersect(b,a); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h index 3d557b0ecdd..5d53929d895 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Ray_3& r) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Ray_3& r) { return K().do_intersect_3_object()(box, r); } template -bool do_intersect(const Ray_3& r, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Ray_3& r, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(r, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h index 35b20b8091d..cb8cd08bd88 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Segment_3& s) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Segment_3& s) { return K().do_intersect_3_object()(box, s); } template -bool do_intersect(const Segment_3& s, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Segment_3& s, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(s, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h index 913020d62cd..87171cfd3de 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h @@ -28,15 +28,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Sphere_3& s) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Sphere_3& s) { return K().do_intersect_3_object()(box, s); } template -bool do_intersect(const Sphere_3& s, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Sphere_3& s, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(s, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h index 456973dbc6a..73fee00b20d 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h @@ -28,15 +28,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Tetrahedron_3& t) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Tetrahedron_3& t) { return K().do_intersect_3_object()(box, t); } template -bool do_intersect(const Tetrahedron_3& t, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Tetrahedron_3& t, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(t, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h index 202765284c7..ccf1a560256 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h @@ -29,15 +29,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Triangle_3& tr) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Triangle_3& tr) { return K().do_intersect_3_object()(box, tr); } template -bool do_intersect(const Triangle_3& tr, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Triangle_3& tr, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(tr, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h index b6d7c174b9f..764e6005cf3 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h @@ -34,4 +34,4 @@ CGAL_INTERSECTION_FUNCTION(Iso_cuboid_3, Triangle_3, 3) } // namespace CGAL -#endif // CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H +#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h index 236fd2a9f50..3030089906c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h @@ -30,7 +30,8 @@ namespace CGAL { template -inline bool +inline +typename K::Boolean do_intersect(const Plane_3& plane1, const Plane_3& plane2, const Plane_3& plane3) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h index 1a2ae1310e5..ab6a98443af 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h @@ -23,9 +23,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const CGAL::Bbox_3& bb, - const typename K::Iso_cuboid_3& ic, - const K& /* k */) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bb, + const typename K::Iso_cuboid_3& ic, + const K& /* k */) { // use CGAL::compare to access the Coercion_traits between K::FT and double if(compare(bb.xmax(), ic.xmin()) == SMALLER || compare(ic.xmax(), bb.xmin()) == SMALLER) @@ -38,9 +39,10 @@ bool do_intersect(const CGAL::Bbox_3& bb, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const CGAL::Bbox_3& bb, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const CGAL::Bbox_3& bb, + const K& k) { return do_intersect(bb, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h index 6062ba6085a..f67b6c4d853 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_LINE_3_DO_INTERSECT_H #define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_LINE_3_DO_INTERSECT_H -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf #include #include @@ -25,9 +25,9 @@ namespace CGAL { namespace Intersections { namespace internal { -template +template inline -bool +typename K::Boolean bbox_line_do_intersect_aux(const LFT px, const LFT py, const LFT pz, const LFT vx, const LFT vy, const LFT vz, const BFT bxmin, const BFT bymin, const BFT bzmin, @@ -135,9 +135,10 @@ bbox_line_do_intersect_aux(const LFT px, const LFT py, const LFT pz, } template -bool do_intersect(const typename K::Line_3& line, - const CGAL::Bbox_3& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Line_3& line, + const CGAL::Bbox_3& bbox, + const K&) { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; @@ -145,16 +146,17 @@ bool do_intersect(const typename K::Line_3& line, const Point_3& point = line.point(); const Vector_3& v = line.to_vector(); - return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), - v.x(), v.y(), v.z(), - bbox.xmin(), bbox.ymin(), bbox.zmin(), - bbox.xmax(), bbox.ymax(), bbox.zmax()); + return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), + v.x(), v.y(), v.z(), + bbox.xmin(), bbox.ymin(), bbox.zmin(), + bbox.xmax(), bbox.ymax(), bbox.zmax()); } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Line_3& line, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Line_3& line, + const K& k) { return do_intersect(line, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h index 803d8594e64..4e412f45d67 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h @@ -22,17 +22,19 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Plane_3& plane, - const Bbox_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Plane_3& plane, + const Bbox_3& bbox, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } template -bool do_intersect(const Bbox_3& bbox, - const typename K::Plane_3& plane, - const K& k) +typename K::Boolean +do_intersect(const Bbox_3& bbox, + const typename K::Plane_3& plane, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h index 36ca263a827..31d26ac1fdb 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H #define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf #include // for CGAL::internal::do_intersect_bbox_segment_aux @@ -26,9 +26,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Ray_3& ray, + const CGAL::Bbox_3& bbox, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -49,9 +50,10 @@ bool do_intersect(const typename K::Ray_3& ray, } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Ray_3& ray, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Ray_3& ray, + const K& k) { return do_intersect(ray, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h index 8a94ade50b7..f7ebc70d25e 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h @@ -22,7 +22,7 @@ #include -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf // This algorithm intersects the line with the x-, y-, and z-slabs of the // bounding box, and computes the interval [t1, t2], in the @@ -224,10 +224,10 @@ do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz, CGAL_assertion(! is_negative(dmin)); CGAL_assertion(! is_negative(dmax)); - if(bounded_0) { + CGAL_assertion_code(if(bounded_0) {) CGAL_assertion(! is_negative(tmin)); CGAL_assertion(! is_negative(tmax)); - } + CGAL_assertion_code(}) // ----------------------------------- // treat y coord @@ -365,11 +365,10 @@ do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz, CGAL_assertion(! is_negative(dzmin)); CGAL_assertion(! is_negative(dzmax)); - if(bounded_0) - { + CGAL_assertion_code(if(bounded_0) {) CGAL_assertion(! is_negative(tzmin)); CGAL_assertion(! is_negative(tzmax)); - } + CGAL_assertion_code(}) typedef Do_intersect_bbox_segment_aux_is_greater Is_greater; typedef typename Is_greater::result_type Is_greater_value; @@ -454,10 +453,9 @@ template inline typename Do_intersect_bbox_segment_aux_is_greater::result_type -do_intersect_bbox_segment_aux( - const FT& px, const FT& py, const FT& pz, - const FT& qx, const FT& qy, const FT& qz, - const Bbox_3& bb) +do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz, + const FT& qx, const FT& qy, const FT& qz, + const Bbox_3& bb) { return do_intersect_bbox_segment_aux(px, py, pz, @@ -467,9 +465,10 @@ do_intersect_bbox_segment_aux( } template -bool do_intersect(const typename K::Segment_3& segment, - const CGAL::Bbox_3& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Segment_3& segment, + const CGAL::Bbox_3& bbox, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -483,9 +482,10 @@ bool do_intersect(const typename K::Segment_3& segment, } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Segment_3& segment, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Segment_3& segment, + const K& k) { return do_intersect(segment, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h index f37ede7b5fa..4c3c4f0c731 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h @@ -23,9 +23,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Sphere_3& sphere, - const CGAL::Bbox_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Sphere_3& sphere, + const CGAL::Bbox_3& bbox, + const K& k) { return do_intersect_sphere_box_3(sphere, bbox.xmin(), bbox.ymin(), bbox.zmin(), @@ -34,9 +35,10 @@ bool do_intersect(const typename K::Sphere_3& sphere, } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Sphere_3& sphere, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Sphere_3& sphere, + const K& k) { return do_intersect(sphere, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h index 9be2c0ccef6..c842e5623ea 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h @@ -24,9 +24,11 @@ namespace Intersections { namespace internal { template -inline typename K::Boolean do_intersect(const CGAL::Bbox_3& aabb, - const typename K::Tetrahedron_3& tet, - const K& k) +inline +typename K::Boolean +do_intersect(const CGAL::Bbox_3& aabb, + const typename K::Tetrahedron_3& tet, + const K& k) { typename K::Construct_triangle_3 tr = k.construct_triangle_3_object(); typename K::Boolean result = false; @@ -57,9 +59,11 @@ inline typename K::Boolean do_intersect(const CGAL::Bbox_3& aabb, } template -inline typename K::Boolean do_intersect(const typename K::Tetrahedron_3& tet, - const CGAL::Bbox_3& bb, - const K &k) +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3& tet, + const CGAL::Bbox_3& bb, + const K &k) { return do_intersect(bb, tet, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h index 0c88e508457..c3ce7befc10 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h @@ -397,9 +397,10 @@ do_intersect_bbox_or_iso_cuboid_impl(const std::array< std::array, 3>& tr } template -bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, - const Box3& a_bbox, - const K& k) +typename K::Boolean +do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, + const Box3& a_bbox, + const K& k) { if(certainly_not(do_bbox_intersect(a_triangle, a_bbox))) return false; @@ -423,22 +424,23 @@ bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, { a_triangle[2][0], a_triangle[2][1], a_triangle[2][2] } }}; - // exception will be thrown in case the output is indeterminate return do_intersect_bbox_or_iso_cuboid_impl(triangle, a_bbox, do_axis_intersect_aux_impl); } template -bool do_intersect(const typename K::Triangle_3& triangle, - const CGAL::Bbox_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& triangle, + const CGAL::Bbox_3& bbox, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Triangle_3& triangle, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Triangle_3& triangle, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h index 3cdf1025537..18bc0e585f4 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h @@ -18,7 +18,8 @@ namespace Intersections { namespace internal { template -inline bool +inline +typename K::Boolean do_intersect(const typename K::Iso_cuboid_3& icub1, const typename K::Iso_cuboid_3& icub2, const K&) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h index 0b3c26bf131..43c4db6c48c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h @@ -23,7 +23,8 @@ namespace Intersections { namespace internal { template -inline bool +inline +typename K::Boolean do_intersect(const typename K::Line_3& line, const typename K::Iso_cuboid_3& ic, const K&) @@ -34,14 +35,15 @@ do_intersect(const typename K::Line_3& line, const Point_3& point = line.point(); const Vector_3& v = line.to_vector(); - return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), - v.x(), v.y(), v.z(), - (ic.min)().x(), (ic.min)().y(), (ic.min)().z(), - (ic.max)().x(), (ic.max)().y(), (ic.max)().z()); + return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), + v.x(), v.y(), v.z(), + (ic.min)().x(), (ic.min)().y(), (ic.min)().z(), + (ic.max)().x(), (ic.max)().y(), (ic.max)().z()); } template -inline bool +inline +typename K::Boolean do_intersect(const typename K::Iso_cuboid_3& ic, const typename K::Line_3& l, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h index 17af49e0246..f35ddb65d2b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h @@ -79,15 +79,16 @@ Uncertain get_min_max(const typename K::Vector_3& p, } template // Iso_cuboid_3 or Bbox_3 -bool do_intersect_plane_box(const typename K::Plane_3& plane, - const Box3& bbox, - const K&) +typename K::Boolean do_intersect_plane_box(const typename K::Plane_3& plane, + const Box3& bbox, + const K&) { typedef typename K::Point_3 Point_3; Point_3 p_max, p_min; Uncertain b = get_min_max(plane.orthogonal_vector(), bbox, p_min, p_max); - if(is_certain(b)){ + if(is_certain(b)) + { return ! (plane.oriented_side(p_max) == ON_NEGATIVE_SIDE || plane.oriented_side(p_min) == ON_POSITIVE_SIDE); } @@ -114,17 +115,19 @@ bool do_intersect_plane_box(const typename K::Plane_3& plane, } template -bool do_intersect(const typename K::Plane_3& plane, - const typename K::Iso_cuboid_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Plane_3& plane, + const typename K::Iso_cuboid_3& bbox, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } template -bool do_intersect(const typename K::Iso_cuboid_3& bbox, - const typename K::Plane_3& plane, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& bbox, + const typename K::Plane_3& plane, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h index bafe971d903..32d01b5526a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Iso_cuboid_3& iso, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Iso_cuboid_3& iso, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h index e467d7ea327..0ef4a7ec6f6 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h @@ -20,16 +20,17 @@ #include // for CGAL::internal::do_intersect_bbox_segment_aux -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf namespace CGAL { namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Ray_3& ray, - const typename K::Iso_cuboid_3& ic, - const K&) +typename K::Boolean +do_intersect(const typename K::Ray_3& ray, + const typename K::Iso_cuboid_3& ic, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -51,9 +52,11 @@ bool do_intersect(const typename K::Ray_3& ray, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const typename K::Ray_3& ray, - const K& k) { +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const typename K::Ray_3& ray, + const K& k) +{ return do_intersect(ray, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h index 3c42487730f..5118e44a6fd 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H #define CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf #include // for CGAL::internal::do_intersect_bbox_segment_aux @@ -24,9 +24,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Segment_3& seg, - const typename K::Iso_cuboid_3& ic, - const K&) +typename K::Boolean +do_intersect(const typename K::Segment_3& seg, + const typename K::Iso_cuboid_3& ic, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -48,9 +49,10 @@ bool do_intersect(const typename K::Segment_3& seg, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const typename K::Segment_3& seg, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const typename K::Segment_3& seg, + const K& k) { return do_intersect(seg, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h index f6090ba7cbf..a9ef6c3a50a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h @@ -22,10 +22,11 @@ namespace Intersections { namespace internal { template // Iso_cuboid_3 or Bbox_3 -bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, - const BFT bxmin, const BFT bymin, const BFT bzmin, - const BFT bxmax, const BFT bymax, const BFT bzmax, - const K&) +typename K::Boolean +do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, + const BFT bxmin, const BFT bymin, const BFT bzmin, + const BFT bxmax, const BFT bymax, const BFT bzmax, + const K&) { typedef typename K::FT SFT; typedef typename Coercion_traits::Type FT; @@ -94,9 +95,10 @@ bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, } template -bool do_intersect(const typename K::Sphere_3& sphere, - const typename K::Iso_cuboid_3& ic, - const K& k) +typename K::Boolean +do_intersect(const typename K::Sphere_3& sphere, + const typename K::Iso_cuboid_3& ic, + const K& k) { return do_intersect_sphere_box_3(sphere, (ic.min)().x(), (ic.min)().y(), (ic.min)().z(), @@ -105,9 +107,10 @@ bool do_intersect(const typename K::Sphere_3& sphere, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const typename K::Sphere_3& sphere, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const typename K::Sphere_3& sphere, + const K& k) { return do_intersect(sphere, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h index 723ef269306..6974c72ebad 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h @@ -21,26 +21,25 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& triangle, - const typename K::Iso_cuboid_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& triangle, + const typename K::Iso_cuboid_3& bbox, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } template -bool do_intersect(const typename K::Iso_cuboid_3& bbox, - const typename K::Triangle_3& triangle, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& bbox, + const typename K::Triangle_3& triangle, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } } // namespace internal } // namespace Intersections - - - } // namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h index 5da82672621..43a161c9c3f 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h @@ -18,7 +18,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Line_3& l1, const typename K::Line_3& l2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h index 2dc5b2122cd..72ead862807 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h @@ -21,7 +21,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Line_3& line, const K&) @@ -48,7 +48,7 @@ do_intersect(const typename K::Plane_3& plane, template inline -bool +typename K::Boolean do_intersect(const typename K::Line_3& line, const typename K::Plane_3& plane, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h index b4a0cf92113..a4407eb7f16 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h @@ -18,7 +18,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Line_3& line, const K& k) @@ -27,7 +27,7 @@ do_intersect(const typename K::Point_3& pt, } template -inline bool +inline typename K::Boolean do_intersect(const typename K::Line_3& line, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h index e6e125107f0..f4aa1e8e37c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h @@ -23,7 +23,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Line_3& l, const typename K::Ray_3& r, const K& k) @@ -47,7 +47,7 @@ do_intersect(const typename K::Line_3& l, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& r, const typename K::Line_3& l, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h index d03d33e76e7..d080ac11279 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h @@ -24,7 +24,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Line_3& l, const typename K::Segment_3& s, const K& k) @@ -52,7 +52,7 @@ do_intersect(const typename K::Line_3& l, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& s, const typename K::Line_3& l, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h index 4b2635a3153..a5b5dd1fc76 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h @@ -21,9 +21,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Line_3& l, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Line_3& l, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t)); CGAL_kernel_precondition(!k.is_degenerate_3_object()(l)); @@ -73,9 +74,10 @@ bool do_intersect(const typename K::Triangle_3& t, template inline -bool do_intersect(const typename K::Line_3& l, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean + do_intersect(const typename K::Line_3& l, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, l, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h index 2884506fc20..05ff652ccfa 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h @@ -23,7 +23,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Plane_3& plane1, const typename K::Plane_3& plane2, const typename K::Plane_3& plane3, diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h index fc984e41dcf..cf39bbe2c41 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h @@ -20,7 +20,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Plane_3& plane1, const typename K::Plane_3& plane2, const K&) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h index f53221b5700..d3798d69b6b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h @@ -18,7 +18,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Plane_3& plane, const K& k) @@ -27,7 +27,7 @@ do_intersect(const typename K::Point_3& pt, } template -inline bool +inline typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h index d254bc3f367..f57d4f9d25a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h @@ -25,7 +25,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Ray_3& ray, const K& k) @@ -40,7 +40,7 @@ do_intersect(const typename K::Plane_3& plane, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& ray, const typename K::Plane_3& plane, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h index 581a9cfa9a8..509ef49ecee 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h @@ -20,7 +20,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Segment_3& seg, const K&) @@ -41,7 +41,7 @@ do_intersect(const typename K::Plane_3& plane, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& seg, const typename K::Plane_3& plane, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h index df7b7c738ae..9f1e51f8686 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h @@ -21,7 +21,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Plane_3& p, const typename K::Sphere_3& s, const K&) @@ -37,7 +37,7 @@ do_intersect(const typename K::Plane_3& p, template inline -bool +typename K::Boolean do_intersect(const typename K::Sphere_3& s, const typename K::Plane_3& p, const K&) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h index 2d7cd516900..ea0462dadd6 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h @@ -21,9 +21,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Plane_3& h, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Plane_3& h, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t)); CGAL_kernel_precondition(!k.is_degenerate_3_object()(h)); @@ -49,9 +50,10 @@ bool do_intersect(const typename K::Triangle_3& t, template inline -bool do_intersect(const typename K::Plane_3& h, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Plane_3& h, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, h, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h index 0aec93a129c..69f75948f8b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Ray_3& ray, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& ray, const typename K::Point_3& pt, const K& k) @@ -39,7 +39,7 @@ do_intersect(const typename K::Ray_3& ray, template -bool +typename K::Boolean Ray_3_has_on_collinear_Point_3(const typename K::Ray_3& r, const typename K::Point_3& p, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h index 2872694d6af..fa54c9bbaba 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Segment_3& seg, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& seg, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h index d825e2ff820..e9734dfdb23 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Sphere_3& sphere, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Sphere_3& sphere, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h index 0518a305073..b22ffc8d0a2 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Tetrahedron_3& tetrahedron, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Tetrahedron_3& tetrahedron, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h index a116b4617a9..f22d551e842 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h @@ -21,9 +21,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Point_3& p, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Point_3& p, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t)); @@ -68,9 +69,10 @@ bool do_intersect(const typename K::Triangle_3& t, } template -bool do_intersect(const typename K::Point_3& p, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Point_3& p, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, p, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h index cf334475335..5ceb8e0eeb9 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h @@ -24,7 +24,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& r1, const typename K::Ray_3& r2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h index bf57d977f0c..72d4ceec703 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h @@ -24,7 +24,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& s, const typename K::Ray_3& r, const K& k) @@ -56,7 +56,7 @@ do_intersect(const typename K::Segment_3& s, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& r, const typename K::Segment_3& s, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h index f0d6ea725d3..d349c2616e2 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h @@ -328,18 +328,20 @@ do_intersect(const typename K::Triangle_3& t, } template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Ray_3& r, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Ray_3& r, + const K& k) { return do_intersect(t, r, k, r3t3_do_intersect_empty_visitor()); } template inline -bool do_intersect(const typename K::Ray_3& r, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Ray_3& r, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, r, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h index 5943325975b..db3b01bffb9 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h @@ -23,7 +23,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& s1, const typename K::Segment_3& s2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h index 70c0f3e0813..23fc5d897f4 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h @@ -25,7 +25,8 @@ bool do_intersect_coplanar(const typename K::Point_3& A, const typename K::Point_3& B, const typename K::Point_3& C, const typename K::Point_3& p, - const typename K::Point_3& q, const K& k) + const typename K::Point_3& q, + const K& k) { typedef typename K::Point_3 Point_3; @@ -173,9 +174,10 @@ bool do_intersect_coplanar(const typename K::Triangle_3& t, } template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Segment_3& s, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Segment_3& s, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t) ); CGAL_kernel_precondition(!k.is_degenerate_3_object()(s) ); @@ -269,9 +271,10 @@ bool do_intersect(const typename K::Triangle_3& t, template inline -bool do_intersect(const typename K::Segment_3& s, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Segment_3& s, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, s, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h index 52976148c05..b7bf1a8e5c0 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h @@ -21,7 +21,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Sphere_3& s1, const typename K::Sphere_3& s2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h index ce993540138..0ab18e3e0c8 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h @@ -22,13 +22,14 @@ namespace Intersections { namespace internal { template -bool _intersection_test_vertex(const typename K::Point_3* p, - const typename K::Point_3* q, - const typename K::Point_3* r, - const typename K::Point_3* a, - const typename K::Point_3* b, - const typename K::Point_3* c, - const K& k) +typename K::Boolean +_intersection_test_vertex(const typename K::Point_3* p, + const typename K::Point_3* q, + const typename K::Point_3* r, + const typename K::Point_3* a, + const typename K::Point_3* b, + const typename K::Point_3* c, + const K& k) { CGAL_kernel_precondition(k.coplanar_orientation_3_object()(*p,*q,*r) == POSITIVE); CGAL_kernel_precondition(k.coplanar_orientation_3_object()(*a,*b,*c) == POSITIVE); @@ -64,13 +65,14 @@ bool _intersection_test_vertex(const typename K::Point_3* p, } template -bool _intersection_test_edge(const typename K::Point_3* p, - const typename K::Point_3* q, - const typename K::Point_3* r, - const typename K::Point_3* a, - const typename K::Point_3* CGAL_kernel_precondition_code(b), - const typename K::Point_3* c, - const K& k) +typename K::Boolean +_intersection_test_edge(const typename K::Point_3* p, + const typename K::Point_3* q, + const typename K::Point_3* r, + const typename K::Point_3* a, + const typename K::Point_3* CGAL_kernel_precondition_code(b), + const typename K::Point_3* c, + const K& k) { CGAL_kernel_precondition(k.coplanar_orientation_3_object() (*p,*q,*r) == POSITIVE); CGAL_kernel_precondition(k.coplanar_orientation_3_object() (*a,*b,*c) == POSITIVE); @@ -97,9 +99,10 @@ bool _intersection_test_edge(const typename K::Point_3* p, } template -bool do_intersect_coplanar(const typename K::Triangle_3& t1, - const typename K::Triangle_3& t2, - const K& k) +typename K::Boolean +do_intersect_coplanar(const typename K::Triangle_3& t1, + const typename K::Triangle_3& t2, + const K& k) { typedef typename K::Point_3 Point_3; diff --git a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp index bd5adeccdeb..152926c2d96 100644 --- a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp +++ b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp @@ -11,8 +11,6 @@ // Author(s) : Stephane Tayeb // -#include - #include #if defined(BOOST_MSVC) @@ -22,17 +20,19 @@ // leda_rational, or Gmpq, or Quotient typedef CGAL::Exact_rational Rational; + #include #include #include #include #include #include - -#include +#include #include // for nextafter +#include +#include double random_in(const double a, const double b) diff --git a/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp b/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp index 9b5490c0164..6fe55a40654 100644 --- a/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp +++ b/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp @@ -339,12 +339,15 @@ public: { P tet0 = random_point(), tet1 = random_point(), tet2 = random_point(), tet3 = random_point(); - const Tet tet(tet0, tet1, tet2, tet3); + Tet tet(tet0, tet1, tet2, tet3); if(tet.is_degenerate()) continue; - P l0 = tet0 - CGAL::cross_product(V(tet0, tet1), V(tet0, tet2)); - P l1 = tet3 + CGAL::cross_product(V(tet3, tet1), V(tet3, tet2)); + if(tet.orientation() == CGAL::NEGATIVE) + tet = Tet(tet1, tet0, tet2, tet3); + + P l0 = tet[0] - CGAL::cross_product(V(tet[0], tet[1]), V(tet[0], tet[2])); + P l1 = tet[3] + CGAL::cross_product(V(tet[3], tet[1]), V(tet[3], tet[2])); assert(tet.has_on_unbounded_side(l0) && tet.has_on_unbounded_side(l1)); diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index 566d7643bcd..c770d0b7b40 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -5964,13 +5964,22 @@ public: /// A model of this concept must provide: /// @{ - /*! introduces a variable with Cartesian coordinates \f$ (0,0)\f$. */ Kernel::Point_2 operator()(const CGAL::Origin &CGAL::ORIGIN); + /*! + returns `p`. + + \note It is advised to return a const reference to `p` to avoid useless copies. + + \note This peculiar requirement is necessary because some \cgal structures such as triangulations + internally manipulate points whose type might be `Point_2` or `Weighted_point_2`. + */ + Kernel::Point_2 operator()(const Kernel::Point_2& p); + /*! extracts the bare point from the weighted point. */ @@ -6001,6 +6010,16 @@ public: */ Kernel::Point_3 operator()(const CGAL::Origin &CGAL::ORIGIN); + /*! + returns `p`. + + \note It is advised to return a const reference to `p` to avoid useless copies. + + \note This peculiar requirement is necessary because some \cgal structures such as triangulations + internally manipulate points whose type might be `Point_3` or `Weighted_point_3`. + */ + Kernel::Point_3 operator()(const Kernel::Point_3& p); + /*! extracts the bare point from the weighted point. */ diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 344e64440ce..c3f5ebf3755 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -20,6 +20,7 @@ #ifndef CGAL_KERNEL_FUNCTION_OBJECTS_H #define CGAL_KERNEL_FUNCTION_OBJECTS_H +#include #include #include #include @@ -30,7 +31,6 @@ #include #include - #include // for Compute_dihedral_angle namespace CGAL { @@ -779,11 +779,12 @@ namespace CommonKernelFunctors { typedef Comparison_result result_type; - result_type operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q, - const Weighted_point_3 & r, - const Weighted_point_3 & s, - const FT& w) const + Needs_FT + operator()(const Weighted_point_3 & p, + const Weighted_point_3 & q, + const Weighted_point_3 & r, + const Weighted_point_3 & s, + const FT& w) const { return CGAL::compare(squared_radius_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -793,10 +794,11 @@ namespace CommonKernelFunctors { w); } - result_type operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q, - const Weighted_point_3 & r, - const FT& w) const + Needs_FT + operator()(const Weighted_point_3 & p, + const Weighted_point_3 & q, + const Weighted_point_3 & r, + const FT& w) const { return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -805,9 +807,10 @@ namespace CommonKernelFunctors { w); } - result_type operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q, - const FT& w) const + Needs_FT + operator()(const Weighted_point_3 & p, + const Weighted_point_3 & q, + const FT& w) const { return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -860,17 +863,18 @@ namespace CommonKernelFunctors { typedef typename K::Comparison_result result_type; template - result_type + Needs_FT operator()(const T1& p, const T2& q, const FT& d2) const { - return CGAL::compare(squared_distance(p, q), d2); + return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - result_type + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { - return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); + return CGAL::compare(internal::squared_distance(p, q, K()), + internal::squared_distance(r, s, K())); } }; @@ -882,17 +886,18 @@ namespace CommonKernelFunctors { typedef typename K::Comparison_result result_type; template - result_type + Needs_FT operator()(const T1& p, const T2& q, const FT& d2) const { - return CGAL::compare(squared_distance(p, q), d2); + return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - result_type + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { - return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); + return CGAL::compare(internal::squared_distance(p, q, K()), + internal::squared_distance(r, s, K())); } }; @@ -3061,10 +3066,11 @@ namespace CommonKernelFunctors { public: typedef typename K::Boolean result_type; + // Needs_FT because Line/Line (and variations) as well as Circle_2/X compute intersections template - result_type + Needs_FT operator()(const T1& t1, const T2& t2) const - { return Intersections::internal::do_intersect(t1, t2, K()); } + { return { Intersections::internal::do_intersect(t1, t2, K())}; } }; template @@ -3078,10 +3084,12 @@ namespace CommonKernelFunctors { operator()(const T1& t1, const T2& t2) const { return Intersections::internal::do_intersect(t1, t2, K()); } - result_type - operator()(const typename K::Plane_3& pl1, const typename K::Plane_3& pl2, const typename K::Plane_3& pl3) const - { return Intersections::internal::do_intersect(pl1, pl2, pl3, K() ); } - + result_type operator()(const typename K::Plane_3& pl1, + const typename K::Plane_3& pl2, + const typename K::Plane_3& pl3) const + { + return Intersections::internal::do_intersect(pl1, pl2, pl3, K()); + } }; template @@ -3371,8 +3379,10 @@ namespace CommonKernelFunctors { return c.rep().has_on_bounded_side(p); } - result_type operator()(const Sphere_3& s1, const Sphere_3& s2, - const Point_3& a, const Point_3& b) const + // returns true iff the line segment ab is inside the union of the bounded sides of s1 and s2. + Needs_FT + operator()(const Sphere_3& s1, const Sphere_3& s2, + const Point_3& a, const Point_3& b) const { typedef typename K::Circle_3 Circle_3; typedef typename K::Point_3 Point_3; @@ -3384,27 +3394,23 @@ namespace CommonKernelFunctors { const bool a_in_s1 = has_on_bounded_side(s1, a); const bool a_in_s2 = has_on_bounded_side(s2, a); - if(!(a_in_s1 || a_in_s2)) return false; + if(!(a_in_s1 || a_in_s2)) return {false}; const bool b_in_s1 = has_on_bounded_side(s1, b); const bool b_in_s2 = has_on_bounded_side(s2, b); - if(!(b_in_s1 || b_in_s2)) return false; + if(!(b_in_s1 || b_in_s2)) return {false}; - if(a_in_s1 && b_in_s1) return true; - if(a_in_s2 && b_in_s2) return true; + if(a_in_s1 && b_in_s1) return {true}; + if(a_in_s2 && b_in_s2) return {true}; - if(!K().do_intersect_3_object()(s1, s2)) return false; + if(!K().do_intersect_3_object()(s1, s2)) return {false}; const Circle_3 circ(s1, s2); const Plane_3& plane = circ.supporting_plane(); const auto optional = K().intersect_3_object()(plane, Segment_3(a, b)); - CGAL_kernel_assertion_msg(bool(optional) == true, - "the segment does not intersect the supporting" - " plane"); + CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting plane"); const Point_3* p = boost::get(&*optional); - CGAL_kernel_assertion_msg(p != 0, - "the segment intersection with the plane is " - "not a point"); + CGAL_kernel_assertion_msg(p != 0, "the segment intersection with the plane is not a point"); return squared_distance(circ.center(), *p) < circ.squared_radius(); } diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 6b346d4ebaa..2d553bad53c 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -18,7 +18,7 @@ // It's aimed at being included from within a kernel traits class, this // way we share more code. -// It is the responsability of the including file to correctly set the 2 +// It is the responsibility of the including file to correctly set the 2 // macros CGAL_Kernel_pred, CGAL_Kernel_cons and CGAL_Kernel_obj. // And they are #undefed at the end of this file. @@ -26,12 +26,6 @@ # define CGAL_Kernel_pred(X, Y) #endif -// Those predicates for which Simple_cartesian is guaranteed not to use -// any division. -#ifndef CGAL_Kernel_pred_RT -# define CGAL_Kernel_pred_RT(X, Y) CGAL_Kernel_pred(X, Y) -#endif - #ifndef CGAL_Kernel_cons # define CGAL_Kernel_cons(X, Y) #endif @@ -100,10 +94,10 @@ CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_3, collinear_are_strictly_ordered_along_line_3_object) CGAL_Kernel_pred(Collinear_has_on_2, collinear_has_on_2_object) -CGAL_Kernel_pred_RT(Collinear_2, - collinear_2_object) -CGAL_Kernel_pred_RT(Collinear_3, - collinear_3_object) +CGAL_Kernel_pred(Collinear_2, + collinear_2_object) +CGAL_Kernel_pred(Collinear_3, + collinear_3_object) CGAL_Kernel_pred(Compare_angle_3, compare_angle_3_object) CGAL_Kernel_pred(Compare_angle_with_x_axis_2, @@ -114,10 +108,10 @@ CGAL_Kernel_pred(Compare_distance_2, compare_distance_2_object) CGAL_Kernel_pred(Compare_distance_3, compare_distance_3_object) -CGAL_Kernel_pred_RT(Compare_power_distance_2, - compare_power_distance_2_object) -CGAL_Kernel_pred_RT(Compare_power_distance_3, - compare_power_distance_3_object) +CGAL_Kernel_pred(Compare_power_distance_2, + compare_power_distance_2_object) +CGAL_Kernel_pred(Compare_power_distance_3, + compare_power_distance_3_object) CGAL_Kernel_pred(Compare_signed_distance_to_line_2, compare_signed_distance_to_line_2_object) CGAL_Kernel_pred(Compare_slope_2, @@ -488,18 +482,18 @@ CGAL_Kernel_cons(Construct_cartesian_const_iterator_2, construct_cartesian_const_iterator_2_object) CGAL_Kernel_cons(Construct_cartesian_const_iterator_3, construct_cartesian_const_iterator_3_object) -CGAL_Kernel_pred_RT(Coplanar_orientation_3, - coplanar_orientation_3_object) -CGAL_Kernel_pred_RT(Coplanar_side_of_bounded_circle_3, - coplanar_side_of_bounded_circle_3_object) -CGAL_Kernel_pred_RT(Coplanar_3, +CGAL_Kernel_pred(Coplanar_orientation_3, + coplanar_orientation_3_object) +CGAL_Kernel_pred(Coplanar_side_of_bounded_circle_3, + coplanar_side_of_bounded_circle_3_object) +CGAL_Kernel_pred(Coplanar_3, coplanar_3_object) CGAL_Kernel_pred(Counterclockwise_in_between_2, counterclockwise_in_between_2_object) CGAL_Kernel_pred(Do_intersect_2, do_intersect_2_object) -CGAL_Kernel_pred_RT(Do_intersect_3, - do_intersect_3_object) +CGAL_Kernel_pred(Do_intersect_3, + do_intersect_3_object) CGAL_Kernel_pred(Equal_xy_3, equal_xy_3_object) CGAL_Kernel_pred(Equal_x_2, @@ -548,8 +542,8 @@ CGAL_Kernel_cons(Intersect_point_3_for_polyhedral_envelope, intersect_point_3_for_polyhedral_envelope_object) CGAL_Kernel_pred(Is_degenerate_2, is_degenerate_2_object) -CGAL_Kernel_pred_RT(Is_degenerate_3, - is_degenerate_3_object) +CGAL_Kernel_pred(Is_degenerate_3, + is_degenerate_3_object) CGAL_Kernel_pred(Is_horizontal_2, is_horizontal_2_object) CGAL_Kernel_pred(Is_vertical_2, @@ -586,10 +580,10 @@ CGAL_Kernel_pred(Less_z_3, less_z_3_object) CGAL_Kernel_pred(Non_zero_coordinate_index_3, non_zero_coordinate_index_3_object) -CGAL_Kernel_pred_RT(Orientation_2, - orientation_2_object) -CGAL_Kernel_pred_RT(Orientation_3, - orientation_3_object) +CGAL_Kernel_pred(Orientation_2, + orientation_2_object) +CGAL_Kernel_pred(Orientation_3, + orientation_3_object) CGAL_Kernel_pred(Oriented_side_2, oriented_side_2_object) CGAL_Kernel_pred(Oriented_side_3, @@ -598,20 +592,19 @@ CGAL_Kernel_pred(Power_side_of_bounded_power_circle_2, power_side_of_bounded_power_circle_2_object) CGAL_Kernel_pred(Power_side_of_bounded_power_sphere_3, power_side_of_bounded_power_sphere_3_object) -CGAL_Kernel_pred_RT(Power_side_of_oriented_power_circle_2, - power_side_of_oriented_power_circle_2_object) -CGAL_Kernel_pred_RT(Power_side_of_oriented_power_sphere_3, - power_side_of_oriented_power_sphere_3_object) -CGAL_Kernel_pred_RT(Side_of_bounded_circle_2, - side_of_bounded_circle_2_object) -CGAL_Kernel_pred_RT(Side_of_bounded_sphere_3, - side_of_bounded_sphere_3_object) -CGAL_Kernel_pred_RT(Side_of_oriented_circle_2, - side_of_oriented_circle_2_object) -CGAL_Kernel_pred_RT(Side_of_oriented_sphere_3, - side_of_oriented_sphere_3_object) +CGAL_Kernel_pred(Power_side_of_oriented_power_circle_2, + power_side_of_oriented_power_circle_2_object) +CGAL_Kernel_pred(Power_side_of_oriented_power_sphere_3, + power_side_of_oriented_power_sphere_3_object) +CGAL_Kernel_pred(Side_of_bounded_circle_2, + side_of_bounded_circle_2_object) +CGAL_Kernel_pred(Side_of_bounded_sphere_3, + side_of_bounded_sphere_3_object) +CGAL_Kernel_pred(Side_of_oriented_circle_2, + side_of_oriented_circle_2_object) +CGAL_Kernel_pred(Side_of_oriented_sphere_3, + side_of_oriented_sphere_3_object) -#undef CGAL_Kernel_pred_RT #undef CGAL_Kernel_pred #undef CGAL_Kernel_cons #undef CGAL_Kernel_obj diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h index 120fa052a85..9f9896ac7eb 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h @@ -13,7 +13,7 @@ #define CGAL_INTERNAL_PROJECTION_TRAITS_3_H #include - +#include #include #include #include diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 24b2ddfc339..1de74e0e1b0 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -1,6 +1,3 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - cmake_minimum_required(VERSION 3.1...3.23) project(Kernel_23_Tests) @@ -8,11 +5,44 @@ find_package(CGAL REQUIRED COMPONENTS Core) include_directories(BEFORE "include") -# create a target per cppfile -file( - GLOB cppfiles - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -foreach(cppfile ${cppfiles}) - create_single_source_cgal_program("${cppfile}") -endforeach() +create_single_source_cgal_program("Cartesian.cpp") +create_single_source_cgal_program("determinant_77.cpp") +create_single_source_cgal_program("Dimension.cpp") +create_single_source_cgal_program("Exact_predicates_exact_constructions_kernel.cpp") +create_single_source_cgal_program("Filtered_cartesian.cpp") +create_single_source_cgal_program("Filtered_homogeneous.cpp") +create_single_source_cgal_program("Homogeneous.cpp") +create_single_source_cgal_program("issue_129.cpp") +create_single_source_cgal_program("issue_3301.cpp") +create_single_source_cgal_program("Kernel_checker.cpp") +create_single_source_cgal_program("Lazy_kernel.cpp") +create_single_source_cgal_program("origin_3.cpp") +create_single_source_cgal_program("overload_bug.cpp") +create_single_source_cgal_program("rank.cpp") +create_single_source_cgal_program("Simple_cartesian.cpp") +create_single_source_cgal_program("Simple_homogeneous.cpp") +create_single_source_cgal_program("test_all_linear_intersections.cpp") +create_single_source_cgal_program("test_approximate_dihedral_angle_3.cpp") +create_single_source_cgal_program("test_bbox.cpp") +create_single_source_cgal_program("test_converter.cpp") +create_single_source_cgal_program("test_Has_conversion.cpp") +create_single_source_cgal_program("test_hash_functions.cpp") +create_single_source_cgal_program("test_kernel__.cpp") +create_single_source_cgal_program("test_projection_traits.cpp") +create_single_source_cgal_program("test_Projection_traits_xy_3_Intersect_2.cpp") + +if(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS) + # Templated operators: + # - create a lot of possible combinations, which is expensive to test + # - create issues because some combinations might be RT-sufficient whereas others will require FT + # + # add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS) + + create_single_source_cgal_program("atomic_compilation_test.cpp") + target_precompile_headers(atomic_compilation_test PUBLIC [["atomic_RT_FT_predicate_headers.h"]]) + + create_single_source_cgal_program("test_RT_or_FT_predicates.cpp") + target_compile_definitions(test_RT_or_FT_predicates PRIVATE + "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" + "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}") +endif() diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index d8b24523c15..3c56a17f44b 100644 --- a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp +++ b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp @@ -14,6 +14,9 @@ // // Author(s) : Sylvain Pion +// This defines removes the operator/ from CGAL::Mpzf to check that functors not using +// the tag `Needs_FT<>` really only need a RT (ring type) without division. +#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include #include diff --git a/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp b/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp new file mode 100644 index 00000000000..be26c19f042 --- /dev/null +++ b/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp @@ -0,0 +1,2 @@ +// This executable is used by test_RT_or_FT_predicates.cpp +int main(int, char**) { } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index b70b9eea4b6..2b4b26dd388 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -22,9 +22,12 @@ #include #include #include +#include #include +CGAL_GENERATE_MEMBER_DETECTOR(needs_FT); + using CGAL::internal::use; // Accessory function testing functions that require sqrt(). @@ -75,6 +78,28 @@ _test_new_3_sqrt(const R& rep, CGAL::Tag_true) return true; } +template struct Test_needs_FT +{ + template void operator()(const T&...) const {} +}; + +template <> struct Test_needs_FT +{ + template + void operator()(const Compare_distance_3& compare_dist, + const Point_3& p1, const Point_3 p2, const Point_3& p3, + const Segment_3& s2, const Line_3& l1) const + { + assert(!compare_dist.needs_FT(p1, p2, p3)); + assert(!compare_dist.needs_FT(p2, s2, s2)); + assert(!compare_dist.needs_FT(p2, p2, s2)); + assert(!compare_dist.needs_FT(p1, s2, p2)); + assert(compare_dist.needs_FT(l1, p1, p1)); + assert(compare_dist.needs_FT(p2, p3, p2, p3)); + assert(compare_dist.needs_FT(p2, s2, l1, s2)); + } +}; template bool @@ -603,8 +628,16 @@ test_new_3(const R& rep) typename R::Compare_distance_3 compare_dist = rep.compare_distance_3_object(); Comparison_result tmp34ab = compare_dist(p2,p3,p4); + tmp34ab = compare_dist(p1, s2, s2); + tmp34ab = compare_dist(p1, p2, s2); + tmp34ab = compare_dist(p1, s2, p2); tmp34ab = compare_dist(p2,p3,p2,p3); tmp34ab = compare_dist(p1, p2, p3, p4); + tmp34ab = compare_dist(l2, p1, p1); + + Test_needs_FT::value> test_needs_ft; + test_needs_ft(compare_dist, p1, p2, p3, s2, l1); (void) tmp34ab; typename R::Compare_squared_distance_3 compare_sq_dist diff --git a/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h new file mode 100644 index 00000000000..81e656adb64 --- /dev/null +++ b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h @@ -0,0 +1,27 @@ +#ifndef CGAL_KERNEL_23_TEST_ATOMIC_HEADERS_H +#define CGAL_KERNEL_23_TEST_ATOMIC_HEADERS_H + +#define CGAL_NO_MPZF_DIVISION_OPERATOR + +// These includes are there because this header is precompiled + +#include +#include +#include + +#include +#include + +namespace CGAL { +namespace Kernel_23_tests { + +struct Any +{ + template + operator T(); +}; + +} // namespace Kernel_23_tests +} // namespace CGAL + +#endif // CGAL_KERNEL_23_TEST_ATOMIC_HEADERS_H diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp new file mode 100644 index 00000000000..03b2787cc0b --- /dev/null +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -0,0 +1,503 @@ +#include +#include + +#include +#include +#include +#include +#include +#include + +// 0, nothing +// > 0, print RT_sufficient/FT_necessary errors and successes +// > 1, same as above + predicate being tested +// > 2, same as above + some general indications on what is going on +// > 4, same as above + even more indications on what is going on +// > 8, everything +#define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 2 + +std::vector predicates_types = { }; + +// @todo, technically somebody could create predicates with non-kernel objects (nor FT/Origin), e.g. `int`. +// In that case, these arguments would have to be added to the lists below since there is no scrapping +// of the predicate arguments, but simply trying all combinations of objects from these lists. +std::vector object_types_2 = { "FT", "Origin" }; +std::vector object_types_3 = { "FT", "Origin" }; + +// @todo potential operator()s with fewer than MIN_ARITY and more than MAX_ARITY are not tested +constexpr std::size_t MIN_ARITY = 0; +constexpr std::size_t MAX_ARITY = 12; + +const std::string kernel_name = "Simple_cartesian"; +const std::string FT_div = "double"; +const std::string RT_no_div = "CGAL::Mpzf"; + +enum Needs_FT_checks +{ + NO_CHECK = 0, + CHECK_NEEDS_FT, + CHECK_NO_NEEDS_FT +}; + +enum Compilation_result +{ + SUCCESSFUL = 0, // if it got to linking, it is also a successful compilation + FAILED_NO_MATCH, + FAILED_AMBIGUOUS_CALL, // ambiguous calls means the arity is valid + FAILED_NO_DIVISION_OPERATOR, // used to detect if a valid compilation can be done with RT + FAILED_STATIC_ASSERTION, // used to detect failures in the result type checks + UNKNOWN +}; + +inline const char* get_error_message(int error_code) +{ + // Messages corresponding to Error_code list above. Must be kept in sync! + static const char* error_message[UNKNOWN+1] = + { + "Success!", + "Failed: no match!", + "Failed: ambiguous call!", + "Failed: called division operator!", + "Failed: static assertion violated!", + "Unexpected error!" + }; + + if(error_code > UNKNOWN || error_code < 0) + return "Doubly unexpected error!!"; + else + return error_message[error_code]; +} + +std::string kernel_with_FT(const std::string& FT_name) +{ + return "CGAL::" + kernel_name + "<" + FT_name + ">"; +} + +// convert from e.g. Point_2 to CGAL::Point_2 +std::string parameter_with_namespace(const std::string& FT_name, + const std::string& o) +{ + if(o == "Any") + return "CGAL::Kernel_23_tests::Any"; + else if(o == "FT") + return "K::FT"; + else if(o == "Origin") + return "CGAL::Origin"; + else + return "CGAL::" + o + "<" + kernel_with_FT(FT_name) + " >"; +} + +int compile() +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "====== Compiling atomic file... ======" << std::endl; +#endif + + return std::system("cmake --build " CGAL_STRINGIZE(CMAKE_BINARY_DIR) " -t atomic_compilation_test > log.txt 2>&1"); +} + +Compilation_result parse_output(const std::string& predicate_name, + const std::string& FT_name = {}, + const std::vector& parameters = {}) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "====== Parsing compilation log... ======" << std::endl; +#endif + Compilation_result res = UNKNOWN; + + std::ifstream in("log.txt"); + if(!in) + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) + std::cerr << "Error: failed to open log file" << std::endl; +#endif + return UNKNOWN; + } + +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS + // Compare_(squared)_distance_23 have templated operator()s, which are a lot of combinations to test. + // In templated operator()s, the compare is simply a call to squared_distance()s and a CGAL::compare(). + // Below prunes some exploration branches in case the first squared_distance() call does not even compile. + bool prune_compare_distance_branches = false; + if(predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3") + { + prune_compare_distance_branches = true; + } +#else + CGAL_USE(predicate_name); + CGAL_USE(FT_name); + CGAL_USE(parameters); +#endif + + std::string line; + while(getline(in, line)) + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 8) + std::cout << line << std::endl; +#endif + + if(line.find("no match for call") != std::string::npos) { + res = FAILED_NO_MATCH; + break; + } else if(line.find("use of deleted function") != std::string::npos) { + res = FAILED_NO_MATCH; + break; +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS + } else if(prune_compare_distance_branches && parameters.size() > 1 && + parameters[0] != "Any" && parameters[1] != "Any" && + line.find(std::string{"no matching function for call to ‘squared_distance(const " + + parameter_with_namespace(FT_name, parameters[0]) + "&, const " + + parameter_with_namespace(FT_name, parameters[1])}) != std::string::npos) { + res = FAILED_NO_MATCH; + break; +#endif + } else if(line.find("ambiguous") != std::string::npos) { + res = FAILED_AMBIGUOUS_CALL; + break; + } else if(line.find("candidate") != std::string::npos) { + res = FAILED_AMBIGUOUS_CALL; + break; + } else if(line.find("no match for ‘operator/’") != std::string::npos) { + res = FAILED_NO_DIVISION_OPERATOR; + break; + } else if(line.find("no match for ‘operator/=’") != std::string::npos) { + res = FAILED_NO_DIVISION_OPERATOR; + break; + } else if(line.find("static assertion failed") != std::string::npos) { + res = FAILED_STATIC_ASSERTION; + break; + } else if(line.find("Built") != std::string::npos) { + res = SUCCESSFUL; + break; + } else if(line.find("undefined reference") != std::string::npos) { + // Can happen because the conversion Any -> kernel object is not implemented + res = SUCCESSFUL; + break; + } + } + +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "Result of atomic test file is: " << get_error_message(res) << std::endl; +#endif + CGAL_postcondition(res != UNKNOWN); + + return res; +} + +void generate_atomic_compilation_test(const std::string& FT_name, + const std::string& predicate_name, + const std::vector& parameters, + const Needs_FT_checks check = NO_CHECK) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "\n====== Generate atomic compilation test... ======" << std::endl; +#endif + +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "\t" << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j;\n"; + + out << "int main(int, char**)\n"; + out << "{\n"; + + out << " P p{};\n"; + for(std::size_t j=0, i=parameters.size(); j::value));\n"; + else if(check == CHECK_NEEDS_FT) + out << ", NFT_B>::value));\n"; + } + + out << " return EXIT_SUCCESS;\n"; + out << "}\n"; + out.close(); +} + +void ensure_NO_Needs_FT(const std::string& predicate_name, + const std::vector& parameters) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << "Error: " << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cerr << "Unexpected error during Needs_FT checks" << std::endl; +#endif + assert(false); + } +} + +void ensure_Needs_FT(const std::string& predicate_name, + const std::vector& parameters) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << "Error: " << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cerr << "Unexpected error during Needs_FT checks" << std::endl; +#endif + assert(false); + } +} + +void test_predicate(const std::string& predicate_name, + const std::size_t object_pos, + const std::size_t arity, + // intentional copy, each sub-branch gets its own parameter list + std::vector parameters) +{ + const std::size_t last = arity - 1; + CGAL_precondition(object_pos <= last); + + CGAL_precondition(predicate_name.back() == '2' || predicate_name.back() == '3'); + const auto& object_types = (predicate_name.back() == '2') ? object_types_2 : object_types_3; + + for(const std::string& object_type : object_types) + { +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS + // This pruning could be done for other predicates, but they're not as expensive so it doesn't matter + if((predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3" || + predicate_name == "Do_intersect_2" || predicate_name == "Do_intersect_3") && + object_type == "FT") + { + continue; + } +#endif + + parameters[object_pos] = object_type; + generate_atomic_compilation_test(RT_no_div, predicate_name, parameters); + auto compilation_result = compile(); + Compilation_result res = compilation_result == 0 ? + SUCCESSFUL : + parse_output(predicate_name, RT_no_div, parameters); + + // See if we can already (i.e., possibly with `Any`s) conclude on the current parameter list + if(res == FAILED_NO_MATCH) + { + // The object at the current position yields a compilation error, do not explore any further + continue; + } + else if(object_pos == last) + { + if(res == SUCCESSFUL) + { + ensure_NO_Needs_FT(predicate_name, parameters); + } + else if(res == FAILED_NO_DIVISION_OPERATOR) + { + ensure_Needs_FT(predicate_name, parameters); + } + } + else + { + // The object at the current position does not invalid the call, explore further this list + test_predicate(predicate_name, object_pos + 1, arity, parameters); + } + } +} + +void test_predicate(const std::string& predicate_name, + const std::size_t arity) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 2) + std::cout << "\n\n==== Test predicate with arity " << arity << "... ====" << std::endl; +#endif + + // Use "Any" to prune early: + // 1st try "Object_1, Any, ..., Any" (i - 1 "Any") + // -> if that doesn't compile, we're done with Object_1 and try "Object_2, Any, ..., Any" (i-1 "Any") + // -> if that compiles, try "Object_1, Object_1, Any, ..., Any" (i-2 "Any") + // etc. + + // the position of the object being changed/tested, when object_pos == arity - 1, + // then this is a call with full objects on which we can do the RT test + std::vector parameters(arity, "Any"); + + // Quick try to see if it even matches anything + generate_atomic_compilation_test(RT_no_div, predicate_name, parameters); + auto compilation_result = compile(); + Compilation_result res = compilation_result == 0 ? + SUCCESSFUL : + parse_output(predicate_name); + if(res == FAILED_NO_MATCH) // No point with this current arity + return; + + std::size_t object_pos = 0; + test_predicate(predicate_name, object_pos, arity, parameters); +} + +void test_predicate(const std::string& predicate_name) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) + std::cout << "\n\n\n== Test predicate: " << predicate_name << "... ==" << std::endl; +#endif + +#ifndef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS + if(predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3" || + predicate_name == "Do_intersect_2" || predicate_name == "Do_intersect_3") + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) + std::cout << "Skipping because 'CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS' is not defined!" << std::endl; +#endif + return; + } +#endif + + for(std::size_t i=MIN_ARITY; i<=MAX_ARITY; ++i) + test_predicate(predicate_name, i); +} + +// Just to not get a diff at the end of the test +void restore_atomic_file() +{ + std::ofstream out("../atomic_compilation_test.cpp"); + if(!out) + { + std::cerr << "Error: could not write into atomic compilation test" << std::endl; + std::exit(1); + } + + out << "// This executable is used by test_RT_or_FT_predicates.cpp\n"; + out << "int main(int, char**) { }\n"; + out.close(); +} + +int main(int , char**) +{ + // Get the predicates + #define CGAL_Kernel_pred(X, Y) predicates_types.push_back(#X); + #include + + // Get the objects + #define CGAL_Kernel_obj(X) { const std::string O = #X; \ + CGAL_precondition(O.back() == '2' || O.back() == '3'); \ + if(O.back() == ('2')) \ + object_types_2.push_back(#X); \ + else \ + object_types_3.push_back(#X); } + #include + +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) + std::cout << predicates_types.size() << " predicates:" << std::endl; + for(const std::string& s : predicates_types) + std::cout << s << "\n"; + std::cout << std::endl; + + std::cout << object_types_2.size() << " 2D objects:" << std::endl; + for(const std::string& o : object_types_2) + std::cout << o << "\n"; + std::cout << std::endl; + + std::cout << object_types_3.size() << " 3D objects:" << std::endl; + for(const std::string& o : object_types_3) + std::cout << o << "\n"; + std::cout << std::endl; +#endif + + // Actual tests + for(const std::string& predicate_name : predicates_types) + { + test_predicate(predicate_name); + } + + restore_atomic_file(); + + return EXIT_SUCCESS; +} diff --git a/Kernel_23/test/Kernel_23/test_projection_traits.cpp b/Kernel_23/test/Kernel_23/test_projection_traits.cpp index 50171ee754d..6929698c39d 100644 --- a/Kernel_23/test/Kernel_23/test_projection_traits.cpp +++ b/Kernel_23/test/Kernel_23/test_projection_traits.cpp @@ -1,3 +1,4 @@ +#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include #include diff --git a/Kernel_d/include/CGAL/Cartesian_d.h b/Kernel_d/include/CGAL/Cartesian_d.h index f23ed661412..cb4d1f848c2 100644 --- a/Kernel_d/include/CGAL/Cartesian_d.h +++ b/Kernel_d/include/CGAL/Cartesian_d.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -71,7 +71,7 @@ public: typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d; - // Boolean had originally been Bool. It was renamed to avoid a conflict + // Boolean had originally been Bool. It was renamed to avoid a conflict // between a macro defined in Xlib.h poorly chosen to have the same name, // that is 'Bool'. typedef typename Same_uncertainty_nt::type diff --git a/Kernel_d/include/CGAL/Homogeneous_d.h b/Kernel_d/include/CGAL/Homogeneous_d.h index 5f8026fbbf5..b5f6981a468 100644 --- a/Kernel_d/include/CGAL/Homogeneous_d.h +++ b/Kernel_d/include/CGAL/Homogeneous_d.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -67,6 +67,24 @@ public: typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d; + // Boolean had originally been Bool. It was renamed to avoid a conflict + // between a macro defined in Xlib.h poorly chosen to have the same name, + // that is 'Bool'. + typedef typename Same_uncertainty_nt::type + Boolean; + typedef typename Same_uncertainty_nt::type + Sign; + typedef typename Same_uncertainty_nt::type + Comparison_result; + typedef typename Same_uncertainty_nt::type + Orientation; + typedef typename Same_uncertainty_nt::type + Oriented_side; + typedef typename Same_uncertainty_nt::type + Bounded_side; + typedef typename Same_uncertainty_nt::type + Angle; + typedef Dynamic_dimension_tag Dimension; template diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake index 37bd9a812d6..5e86a4dd4cf 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake @@ -13,7 +13,7 @@ # use this file except in compliance with the License. You may obtain a copy # of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT diff --git a/Linear_cell_complex/benchmark/README.TXT b/Linear_cell_complex/benchmark/README.TXT index a721960047d..588995c5edb 100644 --- a/Linear_cell_complex/benchmark/README.TXT +++ b/Linear_cell_complex/benchmark/README.TXT @@ -18,9 +18,9 @@ INSTALLATION: 1) Install all the following libraries: CGAL: https://www.cgal.org/ -CGoGN: http://cgogn.u-strasbg.fr/ -OpenMesh: http://www.openmesh.org/ -OpenVolumeMesh: http://www.openvolumemesh.org/ +CGoGN: https://cgogn.github.io/ +OpenMesh: https://www.openmesh.org/ +OpenVolumeMesh: https://www.openvolumemesh.org/ 2) create links (or copy directory): * in the 2D directory: @@ -41,7 +41,7 @@ CGAL_BUILD_DIR being the build directory of the CGAL library. * In 2D, the programs take off files as input. * In 3D, lcc and cgogn take tetmesh and OpenVolumeMesh takes ovm. -You can create a tetmesh file using tetgen programm with an off file as input (http://tetgen.berlios.de/) with option -g to generate XXX.mesh file. Rename this file into XXX.tetmesh. Modify the file to keep only the two following sections: +You can create a tetmesh file using tetgen programm with an off file as input (https://www.berlios.de/software/tetgen/) with option -g to generate XXX.mesh file. Rename this file into XXX.tetmesh. Modify the file to keep only the two following sections: ********************** Vertices diff --git a/Maintenance/deb/sid/debian/README.Debian b/Maintenance/deb/sid/debian/README.Debian index 4be997664d7..e1056ac3ab7 100644 --- a/Maintenance/deb/sid/debian/README.Debian +++ b/Maintenance/deb/sid/debian/README.Debian @@ -44,7 +44,7 @@ and pass the option -DQGLVIEWER_INCLUDE_DIR=/some/dir -to cmake. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more +to cmake. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more information. -- Joachim Reichel Sat, 06 Feb 2010 12:29:02 +0100 diff --git a/Maintenance/deb/sid/debian/copyright b/Maintenance/deb/sid/debian/copyright index ecc6058b7dc..6390c1a2874 100644 --- a/Maintenance/deb/sid/debian/copyright +++ b/Maintenance/deb/sid/debian/copyright @@ -318,7 +318,7 @@ src/CGALCore and include/CGAL/CORE. Copyright (c) 1995-2004 Exact Computation Project All rights reserved. - This file is part of CORE (http://cs.nyu.edu/exact/core/). + This file is part of CORE (https://cs.nyu.edu/exact/core/). You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/Maintenance/deb/sid/debian/rules b/Maintenance/deb/sid/debian/rules index 4e3de31d8e9..a3533b8b2cb 100755 --- a/Maintenance/deb/sid/debian/rules +++ b/Maintenance/deb/sid/debian/rules @@ -2,7 +2,7 @@ # export DH_VERBOSE=1 -# See http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake +# See https://wiki.debian.org/Hardening#Notes_for_packages_using_CMake CFLAGS := $(CFLAGS) $(CPPFLAGS) CXXFLAGS := $(CXXFLAGS) $(CPPFLAGS) @@ -26,11 +26,11 @@ override_dh_auto_configure: cd shared && QTDIR= cmake .. \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ -DWITH_CGAL_Qt3=OFF -DWITH_demos=OFF -DWITH_examples=OFF \ - -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE + -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE mkdir -p shared/demo/CGAL_ipelets cd shared/demo/CGAL_ipelets && QTDIR= cmake ../../../demo/CGAL_ipelets \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=$(CURDIR)/shared + -DCGAL_DIR=$(CURDIR)/shared override_dh_auto_build: $(MAKE) -C static diff --git a/Maintenance/deb/squeeze/debian/README.Debian b/Maintenance/deb/squeeze/debian/README.Debian index 4be997664d7..e1056ac3ab7 100644 --- a/Maintenance/deb/squeeze/debian/README.Debian +++ b/Maintenance/deb/squeeze/debian/README.Debian @@ -44,7 +44,7 @@ and pass the option -DQGLVIEWER_INCLUDE_DIR=/some/dir -to cmake. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more +to cmake. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more information. -- Joachim Reichel Sat, 06 Feb 2010 12:29:02 +0100 diff --git a/Maintenance/deb/squeeze/debian/copyright b/Maintenance/deb/squeeze/debian/copyright index ecc6058b7dc..6390c1a2874 100644 --- a/Maintenance/deb/squeeze/debian/copyright +++ b/Maintenance/deb/squeeze/debian/copyright @@ -318,7 +318,7 @@ src/CGALCore and include/CGAL/CORE. Copyright (c) 1995-2004 Exact Computation Project All rights reserved. - This file is part of CORE (http://cs.nyu.edu/exact/core/). + This file is part of CORE (https://cs.nyu.edu/exact/core/). You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/Maintenance/deb/squeeze/debian/rules b/Maintenance/deb/squeeze/debian/rules index 4e3de31d8e9..a3533b8b2cb 100755 --- a/Maintenance/deb/squeeze/debian/rules +++ b/Maintenance/deb/squeeze/debian/rules @@ -2,7 +2,7 @@ # export DH_VERBOSE=1 -# See http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake +# See https://wiki.debian.org/Hardening#Notes_for_packages_using_CMake CFLAGS := $(CFLAGS) $(CPPFLAGS) CXXFLAGS := $(CXXFLAGS) $(CPPFLAGS) @@ -26,11 +26,11 @@ override_dh_auto_configure: cd shared && QTDIR= cmake .. \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ -DWITH_CGAL_Qt3=OFF -DWITH_demos=OFF -DWITH_examples=OFF \ - -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE + -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE mkdir -p shared/demo/CGAL_ipelets cd shared/demo/CGAL_ipelets && QTDIR= cmake ../../../demo/CGAL_ipelets \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=$(CURDIR)/shared + -DCGAL_DIR=$(CURDIR)/shared override_dh_auto_build: $(MAKE) -C static diff --git a/Maintenance/deb/wheezy/debian/README.Debian b/Maintenance/deb/wheezy/debian/README.Debian index 4be997664d7..e1056ac3ab7 100644 --- a/Maintenance/deb/wheezy/debian/README.Debian +++ b/Maintenance/deb/wheezy/debian/README.Debian @@ -44,7 +44,7 @@ and pass the option -DQGLVIEWER_INCLUDE_DIR=/some/dir -to cmake. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more +to cmake. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more information. -- Joachim Reichel Sat, 06 Feb 2010 12:29:02 +0100 diff --git a/Maintenance/deb/wheezy/debian/copyright b/Maintenance/deb/wheezy/debian/copyright index ecc6058b7dc..6390c1a2874 100644 --- a/Maintenance/deb/wheezy/debian/copyright +++ b/Maintenance/deb/wheezy/debian/copyright @@ -318,7 +318,7 @@ src/CGALCore and include/CGAL/CORE. Copyright (c) 1995-2004 Exact Computation Project All rights reserved. - This file is part of CORE (http://cs.nyu.edu/exact/core/). + This file is part of CORE (https://cs.nyu.edu/exact/core/). You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/Maintenance/deb/wheezy/debian/rules b/Maintenance/deb/wheezy/debian/rules index 4e3de31d8e9..a3533b8b2cb 100755 --- a/Maintenance/deb/wheezy/debian/rules +++ b/Maintenance/deb/wheezy/debian/rules @@ -2,7 +2,7 @@ # export DH_VERBOSE=1 -# See http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake +# See https://wiki.debian.org/Hardening#Notes_for_packages_using_CMake CFLAGS := $(CFLAGS) $(CPPFLAGS) CXXFLAGS := $(CXXFLAGS) $(CPPFLAGS) @@ -26,11 +26,11 @@ override_dh_auto_configure: cd shared && QTDIR= cmake .. \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ -DWITH_CGAL_Qt3=OFF -DWITH_demos=OFF -DWITH_examples=OFF \ - -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE + -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE mkdir -p shared/demo/CGAL_ipelets cd shared/demo/CGAL_ipelets && QTDIR= cmake ../../../demo/CGAL_ipelets \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=$(CURDIR)/shared + -DCGAL_DIR=$(CURDIR)/shared override_dh_auto_build: $(MAKE) -C static diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam b/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam index 60d4ad326c3..cb26334a389 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam @@ -2,13 +2,13 @@ # Copyright 2004 John Maddock # Copyright 2002, 2003, 2004, 2007 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# (See accompanying file LICENSE_1_0.txt or https://www.boost.org/LICENSE_1_0.txt) # This file is used to configure your Boost.Build installation. You can modify # this file in place, or you can place it in a permanent location so that it # does not get overwritten should you get a new version of Boost.Build. See: # -# http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html +# https://www.boost.org/build/doc/html/bbv2/overview/configuration.html # # for documentation about possible permanent locations. @@ -17,7 +17,7 @@ # example lines and adjust them to taste. The complete list of supported tools, # and configuration instructions can be found at: # -# http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html +# https://www.boost.org/build/doc/html/bbv2/reference/tools.html # # This file uses Jam language syntax to describe available tools. Mostly, @@ -31,7 +31,7 @@ # # More details about the syntax can be found at: # -# http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language +# https://www.boost.org/build/doc/html/jam/language.html # # ------------------ @@ -96,7 +96,7 @@ using gcc : : /usr/local/packages/gcc-4.5/bin/g++ ; using gcc : cxxdebug : "/usr/lib64/ccache/g++" # your path to the C++ compiler - : -D_GLIBCXX_DEBUG + : -D_GLIBCXX_DEBUG ; using gcc diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h index 8cfc61a0e88..1b633566c73 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h index 559822a843e..d7e47535627 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h index 8cfc61a0e88..1b633566c73 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h index 559822a843e..d7e47535627 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/public_release/announcement/mailing-beta.eml b/Maintenance/public_release/announcement/mailing-beta.eml index e6de484eb6d..11b4295f32f 100644 --- a/Maintenance/public_release/announcement/mailing-beta.eml +++ b/Maintenance/public_release/announcement/mailing-beta.eml @@ -160,7 +160,7 @@ Most modules are distributed under the terms of the GPL Open Source license (GNU General Public License v3 or later versions). If your intended usage does not meet the criteria of the aforementioned licenses, a commercial license can be purchased from -GeometryFactory (http://www.geometryfactory.com/). +GeometryFactory (https://www.geometryfactory.com/). For further information and for downloading the library and its diff --git a/Maintenance/public_release/announcement/mailing.eml b/Maintenance/public_release/announcement/mailing.eml index 67f9e890a9e..23ea320c941 100644 --- a/Maintenance/public_release/announcement/mailing.eml +++ b/Maintenance/public_release/announcement/mailing.eml @@ -159,7 +159,7 @@ Most modules are distributed under the terms of the GPL Open Source license (GNU General Public License v3 or later versions). If your intended usage does not meet the criteria of the aforementioned licenses, a commercial license can be purchased from -GeometryFactory (http://www.geometryfactory.com/). +GeometryFactory (https://www.geometryfactory.com/). For further information and for downloading the library and its diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index ac7d8d5c28a..6a3632481b7 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -40,7 +40,7 @@ my @testresults; my $testresult_dir=cwd()."/TESTRESULTS"; # Inspired from -# http://cpansearch.perl.org/src/EDAVIS/Sort-Versions-1.5/Versions.pm +# https://metacpan.org/pod/Sort::Versions sub sort_releases($$) { # Take arguments in revert order: one wants to sort from the recent to @@ -596,7 +596,7 @@ sub print_little_header(){ my $release_version = substr($release_name, 5); print OUTPUT<<"EOF"; + "https://www.w3.org/TR/html4/strict.dtd"> @@ -622,14 +622,10 @@ Downloading internal releases

  • The doxygen documentation testpage (and the overview page)
  • +
  • +Diff of testsuites results
  • + EOF - if ( -r "announce.html" ) { - print OUTPUT<<"EOF"; -
  • Announcement of this release
  • -EOF - } - - print OUTPUT "\n"; } @@ -675,7 +671,7 @@ sub main() See the log here.

    - ">">Valid HTML 4.01 Strict

    diff --git a/Maintenance/test_handling/filter_testsuite/create_testresult_page b/Maintenance/test_handling/filter_testsuite/create_testresult_page index 399e57d5ddd..76ca849b01f 100755 --- a/Maintenance/test_handling/filter_testsuite/create_testresult_page +++ b/Maintenance/test_handling/filter_testsuite/create_testresult_page @@ -35,7 +35,7 @@ my @testresults; my $testresult_dir=cwd()."/TESTRESULTS"; # Inspired from -# http://cpansearch.perl.org/src/EDAVIS/Sort-Versions-1.5/Versions.pm +# https://metacpan.org/pod/Sort::Versions sub sort_releases($$) { # Take arguments in revert order: one wants to sort from the recent to @@ -591,7 +591,7 @@ sub print_little_header(){ my $release_version = substr($release_name, 5); print OUTPUT<<"EOF"; + "https://www.w3.org/TR/html4/strict.dtd"> @@ -665,7 +665,7 @@ sub main() See the log here.

    - ">">Valid HTML 4.01 Strict

    diff --git a/Mesh_3/benchmark/Mesh_3/concurrency.cpp b/Mesh_3/benchmark/Mesh_3/concurrency.cpp index ea383a78832..006c917b990 100644 --- a/Mesh_3/benchmark/Mesh_3/concurrency.cpp +++ b/Mesh_3/benchmark/Mesh_3/concurrency.cpp @@ -7,7 +7,7 @@ #endif // Without TBB_USE_THREADING_TOOL Intel Inspector XE will report false positives in Intel TBB -// (http://software.intel.com/en-us/articles/compiler-settings-for-threading-error-analysis-in-intel-inspector-xe/) +// (https://www.intel.com/content/www/us/en/developer/articles/technical/compiler-settings-for-threading-error-analysis-in-intel-inspector-xe.html) #ifdef _DEBUG # define TBB_USE_THREADING_TOOL #endif diff --git a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h index 93b4119a1b1..1b1e53c9305 100644 --- a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h +++ b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h @@ -1058,7 +1058,7 @@ private: */ FT cotangent(const FT& value) const { - return FT(1/std::tan(CGAL::to_double(value))); + return FT(1./std::tan(CGAL::to_double(value))); } /** diff --git a/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h b/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h index 4b98132bb68..8ccc2643a0e 100644 --- a/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h +++ b/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h @@ -14,7 +14,7 @@ several disconnected components. The result is therefore represented as a sequence of generalized polygons, whose edges are either line segments or circular arcs. The output sequence is returned via the output iterator `oi`, whose -value-type must be `Gps_circle_segment_traits_2::Polygon_2`. +value-type must be `Gps_circle_segment_traits_2::%Polygon_2`. \pre `P` is a simple polygon. */ template diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h index b4b057ef2d0..59b5f208021 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h @@ -35,10 +35,8 @@ public: { } - AABB_segment_2_primitive(const AABB_segment_2_primitive &primitive) - { - m_it = primitive.id(); - } + AABB_segment_2_primitive(const AABB_segment_2_primitive& primitive) = default; + AABB_segment_2_primitive& operator=(const AABB_segment_2_primitive& primitive) = default; const Id &id() const { diff --git a/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h b/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h index 4a38ac41754..cef97636549 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h @@ -30,10 +30,8 @@ class SNC_SM_explorer : public SMCDEC { public: SNC_SM_explorer(const Base& E) : Base(E) {} - Self& operator=(const Self& E) { - Base::operator=(E); - return *this; - } + SNC_SM_explorer(const Self& E) = default; + Self& operator=(const Self& E) = default; }; } //namespace CGAL diff --git a/Number_types/doc/Number_types/CGAL/Sqrt_extension.h b/Number_types/doc/Number_types/CGAL/Sqrt_extension.h index e5869154551..a52f55780dc 100644 --- a/Number_types/doc/Number_types/CGAL/Sqrt_extension.h +++ b/Number_types/doc/Number_types/CGAL/Sqrt_extension.h @@ -13,7 +13,7 @@ An instance of this class represents an extension of the type `NT` by *one* squa For example, let `Integer` be some type representing \f$ \mathbb{Z}\f$, then `Sqrt_extension` is able to represent \f$ \mathbb{Z}[\sqrt{\mathrm{root}}]\f$ -for some arbitrary Integer \f$\mathrm{root}\f$. \cgalFootnote{\f$ R[a]\f$ denotes the extension of a ring \f$ R\f$ by an element \f$ a\f$. See also: \cgalFootnoteCode{http://mathworld.wolfram.com/ExtensionRing.html}} +for some arbitrary Integer \f$\mathrm{root}\f$. \cgalFootnote{\f$ R[a]\f$ denotes the extension of a ring \f$ R\f$ by an element \f$ a\f$. See also: \cgalFootnoteCode{https://mathworld.wolfram.com/ExtensionRing.html}} The value of \f$\mathrm{root}\f$ is set at construction time, or set to zero if it is not specified. diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 429941be991..7b926a5d251 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -143,8 +143,8 @@ inline double IA_opacify(double x) { #ifdef __llvm__ // LLVM's support for inline asm is completely messed up: - // http://llvm.org/bugs/show_bug.cgi?id=17958 - // http://llvm.org/bugs/show_bug.cgi?id=17959 + // https://bugs.llvm.org/show_bug.cgi?id=17958 + // https://bugs.llvm.org/show_bug.cgi?id=17959 // etc. // This seems to produce code that is ok (not optimal but better than // volatile). In case of trouble, use volatile instead. @@ -166,7 +166,7 @@ inline double IA_opacify(double x) // Intel used not to emulate this perfectly, we'll see. // If we create a version of IA_opacify for vectors, note that gcc < 4.8 // fails with "+g" and we need to use "+mx" instead. - // "+X" ICEs ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155 ) and + // "+X" ICEs ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155 ) and // may not be safe? // The constraint 'g' doesn't include floating point registers ??? // Intel has a bug where -mno-sse still defines __SSE__ and __SSE2__ @@ -180,10 +180,10 @@ inline double IA_opacify(double x) # endif # elif (defined __i386__ || defined __x86_64__) // "+f" doesn't compile on x86(_64) - // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59157 ) - // Don't mix "t" with "g": http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180 + // ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59157 ) + // Don't mix "t" with "g": https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180 // We can't put "t" with "x" either, prefer "x" for -mfpmath=sse,387. - // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59181 ) + // ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59181 ) asm volatile ("" : "+mt"(x) ); # elif (defined __VFP_FP__ && !defined __SOFTFP__) || defined __aarch64__ // ARM @@ -217,7 +217,7 @@ inline double IA_force_to_double(double x) #if defined __GNUG__ # ifdef CGAL_HAS_SSE2 // For an explanation of volatile: - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56027 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56027 asm volatile ("" : "+mx"(x) ); # else // Similar to writing to a volatile and reading back, except that calling @@ -500,6 +500,7 @@ void FPU_set_cw (FPU_CW_t cw) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_USE(cw); CGAL_assertion(cw == CGAL_FE_TONEAREST); #else CGAL_IA_SETFPCW(cw); @@ -511,6 +512,7 @@ FPU_CW_t FPU_get_and_set_cw (FPU_CW_t cw) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_USE(cw); CGAL_assertion(cw == CGAL_FE_TONEAREST); return CGAL_FE_TONEAREST; #else diff --git a/Number_types/include/CGAL/GMP/Gmpz_type.h b/Number_types/include/CGAL/GMP/Gmpz_type.h index b6ace5743a0..bf91ddb5d91 100644 --- a/Number_types/include/CGAL/GMP/Gmpz_type.h +++ b/Number_types/include/CGAL/GMP/Gmpz_type.h @@ -324,9 +324,9 @@ gmpz_new_read(std::istream &is, Gmpz &z) // peek() sets also the failbit, one has to check for EOL twice. // // See the LWG C++ Issue 2036, classified as Not-A-Defect: - // http://lwg.github.com/issues/lwg-closed.html#2036 + // https://lwg.github.io/issues/lwg-closed.html#2036 // and a StackOverflow related question: - // http://stackoverflow.com/a/9020292/1728537 + // https://stackoverflow.com/a/9020292/1728537 // -- // Laurent Rineau, 2013/10/10 while (!is.eof()) { diff --git a/OpenNL/include/CGAL/OpenNL/bicgstab.h b/OpenNL/include/CGAL/OpenNL/bicgstab.h index dd8ea48a3ca..a9cef2c92e8 100644 --- a/OpenNL/include/CGAL/OpenNL/bicgstab.h +++ b/OpenNL/include/CGAL/OpenNL/bicgstab.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2005-2008: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/blas.h b/OpenNL/include/CGAL/OpenNL/blas.h index 52c4810e2c8..8cea9da67ad 100644 --- a/OpenNL/include/CGAL/OpenNL/blas.h +++ b/OpenNL/include/CGAL/OpenNL/blas.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 01/2005: Change for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h b/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h index c575aa6f0c8..6f2e6f5b2e8 100644 --- a/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h +++ b/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2005-2006: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/full_vector.h b/OpenNL/include/CGAL/OpenNL/full_vector.h index b0857dfa851..0459808b638 100644 --- a/OpenNL/include/CGAL/OpenNL/full_vector.h +++ b/OpenNL/include/CGAL/OpenNL/full_vector.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 01/2005: Change for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/linear_solver.h b/OpenNL/include/CGAL/OpenNL/linear_solver.h index 33dccdcc6cb..d4e928eec9a 100644 --- a/OpenNL/include/CGAL/OpenNL/linear_solver.h +++ b/OpenNL/include/CGAL/OpenNL/linear_solver.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2005-2006: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/preconditioner.h b/OpenNL/include/CGAL/OpenNL/preconditioner.h index 2d7728a94ca..808b6f39eb1 100644 --- a/OpenNL/include/CGAL/OpenNL/preconditioner.h +++ b/OpenNL/include/CGAL/OpenNL/preconditioner.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2006: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/sparse_matrix.h b/OpenNL/include/CGAL/OpenNL/sparse_matrix.h index 2d5b3812e30..4e4c01f46d4 100644 --- a/OpenNL/include/CGAL/OpenNL/sparse_matrix.h +++ b/OpenNL/include/CGAL/OpenNL/sparse_matrix.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 01/2005: Change for CGAL: diff --git a/OpenNL/package_info/OpenNL/long_description.txt b/OpenNL/package_info/OpenNL/long_description.txt index 8c0cd24b1f9..645de7254ee 100644 --- a/OpenNL/package_info/OpenNL/long_description.txt +++ b/OpenNL/package_info/OpenNL/long_description.txt @@ -15,7 +15,7 @@ Contact ======= The author is Bruno Levy . -OpenNL main page is http://www.loria.fr/~levy/software/. +OpenNL main page is https://www.loria.fr/~levy/software/. Caution ======= diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index b2931f84429..bb1dd8a2354 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -320,8 +320,21 @@ public: void refine(const Split_predicate& split_predicate) { // If the tree has already been refined, reset it - if (!m_root.is_leaf()) + if (!m_root.is_leaf()){ + std::queue nodes; + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (m_root[i]); + while (!nodes.empty()) + { + Node node = nodes.front(); + nodes.pop(); + if (!node.is_leaf()) + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (node[i]); + node.free(); + } m_root.unsplit(); + } // Reset the side length map, too m_side_per_depth.resize(1); diff --git a/Orthtree/include/CGAL/Orthtree/Node.h b/Orthtree/include/CGAL/Orthtree/Node.h index cfa49fb5366..a16d2fff192 100644 --- a/Orthtree/include/CGAL/Orthtree/Node.h +++ b/Orthtree/include/CGAL/Orthtree/Node.h @@ -365,7 +365,7 @@ public: } /*! - \brief returns the nth child fo this node. + \brief returns the nth child of this node. \pre `!is_null()` \pre `!is_leaf()` diff --git a/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h b/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h index fa78978a4dd..8887bc4164b 100644 --- a/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h +++ b/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h @@ -47,7 +47,8 @@ public: typedef typename Traits::Point_2 Point_2; using internal::vector< Rotation_tree_node_2 >::push_back; - using internal::vector< Rotation_tree_node_2 >::back; + using internal::vector< Rotation_tree_node_2 >::back; + using internal::vector< Rotation_tree_node_2 >::erase; class Greater { typename Traits::Less_xy_2 less; @@ -78,7 +79,7 @@ public: Greater greater (traits.less_xy_2_object()); Equal equal; std::sort(this->begin(), this->end(), greater); - std::unique(this->begin(), this->end(),equal); + this->erase(std::unique(this->begin(), this->end(),equal), this->end()); // front() is the point with the largest x coordinate diff --git a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp index ddef1fcc6de..3268d9dd881 100644 --- a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp +++ b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) // For generating the plot: /* - + diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp index 64ed148670d..513e34d5ebc 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp @@ -12,7 +12,7 @@ * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ + * https://spdx.org/licenses/SGI-B-2.0.html * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html index bf9e3becae7..9816a12a0c3 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html @@ -2,8 +2,8 @@

    CGAL Periodic Delaunay Triangulation

    Copyright ©2008-2009
    - INRIA Sophia Antipolis - Mediterranee

    -

    This application illustrates the 3D Periodic Delaunay Triangulation + INRIA Sophia Antipolis - Mediterranee

    +

    This application illustrates the 3D Periodic Delaunay Triangulation of CGAL.

    See also the package manual:
    diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html index 6b2b2a5d943..f2f0fb9318b 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html @@ -3,6 +3,6 @@

    Computational Geometry Algorithms Library

    CGAL provides efficient and reliable geometric algorithms in the form of a C++ library.

    -

    For more information visit www.cgal.org

    +

    For more information visit www.cgal.org

    diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 304cf589d5f..c48e0ad463c 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -465,8 +465,9 @@ public: \note Properties of the added point other than its normal vector are initialized to their default value. - \note A normal property must have been added to the point set - before using this method. + \note If not already added, a normal property is automatically + added to the point set when using this method. The default value + for normal vectors is `CGAL::NULL_VECTOR`. \note If a reallocation happens, all iterators, pointers and references related to the container are invalidated. Otherwise, @@ -479,8 +480,7 @@ public: iterator insert (const Point& p, const Vector& n) { iterator out = insert (p); - CGAL_assertion(has_normal_map()); - m_normals[size()-1] = n; + normal_map()[size()-1] = n; return out; } @@ -550,17 +550,17 @@ public: /*! \brief returns a reference to the normal corresponding to `index`. - \note The normal property must have been added to the point set - before calling this method (see `add_normal_map()`). + \note If not already added, a normal property is automatically + added to the point set (see `add_normal_map()`). */ - Vector& normal (const Index& index) { return m_normals[index]; } + Vector& normal (const Index& index) { return normal_map()[index]; } /*! \brief returns a constant reference to the normal corresponding to `index`. - \note The normal property must have been added to the point set - before calling this method (see `add_normal_map()`). + \note If not already added, a normal property is automatically + added to the point set (see `add_normal_map()`). */ - const Vector& normal (const Index& index) const { return m_normals[index]; } + const Vector& normal (const Index& index) const { return normal_map()[index]; } /// @} @@ -869,11 +869,14 @@ public: /*! \brief returns the property map of the normal property. - \note The normal property must have been added to the point set - before calling this method (see `add_normal_map()`). + \note If the normal property has not been added yet to the point set + before calling this method, the property map is automatically added + with `add_normal_map()`. */ Vector_map normal_map () { + if (!m_normals) + add_normal_map(); return m_normals; } /*! @@ -982,7 +985,7 @@ public: inline parameters() const { return CGAL::parameters::point_map (m_points). - normal_map (m_normals). + normal_map (normal_map()). geom_traits (typename Kernel_traits::Kernel()); } @@ -1036,7 +1039,7 @@ public: */ Vector_range normals () const { - return this->range (m_normals); + return this->range (normal_map()); } /// @} @@ -1354,11 +1357,18 @@ struct Point_set_processing_3_np_helper, NamedParamet return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map() + static bool has_normal_map(const Point_set_3& ps, const NamedParameters&) { - return true; + if (ps.has_normal_map()) + return true; + using CGAL::parameters::is_default_parameter; + return !(is_default_parameter::value); } + static constexpr bool has_normal_map(Point_set_3&, const NamedParameters&) + { + return true; // either available in named parameters, and always available in Point_set_3 otherwise + } }; /// \endcond diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index e002a834c5f..660601cb985 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -97,8 +97,6 @@ bool read_OFF(std::istream& is, typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - bool has_normals = NP_helper::has_normal_map(); - PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); @@ -182,8 +180,7 @@ bool read_OFF(std::istream& is, Enriched_point pwn; put(point_map, pwn, point); // point_map[&pwn] = point - if (has_normals) - put(normal_map, pwn, normal); // normal_map[&pwn] = normal + put(normal_map, pwn, normal); // normal_map[&pwn] = normal *output++ = pwn; ++pointsRead; diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 282ad59d4a3..93cf9c91356 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -257,17 +257,12 @@ bool read_PLY(std::istream& is, typedef typename NP_helper::Point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); - PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); - if(has_normals) - return read_PLY_with_properties(is, output, - make_ply_point_reader(point_map), - make_ply_normal_reader(normal_map)); - // else - return read_PLY_with_properties(is, output, make_ply_point_reader(point_map)); + return read_PLY_with_properties(is, output, + make_ply_point_reader(point_map), + make_ply_normal_reader(normal_map)); } /** diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index caf7e062a5e..b930b167d09 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -89,8 +89,6 @@ bool read_XYZ(std::istream& is, typedef typename NP_helper::Normal_map NormalMap; typedef typename NP_helper::Geom_traits Kernel; - bool has_normals = NP_helper::has_normal_map(); - PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); @@ -155,8 +153,7 @@ bool read_XYZ(std::istream& is, Enriched_point pwn; put(point_map, pwn, point); // point_map[pwn] = point - if (has_normals) - put(normal_map, pwn, normal); // normal_map[pwn] = normal + put(normal_map, pwn, normal); // normal_map[pwn] = normal *output++ = pwn; continue; diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 0be0e4183a3..d5411b67fd9 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -45,7 +45,7 @@ bool write_OFF_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - const bool has_normals = !(is_default_parameter::value); + const bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 6dca998ae72..525bc159023 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,7 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 2f2cc0ae701..43875b1a5d8 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -46,7 +46,7 @@ bool write_XYZ_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 396d9cdb0e0..6588d5f32f2 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -278,7 +278,7 @@ bilateral_smooth_point_set( typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Vector_3 Vector_3; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::FT FT; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index bf4b589d788..c74414b6cb2 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,7 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 30a7f34d48c..d808a6ee46f 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,7 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg(!(std::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 2a284b2e859..aa576df9f80 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -631,7 +631,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 4d5e04b9491..897ade8967c 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,7 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index 62c0ea1f76d..2623dbc112c 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -479,7 +479,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index f2d9bd447c3..b421f811b4b 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -233,7 +233,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg((!is_default_parameter::value), "Error: no plane index map"); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index bf7a7f5225c..b85d68cc9e9 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,7 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index 1699ca2a0f9..3906fe9dab3 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -32,7 +32,11 @@ /// Functions to test if there are self intersections, and to report faces that do intersect. /// \ingroup PkgPolygonMeshProcessingRef -/// \defgroup PMP_repairing_grp Combinatorial Repairing +/// \defgroup PMP_combinatorial_repair_grp Combinatorial Repair +/// Functions to repair polygon soups and polygon meshes. +/// \ingroup PkgPolygonMeshProcessingRef + +/// \defgroup PMP_geometric_repair_grp Geometric Repair /// Functions to repair polygon soups and polygon meshes. /// \ingroup PkgPolygonMeshProcessingRef @@ -162,7 +166,7 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polyhedral_envelope` - `CGAL::Side_of_triangle_mesh` -\cgalCRPSection{Combinatorial Repairing Functions} +\cgalCRPSection{Combinatorial Repair Functions} - `CGAL::Polygon_mesh_processing::merge_duplicate_points_in_polygon_soup()` - `CGAL::Polygon_mesh_processing::merge_duplicate_polygons_in_polygon_soup()` - `CGAL::Polygon_mesh_processing::remove_isolated_points_in_polygon_soup()` @@ -179,6 +183,8 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polygon_mesh_processing::duplicate_non_manifold_vertices()` - `CGAL::Polygon_mesh_processing::merge_duplicated_vertices_in_boundary_cycle()` - `CGAL::Polygon_mesh_processing::merge_duplicated_vertices_in_boundary_cycles()` + +\cgalCRPSection{Geometric Repair Functions} - `CGAL::Polygon_mesh_processing::remove_almost_degenerate_faces()` \cgalCRPSection{Connected Components} diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 08e11df647d..947c907a7b3 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -46,7 +46,8 @@ and smoothing algorithms. - \ref PMPPredicates : predicates that can be evaluated on the processed polygon. mesh, which includes point location and self intersection tests. - \ref PMPOrientation : checking or fixing the orientation of a polygon soup. -- \ref PMPRepairing : repair of polygon meshes and polygon soups. +- \ref PMPCombinatorialRepair : repair of polygon meshes and polygon soups. +- \ref PMPGeometricRepair : repair of the geometry of polygon meshes. - \ref PMPNormalComp : normal computation at vertices and on faces of a polygon mesh. - \ref PMPSlicer : functor able to compute the intersections of a polygon mesh with arbitrary planes (slicer). - \ref PMPConnectedComponents : methods to deal with connected @@ -59,7 +60,7 @@ of the graph concepts defined in the package \ref PkgBGLRef. Using common graph enables having common input/output functions for all the models of these concepts. The page \ref PkgBGLIOFct provides an exhaustive description of the available I/O functions. In addition, this package offers the function `CGAL::Polygon_mesh_processing::IO::read_polygon_mesh()`, -which can perform some reparation if the input data do not represent a manifold surface. +which can perform some repairing if the input data do not represent a manifold surface. **************************************** \section PMPMeshing Meshing @@ -746,7 +747,7 @@ This example shows how to correctly repair and orient a soup to get a mesh from **************************************** -\section PMPRepairing Combinatorial Repairing +\section PMPCombinatorialRepair Combinatorial Repair ******************* \subsection PSRepairing Polygon Soup Repairing @@ -785,31 +786,7 @@ with duplicated border edges. \cgalExample{Polygon_mesh_processing/stitch_borders_example.cpp} -\if READY_TO_PUBLISH - -\subsection DegenerateFaces Removing Degenerate Faces - -Some degenerate faces may be part of a given triangle mesh. -A face is considered \e degenerate if two of its vertices -share the same location, or more generally if its three vertices are collinear. -The function `CGAL::Polygon_mesh_processing::remove_degenerate_faces()` -removes those faces and fixes the connectivity of the newly cleaned up mesh. -It is also possible to remove isolated vertices from any polygon mesh, using the function -`CGAL::Polygon_mesh_processing::remove_isolated_vertices()`. - -\subsubsection RemoveDegenerateExample Example - -In the following example, the degenerate faces of a triangle mesh -are removed, the connectivity is fixed, and the number of removed faces -is output. - -\cgalExample{Polygon_mesh_processing/remove_degeneracies_example.cpp} -\endif - \subsection PMPManifoldness Polygon Mesh Manifoldness -This package offers repairing methods to clean ill-formed polygon soups, -see Section \ref PMPRepairing. - Non-manifold vertices can be detected using the function `CGAL::Polygon_mesh_processing::is_non_manifold_vertex()`. The function `CGAL::Polygon_mesh_processing::duplicate_non_manifold_vertices()` can be used to attempt to create a combinatorially manifold surface mesh by splitting any non-manifold vertex @@ -835,6 +812,9 @@ more than once (although, with different vertices) before reaching the initial b `CGAL::Polygon_mesh_processing::merge_duplicated_vertices_in_boundary_cycle()`, which merge vertices at identical positions, can be used to repair this configuration. +\section PMPGeometricRepair Geometric Repair +**************************************** + \subsection PMPRemoveCapsNeedles Removal of Almost Degenerate Triangle Faces Triangle faces of a mesh made up of almost collinear points are badly shaped elements that might not be desirable to have in a mesh. The function @@ -844,6 +824,27 @@ As some badly shaped elements are inevitable (the triangulation of a long cylind with only vertices on the top and bottom circles for example), extra parameters can be passed to prevent the removal of such elements (`collapse_length_threshold` and `flip_triangle_height_threshold`). +\if READY_TO_PUBLISH + +\subsection DegenerateFaces Removing Degenerate Faces + +Some degenerate faces may be part of a given triangle mesh. +A face is considered \e degenerate if two of its vertices +share the same location, or more generally if its three vertices are collinear. +The function `CGAL::Polygon_mesh_processing::remove_degenerate_faces()` +removes those faces and fixes the connectivity of the newly cleaned up mesh. +It is also possible to remove isolated vertices from any polygon mesh, using the function +`CGAL::Polygon_mesh_processing::remove_isolated_vertices()`. + +\subsubsection RemoveDegenerateExample Example + +In the following example, the degenerate faces of a triangle mesh +are removed, the connectivity is fixed, and the number of removed faces +is output. + +\cgalExample{Polygon_mesh_processing/remove_degeneracies_example.cpp} +\endif + **************************************** \section PMPNormalComp Computing Normals diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp index 13da122a884..e58267d6da7 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp @@ -84,9 +84,9 @@ int main(int, char**) polygons.push_back({0,1,2,3,4,3,2,1}); #endif - std::cout << "Before reparation, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; + std::cout << "Before repairing, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; PMP::repair_polygon_soup(points, polygons, CGAL::parameters::geom_traits(Array_traits())); - std::cout << "After reparation, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; + std::cout << "After repairing, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; Mesh mesh; PMP::orient_polygon_soup(points, polygons); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h index d02ef3a9023..0260d314619 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -41,18 +41,18 @@ namespace internal { typename TriangleMesh, typename VertexRange, typename VertexPointMap> - bool fair(TriangleMesh& tmesh, - const VertexRange& vertices, - SparseLinearSolver solver, - WeightCalculator weight_calculator, - unsigned int continuity, - VertexPointMap vpmap) - { - CGAL::Polygon_mesh_processing::internal::Fair_Polyhedron_3 - - fair_functor(tmesh, vpmap, weight_calculator); - return fair_functor.fair(vertices, solver, continuity); - } +bool fair(TriangleMesh& tmesh, + const VertexRange& vertices, + SparseLinearSolver solver, + WeightCalculator weight_calculator, + unsigned int continuity, + VertexPointMap vpmap) +{ + CGAL::Polygon_mesh_processing::internal::Fair_Polyhedron_3 + + fair_functor(tmesh, vpmap, weight_calculator); + return fair_functor.fair(vertices, solver, continuity); +} } //end namespace internal @@ -161,25 +161,27 @@ namespace internal { #endif typedef typename GetVertexPointMap < TriangleMesh, NamedParameters>::type VPMap; + VPMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_property_map(vertex_point, tmesh)); + + typedef typename GetGeomTraits < TriangleMesh, NamedParameters>::type GT; + GT gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); // Cotangent_weight_with_voronoi_area_fairing has been changed to the version: - // Cotangent_weight_with_voronoi_area_fairing_secure to avoid imprecisions from + // Secure_cotangent_weight_with_voronoi_area to avoid imprecisions from // the issue #4706 - https://github.com/CGAL/cgal/issues/4706. - typedef CGAL::Weights::Secure_cotangent_weight_with_voronoi_area Default_weight_calculator; - - VPMap vpmap_ = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_property_map(vertex_point, tmesh)); + typedef CGAL::Weights::Secure_cotangent_weight_with_voronoi_area Default_weight_calculator; return internal::fair(tmesh, vertices, choose_parameter(get_parameter(np, internal_np::sparse_linear_solver)), - choose_parameter(get_parameter(np, internal_np::weight_calculator), Default_weight_calculator(tmesh, vpmap_)), + choose_parameter(get_parameter(np, internal_np::weight_calculator), Default_weight_calculator(tmesh, vpmap, gt)), choose_parameter(get_parameter(np, internal_np::fairing_continuity), 1), - vpmap_); + vpmap); } -} //end namespace Polygon_mesh_processing +} // namespace Polygon_mesh_processing -} //end namespace CGAL +} // namespace CGAL #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 8c7b8702366..79b7f260e69 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1068,15 +1068,15 @@ public: if (!used_to_clip_a_surface && !used_to_classify_patches && (!is_tm1_closed || !is_tm2_closed)) { //make sure there is no ambiguity in tm1 - if( (patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2[patch_id_p1] ) || - (patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2[patch_id_p2] ) ) + if( (!patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2.test(patch_id_p1) ) || + (!patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2.test(patch_id_p2) ) ) { impossible_operation.set(); return true; } //make sure there is no ambiguity in tm2 - if( (patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm2[patch_id_q1] ) || - (patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm2[patch_id_q2] ) ) + if( (!patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm1.test(patch_id_q1) ) || + (!patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm1.test(patch_id_q2) ) ) { impossible_operation.set(); return true; @@ -1091,6 +1091,15 @@ public: patch_status_not_set_tm2.reset(patch_id_q1); patch_status_not_set_tm2.reset(patch_id_q2); + // restore initial state, needed when checking in `inconsistent_classification()` + if (!is_tm1_closed || !is_tm2_closed) + { + is_patch_inside_tm2.reset(patch_id_p1); + is_patch_inside_tm2.reset(patch_id_p2); + is_patch_inside_tm1.reset(patch_id_q1); + is_patch_inside_tm1.reset(patch_id_q2); + } + #ifdef CGAL_COREFINEMENT_POLYHEDRA_DEBUG #warning: Factorize the orientation predicates. #endif //CGAL_COREFINEMENT_POLYHEDRA_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 3af5e28b102..15846998d96 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -383,9 +383,9 @@ class Weight_incomplete private: template Weight_incomplete(const std::vector& P, - const std::vector& Q, - int i, int j, int k, - const LookupTable& lambda) + const std::vector& Q, + int i, int j, int k, + const LookupTable& lambda) : weight(P,Q,i,j,k,lambda), patch_size(1) { } @@ -442,9 +442,9 @@ struct Weight_calculator template Weight operator()(const std::vector& P, - const std::vector& Q, - int i, int j, int k, - const LookupTable& lambda) const + const std::vector& Q, + int i, int j, int k, + const LookupTable& lambda) const { if( !is_valid(P,i,j,k) ) { return Weight::NOT_VALID(); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 837d16467e8..beb20bef0a2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -322,7 +322,7 @@ namespace internal { { halfedge_status_pmap_ = get(CGAL::dynamic_halfedge_property_t(), pmesh); - CGAL_assertion_code(input_mesh_is_valid_ = CGAL::is_valid_polygon_mesh(pmesh)); + CGAL_warning_code(input_mesh_is_valid_ = CGAL::is_valid_polygon_mesh(pmesh)); CGAL_warning_msg(input_mesh_is_valid_, "The input mesh is not a valid polygon mesh. " "It could lead PMP::isotropic_remeshing() to fail."); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h index 3757f23f7d6..411117ab751 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h @@ -78,7 +78,7 @@ public: vimap_(get(Vertex_local_index(), mesh_)), scale_volume_after_smoothing(true), traits_(traits), - weight_calculator_(mesh, vpmap) + weight_calculator_(mesh_, vpmap_, traits_, false /*no clamping*/, false /*no bounding from below*/) { } template @@ -177,7 +177,8 @@ public: if(is_source_constrained && is_target_constrained) continue; - const FT Lij = weight_calculator_(hi); + // Cotangent_weight returns (cot(beta) + cot(gamma)) / 2 + const FT Lij = FT(2) * weight_calculator_(hi); const std::size_t i_source = get(vimap_, v_source); const std::size_t i_target = get(vimap_, v_target); @@ -185,14 +186,14 @@ public: // note that these constraints create asymmetry in the matrix if(!is_source_constrained) { - stiffness_elements.push_back(Triplet(i_source, i_target, Lij)); - diag_coeff.insert(std::make_pair(i_source, 0)).first->second -= Lij; + stiffness_elements.emplace_back(i_source, i_target, Lij); + diag_coeff.emplace(i_source, 0).first->second -= Lij; } if(!is_target_constrained) { - stiffness_elements.push_back(Triplet(i_target, i_source, Lij)); - diag_coeff.insert(std::make_pair(i_target, 0)).first->second -= Lij; + stiffness_elements.emplace_back(i_target, i_source, Lij); + diag_coeff.emplace(i_target, 0).first->second -= Lij; } } } @@ -200,7 +201,7 @@ public: typename std::unordered_map::iterator it = diag_coeff.begin(), end = diag_coeff.end(); for(; it!=end; ++it) - stiffness_elements.push_back(Triplet(it->first, it->first, it->second)); + stiffness_elements.emplace_back(it->first, it->first, it->second); } void update_mesh_no_scaling(const Eigen_vector& Xx, const Eigen_vector& Xy, const Eigen_vector& Xz) @@ -368,8 +369,8 @@ private: std::vector diagonal_; // index of vector -> index of vimap_ std::vector constrained_flags_; - const GeomTraits& traits_; - const CGAL::Weights::Edge_cotangent_weight weight_calculator_; + GeomTraits traits_; + const CGAL::Weights::Cotangent_weight weight_calculator_; }; } // internal diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h index a2087327e98..20e95e59610 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SNAPPING_HELPER_H #define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SNAPPING_HELPER_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h index 60422c492f0..1388ebaeb22 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_H #define CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_H -#include +#include #ifdef CGAL_PMP_SNAP_DEBUG_PP #ifndef CGAL_PMP_SNAP_DEBUG @@ -1009,7 +1009,7 @@ std::size_t snap_non_conformal_one_way(const HalfedgeRange& halfedge_range_S, } } -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // Attempts to snap the vertices in `halfedge_range_A` onto edges of `halfedge_range_B`, and reciprocally. // A vertex from the first range is only snapped to an edge of the second range if the distance to diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h index a31a91b2c96..10043e346a8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_VERTICES_H #define CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_VERTICES_H -#include +#include #ifdef CGAL_PMP_SNAP_DEBUG_PP #ifndef CGAL_PMP_SNAP_DEBUG @@ -1140,7 +1140,7 @@ std::size_t snap_vertices_two_way(const HalfedgeRange_A& halfedge_range_A, namespace experimental { -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // Attempts to snap the vertices in `halfedge_range_A` and `halfedge_range_B`. // A vertex from the first range and a vertex from the second range are only snapped diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h index af22ed1df25..2e3b8a63d7a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_REPAIR_EXTRA_H #define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_REPAIR_EXTRA_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h index 016dedea22d..74fc83d0ec8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SIMPLIFY_POLYLINE_H #define CGAL_POLYGON_MESH_PROCESSING_SIMPLIFY_POLYLINE_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h index 6cf92c50cc7..de45ca3150e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_MANIFOLDNESS_H #define CGAL_POLYGON_MESH_PROCESSING_MANIFOLDNESS_H -#include +#include #include #include @@ -33,7 +33,7 @@ namespace CGAL { namespace Polygon_mesh_processing { -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief returns whether a vertex of a polygon mesh is non-manifold. /// @@ -284,7 +284,7 @@ std::size_t make_umbrella_manifold(typename boost::graph_traits::ha } // end namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief collects the non-manifold vertices (if any) present in the mesh. /// @@ -394,7 +394,7 @@ OutputIterator non_manifold_vertices(const PolygonMesh& pm, return out; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// duplicates all the non-manifold vertices of the input mesh. /// diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h index 2bcd6f06ad0..27bda80bc9c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_MERGE_BORDER_VERTICES_H #define CGAL_POLYGON_MESH_PROCESSING_MERGE_BORDER_VERTICES_H -#include +#include #include #include @@ -204,7 +204,7 @@ void detect_identical_mergeable_vertices( } } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // merges target vertices of a list of halfedges. // Halfedges must be sorted in the list. @@ -259,7 +259,7 @@ void merge_vertices_in_range(const HalfedgeRange& sorted_hedges, } // end of internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// merges identical vertices around a cycle of boundary edges. /// @@ -319,7 +319,7 @@ void merge_duplicated_vertices_in_boundary_cycle(typename boost::graph_traits +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h index 10ab1ec8854..2ea05b9a740 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h @@ -1646,6 +1646,12 @@ void merge_reversible_connected_components(PolygonMesh& pm, * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` * should be available for the vertices of `pm`.} * \cgalParamNEnd + * \cgalParamNBegin{face_partition_id_map} + * \cgalParamDescription{a property map filled by this function and that will contain for each face + * the id of its surface component after reversal and stitching in the range `[0, n - 1]`, + * with `n` the number of such components.} + * \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits::%face_descriptor` as key type and `std::size_t` as value type} + * \cgalParamNEnd * \cgalNamedParamsEnd * * \sa reverse_face_orientations() @@ -1667,6 +1673,15 @@ bool compatible_orientations(const PolygonMesh& pm, Vpm vpm = parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, pm)); + typedef typename internal_np::Lookup_named_param_def < + internal_np::face_partition_id_t, + NamedParameters, + Constant_property_map // default + >::type Partition_map; + + // cc id map if compatible edges were stitched + Partition_map partition_map = parameters::choose_parameter(parameters::get_parameter(np, internal_np::face_partition_id)); + typedef std::size_t F_cc_id; // Face cc-id typedef std::size_t E_id; // Edge id @@ -1753,6 +1768,8 @@ bool compatible_orientations(const PolygonMesh& pm, sorted_ids.insert(cc_id); // consider largest CC first, default and set its bit to 0 + std::size_t partition_id = 0; + std::vector partition_ids(nb_cc); for(F_cc_id cc_id : sorted_ids) { if (cc_handled[cc_id]) continue; @@ -1821,6 +1838,8 @@ bool compatible_orientations(const PolygonMesh& pm, continue; } cc_handled[id]=true; + CGAL_assertion(cc_bits[id]==false); + partition_ids[id] = partition_id; } // set bit of incompatible patches @@ -1839,13 +1858,19 @@ bool compatible_orientations(const PolygonMesh& pm, continue; } cc_handled[id]=true; + partition_ids[id] = partition_id; cc_bits[id]=true; } + ++partition_id; } // set the bit per face for (face_descriptor f : faces(pm)) - put(fbm, f, cc_bits[get(f_cc_ids,f)]); + { + std::size_t f_cc_id = get(f_cc_ids,f); + put(fbm, f, cc_bits[f_cc_id]); + put(partition_map, f, partition_ids[f_cc_id]); + } return true; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h index 5766b85593f..a0e4f6c178d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_POLYGON_MESH_TO_POLYGON_SOUP_H #define CGAL_POLYGON_MESH_PROCESSING_POLYGON_MESH_TO_POLYGON_SOUP_H -#include +#include #include #include @@ -55,7 +55,7 @@ struct PM_to_PS_point_converter > } // namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// adds the vertices and faces of a mesh into a (possibly non-empty) polygon soup. /// diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h index bc8bfed4033..7f4878648ae 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH_H #define CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH_H -#include +#include #include @@ -153,7 +153,7 @@ private: } // namespace internal /** -* \ingroup PMP_repairing_grp +* \ingroup PMP_combinatorial_repair_grp * * \brief returns `true` if the soup of polygons defines a valid polygon * mesh that can be handled by @@ -231,7 +231,7 @@ bool is_polygon_soup_a_polygon_mesh(const PolygonRange& polygons) } /** -* \ingroup PMP_repairing_grp +* \ingroup PMP_combinatorial_repair_grp * * builds a polygon mesh from a soup of polygons. * diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h index 9e9827f08fe..73828b33115 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_H #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_H -#include +#include #include #include @@ -29,7 +29,7 @@ namespace CGAL { namespace Polygon_mesh_processing { -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_geometric_repair_grp /// /// \brief removes the isolated vertices from any polygon mesh. /// @@ -60,7 +60,7 @@ std::size_t remove_isolated_vertices(PolygonMesh& pmesh) return nb_removed; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_geometric_repair_grp /// /// \brief removes connected components whose area or volume is under a certain threshold value. /// 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 90fd92adca4..22be1f47e8e 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 @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_DEGENERACIES_H #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_DEGENERACIES_H -#include +#include #include #include @@ -535,7 +535,7 @@ struct Filter_wrapper_for_cap_needle_removalneedle
    @@ -1034,7 +1034,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, return false; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_geometric_repair_grp /// removes all almost degenerate faces from a triangulated surface mesh. /// Equivalent to `remove_almost_degenerate_faces(faces(tmesh), tmesh, np)` template @@ -1326,7 +1326,7 @@ remove_a_border_edge(typename boost::graph_traits::edge_descriptor return remove_a_border_edge(ed, tm, input_range, edge_set, face_set); } -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // removes the degenerate edges from a triangulated surface mesh. // An edge is considered degenerate if its two extremities share the same location. @@ -1880,7 +1880,7 @@ bool remove_degenerate_edges(TriangleMesh& tmesh, return remove_degenerate_edges(edges(tmesh), tmesh, face_set, np); } -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // removes the degenerate faces from a triangulated surface mesh. // A face is considered degenerate if two of its vertices share the same location, diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h index 23a6ac92904..cb24ce8ae7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h @@ -12,7 +12,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_POLYGON_SOUP #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_POLYGON_SOUP -#include +#include #include #include @@ -140,7 +140,7 @@ bool simplify_polygon(PointRange& points, return (removed_points_n != 0); } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // For each polygon of the soup, removes consecutive identical (in a geometric sense) points. // @@ -194,7 +194,7 @@ std::size_t simplify_polygons_in_polygon_soup(PointRange& points, return simplified_polygons_n; } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // splits "pinched" polygons, that is polygons for which a point appears more than once, // into multiple non-pinched polygons. @@ -291,7 +291,7 @@ std::size_t split_pinched_polygons_in_polygon_soup(PointRange& points, return new_polygons_n; } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // removes polygons with fewer than 2 points from the soup. // @@ -334,7 +334,7 @@ std::size_t remove_invalid_polygons_in_polygon_soup(PointRange& /*points*/, return removed_polygons_n; } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // Removes invalid array-based polygons, i.e. polygons which have two equal consecutive points. // @@ -397,7 +397,7 @@ std::size_t remove_invalid_polygons_in_array_polygon_soup(PointRange& points, } // end namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// removes the isolated points from a polygon soup. /// A point is considered isolated if it does not appear in any polygon of the soup. @@ -500,7 +500,7 @@ std::size_t remove_isolated_points_in_polygon_soup(PointRange& points, return removed_points_n; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief merges the duplicate points in a polygon soup. /// @@ -817,7 +817,7 @@ struct Duplicate_collector void dump(CGAL::Emptyset_iterator) { } }; -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // collects duplicate polygons in a polygon soup, that is polygons that share the same vertices in the same // order. @@ -897,7 +897,7 @@ DuplicateOutputIterator collect_duplicate_polygons(const PointRange& points, } // end namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// merges the duplicate polygons in a polygon soup. Two polygons are duplicate if they share the same /// vertices in the same order. Note that the first vertex of the polygon does not matter, that is @@ -1104,7 +1104,7 @@ struct Polygon_soup_fixer > } // namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief cleans a given polygon soup through various repairing operations. /// 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 e7cd58b3145..0406329d233 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 @@ -13,17 +13,17 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_SELF_INTERSECTIONS_H #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_SELF_INTERSECTIONS_H -#include +#include #include #include #include #include #include -#include #include #include #include +#include #ifndef CGAL_PMP_REMOVE_SELF_INTERSECTION_NO_POLYHEDRAL_ENVELOPE_CHECK #include #endif diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h index 6179f281445..7f223ba578f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SHAPE_PREDICATES_H #define CGAL_POLYGON_MESH_PROCESSING_SHAPE_PREDICATES_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 8f868eec20d..e30f95fd289 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_STITCH_BORDERS_H #define CGAL_POLYGON_MESH_PROCESSING_STITCH_BORDERS_H -#include +#include #include #include @@ -1119,7 +1119,7 @@ std::size_t stitch_boundary_cycle(const typename boost::graph_traits #include #include -#include #include #include #include #include -#include #include #include diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 72ef02c7c4c..f74562e6e58 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -65,7 +65,9 @@ #include #include #include +#include #endif + #include // Covariant return types don't work for scalar types and we cannot @@ -978,7 +980,8 @@ private Q_SLOTS: QString Io_image_plugin::nameFilters() const { return QString("Inrimage files (*.inr *.inr.gz) ;; " "Analyze files (*.hdr *.img *img.gz) ;; " - "Stanford Exploration Project files (*.H *.HH)"); + "Stanford Exploration Project files (*.H *.HH) ;; " + "NRRD image files (*.nrrd)"); } @@ -1011,7 +1014,33 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) ok = true; QApplication::restoreOverrideCursor(); Image* image = new Image; - if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && + + //read a nrrd file + if (fileinfo.suffix() == "nrrd") + { +#ifdef CGAL_USE_VTK + vtkNew reader; + reader->SetFileName(fileinfo.filePath().toUtf8()); + reader->Update(); + auto vtk_image = reader->GetOutput(); + vtk_image->Print(std::cerr); + *image = CGAL::IO::read_vtk_image_data(vtk_image); // copy the image data +#else + CGAL::Three::Three::warning("You need VTK to read a NRRD file"); + delete image; + return QList(); +#endif + } + + //read a sep file + else if (fileinfo.suffix() == "H" || fileinfo.suffix() == "HH") + { + CGAL::SEP_to_ImageIO reader(fileinfo.filePath().toUtf8().data()); + *image = *reader.cgal_image(); + is_gray = true; + } + + else if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && !image->read(fileinfo.filePath().toUtf8())) { QMessageBox qmb(QMessageBox::NoIcon, @@ -1100,13 +1129,7 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) return QList(); } } - //read a sep file - else if(fileinfo.suffix() == "H" || fileinfo.suffix() == "HH") - { - CGAL::SEP_to_ImageIO reader(fileinfo.filePath().toUtf8().data()); - *image = *reader.cgal_image(); - is_gray = true; - } + // Get display precision QDialog dialog; ui.setupUi(&dialog); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 6aa0571c8b9..e1b3770c225 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -374,27 +374,6 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const auto& image_item = image_mesh_items->image_item; item = image_item; features_protection_available = true; - - bool fit_wrdtp = true; - std::size_t img_wdim = image_item->image()->image()->wdim; - WORD_KIND img_wordKind = image_item->image()->image()->wordKind; - // check if the word type fits the hardcoded values in the plugin - if (image_item->isGray()) { - if (img_wordKind != WK_FLOAT) - fit_wrdtp = false; - else if (img_wdim != 4) - fit_wrdtp = false; - } else { - if (img_wordKind != WK_FIXED) - fit_wrdtp = false; - else if (img_wdim != 1) - fit_wrdtp = false; - } - if (!fit_wrdtp) { - return tr( - "Selected object can't be meshed because the image's word type is " - "not supported by this plugin."); - } } # endif @@ -543,6 +522,9 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, .arg(bbox.ymax() - bbox.ymin(),0,'g',3) .arg(bbox.zmax() - bbox.zmin(),0,'g',3) ); + const bool input_is_labeled_img = (image_item != nullptr && !image_item->isGray()); + const bool input_is_gray_img = (image_item != nullptr && image_item->isGray()); + set_defaults(); double diag = CGAL::sqrt((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin())); ui.facetSizing->setRange(diag * 10e-6, // min @@ -561,11 +543,13 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.protect->setEnabled(features_protection_available); ui.protect->setChecked(features_protection_available); ui.protectEdges->setEnabled(features_protection_available); + if(input_is_gray_img) + ui.sharpFeaturesGroup->setEnabled(false); ui.facegraphCheckBox->setVisible(mesh_type == Mesh_type::SURFACE_ONLY); - ui.initializationGroup->setVisible(image_item != nullptr && - !image_item->isGray()); - ui.grayImgGroup->setVisible(image_item != nullptr && image_item->isGray()); + ui.initializationGroup->setVisible(input_is_labeled_img); + ui.grayImgGroup->setVisible(input_is_gray_img); + if (items->which() == POLYHEDRAL_MESH_ITEMS) ui.volumeGroup->setVisible(mesh_type == Mesh_type::VOLUME && nullptr != bounding_sm_item); @@ -609,7 +593,6 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, connect(ui.useWeights_checkbox, SIGNAL(toggled(bool)), ui.weightsSigma_label, SLOT(setEnabled(bool))); ui.weightsSigma->setValue(1.); - bool input_is_labeled_img = (image_item != nullptr && !image_item->isGray()); ui.labeledImgGroup->setVisible(input_is_labeled_img); #ifndef CGAL_USE_ITK diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui index 91f3b989f8a..9b8b669d72b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui @@ -62,7 +62,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui index 5592bbbde5a..f2839e20f06 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui @@ -1046,7 +1046,7 @@ QGroupBox::title { - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -1094,7 +1094,7 @@ p, li { white-space: pre-wrap; } - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp index 94300e439fa..82c807ea335 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp @@ -725,14 +725,15 @@ bool Polyhedron_demo_hole_filling_plugin::fill use_delaunay_triangulation(use_DT))); } else { - auto pmap = get_property_map(CGAL::vertex_point, poly); + auto vpm = get_property_map(CGAL::vertex_point, poly); + auto weight_calc = CGAL::Weights::Secure_cotangent_weight_with_voronoi_area(poly, vpm, EPICK()); + success = std::get<0>(CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly, it, std::back_inserter(patch), CGAL::Emptyset_iterator(), - CGAL::parameters:: - weight_calculator(CGAL::Weights::Secure_cotangent_weight_with_voronoi_area(poly, pmap)). - density_control_factor(alpha). - fairing_continuity(continuity). - use_delaunay_triangulation(use_DT))); + CGAL::parameters::weight_calculator(weight_calc). + density_control_factor(alpha). + fairing_continuity(continuity). + use_delaunay_triangulation(use_DT))); } if(!success) { print_message("Error: fairing is not successful, only triangulation and refinement are applied!"); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp index f32c322c16d..f3be698c5ad 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp @@ -192,7 +192,7 @@ public Q_SLOTS: boost::optional bbox = boost::make_optional(false, CGAL::Three::Scene_interface::Bbox()); // Workaround a bug in g++-4.8.3: - // http://stackoverflow.com/a/21755207/1728537 + // https://stackoverflow.com/a/21755207/1728537 // Using boost::make_optional to copy-initialize 'bbox' hides the // warning about '*bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index 92568b3e193..4c2dcc1702a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -1067,7 +1067,7 @@ public Q_SLOTS: selection_item->set_is_insert(is_insert); selection_item->set_k_ring(k_ring); selection_item->setRenderingMode(Flat); - if(selection_item->name() == "unamed") { + if(selection_item->name() == "unnamed") { selection_item->setName(tr("%1 (selection)").arg(poly_item->name())); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui index 9cc5d979842..e527115cd2b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui @@ -187,7 +187,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index c8913412da2..31f46ffc2fb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -25,7 +25,7 @@ typedef Scene_facegraph_item::Face_graph FaceGraph; class Custom_stop_predicate { bool m_and; - CGAL::Surface_mesh_simplification::Count_stop_predicate m_count_stop; + CGAL::Surface_mesh_simplification::Edge_count_stop_predicate m_count_stop; CGAL::Surface_mesh_simplification::Edge_length_stop_predicate m_length_stop; public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp index 03259d7e6eb..d6be0d38c6a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp @@ -222,7 +222,7 @@ void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex) item->setRenderingMode(Flat); - if(item->name() == "unamed") + if(item->name() == "unnamed") { item->setName(tr("%1 (shortest path computation item)").arg(item->polyhedron_item()->name())); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt index f6b0e9c045b..db5531c9454 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt @@ -17,7 +17,7 @@ find_package( COMPONENTS OpenGL Script Svg OPTIONAL_COMPONENTS ScriptTools WebSockets) -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) if(Qt5_FOUND) include(${CGAL_USE_FILE}) endif() diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index 4a1ec1d8a6d..7b6e5225dfe 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -104,7 +104,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, // On Apple, the first time the application is launched, the menus are unclicable, and // the only way you can fix it is to unfocus and re-focus the application. // This is a hack that makes the application lose the focus after it is started, to force the user - // to re-focus it. (source : http://www.alecjacobson.com/weblog/?p=3910) + // to re-focus it. (source: https://www.alecjacobson.com/weblog/?p=3910) #ifdef __APPLE__ system("osascript -e 'tell application \"System Events\" " "to keystroke tab using {command down, shift down}'"); diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h index 5b803274716..8164cdacf8f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h @@ -288,7 +288,7 @@ public: void compute_bbox() const { // Workaround a bug in g++-4.8.3: - // http://stackoverflow.com/a/21755207/1728537 + // https://stackoverflow.com/a/21755207/1728537 // Using boost::make_optional to copy-initialize 'item_bbox' hides the // warning about '*item_bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.ui b/Polyhedron/demo/Polyhedron/Show_point_dialog.ui index bbe92b716a9..1816683d2fe 100644 --- a/Polyhedron/demo/Polyhedron/Show_point_dialog.ui +++ b/Polyhedron/demo/Polyhedron/Show_point_dialog.ui @@ -43,7 +43,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'DejaVu LGC Sans'; font-size:11pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/resources/about.html b/Polyhedron/demo/Polyhedron/resources/about.html index 3089144f7a1..b881e30bab7 100644 --- a/Polyhedron/demo/Polyhedron/resources/about.html +++ b/Polyhedron/demo/Polyhedron/resources/about.html @@ -1,9 +1,9 @@

    3D Polyhedral Surfaces

    -

    Copyright ©2008-2009 - GeometryFactory - and INRIA Sophia Antipolis - Mediterranee

    +

    Copyright ©2008-2009 + GeometryFactory + and INRIA Sophia Antipolis - Mediterranee

    This application illustrates the data structures of CGAL, and operations and algorithms that can be applied to.

    diff --git a/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html b/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html index 8d2c41d1ea0..d6b327c3558 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html +++ b/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html @@ -2,8 +2,8 @@

    AABB Tree Demo

    Copyright ©2009 - INRIA Sophia Antipolis - Mediterranee

    -

    This application illustrates the AABB tree component + INRIA Sophia Antipolis - Mediterranee

    +

    This application illustrates the AABB tree component of CGAL, applied to polyhedron facets and edges.

    See also the following chapters of the manual: diff --git a/Profiling_tools/include/CGAL/Memory_sizer.h b/Profiling_tools/include/CGAL/Memory_sizer.h index 4bf90350f2e..6d0551ef7f9 100644 --- a/Profiling_tools/include/CGAL/Memory_sizer.h +++ b/Profiling_tools/include/CGAL/Memory_sizer.h @@ -125,7 +125,7 @@ private: #else // __APPLE__ is defined - // http://miknight.blogspot.com/2005/11/resident-set-size-in-mac-os-x.html + // https://miknight.blogspot.com/2005/11/resident-set-size-in-mac-os-x.html // This is highly experimental. But still better than returning 0. // It appears that we might need certain 'rights' to get access to the kernel // task... It works if you have admin rights apparently diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps index be23f7d172f..966b92282a6 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: QBORE3D http://www.doc.ic.ac.uk/~im/ -* Generated-by: http://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP +* Description: QBORE3D https://www.doc.ic.ac.uk/~im/ +* Generated-by: https://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP * Derivatives: none NAME BORE3D ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps index bdf64319be2..cecd01701f7 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: QCAPRI http://www.doc.ic.ac.uk/~im/ -* Generated-by: http://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP +* Description: QCAPRI https://www.doc.ic.ac.uk/~im/ +* Generated-by: https://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP * Derivatives: none NAME CAPRI ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps index b38a5944b85..81306a3cfc8 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: QRECIPE http://www.doc.ic.ac.uk/~im/ -* Generated-by: http://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP +* Description: QRECIPE https://www.doc.ic.ac.uk/~im/ +* Generated-by: https://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP * Derivatives: none NAME RECIPE ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps index 65e0935866b..dee88708b9a 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: http://www.netlib.org/lp/data/ -* Generated-by: +* Description: https://www.netlib.org/lp/data/ +* Generated-by: * Derivatives: none NAME FIT1D ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps index aeacd42c629..c63185ec865 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: http://www.netlib.org/lp/data/ -* Generated-by: +* Description: https://www.netlib.org/lp/data/ +* Generated-by: * Derivatives: none NAME FIT2D ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps index 5766d6427fe..83cc8430687 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: http://www.netlib.org/lp/data/ -* Generated-by: +* Description: https://www.netlib.org/lp/data/ +* Generated-by: * Derivatives: none NAME SCSD1 ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps index 875d0b3c931..4f6af9720da 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps @@ -1,5 +1,5 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ -NAME HS118 +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ +NAME HS118 ROWS N OBJ.FUNC G R------1 diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps index f0846c3402f..24aca9bb682 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps @@ -1,6 +1,6 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ * Derivatives: none -NAME PRIMALC1 +NAME PRIMALC1 ROWS N OBJ.FUNC L R------1 diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps index fb89b43794b..3b8f8bc546c 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps @@ -1,4 +1,4 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ NAME QP example ROWS N obj diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps index 2d2e36a96e6..a42199f6137 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps @@ -1,5 +1,5 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ -NAME ZECEVIC2 +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ +NAME ZECEVIC2 ROWS N OBJ.FUNC L R------1 diff --git a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h index 0f97901c087..e8e8c777c91 100644 --- a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h +++ b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h @@ -1462,7 +1462,7 @@ public: private: // Sequential: non-atomic // "dummy" is here to allow the specialization (see below) - // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 + // See https://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 template struct Number_of_elements { diff --git a/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h b/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h index 98a1af5ceb6..dd409ee8f02 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h @@ -672,7 +672,7 @@ bool owns(const_iterator pos); /*! * returns whether `pos` is in the range `[cc.begin(), cc`.end())` (`cc.end()` excluded). */ -bool owns_dereferencable(const_iterator pos); +bool owns_dereferenceable(const_iterator pos); /// @} diff --git a/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h b/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h index 65e853f489a..306595daf1e 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h @@ -293,8 +293,8 @@ complexity. No exception is thrown. /// @{ /// returns whether `pos` is in the range `[ccc.begin(), ccc.end()]` (`ccc.end()` included). bool owns(const_iterator pos); - /// returns whether `pos` is in the range `[ccc.begin(), ccc`.end())` (`ccc.end()` excluded). - bool owns_dereferencable(const_iterator pos); + /// returns whether `pos` is in the range `[ccc.begin(), ccc.end())` (`ccc.end()` excluded). + bool owns_dereferenceable(const_iterator pos); /// @} diff --git a/STL_Extension/doc/STL_Extension/CGAL/algorithm.h b/STL_Extension/doc/STL_Extension/CGAL/algorithm.h index 13fa64df19b..2250a4a3e93 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/algorithm.h +++ b/STL_Extension/doc/STL_Extension/CGAL/algorithm.h @@ -42,7 +42,7 @@ Computes the minimal and the maximal element of a range. It is modeled after the \stl functions `std::min_element` and `std::max_element`. +href="https://en.cppreference.com/w/cpp/algorithm/max_element">`std::max_element`. The advantage of `min_max_element()` compared to calling both \stl functions is that one only iterates once over the sequence. This is more efficient especially for large and/or complex sequences. diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 9ff0bb95b9e..af1ab3c9d28 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -538,11 +538,17 @@ public: return false; } - bool owns_dereferencable(const_iterator cit) const + bool owns_dereferenceable(const_iterator cit) const { return cit != end() && owns(cit); } + + CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const + { + return owns_dereferenceable(cit); + } + /** Reserve method to ensure that the capacity of the Compact_container be * greater or equal than a given value n. */ diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 6bbdeee9176..395f8a483f4 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -542,11 +542,16 @@ public: return false; } - bool owns_dereferencable(const_iterator cit) const + bool owns_dereferenceable(const_iterator cit) const { return cit != end() && owns(cit); } + CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const + { + return owns_dereferenceable(cit); + } + /** Reserve method to ensure that the capacity of the Concurrent_compact_container be * greater or equal than a given value n. */ diff --git a/STL_Extension/include/CGAL/Handle.h b/STL_Extension/include/CGAL/Handle.h index 4fa3a17286b..55634481044 100644 --- a/STL_Extension/include/CGAL/Handle.h +++ b/STL_Extension/include/CGAL/Handle.h @@ -122,7 +122,7 @@ class Handle int refs() const noexcept { return PTR->count.load(std::memory_order_relaxed); } - Id_type id() const noexcept { return PTR - static_cast(0); } + Id_type id() const noexcept { return static_cast(reinterpret_cast(static_cast(PTR)) / sizeof(Rep)); } bool identical(const Handle& h) const noexcept { return PTR == h.PTR; } diff --git a/STL_Extension/include/CGAL/Handle_for.h b/STL_Extension/include/CGAL/Handle_for.h index 2a93662e69b..2f05c6be1ce 100644 --- a/STL_Extension/include/CGAL/Handle_for.h +++ b/STL_Extension/include/CGAL/Handle_for.h @@ -30,7 +30,7 @@ #if defined(BOOST_MSVC) # pragma warning(push) -# pragma warning(disable:4345) // Avoid warning http://msdn.microsoft.com/en-us/library/wewb47ee(VS.80).aspx +# pragma warning(disable:4345) // Avoid warning https://learn.microsoft.com/en-us/previous-versions/wewb47ee(v=vs.120) #endif namespace CGAL { diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index 06d9043ab33..243ed7b4be5 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -426,14 +426,6 @@ inline all_default() } #endif -template -Named_function_parameters -inline no_parameters(Named_function_parameters) -{ - typedef Named_function_parameters Params; - return Params(); -} - template struct Boost_parameter_compatibility_wrapper { diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp b/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp index c91dea7d62f..a02a831f044 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp +++ b/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp @@ -3,7 +3,7 @@ // Copyright 2004 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) +// https://www.boost.org/LICENSE_1_0.txt) // // Authors: Douglas Gregor // Andrew Lumsdaine diff --git a/STL_Extension/include/CGAL/array.h b/STL_Extension/include/CGAL/array.h index cfaca0a0550..ff234183f99 100644 --- a/STL_Extension/include/CGAL/array.h +++ b/STL_Extension/include/CGAL/array.h @@ -30,7 +30,7 @@ namespace CGAL { // https://lists.boost.org/Archives/boost/2006/08/109003.php // // C++0x has it under discussion here : -// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#851 +// https://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#851 // Hopefully C++0x will fix this properly with initializer_lists. // So, it's temporary, therefore I do not document it and keep it internal. diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index e395ab3c76f..ea9a964c8a3 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -1283,6 +1283,8 @@ template < typename D, typename V = std::tuple<>, typename O = std::tuple<> > struct Derivator { typedef Derivator Self; + Derivator() = default; + Derivator(const Self&) = default; Self& operator=(const Self&) = delete; template void tuple_dispatch(const Tuple&) @@ -1296,6 +1298,8 @@ struct Derivator, std::tuple > typedef Derivator, std::tuple > Self; typedef Derivator, std::tuple > Base; + Derivator() = default; + Derivator(const Self&) = default; Self& operator=(const Self&) = delete; using Base::operator=; diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index c1f9c8ab130..6aa1988e1cc 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -81,6 +81,27 @@ Assert_compile_time_tag( const Tag&, const Derived& b) x.match_compile_time_tag(b); } -} //namespace CGAL +// To distinguish between kernel predicates for which a division-less FT is sufficient +template +struct Needs_FT +{ + T value; + Needs_FT(T v) : value(v) {} + operator T() const { return value; } +}; + +template +struct Remove_needs_FT +{ + using Type = T; +}; + +template +struct Remove_needs_FT > +{ + using Type = T; +}; + +} // namespace CGAL #endif // CGAL_TAGS_H diff --git a/STL_Extension/test/STL_Extension/test_Compact_container.cpp b/STL_Extension/test/STL_Extension/test_Compact_container.cpp index 661ec453cbd..d2d96cdfc4b 100644 --- a/STL_Extension/test/STL_Extension/test_Compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Compact_container.cpp @@ -242,15 +242,15 @@ void test(const Cont &) assert(c11.size() == v1.size()); assert(c10 == c11); - // owns() and owns_dereferencable(). + // owns() and owns_dereferenceable(). for(typename Cont::const_iterator it = c9.begin(), end = c9.end(); it != end; ++it) { assert(c9.owns(it)); - assert(c9.owns_dereferencable(it)); + assert(c9.owns_dereferenceable(it)); assert(! c10.owns(it)); - assert(! c10.owns_dereferencable(it)); + assert(! c10.owns_dereferenceable(it)); } assert(c9.owns(c9.end())); - assert(! c9.owns_dereferencable(c9.end())); + assert(! c9.owns_dereferenceable(c9.end())); c9.erase(c9.begin(), c9.end()); diff --git a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp index 00f2e1da4ec..a42676f8f7f 100644 --- a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp @@ -322,15 +322,15 @@ void test(const Cont &) assert(c11.size() == v1.size()); assert(c10 == c11);*/ - // owns() and owns_dereferencable(). + // owns() and owns_dereferenceable(). for(typename Cont::const_iterator it = c9.begin(), end = c9.end(); it != end; ++it) { assert(c9.owns(it)); - assert(c9.owns_dereferencable(it)); + assert(c9.owns_dereferenceable(it)); assert(! c10.owns(it)); - assert(! c10.owns_dereferencable(it)); + assert(! c10.owns_dereferenceable(it)); } assert(c9.owns(c9.end())); - assert(! c9.owns_dereferencable(c9.end())); + assert(! c9.owns_dereferenceable(c9.end())); c9.erase(c9.begin(), c9.end()); diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index 3d4aa099e76..f0ddcbc36fd 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -117,6 +117,30 @@ if [ -n "${project_name_demo}" ]; then exit 1 fi +# check minimal version is the first instruction in cmake scripts +echo '.. Checking if all CMakeLists.txt starts with cmake_minimum_required...' +cmr_tests=$(for i in ^build*/test/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^\s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) +cmr_examples=$(for i in ^build*/examples/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) +cmr_demo=$(for i in ^build*/demo/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) + +if [ -n "${cmr_tests}" ]; then + echo "CMakeLists in test with issues:" + echo ${cmr_tests} + exit 1 +fi + +if [ -n "${cmr_examples}" ]; then + echo "CMakeLists in examples with issues:" + echo ${cmr_examples} + exit 1 +fi + +if [ -n "${cmr_demo}" ]; then + echo "CMakeLists in demo with issues:" + echo ${cmr_demo} + exit 1 +fi + #check header files without SPDX license identifier echo '.. Checking SPDX license identifier presence in header files...' file_without_SPDX_identifiers=$(for pkg in `find */package_info -name 'license.txt' | awk -F "/" '{print $1}'`; do if [ -e ${pkg}/include ]; then find ${pkg}/include -type f \( -name '*.h' -o -name '*.hpp' \) | xargs -r grep -L "SPDX-License-Identifier"; fi; done) diff --git a/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt b/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt index c59acf0e24a..782b87fd820 100644 --- a/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt +++ b/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1...3.23) project(Set_movable_separability_2_Tests) -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # Just to avoid a warning from CMake when that variable is set on the command line... endif() if(CGAL_DIR) diff --git a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt index adfb948e463..951cf0d3a9f 100644 --- a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -project(Shape_regularization_Examples) - cmake_minimum_required(VERSION 3.1...3.23) +project(Shape_regularization_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) # Find OSQP library and headers. diff --git a/Shape_regularization/test/Shape_regularization/CMakeLists.txt b/Shape_regularization/test/Shape_regularization/CMakeLists.txt index 5bb7cc98ef3..deb8fea32be 100644 --- a/Shape_regularization/test/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/test/Shape_regularization/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -project(Shape_regularization_Tests) - cmake_minimum_required(VERSION 3.1...3.23) +project(Shape_regularization_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) # Find OSQP library and headers. diff --git a/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h b/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h index 1a888a011ce..5f908c59c86 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h +++ b/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h @@ -189,7 +189,7 @@ class ConstructVertex_2 public: /*! returns the source or target of `seg`. If `i` modulo 2 is 0, - the source is returned, otherwise the target is returned.} + the source is returned, otherwise the target is returned. */ Point_2 operator()(Segment_2 seg, int i); }; @@ -223,7 +223,7 @@ class ConstructIsoRectangle_2 public: /*! - introduces an iso-oriented rectangle fo whose minimal `x` coordinate + introduces an iso-oriented rectangle whose minimal `x` coordinate is the one of `left`, the maximal `x` coordinate is the one of `right`, the minimal `y` coordinate is the one of `bottom`, the maximal `y` coordinate is the one of `top`.} diff --git a/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt b/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt index bffd43ef1dd..41d9f6872e4 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt +++ b/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt @@ -128,8 +128,7 @@ Polyline number 4: The package is supplied with a graphical demo program that opens a window, allows the user to edit segments dynamically, applies a selected snap-rounding procedures, and displays the result onto the same window -(see `/demo/Snap_rounding_2/demo.cpp`). +(see `/demo/Snap_rounding_2/Snap_rounding_2.cpp`). */ } /* namespace CGAL */ - diff --git a/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h b/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h index cf7b6c2def6..20140344b84 100644 --- a/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h +++ b/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include diff --git a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h index e0321f57395..2138c377e42 100644 --- a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h @@ -53,7 +53,7 @@ struct Restricted_FT { typedef float type; }; /// /// \cgalModels `DiagonalizeTraits` /// -/// \sa http://eigen.tuxfamily.org/index.php?title=Main_Page +/// \sa https://eigen.tuxfamily.org/index.php?title=Main_Page template class Eigen_diagonalize_traits { diff --git a/Solver_interface/include/CGAL/Eigen_matrix.h b/Solver_interface/include/CGAL/Eigen_matrix.h index 4a34a022d0d..4f28c3f7c6f 100644 --- a/Solver_interface/include/CGAL/Eigen_matrix.h +++ b/Solver_interface/include/CGAL/Eigen_matrix.h @@ -23,7 +23,7 @@ namespace CGAL { \ingroup PkgSolverInterfaceLS The class `Eigen_matrix` is a wrapper around `Eigen` matrix type -`Eigen::Matrix`. +`Eigen::Matrix`. \cgalModels `SvdTraits::Matrix` diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.h b/Solver_interface/include/CGAL/Eigen_solver_traits.h index 9fe3457e84d..93820b7b827 100644 --- a/Solver_interface/include/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/include/CGAL/Eigen_solver_traits.h @@ -75,7 +75,7 @@ The class `Eigen_solver_traits` provides an interface to the sparse solvers of \ \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org/index.php?title=Main_Page +\sa https://eigen.tuxfamily.org/index.php?title=Main_Page \cgalHeading{Instantiation Example} diff --git a/Solver_interface/include/CGAL/Eigen_sparse_matrix.h b/Solver_interface/include/CGAL/Eigen_sparse_matrix.h index ff83d2a65fd..20e8962bb15 100644 --- a/Solver_interface/include/CGAL/Eigen_sparse_matrix.h +++ b/Solver_interface/include/CGAL/Eigen_sparse_matrix.h @@ -21,7 +21,7 @@ namespace CGAL { \ingroup PkgSolverInterfaceLS The class `Eigen_sparse_matrix` is a wrapper around `Eigen` matrix type -`Eigen::SparseMatrix` +`Eigen::SparseMatrix` that represents general matrices, be they symmetric or not. \cgalModels `SparseLinearAlgebraTraits_d::Matrix` @@ -301,7 +301,7 @@ private: \ingroup PkgSolverInterfaceRefLS The class `Eigen_sparse_symmetric_matrix` is a wrapper around `Eigen` matrix type -`Eigen::SparseMatrix` +`Eigen::SparseMatrix` Since the matrix is symmetric, only the lower triangle part is stored. diff --git a/Solver_interface/include/CGAL/Eigen_vector.h b/Solver_interface/include/CGAL/Eigen_vector.h index d080777a2f8..b50ac037eff 100644 --- a/Solver_interface/include/CGAL/Eigen_vector.h +++ b/Solver_interface/include/CGAL/Eigen_vector.h @@ -20,7 +20,7 @@ namespace CGAL { \ingroup PkgSolverInterfaceLS The class `Eigen_vector` is a wrapper around `Eigen` -vector type, +vector type, which is a simple array of numbers. \cgalModels `SvdTraits::Vector` diff --git a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp index 766b41c77fc..a999a5235ec 100644 --- a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp +++ b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp @@ -393,7 +393,7 @@ namespace nanoflann /** @addtogroup param_grp Parameter structs * @{ */ - /** Parameters (see http://code.google.com/p/nanoflann/ for help choosing the parameters) + /** Parameters (see https://github.com/jlblancoc/nanoflann for help choosing the parameters) */ struct KDTreeSingleIndexAdaptorParams { @@ -580,10 +580,10 @@ namespace nanoflann * This code is an adapted version from Boost, modifed for its integration * within MRPT (JLBC, Dec/2009) (Renamed array -> CArray to avoid possible potential conflicts). * See - * http://www.josuttis.com/cppcode + * https://www.josuttis.com/cppcode/ * for details and the latest version. * See - * http://www.boost.org/libs/array for Documentation. + * https://www.boost.org/libs/array for Documentation. * for documentation. * * (C) Copyright Nicolai M. Josuttis 2001. @@ -851,7 +851,7 @@ namespace nanoflann * * Params: * inputData = dataset with the input features - * params = parameters passed to the kdtree algorithm (see http://code.google.com/p/nanoflann/ for help choosing the parameters) + * params = parameters passed to the kdtree algorithm (see https://github.com/jlblancoc/nanoflann for help choosing the parameters) */ KDTreeSingleIndexAdaptor(const int dimensionality, const DatasetAdaptor& inputData, const KDTreeSingleIndexAdaptorParams& params = KDTreeSingleIndexAdaptorParams() ) : dataset(inputData), index_params(params), root_node(NULL), distance(inputData) diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h b/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h index d82fd2ca8b7..e1575fb05f3 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h @@ -52,7 +52,8 @@ Constructor implementing \f$ l_2\f$ metric for \f$ d\f$-dimensional points. Weighted_Minkowski_distance(int d,Traits t=Traits()); /*! -Constructor implementing the \f$ l_{power}(weights)\f$ metric. \f$ power \leq0\f$ denotes the \f$ l_{\infty}(weights)\f$ metric. +Constructor implementing the \f$ l_{power}(weights)\f$ metric. `power=0` +denotes the \f$ l_{\infty}(weights)\f$ metric. The values in the iterator range `[wb,we)` are the weight. */ template diff --git a/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h b/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h index ed0dceb3efe..8e1d0387b18 100644 --- a/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h +++ b/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h @@ -10,7 +10,7 @@ // Author(s) : Fernando Cacciola // // Descriptions of the file format can be found at -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_DXF_STREAM_H #define CGAL_DXF_STREAM_H diff --git a/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h b/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h index 2c6e28c1fc7..11a41b3a204 100644 --- a/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h +++ b/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h @@ -10,7 +10,7 @@ // Author(s) : Fernando Cacciola // // Description of the file format can be found at the following address: -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_WRITER_H #define CGAL_IO_DXF_WRITER_H diff --git a/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt b/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt index 4834a83616b..5ca36ae8a8c 100644 --- a/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt +++ b/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt @@ -107,7 +107,7 @@ which offers combinatorial repairing while reading bad inputs. The `OBJ` file format, using the file extension `.obj`, is a simple \ascii data format that represents 3D geometry. Vertices are stored in a counter-clockwise order by default, making explicit declaration of face normals unnecessary. -A precise specification of the format is available here. +A precise specification of the format is available here. @@ -148,7 +148,7 @@ The `STL` file format, using the file extension `.stl`, is an \ascii or binary f to the stereolithography CAD software created by 3D Systems. STL files describe the surface geometry of a three-dimensional object. -A precise specification of those formats is available here. +A precise specification of those formats is available here.
    diff --git a/Surface_mesh/benchmark/polyhedron_performance.h b/Surface_mesh/benchmark/polyhedron_performance.h index 6229adb0007..b4de8bd6b6d 100644 --- a/Surface_mesh/benchmark/polyhedron_performance.h +++ b/Surface_mesh/benchmark/polyhedron_performance.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -461,7 +461,7 @@ private: ) vb->id() = index++; - SMS::Count_ratio_stop_predicate stop(0.1); + SMS::Edge_count_ratio_stop_predicate stop(0.1); int r = SMS::edge_collapse(P, stop); #endif } diff --git a/Surface_mesh/benchmark/surface_mesh_performance.h b/Surface_mesh/benchmark/surface_mesh_performance.h index 9ab57e28c9a..e310a6f4400 100644 --- a/Surface_mesh/benchmark/surface_mesh_performance.h +++ b/Surface_mesh/benchmark/surface_mesh_performance.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include typedef CGAL::Simple_cartesian K; @@ -284,7 +284,7 @@ private: mesh.clear(); bool b = CGAL::IO::read_OFF(_filename, mesh); - SMS::Count_ratio_stop_predicate stop(0.1); + SMS::Edge_count_ratio_stop_predicate stop(0.1); int r = SMS::edge_collapse(mesh, stop); } diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 97ba5aed47b..8e274941fc1 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -289,10 +289,22 @@ public: if(m_vcolors == 3) { - unsigned char r, g, b; - element.assign(r, "red"); - element.assign(g, "green"); - element.assign(b, "blue"); + unsigned char r=0, g=0, b=0; + float rf=0, gf=0, bf=0; + if(element.has_property("red",r)) + { + element.assign(r, "red"); + element.assign(g, "green"); + element.assign(b, "blue"); + }else if(element.has_property("red", rf)) + { + element.assign(rf, "red"); + element.assign(gf, "green"); + element.assign(bf, "blue"); + r = static_cast(std::floor(rf*255)); + g = static_cast(std::floor(gf*255)); + b = static_cast(std::floor(bf*255)); + } m_vcolor_map[vi] = CGAL::IO::Color(r, g, b); } } @@ -331,10 +343,22 @@ public: if(m_fcolors == 3) { - unsigned char r, g, b; - element.assign(r, "red"); - element.assign(g, "green"); - element.assign(b, "blue"); + unsigned char r=0, g=0, b=0; + float rf=0, gf=0, bf=0; + if(element.has_property("red",r)) + { + element.assign(r, "red"); + element.assign(g, "green"); + element.assign(b, "blue"); + } else if(element.has_property("red", rf)) + { + element.assign(rf, "red"); + element.assign(gf, "green"); + element.assign(bf, "blue"); + r = static_cast(std::floor(rf*255)); + g = static_cast(std::floor(gf*255)); + b = static_cast(std::floor(bf*255)); + } m_fcolor_map[fi] = CGAL::IO::Color(r, g, b); } } diff --git a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h index c267c49b808..a536e13ddae 100644 --- a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h +++ b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h @@ -55,49 +55,69 @@ enum Deformation_algorithm_tag /// @cond CGAL_DOCUMENT_INTERNAL namespace internal { -template +// property map that create a Simple_cartesian::Point_3 +// on the fly in order the deformation class to be used +// with points with minimal requirements +template +struct SC_on_the_fly_pmap + : public Vertex_point_map +{ + typedef boost::readable_property_map_tag category; + typedef CGAL::Simple_cartesian::Point_3 value_type; + typedef value_type reference; + typedef typename boost::property_traits::key_type key_type; + + SC_on_the_fly_pmap(Vertex_point_map base): + Vertex_point_map(base) {} + + friend value_type + get(const SC_on_the_fly_pmap map, key_type k) + { + typename boost::property_traits::reference base= + get(static_cast(map), k); + return value_type(base[0], base[1], base[2]); + } +}; + +template struct Types_selectors; -template -struct Types_selectors { - - // Get weight from the weight interface. +template +struct Types_selectors +{ typedef CGAL::Weights::Single_cotangent_weight Weight_calculator; - struct ARAP_visitor{ - template + struct ARAP_visitor + { void init(TriangleMesh, VertexPointMap){} - void rotation_matrix_pre( - typename boost::graph_traits::vertex_descriptor, - TriangleMesh&){} + void rotation_matrix_pre(typename boost::graph_traits::vertex_descriptor, + TriangleMesh&){} template - void update_covariance_matrix( - Square_matrix_3&, - const Square_matrix_3&){} + void update_covariance_matrix(Square_matrix_3&, + const Square_matrix_3&){} void set_sre_arap_alpha(double){} }; }; -template -struct Types_selectors { - - // Get weight from the weight interface. +template +struct Types_selectors +{ typedef CGAL::Weights::Cotangent_weight Weight_calculator; - typedef typename Types_selectors - ::ARAP_visitor ARAP_visitor; + typedef typename Types_selectors::ARAP_visitor ARAP_visitor; }; -template -struct Types_selectors { - - // Get weight from the weight interface. +template +struct Types_selectors +{ typedef CGAL::Weights::Cotangent_weight Weight_calculator; - class ARAP_visitor{ + class ARAP_visitor + { double m_nb_edges_incident; double m_area; double m_alpha; @@ -105,7 +125,6 @@ struct Types_selectors { public: ARAP_visitor(): m_alpha(0.02) {} - template void init(TriangleMesh triangle_mesh, const VertexPointMap& vpmap) { // calculate area @@ -144,31 +163,6 @@ struct Types_selectors { }; }; -// property map that create a Simple_cartesian::Point_3 -// on the fly in order the deformation class to be used -// with points with minimal requirements -template -struct SC_on_the_fly_pmap - : public Vertex_point_map -{ - typedef boost::readable_property_map_tag category; - typedef CGAL::Simple_cartesian::Point_3 value_type; - typedef value_type reference; - typedef typename boost::property_traits::key_type key_type; - - SC_on_the_fly_pmap(Vertex_point_map base): - Vertex_point_map(base) {} - - friend value_type - get(const SC_on_the_fly_pmap map, key_type k) - { - typename boost::property_traits::reference base= - get(static_cast(map), k); - return value_type(base[0], base[1], base[2]); - } -}; - - }//namespace internal /// @endcond @@ -235,17 +229,6 @@ public: typedef HIM Hedge_index_map; #endif -// weight calculator -#ifndef DOXYGEN_RUNNING - typedef typename Default::Get< - WC, - typename internal::Types_selectors::Weight_calculator - >::type Weight_calculator; -#else - /// weight calculator functor type - typedef WC Weight_calculator; -#endif - // sparse linear solver #ifndef DOXYGEN_RUNNING typedef typename Default::Get< @@ -290,6 +273,17 @@ public: typedef VPM Vertex_point_map; #endif +// weight calculator +#ifndef DOXYGEN_RUNNING + typedef typename Default::Get< + WC, + typename internal::Types_selectors::Weight_calculator + >::type Weight_calculator; +#else + /// weight calculator functor type + typedef WC Weight_calculator; +#endif + /// The type for vertex descriptor typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; /// The type for halfedge descriptor @@ -304,8 +298,6 @@ public: private: typedef Surface_mesh_deformation Self; // Repeat Triangle_mesh types - typedef typename boost::graph_traits::vertex_iterator vertex_iterator; - typedef typename boost::graph_traits::halfedge_iterator halfedge_iterator; typedef typename boost::graph_traits::in_edge_iterator in_edge_iterator; typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; @@ -340,12 +332,11 @@ private: bool last_preprocess_successful; ///< stores the result of last call to preprocess() + Vertex_point_map vertex_point_map; Weight_calculator weight_calculator; - Vertex_point_map vertex_point_map; - public: - typename internal::Types_selectors::ARAP_visitor arap_visitor; + typename internal::Types_selectors::ARAP_visitor arap_visitor; private: #ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE @@ -359,68 +350,13 @@ public: public: /// \cond SKIP_FROM_MANUAL - //vertex_point_map set by default - Surface_mesh_deformation(Triangle_mesh& triangle_mesh, - Vertex_index_map vertex_index_map, - Hedge_index_map hedge_index_map) - : m_triangle_mesh(triangle_mesh), - vertex_index_map(vertex_index_map), - hedge_index_map(hedge_index_map), - ros_id_map(std::vector(num_vertices(triangle_mesh), (std::numeric_limits::max)() )), - is_roi_map(std::vector(num_vertices(triangle_mesh), false)), - is_ctrl_map(std::vector(num_vertices(triangle_mesh), false)), - m_iterations(5), m_tolerance(1e-4), - need_preprocess_factorization(true), - need_preprocess_region_of_solution(true), - last_preprocess_successful(false), - weight_calculator(Weight_calculator()), - vertex_point_map(get(vertex_point, triangle_mesh)) - { - init(); - } - - //vertex_point_map and hedge_index_map set by default - Surface_mesh_deformation(Triangle_mesh& triangle_mesh, - Vertex_index_map vertex_index_map) - : m_triangle_mesh(triangle_mesh), - vertex_index_map(vertex_index_map), - hedge_index_map(CGAL::get_initialized_halfedge_index_map(triangle_mesh)), - ros_id_map(std::vector(num_vertices(triangle_mesh), (std::numeric_limits::max)() )), - is_roi_map(std::vector(num_vertices(triangle_mesh), false)), - is_ctrl_map(std::vector(num_vertices(triangle_mesh), false)), - m_iterations(5), m_tolerance(1e-4), - need_preprocess_factorization(true), - need_preprocess_region_of_solution(true), - last_preprocess_successful(false), - weight_calculator(Weight_calculator()), - vertex_point_map(get(vertex_point, triangle_mesh)) - { - init(); - } - //vertex_point_map, hedge_index_map and vertex_index_map set by default - Surface_mesh_deformation(Triangle_mesh& triangle_mesh) - : m_triangle_mesh(triangle_mesh), - vertex_index_map(CGAL::get_initialized_vertex_index_map(triangle_mesh)), - hedge_index_map(CGAL::get_initialized_halfedge_index_map(triangle_mesh)), - ros_id_map(std::vector(num_vertices(triangle_mesh), (std::numeric_limits::max)() )), - is_roi_map(std::vector(num_vertices(triangle_mesh), false)), - is_ctrl_map(std::vector(num_vertices(triangle_mesh), false)), - m_iterations(5), m_tolerance(1e-4), - need_preprocess_factorization(true), - need_preprocess_region_of_solution(true), - last_preprocess_successful(false), - weight_calculator(Weight_calculator()), - vertex_point_map(get(vertex_point, triangle_mesh)) - { - init(); - } // Constructor with all the parameters provided Surface_mesh_deformation(Triangle_mesh& triangle_mesh, Vertex_index_map vertex_index_map, Hedge_index_map hedge_index_map, Vertex_point_map vertex_point_map, - Weight_calculator weight_calculator = Weight_calculator()) + Weight_calculator weight_calculator) : m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map), @@ -431,13 +367,47 @@ public: need_preprocess_factorization(true), need_preprocess_region_of_solution(true), last_preprocess_successful(false), - weight_calculator(weight_calculator), - vertex_point_map(vertex_point_map) + vertex_point_map(vertex_point_map), + weight_calculator(weight_calculator) { init(); } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh, + Vertex_index_map vertex_index_map, + Hedge_index_map hedge_index_map, + Vertex_point_map vertex_point_map) + : Surface_mesh_deformation(triangle_mesh, + vertex_index_map, + hedge_index_map, + vertex_point_map, + Weight_calculator()) + { } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh, + Vertex_index_map vertex_index_map, + Hedge_index_map hedge_index_map) + : Surface_mesh_deformation(triangle_mesh, + vertex_index_map, + hedge_index_map, + get(vertex_point, triangle_mesh)) + { } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh, + Vertex_index_map vertex_index_map) + : Surface_mesh_deformation(triangle_mesh, + vertex_index_map, + CGAL::get_initialized_halfedge_index_map(triangle_mesh)) + { } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh) + : Surface_mesh_deformation(triangle_mesh, + CGAL::get_initialized_vertex_index_map(triangle_mesh)) + { } + /// \endcond - #if DOXYGEN_RUNNING + +#if DOXYGEN_RUNNING /// \name Construction /// @{ /** @@ -457,21 +427,18 @@ public: Vertex_index_map vertex_index_map = unspecified_internal_vertex_index_map, Hedge_index_map hedge_index_map = unspecified_internal_halfedge_index_map, Vertex_point_map vertex_point_map = get(boost::vertex_point, triangle_mesh), - Weight_calculator weight_calculator = Weight_calculator()); + Weight_calculator weight_calculator = Weight_calculator(triangle_mesh, vertex_point_map)); /// @} #endif private: - void init() { + void init() + { typedef internal::SC_on_the_fly_pmap Wrapper; - // compute halfedge weights - halfedge_iterator eb, ee; - hedge_weight.reserve(2*num_edges(m_triangle_mesh)); - for(std::tie(eb, ee) = halfedges(m_triangle_mesh); eb != ee; ++eb) - { - hedge_weight.push_back( - this->weight_calculator(*eb, m_triangle_mesh, Wrapper(vertex_point_map))); - } + hedge_weight.reserve(num_halfedges(m_triangle_mesh)); + for(halfedge_descriptor he : halfedges(m_triangle_mesh)) + hedge_weight.push_back(this->weight_calculator(he, m_triangle_mesh, Wrapper(vertex_point_map))); + arap_visitor.init(m_triangle_mesh, vertex_point_map); } diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h index 65bd6659902..21d42cf360d 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h @@ -458,6 +458,7 @@ private: const Faces_vector& faces, Cot_map ctmap) const { + // Since we loop faces, we are implicitely defining the weight of border halfedges as 0... for(face_descriptor fd : faces) { halfedge_descriptor hd = halfedge(fd, mesh), hdb = hd; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h index ec6df820e80..a6c7b410a57 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h @@ -187,7 +187,7 @@ protected: ++next_vertex_v_l; const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); - return CGAL::Weights::authalic_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); + return CGAL::Weights::authalic_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); } }; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h index 554ce4bf65b..7787476e654 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h @@ -183,7 +183,7 @@ protected: ++next_vertex_v_l; const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); - return CGAL::Weights::cotangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); + return CGAL::Weights::cotangent_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); } }; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h index 24cf892b964..a8f1941a189 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h @@ -454,7 +454,7 @@ private: double weight; }; - NT determinant(Point_2& v0, Point_2& v1) const + NT determinant(const Point_2& v0, const Point_2& v1) const { return (v0.x() * v1.y() - v1.x() * v0.y()); } @@ -465,8 +465,8 @@ private: const NT det0 = determinant(uv1, uv2); const NT det1 = determinant(uv2, uv0); const NT det2 = determinant(uv0, uv1); - const NT det3 = CGAL::determinant(Vector_2(uv1.x()-uv0.x(), uv1.y()-uv0.y()), - Vector_2(uv2.x()-uv0.x(), uv2.y()-uv0.y())); + NT det3 = CGAL::determinant(Vector_2(uv1.x()-uv0.x(), uv1.y()-uv0.y()), + Vector_2(uv2.x()-uv0.x(), uv2.y()-uv0.y())); CGAL_assertion(det3 > NT(0)); if(det3 <= NT(0)) det3 = NT(1); @@ -503,7 +503,7 @@ private: { Neighbor_list NL; NL.vertex = *v_j; - NL.vector = Vector_3(get(ppmap, v), tmesh.point(*v_j)); + NL.vector = Vector_3(get(ppmap, v), get(ppmap, *v_j)); NL.length = sqrt(NL.vector.squared_length()); neighbor_list.push_back(NL); ++neighborsCounter; @@ -617,9 +617,6 @@ private: const PPM_ref position_v_i = get(ppmap, main_vertex_v_i); const PPM_ref position_v_j = get(ppmap, *neighbor_vertex_v_j); - const Vector_3 edge = position_v_i - position_v_j; - const NT squared_length = edge * edge; - vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j; --previous_vertex_v_k; const PPM_ref position_v_k = get(ppmap, *previous_vertex_v_k); @@ -628,14 +625,10 @@ private: ++next_vertex_v_l; const PPM_ref position_v_l = get(ppmap, *next_vertex_v_l); - NT weight = NT(0); - CGAL_assertion(squared_length > NT(0)); // two points are identical! - if(squared_length != NT(0)) { - // This version was commented out to be an alternative weight - // in the original code by authors. - // weight = CGAL::Weights::authalic_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); - weight = CGAL::Weights::cotangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); - } + // This version was commented out to be an alternative weight in the original code by authors. +// NT weight = CGAL::Weights::authalic_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); + NT weight = CGAL::Weights::cotangent_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); + return weight; } @@ -699,7 +692,7 @@ private: VertexIndexMap& vimap) const { auto vpm = get_const_property_map(CGAL::vertex_point, tmesh); - const CGAL::Weights::Edge_tangent_weight compute_mvc(tmesh, vpm); + const CGAL::Weights::Edge_tangent_weight weight_calc(tmesh, vpm, Kernel()); const int i = get(vimap, v); @@ -709,7 +702,7 @@ private: for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) { - NT w_ij = NT(-1) * compute_mvc(h); + NT w_ij = NT(-1) * weight_calc(h); // w_ii = - sum of w_ijs w_ii -= w_ij; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h index 019fcb20262..bacdd2ea12c 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h @@ -206,7 +206,7 @@ protected: ++next_vertex_v_l; const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); - return CGAL::Weights::tangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); + return CGAL::Weights::tangent_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); } }; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h index 39070956d64..10639df65e6 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h @@ -782,9 +782,13 @@ private: const int i = get(vimap, vi); const int j = get(vimap, vj); - if (i > j) continue; - const CGAL::Weights::Cotangent_weight cotangent_weight; - const NT w_ij = NT(2) * cotangent_weight(hd, mesh, pmap); + if (i > j) + continue; + + const CGAL::Weights::Cotangent_weight cotangent_weight(mesh, pmap); + + // x2 because Cotangent_weight returns 0.5 * (cot alpha + cot beta)... + const NT w_ij = NT(2) * cotangent_weight(hd); // ij M.set_coef(2*i, 2*j, w_ij, true /* new coef */); diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h index 5f357c809ab..03c90101c33 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h @@ -53,7 +53,7 @@ This program is available under dual licence: 1) Under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Note that any program that incorporates the code under this licence must, under the terms of the GNU GPL, be released under a licence compatible with the GPL. GNU GPL does not permit incorporating this program into proprietary programs. If you wish to do this, please see the alternative licence available below. -GNU General Public License can be found at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +GNU General Public License can be found at https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 2) Proprietary Licence from UCL Business PLC. To enable programers to include the MaxFlow software in a proprietary system (which is not allowed by the GNU GPL), this licence gives you the right to incorporate the software in your program and distribute under any licence of your choosing. The full terms of the licence and applicable fee, are available from the Licensors at: http://www.uclb-elicensing.com/optimisation_software/maxflow_computervision.html diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp index 389cc215f11..aaf41537b8b 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp @@ -72,6 +72,12 @@ struct TestMeshProgramInstance numIterations = 1; } + ~TestMeshProgramInstance() + { + if (randomizer) + delete randomizer; + } + size_t numIterations; std::string meshName; bool debugMode; @@ -264,7 +270,7 @@ void run_program_instance(po::variables_map& vm) if (vm.count("randomseed")) { - programInstance.randomizer = new CGAL::Random(vm["randomSeed"].as()); + programInstance.randomizer = new CGAL::Random(vm["randomseed"].as()); } programInstance.debugMode = vm["debugmode"].as(); @@ -308,9 +314,9 @@ int main(int argc, char** argv) options.add_options() ("help,h", "Display help message") - ("polyhedron,p", po::value(), "Polyhedron input file") + ("polyhedron,p", po::value()->default_value("./data/test_mesh_6.off"), "Polyhedron input file") ("debugmode,d", po::value()->default_value(false), "Enable debug output") - ("randomseed,r", po::value(), "Randomization seed value") + ("randomseed,r", po::value()->default_value(0), "Randomization seed value") ("trials,t", po::value()->default_value(1), "Number of trials to run") ("kernel,k", po::value()->default_value("epick"), "Kernel to use. One of \'ipick\', \'epick\', \'epeck\'") ; diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index 8ffe08d081a..f4a5378489b 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -5,6 +5,8 @@ namespace Surface_mesh_simplification { /*! \ingroup PkgSurfaceMeshSimplificationRef +\deprecated This class is deprecated since \cgal 5.6, the class `Edge_count_ratio_stop_predicate` should be used instead. + The class `Count_ratio_stop_predicate` is a model for the `StopPredicate` concept which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. @@ -12,8 +14,8 @@ which returns `true` when the relation between the initial and current number of \cgalModels `StopPredicate` -\sa `CGAL::Surface_mesh_simplification::Count_stop_predicate` - +\sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` */ template< typename TriangleMesh> class Count_ratio_stop_predicate @@ -34,7 +36,7 @@ public: /// @{ /*! - Returns `((double)current_edge_count / (double)initial_edge_count) < ratio`. + Returns `(double(current_edge_count) / double(initial_edge_count)) < ratio`. All other parameters are ignored (but exist since this is a generic policy). */ bool operator()(const Edge_profile::FT current_cost, diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index 7e6deb0254a..bef9e2fdba9 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -4,6 +4,8 @@ namespace Surface_mesh_simplification { /*! \ingroup PkgSurfaceMeshSimplificationRef +\deprecated This class is deprecated since \cgal 5.6, the class `Edge_count_stop_predicate` should be used instead. + The class `Count_stop_predicate` is a model for the `StopPredicate` concept, which returns `true` when the number of current edges drops below a certain threshold. @@ -11,8 +13,8 @@ which returns `true` when the number of current edges drops below a certain thre \cgalModels `StopPredicate` -\sa `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` - +\sa `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` */ template class Count_stop_predicate diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..fed8537304f --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h @@ -0,0 +1,50 @@ + +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Edge_count_ratio_stop_predicate` is a model for the `StopPredicate` concept +which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` +*/ +template< typename TriangleMesh> +class Edge_count_ratio_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `ratio`. + */ + Edge_count_ratio_stop_predicate(const double ratio); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `(double(current_edge_count) / double(initial_edge_count)) < ratio`. + All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h new file mode 100644 index 00000000000..6e3920dd421 --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h @@ -0,0 +1,48 @@ +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Edge_count_stop_predicate` is a model for the `StopPredicate` concept, +which returns `true` when the number of current edges drops below a certain threshold. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Edge_ratio_count_stop_predicate` +*/ +template +class Edge_count_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `threshold` value. + */ + Edge_count_stop_predicate(const Edge_profile::edges_size_type threshold); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `(current_edge_count < threshold)`. All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT& current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..f5154aeb0d8 --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -0,0 +1,51 @@ + +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Face_count_ratio_stop_predicate` is a model for the `StopPredicate` concept +which returns `true` when the relation between the initial and current number of faces drops below a certain ratio. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +*/ +template< typename TriangleMesh> +class Face_count_ratio_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `ratio`. + */ + Face_count_ratio_stop_predicate(const double ratio, const TriangleMesh& tmesh); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `true` if the ratio of current face count over initial face count is strictly smaller than `ratio`, + and `false` otherwise. + All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h new file mode 100644 index 00000000000..8c35a5c35e7 --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h @@ -0,0 +1,49 @@ +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Face_count_stop_predicate` is a model for the `StopPredicate` concept, +which returns `true` when the number of current faces drops below a certain threshold. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` +*/ +template +class Face_count_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `threshold` value. + */ + Face_count_stop_predicate(const Edge_profile::edges_size_type threshold); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `true` if the current face count is strictly smaller than `threshold`, and `false` otherwise. + All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT& current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h index b24bc09c99e..ad5f22d4ccb 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h @@ -4,8 +4,10 @@ The concept `StopPredicate` describes the requirements for the predicate which indicates if the simplification process must finish. -\cgalHasModel `CGAL::Surface_mesh_simplification::Count_stop_predicate` -\cgalHasModel `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` \cgalHasModel `CGAL::Surface_mesh_simplification::Edge_length_stop_predicate` */ diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt index f29f913fc0a..1d97e670f9d 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt @@ -34,8 +34,12 @@ - `CGAL::Surface_mesh_simplification::edge_collapse()` \cgalCRPSection{Policies} -- `CGAL::Surface_mesh_simplification::Count_stop_predicate` -- `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` +- `CGAL::Surface_mesh_simplification::Count_stop_predicate` (deprecated) +- `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` (deprecated) +- `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +- `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +- `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +- `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` - `CGAL::Surface_mesh_simplification::Edge_length_stop_predicate` - `CGAL::Surface_mesh_simplification::Edge_length_cost` - `CGAL::Surface_mesh_simplification::Midpoint_placement` diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp index ae8c50b4c45..7612d7436e2 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp @@ -5,7 +5,7 @@ // Simplification function #include -#include +#include #include #include @@ -70,7 +70,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number (1000) const std::size_t stop_n = (argc > 2) ? std::stoi(argv[2]) : 1000; - SMS::Count_stop_predicate stop(stop_n); + SMS::Edge_count_stop_predicate stop(stop_n); // This the actual call to the simplification algorithm. // The surface mesh and stop conditions are mandatory arguments. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp index e8d0ba8ba1b..88eb9b986e7 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number const std::size_t stop_n = (argc > 2) ? std::stoi(argv[2]) : num_halfedges(surface_mesh)/2 - 1; - SMS::Count_stop_predicate stop(stop_n); + SMS::Edge_count_stop_predicate stop(stop_n); typedef SMS::LindstromTurk_placement Placement; diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp index 678087c38b2..f40a35faeae 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -121,7 +121,7 @@ int main(int argc, char** argv) std::cerr << "# sharp edges = " << nb_sharp_edges << std::endl; // Contract the surface mesh as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); std::cout << "Collapsing as many non-sharp edges of mesh: " << filename << " as possible..." << std::endl; int r = SMS::edge_collapse(surface_mesh, stop, diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp index 9c50a593725..1fcb9ce4e05 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp @@ -11,7 +11,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -78,7 +78,7 @@ int main(int argc, char** argv) } // Contract the surface mesh as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); Border_is_constrained_edge_map bem(surface_mesh); // This the actual call to the simplification algorithm. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp index b60753cddfc..4d3418e9abe 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp @@ -11,7 +11,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -77,7 +77,7 @@ int main(int argc, char** argv) } // Contract the surface mesh as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); Border_is_constrained_edge_map bem(surface_mesh); // This the actual call to the simplification algorithm. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp index d8b574b241f..a48e1833bb3 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // drops below xx% of the initial count const double ratio = (argc > 2) ? std::stod(argv[2]) : 0.1; - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); // The index maps are not explicitelty passed as in the previous // example because the surface mesh items have a proper id() field. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp index 6b8ee4e8902..7fc05ffc8b8 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ int main(int argc, char** argv) std::ifstream is(argc > 1 ? argv[1] : CGAL::data_file_path("meshes/helmet.off")); is >> mesh; - SMS::Count_stop_predicate stop(0); // go as far as you can while in the envelope + SMS::Edge_count_stop_predicate stop(0); // go as far as you can while in the envelope CGAL::Iso_cuboid_3 bbox(CGAL::Polygon_mesh_processing::bbox(mesh)); diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp index ef14f4f94ba..8a70a30d560 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp @@ -1,11 +1,13 @@ #include #include -#include +#include #include #include #include +#include + #include #include #include @@ -29,13 +31,13 @@ void collapse_gh(Surface_mesh& mesh, { std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now(); - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); // Garland&Heckbert simplification policies typedef typename GHPolicies::Get_cost GH_cost; typedef typename GHPolicies::Get_placement GH_placement; - typedef SMS::Bounded_normal_change_placement Bounded_GH_placement; + typedef SMS::Bounded_normal_change_placement Bounded_GH_placement; GHPolicies gh_policies(mesh); const GH_cost& gh_cost = gh_policies.get_cost(); diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp index 3528fb06646..4bedf34619a 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp @@ -4,7 +4,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -42,7 +42,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number (1000 by default) const std::size_t edge_count_treshold = (argc > 2) ? std::stoi(argv[2]) : 1000; - SMS::Count_stop_predicate stop(edge_count_treshold); + SMS::Edge_count_stop_predicate stop(edge_count_treshold); // This the actual call to the simplification algorithm. // The surface mesh and stop conditions are mandatory arguments. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp index a46b5ab76db..712afa46742 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp @@ -5,7 +5,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -36,7 +36,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number (1000) const std::size_t edge_count_treshold = (argc > 2) ? std::stoi(argv[2]) : 1000; - SMS::Count_stop_predicate stop(edge_count_treshold); + SMS::Edge_count_stop_predicate stop(edge_count_treshold); // This the actual call to the simplification algorithm. // The surface mesh and stop conditions are mandatory arguments. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp index d0bce9ca051..d21417d9829 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -36,7 +36,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // drops below 10% of the initial count double stop_ratio = (argc > 2) ? std::stod(argv[2]) : 0.1; - SMS::Count_ratio_stop_predicate stop(stop_ratio); + SMS::Edge_count_ratio_stop_predicate stop(stop_ratio); int r = SMS::edge_collapse(surface_mesh, stop); diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp index 2568e555755..f0b747108a6 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp @@ -8,7 +8,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -112,7 +112,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // drops below xx% of the initial count const double ratio = (argc > 2) ? std::stod(argv[2]) : 0.1; - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); Stats stats; My_visitor vis(&stats); diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index eaa2849e61b..36b784e4dbf 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -13,48 +13,24 @@ #include -#include -#include +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" +#include + +#include + +#ifndef CGAL_NO_DEPRECATED_CODE namespace CGAL { namespace Surface_mesh_simplification { -//******************************************************************************************************************* -// -= stopping condition predicate =- -// -// Determines whether the simplification has finished. -// The arguments are (current_cost,vertex,vertex,is_edge,initial_pair_count,current_pair_count,surface) and the result is bool -// -//******************************************************************************************************************* - -// Stops when the ratio of initial to current vertex pairs is below some value. +// Stops when the ratio of initial to current number of edges is below some value. template -class Count_ratio_stop_predicate -{ -public: - typedef TM_ TM; - typedef typename boost::graph_traits::edges_size_type size_type; - - Count_ratio_stop_predicate(const double ratio) - : m_ratio(ratio) - { - CGAL_warning(0. < ratio && ratio <= 1.); - } - - template - bool operator()(const F& /*current_cost*/, - const Profile& /*profile*/, - size_type initial_edge_count, - size_type current_edge_count) const - { - return (static_cast(current_edge_count) / static_cast(initial_edge_count)) < m_ratio; - } - -private: - double m_ratio; -}; +using Count_ratio_stop_predicate CGAL_DEPRECATED = Edge_count_ratio_stop_predicate; } // namespace Surface_mesh_simplification } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index ddc7e7a4843..66b0f5fb8c9 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -13,46 +13,24 @@ #include -#include -#include +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" +#include + +#include + +#ifndef CGAL_NO_DEPRECATED_CODE namespace CGAL { namespace Surface_mesh_simplification { -//******************************************************************************************************************* -// -= stopping condition predicate =- -// -// Determines whether the simplification has finished. -// The arguments are (current_cost,vertex,vertex,is_edge,initial_pair_count,current_pair_count,surface) and the result is bool -// -//******************************************************************************************************************* - // Stops when the number of edges left falls below a given number. template -class Count_stop_predicate -{ -public: - typedef TM_ TM; - typedef typename boost::graph_traits::edges_size_type size_type; - - Count_stop_predicate(const std::size_t edge_count_threshold) - : m_edge_count_threshold(edge_count_threshold) - { } - - template - bool operator()(const F& /*current_cost*/, - const Profile& /*profile*/, - std::size_t /*initial_edge_count*/, - std::size_t current_edge_count) const - { - return current_edge_count < m_edge_count_threshold; - } - -private: - std::size_t m_edge_count_threshold; -}; +using Count_stop_predicate CGAL_DEPRECATED = Edge_count_stop_predicate; } // namespace Surface_mesh_simplification } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..13123440d86 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h @@ -0,0 +1,52 @@ +// Copyright (c) 2006 GeometryFactory (France). 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) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_RATIO_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_RATIO_STOP_PREDICATE_H + +#include + +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the ratio of initial to current number of edges is below some value. +template +class Edge_count_ratio_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::edges_size_type size_type; + + Edge_count_ratio_stop_predicate(const double ratio) + : m_ratio(ratio) + { + CGAL_warning(0. < ratio && ratio <= 1.); + } + + template + bool operator()(const F& /*current_cost*/, + const Profile& /*profile*/, + size_type initial_edge_count, + size_type current_edge_count) const + { + return (static_cast(current_edge_count) / static_cast(initial_edge_count)) < m_ratio; + } + +private: + double m_ratio; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_RATIO_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h new file mode 100644 index 00000000000..aa3de2159a9 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h @@ -0,0 +1,50 @@ +// Copyright (c) 2006 GeometryFactory (France). 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) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_STOP_PREDICATE_H + +#include + +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the number of edges falls below a given number. +template +class Edge_count_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::edges_size_type size_type; + + Edge_count_stop_predicate(const std::size_t edge_count_threshold) + : m_edge_count_threshold(edge_count_threshold) + { } + + template + bool operator()(const F& /*current_cost*/, + const Profile& /*profile*/, + std::size_t /*initial_edge_count*/, + std::size_t current_edge_count) const + { + return current_edge_count < m_edge_count_threshold; + } + +private: + std::size_t m_edge_count_threshold; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..d349c948181 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -0,0 +1,56 @@ +// Copyright (c) 2006 GeometryFactory (France). 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) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_RATIO_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_RATIO_STOP_PREDICATE_H + +#include + +#include +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the ratio of initial to current number of faces is below some value. +template +class Face_count_ratio_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::edges_size_type size_type; + + Face_count_ratio_stop_predicate(const double ratio, + const TM& tmesh) + : m_ratio(ratio), m_initial_face_count(CGAL::internal::exact_num_faces(tmesh)) + { + CGAL_warning(0. < ratio && ratio <= 1.); + } + + template + bool operator()(const F& /*current_cost*/, + const Profile& profile, + size_type /*initial_edge_count*/, + size_type /*current_edge_count*/) const + { + const std::size_t current_face_count = CGAL::internal::exact_num_faces(profile.surface_mesh()); + return (static_cast(current_face_count) / static_cast(m_initial_face_count)) < m_ratio; + } + +private: + const double m_ratio; + const std::size_t m_initial_face_count; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_RATIO_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h new file mode 100644 index 00000000000..873cac7c320 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h @@ -0,0 +1,52 @@ +// Copyright (c) 2006 GeometryFactory (France). 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) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_STOP_PREDICATE_H + +#include + +#include +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the number of faces falls below a given number. +template +class Face_count_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::faces_size_type size_type; + + Face_count_stop_predicate(const std::size_t face_count_threshold) + : m_face_count_threshold(face_count_threshold) + { } + + template + bool operator()(const F& /*current_cost*/, + const Profile& profile, + std::size_t /*initial_edge_count*/, + std::size_t /*current_edge_count*/) const + { + const std::size_t current_face_count = CGAL::internal::exact_num_faces(profile.surface_mesh()); + return (current_face_count < m_face_count_threshold); + } + +private: + std::size_t m_face_count_threshold; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt index 86599afd28e..2f55474593a 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt @@ -11,6 +11,7 @@ create_single_source_cgal_program("test_edge_collapse_bounded_distance.cpp") create_single_source_cgal_program("test_edge_collapse_Envelope.cpp") create_single_source_cgal_program("test_edge_collapse_Polyhedron_3.cpp") create_single_source_cgal_program("test_edge_profile_link.cpp") +create_single_source_cgal_program("test_edge_deprecated_stop_predicates.cpp") find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h b/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h index 703a7f4c194..e1363e7fed6 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h @@ -32,7 +32,8 @@ void Surface_simplification_external_trace(std::string s) #include #include #include -#include +#include +#include #include #include diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp index 9b7bd975503..32505153d06 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -102,7 +102,7 @@ Surface_mesh edge_collapse(Surface_mesh& mesh, const Cost& cost = p.get_cost(); const Placement& unbounded_placement = p.get_placement(); Bounded_placement bounded_placement(unbounded_placement); - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); std::chrono::time_point start_time = std::chrono::steady_clock::now(); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp index 5e0ab17d1d6..479a7687dda 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp @@ -8,7 +8,7 @@ #include // Stop-condition policy -#include +#include typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Polyhedron_3 Surface; @@ -36,7 +36,7 @@ int main(int argc, char** argv) std::cout << "Initial count " << initial_count << " edges.\n"; // Contract the surface as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); int r = SMS::edge_collapse (surface diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp index d7228a1406a..cb52e089ede 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include @@ -96,7 +96,7 @@ int main(int argc, char** argv) std::ifstream is(argc > 1 ? argv[1] : "data/helmet.off"); is >> input_mesh; - SMS::Count_stop_predicate stop(0); // go as far as you can while in the envelope + SMS::Edge_count_stop_predicate stop(0); // go as far as you can while in the envelope Stats stats; My_visitor vis(&stats); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp index 7c641c5eb69..b81c477049c 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp @@ -378,7 +378,7 @@ bool Test (string aName) set_halfedgeds_items_id(lSurface); - SMS::Count_stop_predicate stop(sStop); + SMS::Edge_count_stop_predicate stop(sStop); Real_timer t; t.start(); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp index 0764b881fe1..f6cd535bf50 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp @@ -4,7 +4,7 @@ // Simplification function #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ int main(int argc, char** argv) std::ifstream is(argc > 1 ? argv[1] : "data/helmet.off"); is >> ref_mesh; - SMS::Count_stop_predicate stop(num_halfedges(ref_mesh)/10); + SMS::Edge_count_stop_predicate stop(num_halfedges(ref_mesh)/10); std::cout << "input has " << num_vertices(ref_mesh) << " vertices." << std::endl; CGAL::Iso_cuboid_3 bbox(CGAL::Polygon_mesh_processing::bbox(ref_mesh)); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp new file mode 100644 index 00000000000..238a796eb03 --- /dev/null +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp @@ -0,0 +1,170 @@ +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +// deprecated +#include +#include + +#include +#include + +#include + +typedef CGAL::Simple_cartesian K; +typedef CGAL::Surface_mesh Mesh; + +namespace SMS = CGAL::Surface_mesh_simplification; + +typedef SMS::Edge_count_stop_predicate Edge_count_stop; +typedef SMS::Face_count_stop_predicate Face_count_stop; +typedef SMS::Edge_count_ratio_stop_predicate Edge_count_ratio_stop; +typedef SMS::Face_count_ratio_stop_predicate Face_count_ratio_stop; + +typedef SMS::Count_stop_predicate Count_stop; +typedef SMS::Count_ratio_stop_predicate Count_ratio_stop; + +typedef SMS::Count_ratio_stop_predicate Count_ratio_stop; + +typedef SMS::Edge_length_cost Cost; +typedef SMS::Midpoint_placement Placement; + +int main(int argc, char** argv) +{ + const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cube-meshed.off"); + + Mesh mesh; + if(!CGAL::IO::read_polygon_mesh(filename, mesh)) + { + std::cerr << "Failed to read input mesh: " << filename << std::endl; + return EXIT_FAILURE; + } + + if(!CGAL::is_triangle_mesh(mesh)) + { + std::cerr << "Input geometry is not triangulated." << std::endl; + return EXIT_FAILURE; + } + + std::cout << "Input mesh has " << num_vertices(mesh) << " nv " + << num_edges(mesh) << " ne " + << num_faces(mesh) << " nf" << std::endl; + + Cost cost; + Placement placement; + + // Edge_count_stop + { + Mesh mesh_cpy = mesh; + const std::size_t expected_ne = num_edges(mesh_cpy) / 2; + Edge_count_stop stop(expected_ne); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) < expected_ne); + } + + // Count_stop + { + Mesh mesh_cpy = mesh; + const std::size_t expected_ne = num_edges(mesh_cpy) + 1; + Count_stop stop(expected_ne); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) < expected_ne); + } + + // Face_count_stop + { + Mesh mesh_cpy = mesh; + const std::size_t expected_nf = num_faces(mesh_cpy) / 4; + Face_count_stop stop(expected_nf); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_faces(mesh_cpy) < expected_nf); + } + + /// RATIO + + // Edge_count_ratio_stop + { + Mesh mesh_cpy = mesh; + const double ratio = 0.5; + const std::size_t initial_ne = num_edges(mesh_cpy); + Edge_count_ratio_stop stop(ratio); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) / initial_ne < ratio); + } + + // Count_ratio_stop + { + Mesh mesh_cpy = mesh; + const double ratio = 1.; + const std::size_t initial_ne = num_edges(mesh_cpy); + Count_ratio_stop stop(ratio); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) / initial_ne < ratio); + } + + // Face_count_ratio_stop + { + Mesh mesh_cpy = mesh; + const double ratio = 0.7; + const std::size_t initial_nf = num_faces(mesh_cpy); + Face_count_ratio_stop stop(ratio, mesh_cpy); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_faces(mesh_cpy) / initial_nf < ratio); + } + + return 0; +} + diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index 3c11f859619..cdf6e6f940b 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -235,7 +235,7 @@ public: typedef typename boost::graph_traits::edge_iterator edge_iterator; // Get weight from the weight interface. - typedef CGAL::Weights::Cotangent_weight Weight_calculator; + typedef CGAL::Weights::Cotangent_weight Weight_calculator; typedef internal::Curve_skeleton Vertex_pair; std::vector v2v; copy_face_graph(tmesh, m_tmesh, - CGAL::parameters::vertex_to_vertex_output_iterator( - std::back_inserter(v2v)).vertex_point_map(vpm)); + CGAL::parameters::vertex_to_vertex_output_iterator(std::back_inserter(v2v)) + .vertex_point_map(vpm)); // copy input vertices to keep correspondence for(const Vertex_pair& vp : v2v) @@ -919,11 +921,9 @@ private: void compute_edge_weight() { m_edge_weight.clear(); - m_edge_weight.reserve(2 * num_edges(m_tmesh)); + m_edge_weight.reserve(num_halfedges(m_tmesh)); for(halfedge_descriptor hd : halfedges(m_tmesh)) - { - m_edge_weight.push_back(m_weight_calculator(hd, m_tmesh, m_tmesh_point_pmap)); - } + m_edge_weight.push_back(m_weight_calculator(hd)); } /// Assemble the left hand side. diff --git a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt index aab8a082853..6f74259ab17 100644 --- a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt @@ -11,7 +11,7 @@ if(CGAL_ImageIO_FOUND) create_single_source_cgal_program("mesh_an_implicit_function.cpp") else() - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # Just to avoid a warning from CMake if that variable is set on the command line... endif() diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 8f2df91c48a..6333387f28b 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -2049,7 +2049,7 @@ bool Triangulation_data_structure_3:: is_vertex(Vertex_handle v) const { - return vertices().owns_dereferencable(v); + return vertices().owns_dereferenceable(v); } template @@ -2102,7 +2102,7 @@ is_edge(Cell_handle c, int i, int j) const if ( (dimension() == 2) && ((i>2) || (j>2)) ) return false; if ((i>3) || (j>3)) return false; - return cells().owns_dereferencable(c); + return cells().owns_dereferenceable(c); } template @@ -2149,7 +2149,7 @@ is_facet(Cell_handle c, int i) const if ( (dimension() == 2) && (i!=3) ) return false; - return cells().owns_dereferencable(c); + return cells().owns_dereferenceable(c); } template @@ -2161,7 +2161,7 @@ is_cell( Cell_handle c ) const if (dimension() < 3) return false; - return cells().owns_dereferencable(c); + return cells().owns_dereferenceable(c); } template diff --git a/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h b/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h index 3254fb6571f..ed489b44bcf 100644 --- a/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h +++ b/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h @@ -11,6 +11,8 @@ // Author(s) : Laurent Rineau // +#ifndef CGAL_TEST_T23_MOVE_SEMANTIC_C +#define CGAL_TEST_T23_MOVE_SEMANTIC_C #include @@ -67,3 +69,5 @@ namespace CGAL { } } } + +#endif // CGAL_TEST_T23_MOVE_SEMANTIC_C diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp index ec9f56138e0..097b7955fb5 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp @@ -10,19 +10,34 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Tetrahedral_remeshing::Remeshing_triangulation_3 Remeshing_triangulation; -struct Cells_of_subdomain +template +struct Cells_of_subdomain_pmap { private: + using Cell_handle = typename Tr::Cell_handle; + const int m_subdomain; public: - Cells_of_subdomain(const int& subdomain) + using key_type = Cell_handle; + using value_type = bool; + using reference = bool; + using category = boost::read_write_property_map_tag; + + Cells_of_subdomain_pmap(const int& subdomain) : m_subdomain(subdomain) {} - bool operator()(Remeshing_triangulation::Cell_handle c) const + friend value_type get(const Cells_of_subdomain_pmap& map, + const key_type& c) { - return m_subdomain == c->subdomain_index(); + return (map.m_subdomain == c->subdomain_index()); + } + friend void put(Cells_of_subdomain_pmap&, + const key_type&, + const value_type) + { + ; //nothing to do : subdomain indices are updated in remeshing } }; @@ -35,7 +50,8 @@ int main(int argc, char* argv[]) CGAL::Tetrahedral_remeshing::generate_input_two_subdomains(nbv, tr); CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length, - CGAL::parameters::cell_is_selected_map(Cells_of_subdomain(2))); + CGAL::parameters::cell_is_selected_map( + Cells_of_subdomain_pmap(2))); return EXIT_SUCCESS; } diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h index c107aec320a..77caca7318f 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h @@ -747,10 +747,11 @@ void merge_surface_patch_indices(const typename C3t3::Facet& f1, } } -template +template typename C3t3::Vertex_handle collapse(const typename C3t3::Cell_handle ch, const int to, const int from, + CellSelector& cell_selector, C3t3& c3t3) { typedef typename C3t3::Triangulation Tr; @@ -916,8 +917,7 @@ collapse(const typename C3t3::Cell_handle ch, for (Cell_handle cell_to_remove : cells_to_remove) { // remove cell - if (c3t3.is_in_complex(cell_to_remove)) - c3t3.remove_from_complex(cell_to_remove); + treat_before_delete(cell_to_remove, cell_selector, c3t3); c3t3.triangulation().tds().delete_cell(cell_to_remove); } @@ -930,9 +930,10 @@ collapse(const typename C3t3::Cell_handle ch, } -template +template typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, const Collapse_type& collapse_type, + CellSelector& cell_selector, C3t3& c3t3) { typedef typename C3t3::Vertex_handle Vertex_handle; @@ -956,7 +957,7 @@ typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, vh0->set_point(new_position); vh1->set_point(new_position); - vh = collapse(edge.first, edge.second, edge.third, c3t3); + vh = collapse(edge.first, edge.second, edge.third, cell_selector, c3t3); c3t3.set_dimension(vh, (std::min)(dim_vh0, dim_vh1)); } else //Collapse at vertex @@ -964,7 +965,7 @@ typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, if (collapse_type == TO_V1) { vh0->set_point(p1); - vh = collapse(edge.first, edge.third, edge.second, c3t3); + vh = collapse(edge.first, edge.third, edge.second, cell_selector, c3t3); c3t3.set_dimension(vh, (std::min)(dim_vh0, dim_vh1)); } else //Collapse at v0 @@ -972,7 +973,7 @@ typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, if (collapse_type == TO_V0) { vh1->set_point(p0); - vh = collapse(edge.first, edge.second, edge.third, c3t3); + vh = collapse(edge.first, edge.second, edge.third, cell_selector, c3t3); c3t3.set_dimension(vh, (std::min)(dim_vh0, dim_vh1)); } else @@ -1136,7 +1137,7 @@ typename C3t3::Vertex_handle collapse_edge(typename C3t3::Edge& edge, if (in_cx) nb_valid_collapse++; #endif - return collapse(edge, collapse_type, c3t3); + return collapse(edge, collapse_type, cell_selector, c3t3); } } #ifdef CGAL_DEBUG_TET_REMESHING_IN_PLUGIN diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h index a2c8191fa8f..190d6e6e320 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h @@ -55,11 +55,11 @@ void compute_statistics(const Triangulation& tr, double max_dihedral_angle = 0.; double min_dihedral_angle = 180.; - for (Facet fit : tr.finite_facets()) + for (Facet f : tr.finite_facets()) { - const Cell_handle cell = fit.first; - const int& index = fit.second; - if (!cell_selector(cell) || !cell_selector(cell->neighbor(index))) + const Cell_handle cell = f.first; + const int& index = f.second; + if (!get(cell_selector, cell) || !get(cell_selector, cell->neighbor(index))) continue; const Point& pa = point(cell->vertex((index + 1) & 3)->point()); @@ -92,7 +92,7 @@ void compute_statistics(const Triangulation& tr, ++cit) { const Subdomain_index& si = cit->subdomain_index(); - if (si == Subdomain_index() || !cell_selector(cit)) + if (si == Subdomain_index() || !get(cell_selector, cit)) continue; ++nb_tets; diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h index 91a629ac875..4fbe1180756 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h @@ -88,12 +88,13 @@ void update_c3t3_facets(C3t3& c3t3, } } -template +template Sliver_removal_result flip_3_to_2(typename C3t3::Edge& edge, C3t3& c3t3, const std::vector& vertices_around_edge, const Flip_Criterion& criterion, - IncCellsVectorMap& inc_cells) + IncCellsVectorMap& inc_cells, + Cell_selector& cell_selector) { typedef typename C3t3::Triangulation Tr; typedef typename C3t3::Facet Facet; @@ -324,7 +325,7 @@ Sliver_removal_result flip_3_to_2(typename C3t3::Edge& edge, // Update c3t3 update_c3t3_facets(c3t3, cells_to_update, outer_mirror_facets); - c3t3.remove_from_complex(cell_to_remove); + treat_before_delete(cell_to_remove, cell_selector, c3t3); tr.tds().delete_cell(cell_to_remove); /********************VALIDITY CHECK***************************/ @@ -704,11 +705,15 @@ void find_best_flip_to_improve_dh(C3t3& c3t3, } } -template +template Sliver_removal_result flip_n_to_m(C3t3& c3t3, typename C3t3::Edge& edge, typename C3t3::Vertex_handle vh, IncCellsVectorMap& inc_cells, + Cell_selector& cell_selector, Visitor& visitor, bool check_validity = false) { @@ -863,6 +868,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, //Subdomain index? typename C3t3::Subdomain_index subdomain = to_remove[0]->subdomain_index(); + bool selected = get(cell_selector, to_remove[0]); visitor.before_flip(to_remove[0]); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG @@ -883,7 +889,8 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, new_cell->set_vertex(fi.second, vh); - c3t3.add_to_complex(new_cell, subdomain); + treat_new_cell(new_cell, subdomain, cell_selector, selected, c3t3); + visitor.after_flip(new_cell); cells_to_update.push_back(new_cell); } @@ -952,7 +959,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, //Remove cells for (Cell_handle ch : to_remove) { - c3t3.remove_from_complex(ch); + treat_before_delete(ch, cell_selector, c3t3); tr.tds().delete_cell(ch); } @@ -1009,12 +1016,13 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, } -template +template Sliver_removal_result flip_n_to_m(typename C3t3::Edge& edge, C3t3& c3t3, const std::vector& boundary_vertices, const Flip_Criterion& criterion, IncCellsVectorMap& inc_cells, + CellSelector& cell_selector, Visitor& visitor) { typedef typename C3t3::Vertex_handle Vertex_handle; @@ -1063,7 +1071,8 @@ Sliver_removal_result flip_n_to_m(typename C3t3::Edge& edge, if (curr_max_cosdh <= curr_cost_vpair.first) return NO_BEST_CONFIGURATION; - result = flip_n_to_m(c3t3, edge, curr_cost_vpair.second.first, inc_cells, visitor); + result = flip_n_to_m(c3t3, edge, curr_cost_vpair.second.first, inc_cells, + cell_selector, visitor); if (result != NOT_FLIPPABLE) flip_performed = true; @@ -1073,11 +1082,12 @@ Sliver_removal_result flip_n_to_m(typename C3t3::Edge& edge, return result; } -template +template Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, C3t3& c3t3, const Flip_Criterion& criterion, IncCellsVectorMap& inc_cells, + Cell_selector& cell_selector, Visitor& visitor) { typedef typename C3t3::Triangulation Tr; @@ -1140,7 +1150,7 @@ Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, { std::vector vertices; vertices.insert(vertices.end(), vertices_around_edge.begin(), vertices_around_edge.end()); - res = flip_3_to_2(edge, c3t3, vertices, criterion, inc_cells); + res = flip_3_to_2(edge, c3t3, vertices, criterion, inc_cells, cell_selector); } } else @@ -1152,7 +1162,7 @@ Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, { std::vector vertices; vertices.insert(vertices.end(), boundary_vertices.begin(), boundary_vertices.end()); - res = flip_n_to_m(edge, c3t3, vertices, criterion, inc_cells, visitor); + res = flip_n_to_m(edge, c3t3, vertices, criterion, inc_cells, cell_selector, visitor); //return n_to_m_flip(edge, boundary_vertices, flip_criterion); } } @@ -1161,10 +1171,11 @@ Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, } -template +template std::size_t flip_all_edges(const std::vector& edges, C3t3& c3t3, const Flip_Criterion& criterion, + Cell_selector& cell_selector, Visitor& visitor) { typedef typename C3t3::Triangulation Tr; @@ -1195,7 +1206,8 @@ std::size_t flip_all_edges(const std::vector& edges, { Edge edge(ch, i0, i1); - Sliver_removal_result res = find_best_flip(edge, c3t3, criterion, inc_cells, visitor); + Sliver_removal_result res + = find_best_flip(edge, c3t3, criterion, inc_cells, cell_selector, visitor); if (res == INVALID_CELL || res == INVALID_VERTEX || res == INVALID_ORIENTATION) { std::cout << "FLIP PROBLEM!!!!" << std::endl; @@ -1222,7 +1234,7 @@ std::size_t flip_all_edges(const std::vector& edges, template void flip_edges(C3T3& c3t3, const bool protect_boundaries, - CellSelector cell_selector, + CellSelector& cell_selector, Visitor& visitor) { CGAL_USE(protect_boundaries); @@ -1238,8 +1250,6 @@ void flip_edges(C3T3& c3t3, //const Flip_Criterion criterion = VALENCE_MIN_DH_BASED; - //collect long edges - //compute vertices normals map? // typedef typename C3T3::Surface_patch_index Surface_patch_index; @@ -1273,7 +1283,7 @@ void flip_edges(C3T3& c3t3, #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_flips = #endif - flip_all_edges(inside_edges, c3t3, MIN_ANGLE_BASED, visitor); + flip_all_edges(inside_edges, c3t3, MIN_ANGLE_BASED, cell_selector, visitor); //} #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index 49ff1c2390e..24874936248 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -142,6 +142,20 @@ private: return n; } + template + std::string debug_to_string(const Patch_index i) + { + return std::to_string(i); + } + + template + std::string debug_to_string(const std::pair& pi) + { + std::string str = std::to_string(pi.first); + str.append("_").append(std::to_string(pi.second)); + return str; + } + template void compute_vertices_normals(const C3t3& c3t3, VertexNormalsMap& normals_map, @@ -283,7 +297,8 @@ private: for (auto& kv : ons_map) { std::ostringstream oss; - oss << "dump_normals_normalized_" << kv.first << ".polylines.txt"; + oss << "dump_normals_normalized_[" + << debug_to_string(kv.first) << "].polylines.txt"; std::ofstream ons(oss.str()); for (auto s : kv.second) ons << "2 " << s.source() << " " << s.target() << std::endl; @@ -452,7 +467,7 @@ public: inc_cells(nbv, boost::container::small_vector()); for (const Cell_handle c : tr.finite_cell_handles()) { - const bool cell_is_selected = cell_selector(c); + const bool cell_is_selected = get(cell_selector, c); for (int i = 0; i < 4; ++i) { diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h index 86e7aa27856..5106fb1835b 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h @@ -33,8 +33,9 @@ namespace Tetrahedral_remeshing { namespace internal { -template +template typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, + CellSelector cell_selector, C3t3& c3t3) { typedef typename C3t3::Triangulation Tr; @@ -69,8 +70,16 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, } CGAL_assertion(dimension > 0); - std::unordered_map> cells_info; - std::unordered_map, boost::hash> facets_info; + struct Cell_info { + Subdomain_index subdomain_index_; + bool selected_; + }; + struct Facet_info { + Vertex_handle opp_vertex_; + Surface_patch_index patch_index_; + }; + boost::unordered_map> cells_info; + boost::unordered_map> facets_info; // check orientation and collect incident cells to avoid circulating twice boost::container::small_vector inc_cells; @@ -114,23 +123,21 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, //keys are the opposite facets to the ones not containing e, //because they will not be modified const Subdomain_index subdomain = c3t3.subdomain_index(c); + const bool selected = get(cell_selector, c); const Facet opp_facet1 = tr.mirror_facet(Facet(c, index_v1)); const Facet opp_facet2 = tr.mirror_facet(Facet(c, index_v2)); // volume data - cells_info.insert(std::make_pair(opp_facet1, subdomain)); - cells_info.insert(std::make_pair(opp_facet2, subdomain)); - if (c3t3.is_in_complex(c)) - c3t3.remove_from_complex(c); + cells_info.insert(std::make_pair(opp_facet1, Cell_info{subdomain, selected})); + cells_info.insert(std::make_pair(opp_facet2, Cell_info{subdomain, selected})); + treat_before_delete(c, cell_selector, c3t3); // surface data for facets of the cells to be split const int findex = CGAL::Triangulation_utils_3::next_around_edge(index_v1, index_v2); Surface_patch_index patch = c3t3.surface_patch_index(c, findex); Vertex_handle opp_vertex = c->vertex(findex); - facets_info.insert(std::make_pair(opp_facet1, - std::make_pair(opp_vertex, patch))); - facets_info.insert(std::make_pair(opp_facet2, - std::make_pair(opp_vertex, patch))); + facets_info.insert(std::make_pair(opp_facet1, Facet_info{opp_vertex, patch})); + facets_info.insert(std::make_pair(opp_facet2, Facet_info{opp_vertex, patch})); if(c3t3.is_in_complex(c, findex)) c3t3.remove_from_complex(c, findex); @@ -151,28 +158,26 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, //get subdomain info back CGAL_assertion(cells_info.find(mfi) != cells_info.end()); - Subdomain_index n_index = cells_info.at(mfi); - if (Subdomain_index() != n_index) - c3t3.add_to_complex(new_cell, n_index); - else - new_cell->set_subdomain_index(Subdomain_index()); + Cell_info c_info = cells_info.at(mfi); + treat_new_cell(new_cell, c_info.subdomain_index_, + cell_selector, c_info.selected_, c3t3); // get surface info back CGAL_assertion(facets_info.find(mfi) != facets_info.end()); - const std::pair v_and_opp_patch = facets_info.at(mfi); + const Facet_info v_and_opp_patch = facets_info.at(mfi); // facet opposite to new_v (status wrt c3t3 is unchanged) new_cell->set_surface_patch_index(new_cell->index(new_v), mfi.first->surface_patch_index(mfi.second)); // new half-facet (added or not to c3t3 depending on the stored surface patch index) - if (Surface_patch_index() == v_and_opp_patch.second) - new_cell->set_surface_patch_index(new_cell->index(v_and_opp_patch.first), + if (Surface_patch_index() == v_and_opp_patch.patch_index_) + new_cell->set_surface_patch_index(new_cell->index(v_and_opp_patch.opp_vertex_), Surface_patch_index()); else c3t3.add_to_complex(new_cell, - new_cell->index(v_and_opp_patch.first), - v_and_opp_patch.second); + new_cell->index(v_and_opp_patch.opp_vertex_), + v_and_opp_patch.patch_index_); // newly created internal facet for (int i = 0; i < 4; ++i) @@ -299,7 +304,7 @@ void split_long_edges(C3T3& c3t3, continue; visitor.before_split(tr, edge); - Vertex_handle vh = split_edge(edge, c3t3); + Vertex_handle vh = split_edge(edge, cell_selector, c3t3); if(vh != Vertex_handle()) visitor.after_split(tr, vh); 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 b4f1093393d..0d68c959ccb 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 @@ -58,29 +58,20 @@ public: template struct All_cells_selected { - typedef typename Tr::Cell_handle argument_type; - typedef typename Tr::Cell::Subdomain_index Subdomain_index; + using key_type = typename Tr::Cell_handle; + using value_type = bool; + using reference = bool; + using category = boost::read_write_property_map_tag; - typedef bool result_type; - - result_type operator()(const argument_type c) const + friend value_type get(const All_cells_selected&, const key_type& c) { - return c->subdomain_index() != Subdomain_index(); + using SI = typename Tr::Cell::Subdomain_index; + return c->subdomain_index() != SI(); } + friend void put(All_cells_selected&, const key_type&, const value_type) + {} //nothing to do : subdomain indices are updated in remeshing}; }; -template -struct No_constraint_pmap -{ -public: - typedef Primitive key_type; - typedef bool value_type; - typedef value_type reference; - typedef boost::read_write_property_map_tag category; - - friend value_type get(No_constraint_pmap, key_type) { return false; } - friend void put(No_constraint_pmap, key_type, value_type) {} -}; templatesubdomain_index(); if(!input_is_c3t3()) m_c3t3.remove_from_complex(cit); - m_c3t3.add_to_complex(cit, index); + if(Subdomain_index() != index) + m_c3t3.add_to_complex(cit, index); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbc; @@ -421,10 +417,7 @@ private: if (!input_is_c3t3()) { for (int i = 0; i < 4; ++i) - { - if (cit->vertex(i)->in_dimension() == -1) - cit->vertex(i)->set_dimension(3); - } + cit->vertex(i)->set_dimension(3); } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG else if (input_is_c3t3() && m_c3t3.is_in_complex(cit)) @@ -453,8 +446,7 @@ private: for (int j = 0; j < 3; ++j) { Vertex_handle vij = f.first->vertex(Tr::vertex_triple_index(i, j)); - if (vij->in_dimension() == -1 || vij->in_dimension() > 2) - vij->set_dimension(2); + vij->set_dimension(2); } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbf; @@ -486,12 +478,10 @@ private: m_c3t3.add_to_complex(e, 1); Vertex_handle v = e.first->vertex(e.second); - if (v->in_dimension() == -1 || v->in_dimension() > 1) - v->set_dimension(1); + v->set_dimension(1); v = e.first->vertex(e.third); - if (v->in_dimension() == -1 || v->in_dimension() > 1) - v->set_dimension(1); + v->set_dimension(1); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbe; @@ -512,8 +502,7 @@ private: if(!m_c3t3.is_in_complex(vit)) m_c3t3.add_to_complex(vit, ++corner_id); - if (vit->in_dimension() == -1 || vit->in_dimension() > 0) - vit->set_dimension(0); + vit->set_dimension(0); vit->set_index(corner_id); @@ -535,6 +524,7 @@ private: CGAL::Tetrahedral_remeshing::debug::dump_vertices_by_dimension( m_c3t3.triangulation(), "c3t3_vertices_"); + CGAL::Tetrahedral_remeshing::debug::check_surface_patch_indices(m_c3t3); #endif } diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h index 1be3eae9b0b..5814fc4fd28 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h @@ -441,7 +441,7 @@ bool is_boundary(const C3T3& c3t3, const CellSelector& cell_selector) { return c3t3.is_in_complex(f) - || cell_selector(f.first) != cell_selector(f.first->neighbor(f.second)); + || get(cell_selector, f.first) != get(cell_selector, f.first->neighbor(f.second)); } template @@ -497,7 +497,7 @@ bool is_boundary_vertex(const typename C3t3::Vertex_handle& v, { if (c3t3.is_in_complex(f)) return true; - if (cell_selector(f.first) ^ cell_selector(f.first->neighbor(f.second))) + if (get(cell_selector, f.first) ^ get(cell_selector, f.first->neighbor(f.second))) return true; } return false; @@ -767,7 +767,7 @@ bool is_outside(const typename C3t3::Edge & edge, if (c3t3.is_in_complex(circ)) return false; // does circ belong to the selection? - if (cell_selector(circ)) + if (get(cell_selector, circ)) return false; ++circ; @@ -789,7 +789,7 @@ bool is_selected(const typename C3t3::Vertex_handle v, for(Cell_handle c : cells) { - if (cell_selector(c)) + if (get(cell_selector, c)) return true; } return false; @@ -814,7 +814,7 @@ bool is_internal(const typename C3t3::Edge& edge, return false; if (si != circ->subdomain_index()) return false; - if (!cell_selector(circ)) + if (!get(cell_selector, circ)) return false; if (c3t3.is_in_complex( circ, @@ -836,7 +836,7 @@ bool is_selected(const typename C3T3::Triangulation::Edge& e, Cell_circulator done = circ; do { - if (cell_selector(circ)) + if (get(cell_selector, circ)) return true; } while (++circ != done); @@ -1135,6 +1135,38 @@ void get_edge_info(const typename C3t3::Edge& edge, } } +namespace internal +{ + template + void treat_before_delete(typename C3t3::Cell_handle c, + CellSelector& cell_selector, + C3t3& c3t3) + { + if (c3t3.is_in_complex(c)) + c3t3.remove_from_complex(c); + if (get(cell_selector, c)) + put(cell_selector, c, false); + } + + template + void treat_new_cell(typename C3t3::Cell_handle c, + const typename C3t3::Subdomain_index& subdomain, + CellSelector& cell_selector, + const bool selected, + C3t3& c3t3) + { + //update C3t3 + using Subdomain_index = typename C3t3::Subdomain_index; + if (Subdomain_index() != subdomain) + c3t3.add_to_complex(c, subdomain); + else + c->set_subdomain_index(Subdomain_index()); + + //update cell_selector property map + put(cell_selector, c, selected); + } +} + namespace debug { @@ -1592,11 +1624,9 @@ void dump_cells_with_small_dihedral_angle(const Tr& tr, std::vector cells; std::vector indices; - for (typename Tr::Finite_cells_iterator cit = tr.finite_cells_begin(); - cit != tr.finite_cells_end(); ++cit) + for (Cell_handle c : tr.finite_cell_handles()) { - Cell_handle c = cit; - if (c->subdomain_index() != Subdomain_index() && cell_select(c)) + if (c->subdomain_index() != Subdomain_index() && get(cell_select, c)) { double dh = min_dihedral_angle(tr, c); if (dh < angle_bound) diff --git a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h index b0374e64dd2..4a2dd01166b 100644 --- a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h +++ b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h @@ -26,6 +26,8 @@ #include #include +#include + #ifdef CGAL_DUMP_REMESHING_STEPS #include #endif @@ -224,24 +226,22 @@ void tetrahedral_isotropic_remeshing( Tetrahedral_remeshing::internal::All_cells_selected()); typedef std::pair Edge_vv; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_edge; typedef typename internal_np::Lookup_named_param_def < internal_np::edge_is_constrained_t, NamedParameters, - No_edge//default + Constant_property_map//default > ::type ECMap; ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), - No_edge()); + Constant_property_map(false)); typedef typename Tr::Facet Facet; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_facet; typedef typename internal_np::Lookup_named_param_def < internal_np::facet_is_constrained_t, NamedParameters, - No_facet//default + Constant_property_map//default > ::type FCMap; FCMap fcmap = choose_parameter(get_parameter(np, internal_np::facet_is_constrained), - No_facet()); + Constant_property_map(false)); typedef typename internal_np::Lookup_named_param_def < internal_np::visitor_t, @@ -392,34 +392,33 @@ void tetrahedral_isotropic_remeshing( = choose_parameter(get_parameter(np, internal_np::smooth_constrained_edges), false); + typedef typename Tr::Cell_handle Cell_handle; typedef typename internal_np::Lookup_named_param_def < internal_np::cell_selector_t, NamedParameters, - Tetrahedral_remeshing::internal::All_cells_selected//default + Constant_property_map//default > ::type SelectionFunctor; SelectionFunctor cell_select = choose_parameter(get_parameter(np, internal_np::cell_selector), - Tetrahedral_remeshing::internal::All_cells_selected()); + Constant_property_map(true)); typedef std::pair Edge_vv; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_edge; typedef typename internal_np::Lookup_named_param_def < internal_np::edge_is_constrained_t, NamedParameters, - No_edge//default + Constant_property_map//default > ::type ECMap; ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), - No_edge()); + Constant_property_map(false)); typedef typename Tr::Facet Facet; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_facet; typedef typename internal_np::Lookup_named_param_def < internal_np::facet_is_constrained_t, NamedParameters, - No_facet//default + Constant_property_map//default > ::type FCMap; FCMap fcmap = choose_parameter(get_parameter(np, internal_np::facet_is_constrained), - No_facet()); + Constant_property_map(false)); typedef typename internal_np::Lookup_named_param_def < internal_np::visitor_t, diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp index 0d90df4938b..699820db5b4 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp @@ -48,20 +48,33 @@ void generate_input_two_subdomains(const std::size_t nbv, Remeshing_triangulatio #endif } -struct Cells_of_subdomain +template +struct Cells_of_subdomain_pmap { private: + using Cell_handle = typename Tr::Cell_handle; + const int m_subdomain; public: - Cells_of_subdomain(const int& subdomain) + using key_type = Cell_handle; + using value_type = bool; + using reference = bool; + using category = boost::read_write_property_map_tag; + + Cells_of_subdomain_pmap(const int& subdomain) : m_subdomain(subdomain) {} - bool operator()(Remeshing_triangulation::Cell_handle c) const + friend value_type get( + const Cells_of_subdomain_pmap& map, const key_type& c) { - return m_subdomain == c->subdomain_index(); + return (map.m_subdomain == c->subdomain_index()); } + friend void put( + Cells_of_subdomain_pmap&, const key_type&, const value_type) + {} //nothing to do : subdomain indices are updated in remeshing + }; int main(int argc, char* argv[]) @@ -75,7 +88,8 @@ int main(int argc, char* argv[]) generate_input_two_subdomains(1000, tr); CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length, - CGAL::parameters::cell_is_selected_map(Cells_of_subdomain(2))); + CGAL::parameters::cell_is_selected_map( + Cells_of_subdomain_pmap(2))); return EXIT_SUCCESS; } diff --git a/Three/doc/Three/Three.txt b/Three/doc/Three/Three.txt index 5d44b6c8eac..548f2e12893 100644 --- a/Three/doc/Three/Three.txt +++ b/Three/doc/Three/Three.txt @@ -392,7 +392,7 @@ Notice that an external plugin will not be automatically loaded in the Polyhedro \section example Examples -All the examples are de-activated in the cmake list outside of our testsuite. To tesr them, one must add `-DRUNNING_CGAL_AUTO_TEST=ON` to the cmake call. +All the examples are de-activated in the cmake list outside of our testsuite. To test them, one must add `-DCGAL_TEST_SUITE=ON` to the cmake call. \subsection example1 Creating a Basic Plugin \cgalExample{Three_examples/Basic_plugin.cpp} diff --git a/Triangulation_3/demo/Triangulation_3/documentation/about.html b/Triangulation_3/demo/Triangulation_3/documentation/about.html index 1954aa1d7fa..d6077d7b567 100644 --- a/Triangulation_3/demo/Triangulation_3/documentation/about.html +++ b/Triangulation_3/demo/Triangulation_3/documentation/about.html @@ -2,7 +2,7 @@

    CGAL Triangulation_3 Demo

    Copyright ©2010-2011
    - INRIA Sophia Antipolis - Mediterranee

    + INRIA Sophia Antipolis - Mediterranee

    This application illustrates an interactive demo for 3D Delaunay Triangulation package of CGAL.

    See also the package manual:
    diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index ac6371c6484..482cb41c176 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -1243,7 +1243,7 @@ protected: // Sequential version // "dummy" is here to allow the specialization (see below) - // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 + // See https://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 template class Hidden_point_visitor { diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index 6d089a23a8b..39fadd1e68b 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -19,13 +19,12 @@ create_single_source_cgal_program("test_regular_as_delaunay_3.cpp") create_single_source_cgal_program("test_regular_insert_range_with_info.cpp") create_single_source_cgal_program("test_regular_remove_3.cpp") create_single_source_cgal_program("test_regular_traits_3.cpp") -create_single_source_cgal_program( - "test_RT_cell_base_with_weighted_circumcenter_3.cpp") +create_single_source_cgal_program("test_RT_cell_base_with_weighted_circumcenter_3.cpp") create_single_source_cgal_program("test_robust_weighted_circumcenter.cpp") create_single_source_cgal_program("test_simplex_3.cpp") -create_single_source_cgal_program( "test_simplex_iterator_3.cpp" ) -create_single_source_cgal_program( "test_segment_cell_traverser_3.cpp" ) -create_single_source_cgal_program( "test_segment_simplex_traverser_3.cpp" ) +create_single_source_cgal_program("test_simplex_iterator_3.cpp" ) +create_single_source_cgal_program("test_segment_cell_traverser_3.cpp" ) +create_single_source_cgal_program("test_segment_simplex_traverser_3.cpp" ) create_single_source_cgal_program("test_static_filters.cpp") create_single_source_cgal_program("test_triangulation_3.cpp") create_single_source_cgal_program("test_io_triangulation_3.cpp") diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h index 1a6f6d7e78a..f58c05d0bef 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h @@ -14,6 +14,19 @@ #ifndef CGAL_TEST_CLS_DELAUNAY_C #define CGAL_TEST_CLS_DELAUNAY_C +#include "_test_cls_iterator.h" +#include "_test_cls_circulator.h" +#include "_test_remove_cluster.h" + +#include +#include + +#include +#include + +#include +#include + #include #include #include @@ -21,18 +34,6 @@ #include #include -#include -#include - -#include "_test_cls_iterator.h" -#include "_test_cls_circulator.h" -#include "_test_remove_cluster.h" - -#include -#include -#include -#include - // Accessory set of functions to differentiate between // Delaunay::nearest_vertex[_in_cell] and // Regular::nearest_power_vertex[_in_cell]. @@ -93,22 +94,6 @@ nearest_vertex_in_cell(const T&t, const P&p, const typename T::Cell_handle c) return nearest_vertex_in_cell(t, p, c, typename T::Weighted_tag()); } -// Template meta programming if. -template < typename Cond, typename Then, typename Else > -struct If; - -template < typename Then, typename Else > -struct If -{ - typedef Then type; -}; - -template < typename Then, typename Else > -struct If -{ - typedef Else type; -}; - template < typename T, typename P > void test_conflicts(T& T3_13, const P *q) { @@ -221,6 +206,10 @@ _test_cls_delaunay_3(const Triangulation &) CGAL_USE_TYPE(Cell); CGAL_USE_TYPE(Vertex_iterator); CGAL_USE_TYPE(Cell_iterator); + + CGAL_USE_TYPE(typename Cls::Periodic_tag); + CGAL_USE_TYPE(typename Cls::Weighted_tag); + // +++ We define now some points for building triangulations +++++// // list of Points for T1_0 , T1_1, T1_2 : @@ -947,7 +936,7 @@ _test_cls_delaunay_3(const Triangulation &) Vertex_handle tmv1 = TM_0.insert(Point(0,0,0)); Vertex_handle tmv2 = TM_0.insert(Point(0,1,0)); - TM_0.move_if_no_collision(tmv1, Point(0, 2, 1)); + TM_0.move_if_no_collision(tmv1, Point(0, 2, 1)); assert(TM_0.tds().is_valid()); assert(TM_0.is_valid()); assert(TM_0.dimension() == 1); diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h index ea40d75963e..798c40e2b5f 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h @@ -10,49 +10,62 @@ // // Author(s) : Monique Teillaud (Monique.Teillaud@sophia.inria.fr) -// This stuff is not used (obsolete) at the moment. +#include + +#include #include #include #include #include -#include -#include template void _test_cls_regular_3(const Triangulation &) { - typedef Triangulation Cls; + typedef Triangulation Cls; - static_assert(std::is_nothrow_move_constructible::value, - "move cstr is missing"); - static_assert(std::is_nothrow_move_assignable::value, - "move assignment is missing"); + typedef typename Cls::Bare_point Point; + typedef typename Cls::Weighted_point Weighted_point; + + typedef typename Cls::Vertex_handle Vertex_handle; + typedef typename Cls::Cell_handle Cell_handle; + typedef typename Cls::Facet Facet; + typedef typename Cls::Edge Edge; + + typedef std::list list_point; + typedef typename Cls::Finite_cells_iterator Finite_cells_iterator; typedef typename Triangulation::Geom_traits Gt; CGAL_USE_TYPE(Gt); - // We assume the traits class has been tested already - // actually, any traits is good if it has been tested + CGAL_USE_TYPE(typename Cls::Periodic_tag); + CGAL_USE_TYPE(typename Cls::Weighted_tag); - typedef typename Cls::Bare_point Bare_point; - typedef typename Cls::Weighted_point Weighted_point; + int n, m; + int count = 0; - typedef std::list list_point; - - // temporary version - - int n,m; - int count = 0 ; + // For dimension 0, we need to check that the point of highest weight is the + // one that finally ends up in the vertex. + std::cout << " test dimension 0 " << std::endl; + Cls T0; + T0.insert(Weighted_point( Point (0,0,0), 0) ); + T0.insert(Weighted_point( Point (0,0,0), 1) ); + T0.insert(Weighted_point( Point (0,0,0), -1) ); + assert(T0.dimension() == 0); + assert(T0.number_of_vertices() == 1); + assert(T0.finite_vertices_begin()->point().weight() == 1); std::cout << " test dimension 1 " << std::endl; Cls T1; std::cout << " number of inserted points : " ; + Weighted_point p[5]; for ( m=0; m<5; m++) { if ( (m%2)== 0 ) - T1.insert( Weighted_point( Bare_point( 2*m,0,0 ), 2 ) ); - else T1.insert( Weighted_point( Bare_point( -2*m+1,0,0 ), 2 ) ); + p[m] = Weighted_point( Point( 2*m,0,0 ), 2 ); + else + p[m] = Weighted_point( Point( -2*m+1,0,0 ), 2 ); + T1.insert( p[m] ); count++; if (count <10) std::cout << count << '\b' ; @@ -65,47 +78,123 @@ _test_cls_regular_3(const Triangulation &) } assert( T1.is_valid() ); std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; + << T1.number_of_vertices() << std::endl; std::cout << " number of inserted points : " ; + Weighted_point q[5]; for ( m=0; m<5; m++) { if ( (m%2)== 0 ) - T1.insert( Weighted_point( Bare_point( 2*m+1,0,0 ), 5 ) ); - else T1.insert( Weighted_point( Bare_point( -2*m+1,0,0 ), 5 ) ); + q[m] = Weighted_point( Point( 2*m+1,0,0 ), 5 ); + else + q[m] = Weighted_point( Point( -2*m+1,0,0 ), 5 ); + T1.insert( q[m] ); count++; if (count <10) std::cout << count << '\b' ; else if (count < 100) - std::cout << count << '\b' << '\b' ; + std::cout << count << '\b' << '\b' ; else - std::cout << count << '\b' << '\b' << '\b' ; + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } assert( T1.is_valid() ); std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; + << T1.number_of_vertices() << std::endl; std::cout << " number of inserted points : " ; + Weighted_point r[10]; for ( m=0; m<10; m++) { if ( (m%2)== 0 ) - T1.insert( Weighted_point( Bare_point( m,0,0 ), 1 ) ); - else T1.insert( Weighted_point( Bare_point( -m,0,0 ), 1 ) ); + r[m] = Weighted_point( Point( m,0,0 ), 1 ); + else + r[m] = Weighted_point( Point( -m,0,0 ), 1 ); + T1.insert( r[m] ); count++; if (count <10) std::cout << count << '\b' ; else if (count < 100) - std::cout << count << '\b' << '\b' ; + std::cout << count << '\b' << '\b' ; else - std::cout << count << '\b' << '\b' << '\b' ; + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } assert( T1.is_valid() ); std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; + << T1.number_of_vertices() << std::endl; assert( T1.dimension()==1 ); + // The following is distilled from a bug report by Wulue Zhao + // (zhao.88@osu.edu), a student of Tamal Dey. + Point pt0(0,0,0); + Point pt1( 1,0,0), pt2(2,0,0), pt3(3,0,0); + Point pt4(-1,0,0), pt5(-2,0,0), pt6(-3,0,0); + + Weighted_point wp0(pt0,10.0); + Weighted_point wp1(pt1,0.0), wp2(pt2,0.0), wp3(pt3,0.0); + Weighted_point wp4(pt4,0.0), wp5(pt5,0.0), wp6(pt6,0.0); + + Cls T11; + + T11.insert(wp0); + T11.insert(wp1); + T11.insert(wp2); + T11.insert(wp3); + T11.insert(wp4); + T11.insert(wp5); + T11.insert(wp6); + + assert(T11.is_valid()); + + // And another distilled bug report from the same guy. + { + Point p1(-0.07, 0.04, 0.04); + Point p2(0.09, 0.04, 0.04); + Point p3(0.09, -0.05, 0.04); + Point p4(0.05, -0.05, 0.04); + Point p5(0.05, 0.0, 0.04); + Point p6(-0.07, 0.0, 0.04); + Point p7(-0.07, 0.04, -0.04); + Point p8(0.09, 0.04, -0.04); + Point p9(0.09, -0.05, -0.04); + Point p10(0.05, -0.05, -0.04); + Point p11(0.05, 0.0, -0.04); + Point p12(-0.07, 0.0, -0.04); + + Weighted_point wp1(p1,0); + Weighted_point wp2(p2,0); + Weighted_point wp3(p3,0); + Weighted_point wp4(p4,0); + Weighted_point wp5(p5,0); + Weighted_point wp6(p6,0); + Weighted_point wp7(p7,0); + Weighted_point wp8(p8,0); + Weighted_point wp9(p9,0); + Weighted_point wp10(p10,0); + Weighted_point wp11(p11,0); + Weighted_point wp12(p12,0); + Weighted_point wp13(p3,0.3); // wp13 has the same coordinates with wp3 + + Cls T111; + + T111.insert(wp1); + T111.insert(wp2); + T111.insert(wp3); + T111.insert(wp13); // it doesnot work inserting wp13 here + T111.insert(wp4); + T111.insert(wp5); + T111.insert(wp6); + T111.insert(wp7); + T111.insert(wp8); + T111.insert(wp9); + T111.insert(wp10); + T111.insert(wp11); + T111.insert(wp12); + + assert(T111.is_valid()); + } + std::cout << " test dimension 2 " << std::endl; std::cout << " number of inserted points : " ; Cls T2; @@ -113,61 +202,66 @@ _test_cls_regular_3(const Triangulation &) count = 0 ; int px=1, py=1; int qx=-1, qy=2; + Weighted_point s[400]; for (m=0; m<10; m++) for (n=0; n<10; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), 1 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 1 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } for (m=10; m<20; m++) for (n=0; n<10; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), -1 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -1 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } for (m=0; m<10; m++) for (n=10; n<20; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), -2 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -2 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } for (m=10; m<20; m++) for (n=10; n<20; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), 5 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 5 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } std::cout << std::endl << " number of vertices : " - << T2.number_of_vertices() << std::endl; + << T2.number_of_vertices() << std::endl; assert( T2.dimension()==2 ); assert( T2.is_valid() ); @@ -178,16 +272,18 @@ _test_cls_regular_3(const Triangulation &) list_point lp; int a, b, d; for (a=0;a!=10;a++) - for (b=0;b!=10;b++) - for (d=0;d!=10;d++) - lp.push_back(Weighted_point( Bare_point(a*b-d*a + (a-b)*10 +a , - a-b+d +5*b, - a*a-d*d+b), - a*b-a*d) ); + // for (b=0;b!=10;b++) + for (b=0;b!=5;b++) + // for (d=0;d!=10;d++) + for (d=0;d!=5;d++) + lp.push_back(Weighted_point( Point(a*b-d*a + (a-b)*10 +a , + a-b+d +5*b, + a*a-d*d+b), + a*b-a*d) ); typename list_point::iterator it; count = 0 ; std::cout << " number of inserted points : " ; - for (it=lp.begin(); it!=lp.end();it++){ + for (it=lp.begin(); it!=lp.end(); ++it){ count++; T.insert(*it); if (count <10) @@ -199,15 +295,136 @@ _test_cls_regular_3(const Triangulation &) if (count < 1000) std::cout << count << '\b' << '\b' << '\b' ; else - std::cout << count << std::endl; + std::cout << count << std::endl; std::cout.flush(); } + std::cout << std::endl; std::cout << " number of vertices : " - << T.number_of_vertices() << std::endl; + << T.number_of_vertices() << std::endl; assert(T.is_valid()); assert(T.dimension()==3); + T.clear(); + std::cout << " test iterator range insert" << std::endl; + T.insert (lp.begin(), lp.end()); + + std::cout << " number of vertices : " + << T.number_of_vertices() << std::endl; + assert(T.is_valid()); + assert(T.dimension()==3); + + + //test nearest_power_vertex + std::cout << " test nearest_power_vertex " << std::endl; + Point pp1(0.0, 0.0, 0.0); + Point pp2(1.0, 0.0, 0.0); + Point pp3(0.0, 1.0, 0.0); + Point pp4(0.0, 0.0, 1.0); + Point pp5(1.0, 1.0, 0.0); + Point pp6(0.0, 1.0, 1.0); + Point pp7(1.0, 0.0, 1.0); + Point pp8(1.0, 1.0, 1.0); + Point pp9(0.5, 0.5, 0.5); + + Weighted_point wpp1(pp1, 1.0); + Weighted_point wpp2(pp2, 2.0); + Weighted_point wpp3(pp3, 1.0); + Weighted_point wpp4(pp4, 4.0); + Weighted_point wpp5(pp5, 1.0); + Weighted_point wpp6(pp6, 1.0); + Weighted_point wpp7(pp7, 1.0); + Weighted_point wpp8(pp8, 8.0); + Weighted_point wpp9(pp9, -8.0); + + Cls T3; + + T3.insert(wpp1); + Vertex_handle v2 = T3.insert(wpp2); + assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v2); + + T3.insert(wpp3); + Vertex_handle v4 = T3.insert(wpp4); + assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v4); + + T3.insert(wpp5); + T3.insert(wpp6); + T3.insert(wpp7); + + Vertex_handle v8 = T3.insert(wpp8); + Point query(0.5,0.5,0.5); + assert(T3.nearest_power_vertex(query) == v8); + assert(T3.nearest_power_vertex_in_cell(query ,v8->cell()) == v8); + + Vertex_handle v9 = T3.insert(wpp9); + assert(v9 == Vertex_handle()); // hidden point + + // test dual + std::cout << " test dual member functions" << std::endl; + Finite_cells_iterator fcit = T3.finite_cells_begin(); + for( ; fcit != T3.finite_cells_end(); ++fcit) { + Point cc = T3.dual(fcit); + Vertex_handle ncc = T3.nearest_power_vertex(cc); + assert(fcit->has_vertex(ncc)); + } + + // test Gabriel + std::cout << " test is_Gabriel " << std::endl; + Point q0(0.,0.,0.); + Point q1(2.,0.,0.); + Point q2(0.,2.,0.); + Point q3(0.,0.,2.); + + Weighted_point wq0(q0,0.); + Weighted_point wq1(q1,0.); + Weighted_point wq2(q2,0.); + Weighted_point wq3(q3,0.); + Weighted_point wq01(q0,2.); + + Cls T4; + Vertex_handle v0 = T4.insert(wq0); + Vertex_handle v1 = T4.insert(wq1); + v2 = T4.insert(wq2); + Vertex_handle v3 = T4.insert(wq3); + Cell_handle c; + int i,j,k,l; + assert(T4.is_facet(v0,v1,v2,c,j,k,l)); + i = 6 - (j+k+l); + Facet f = std::make_pair(c,i); + assert(T4.is_Gabriel(c,i)); + assert(T4.is_Gabriel(f)); + assert(T4.is_facet(v1,v2,v3,c,j,k,l)); + i = 6 - (j+k+l); + assert(!T4.is_Gabriel(c,i)); + assert(T4.is_edge(v0,v1,c,i,j)); + assert(T4.is_Gabriel(c,i,j)); + Edge e = make_triple(c,i,j); + assert(T4.is_Gabriel(e)); + assert(T4.is_edge(v2,v3,c,i,j)); + assert(T4.is_Gabriel(c,i,j)); + + Vertex_handle v01 = T4.insert(wq01); + (void) v01; // kill warning + assert(T4.is_edge(v2,v3,c,i,j)); + assert(!T4.is_Gabriel(c,i,j)); + + Weighted_point wwq0(q0,0.); + Weighted_point wwq1(q1,0.); + Weighted_point wwq2(q2,0.); + Weighted_point wwq3(q3,5.); + Cls T5; + v0 = T5.insert(wwq0); + v1 = T5.insert(wwq1); + v2 = T5.insert(wwq2); + v3 = T5.insert(wwq3); + assert(T5.nearest_power_vertex(v3->point().point()) == v3); + assert(T5.nearest_power_vertex(v0->point().point()) == v3); + assert(T5.is_Gabriel(v3)); + assert(!T5.is_Gabriel(v0)); + + static_assert(std::is_nothrow_move_constructible::value, "move cstr is missing"); + static_assert(std::is_nothrow_move_assignable::value, "move assignment is missing"); + namespace test_tr_23 = CGAL::Testsuite::Triangulation_23; test_tr_23::test_move_semantic(T); } diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h index 9790692fd90..8d85533d589 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h @@ -10,6 +10,14 @@ // // Author(s) : Francois Rebufat +#include "_test_cls_iterator.h" +#include "_test_cls_circulator.h" +#include +#include + +#include +#include + #include #include #include @@ -17,14 +25,6 @@ #include #include -#include "_test_cls_iterator.h" -#include "_test_cls_circulator.h" - -#include -#include -#include -#include - template bool check_all_are_finite(Triangulation* tr, const Container& cont) { @@ -120,6 +120,9 @@ _test_cls_triangulation_3(const Triangulation &) CGAL_USE_TYPE(Vertex_iterator); CGAL_USE_TYPE(Cell_iterator); + CGAL_USE_TYPE(typename Cls::Periodic_tag); + CGAL_USE_TYPE(typename Cls::Weighted_tag); + // +++ We define now some points for building triangulations +++++// // list of Points for T1_0 , T1_1, T1_2 : diff --git a/Triangulation_3/test/Triangulation_3/test_regular_3.cpp b/Triangulation_3/test/Triangulation_3/test_regular_3.cpp index 430a2dee4ed..b8a9d8170ad 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_3.cpp @@ -1,455 +1,51 @@ -// Copyright (c) 1998 INRIA Sophia-Antipolis (France). -// 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) : Monique Teillaud (Monique.Teillaud@sophia.inria.fr) -// : Mariette Yvinec (Mariette.Yvinec@sophia.inria.fr) - #include -#include -#include -#include + +bool del = true; #include #include #include -bool del=true; - -typedef CGAL::Exact_predicates_inexact_constructions_kernel traits; +#include +#include +#include +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC; // Explicit instantiation of the whole class : -template class CGAL::Regular_triangulation_3; +template class CGAL::Regular_triangulation_3; -template -void test_RT() +template +void test_kernel() { - typedef RT Cls; + using Cls = CGAL::Regular_triangulation_3; - _test_cls_regular_3( Cls() ); - typedef typename RT::Bare_point Point; - typedef typename RT::Weighted_point Weighted_point; - - typedef typename Cls::Vertex_handle Vertex_handle; - typedef typename Cls::Cell_handle Cell_handle; - typedef typename Cls::Facet Facet; - typedef typename Cls::Edge Edge; - - typedef std::list list_point; - typedef typename Cls::Finite_cells_iterator Finite_cells_iterator; - - // temporary version - - int n, m; - int count = 0; - - // For dimension 0, we need to check that the point of highest weight is the - // one that finally ends up in the vertex. - std::cout << " test dimension 0 " << std::endl; - Cls T0; - T0.insert(Weighted_point( Point (0,0,0), 0) ); - T0.insert(Weighted_point( Point (0,0,0), 1) ); - T0.insert(Weighted_point( Point (0,0,0), -1) ); - assert(T0.dimension() == 0); - assert(T0.number_of_vertices() == 1); - assert(T0.finite_vertices_begin()->point().weight() == 1); - - std::cout << " test dimension 1 " << std::endl; - Cls T1; - std::cout << " number of inserted points : " ; - Weighted_point p[5]; - for ( m=0; m<5; m++) { - if ( (m%2)== 0 ) - p[m] = Weighted_point( Point( 2*m,0,0 ), 2 ); - else - p[m] = Weighted_point( Point( -2*m+1,0,0 ), 2 ); - T1.insert( p[m] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - assert( T1.is_valid() ); - std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; - - std::cout << " number of inserted points : " ; - Weighted_point q[5]; - for ( m=0; m<5; m++) { - if ( (m%2)== 0 ) - q[m] = Weighted_point( Point( 2*m+1,0,0 ), 5 ); - else - q[m] = Weighted_point( Point( -2*m+1,0,0 ), 5 ); - T1.insert( q[m] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - assert( T1.is_valid() ); - std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; - - std::cout << " number of inserted points : " ; - Weighted_point r[10]; - for ( m=0; m<10; m++) { - if ( (m%2)== 0 ) - r[m] = Weighted_point( Point( m,0,0 ), 1 ); - else - r[m] = Weighted_point( Point( -m,0,0 ), 1 ); - T1.insert( r[m] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - assert( T1.is_valid() ); - std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; - assert( T1.dimension()==1 ); - - // The following is distilled from a bug report by Wulue Zhao - // (zhao.88@osu.edu), a student of Tamal Dey. - Point pt0(0,0,0); - Point pt1( 1,0,0), pt2(2,0,0), pt3(3,0,0); - Point pt4(-1,0,0), pt5(-2,0,0), pt6(-3,0,0); - - Weighted_point wp0(pt0,10.0); - Weighted_point wp1(pt1,0.0), wp2(pt2,0.0), wp3(pt3,0.0); - Weighted_point wp4(pt4,0.0), wp5(pt5,0.0), wp6(pt6,0.0); - - Cls T11; - - T11.insert(wp0); - T11.insert(wp1); - T11.insert(wp2); - T11.insert(wp3); - T11.insert(wp4); - T11.insert(wp5); - T11.insert(wp6); - - assert(T11.is_valid()); - - // And another distilled bug report from the same guy. - { - Point p1(-0.07, 0.04, 0.04); - Point p2(0.09, 0.04, 0.04); - Point p3(0.09, -0.05, 0.04); - Point p4(0.05, -0.05, 0.04); - Point p5(0.05, 0.0, 0.04); - Point p6(-0.07, 0.0, 0.04); - Point p7(-0.07, 0.04, -0.04); - Point p8(0.09, 0.04, -0.04); - Point p9(0.09, -0.05, -0.04); - Point p10(0.05, -0.05, -0.04); - Point p11(0.05, 0.0, -0.04); - Point p12(-0.07, 0.0, -0.04); - - Weighted_point wp1(p1,0); - Weighted_point wp2(p2,0); - Weighted_point wp3(p3,0); - Weighted_point wp4(p4,0); - Weighted_point wp5(p5,0); - Weighted_point wp6(p6,0); - Weighted_point wp7(p7,0); - Weighted_point wp8(p8,0); - Weighted_point wp9(p9,0); - Weighted_point wp10(p10,0); - Weighted_point wp11(p11,0); - Weighted_point wp12(p12,0); - Weighted_point wp13(p3,0.3); // wp13 has the same coordinates with wp3 - - Cls T111; - - T111.insert(wp1); - T111.insert(wp2); - T111.insert(wp3); - T111.insert(wp13); // it doesnot work inserting wp13 here - T111.insert(wp4); - T111.insert(wp5); - T111.insert(wp6); - T111.insert(wp7); - T111.insert(wp8); - T111.insert(wp9); - T111.insert(wp10); - T111.insert(wp11); - T111.insert(wp12); - - assert(T111.is_valid()); - } - - std::cout << " test dimension 2 " << std::endl; - std::cout << " number of inserted points : " ; - Cls T2; - - count = 0 ; - int px=1, py=1; - int qx=-1, qy=2; - Weighted_point s[400]; - for (m=0; m<10; m++) - for (n=0; n<10; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 1 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - for (m=10; m<20; m++) - for (n=0; n<10; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -1 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - for (m=0; m<10; m++) - for (n=10; n<20; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -2 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - for (m=10; m<20; m++) - for (n=10; n<20; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 5 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - - std::cout << std::endl << " number of vertices : " - << T2.number_of_vertices() << std::endl; - assert( T2.dimension()==2 ); - assert( T2.is_valid() ); - - // dimension 3 - std::cout << " test dimension 3" << std::endl; - Cls T; - - list_point lp; - int a, b, d; - for (a=0;a!=10;a++) - // for (b=0;b!=10;b++) - for (b=0;b!=5;b++) - // for (d=0;d!=10;d++) - for (d=0;d!=5;d++) - lp.push_back(Weighted_point( Point(a*b-d*a + (a-b)*10 +a , - a-b+d +5*b, - a*a-d*d+b), - a*b-a*d) ); - typename list_point::iterator it; - count = 0 ; - std::cout << " number of inserted points : " ; - for (it=lp.begin(); it!=lp.end(); ++it){ - count++; - T.insert(*it); - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - if (count < 1000) - std::cout << count << '\b' << '\b' << '\b' ; - else - std::cout << count << std::endl; - std::cout.flush(); - } - std::cout << std::endl; - - std::cout << " number of vertices : " - << T.number_of_vertices() << std::endl; - assert(T.is_valid()); - assert(T.dimension()==3); - - T.clear(); - std::cout << " test iterator range insert" << std::endl; - T.insert (lp.begin(), lp.end()); - - std::cout << " number of vertices : " - << T.number_of_vertices() << std::endl; - assert(T.is_valid()); - assert(T.dimension()==3); - - - //test nearest_power_vertex - std::cout << " test nearest_power_vertex " << std::endl; - Point pp1(0.0, 0.0, 0.0); - Point pp2(1.0, 0.0, 0.0); - Point pp3(0.0, 1.0, 0.0); - Point pp4(0.0, 0.0, 1.0); - Point pp5(1.0, 1.0, 0.0); - Point pp6(0.0, 1.0, 1.0); - Point pp7(1.0, 0.0, 1.0); - Point pp8(1.0, 1.0, 1.0); - Point pp9(0.5, 0.5, 0.5); - - Weighted_point wpp1(pp1, 1.0); - Weighted_point wpp2(pp2, 2.0); - Weighted_point wpp3(pp3, 1.0); - Weighted_point wpp4(pp4, 4.0); - Weighted_point wpp5(pp5, 1.0); - Weighted_point wpp6(pp6, 1.0); - Weighted_point wpp7(pp7, 1.0); - Weighted_point wpp8(pp8, 8.0); - Weighted_point wpp9(pp9, -8.0); - - Cls T3; - - T3.insert(wpp1); - Vertex_handle v2 = T3.insert(wpp2); - assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v2); - - T3.insert(wpp3); - Vertex_handle v4 = T3.insert(wpp4); - assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v4); - - T3.insert(wpp5); - T3.insert(wpp6); - T3.insert(wpp7); - - Vertex_handle v8 = T3.insert(wpp8); - Point query(0.5,0.5,0.5); - assert(T3.nearest_power_vertex(query) == v8); - assert(T3.nearest_power_vertex_in_cell(query ,v8->cell()) == v8); - - Vertex_handle v9 = T3.insert(wpp9); - assert(v9 == Vertex_handle()); // hidden point - - // test dual - std::cout << " test dual member functions" << std::endl; - Finite_cells_iterator fcit = T3.finite_cells_begin(); - for( ; fcit != T3.finite_cells_end(); ++fcit) { - Point cc = T3.dual(fcit); - Vertex_handle ncc = T3.nearest_power_vertex(cc); - assert(fcit->has_vertex(ncc)); - } - - // test Gabriel - std::cout << " test is_Gabriel " << std::endl; - Point q0(0.,0.,0.); - Point q1(2.,0.,0.); - Point q2(0.,2.,0.); - Point q3(0.,0.,2.); - - Weighted_point wq0(q0,0.); - Weighted_point wq1(q1,0.); - Weighted_point wq2(q2,0.); - Weighted_point wq3(q3,0.); - Weighted_point wq01(q0,2.); - - Cls T4; - Vertex_handle v0 = T4.insert(wq0); - Vertex_handle v1 = T4.insert(wq1); - v2 = T4.insert(wq2); - Vertex_handle v3 = T4.insert(wq3); - Cell_handle c; - int i,j,k,l; - assert(T4.is_facet(v0,v1,v2,c,j,k,l)); - i = 6 - (j+k+l); - Facet f = std::make_pair(c,i); - assert(T4.is_Gabriel(c,i)); - assert(T4.is_Gabriel(f)); - assert(T4.is_facet(v1,v2,v3,c,j,k,l)); - i = 6 - (j+k+l); - assert(!T4.is_Gabriel(c,i)); - assert(T4.is_edge(v0,v1,c,i,j)); - assert(T4.is_Gabriel(c,i,j)); - Edge e = make_triple(c,i,j); - assert(T4.is_Gabriel(e)); - assert(T4.is_edge(v2,v3,c,i,j)); - assert(T4.is_Gabriel(c,i,j)); - - Vertex_handle v01 = T4.insert(wq01); - (void) v01; // kill warning - assert(T4.is_edge(v2,v3,c,i,j)); - assert(!T4.is_Gabriel(c,i,j)); - - Weighted_point wwq0(q0,0.); - Weighted_point wwq1(q1,0.); - Weighted_point wwq2(q2,0.); - Weighted_point wwq3(q3,5.); - Cls T5; - v0 = T5.insert(wwq0); - v1 = T5.insert(wwq1); - v2 = T5.insert(wwq2); - v3 = T5.insert(wwq3); - assert(T5.nearest_power_vertex(v3->point().point()) == v3); - assert(T5.nearest_power_vertex(v0->point().point()) == v3); - assert(T5.is_Gabriel(v3)); - assert(!T5.is_Gabriel(v0)); -} - -int main() -{ - test_RT >(); + _test_cls_regular_3(Cls()); #ifdef CGAL_LINKED_WITH_TBB typedef CGAL::Spatial_lock_grid_3< CGAL::Tag_priority_blocking> Lock_ds; typedef CGAL::Triangulation_data_structure_3< - CGAL::Regular_triangulation_vertex_base_3, - CGAL::Regular_triangulation_cell_base_3, - CGAL::Parallel_tag > Tds_parallel; + CGAL::Regular_triangulation_vertex_base_3, + CGAL::Regular_triangulation_cell_base_3, + CGAL::Parallel_tag > Tds_parallel; typedef CGAL::Regular_triangulation_3< - traits, Tds_parallel, Lock_ds> RT_parallel; + K, Tds_parallel, Lock_ds> RT_parallel; // The following test won't do things in parallel since it doesn't provide a lock data structure - test_RT(); + _test_cls_regular_3(RT_parallel()); // This test performs parallel operations - _test_cls_parallel_triangulation_3( RT_parallel() ); + _test_cls_parallel_triangulation_3(RT_parallel()); #endif - - std::cout << " quit " << std::endl; - return 0; +} + +int main() +{ + test_kernel(); + test_kernel(); + + std::cout << "Done!" << std::endl; + return EXIT_SUCCESS; } diff --git a/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp b/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp index c607bae4119..b7ab0c7c7cb 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp @@ -1,33 +1,37 @@ -// Copyright (c) 2004 INRIA Sophia-Antipolis (France). -// 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) : Sylvain Pion - #include +bool del = true; -bool del=true; +#include +#include -#include "include/CGAL/_test_types.h" -#include "include/CGAL/_test_cls_delaunay_3.h" +template +void test_kernel() +{ + using Cls = CGAL::Regular_triangulation_3; + _test_cls_delaunay_3(Cls()); + +#ifdef CGAL_LINKED_WITH_TBB + typedef CGAL::Spatial_lock_grid_3< + CGAL::Tag_priority_blocking> Lock_ds; + typedef CGAL::Triangulation_data_structure_3< + CGAL::Regular_triangulation_vertex_base_3, + CGAL::Regular_triangulation_cell_base_3, + CGAL::Parallel_tag > Tds_parallel; + typedef CGAL::Regular_triangulation_3< + K, Tds_parallel, Lock_ds> RT_parallel; + + // The following test won't do things in parallel since it doesn't provide a lock data structure + _test_cls_delaunay_3(RT_parallel()); +#endif +} int main() { - typedef CGAL::Regular_triangulation_3 Cls; + test_kernel(); + test_kernel(); - _test_cls_delaunay_3( Cls() ); - - return 0; + std::cout << "Done!" << std::endl; + return EXIT_SUCCESS; } - -// MipsPro prefers this after the other instantiations... -// Explicit instantiation of the whole class : -template class CGAL::Regular_triangulation_3; diff --git a/Weights/doc/Weights/PackageDescription.txt b/Weights/doc/Weights/PackageDescription.txt index e4b66502338..a2cd0632d19 100644 --- a/Weights/doc/Weights/PackageDescription.txt +++ b/Weights/doc/Weights/PackageDescription.txt @@ -101,7 +101,7 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \frac{d_2^a A_1 - d^a B + d_1^a A_2}{A_1 A_2}\f$ +\f$w = \frac{d_2^a A_0 - d^a B + d_0^a A_2}{A_0 A_2}\f$ with notations shown in the figure below and \f$a\f$ any real number being the power parameter. @@ -142,7 +142,7 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \frac{C}{A_1 A_2}\f$ +\f$w = \frac{C}{A_0 A_2}\f$ with notations shown in the figure below. Here, `q` is a query point and the points `p0`, `p1`, and `p2` are its neighbors. @@ -207,10 +207,10 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \pm 2 \sqrt{\frac{2 (d_1 d_2 - D)}{(d d_1 + D_1)(d d_2 + D_2)}}\f$ +\f$w = \pm 2 \sqrt{\frac{2 (d_0 d_2 - D)}{(d d_0 + D_0)(d d_2 + D_2)}}\f$ with notations shown in the figure below and dot products -\f$D_1 = (p_0 - q) \cdot (p_1 - q)\f$, +\f$D_0 = (p_0 - q) \cdot (p_1 - q)\f$, \f$D_2 = (p_1 - q) \cdot (p_2 - q)\f$, and \f$D = (p_0 - q) \cdot (p_2 - q)\f$. @@ -247,11 +247,11 @@ a model of `AnalyticWeightTraits_3` for 3D points This weight is computed as \f$w = 2 \frac{t_1 + t_2}{d}\f$, where -\f$t_1 = \frac{2 A_1}{d d_1 + D_1}\f$ and +\f$t_1 = \frac{2 A_0}{d d_0 + D_0}\f$ and \f$t_2 = \frac{2 A_2}{d d_2 + D_2}\f$ with notations shown in the figure below and dot products -\f$D_1 = (p_0 - q) \cdot (p_1 - q)\f$ and +\f$D_0 = (p_0 - q) \cdot (p_1 - q)\f$ and \f$D_2 = (p_1 - q) \cdot (p_2 - q)\f$. Here, `q` is a query point and the points `p0`, `p1`, and `p2` are its neighbors. @@ -283,7 +283,7 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \frac{d_2^2 A_1 - d^2 B + d_1^2 A_2}{A_1 A_2}\f$ +\f$w = \frac{d_2^2 A_0 - d^2 B + d_0^2 A_2}{A_0 A_2}\f$ with notations shown in the figure below. Here, `q` is a query point and the points `p0`, `p1`, and `p2` are its neighbors. diff --git a/Weights/doc/Weights/fig/discrete_harmonic.svg b/Weights/doc/Weights/fig/discrete_harmonic.svg index 21fdafc5cd7..08c74518014 100644 --- a/Weights/doc/Weights/fig/discrete_harmonic.svg +++ b/Weights/doc/Weights/fig/discrete_harmonic.svg @@ -1,235 +1,439 @@ - + - - diff --git a/Weights/doc/Weights/fig/mean_value.svg b/Weights/doc/Weights/fig/mean_value.svg index 0e40e87eaef..d102c8d130f 100644 --- a/Weights/doc/Weights/fig/mean_value.svg +++ b/Weights/doc/Weights/fig/mean_value.svg @@ -1,79 +1,163 @@ - + - - diff --git a/Weights/doc/Weights/fig/tangent.svg b/Weights/doc/Weights/fig/tangent.svg index a52fcf03170..9ee59f419e8 100644 --- a/Weights/doc/Weights/fig/tangent.svg +++ b/Weights/doc/Weights/fig/tangent.svg @@ -1,93 +1,174 @@ - + - - diff --git a/Weights/doc/Weights/fig/three_point_family.svg b/Weights/doc/Weights/fig/three_point_family.svg index 21fdafc5cd7..079ce8129b1 100644 --- a/Weights/doc/Weights/fig/three_point_family.svg +++ b/Weights/doc/Weights/fig/three_point_family.svg @@ -1,235 +1,433 @@ - + - - diff --git a/Weights/doc/Weights/fig/wachspress.svg b/Weights/doc/Weights/fig/wachspress.svg index cc751743d65..2b79da2a60b 100644 --- a/Weights/doc/Weights/fig/wachspress.svg +++ b/Weights/doc/Weights/fig/wachspress.svg @@ -1,244 +1,439 @@ - + - - diff --git a/Weights/examples/Weights/CMakeLists.txt b/Weights/examples/Weights/CMakeLists.txt index 4521e9cc475..0edac604a89 100644 --- a/Weights/examples/Weights/CMakeLists.txt +++ b/Weights/examples/Weights/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Weights_Examples) - cmake_minimum_required(VERSION 3.1...3.23) +project(Weights_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("weights.cpp") diff --git a/Weights/examples/Weights/convergence.cpp b/Weights/examples/Weights/convergence.cpp index 8cc85915531..83bb06ebe83 100644 --- a/Weights/examples/Weights/convergence.cpp +++ b/Weights/examples/Weights/convergence.cpp @@ -1,5 +1,4 @@ #include -#include #include // Typedefs. diff --git a/Weights/examples/Weights/weighted_laplacian.cpp b/Weights/examples/Weights/weighted_laplacian.cpp index bd44f1fb0ea..af3e4345b41 100644 --- a/Weights/examples/Weights/weighted_laplacian.cpp +++ b/Weights/examples/Weights/weighted_laplacian.cpp @@ -20,18 +20,18 @@ using HD = boost::graph_traits::halfedge_descriptor; template FT get_w_ij(const Mesh& mesh, const HD he, const PointMap pmap) { - const auto v0 = target(he, mesh); - const auto v1 = source(he, mesh); + const VD v0 = target(he, mesh); + const VD v1 = source(he, mesh); const auto& q = get(pmap, v0); // query const auto& p1 = get(pmap, v1); // neighbor j if (is_border_edge(he, mesh)) { - const auto he_cw = opposite(next(he, mesh), mesh); - auto v2 = source(he_cw, mesh); + const HD he_cw = opposite(next(he, mesh), mesh); + VD v2 = source(he_cw, mesh); if (is_border_edge(he_cw, mesh)) { - const auto he_ccw = prev(opposite(he, mesh), mesh); + const HD he_ccw = prev(opposite(he, mesh), mesh); v2 = source(he_ccw, mesh); const auto& p2 = get(pmap, v2); // neighbor jp @@ -42,10 +42,10 @@ FT get_w_ij(const Mesh& mesh, const HD he, const PointMap pmap) { } } - const auto he_cw = opposite(next(he, mesh), mesh); - const auto v2 = source(he_cw, mesh); - const auto he_ccw = prev(opposite(he, mesh), mesh); - const auto v3 = source(he_ccw, mesh); + const HD he_cw = opposite(next(he, mesh), mesh); + const VD v2 = source(he_cw, mesh); + const HD he_ccw = prev(opposite(he, mesh), mesh); + const VD v3 = source(he_ccw, mesh); const auto& p0 = get(pmap, v2); // neighbor jm const auto& p2 = get(pmap, v3); // neighbor jp @@ -56,14 +56,14 @@ template FT get_w_i(const Mesh& mesh, const VD v_i, const PointMap pmap) { FT A_i = 0.0; - const auto v0 = v_i; - const auto init = halfedge(v_i, mesh); - for (const auto& he : halfedges_around_target(init, mesh)) { + const VD v0 = v_i; + const HD init = halfedge(v_i, mesh); + for (const HD he : halfedges_around_target(init, mesh)) { assert(v0 == target(he, mesh)); if (is_border(he, mesh)) { continue; } - const auto v1 = source(he, mesh); - const auto v2 = target(next(he, mesh), mesh); + const VD v1 = source(he, mesh); + const VD v2 = target(next(he, mesh), mesh); const auto& p = get(pmap, v0); const auto& q = get(pmap, v1); @@ -81,14 +81,14 @@ void set_laplacian_matrix(const Mesh& mesh, Matrix& L) { // Precompute Voronoi areas. std::map w_i; - for (const auto& v_i : vertices(mesh)) { + for (const VD v_i : vertices(mesh)) { w_i[get(imap, v_i)] = get_w_i(mesh, v_i, pmap); } // Fill the matrix. - for (const auto& he : halfedges(mesh)) { - const auto vi = source(he, mesh); - const auto vj = target(he, mesh); + for (const HD he : halfedges(mesh)) { + const VD vi = source(he, mesh); + const VD vj = target(he, mesh); const std::size_t i = get(imap, vi); const std::size_t j = get(imap, vj); @@ -106,11 +106,11 @@ int main() { // Create mesh. Mesh mesh; - const auto v0 = mesh.add_vertex(Point_3(0, 2, 0)); - const auto v1 = mesh.add_vertex(Point_3(2, 2, 0)); - const auto v2 = mesh.add_vertex(Point_3(0, 0, 0)); - const auto v3 = mesh.add_vertex(Point_3(2, 0, 0)); - const auto v4 = mesh.add_vertex(Point_3(1, 1, 1)); + const VD v0 = mesh.add_vertex(Point_3(0, 2, 0)); + const VD v1 = mesh.add_vertex(Point_3(2, 2, 0)); + const VD v2 = mesh.add_vertex(Point_3(0, 0, 0)); + const VD v3 = mesh.add_vertex(Point_3(2, 0, 0)); + const VD v4 = mesh.add_vertex(Point_3(1, 1, 1)); mesh.add_face(v0, v2, v4); mesh.add_face(v2, v3, v4); mesh.add_face(v3, v1, v4); diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 5b76f7a9480..8c3eede9a25 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -14,186 +14,147 @@ #ifndef CGAL_AUTHALIC_WEIGHTS_H #define CGAL_AUTHALIC_WEIGHTS_H -// Internal includes. -#include +#include + +#include +#include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace authalic_ns { +/// \cond SKIP_IN_MANUAL - template - FT half_weight(const FT cot, const FT r2) { +namespace authalic_ns { - FT w = FT(0); - CGAL_precondition(r2 != FT(0)); - if (r2 != FT(0)) { - const FT inv = FT(2) / r2; - w = cot * inv; - } - return w; - } +template +FT half_weight(const FT cot, const FT r2) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(r2)); + if (!is_zero(r2)) + w = FT(2) * cot / r2; - template - FT weight(const FT cot_gamma, const FT cot_beta, const FT r2) { + return w; +} - FT w = FT(0); - CGAL_precondition(r2 != FT(0)); - if (r2 != FT(0)) { - const FT inv = FT(2) / r2; - w = (cot_gamma + cot_beta) * inv; - } - return w; - } - } - /// \endcond +template +FT weight(const FT cot_gamma, const FT cot_beta, const FT r2) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(r2)); + if (!is_zero(r2)) + w = FT(2) * (cot_gamma + cot_beta) / r2; - /*! - \ingroup PkgWeightsRefAuthalicWeights + return w; +} - \brief computes the half value of the authalic weight. +} // namespace authalic_ns - This function constructs the half of the authalic weight using the precomputed - cotangent and squared distance values. The returned value is - \f$\frac{2\textbf{cot}}{\textbf{d2}}\f$. +/// \endcond - \tparam FT - a model of `FieldNumberType` +/*! + \ingroup PkgWeightsRefAuthalicWeights - \param cot - the cotangent value + \brief computes the half value of the authalic weight. - \param d2 - the squared distance value + This function computes the half of the authalic weight using the precomputed + cotangent and squared distance values. The returned value is + \f$\frac{2\textbf{cot}}{\textbf{sq_d}}\f$. - \pre d2 != 0 + \tparam FT a model of `FieldNumberType` - \sa `authalic_weight()` - */ - template - FT half_authalic_weight(const FT cot, const FT d2) { - return authalic_ns::half_weight(cot, d2); - } + \param cot the cotangent value + \param sq_d the squared distance value - #if defined(DOXYGEN_RUNNING) + \pre sq_d != 0 - /*! - \ingroup PkgWeightsRefAuthalicWeights + \sa `authalic_weight()` +*/ +template +FT half_authalic_weight(const FT cot, const FT sq_d) +{ + return authalic_ns::half_weight(cot, sq_d); +} - \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefAuthalicWeights +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_3& p0, - const typename GeomTraits::Point_3& p1, - const typename GeomTraits::Point_3& p2, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } + const FT cot_gamma = cotangent_2(p0, p1, q, traits); + const FT cot_beta = cotangent_2(q, p1, p2, traits); - /*! - \ingroup PkgWeightsRefAuthalicWeights + auto squared_distance_2 = traits.compute_squared_distance_2_object(); + const FT sq_d = squared_distance_2(q, p1); - \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT authalic_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } + return authalic_ns::weight(cot_gamma, cot_beta, sq_d); +} - /*! - \ingroup PkgWeightsRefAuthalicWeights +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT authalic_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + const Kernel traits; + return authalic_weight(p0, p1, p2, q, traits); +} - \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT authalic_weight( - const CGAL::Point_3& p0, - const CGAL::Point_3& p1, - const CGAL::Point_3& p2, - const CGAL::Point_3& q) { } +// 3D ============================================================================================== - #endif // DOXYGEN_RUNNING +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - /// \cond SKIP_IN_MANUAL - // Overloads! - template - typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { + const FT cot_gamma = cotangent_3(p0, p1, q, traits); + const FT cot_beta = cotangent_3(q, p1, p2, traits); - using FT = typename GeomTraits::FT; - const FT cot_gamma = internal::cotangent_2(traits, t, r, q); - const FT cot_beta = internal::cotangent_2(traits, q, r, p); + auto squared_distance_3 = traits.compute_squared_distance_3_object(); + const FT sq_d = squared_distance_3(q, p1); - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - const FT d2 = squared_distance_2(q, r); - return authalic_ns::weight(cot_gamma, cot_beta, d2); - } + return authalic_ns::weight(cot_gamma, cot_beta, sq_d); +} - template - typename GeomTraits::FT authalic_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return authalic_weight(t, r, p, q, traits); - } - - template - typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const FT cot_gamma = internal::cotangent_3(traits, t, r, q); - const FT cot_beta = internal::cotangent_3(traits, q, r, p); - - const auto squared_distance_3 = - traits.compute_squared_distance_3_object(); - const FT d2 = squared_distance_3(q, r); - return authalic_ns::weight(cot_gamma, cot_beta, d2); - } - - template - typename GeomTraits::FT authalic_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return authalic_weight(t, r, p, q, traits); - } - /// \endcond +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT authalic_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + const Kernel traits; + return authalic_weight(p0, p1, p2, q, traits); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/barycentric_region_weights.h b/Weights/include/CGAL/Weights/barycentric_region_weights.h index 46fe69bcfa4..7d9f0bf2feb 100644 --- a/Weights/include/CGAL/Weights/barycentric_region_weights.h +++ b/Weights/include/CGAL/Weights/barycentric_region_weights.h @@ -14,131 +14,97 @@ #ifndef CGAL_BARYCENTRIC_REGION_WEIGHTS_H #define CGAL_BARYCENTRIC_REGION_WEIGHTS_H -// Internal includes. -#include +#include + +#include +#include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 2D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; - \brief computes the area of the barycentric cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } + auto midpoint_2 = traits.construct_midpoint_2_object(); + auto centroid_2 = traits.construct_centroid_2_object(); - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights + const Point_2 center = centroid_2(p, q, r); + const Point_2 m1 = midpoint_2(q, r); + const Point_2 m2 = midpoint_2(q, p); - \brief computes the area of the barycentric cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } + const FT A1 = internal::positive_area_2(q, m1, center, traits); + const FT A2 = internal::positive_area_2(q, center, m2, traits); + return A1 + A2; +} - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT barycentric_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return barycentric_area(p, q, r, traits); +} - \brief computes the area of the barycentric cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT barycentric_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } +// 3D ============================================================================================== - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 3D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; - \brief computes the area of the barycentric cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT barycentric_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } + auto midpoint_3 = traits.construct_midpoint_3_object(); + auto centroid_3 = traits.construct_centroid_3_object(); - #endif // DOXYGEN_RUNNING + const Point_3 center = centroid_3(p, q, r); + const Point_3 m1 = midpoint_3(q, r); + const Point_3 m2 = midpoint_3(q, p); - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { + const FT A1 = internal::positive_area_3(q, m1, center, traits); + const FT A2 = internal::positive_area_3(q, center, m2, traits); + return A1 + A2; +} - using FT = typename GeomTraits::FT; - const auto midpoint_2 = - traits.construct_midpoint_2_object(); - const auto centroid_2 = - traits.construct_centroid_2_object(); - - const auto center = centroid_2(p, q, r); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); - - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); - return A1 + A2; - } - - template - typename GeomTraits::FT barycentric_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return barycentric_area(p, q, r, traits); - } - - template - typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto midpoint_3 = - traits.construct_midpoint_3_object(); - const auto centroid_3 = - traits.construct_centroid_3_object(); - - const auto center = centroid_3(p, q, r); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); - - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); - return A1 + A2; - } - - template - typename GeomTraits::FT barycentric_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return barycentric_area(p, q, r, traits); - } - /// \endcond +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT barycentric_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return barycentric_area(p, q, r, traits); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 0591d105d0d..dc070c5c493 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -14,482 +14,388 @@ #ifndef CGAL_COTANGENT_WEIGHTS_H #define CGAL_COTANGENT_WEIGHTS_H -// Internal includes. -#include +#include + +#include +#include +#include +#include +#include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace cotangent_ns { +/// \cond SKIP_IN_MANUAL - template - FT half_weight(const FT cot) { - return FT(2) * cot; - } +namespace cotangent_ns { - template - FT weight(const FT cot_beta, const FT cot_gamma) { - return FT(2) * (cot_beta + cot_gamma); - } - } - /// \endcond +template +FT half_weight(const FT cot) +{ + return FT(2) * cot; +} - /*! - \ingroup PkgWeightsRefCotangentWeights +template +FT weight(const FT cot_beta, const FT cot_gamma) +{ + return FT(2) * (cot_beta + cot_gamma); +} - \brief computes the half value of the cotangent weight. +} // namespace cotangent_ns - This function constructs the half of the cotangent weight using the precomputed - cotangent value. The returned value is - \f$2\textbf{cot}\f$. +/// \endcond - \tparam FT - a model of `FieldNumberType` +/*! + \ingroup PkgWeightsRefCotangentWeights - \param cot - the cotangent value + \brief computes the half value of the cotangent weight. - \sa `cotangent_weight()` - */ - template - FT half_cotangent_weight(const FT cot) { - return cotangent_ns::half_weight(cot); - } + This function constructs the half of the cotangent weight using the precomputed + cotangent value. The returned value is \f$2\textbf{cot}\f$. - #if defined(DOXYGEN_RUNNING) + \tparam FT a model of `FieldNumberType` - /*! - \ingroup PkgWeightsRefCotangentWeights + \param cot the cotangent value - \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } + \sa `cotangent_weight()` +*/ +template +FT half_cotangent_weight(const FT cot) +{ + return cotangent_ns::half_weight(cot); +} - /*! - \ingroup PkgWeightsRefCotangentWeights +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_3& p0, - const typename GeomTraits::Point_3& p1, - const typename GeomTraits::Point_3& p2, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } + const FT cot_beta = cotangent_2(q, p0, p1, traits); + const FT cot_gamma = cotangent_2(p1, p2, q, traits); - /*! - \ingroup PkgWeightsRefCotangentWeights + return cotangent_ns::weight(cot_beta, cot_gamma); +} - \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT cotangent_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT cotangent_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + Kernel traits; + return cotangent_weight(p0, p1, p2, q, traits); +} - /*! - \ingroup PkgWeightsRefCotangentWeights +// 3D ============================================================================================== - \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT cotangent_weight( - const CGAL::Point_3& p0, - const CGAL::Point_3& p1, - const CGAL::Point_3& p2, - const CGAL::Point_3& q) { } +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - #endif // DOXYGEN_RUNNING + const FT cot_beta = cotangent_3(q, p0, p1, traits); + const FT cot_gamma = cotangent_3(p1, p2, q, traits); - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { + return cotangent_ns::weight(cot_beta, cot_gamma); +} - using FT = typename GeomTraits::FT; - const FT cot_beta = internal::cotangent_2(traits, q, t, r); - const FT cot_gamma = internal::cotangent_2(traits, r, p, q); - return cotangent_ns::weight(cot_beta, cot_gamma); - } +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT cotangent_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + Kernel traits; + return cotangent_weight(p0, p1, p2, q, traits); +} - template - typename GeomTraits::FT cotangent_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - GeomTraits traits; - return cotangent_weight(t, r, p, q, traits); - } +/// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { +// Undocumented cotangent weight class. +// Returns: cot(beta) +// +// Returns a single cotangent weight, its operator() is defined based on the +// halfedge_descriptor, polygon mesh, and vertex to point map. +// For border edges it returns zero. +// This version is currently used in: +// Surface_mesh_deformation -> Surface_mesh_deformation.h +template +class Single_cotangent_weight +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - using FT = typename GeomTraits::FT; - const FT cot_beta = internal::cotangent_3(traits, q, t, r); - const FT cot_gamma = internal::cotangent_3(traits, r, p, q); - return cotangent_ns::weight(cot_beta, cot_gamma); - } +public: + // Returns the cotangent of the opposite angle of the edge + // 0 for border edges (which does not have an opposite angle). + template + auto operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + VPM vpm) + { + using Point = typename boost::property_traits::value_type; + using Point_ref = typename boost::property_traits::reference; - template - typename GeomTraits::FT cotangent_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - GeomTraits traits; - return cotangent_weight(t, r, p, q, traits); - } - - // Undocumented cotangent weight class. - // Its constructor takes a polygon mesh and a vertex to point map - // and its operator() is defined based on the halfedge_descriptor only. - // This version is currently used in: - // Polygon_mesh_processing -> curvature_flow_impl.h - template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> - class Edge_cotangent_weight { - - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; + using GeomTraits = typename Kernel_traits::type; using FT = typename GeomTraits::FT; - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - GeomTraits m_traits; + if(is_border(he, pmesh)) + return FT{0}; - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + const vertex_descriptor v0 = target(he, pmesh); + const vertex_descriptor v1 = source(he, pmesh); + const vertex_descriptor v2 = target(next(he, pmesh), pmesh); - Edge_cotangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) : - m_pmesh(pmesh), m_pmap(pmap), m_traits() { } + const Point_ref p0 = get(vpm, v0); + const Point_ref p1 = get(vpm, v1); + const Point_ref p2 = get(vpm, v2); - FT operator()(const halfedge_descriptor he) const { + return cotangent(p0, p2, p1); + } +}; - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) { - const auto h1 = next(he, m_pmesh); +// Undocumented cotangent weight class. +// Returns: 0.5 * (cot(beta) + cot(gamma)) +// +// Its constructor takes a boolean flag to choose between default and clamped +// versions of the cotangent weights and its operator() is defined based on the +// halfedge_descriptor, polygon mesh, and vertex to point map. +// This version is currently used in: +// Polygon_mesh_processing -> curvature_flow_impl.h (no clamping, no bounding) +// Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) +// Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) +// Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) +// +// The API is a bit awkward: the template parameters VertexPointMap and GeomTraits +// are only meaningful in the API that calls the operator with a single parameter. +template::type, + typename GeomTraits = typename Kernel_traits< + typename boost::property_traits::value_type>::type> +class Cotangent_weight +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); +private: + // These class members are used only when the constructor initializing them + // is used, but Surface_mesh_deformation has its own weight API locked + // by the concept SurfaceMeshDeformationWeights. + // A bit awkward, but better than duplicating code... + PolygonMesh const * const m_pmesh_ptr; + const VertexPointMap m_vpm; + const GeomTraits m_traits; - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); + bool m_use_clamped_version; + bool m_bound_from_below; - weight = internal::cotangent_3(m_traits, p0, p2, p1); +public: + Cotangent_weight() + : m_pmesh_ptr(nullptr), m_vpm(), m_traits(), m_use_clamped_version(false), m_bound_from_below(true) + { } - } else { - const auto h1 = next(he, m_pmesh); - const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); + // Common API whether mesh/vpm/traits are initialized in the constructor, + // or passed in the operator() + template + typename GT::FT + operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm, + const GT& traits) const + { + using Point_ref = typename boost::property_traits::reference; + using FT = typename GT::FT; - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - const auto v3 = source(h2, m_pmesh); + if(is_border(he, pmesh)) + return FT{0}; - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - weight = cotangent_weight(p2, p1, p3, p0) / FT(2); - } - return weight; - } - }; - - // Undocumented cotangent weight class. - // Returns a single cotangent weight, its operator() is defined based on the - // halfedge_descriptor, polygon mesh, and vertex to point map. - // For border edges it returns zero. - // This version is currently used in: - // Surface_mesh_deformation -> Surface_mesh_deformation.h - template - class Single_cotangent_weight { - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - template - decltype(auto) operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, const VertexPointMap pmap) const { - - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; - GeomTraits traits; - - if (is_border(he, pmesh)) { - return FT(0); - } + auto half_weight = [&] (const halfedge_descriptor he) -> FT + { + if(is_border(he, pmesh)) + return FT{0}; const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); const vertex_descriptor v2 = target(next(he, pmesh), pmesh); - const auto& p0 = get(pmap, v0); - const auto& p1 = get(pmap, v1); - const auto& p2 = get(pmap, v2); + const Point_ref p0 = get(vpm, v0); + const Point_ref p1 = get(vpm, v1); + const Point_ref p2 = get(vpm, v2); - return internal::cotangent_3(traits, p0, p2, p1); - } - }; + FT weight = 0; + if (m_use_clamped_version) + weight = cotangent_3_clamped(p1, p2, p0, traits); + else + weight = cotangent_3(p1, p2, p0, traits); - // Undocumented cotangent weight class. - // Its constructor takes a boolean flag to choose between default and clamped - // versions of the cotangent weights and its operator() is defined based on the - // halfedge_descriptor, polygon mesh, and vertex to point map. - // This version is currently used in: - // Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) - // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) - // Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) - template - class Cotangent_weight { - bool m_use_clamped_version; + if(m_bound_from_below) + weight = (CGAL::max)(FT(0), weight); - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + return weight / FT(2); + }; - Cotangent_weight(const bool use_clamped_version = false) : - m_use_clamped_version(use_clamped_version) { } + FT weight = half_weight(he) + half_weight(opposite(he, pmesh)); + return weight; + } - template - decltype(auto) operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, const VertexPointMap pmap) const { + // That is the API called by Surface_mesh_deformation + template + auto // kernel_traits::type::FT + operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm) const + { + using Point = typename boost::property_traits::value_type; + using GT = typename Kernel_traits::type; + return this->operator()(he, pmesh, vpm, GT()); + } - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; - GeomTraits traits; +public: + // This is the "normal" API: give all info to the constructor, and operator()(halfedge) + Cotangent_weight(const PolygonMesh& pmesh, + const VertexPointMap vpm, + const GeomTraits& traits = GeomTraits(), + const bool use_clamped_version = false, + const bool bound_from_below = true) + : m_pmesh_ptr(&pmesh), m_vpm(vpm), m_traits(traits), + m_use_clamped_version(use_clamped_version), + m_bound_from_below(bound_from_below) + { } - const auto v0 = target(he, pmesh); - const auto v1 = source(he, pmesh); + typename GeomTraits::FT operator()(const halfedge_descriptor he) const + { + CGAL_precondition(m_pmesh_ptr != nullptr); + return this->operator()(he, *m_pmesh_ptr, m_vpm, m_traits); + } +}; - const auto& p0 = get(pmap, v0); - const auto& p1 = get(pmap, v1); +// Undocumented cotangent weight class. +// +// Its constructor takes a polygon mesh and a vertex to point map +// and its operator() is defined based on the halfedge_descriptor only. +// This class is using a special clamped version of the cotangent weights. +// This version is currently used in: +// Polygon_mesh_processing -> fair.h +// Polyhedron demo -> Hole_filling_plugin.cpp +template +class Secure_cotangent_weight_with_voronoi_area +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - FT weight = FT(0); - if (is_border_edge(he, pmesh)) { - const auto he_cw = opposite(next(he, pmesh), pmesh); - auto v2 = source(he_cw, pmesh); + using Point_ref = typename boost::property_traits::reference; + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - if (is_border_edge(he_cw, pmesh)) { - const auto he_ccw = prev(opposite(he, pmesh), pmesh); - v2 = source(he_ccw, pmesh); +private: + const PolygonMesh& m_pmesh; + const VertexPointMap m_vpm; + GeomTraits m_traits; - const auto& p2 = get(pmap, v2); - if (m_use_clamped_version) { - weight = internal::cotangent_3_clamped(traits, p1, p2, p0); - } else { - weight = internal::cotangent_3(traits, p1, p2, p0); - } - weight = (CGAL::max)(FT(0), weight); - weight /= FT(2); - } else { - const auto& p2 = get(pmap, v2); - if (m_use_clamped_version) { - weight = internal::cotangent_3_clamped(traits, p0, p2, p1); - } else { - weight = internal::cotangent_3(traits, p0, p2, p1); - } - weight = (CGAL::max)(FT(0), weight); - weight /= FT(2); - } + Cotangent_weight cotangent_weight_calculator; - } else { - const auto he_cw = opposite(next(he, pmesh), pmesh); - const auto v2 = source(he_cw, pmesh); - const auto he_ccw = prev(opposite(he, pmesh), pmesh); - const auto v3 = source(he_ccw, pmesh); +public: + Secure_cotangent_weight_with_voronoi_area(const PolygonMesh& pmesh, + const VertexPointMap vpm, + const GeomTraits& traits = GeomTraits()) + : m_pmesh(pmesh), m_vpm(vpm), m_traits(traits), + cotangent_weight_calculator(m_pmesh, m_vpm, m_traits, + true /*clamp*/, true /*bound from below*/) + { } - const auto& p2 = get(pmap, v2); - const auto& p3 = get(pmap, v3); - FT cot_beta = FT(0), cot_gamma = FT(0); + FT w_i(const vertex_descriptor v_i) const + { + return FT(1) / (FT(2) * voronoi(v_i)); + } - if (m_use_clamped_version) { - cot_beta = internal::cotangent_3_clamped(traits, p0, p2, p1); - } else { - cot_beta = internal::cotangent_3(traits, p0, p2, p1); - } + FT w_ij(const halfedge_descriptor he) const + { + return cotangent_weight_calculator(he); + } - if (m_use_clamped_version) { - cot_gamma = internal::cotangent_3_clamped(traits, p1, p3, p0); - } else { - cot_gamma = internal::cotangent_3(traits, p1, p3, p0); - } +private: + FT voronoi(const vertex_descriptor v0) const + { + auto squared_length_3 = m_traits.compute_squared_length_3_object(); + auto vector_3 = m_traits.construct_vector_3_object(); - cot_beta = (CGAL::max)(FT(0), cot_beta); cot_beta /= FT(2); - cot_gamma = (CGAL::max)(FT(0), cot_gamma); cot_gamma /= FT(2); - weight = cot_beta + cot_gamma; + FT voronoi_area = FT(0); + for (const halfedge_descriptor he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) + { + CGAL_assertion(v0 == target(he, m_pmesh)); + CGAL_assertion(CGAL::is_triangle(he, m_pmesh)); + + if (is_border(he, m_pmesh)) + continue; + + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); + + const Point_ref p0 = get(m_vpm, v0); + const Point_ref p1 = get(m_vpm, v1); + const Point_ref p2 = get(m_vpm, v2); + + const CGAL::Angle angle0 = CGAL::angle(p1, p0, p2); + if((angle0 == CGAL::OBTUSE) || + (CGAL::angle(p2, p1, p0) == CGAL::OBTUSE) || + (CGAL::angle(p0, p2, p1) == CGAL::OBTUSE)) + { + const FT A = internal::positive_area_3(p0, p1, p2, m_traits); + if (angle0 == CGAL::OBTUSE) + voronoi_area += A / FT(2); + else + voronoi_area += A / FT(4); } - return weight; - } - }; + else + { + const FT cot_p1 = cotangent_3_clamped(p2, p1, p0, m_traits); + const FT cot_p2 = cotangent_3_clamped(p0, p2, p1, m_traits); - // Undocumented cotangent weight class. - // Its constructor takes a polygon mesh and a vertex to point map - // and its operator() is defined based on the halfedge_descriptor only. - // This class is using a special clamped version of the cotangent weights. - // This version is currently used in: - // Polygon_mesh_processing -> fair.h - // Polyhedron demo -> Hole_filling_plugin.cpp - template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> - class Secure_cotangent_weight_with_voronoi_area { + const Vector_3 v1 = vector_3(p0, p1); + const Vector_3 v2 = vector_3(p0, p2); - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; - - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - GeomTraits m_traits; - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - Secure_cotangent_weight_with_voronoi_area(const PolygonMesh& pmesh, const VertexPointMap pmap) : - m_pmesh(pmesh), m_pmap(pmap), m_traits() { } - - FT w_i(const vertex_descriptor v_i) const { - return FT(1) / (FT(2) * voronoi(v_i)); - } - - FT w_ij(const halfedge_descriptor he) const { - return cotangent_clamped(he); - } - - private: - FT cotangent_clamped(const halfedge_descriptor he) const { - - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) { - const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); - auto v2 = source(he_cw, m_pmesh); - - if (is_border_edge(he_cw, m_pmesh)) { - const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - v2 = source(he_ccw, m_pmesh); - - const auto& p2 = get(m_pmap, v2); - weight = internal::cotangent_3_clamped(m_traits, p1, p2, p0); - } else { - const auto& p2 = get(m_pmap, v2); - weight = internal::cotangent_3_clamped(m_traits, p0, p2, p1); - } - - } else { - const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); - const auto v2 = source(he_cw, m_pmesh); - const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - const auto v3 = source(he_ccw, m_pmesh); - - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - const FT cot_beta = internal::cotangent_3_clamped(m_traits, p0, p2, p1); - const FT cot_gamma = internal::cotangent_3_clamped(m_traits, p1, p3, p0); - weight = cot_beta + cot_gamma; + const FT t1 = cot_p1 * squared_length_3(v2); + const FT t2 = cot_p2 * squared_length_3(v1); + voronoi_area += (t1 + t2) / FT(8); } - return weight; } - FT voronoi(const vertex_descriptor v0) const { + CGAL_assertion(!is_zero(voronoi_area)); + return voronoi_area; + } +}; - const auto squared_length_3 = - m_traits.compute_squared_length_3_object(); - const auto construct_vector_3 = - m_traits.construct_vector_3_object(); - - FT voronoi_area = FT(0); - CGAL_assertion(CGAL::is_triangle_mesh(m_pmesh)); - for (const auto& he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) { - CGAL_assertion(v0 == target(he, m_pmesh)); - if (is_border(he, m_pmesh)) { - continue; - } - - const auto v1 = source(he, m_pmesh); - const auto v2 = target(next(he, m_pmesh), m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - - const auto angle0 = CGAL::angle(p1, p0, p2); - const auto angle1 = CGAL::angle(p2, p1, p0); - const auto angle2 = CGAL::angle(p0, p2, p1); - - const bool obtuse = - (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle2 == CGAL::OBTUSE); - - if (!obtuse) { - const FT cot_p1 = internal::cotangent_3(m_traits, p2, p1, p0); - const FT cot_p2 = internal::cotangent_3(m_traits, p0, p2, p1); - - const auto v1 = construct_vector_3(p0, p1); - const auto v2 = construct_vector_3(p0, p2); - - const FT t1 = cot_p1 * squared_length_3(v2); - const FT t2 = cot_p2 * squared_length_3(v1); - voronoi_area += (t1 + t2) / FT(8); - - } else { - - const FT A = internal::positive_area_3(m_traits, p0, p1, p2); - if (angle0 == CGAL::OBTUSE) { - voronoi_area += A / FT(2); - } else { - voronoi_area += A / FT(4); - } - } - } - CGAL_assertion(voronoi_area != FT(0)); - return voronoi_area; - } - }; - - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index 42a7056afc2..6faa6f189c4 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -14,429 +14,379 @@ #ifndef CGAL_DISCRETE_HARMONIC_WEIGHTS_H #define CGAL_DISCRETE_HARMONIC_WEIGHTS_H -// Internal includes. #include #include +#include +#include +#include + +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace discrete_harmonic_ns { +/// \cond SKIP_IN_MANUAL - template - FT weight( - const FT r1, const FT r2, const FT r3, - const FT A1, const FT A2, const FT B) { +namespace discrete_harmonic_ns { - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - w = (r3 * A1 - r2 * B + r1 * A2) * inv; - } - return w; - } - } - /// \endcond +template +FT weight(const FT d0, const FT d2, const FT d, + const FT A0, const FT A2, const FT B) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(A0) && !is_zero(A2)); + const FT prod = A0 * A2; + if (!is_zero(prod)) + w = (d2 * A0 - d * B + d0 * A2) / prod; - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefDiscreteHarmonicWeights +} // namespace discrete_harmonic_ns - \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT discrete_harmonic_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } +/// \endcond - /*! - \ingroup PkgWeightsRefDiscreteHarmonicWeights +// 2D ============================================================================================== - \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT discrete_harmonic_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } +/*! + \ingroup PkgWeightsRefDiscreteHarmonicWeights + \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - #endif // DOXYGEN_RUNNING + auto squared_distance_2 = traits.compute_squared_distance_2_object(); + auto area_2 = traits.compute_area_2_object(); + + const FT d0 = squared_distance_2(q, p0); + const FT d = squared_distance_2(q, p1); + const FT d2 = squared_distance_2(q, p2); + + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT B = area_2(p2, q, p0); + + return discrete_harmonic_ns::weight(d0, d2, d, A0, A2, B); +} + +/*! + \ingroup PkgWeightsRefDiscreteHarmonicWeights + \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT discrete_harmonic_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + const Kernel traits; + return discrete_harmonic_weight(p0, p1, p2, q, traits); +} + +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL + +template +typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2, q, + p0f, p1f, p2f, qf, + traits); + return discrete_harmonic_weight(p0f, p1f, p2f, qf, traits); +} + +template +typename Kernel::FT discrete_harmonic_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + const Kernel traits; + return discrete_harmonic_weight(p0, p1, p2, q, traits); +} + +/// \endcond + +/*! + \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + + \brief 2D discrete harmonic weights for polygons. + + This class implements 2D discrete harmonic weights (\cite cgal:bc:eddhls-maam-95, + \cite cgal:bc:fhk-gcbcocp-06, \cite cgal:pp-cdmsc-93) which can be computed + at any point inside a strictly convex polygon. + + Discrete harmonic weights are well-defined inside a strictly convex polygon + but they are not necessarily positive. These weights are computed analytically + using the formulation from the `discrete_harmonic_weight()`. + + \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and + value type is `Point_2`. The default is `CGAL::Identity_property_map`. + + \cgalModels `BarycentricWeights_2` +*/ +template > +class Discrete_harmonic_weights_2 +{ +public: + /// \name Types + /// @{ /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT discrete_harmonic_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - - const FT d1 = squared_distance_2(q, t); - const FT d2 = squared_distance_2(q, r); - const FT d3 = squared_distance_2(q, p); - - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); - - return discrete_harmonic_ns::weight( - d1, d2, d3, A1, A2, B); - } - - template - typename GeomTraits::FT discrete_harmonic_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return discrete_harmonic_weight(t, r, p, q, traits); - } - - namespace internal { - - template - typename GeomTraits::FT discrete_harmonic_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - discrete_harmonic_weight(tf, rf, pf, qf, traits); - } - - template - typename GeomTraits::FT discrete_harmonic_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return discrete_harmonic_weight(t, r, p, q, traits); - } - - } // namespace internal + using Vertex_range = VertexRange; + using Geom_traits = GeomTraits; + using Point_map = PointMap; + using Area_2 = typename GeomTraits::Compute_area_2; + using Squared_distance_2 = typename GeomTraits::Compute_squared_distance_2; /// \endcond - /*! - \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + /// Number type. + typedef typename GeomTraits::FT FT; - \brief 2D discrete harmonic weights for polygons. + /// Point type. + typedef typename GeomTraits::Point_2 Point_2; - This class implements 2D discrete harmonic weights ( \cite cgal:bc:fhk-gcbcocp-06, - \cite cgal:pp-cdmsc-93, \cite cgal:bc:eddhls-maam-95 ) which can be computed - at any point inside a strictly convex polygon. + /// @} - Discrete harmonic weights are well-defined inside a strictly convex polygon - but they are not necessarily positive. These weights are computed analytically - using the formulation from the `discrete_harmonic_weight()`. - - \tparam VertexRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \tparam PointMap - a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. - - \cgalModels `BarycentricWeights_2` - */ - template< - typename VertexRange, - typename GeomTraits, - typename PointMap = CGAL::Identity_property_map > - class Discrete_harmonic_weights_2 { - - public: - - /// \name Types - /// @{ - - /// \cond SKIP_IN_MANUAL - using Vertex_range = VertexRange; - using Geom_traits = GeomTraits; - using Point_map = PointMap; - - using Area_2 = typename GeomTraits::Compute_area_2; - using Squared_distance_2 = typename GeomTraits::Compute_squared_distance_2; - /// \endcond - - /// Number type. - typedef typename GeomTraits::FT FT; - - /// Point type. - typedef typename GeomTraits::Point_2 Point_2; - - /// @} - - /// \name Initialization - /// @{ - - /*! - \brief initializes all internal data structures. - - This class implements the behavior of discrete harmonic weights - for 2D query points inside strictly convex polygons. - - \param polygon - an instance of `VertexRange` with the vertices of a strictly convex polygon - - \param traits - a traits class with geometric objects, predicates, and constructions; - the default initialization is provided - - \param point_map - an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; - the default initialization is provided - - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex - */ - Discrete_harmonic_weights_2( - const VertexRange& polygon, - const GeomTraits traits = GeomTraits(), - const PointMap point_map = PointMap()) : - m_polygon(polygon), - m_traits(traits), - m_point_map(point_map), - m_area_2(m_traits.compute_area_2_object()), - m_squared_distance_2(m_traits.compute_squared_distance_2_object()) { - - CGAL_precondition( - polygon.size() >= 3); - CGAL_precondition( - internal::is_simple_2(polygon, traits, point_map)); - CGAL_precondition( - internal::polygon_type_2(polygon, traits, point_map) == - internal::Polygon_type::STRICTLY_CONVEX); - resize(); - } - - /// @} - - /// \name Access - /// @{ - - /*! - \brief computes 2D discrete harmonic weights. - - This function fills a destination range with 2D discrete harmonic weights - computed at the `query` point with respect to the vertices of the input polygon. - - The number of computed weights is equal to the number of polygon vertices. - - \tparam OutIterator - a model of `OutputIterator` whose value type is `FT` - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \return an output iterator to the element in the destination range, - one past the last weight stored - */ - template - OutIterator operator()(const Point_2& query, OutIterator w_begin) { - const bool normalize = false; - return operator()(query, w_begin, normalize); - } - - /// @} - - /// \cond SKIP_IN_MANUAL - template - OutIterator operator()(const Point_2& query, OutIterator w_begin, const bool normalize) { - return optimal_weights(query, w_begin, normalize); - } - /// \endcond - - private: - - // Fields. - const VertexRange& m_polygon; - const GeomTraits m_traits; - const PointMap m_point_map; - - const Area_2 m_area_2; - const Squared_distance_2 m_squared_distance_2; - - std::vector r; - std::vector A; - std::vector B; - std::vector w; - - // Functions. - void resize() { - r.resize(m_polygon.size()); - A.resize(m_polygon.size()); - B.resize(m_polygon.size()); - w.resize(m_polygon.size()); - } - - template - OutputIterator optimal_weights( - const Point_2& query, OutputIterator weights, const bool normalize) { - - // Get the number of vertices in the polygon. - const std::size_t n = m_polygon.size(); - - // Compute areas A, B, and distances r following the notation from [1]. - // Split the loop to make this computation faster. - const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); - const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); - const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); - - r[0] = m_squared_distance_2(p1, query); - A[0] = m_area_2(p1, p2, query); - B[0] = m_area_2(pn, p2, query); - - for (std::size_t i = 1; i < n - 1; ++i) { - const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); - const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); - const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); - - r[i] = m_squared_distance_2(pi1, query); - A[i] = m_area_2(pi1, pi2, query); - B[i] = m_area_2(pi0, pi2, query); - } - - const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); - r[n - 1] = m_squared_distance_2(pn, query); - A[n - 1] = m_area_2(pn, p1, query); - B[n - 1] = m_area_2(pm, p1, query); - - // Compute unnormalized weights following the formula (25) with p = 2 from [1]. - CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); - w[0] = (r[1] * A[n - 1] - r[0] * B[0] + r[n - 1] * A[0]) / (A[n - 1] * A[0]); - - for (std::size_t i = 1; i < n - 1; ++i) { - CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); - w[i] = (r[i + 1] * A[i - 1] - r[i] * B[i] + r[i - 1] * A[i]) / (A[i - 1] * A[i]); - } - - CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); - w[n - 1] = (r[0] * A[n - 2] - r[n - 1] * B[n - 1] + r[n - 2] * A[n - 1]) / (A[n - 2] * A[n - 1]); - - // Normalize if necessary. - if (normalize) { - internal::normalize(w); - } - - // Return weights. - for (std::size_t i = 0; i < n; ++i) { - *(weights++) = w[i]; - } - return weights; - } - }; + /// \name Initialization + /// @{ /*! - \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + \brief initializes all internal data structures. - \brief computes 2D discrete harmonic weights for polygons. + This class implements the behavior of discrete harmonic weights + for 2D query points inside strictly convex polygons. - This function computes 2D discrete harmonic weights at a given `query` point - with respect to the vertices of a strictly convex `polygon`, that is one - weight per vertex. The weights are stored in a destination range - beginning at `w_begin`. - - Internally, the class `Discrete_harmonic_weights_2` is used. If one wants to process - multiple query points, it is better to use that class. When using the free function, - internal memory is allocated for each query point, while when using the class, - it is allocated only once which is much more efficient. However, for a few query - points, it is easier to use this function. It can also be used when the processing - time is not a concern. - - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - and value type is `GeomTraits::Point_2` - - \tparam OutIterator - a model of `OutputIterator` whose value type is `GeomTraits::FT` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \param polygon - an instance of `PointRange` with 2D points which form a strictly convex polygon - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \param traits - a traits class with geometric objects, predicates, and constructions; - this parameter can be omitted if the traits class can be deduced from the point type - - \return an output iterator to the element in the destination range, - one past the last weight stored + \param polygon an instance of `VertexRange` with the vertices of a strictly convex polygon + \param traits a traits class with geometric objects, predicates, and constructions; + the default initialization is provided + \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; + the default initialization is provided \pre polygon.size() >= 3 \pre polygon is simple \pre polygon is strictly convex */ - template< - typename PointRange, - typename OutIterator, - typename GeomTraits> - OutIterator discrete_harmonic_weights_2( - const PointRange& polygon, const typename GeomTraits::Point_2& query, - OutIterator w_begin, const GeomTraits& traits) { + Discrete_harmonic_weights_2(const VertexRange& polygon, + const GeomTraits traits = GeomTraits(), + const PointMap point_map = PointMap()) + : m_polygon(polygon), + m_traits(traits), + m_point_map(point_map), + m_area_2(m_traits.compute_area_2_object()), + m_squared_distance_2(m_traits.compute_squared_distance_2_object()) + { + CGAL_precondition(polygon.size() >= 3); + CGAL_precondition(internal::is_simple_2(polygon, traits, point_map)); + CGAL_precondition(internal::polygon_type_2(polygon, traits, point_map) == internal::Polygon_type::STRICTLY_CONVEX); - Discrete_harmonic_weights_2 - discrete_harmonic(polygon, traits); - return discrete_harmonic(query, w_begin); + resize(); } + /// @} + + /// \name Access + /// @{ + + /*! + \brief computes 2D discrete harmonic weights. + + This function fills a destination range with 2D discrete harmonic weights + computed at the `query` point with respect to the vertices of the input polygon. + + The number of computed weights is equal to the number of polygon vertices. + + \tparam OutIterator a model of `OutputIterator` whose value type is `FT` + + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + + \return an output iterator to the element in the destination range, one past the last weight stored + */ + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin) + { + const bool normalize = false; + return operator()(query, w_begin, normalize); + } + + /// @} + /// \cond SKIP_IN_MANUAL - template< - typename PointRange, - typename OutIterator> - OutIterator discrete_harmonic_weights_2( - const PointRange& polygon, - const typename PointRange::value_type& query, - OutIterator w_begin) { - - using Point_2 = typename PointRange::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - const GeomTraits traits; - return discrete_harmonic_weights_2( - polygon, query, w_begin, traits); + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin, + const bool normalize) + { + return optimal_weights(query, w_begin, normalize); } + /// \endcond +private: + const VertexRange& m_polygon; + const GeomTraits m_traits; + const PointMap m_point_map; + + const Area_2 m_area_2; + const Squared_distance_2 m_squared_distance_2; + + std::vector r; + std::vector A; + std::vector B; + std::vector w; + + void resize() + { + r.resize(m_polygon.size()); + A.resize(m_polygon.size()); + B.resize(m_polygon.size()); + w.resize(m_polygon.size()); + } + + template + OutputIterator optimal_weights(const Point_2& query, + OutputIterator weights, + const bool normalize) + { + // Get the number of vertices in the polygon. + const std::size_t n = m_polygon.size(); + + // Compute areas A, B, and distances r following the notation from [1]. + // Split the loop to make this computation faster. + const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); + const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); + const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); + + r[0] = m_squared_distance_2(p1, query); + A[0] = m_area_2(p1, p2, query); + B[0] = m_area_2(pn, p2, query); + + for (std::size_t i = 1; i < n - 1; ++i) + { + const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); + const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); + const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); + + r[i] = m_squared_distance_2(pi1, query); + A[i] = m_area_2(pi1, pi2, query); + B[i] = m_area_2(pi0, pi2, query); + } + + const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); + r[n - 1] = m_squared_distance_2(pn, query); + A[n - 1] = m_area_2(pn, p1, query); + B[n - 1] = m_area_2(pm, p1, query); + + // Compute unnormalized weights following the formula (25) with p = 2 from [1]. + CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); + w[0] = (r[1] * A[n - 1] - r[0] * B[0] + r[n - 1] * A[0]) / (A[n - 1] * A[0]); + + for (std::size_t i = 1; i < n - 1; ++i) + { + CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); + w[i] = (r[i + 1] * A[i - 1] - r[i] * B[i] + r[i - 1] * A[i]) / (A[i - 1] * A[i]); + } + + CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); + w[n - 1] = (r[0] * A[n - 2] - r[n - 1] * B[n - 1] + r[n - 2] * A[n - 1]) / (A[n - 2] * A[n - 1]); + + // Normalize if necessary. + if (normalize) + internal::normalize(w); + + // Return weights. + for (std::size_t i = 0; i < n; ++i) + *(weights++) = w[i]; + + return weights; + } +}; + +/*! + \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + + \brief computes 2D discrete harmonic weights for polygons. + + This function computes 2D discrete harmonic weights at a given `query` point + with respect to the vertices of a strictly convex `polygon`, that is one + weight per vertex. The weights are stored in a destination range + beginning at `w_begin`. + + Internally, the class `Discrete_harmonic_weights_2` is used. If one wants to process + multiple query points, it is better to use that class. When using the free function, + internal memory is allocated for each query point, while when using the class, + it is allocated only once which is much more efficient. However, for a few query + points, it is easier to use this function. It can also be used when the processing + time is not a concern. + + \tparam PointRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + and value type is `GeomTraits::Point_2` + \tparam OutIterator a model of `OutputIterator` whose value type is `GeomTraits::FT` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + + \param polygon an instance of `PointRange` with 2D points which form a strictly convex polygon + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + \param traits a traits class with geometric objects, predicates, and constructions; + this parameter can be omitted if the traits class can be deduced from the point type + + \return an output iterator to the element in the destination range, one past the last weight stored + + \pre `polygon.size() >= 3` + \pre `polygon` is simple + \pre `polygon` is strictly convex +*/ +template +OutIterator discrete_harmonic_weights_2(const PointRange& polygon, + const typename GeomTraits::Point_2& query, + OutIterator w_begin, + const GeomTraits& traits) +{ + Discrete_harmonic_weights_2 discrete_harmonic(polygon, traits); + return discrete_harmonic(query, w_begin); +} + +/// \cond SKIP_IN_MANUAL +template +OutIterator discrete_harmonic_weights_2(const PointRange& polygon, + const typename PointRange::value_type& query, + OutIterator w_begin) +{ + using Point_2 = typename PointRange::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + + const GeomTraits traits; + return discrete_harmonic_weights_2(polygon, query, w_begin, traits); +} +/// \endcond + } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h index 0170e812d1f..40984d8bc0f 100644 --- a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h +++ b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h @@ -19,8 +19,10 @@ "This part of the package is deprecated since the version 5.4 of CGAL!" #include +#ifndef CGAL_NO_DEPRECATED_CODE + // README: -// This header collects all weights, which have been in CGAL before unifying them +// This header collects all weights which have been in CGAL before unifying them // into the new package Weights. This header is for information purpose only. It // will be removed in the next release. @@ -41,17 +43,16 @@ namespace deprecated { // (i.e. for v0, v1, v2 and v2, v1, v0 the returned cot weights can be slightly different). // This one provides stable results. template -struct Cotangent_value_Meyer_impl { - +struct Cotangent_value_Meyer_impl +{ typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap& ppmap) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + VertexPointMap ppmap) + { typedef typename Kernel_traits< typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; @@ -66,68 +67,58 @@ struct Cotangent_value_Meyer_impl { // double divider = CGAL::sqrt(dot_aa * dot_bb - dot_ab * dot_ab); const Vector cross_ab = CGAL::cross_product(a, b); - const double divider = CGAL::to_double( - CGAL::approximate_sqrt(cross_ab * cross_ab)); + const double divider = CGAL::to_double(CGAL::approximate_sqrt(cross_ab * cross_ab)); - if (divider == 0.0 /* || divider != divider */) { + if (divider == 0.0 /* || divider != divider */) + { CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ? CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); - return dot_ab > 0.0 ? - (std::numeric_limits::max)() : - -(std::numeric_limits::max)(); + return dot_ab > 0.0 ? (std::numeric_limits::max)() : + -(std::numeric_limits::max)(); } + return dot_ab / divider; } }; // Same as above but with a different API. -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> -class Cotangent_value_Meyer { - +template::type> +class Cotangent_value_Meyer +{ protected: typedef VertexPointMap Point_property_map; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel::Vector_3 Vector; - PolygonMesh& pmesh_; + const PolygonMesh& pmesh_; Point_property_map ppmap_; public: - Cotangent_value_Meyer( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + Cotangent_value_Meyer(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { - return pmesh_; - } - - Point_property_map& ppmap() { - return ppmap_; - } - - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + const PolygonMesh& pmesh() { return pmesh_; } + Point_property_map ppmap() { return ppmap_; } + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { return Cotangent_value_Meyer_impl()(v0, v1, v2, ppmap()); } }; // Imported from skeletonization. -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> -class Cotangent_value_Meyer_secure { - +template::type> +class Cotangent_value_Meyer_secure +{ typedef VertexPointMap Point_property_map; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::property_traits::value_type Point; @@ -137,26 +128,18 @@ class Cotangent_value_Meyer_secure { Point_property_map ppmap_; public: - Cotangent_value_Meyer_secure( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + Cotangent_value_Meyer_secure(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { - return pmesh_; - } - - Point_property_map& ppmap() { - return ppmap_; - } - - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + const PolygonMesh& pmesh() { return pmesh_; } + Point_property_map ppmap() { return ppmap_; } + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector a = get(ppmap(), v0) - get(ppmap(), v1); const Vector b = get(ppmap(), v2) - get(ppmap(), v1); @@ -174,37 +157,28 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by clamping between // [1, 89] degrees as suggested by -[Friedel] Unconstrained Spherical Parameterization-. -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, +template::type, typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_clamped : CotangentValue { - - Cotangent_value_clamped() - { } +class Cotangent_value_clamped : CotangentValue +{ + Cotangent_value_clamped() { } public: - Cotangent_value_clamped( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_clamped(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double cot_1 = 57.289962; const double cot_89 = 0.017455; const double value = CotangentValue::operator()(v0, v1, v2); @@ -212,37 +186,28 @@ public: } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, +template::type, typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_clamped_2 : CotangentValue { - - Cotangent_value_clamped_2() - { } +class Cotangent_value_clamped_2 : CotangentValue +{ + Cotangent_value_clamped_2() { } public: - Cotangent_value_clamped_2( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_clamped_2(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double cot_5 = 5.671282; const double cot_175 = -cot_5; const double value = CotangentValue::operator()(v0, v1, v2); @@ -250,80 +215,65 @@ public: } }; -template< -typename PolygonMesh, -typename CotangentValue = Cotangent_value_Meyer_impl > -struct Cotangent_value_minimum_zero_impl : CotangentValue { - +template > +struct Cotangent_value_minimum_zero_impl + : CotangentValue +{ typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap ppmap) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap ppmap) + { const double value = CotangentValue::operator()(v0, v1, v2, ppmap); return (std::max)(0.0, value); } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, +template::type, typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_minimum_zero : CotangentValue { - - Cotangent_value_minimum_zero() - { } - +class Cotangent_value_minimum_zero : CotangentValue +{ public: - Cotangent_value_minimum_zero( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_minimum_zero() { } + + Cotangent_value_minimum_zero(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double value = CotangentValue::operator()(v0, v1, v2); return (std::max)(0.0, value); } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > -class Voronoi_area : CotangentValue { - +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Voronoi_area + : CotangentValue +{ public: - Voronoi_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Voronoi_area(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::in_edge_iterator in_edge_iterator; @@ -333,13 +283,13 @@ public: typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel::Vector_3 Vector; - double operator()(vertex_descriptor v0) { - + double operator()(vertex_descriptor v0) + { // return 1.0; double voronoi_area = 0.0; for (const halfedge_descriptor he : - halfedges_around_target(halfedge(v0, pmesh()), pmesh())) { - + halfedges_around_target(halfedge(v0, pmesh()), pmesh())) + { if (is_border(he, pmesh()) ) { continue; } CGAL_assertion(CGAL::is_triangle_mesh(pmesh())); @@ -356,12 +306,12 @@ public: const CGAL::Angle angle1 = CGAL::angle(v_op_p, v1_p, v0_p); const CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p); - bool obtuse = - (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle_op == CGAL::OBTUSE); + bool obtuse = (angle0 == CGAL::OBTUSE) || + (angle1 == CGAL::OBTUSE) || + (angle_op == CGAL::OBTUSE); - if (!obtuse) { + if (!obtuse) + { const double cot_v1 = CotangentValue::operator()(v_op, v1, v0); const double cot_v_op = CotangentValue::operator()(v0, v_op, v1); @@ -369,18 +319,18 @@ public: const double term2 = cot_v_op * to_double((v1_p - v0_p).squared_length()); voronoi_area += (1.0 / 8.0) * (term1 + term2); - } else { - const double area_t = to_double( - CGAL::approximate_sqrt( - CGAL::squared_area(v0_p, v1_p, v_op_p))); + } + else + { + const double area_t = to_double(CGAL::approximate_sqrt(CGAL::squared_area(v0_p, v1_p, v_op_p))); - if (angle0 == CGAL::OBTUSE) { + if (angle0 == CGAL::OBTUSE) voronoi_area += area_t / 2.0; - } else { + else voronoi_area += area_t / 4.0; - } } } + CGAL_warning_msg(voronoi_area != 0.0, "Zero Voronoi area!"); return voronoi_area; } @@ -388,118 +338,103 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by dividing the triangle area // as suggested by -[Mullen08] Spectral Conformal Parameterization-. -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_area_weighted : CotangentValue { - - Cotangent_value_area_weighted() - { } +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_area_weighted + : CotangentValue +{ + Cotangent_value_area_weighted() { } public: - Cotangent_value_area_weighted( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_area_weighted(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { return CotangentValue::operator()(v0, v1, v2) / - CGAL::sqrt(CGAL::squared_area( - get(this->ppmap(), v0), - get(this->ppmap(), v1), - get(this->ppmap(), v2))); + CGAL::sqrt(CGAL::squared_area(get(this->ppmap(), v0), + get(this->ppmap(), v1), + get(this->ppmap(), v2))); } }; // Cotangent weight calculator: // Cotangent_value: as suggested by -[Sorkine07] ARAP Surface Modeling-. // Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-. -template< -typename PolygonMesh, -typename CotangentValue = Cotangent_value_minimum_zero_impl > -struct Cotangent_weight_impl : CotangentValue { - +template > +struct Cotangent_weight_impl + : CotangentValue +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; // Returns the cotangent weight of the specified halfedge_descriptor. // Edge orientation is trivial. template - double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { - + double operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + VertexPointMap ppmap) + { const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); // Only one triangle for border edges. - if (is_border_edge(he, pmesh)) { - + if (is_border_edge(he, pmesh)) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); vertex_descriptor v2 = source(he_cw, pmesh); - if (is_border_edge(he_cw, pmesh)) { + if (is_border_edge(he_cw, pmesh)) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); v2 = source(he_ccw, pmesh); } - return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0); - } else { + return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); const vertex_descriptor v2 = source(he_cw, pmesh); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); const vertex_descriptor v3 = source(he_ccw, pmesh); - return ( - CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + - CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); + return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + + CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); } } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_minimum_zero > -class Cotangent_weight : CotangentValue { - - Cotangent_weight() - { } - +template::type, + typename CotangentValue = Cotangent_value_minimum_zero > +class Cotangent_weight + : CotangentValue +{ public: - Cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_weight() { } + + Cotangent_weight(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - Cotangent_weight(PolygonMesh& pmesh_) : - CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight(const PolygonMesh& pmesh_) + : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -510,52 +445,55 @@ public: // Returns the cotangent weight of the specified halfedge_descriptor. // Edge orientation is trivial. - double operator()(halfedge_descriptor he) { + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { - + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } - return (CotangentValue::operator()(v0, v2, v1) / 2.0); - } else { + return (CotangentValue::operator()(v0, v2, v1) / 2.0); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); - return ( - CotangentValue::operator()(v0, v2, v1) / 2.0 + - CotangentValue::operator()(v0, v3, v1) / 2.0 ); - } + return (CotangentValue::operator()(v0, v2, v1) / 2.0 + + CotangentValue::operator()(v0, v3, v1) / 2.0 ); + } } }; // Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation. -template< -typename PolygonMesh, -typename CotangentValue = Cotangent_value_Meyer_impl > -struct Single_cotangent_weight_impl : CotangentValue { - +template > +struct Single_cotangent_weight_impl + : CotangentValue +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; // Returns the cotangent of the opposite angle of the edge // 0 for border edges (which does not have an opposite angle). template - double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { - - if (is_border(he, pmesh)) { return 0.0; } + double operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) + { + if (is_border(he, pmesh)) + return 0.0; const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); @@ -564,29 +502,22 @@ struct Single_cotangent_weight_impl : CotangentValue { } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > -class Single_cotangent_weight : CotangentValue { - - Single_cotangent_weight() - { } +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Single_cotangent_weight + : CotangentValue +{ + Single_cotangent_weight() { } public: - Single_cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Single_cotangent_weight(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -597,9 +528,10 @@ public: // Returns the cotangent of the opposite angle of the edge // 0 for border edges (which does not have an opposite angle). - double operator()(halfedge_descriptor he) { - - if (is_border(he, pmesh())) { return 0.0; } + double operator()(halfedge_descriptor he) + { + if (is_border(he, pmesh())) + return 0.0; const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); @@ -608,12 +540,12 @@ public: } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_weight_with_triangle_area : CotangentValue { - +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_weight_with_triangle_area + : CotangentValue +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; typedef typename boost::property_traits::value_type Point; @@ -621,33 +553,29 @@ class Cotangent_weight_with_triangle_area : CotangentValue { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Cotangent_weight_with_triangle_area() - { } + Cotangent_weight_with_triangle_area() { } public: - Cotangent_weight_with_triangle_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_weight_with_triangle_area(const PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } - - double operator()(halfedge_descriptor he) { + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } @@ -655,11 +583,11 @@ public: const Point& v0_p = get(ppmap(), v0); const Point& v1_p = get(ppmap(), v1); const Point& v2_p = get(ppmap(), v2); - const double area_t = to_double( - CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); + const double area_t = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); return (CotangentValue::operator()(v0, v2, v1) / area_t); - - } else { + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); @@ -672,37 +600,29 @@ public: const double area_t1 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); const double area_t2 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v3_p))); - return ( - CotangentValue::operator()(v0, v2, v1) / area_t1 + - CotangentValue::operator()(v0, v3, v1) / area_t2 ); + return (CotangentValue::operator()(v0, v2, v1) / area_t1 + + CotangentValue::operator()(v0, v3, v1) / area_t2 ); } + return 0.0; } }; // Mean value calculator described in -[Floater04] Mean Value Coordinates- -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> -class Mean_value_weight { - - // Mean_value_weight() - // {} - - PolygonMesh& pmesh_; +template::type> +class Mean_value_weight +{ + const PolygonMesh& pmesh_; VertexPointMap vpmap_; public: - Mean_value_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap) : - pmesh_(pmesh_), - vpmap_(vpmap) + Mean_value_weight(const PolygonMesh& pmesh_, + VertexPointMap vpmap) + : pmesh_(pmesh_), vpmap_(vpmap) { } - PolygonMesh& pmesh() { - return pmesh_; - } + const PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -714,42 +634,43 @@ public: // Returns the mean-value coordinate of the specified halfedge_descriptor. // Returns different value for different edge orientation (which is a normal // behavior according to the formula). - double operator()(halfedge_descriptor he) { - + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); const Vector vec = get(vpmap_, v0) - get(vpmap_, v1); const double norm = CGAL::sqrt(vec.squared_length()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { - + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } - return (half_tan_value_2(v1, v0, v2) / norm); - } else { + return (half_tan_value_2(v1, v0, v2) / norm); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); - return ( - half_tan_value_2(v1, v0, v2) / norm + - half_tan_value_2(v1, v0, v3) / norm); + return (half_tan_value_2(v1, v0, v2) / norm + + half_tan_value_2(v1, v0, v3) / norm); } } private: // Returns the tangent value of the half angle v0_v1_v2 / 2. - double half_tan_value( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double half_tan_value(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector vec0 = get(vpmap_, v1) - get(vpmap_, v2); const Vector vec1 = get(vpmap_, v2) - get(vpmap_, v0); const Vector vec2 = get(vpmap_, v0) - get(vpmap_, v1); @@ -765,11 +686,10 @@ private: } // My deviation built on Meyer_02. - double half_tan_value_2( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double half_tan_value_2(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector a = get(vpmap_, v0) - get(vpmap_, v1); const Vector b = get(vpmap_, v2) - get(vpmap_, v1); const double dot_ab = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; @@ -787,32 +707,28 @@ private: } }; -template< -typename PolygonMesh, -typename PrimaryWeight = Cotangent_weight, -typename SecondaryWeight = Mean_value_weight > -class Hybrid_weight : public PrimaryWeight, SecondaryWeight { - +template, + typename SecondaryWeight = Mean_value_weight > +class Hybrid_weight + : public PrimaryWeight, SecondaryWeight +{ PrimaryWeight primary; SecondaryWeight secondary; - Hybrid_weight() - { } + Hybrid_weight() { } public: - Hybrid_weight(PolygonMesh& pmesh_) : - primary(pmesh_), - secondary(pmesh_) + Hybrid_weight(const PolygonMesh& pmesh_) + : primary(pmesh_), secondary(pmesh_) { } - PolygonMesh& pmesh() { - return primary.pmesh(); - } + const PolygonMesh& pmesh() { return primary.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - double operator()(halfedge_descriptor he) { - + double operator()(halfedge_descriptor he) + { const double weight = primary(he); // if (weight < 0.0) { std::cout << "Negative weight!" << std::endl; } return (weight >= 0.0) ? weight : secondary(he); @@ -821,27 +737,25 @@ public: // Trivial uniform weights (created for test purposes). template -class Uniform_weight { +class Uniform_weight +{ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - double operator()(halfedge_descriptor /* e */) - { return 1.0; } + double operator()(halfedge_descriptor /* e */) { return 1.0; } }; template -class Scale_dependent_weight_fairing { - - PolygonMesh& pmesh_; +class Scale_dependent_weight_fairing +{ + const PolygonMesh& pmesh_; public: - Scale_dependent_weight_fairing(PolygonMesh& pmesh_) : - pmesh_(pmesh_) + Scale_dependent_weight_fairing(const PolygonMesh& pmesh_) + : pmesh_(pmesh_) { } - PolygonMesh& pmesh() { - return pmesh_; - } + const PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -852,53 +766,53 @@ public: double w_i(vertex_descriptor /* v_i */) { return 1.0; } - double w_ij(halfedge_descriptor he) { - + double w_ij(halfedge_descriptor he) + { const Vector v = target(he, pmesh())->point() - source(he, pmesh())->point(); const double divider = CGAL::sqrt(v.squared_length()); - if (divider == 0.0) { + if (divider == 0.0) + { CGAL_warning_msg(false, "Scale dependent weight - zero length edge."); return (std::numeric_limits::max)(); } + return 1.0 / divider; } }; -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> -class Cotangent_weight_with_voronoi_area_fairing { - +template::type> +class Cotangent_weight_with_voronoi_area_fairing +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; Voronoi_area voronoi_functor; Cotangent_weight > cotangent_functor; public: - Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) + : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - Cotangent_weight_with_voronoi_area_fairing( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, + VPMap vpmap_) + : voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } - PM& pmesh() { - return voronoi_functor.pmesh(); - } + PM& pmesh() { return voronoi_functor.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double w_i(vertex_descriptor v_i) { + double w_i(vertex_descriptor v_i) + { return 0.5 / voronoi_functor(v_i); } - double w_ij(halfedge_descriptor he) { + double w_ij(halfedge_descriptor he) + { return cotangent_functor(he) * 2.0; } }; @@ -906,54 +820,51 @@ public: // Cotangent_value_Meyer has been changed to the version: // Cotangent_value_Meyer_secure to avoid imprecisions from // the issue #4706 - https://github.com/CGAL/cgal/issues/4706. -template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> -class Cotangent_weight_with_voronoi_area_fairing_secure { - +template::type> +class Cotangent_weight_with_voronoi_area_fairing_secure +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; Voronoi_area voronoi_functor; Cotangent_weight > cotangent_functor; public: - Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) + : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - Cotangent_weight_with_voronoi_area_fairing_secure( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_, + VPMap vpmap_) + : voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } - PM& pmesh() { - return voronoi_functor.pmesh(); - } + PM& pmesh() { return voronoi_functor.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double w_i(vertex_descriptor v_i) { + double w_i(vertex_descriptor v_i) + { return 0.5 / voronoi_functor(v_i); } - double w_ij(halfedge_descriptor he) { + double w_ij(halfedge_descriptor he) + { return cotangent_functor(he) * 2.0; } }; template -class Uniform_weight_fairing { - +class Uniform_weight_fairing +{ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Uniform_weight_fairing(PolygonMesh&) - { } + Uniform_weight_fairing(const PolygonMesh&) { } double w_ij(halfedge_descriptor /* e */) { return 1.0; } double w_i(vertex_descriptor /* v_i */) { return 1.0; } @@ -965,4 +876,6 @@ public: } // namespace Weights } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_WEIGHTS_PMP_DEPRECATED_H diff --git a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h index b65ed49828c..8b2bb361673 100644 --- a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h +++ b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h @@ -14,7 +14,12 @@ #ifndef CGAL_WEIGHTS_INTERNAL_POLYGON_UTILS_2_H #define CGAL_WEIGHTS_INTERNAL_POLYGON_UTILS_2_H -// STL includes. +#include +#include +#include +#include +#include + #include #include #include @@ -23,345 +28,329 @@ #include #include -// CGAL includes. -#include -#include -#include -#include -#include - namespace CGAL { namespace Weights { namespace internal { - enum class Edge_case { +enum class Edge_case { - EXTERIOR = 0, // exterior part of the polygon - BOUNDARY = 1, // boundary part of the polygon - INTERIOR = 2 // interior part of the polygon - }; + EXTERIOR = 0, // exterior part of the polygon + BOUNDARY = 1, // boundary part of the polygon + INTERIOR = 2 // interior part of the polygon +}; - // VertexRange type enum. - enum class Polygon_type { +// VertexRange type enum. +enum class Polygon_type +{ + CONCAVE = 0, // Concave polygon = non-convex polygon. + WEAKLY_CONVEX = 1, // This is a convex polygon with collinear vertices. + STRICTLY_CONVEX = 2 // This is a convex polygon without collinear vertices. +}; - // Concave polygon = non-convex polygon. - CONCAVE = 0, +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +int which_side_in_slab_2(const Point_2& query, + const Point_2& low, const Point_2& high, + const Orientation_2& orientation_2, + const CompareX_2& compare_x_2) +{ + const Comparison_result low_x_comp_res = compare_x_2(query, low); + const Comparison_result high_x_comp_res = compare_x_2(query, high); - // This is a convex polygon with collinear vertices. - WEAKLY_CONVEX = 1, - - // This is a convex polygon without collinear vertices. - STRICTLY_CONVEX = 2 - }; - - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - class Point_2, - class Orientation_2, - class CompareX_2> - int which_side_in_slab_2( - const Point_2& query, const Point_2& low, const Point_2& high, - const Orientation_2& orientation_2, const CompareX_2& compare_x_2) { - - const auto low_x_comp_res = compare_x_2(query, low); - const auto high_x_comp_res = compare_x_2(query, high); - if (low_x_comp_res == CGAL::SMALLER) { - if (high_x_comp_res == CGAL::SMALLER) { - return -1; - } - } else { - switch (high_x_comp_res) { - case CGAL::LARGER: return 1; - case CGAL::SMALLER: break; - case CGAL::EQUAL: return (low_x_comp_res == CGAL::EQUAL) ? 0 : 1; - } + if (low_x_comp_res == CGAL::SMALLER) { + if (high_x_comp_res == CGAL::SMALLER) { + return -1; } - switch (orientation_2(low, query, high)) { - case CGAL::LEFT_TURN: return 1; - case CGAL::RIGHT_TURN: return -1; - default: return 0; + } else { + switch (high_x_comp_res) { + case CGAL::LARGER: return 1; + case CGAL::SMALLER: break; + case CGAL::EQUAL: return (low_x_comp_res == CGAL::EQUAL) ? 0 : 1; } } - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - Edge_case bounded_side_2( - const VertexRange& polygon, const typename GeomTraits::Point_2& query, - const GeomTraits& traits, const PointMap point_map) { - - const auto first = polygon.begin(); - const auto last = polygon.end(); - - auto curr = first; - if (curr == last) { - return Edge_case::EXTERIOR; - } - - auto next = curr; ++next; - if (next == last) { - return Edge_case::EXTERIOR; - } - - const auto compare_x_2 = traits.compare_x_2_object(); - const auto compare_y_2 = traits.compare_y_2_object(); - const auto orientation_2 = traits.orientation_2_object(); - - bool is_inside = false; - auto curr_y_comp_res = compare_y_2(get(point_map, *curr), query); - - // Check if the segment (curr, next) intersects - // the ray { (t, query.y()) | t >= query.x() }. - do { - const auto& currp = get(point_map, *curr); - const auto& nextp = get(point_map, *next); - - auto next_y_comp_res = compare_y_2(nextp, query); - switch (curr_y_comp_res) { - case CGAL::SMALLER: - switch (next_y_comp_res) { - case CGAL::SMALLER: - break; - case CGAL::EQUAL: - switch (compare_x_2(query, nextp)) { - case CGAL::SMALLER: is_inside = !is_inside; break; - case CGAL::EQUAL: return Edge_case::BOUNDARY; - case CGAL::LARGER: break; - } - break; - case CGAL::LARGER: - switch (which_side_in_slab_2( - query, currp, nextp, orientation_2, compare_x_2)) { - case -1: is_inside = !is_inside; break; - case 0: return Edge_case::BOUNDARY; - } - break; - } - break; - case CGAL::EQUAL: - switch (next_y_comp_res) { - case CGAL::SMALLER: - switch (compare_x_2(query, currp)) { - case CGAL::SMALLER: is_inside = !is_inside; break; - case CGAL::EQUAL: return Edge_case::BOUNDARY; - case CGAL::LARGER: break; - } - break; - case CGAL::EQUAL: - switch (compare_x_2(query, currp)) { - case CGAL::SMALLER: - if (compare_x_2(query, nextp) != CGAL::SMALLER) { - return Edge_case::BOUNDARY; - } - break; - case CGAL::EQUAL: return Edge_case::BOUNDARY; - case CGAL::LARGER: - if (compare_x_2(query, nextp) != CGAL::LARGER) { - return Edge_case::BOUNDARY; - } - break; - } - break; - case CGAL::LARGER: - if (compare_x_2(query, currp) == CGAL::EQUAL) { - return Edge_case::BOUNDARY; - } - break; - } - break; - case CGAL::LARGER: - switch (next_y_comp_res) { - case CGAL::SMALLER: - switch (which_side_in_slab_2( - query, nextp, currp, orientation_2, compare_x_2)) { - case -1: is_inside = !is_inside; break; - case 0: return Edge_case::BOUNDARY; - } - break; - case CGAL::EQUAL: - if (compare_x_2(query, nextp) == CGAL::EQUAL) { - return Edge_case::BOUNDARY; - } - break; - case CGAL::LARGER: - break; - } - break; - } - - curr = next; - curr_y_comp_res = next_y_comp_res; - ++next; - if (next == last) { - next = first; - } - } while (curr != first); - return is_inside ? Edge_case::INTERIOR : Edge_case::EXTERIOR; + switch (orientation_2(low, query, high)) { + case CGAL::LEFT_TURN: return 1; + case CGAL::RIGHT_TURN: return -1; + default: return 0; } +} - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - bool is_convex_2( - const VertexRange& polygon, const GeomTraits traits, const PointMap point_map) { +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +Edge_case bounded_side_2(const VertexRange& polygon, + const typename GeomTraits::Point_2& query, + const GeomTraits& traits, + const PointMap point_map) +{ + const auto first = polygon.begin(); + const auto last = polygon.end(); - auto first = polygon.begin(); - const auto last = polygon.end(); + auto curr = first; + if (curr == last) + return Edge_case::EXTERIOR; - auto prev = first; - if (prev == last) { - return true; - } + auto next = curr; + ++next; + if (next == last) + return Edge_case::EXTERIOR; - auto curr = prev; ++curr; - if (curr == last) { - return true; - } + auto compare_x_2 = traits.compare_x_2_object(); + auto compare_y_2 = traits.compare_y_2_object(); + auto orientation_2 = traits.orientation_2_object(); - auto next = curr; ++next; - if (next == last) { - return true; - } + bool is_inside = false; + Comparison_result curr_y_comp_res = compare_y_2(get(point_map, *curr), query); - const auto equal_2 = traits.equal_2_object(); - while (equal_2(get(point_map, *prev), get(point_map, *curr))) { - curr = next; ++next; - if (next == last) { - return true; - } - } + // Check if the segment (curr, next) intersects + // the ray { (t, query.y()) | t >= query.x() }. + do { + const auto& currp = get(point_map, *curr); + const auto& nextp = get(point_map, *next); - const auto less_xy_2 = traits.less_xy_2_object(); - const auto orientation_2 = traits.orientation_2_object(); - - bool has_clockwise_triplets = false; - bool has_counterclockwise_triplets = false; - bool order = less_xy_2( - get(point_map, *prev), get(point_map, *curr)); - int num_order_changes = 0; - - do { - switch_orient: - switch (orientation_2( - get(point_map, *prev), get(point_map, *curr), get(point_map, *next))) { - - case CGAL::CLOCKWISE: - has_clockwise_triplets = true; - break; - case CGAL::COUNTERCLOCKWISE: - has_counterclockwise_triplets = true; - break; - case CGAL::ZERO: { - if (equal_2( - get(point_map, *curr), - get(point_map, *next))) { - - if (next == first) { - first = curr; + Comparison_result next_y_comp_res = compare_y_2(nextp, query); + switch (curr_y_comp_res) { + case CGAL::SMALLER: + switch (next_y_comp_res) { + case CGAL::SMALLER: + break; + case CGAL::EQUAL: + switch (compare_x_2(query, nextp)) { + case CGAL::SMALLER: is_inside = !is_inside; break; + case CGAL::EQUAL: return Edge_case::BOUNDARY; + case CGAL::LARGER: break; } - ++next; - if (next == last) { - next = first; + break; + case CGAL::LARGER: + switch (which_side_in_slab_2( + query, currp, nextp, orientation_2, compare_x_2)) { + case -1: is_inside = !is_inside; break; + case 0: return Edge_case::BOUNDARY; } - goto switch_orient; - } - break; + break; } - } + break; + case CGAL::EQUAL: + switch (next_y_comp_res) { + case CGAL::SMALLER: + switch (compare_x_2(query, currp)) { + case CGAL::SMALLER: is_inside = !is_inside; break; + case CGAL::EQUAL: return Edge_case::BOUNDARY; + case CGAL::LARGER: break; + } + break; + case CGAL::EQUAL: + switch (compare_x_2(query, currp)) { + case CGAL::SMALLER: + if (compare_x_2(query, nextp) != CGAL::SMALLER) { + return Edge_case::BOUNDARY; + } + break; + case CGAL::EQUAL: return Edge_case::BOUNDARY; + case CGAL::LARGER: + if (compare_x_2(query, nextp) != CGAL::LARGER) { + return Edge_case::BOUNDARY; + } + break; + } + break; + case CGAL::LARGER: + if (compare_x_2(query, currp) == CGAL::EQUAL) { + return Edge_case::BOUNDARY; + } + break; + } + break; + case CGAL::LARGER: + switch (next_y_comp_res) { + case CGAL::SMALLER: + switch (which_side_in_slab_2( + query, nextp, currp, orientation_2, compare_x_2)) { + case -1: is_inside = !is_inside; break; + case 0: return Edge_case::BOUNDARY; + } + break; + case CGAL::EQUAL: + if (compare_x_2(query, nextp) == CGAL::EQUAL) { + return Edge_case::BOUNDARY; + } + break; + case CGAL::LARGER: + break; + } + break; + } - const bool new_order = less_xy_2( - get(point_map, *curr), get(point_map, *next)); + curr = next; + curr_y_comp_res = next_y_comp_res; + ++next; + if (next == last) { + next = first; + } + } while (curr != first); - if (order != new_order) { - num_order_changes++; - } + return is_inside ? Edge_case::INTERIOR : Edge_case::EXTERIOR; +} - if (num_order_changes > 2) { - return false; - } +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +bool is_convex_2(const VertexRange& polygon, + const GeomTraits traits, + const PointMap point_map) +{ + auto first = polygon.begin(); + const auto last = polygon.end(); - if (has_clockwise_triplets && has_counterclockwise_triplets) { - return false; - } - - prev = curr; - curr = next; - ++next; - if (next == last) { - next = first; - } - order = new_order; - } while (prev != first); + auto prev = first; + if (prev == last) return true; - } - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - bool is_simple_2( - const VertexRange& polygon, const GeomTraits traits, const PointMap point_map) { + auto curr = prev; + ++curr; + if (curr == last) + return true; - const auto first = polygon.begin(); - const auto last = polygon.end(); - if (first == last) { + auto next = curr; + ++next; + if (next == last) + return true; + + auto equal_2 = traits.equal_2_object(); + while (equal_2(get(point_map, *prev), get(point_map, *curr))) + { + curr = next; ++next; + if (next == last) return true; - } - - std::vector poly; - poly.reserve(polygon.size()); - for (const auto& vertex : polygon) { - poly.push_back(get(point_map, vertex)); - } - return CGAL::is_simple_2(poly.begin(), poly.end(), traits); } - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - Polygon_type polygon_type_2( - const VertexRange& polygon, const GeomTraits traits, const PointMap point_map) { + auto less_xy_2 = traits.less_xy_2_object(); + auto orientation_2 = traits.orientation_2_object(); - const auto collinear_2 = - traits.collinear_2_object(); - CGAL_precondition(polygon.size() >= 3); + bool has_clockwise_triplets = false; + bool has_counterclockwise_triplets = false; + bool order = less_xy_2(get(point_map, *prev), get(point_map, *curr)); + int num_order_changes = 0; - // First, test the polygon on convexity. - if (is_convex_2(polygon, traits, point_map)) { + do + { +switch_orient: + switch (orientation_2(get(point_map, *prev), get(point_map, *curr), get(point_map, *next))) + { + case CGAL::CLOCKWISE: + has_clockwise_triplets = true; + break; + case CGAL::COUNTERCLOCKWISE: + has_counterclockwise_triplets = true; + break; + case CGAL::ZERO: { + if (equal_2(get(point_map, *curr), + get(point_map, *next))) + { + if (next == first) + first = curr; - // Test all the consequent triplets of polygon vertices on collinearity. - // In case we find at least one, return WEAKLY_CONVEX polygon. - const std::size_t n = polygon.size(); - for (std::size_t i = 0; i < n; ++i) { - const auto& p1 = get(point_map, *(polygon.begin() + i)); + ++next; + if (next == last) + next = first; - const std::size_t im = (i + n - 1) % n; - const std::size_t ip = (i + 1) % n; - - const auto& p0 = get(point_map, *(polygon.begin() + im)); - const auto& p2 = get(point_map, *(polygon.begin() + ip)); - - if (collinear_2(p0, p1, p2)) { - return Polygon_type::WEAKLY_CONVEX; + goto switch_orient; } + break; } - // Otherwise, return STRICTLY_CONVEX polygon. - return Polygon_type::STRICTLY_CONVEX; } - // Otherwise, return CONCAVE polygon. - return Polygon_type::CONCAVE; + + const bool new_order = less_xy_2(get(point_map, *curr), get(point_map, *next)); + + if (order != new_order) + num_order_changes++; + + if (num_order_changes > 2) + return false; + + if (has_clockwise_triplets && has_counterclockwise_triplets) + return false; + + prev = curr; + curr = next; + ++next; + if (next == last) + next = first; + + order = new_order; + } while (prev != first); + + return true; +} + +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +bool is_simple_2(const VertexRange& polygon, + const GeomTraits traits, + const PointMap point_map) +{ + const auto first = polygon.begin(); + const auto last = polygon.end(); + if (first == last) + return true; + + std::vector poly; + poly.reserve(polygon.size()); + for (const auto& vertex : polygon) + poly.push_back(get(point_map, vertex)); + + return CGAL::is_simple_2(poly.begin(), poly.end(), traits); +} + +template +Polygon_type polygon_type_2(const VertexRange& polygon, + const GeomTraits traits, + const PointMap point_map) +{ + auto collinear_2 = traits.collinear_2_object(); + CGAL_precondition(polygon.size() >= 3); + + // First, test the polygon on convexity. + if (is_convex_2(polygon, traits, point_map)) + { + // Test all the consequent triplets of polygon vertices on collinearity. + // In case we find at least one, return WEAKLY_CONVEX polygon. + const std::size_t n = polygon.size(); + for (std::size_t i = 0; i < n; ++i) + { + const auto& p1 = get(point_map, *(polygon.begin() + i)); + + const std::size_t im = (i + n - 1) % n; + const std::size_t ip = (i + 1) % n; + + const auto& p0 = get(point_map, *(polygon.begin() + im)); + const auto& p2 = get(point_map, *(polygon.begin() + ip)); + + if (collinear_2(p0, p1, p2)) + return Polygon_type::WEAKLY_CONVEX; + } + + // Otherwise, return STRICTLY_CONVEX polygon. + return Polygon_type::STRICTLY_CONVEX; } + // Otherwise, return CONCAVE polygon. + return Polygon_type::CONCAVE; +} + } // namespace internal } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 4e6ef42f96c..850fccff1e8 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -14,722 +14,489 @@ #ifndef CGAL_WEIGHTS_INTERNAL_UTILS_H #define CGAL_WEIGHTS_INTERNAL_UTILS_H -// STL includes. -#include -#include -#include -#include -#include -#include -#include -#include - -// Boost headers. -#include -#include - -// CGAL includes. -#include #include -#include +#include #include +#include #include -#include -#include +#include + +#include + +#include +#include +#include +#include +#include namespace CGAL { namespace Weights { namespace internal { - // Sqrt helpers. - template - class Default_sqrt { +// Sqrt helpers. +template +class Default_sqrt +{ +private: + using Traits = GeomTraits; + using FT = typename Traits::FT; - private: - using Traits = GeomTraits; - using FT = typename Traits::FT; - - public: - FT operator()(const FT value) const { - return static_cast( - CGAL::sqrt(CGAL::to_double(CGAL::abs(value)))); - } - }; - - BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Sqrt, Sqrt, false) - - // Case: do_not_use_default = false. - template::value> - class Get_sqrt { - - public: - using Traits = GeomTraits; - using Sqrt = Default_sqrt; - - static Sqrt sqrt_object(const Traits& ) { - return Sqrt(); - } - }; - - // Case: do_not_use_default = true. - template - class Get_sqrt { - - public: - using Traits = GeomTraits; - using Sqrt = typename Traits::Sqrt; - - static Sqrt sqrt_object(const Traits& traits) { - return traits.sqrt_object(); - } - }; - - // Normalize values. - template - void normalize(std::vector& values) { - - FT sum = FT(0); - for (const FT& value : values) { - sum += value; - } - - CGAL_assertion(sum != FT(0)); - if (sum == FT(0)) { - return; - } - - const FT inv_sum = FT(1) / sum; - for (FT& value : values) { - value *= inv_sum; - } +public: + FT operator()(const FT value) const + { + return static_cast(CGAL::sqrt(CGAL::to_double(CGAL::abs(value)))); } +}; - // Raises value to the power. - template - typename GeomTraits::FT power( - const GeomTraits&, - const typename GeomTraits::FT value, - const typename GeomTraits::FT p) { +BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Sqrt, Sqrt, false) - using FT = typename GeomTraits::FT; - const double base = CGAL::to_double(value); - const double exp = CGAL::to_double(p); - return static_cast(std::pow(base, exp)); +// Case: do_not_use_default = false. +template::value> +class Get_sqrt +{ +public: + using Traits = GeomTraits; + using Sqrt = Default_sqrt; + + static Sqrt sqrt_object(const Traits&) + { + return Sqrt(); } +}; - // Computes distance between two 2D points. - template - typename GeomTraits::FT distance_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q) { +// Case: do_not_use_default = true. +template +class Get_sqrt +{ +public: + using Traits = GeomTraits; + using Sqrt = typename Traits::Sqrt; - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - return sqrt(squared_distance_2(p, q)); - } - - // Computes length of a 2D vector. - template - typename GeomTraits::FT length_2( - const GeomTraits& traits, - const typename GeomTraits::Vector_2& v) { - - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_length_2 = - traits.compute_squared_length_2_object(); - return sqrt(squared_length_2(v)); - } - - // Normalizes a 2D vector. - template - void normalize_2( - const GeomTraits& traits, - typename GeomTraits::Vector_2& v) { - - using FT = typename GeomTraits::FT; - const FT length = length_2(traits, v); - CGAL_assertion(length != FT(0)); - if (length == FT(0)) { - return; - } - v /= length; - } - - // Computes cotanget between two 2D vectors. - template - typename GeomTraits::FT cotangent_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto cross_product_2 = - traits.compute_determinant_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - - const FT dot = dot_product_2(v1, v2); - const FT cross = cross_product_2(v1, v2); - - const FT length = CGAL::abs(cross); - // CGAL_assertion(length != FT(0)); not really necessary - if (length != FT(0)) { - return dot / length; - } else { - return FT(0); // undefined - } - } - - // Computes tanget between two 2D vectors. - template - typename GeomTraits::FT tangent_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto cross_product_2 = - traits.compute_determinant_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - - const FT dot = dot_product_2(v1, v2); - const FT cross = cross_product_2(v1, v2); - - const FT length = CGAL::abs(cross); - // CGAL_assertion(dot != FT(0)); not really necessary - if (dot != FT(0)) { - return length / dot; - } else { - return FT(0); // undefined - } - } - - // Computes distance between two 3D points. - template - typename GeomTraits::FT distance_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q) { - - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_distance_3 = - traits.compute_squared_distance_3_object(); - return sqrt(squared_distance_3(p, q)); - } - - // Computes length of a 3D vector. - template - typename GeomTraits::FT length_3( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& v) { - - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_length_3 = - traits.compute_squared_length_3_object(); - return sqrt(squared_length_3(v)); - } - - // Normalizes a 3D vector. - template - void normalize_3( - const GeomTraits& traits, - typename GeomTraits::Vector_3& v) { - - using FT = typename GeomTraits::FT; - const FT length = length_3(traits, v); - CGAL_assertion(length != FT(0)); - if (length == FT(0)) { - return; - } - v /= length; - } - - // Computes cotanget between two 3D vectors. - template - typename GeomTraits::FT cotangent_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const auto cross = cross_product_3(v1, v2); - - const FT length = length_3(traits, cross); - // TODO: - // Not really necessary: since we handle case length = 0. Does this case happen? - // Yes, e.g. in Surface Parameterization tests. Does it affect the results? - // In current applications, not really. - // CGAL_assertion(length != FT(0)); - if (length != FT(0)) { - return dot / length; - } else { - return FT(0); // undefined - } - } - - // Computes tanget between two 3D vectors. - template - typename GeomTraits::FT tangent_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const auto cross = cross_product_3(v1, v2); - - const FT length = length_3(traits, cross); - // CGAL_assertion(dot != FT(0)); not really necessary - if (dot != FT(0)) { - return length / dot; - } else { - return FT(0); // undefined - } - } - - // Computes 3D angle between two vectors. - template - double angle_3( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& v1, - const typename GeomTraits::Vector_3& v2) { - - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const double dot = - CGAL::to_double(dot_product_3(v1, v2)); - - double angle_rad = 0.0; - if (dot < -1.0) { - angle_rad = std::acos(-1.0); - } else if (dot > 1.0) { - angle_rad = std::acos(+1.0); - } else { - angle_rad = std::acos(dot); - } - return angle_rad; - } - - // Rotates a 3D point around axis. - template - typename GeomTraits::Point_3 rotate_point_3( - const GeomTraits&, - const double angle_rad, - const typename GeomTraits::Vector_3& axis, - const typename GeomTraits::Point_3& query) { - - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; - - const FT c = static_cast(std::cos(angle_rad)); - const FT s = static_cast(std::sin(angle_rad)); - const FT C = FT(1) - c; - - const auto x = axis.x(); - const auto y = axis.y(); - const auto z = axis.z(); - - return Point_3( - (x * x * C + c) * query.x() + - (x * y * C - z * s) * query.y() + - (x * z * C + y * s) * query.z(), - (y * x * C + z * s) * query.x() + - (y * y * C + c) * query.y() + - (y * z * C - x * s) * query.z(), - (z * x * C - y * s) * query.x() + - (z * y * C + x * s) * query.y() + - (z * z * C + c) * query.z()); - } - - // Computes two 3D orthogonal base vectors wrt a given normal. - template - void orthogonal_bases_3( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& normal, - typename GeomTraits::Vector_3& b1, - typename GeomTraits::Vector_3& b2) { - - using Vector_3 = typename GeomTraits::Vector_3; - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - - const auto nx = normal.x(); - const auto ny = normal.y(); - const auto nz = normal.z(); - - if (CGAL::abs(nz) >= CGAL::abs(ny)) { - b1 = Vector_3(nz, 0, -nx); - } else { - b1 = Vector_3(ny, -nx, 0); - } - b2 = cross_product_3(normal, b1); - - normalize_3(traits, b1); - normalize_3(traits, b2); - } - - // Converts a 3D point into a 2D point wrt to a given plane. - template - typename GeomTraits::Point_2 to_2d( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& b1, - const typename GeomTraits::Vector_3& b2, - const typename GeomTraits::Point_3& origin, - const typename GeomTraits::Point_3& query) { - - using Point_2 = typename GeomTraits::Point_2; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v = construct_vector_3(origin, query); - const auto x = dot_product_3(b1, v); - const auto y = dot_product_3(b2, v); - return Point_2(x, y); - } - - // Flattening. - - // \cgalFigureBegin{flattening, flattening.svg} - // The non-planar configuration (top) is flattened to the planar configuration (bottom). - // \cgalFigureEnd - - // When computing weights for a query point \f$q\f$ with respect to its neighbors - // \f$p_0\f$, \f$p_1\f$, and \f$p_2\f$, the local configuration is a quadrilateral - // [\f$p_0\f$, \f$p_1\f$, \f$p_2\f$, \f$q\f$] or two connected triangles [\f$q\f$, \f$p_0\f$, \f$p_1\f$] - // and [\f$q\f$, \f$p_1\f$, \f$p_2\f$]. When working in 3D, these triangles are not - // necessarily coplanar, in other words, they do not belong to the same common plane. - // When they are not coplanar, they can be made coplanar through the process called *flattening* (see the Figure above), - // however the latter introduces a distortion because the weights are computed with respect to the - // flattened configuration rather than to the original non-flat configuration. - - // \subsection Weights_Examples_ProjectionTraits Computing 2D Weights in 3D - - // If you have a 2D polygon in 3D plane that is not an XY plane, you can still compute - // the 2D weights, however you need to provide a special projection traits class. - // The common plane that is used in this example is projectable to the XY plane. We first - // compute `Mean_value_weights_2` for a 3D polygon in this plane. We then also show how to use - // the projection traits to compute the \ref PkgWeightsRefWachspressWeights "2D Wachspress weight" - // for 3D points which are not strictly coplanar. - - // \cgalExample{Weights/projection_traits.cpp} - - // Example of flattening: - - // 3D configuration. - // const Point_3 p0(0, 1, 1); - // const Point_3 p1(2, 0, 1); - // const Point_3 p2(7, 1, 1); - // const Point_3 q0(3, 1, 1); - - // Choose a type of the weight: - // e.g. 0 - Wachspress (WP) weight. - // const FT wp = FT(0); - - // Compute WP weights for q1 which is not on the plane [p0, p1, p2]. - - // Point_3 q1(3, 1, 2); - // std::cout << "3D wachspress (WP, q1): "; - // std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << std::endl; - - // Converge q1 towards q0 that is we flatten the configuration. - // We also compare the result with the authalic weight. - - // std::cout << "Converge q1 to q0: " << std::endl; - // for (FT x = FT(0); x <= FT(1); x += step) { - // std::cout << "3D wachspress/authalic: "; - // q1 = Point_3(3, 1, FT(2) - x); - // std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << "/"; - // std::cout << CGAL::Weights::authalic_weight(p0, p1, p2, q1) << std::endl; - // } - - // Flattens an arbitrary quad into a planar quad. - template - void flatten( - const GeomTraits& traits, - const typename GeomTraits::Point_3& t, // prev neighbor/vertex/point - const typename GeomTraits::Point_3& r, // curr neighbor/vertex/point - const typename GeomTraits::Point_3& p, // next neighbor/vertex/point - const typename GeomTraits::Point_3& q, // query point - typename GeomTraits::Point_2& tf, - typename GeomTraits::Point_2& rf, - typename GeomTraits::Point_2& pf, - typename GeomTraits::Point_2& qf) { - - // std::cout << std::endl; - using Point_3 = typename GeomTraits::Point_3; - using Vector_3 = typename GeomTraits::Vector_3; - - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - const auto centroid_3 = - traits.construct_centroid_3_object(); - - // Compute centroid. - const auto center = centroid_3(t, r, p, q); - // std::cout << "centroid: " << center << std::endl; - - // Translate. - const Point_3 t1 = Point_3( - t.x() - center.x(), t.y() - center.y(), t.z() - center.z()); - const Point_3 r1 = Point_3( - r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); - const Point_3 p1 = Point_3( - p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); - const Point_3 q1 = Point_3( - q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); - - // std::cout << "translated t1: " << t1 << std::endl; - // std::cout << "translated r1: " << r1 << std::endl; - // std::cout << "translated p1: " << p1 << std::endl; - // std::cout << "translated q1: " << q1 << std::endl; - - // Middle axis. - auto ax = construct_vector_3(q1, r1); - normalize_3(traits, ax); - - // Prev and next vectors. - auto v1 = construct_vector_3(q1, t1); - auto v2 = construct_vector_3(q1, p1); - - normalize_3(traits, v1); - normalize_3(traits, v2); - - // Two triangle normals. - auto n1 = cross_product_3(v1, ax); - auto n2 = cross_product_3(ax, v2); - - normalize_3(traits, n1); - normalize_3(traits, n2); - - // std::cout << "normal n1: " << n1 << std::endl; - // std::cout << "normal n2: " << n2 << std::endl; - - // Angle between two normals. - const double angle_rad = angle_3(traits, n1, n2); - // std::cout << "angle deg n1 <-> n2: " << angle_rad * 180.0 / CGAL_PI << std::endl; - - // Rotate p1 around ax so that it lands onto the plane [q1, t1, r1]. - const auto& t2 = t1; - const auto& r2 = r1; - const auto p2 = rotate_point_3(traits, angle_rad, ax, p1); - const auto& q2 = q1; - // std::cout << "rotated p2: " << p2 << std::endl; - - // Compute orthogonal base vectors. - Vector_3 b1, b2; - const auto& normal = n1; - orthogonal_bases_3(traits, normal, b1, b2); - - // const auto angle12 = angle_3(traits, b1, b2); - // std::cout << "angle deg b1 <-> b2: " << angle12 * 180.0 / CGAL_PI << std::endl; - - // Flatten a quad. - const auto& origin = q2; - tf = to_2d(traits, b1, b2, origin, t2); - rf = to_2d(traits, b1, b2, origin, r2); - pf = to_2d(traits, b1, b2, origin, p2); - qf = to_2d(traits, b1, b2, origin, q2); - - // std::cout << "flattened qf: " << qf << std::endl; - // std::cout << "flattened tf: " << tf << std::endl; - // std::cout << "flattened rf: " << rf << std::endl; - // std::cout << "flattened pf: " << pf << std::endl; - - // std::cout << "A1: " << area_2(traits, rf, qf, pf) << std::endl; - // std::cout << "A2: " << area_2(traits, pf, qf, rf) << std::endl; - // std::cout << "C: " << area_2(traits, tf, rf, pf) << std::endl; - // std::cout << "B: " << area_2(traits, pf, qf, tf) << std::endl; - } - - // Computes area of a 2D triangle. - template - typename GeomTraits::FT area_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - const auto area_2 = traits.compute_area_2_object(); - return area_2(p, q, r); - } - - // Computes positive area of a 2D triangle. - template - typename GeomTraits::FT positive_area_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - return CGAL::abs(area_2(traits, p, q, r)); - } - - // Computes area of a 3D triangle. - template - typename GeomTraits::FT area_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; - using Vector_3 = typename GeomTraits::Vector_3; - - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - const auto centroid_3 = - traits.construct_centroid_3_object(); - - // Compute centroid. - const auto center = centroid_3(p, q, r); - - // Translate. - const Point_3 a = Point_3( - p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); - const Point_3 b = Point_3( - q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); - const Point_3 c = Point_3( - r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); - - // Prev and next vectors. - auto v1 = construct_vector_3(b, a); - auto v2 = construct_vector_3(b, c); - normalize_3(traits, v1); - normalize_3(traits, v2); - - // Compute normal. - auto normal = cross_product_3(v1, v2); - normalize_3(traits, normal); - - // Compute orthogonal base vectors. - Vector_3 b1, b2; - orthogonal_bases_3(traits, normal, b1, b2); - - // Compute area. - const auto& origin = b; - const auto pf = to_2d(traits, b1, b2, origin, a); - const auto qf = to_2d(traits, b1, b2, origin, b); - const auto rf = to_2d(traits, b1, b2, origin, c); - - const FT A = area_2(traits, pf, qf, rf); - return A; - } - - // Computes positive area of a 3D triangle. - template - typename GeomTraits::FT positive_area_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto cross = cross_product_3(v1, v2); - const FT half = FT(1) / FT(2); - const FT A = half * length_3(traits, cross); - return A; - } - - // Computes a clamped cotangent between two 3D vectors. - // In the old version of weights in PMP, it has been called secure. - // See Weights/internal/pmp_weights_deprecated.h for more information. - template - typename GeomTraits::FT cotangent_3_clamped( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const FT length_v1 = length_3(traits, v1); - const FT length_v2 = length_3(traits, v2); - - const FT lb = -FT(999) / FT(1000), ub = FT(999) / FT(1000); - FT cosine = dot / length_v1 / length_v2; - cosine = (cosine < lb) ? lb : cosine; - cosine = (cosine > ub) ? ub : cosine; - const FT sine = sqrt(FT(1) - cosine * cosine); - - CGAL_assertion(sine != FT(0)); - if (sine != FT(0)) { - return cosine / sine; - } - return FT(0); // undefined + static Sqrt sqrt_object(const Traits& traits) + { + return traits.sqrt_object(); } +}; + +template +void normalize(std::vector& values) +{ + FT sum = FT(0); + for (const FT& value : values) + sum += value; + + CGAL_assertion(!is_zero(sum)); + if (is_zero(sum)) + return; + + const FT inv_sum = FT(1) / sum; + for (FT& value : values) + value *= inv_sum; +} + +template +FT power(const FT value, + const FT p) +{ + const double base = CGAL::to_double(value); + const double exp = CGAL::to_double(p); + + return static_cast(std::pow(base, exp)); +} + +// 2D ============================================================================================== + +template +typename GeomTraits::FT distance_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using Get_sqrt = Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + auto squared_distance_2 = traits.compute_squared_distance_2_object(); + return sqrt(squared_distance_2(p, q)); +} + +template +typename GeomTraits::FT length_2(const typename GeomTraits::Vector_2& v, + const GeomTraits& traits) +{ + using Get_sqrt = Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + auto squared_length_2 = traits.compute_squared_length_2_object(); + return sqrt(squared_length_2(v)); +} + +template +void normalize_2(typename GeomTraits::Vector_2& v, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + const FT length = length_2(v, traits); + CGAL_assertion(!is_zero(length)); + if (is_zero(length)) + return; + + v /= length; +} + +// 3D ============================================================================================== + +template +typename GeomTraits::FT distance_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + auto squared_distance_3 = traits.compute_squared_distance_3_object(); + + using Get_sqrt = Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + return sqrt(squared_distance_3(p, q)); +} + +template +typename GeomTraits::FT length_3(const typename GeomTraits::Vector_3& v, + const GeomTraits& traits) +{ + using Get_sqrt = Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + auto squared_length_3 = traits.compute_squared_length_3_object(); + return sqrt(squared_length_3(v)); +} + +template +void normalize_3(typename GeomTraits::Vector_3& v, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + const FT length = length_3(v, traits); + CGAL_assertion(!is_zero(length)); + if (is_zero(length)) + return; + + v /= length; +} + +// the angle is in radians +template +double angle_3(const typename GeomTraits::Vector_3& v1, + const typename GeomTraits::Vector_3& v2, + const GeomTraits& traits) +{ + auto dot_product_3 = traits.compute_scalar_product_3_object(); + + const double product = CGAL::sqrt(to_double(dot_product_3(v1,v1) * dot_product_3(v2,v2))); + if(product == 0.) + return 0.; + + const double dot = CGAL::to_double(dot_product_3(v1, v2)); + const double cosine = dot / product; + + if (cosine < -1.0) + return std::acos(-1.0); + else if (cosine > 1.0) + return std::acos(+1.0); + else + return std::acos(cosine); +} + +// Rotates a 3D point around axis. +template +typename GeomTraits::Point_3 rotate_point_3(const double angle_rad, + const typename GeomTraits::Vector_3& axis, + const typename GeomTraits::Point_3& query, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + auto point_3 = traits.construct_point_3_object(); + + const FT c = static_cast(std::cos(angle_rad)); + const FT s = static_cast(std::sin(angle_rad)); + const FT C = FT(1) - c; + + const FT& x = axis.x(); + const FT& y = axis.y(); + const FT& z = axis.z(); + + return point_3( + (x * x * C + c) * query.x() + + (x * y * C - z * s) * query.y() + + (x * z * C + y * s) * query.z(), + (y * x * C + z * s) * query.x() + + (y * y * C + c) * query.y() + + (y * z * C - x * s) * query.z(), + (z * x * C - y * s) * query.x() + + (z * y * C + x * s) * query.y() + + (z * z * C + c) * query.z()); +} + +// Computes two 3D orthogonal base vectors wrt a given normal. +template +void orthogonal_bases_3(const typename GeomTraits::Vector_3& normal, + typename GeomTraits::Vector_3& b1, + typename GeomTraits::Vector_3& b2, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + + const FT& nx = normal.x(); + const FT& ny = normal.y(); + const FT& nz = normal.z(); + + if (CGAL::abs(nz) >= CGAL::abs(ny)) + b1 = Vector_3(nz, 0, -nx); + else + b1 = Vector_3(ny, -nx, 0); + + b2 = cross_product_3(normal, b1); + + normalize_3(b1, traits); + normalize_3(b2, traits); +} + +// Converts a 3D point into a 2D point wrt to a given plane. +template +typename GeomTraits::Point_2 to_2d(const typename GeomTraits::Vector_3& b1, + const typename GeomTraits::Vector_3& b2, + const typename GeomTraits::Point_3& origin, + const typename GeomTraits::Point_3& query, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + auto point_2 = traits.construct_point_2_object(); + + const Vector_3 v = vector_3(origin, query); + const FT x = dot_product_3(b1, v); + const FT y = dot_product_3(b2, v); + + return point_2(x, y); +} + +// Flattening. + +// \cgalFigureBegin{flattening, flattening.svg} +// The non-planar configuration (top) is flattened to the planar configuration (bottom). +// \cgalFigureEnd + +// When computing weights for a query point \f$q\f$ with respect to its neighbors +// \f$p_0\f$, \f$p_1\f$, and \f$p_2\f$, the local configuration is a quadrilateral +// [\f$p_0\f$, \f$p_1\f$, \f$p_2\f$, \f$q\f$] or two connected triangles [\f$q\f$, \f$p_0\f$, \f$p_1\f$] +// and [\f$q\f$, \f$p_1\f$, \f$p_2\f$]. When working in 3D, these triangles are not +// necessarily coplanar, in other words, they do not belong to the same common plane. +// When they are not coplanar, they can be made coplanar through the process called *flattening* (see the Figure above), +// however the latter introduces a distortion because the weights are computed with respect to the +// flattened configuration rather than to the original non-flat configuration. + +// \subsection Weights_Examples_ProjectionTraits Computing 2D Weights in 3D + +// If you have a 2D polygon in 3D plane that is not an XY plane, you can still compute +// the 2D weights, however you need to provide a special projection traits class. +// The common plane that is used in this example is projectable to the XY plane. We first +// compute `Mean_value_weights_2` for a 3D polygon in this plane. We then also show how to use +// the projection traits to compute the \ref PkgWeightsRefWachspressWeights "2D Wachspress weight" +// for 3D points which are not strictly coplanar. + +// \cgalExample{Weights/projection_traits.cpp} + +// Example of flattening: + +// 3D configuration. +// const Point_3 p0(0, 1, 1); +// const Point_3 p1(2, 0, 1); +// const Point_3 p2(7, 1, 1); +// const Point_3 q0(3, 1, 1); + +// Choose a type of the weight: +// e.g. 0 - Wachspress (WP) weight. +// const FT wp = FT(0); + +// Compute WP weights for q1 which is not on the plane [p0, p1, p2]. + +// Point_3 q1(3, 1, 2); +// std::cout << "3D wachspress (WP, q1): "; +// std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << std::endl; + +// Converge q1 towards q0 that is we flatten the configuration. +// We also compare the result with the authalic weight. + +// std::cout << "Converge q1 to q0: " << std::endl; +// for (FT x = FT(0); x <= FT(1); x += step) { +// std::cout << "3D wachspress/authalic: "; +// q1 = Point_3(3, 1, FT(2) - x); +// std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << "/"; +// std::cout << CGAL::Weights::authalic_weight(p0, p1, p2, q1) << std::endl; +// } + +// Flattens an arbitrary quad into a planar quad. +template +void flatten(const typename GeomTraits::Point_3& t, // prev neighbor/vertex/point + const typename GeomTraits::Point_3& r, // curr neighbor/vertex/point + const typename GeomTraits::Point_3& p, // next neighbor/vertex/point + const typename GeomTraits::Point_3& q, // query point + typename GeomTraits::Point_2& tf, + typename GeomTraits::Point_2& rf, + typename GeomTraits::Point_2& pf, + typename GeomTraits::Point_2& qf, + const GeomTraits& traits) +{ + // std::cout << std::endl; + using Point_3 = typename GeomTraits::Point_3; + using Vector_3 = typename GeomTraits::Vector_3; + + auto point_3 = traits.construct_point_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + auto centroid_3 = traits.construct_centroid_3_object(); + + // Compute centroid. + const Point_3 center = centroid_3(t, r, p, q); + // std::cout << "centroid: " << center << std::endl; + + // Translate. + const Point_3 t1 = point_3(t.x() - center.x(), t.y() - center.y(), t.z() - center.z()); + const Point_3 r1 = point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); + const Point_3 p1 = point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); + const Point_3 q1 = point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); + + // std::cout << "translated t1: " << t1 << std::endl; + // std::cout << "translated r1: " << r1 << std::endl; + // std::cout << "translated p1: " << p1 << std::endl; + // std::cout << "translated q1: " << q1 << std::endl; + + // Middle axis. + Vector_3 ax = vector_3(q1, r1); + normalize_3(ax, traits); + + // Prev and next vectors. + Vector_3 v1 = vector_3(q1, t1); + Vector_3 v2 = vector_3(q1, p1); + + // Two triangle normals. + Vector_3 n1 = cross_product_3(v1, ax); + Vector_3 n2 = cross_product_3(ax, v2); + + // std::cout << "normal n1: " << n1 << std::endl; + // std::cout << "normal n2: " << n2 << std::endl; + + // Angle between two normals. + const double angle_rad = angle_3(n1, n2, traits); + // std::cout << "angle deg n1 <-> n2: " << angle_rad * 180.0 / CGAL_PI << std::endl; + + // Rotate p1 around ax so that it lands onto the plane [q1, t1, r1]. + const Point_3& t2 = t1; + const Point_3& r2 = r1; + const Point_3 p2 = rotate_point_3(angle_rad, ax, p1, traits); + const Point_3& q2 = q1; + // std::cout << "rotated p2: " << p2 << std::endl; + + // Compute orthogonal base vectors. + Vector_3 b1, b2; + const Vector_3& normal = n1; + orthogonal_bases_3(normal, b1, b2, traits); + + // const Angle angle12 = angle_3(b1, b2, traits); + // std::cout << "angle deg b1 <-> b2: " << angle12 * 180.0 / CGAL_PI << std::endl; + + // Flatten a quad. + const Point_3& origin = q2; + tf = to_2d(b1, b2, origin, t2, traits); + rf = to_2d(b1, b2, origin, r2, traits); + pf = to_2d(b1, b2, origin, p2, traits); + qf = to_2d(b1, b2, origin, q2, traits); + + // std::cout << "flattened qf: " << qf << std::endl; + // std::cout << "flattened tf: " << tf << std::endl; + // std::cout << "flattened rf: " << rf << std::endl; + // std::cout << "flattened pf: " << pf << std::endl; + + // std::cout << "A1: " << area_2(rf, qf, pf, traits) << std::endl; + // std::cout << "A2: " << area_2(pf, qf, rf, traits) << std::endl; + // std::cout << "C: " << area_2(tf, rf, pf, traits) << std::endl; + // std::cout << "B: " << area_2(pf, qf, tf, traits) << std::endl; +} + +template +typename GeomTraits::FT positive_area_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + auto area_2 = traits.compute_area_2_object(); + return CGAL::abs(area_2(p, q, r)); +} + +template +typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + using Point_3 = typename GeomTraits::Point_3; + using Vector_3 = typename GeomTraits::Vector_3; + + auto area_2 = traits.compute_area_2_object(); + auto point_3 = traits.construct_point_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + auto centroid_3 = traits.construct_centroid_3_object(); + + // Compute centroid. + const Point_3 center = centroid_3(p, q, r); + + // Translate. + const Point_3 a = point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); + const Point_3 b = point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); + const Point_3 c = point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); + + // Prev and next vectors. + Vector_3 v1 = vector_3(b, a); + Vector_3 v2 = vector_3(b, c); + + // Compute normal. + Vector_3 normal = cross_product_3(v1, v2); + + // Compute orthogonal base vectors. + Vector_3 b1, b2; + orthogonal_bases_3(normal, b1, b2, traits); + + // Compute area. + const Point_3& origin = b; + const Point_2 pf = to_2d(b1, b2, origin, a, traits); + const Point_2 qf = to_2d(b1, b2, origin, b, traits); + const Point_2 rf = to_2d(b1, b2, origin, c, traits); + + return area_2(pf, qf, rf); +} + +// Computes positive area of a 3D triangle. +template +typename GeomTraits::FT positive_area_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using Get_sqrt = Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + auto squared_area_3 = traits.compute_squared_area_3_object(); + + return sqrt(squared_area_3(p, q, r)); +} } // namespace internal } // namespace Weights diff --git a/Weights/include/CGAL/Weights/inverse_distance_weights.h b/Weights/include/CGAL/Weights/inverse_distance_weights.h index 39dd22a189b..34e7a69bddd 100644 --- a/Weights/include/CGAL/Weights/inverse_distance_weights.h +++ b/Weights/include/CGAL/Weights/inverse_distance_weights.h @@ -14,219 +14,167 @@ #ifndef CGAL_INVERSE_DISTANCE_WEIGHTS_H #define CGAL_INVERSE_DISTANCE_WEIGHTS_H -// Internal includes. #include +#include +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace inverse_distance_ns { +/// \cond SKIP_IN_MANUAL +namespace inverse_distance_ns { - template - FT weight(const FT d) { +template +FT weight(const FT d) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(d)); + if (!is_zero(d)) + w = FT(1) / d; - FT w = FT(0); - CGAL_precondition(d != FT(0)); - if (d != FT(0)) { - w = FT(1) / d; - } - return w; - } - } - /// \endcond + return w; +} - #if defined(DOXYGEN_RUNNING) +} // namespace inverse_distance_ns - /*! - \ingroup PkgWeightsRefInverseDistanceWeights +/// \endcond - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - /*! - \ingroup PkgWeightsRefInverseDistanceWeights + const FT d = internal::distance_2(p, q, traits); + return inverse_distance_ns::weight(d); +} - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT inverse_distance_weight(const CGAL::Point_2&, + const CGAL::Point_2& p, + const CGAL::Point_2&, + const CGAL::Point_2& q) +#else +typename Kernel::FT inverse_distance_weight(const CGAL::Point_2& stub_l, + const CGAL::Point_2& p, + const CGAL::Point_2& stub_r, + const CGAL::Point_2& q) +#endif +{ + const Kernel traits; + return inverse_distance_weight(stub_l, p, stub_r, q, traits); +} - /*! - \ingroup PkgWeightsRefInverseDistanceWeights +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + typename GeomTraits::Point_2 stub; + return inverse_distance_weight(stub, p, stub, q, traits); +} - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ - template - typename K::FT inverse_distance_weight( - const CGAL::Point_2&, - const CGAL::Point_2& p, - const CGAL::Point_2&, - const CGAL::Point_2& q) { } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT inverse_distance_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + CGAL::Point_2 stub; + return inverse_distance_weight(stub, p, stub, q); +} - /*! - \ingroup PkgWeightsRefInverseDistanceWeights +// 3D ============================================================================================== - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ - template - typename K::FT inverse_distance_weight( - const CGAL::Point_3&, - const CGAL::Point_3& p, - const CGAL::Point_3&, - const CGAL::Point_3& q) { } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - /*! - \ingroup PkgWeightsRefInverseDistanceWeights + const FT d = internal::distance_3(p, q, traits); + return inverse_distance_ns::weight(d); +} - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT inverse_distance_weight(const CGAL::Point_3&, + const CGAL::Point_3& p, + const CGAL::Point_3&, + const CGAL::Point_3& q) +#else +typename Kernel::FT inverse_distance_weight(const CGAL::Point_3& stub_l, + const CGAL::Point_3& p, + const CGAL::Point_3& stub_r, + const CGAL::Point_3& q) +#endif +{ + const Kernel traits; + return inverse_distance_weight(stub_l, p, stub_r, q, traits); +} - /*! - \ingroup PkgWeightsRefInverseDistanceWeights +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + typename GeomTraits::Point_3 stub; + return inverse_distance_weight(stub, p, stub, q, traits); +} - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } - - /*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ - template - typename K::FT inverse_distance_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { } - - /*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ - template - typename K::FT inverse_distance_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { } - - #endif // DOXYGEN_RUNNING - - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const FT d = internal::distance_2(traits, q, r); - return inverse_distance_ns::weight(d); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return inverse_distance_weight(t, r, p, q, traits); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - - typename GeomTraits::Point_2 stub; - return inverse_distance_weight(stub, p, stub, q, traits); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - CGAL::Point_2 stub; - return inverse_distance_weight(stub, p, stub, q); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const FT d = internal::distance_3(traits, q, r); - return inverse_distance_ns::weight(d); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return inverse_distance_weight(t, r, p, q, traits); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - typename GeomTraits::Point_3 stub; - return inverse_distance_weight(stub, p, stub, q, traits); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - CGAL::Point_3 stub; - return inverse_distance_weight(stub, p, stub, q); - } - /// \endcond +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT inverse_distance_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + CGAL::Point_3 stub; + return inverse_distance_weight(stub, p, stub, q); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index 814ba883608..a7bd53e9d6c 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -14,498 +14,457 @@ #ifndef CGAL_MEAN_VALUE_WEIGHTS_H #define CGAL_MEAN_VALUE_WEIGHTS_H -// Internal includes. #include #include +#include +#include +#include +#include + +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace mean_value_ns { +/// \cond SKIP_IN_MANUAL - template - FT sign_of_weight(const FT A1, const FT A2, const FT B) { +namespace mean_value_ns { - if (A1 > FT(0) && A2 > FT(0) && B <= FT(0)) { - return +FT(1); - } - if (A1 < FT(0) && A2 < FT(0) && B >= FT(0)) { - return -FT(1); - } - if (B > FT(0)) { - return +FT(1); - } - if (B < FT(0)) { - return -FT(1); - } - return FT(0); - } +template +FT sign_of_weight(const FT A0, const FT A2, const FT B) +{ + if (A0 > FT(0) && A2 > FT(0) && B <= FT(0)) + return +FT(1); - template - typename GeomTraits::FT weight( - const GeomTraits& traits, - const typename GeomTraits::FT r1, - const typename GeomTraits::FT r2, - const typename GeomTraits::FT r3, - const typename GeomTraits::FT D1, - const typename GeomTraits::FT D2, - const typename GeomTraits::FT D, - const typename GeomTraits::FT sign) { + if (A0 < FT(0) && A2 < FT(0) && B >= FT(0)) + return -FT(1); - using FT = typename GeomTraits::FT; - using Get_sqrt = internal::Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + if (B > FT(0)) + return +FT(1); - const FT P1 = r1 * r2 + D1; - const FT P2 = r2 * r3 + D2; + if (B < FT(0)) + return -FT(1); - FT w = FT(0); - CGAL_precondition(P1 != FT(0) && P2 != FT(0)); - const FT prod = P1 * P2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - w = FT(2) * (r1 * r3 - D) * inv; - CGAL_assertion(w >= FT(0)); - w = sqrt(w); - } - w *= FT(2); w *= sign; - return w; - } + return FT(0); +} + +template +typename GeomTraits::FT weight(const typename GeomTraits::FT d0, + const typename GeomTraits::FT d2, + const typename GeomTraits::FT d, + const typename GeomTraits::FT D0, + const typename GeomTraits::FT D2, + const typename GeomTraits::FT D, + const typename GeomTraits::FT sign, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + using Get_sqrt = internal::Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + const FT P1 = d * d0 + D0; + const FT P2 = d * d2 + D2; + + FT w = FT(0); + CGAL_precondition(!is_zero(P1) && !is_zero(P2)); + const FT prod = P1 * P2; + if (!is_zero(prod)) + { + w = FT(2) * (d0 * d2 - D) / prod; + CGAL_assertion(w >= FT(0)); + w = sqrt(w); } - /// \endcond - #if defined(DOXYGEN_RUNNING) + w *= sign * FT(2); + return w; +} - /*! - \ingroup PkgWeightsRefMeanValueWeights +} // namespace mean_value_ns - \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT mean_value_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } +/// \endcond - /*! - \ingroup PkgWeightsRefMeanValueWeights +// 2D ============================================================================================== - \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT mean_value_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } +/*! + \ingroup PkgWeightsRefMeanValueWeights + \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; - #endif // DOXYGEN_RUNNING + auto vector_2 = traits.construct_vector_2_object(); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto area_2 = traits.compute_area_2_object(); + + const Vector_2 v1 = vector_2(q, p0); + const Vector_2 v = vector_2(q, p1); + const Vector_2 v2 = vector_2(q, p2); + + const FT d0 = internal::length_2(v1, traits); + const FT d = internal::length_2(v, traits); + const FT d2 = internal::length_2(v2, traits); + + const FT D0 = dot_product_2(v1, v); + const FT D2 = dot_product_2(v, v2); + const FT D = dot_product_2(v1, v2); + + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT B = area_2(p2, q, p0); + + const FT sign = mean_value_ns::sign_of_weight(A0, A2, B); + return mean_value_ns::weight(d0, d2, d, D0, D2, D, sign, traits); +} + +/*! + \ingroup PkgWeightsRefMeanValueWeights + \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT mean_value_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + const Kernel traits; + return mean_value_weight(p0, p1, p2, q, traits); +} + +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL + +template +typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2, q, + p0f, p1f, p2f, qf, + traits); + return CGAL::Weights::mean_value_weight(p0f, p1f, p2f, qf, traits); +} + +template +typename Kernel::FT mean_value_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + const Kernel traits; + return mean_value_weight(p0, p1, p2, q, traits); +} + +/// \endcond + +/*! + \ingroup PkgWeightsRefBarycentricMeanValueWeights + + \brief 2D mean value weights for polygons. + + This class implements 2D mean value weights (\cite cgal:bc:fhk-gcbcocp-06, \cite cgal:f-mvc-03, + \cite cgal:bc:hf-mvcapp-06) which can be computed at any point inside and outside a simple polygon. + + Mean value weights are well-defined inside and outside a simple polygon and are + non-negative in the kernel of a star-shaped polygon. These weights are computed + analytically using the formulation from `tangent_weight()`. + + \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and + value type is `Point_2`. The default is `CGAL::Identity_property_map`. + + \cgalModels `BarycentricWeights_2` +*/ +template > +class Mean_value_weights_2 +{ +public: + /// \name Types + /// @{ /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT mean_value_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); + using Vertex_range = VertexRange; + using Geom_traits = GeomTraits; + using Point_map = PointMap; - const auto v1 = construct_vector_2(q, t); - const auto v2 = construct_vector_2(q, r); - const auto v3 = construct_vector_2(q, p); - - const FT l1 = internal::length_2(traits, v1); - const FT l2 = internal::length_2(traits, v2); - const FT l3 = internal::length_2(traits, v3); - - const FT D1 = dot_product_2(v1, v2); - const FT D2 = dot_product_2(v2, v3); - const FT D = dot_product_2(v1, v3); - - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); - - const FT sign = mean_value_ns::sign_of_weight(A1, A2, B); - return mean_value_ns::weight( - traits, l1, l2, l3, D1, D2, D, sign); - } - - template - typename GeomTraits::FT mean_value_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return mean_value_weight(t, r, p, q, traits); - } - - namespace internal { - - template - typename GeomTraits::FT mean_value_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - mean_value_weight(tf, rf, pf, qf, traits); - } - - template - typename GeomTraits::FT mean_value_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return mean_value_weight(t, r, p, q, traits); - } - - } // namespace internal + using Vector_2 = typename GeomTraits::Vector_2; + using Area_2 = typename GeomTraits::Compute_area_2; + using Construct_vector_2 = typename GeomTraits::Construct_vector_2; + using Squared_length_2 = typename GeomTraits::Compute_squared_length_2; + using Scalar_product_2 = typename GeomTraits::Compute_scalar_product_2; + using Get_sqrt = internal::Get_sqrt; + using Sqrt = typename Get_sqrt::Sqrt; /// \endcond - /*! - \ingroup PkgWeightsRefBarycentricMeanValueWeights + /// Number type. + typedef typename GeomTraits::FT FT; - \brief 2D mean value weights for polygons. + /// Point type. + typedef typename GeomTraits::Point_2 Point_2; - This class implements 2D mean value weights ( \cite cgal:bc:hf-mvcapp-06, - \cite cgal:bc:fhk-gcbcocp-06, \cite cgal:f-mvc-03 ) which can be computed - at any point inside and outside a simple polygon. + /// @} - Mean value weights are well-defined inside and outside a simple polygon and are - non-negative in the kernel of a star-shaped polygon. These weights are computed - analytically using the formulation from the `tangent_weight()`. - - \tparam VertexRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \tparam PointMap - a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. - - \cgalModels `BarycentricWeights_2` - */ - template< - typename VertexRange, - typename GeomTraits, - typename PointMap = CGAL::Identity_property_map > - class Mean_value_weights_2 { - - public: - - /// \name Types - /// @{ - - /// \cond SKIP_IN_MANUAL - using Vertex_range = VertexRange; - using Geom_traits = GeomTraits; - using Point_map = PointMap; - - using Vector_2 = typename GeomTraits::Vector_2; - using Area_2 = typename GeomTraits::Compute_area_2; - using Construct_vector_2 = typename GeomTraits::Construct_vector_2; - using Squared_length_2 = typename GeomTraits::Compute_squared_length_2; - using Scalar_product_2 = typename GeomTraits::Compute_scalar_product_2; - using Get_sqrt = internal::Get_sqrt; - using Sqrt = typename Get_sqrt::Sqrt; - /// \endcond - - /// Number type. - typedef typename GeomTraits::FT FT; - - /// Point type. - typedef typename GeomTraits::Point_2 Point_2; - - /// @} - - /// \name Initialization - /// @{ - - /*! - \brief initializes all internal data structures. - - This class implements the behavior of mean value weights - for 2D query points inside simple polygons. - - \param polygon - an instance of `VertexRange` with the vertices of a simple polygon - - \param traits - a traits class with geometric objects, predicates, and constructions; - the default initialization is provided - - \param point_map - an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; - the default initialization is provided - - \pre polygon.size() >= 3 - \pre polygon is simple - */ - Mean_value_weights_2( - const VertexRange& polygon, - const GeomTraits traits = GeomTraits(), - const PointMap point_map = PointMap()) : - m_polygon(polygon), - m_traits(traits), - m_point_map(point_map), - m_area_2(m_traits.compute_area_2_object()), - m_construct_vector_2(m_traits.construct_vector_2_object()), - m_squared_length_2(m_traits.compute_squared_length_2_object()), - m_scalar_product_2(m_traits.compute_scalar_product_2_object()), - m_sqrt(Get_sqrt::sqrt_object(m_traits)) { - - CGAL_precondition( - polygon.size() >= 3); - CGAL_precondition( - internal::is_simple_2(polygon, traits, point_map)); - resize(); - } - - /// @} - - /// \name Access - /// @{ - - /*! - \brief computes 2D mean value weights. - - This function fills a destination range with 2D mean value weights computed at - the `query` point with respect to the vertices of the input polygon. - - The number of computed weights is equal to the number of polygon vertices. - - \tparam OutIterator - a model of `OutputIterator` whose value type is `FT` - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \return an output iterator to the element in the destination range, - one past the last weight stored - */ - template - OutIterator operator()(const Point_2& query, OutIterator w_begin) { - const bool normalize = false; - return operator()(query, w_begin, normalize); - } - - /// @} - - /// \cond SKIP_IN_MANUAL - template - OutIterator operator()(const Point_2& query, OutIterator weights, const bool normalize) { - return optimal_weights(query, weights, normalize); - } - /// \endcond - - private: - - // Fields. - const VertexRange& m_polygon; - const GeomTraits m_traits; - const PointMap m_point_map; - - const Area_2 m_area_2; - const Construct_vector_2 m_construct_vector_2; - const Squared_length_2 m_squared_length_2; - const Scalar_product_2 m_scalar_product_2; - const Sqrt m_sqrt; - - std::vector s; - std::vector r; - std::vector A; - std::vector D; - std::vector t; - std::vector w; - - // Functions. - void resize() { - s.resize(m_polygon.size()); - r.resize(m_polygon.size()); - A.resize(m_polygon.size()); - D.resize(m_polygon.size()); - t.resize(m_polygon.size()); - w.resize(m_polygon.size()); - } - - template - OutputIterator optimal_weights( - const Point_2& query, OutputIterator weights, const bool normalize) { - - // Get the number of vertices in the polygon. - const std::size_t n = m_polygon.size(); - - // Compute vectors s following the pseudo-code in the Figure 10 from [1]. - for (std::size_t i = 0; i < n; ++i) { - const auto& pi = get(m_point_map, *(m_polygon.begin() + i)); - s[i] = m_construct_vector_2(query, pi); - } - - // Compute lengths r, areas A, and dot products D following the pseudo-code - // in the Figure 10 from [1]. Split the loop to make this computation faster. - const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); - const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); - - r[0] = m_sqrt(m_squared_length_2(s[0])); - A[0] = m_area_2(p1, p2, query); - D[0] = m_scalar_product_2(s[0], s[1]); - - for (std::size_t i = 1; i < n - 1; ++i) { - const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); - const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); - - r[i] = m_sqrt(m_squared_length_2(s[i])); - A[i] = m_area_2(pi1, pi2, query); - D[i] = m_scalar_product_2(s[i], s[i + 1]); - } - - const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); - r[n - 1] = m_sqrt(m_squared_length_2(s[n - 1])); - A[n - 1] = m_area_2(pn, p1, query); - D[n - 1] = m_scalar_product_2(s[n - 1], s[0]); - - // Compute intermediate values t using the formulas from slide 19 here - // - http://www.inf.usi.ch/hormann/nsfworkshop/presentations/Hormann.pdf - for (std::size_t i = 0; i < n - 1; ++i) { - CGAL_assertion((r[i] * r[i + 1] + D[i]) != FT(0)); - t[i] = FT(2) * A[i] / (r[i] * r[i + 1] + D[i]); - } - - CGAL_assertion((r[n - 1] * r[0] + D[n - 1]) != FT(0)); - t[n - 1] = FT(2) * A[n - 1] / (r[n - 1] * r[0] + D[n - 1]); - - // Compute mean value weights using the same pseudo-code as before. - CGAL_assertion(r[0] != FT(0)); - w[0] = FT(2) * (t[n - 1] + t[0]) / r[0]; - - for (std::size_t i = 1; i < n - 1; ++i) { - CGAL_assertion(r[i] != FT(0)); - w[i] = FT(2) * (t[i - 1] + t[i]) / r[i]; - } - - CGAL_assertion(r[n - 1] != FT(0)); - w[n - 1] = FT(2) * (t[n - 2] + t[n - 1]) / r[n - 1]; - - // Normalize if necessary. - if (normalize) { - internal::normalize(w); - } - - // Return weights. - for (std::size_t i = 0; i < n; ++i) { - *(weights++) = w[i]; - } - return weights; - } - }; + /// \name Initialization + /// @{ /*! - \ingroup PkgWeightsRefBarycentricMeanValueWeights + \brief initializes all internal data structures. - \brief computes 2D mean value weights for polygons. + This class implements the behavior of mean value weights + for 2D query points inside simple polygons. - This function computes 2D mean value weights at a given `query` point - with respect to the vertices of a simple `polygon`, that is one - weight per vertex. The weights are stored in a destination range - beginning at `w_begin`. - - Internally, the class `Mean_value_weights_2` is used. If one wants to process - multiple query points, it is better to use that class. When using the free function, - internal memory is allocated for each query point, while when using the class, - it is allocated only once which is much more efficient. However, for a few query - points, it is easier to use this function. It can also be used when the processing - time is not a concern. - - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - and value type is `GeomTraits::Point_2` - - \tparam OutIterator - a model of `OutputIterator` whose value type is `GeomTraits::FT` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \param polygon - an instance of `PointRange` with 2D points which form a simple polygon - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \param traits - a traits class with geometric objects, predicates, and constructions; - this parameter can be omitted if the traits class can be deduced from the point type - - \return an output iterator to the element in the destination range, - one past the last weight stored + \param polygon an instance of `VertexRange` with the vertices of a simple polygon + \param traits a traits class with geometric objects, predicates, and constructions; + the default initialization is provided + \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; + the default initialization is provided \pre polygon.size() >= 3 \pre polygon is simple */ - template< - typename PointRange, - typename OutIterator, - typename GeomTraits> - OutIterator mean_value_weights_2( - const PointRange& polygon, const typename GeomTraits::Point_2& query, - OutIterator w_begin, const GeomTraits& traits) { - - Mean_value_weights_2 - mean_value(polygon, traits); - return mean_value(query, w_begin); + Mean_value_weights_2(const VertexRange& polygon, + const GeomTraits traits = GeomTraits(), + const PointMap point_map = PointMap()) + : m_polygon(polygon), + m_traits(traits), + m_point_map(point_map), + m_area_2(m_traits.compute_area_2_object()), + m_construct_vector_2(m_traits.construct_vector_2_object()), + m_squared_length_2(m_traits.compute_squared_length_2_object()), + m_scalar_product_2(m_traits.compute_scalar_product_2_object()), + m_sqrt(Get_sqrt::sqrt_object(m_traits)) + { + CGAL_precondition(polygon.size() >= 3); + CGAL_precondition(internal::is_simple_2(polygon, traits, point_map)); + resize(); } + /// @} + + /// \name Access + /// @{ + + /*! + \brief computes 2D mean value weights. + + This function fills a destination range with 2D mean value weights computed at + the `query` point with respect to the vertices of the input polygon. + + The number of computed weights is equal to the number of polygon vertices. + + \tparam OutIterator a model of `OutputIterator` whose value type is `FT` + + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + + \return an output iterator to the element in the destination range, one past the last weight stored + */ + template + OutIterator operator()(const Point_2& query, OutIterator w_begin) + { + const bool normalize = false; + return operator()(query, w_begin, normalize); + } + + /// @} + /// \cond SKIP_IN_MANUAL - template< - typename PointRange, - typename OutIterator> - OutIterator mean_value_weights_2( - const PointRange& polygon, - const typename PointRange::value_type& query, - OutIterator w_begin) { - using Point_2 = typename PointRange::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - const GeomTraits traits; - return mean_value_weights_2( - polygon, query, w_begin, traits); + template + OutIterator operator()(const Point_2& query, + OutIterator weights, + const bool normalize) + { + return optimal_weights(query, weights, normalize); } + /// \endcond +private: + const VertexRange& m_polygon; + const GeomTraits m_traits; + const PointMap m_point_map; + + const Area_2 m_area_2; + const Construct_vector_2 m_construct_vector_2; + const Squared_length_2 m_squared_length_2; + const Scalar_product_2 m_scalar_product_2; + const Sqrt m_sqrt; + + std::vector s; + std::vector r; + std::vector A; + std::vector D; + std::vector t; + std::vector w; + + void resize() + { + s.resize(m_polygon.size()); + r.resize(m_polygon.size()); + A.resize(m_polygon.size()); + D.resize(m_polygon.size()); + t.resize(m_polygon.size()); + w.resize(m_polygon.size()); + } + + template + OutputIterator optimal_weights(const Point_2& query, + OutputIterator weights, + const bool normalize) + { + const std::size_t n = m_polygon.size(); + + // Compute vectors s following the pseudo-code in the Figure 10 from [1]. + for (std::size_t i = 0; i < n; ++i) + { + const auto& pi = get(m_point_map, *(m_polygon.begin() + i)); + s[i] = m_construct_vector_2(query, pi); + } + + // Compute lengths r, areas A, and dot products D following the pseudo-code + // in the Figure 10 from [1]. Split the loop to make this computation faster. + const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); + const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); + + r[0] = m_sqrt(m_squared_length_2(s[0])); + A[0] = m_area_2(p1, p2, query); + D[0] = m_scalar_product_2(s[0], s[1]); + + for (std::size_t i = 1; i < n - 1; ++i) + { + const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); + const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); + + r[i] = m_sqrt(m_squared_length_2(s[i])); + A[i] = m_area_2(pi1, pi2, query); + D[i] = m_scalar_product_2(s[i], s[i + 1]); + } + + const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); + r[n - 1] = m_sqrt(m_squared_length_2(s[n - 1])); + A[n - 1] = m_area_2(pn, p1, query); + D[n - 1] = m_scalar_product_2(s[n - 1], s[0]); + + // Compute intermediate values t using the formulas from slide 19 here + // - http://www.inf.usi.ch/hormann/nsfworkshop/presentations/Hormann.pdf + for (std::size_t i = 0; i < n - 1; ++i) + { + CGAL_assertion((r[i] * r[i + 1] + D[i]) != FT(0)); + t[i] = FT(2) * A[i] / (r[i] * r[i + 1] + D[i]); + } + + CGAL_assertion((r[n - 1] * r[0] + D[n - 1]) != FT(0)); + t[n - 1] = FT(2) * A[n - 1] / (r[n - 1] * r[0] + D[n - 1]); + + // Compute mean value weights using the same pseudo-code as before. + CGAL_assertion(r[0] != FT(0)); + w[0] = FT(2) * (t[n - 1] + t[0]) / r[0]; + + for (std::size_t i = 1; i < n - 1; ++i) + { + CGAL_assertion(r[i] != FT(0)); + w[i] = FT(2) * (t[i - 1] + t[i]) / r[i]; + } + + CGAL_assertion(r[n - 1] != FT(0)); + w[n - 1] = FT(2) * (t[n - 2] + t[n - 1]) / r[n - 1]; + + // Normalize if necessary. + if (normalize) + internal::normalize(w); + + // Return weights. + for (std::size_t i = 0; i < n; ++i) + *(weights++) = w[i]; + + return weights; + } +}; + +/*! + \ingroup PkgWeightsRefBarycentricMeanValueWeights + + \brief computes 2D mean value weights for polygons. + + This function computes 2D mean value weights at a given `query` point + with respect to the vertices of a simple `polygon`, that is one + weight per vertex. The weights are stored in a destination range + beginning at `w_begin`. + + Internally, the class `Mean_value_weights_2` is used. If one wants to process + multiple query points, it is better to use that class. When using the free function, + internal memory is allocated for each query point, while when using the class, + it is allocated only once which is much more efficient. However, for a few query + points, it is easier to use this function. It can also be used when the processing + time is not a concern. + + \tparam PointRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + and value type is `GeomTraits::Point_2` + \tparam OutIterator a model of `OutputIterator` whose value type is `GeomTraits::FT` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + + \param polygon an instance of `PointRange` with 2D points which form a simple polygon + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + \param traits a traits class with geometric objects, predicates, and constructions; + this parameter can be omitted if the traits class can be deduced from the point type + + \return an output iterator to the element in the destination range, one past the last weight stored + + \pre `polygon.size() >= 3` + \pre `polygon` is simple +*/ +template +OutIterator mean_value_weights_2(const PointRange& polygon, + const typename GeomTraits::Point_2& query, + OutIterator w_begin, + const GeomTraits& traits) +{ + Mean_value_weights_2 mean_value(polygon, traits); + return mean_value(query, w_begin); +} + +/// \cond SKIP_IN_MANUAL + +template +OutIterator mean_value_weights_2(const PointRange& polygon, + const typename PointRange::value_type& query, + OutIterator w_begin) +{ + using Point_2 = typename PointRange::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + + const GeomTraits traits; + return mean_value_weights_2(polygon, query, w_begin, traits); +} + +/// \endcond + } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h index 579e8efda77..647e771a7c9 100644 --- a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h @@ -14,157 +14,115 @@ #ifndef CGAL_MIXED_VORONOI_REGION_WEIGHTS_H #define CGAL_MIXED_VORONOI_REGION_WEIGHTS_H -// Internal includes. #include +#include +#include + namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; - \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } + auto angle_2 = traits.angle_2_object(); + auto midpoint_2 = traits.construct_midpoint_2_object(); + auto circumcenter_2 = traits.construct_circumcenter_2_object(); - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights + Point_2 center; + if (angle_2(p, q, r) != CGAL::OBTUSE && + angle_2(q, r, p) != CGAL::OBTUSE && + angle_2(r, p, q) != CGAL::OBTUSE) + center = circumcenter_2(p, q, r); + else + center = midpoint_2(r, p); - \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } + const Point_2 m1 = midpoint_2(q, r); + const Point_2 m2 = midpoint_2(q, p); - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights + const FT A1 = internal::positive_area_2(q, m1, center, traits); + const FT A2 = internal::positive_area_2(q, center, m2, traits); - \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT mixed_voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } + return A1 + A2; +} - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename GeomTraits::FT mixed_voronoi_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return mixed_voronoi_area(p, q, r, traits); +} - \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT mixed_voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } +// 3D ============================================================================================== - #endif // DOXYGEN_RUNNING +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { + auto angle_3 = traits.angle_3_object(); + auto midpoint_3 = traits.construct_midpoint_3_object(); + auto circumcenter_3 = traits.construct_circumcenter_3_object(); - using FT = typename GeomTraits::FT; - using Point_2 = typename GeomTraits::Point_2; + Point_3 center; + if (angle_3(p, q, r) != CGAL::OBTUSE && + angle_3(q, r, p) != CGAL::OBTUSE && + angle_3(r, p, q) != CGAL::OBTUSE) + center = circumcenter_3(p, q, r); + else + center = midpoint_3(r, p); - const auto angle_2 = - traits.angle_2_object(); - const auto a1 = angle_2(p, q, r); - const auto a2 = angle_2(q, r, p); - const auto a3 = angle_2(r, p, q); + const Point_3 m1 = midpoint_3(q, r); + const Point_3 m2 = midpoint_3(q, p); - Point_2 center; - const auto midpoint_2 = - traits.construct_midpoint_2_object(); - if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) { - const auto circumcenter_2 = - traits.construct_circumcenter_2_object(); - center = circumcenter_2(p, q, r); - } else { - center = midpoint_2(r, p); - } + const FT A1 = internal::positive_area_3(q, m1, center, traits); + const FT A2 = internal::positive_area_3(q, center, m2, traits); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + return A1 + A2; +} - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); - return A1 + A2; - } - - template - typename GeomTraits::FT mixed_voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return mixed_voronoi_area(p, q, r, traits); - } - - template - typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; - - const auto angle_3 = - traits.angle_3_object(); - const auto a1 = angle_3(p, q, r); - const auto a2 = angle_3(q, r, p); - const auto a3 = angle_3(r, p, q); - - Point_3 center; - const auto midpoint_3 = - traits.construct_midpoint_3_object(); - if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) { - const auto circumcenter_3 = - traits.construct_circumcenter_3_object(); - center = circumcenter_3(p, q, r); - } else { - center = midpoint_3(r, p); - } - - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); - - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); - return A1 + A2; - } - - template - typename GeomTraits::FT mixed_voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return mixed_voronoi_area(p, q, r, traits); - } - /// \endcond +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT mixed_voronoi_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return mixed_voronoi_area(p, q, r, traits); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/shepard_weights.h b/Weights/include/CGAL/Weights/shepard_weights.h index 0a9fb5f8494..e510cbd6507 100644 --- a/Weights/include/CGAL/Weights/shepard_weights.h +++ b/Weights/include/CGAL/Weights/shepard_weights.h @@ -14,251 +14,178 @@ #ifndef CGAL_SHEPARD_WEIGHTS_H #define CGAL_SHEPARD_WEIGHTS_H -// Internal includes. #include +#include +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace shepard_ns { +/// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT weight( - const GeomTraits& traits, - const typename GeomTraits::FT d, - const typename GeomTraits::FT p) { +namespace shepard_ns { - using FT = typename GeomTraits::FT; - FT w = FT(0); - CGAL_precondition(d != FT(0)); - if (d != FT(0)) { - FT denom = d; - if (p != FT(1)) { - denom = internal::power(traits, d, p); - } - w = FT(1) / denom; - } - return w; - } - } - /// \endcond +template +FT weight(const FT d, const FT p) +{ + FT w = FT(0); + CGAL_precondition(is_positive(d)); + if(is_positive(d)) + w = internal::power(d, -p); - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefShepardWeights +} // namespace shepard_ns - \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } +/// \endcond - /*! - \ingroup PkgWeightsRefShepardWeights +// 2D ============================================================================================== - \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + const FT d = internal::distance_2(p, q, traits); + return shepard_ns::weight(d, a); +} - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q`, and the power parameter `a` + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT shepard_weight(const CGAL::Point_2&, + const CGAL::Point_2& p^, + const CGAL::Point_2&, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) +#else +typename Kernel::FT shepard_weight(const CGAL::Point_2& stub_l, + const CGAL::Point_2& p, + const CGAL::Point_2& stub_r, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) +#endif +{ + const Kernel traits; + return shepard_weight(stub_l, p, stub_r, q, a, traits); +} - \brief computes the Shepard weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( - const CGAL::Point_2&, - const CGAL::Point_2& p, - const CGAL::Point_2&, - const CGAL::Point_2& q, - const typename K::FT a = typename K::FT(1)) { } +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + typename GeomTraits::Point_2 stub; + return shepard_weight(stub, p, stub, q, a, traits); +} - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q`, and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT shepard_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) +{ + CGAL::Point_2 stub; + return shepard_weight(stub, p, stub, q, a); +} - \brief computes the Shepard weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( - const CGAL::Point_3&, - const CGAL::Point_3& p, - const CGAL::Point_3&, - const CGAL::Point_3& q, - const typename K::FT a = typename K::FT(1)) { } +// 3D ============================================================================================== - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + const FT d = internal::distance_3(p, q, traits); + return shepard_ns::weight(d, a); +} - \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q`, and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT shepard_weight(const CGAL::Point_3& p, + const CGAL::Point_3&, + const CGAL::Point_3& q, + const CGAL::Point_3&, + const typename Kernel::FT a = {1}) +#else +typename Kernel::FT shepard_weight(const CGAL::Point_3& stub_l, + const CGAL::Point_3& p, + const CGAL::Point_3& stub_r, + const CGAL::Point_3& q, + const typename Kernel::FT a = {1}) +#endif +{ + const Kernel traits; + return shepard_weight(stub_l, p, stub_r, q, a, traits); +} - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + typename GeomTraits::Point_3 stub; + return shepard_weight(stub, p, stub, q, a, traits); +} - \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } - - /*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename K::FT a = typename K::FT(1)) { } - - /*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename K::FT a = typename K::FT(1)) { } - - #endif // DOXYGEN_RUNNING - - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const FT d = internal::distance_2(traits, q, r); - return shepard_ns::weight(traits, d, a); - } - - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - const GeomTraits traits; - return shepard_weight(t, r, p, q, a, traits); - } - - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { - - typename GeomTraits::Point_2 stub; - return shepard_weight(stub, p, stub, q, a, traits); - } - - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - CGAL::Point_2 stub; - return shepard_weight(stub, p, stub, q, a); - } - - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const FT d = internal::distance_3(traits, q, r); - return shepard_ns::weight(traits, d, a); - } - - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - const GeomTraits traits; - return shepard_weight(t, r, p, q, a, traits); - } - - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { - - typename GeomTraits::Point_3 stub; - return shepard_weight(stub, p, stub, q, a, traits); - } - - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - CGAL::Point_3 stub; - return shepard_weight(stub, p, stub, q, a); - } - /// \endcond +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q`, and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT shepard_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const typename Kernel::FT a = {1}) +{ + CGAL::Point_3 stub; + return shepard_weight(stub, p, stub, q, a); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index da4c87d0fdd..7788a961218 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -14,495 +14,507 @@ #ifndef CGAL_TANGENT_WEIGHTS_H #define CGAL_TANGENT_WEIGHTS_H -// Internal includes. -#include +#include + +#include +#include + +#include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace tangent_ns { +/// \cond SKIP_IN_MANUAL - template - FT half_angle_tangent(const FT r, const FT d, const FT A, const FT D) { +namespace tangent_ns { - FT t = FT(0); - const FT P = r * d + D; - CGAL_precondition(P != FT(0)); - if (P != FT(0)) { - const FT inv = FT(2) / P; - t = A * inv; - } - return t; - } +template +FT half_weight(const FT t, const FT r) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(r)); + if (!is_zero(r)) + w = FT(2) * t / r; - template - FT half_weight(const FT t, const FT r) { + return w; +} - FT w = FT(0); - CGAL_precondition(r != FT(0)); - if (r != FT(0)) { - const FT inv = FT(2) / r; - w = t * inv; - } - return w; - } +template +FT weight(const FT t0, const FT t2, const FT r) +{ + FT w = FT(0); + CGAL_precondition(r != FT(0)); + if (r != FT(0)) + w = FT(2) * (t0 + t2) / r; - template - FT weight(const FT t1, const FT t2, const FT r) { + return w; +} - FT w = FT(0); - CGAL_precondition(r != FT(0)); - if (r != FT(0)) { - const FT inv = FT(2) / r; - w = (t1 + t2) * inv; - } - return w; - } +template +FT weight(const FT d0, const FT d2, const FT d, + const FT A0, const FT A2, + const FT D0, const FT D2) +{ + const FT P0 = d * d0 + D0; + const FT P2 = d * d2 + D2; - template - FT weight( - const FT d1, const FT r, const FT d2, - const FT A1, const FT A2, - const FT D1, const FT D2) { - - const FT P1 = d1 * r + D1; - const FT P2 = d2 * r + D2; - - FT w = FT(0); - CGAL_precondition(P1 != FT(0) && P2 != FT(0)); - if (P1 != FT(0) && P2 != FT(0)) { - const FT inv1 = FT(2) / P1; - const FT inv2 = FT(2) / P2; - const FT t1 = A1 * inv1; - const FT t2 = A2 * inv2; - w = weight(t1, t2, r); - } - return w; - } - - // This is positive case only. - // This version is based on the positive area. - // This version is more precise for all positive cases. - template - typename GeomTraits::FT tangent_weight_v1( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, t); - const auto v2 = construct_vector_3(q, r); - const auto v3 = construct_vector_3(q, p); - - const FT l1 = internal::length_3(traits, v1); - const FT l2 = internal::length_3(traits, v2); - const FT l3 = internal::length_3(traits, v3); - - const FT A1 = internal::positive_area_3(traits, r, q, t); - const FT A2 = internal::positive_area_3(traits, p, q, r); - - const FT D1 = dot_product_3(v1, v2); - const FT D2 = dot_product_3(v2, v3); - - return weight(l1, l2, l3, A1, A2, D1, D2); - } - - // This version handles both positive and negative cases. - // However, it is less precise. - template - typename GeomTraits::FT tangent_weight_v2( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - auto v1 = construct_vector_3(q, t); - auto v2 = construct_vector_3(q, r); - auto v3 = construct_vector_3(q, p); - - const FT l2 = internal::length_3(traits, v2); - - internal::normalize_3(traits, v1); - internal::normalize_3(traits, v2); - internal::normalize_3(traits, v3); - - const double ha_rad_1 = internal::angle_3(traits, v1, v2) / 2.0; - const double ha_rad_2 = internal::angle_3(traits, v2, v3) / 2.0; - const FT t1 = static_cast(std::tan(ha_rad_1)); - const FT t2 = static_cast(std::tan(ha_rad_2)); - - return weight(t1, t2, l2); - } - } - /// \endcond - - /*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent of the half angle. - - This function computes the tangent of the half angle using the precomputed - distance, area, and dot product values. The returned value is - \f$\frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. - - \tparam FT - a model of `FieldNumberType` - - \param d - the distance value - - \param l - the distance value - - \param A - the area value - - \param D - the dot product value - - \pre (d * l + D) != 0 - - \sa `half_tangent_weight()` - */ - template - FT tangent_half_angle(const FT d, const FT l, const FT A, const FT D) { - return tangent_ns::half_angle_tangent(d, l, A, D); + FT w = FT(0); + CGAL_precondition(!is_zero(P0) && !is_zero(P2)); + if (!is_zero(P0) && !is_zero(P2)) + { + const FT t0 = FT(2) * A0 / P0; + const FT t2 = FT(2) * A2 / P2; + w = weight(t0, t2, d); } - /*! - \ingroup PkgWeightsRefTangentWeights + return w; +} - \brief computes the half value of the tangent weight. +// This is positive case only. +// This version is based on the positive area. +// This version is more precise for all positive cases. +template +typename GeomTraits::FT tangent_weight_v1(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - This function constructs the half of the tangent weight using the precomputed - half angle tangent and distance values. The returned value is - \f$\frac{2\textbf{tan05}}{\textbf{d}}\f$. + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); - \tparam FT - a model of `FieldNumberType` + const Vector_3 v0 = vector_3(q, p0); + const Vector_3 v = vector_3(q, p1); + const Vector_3 v2 = vector_3(q, p2); - \param tan05 - the half angle tangent value + const FT d0 = internal::length_3(v0, traits); + const FT d = internal::length_3(v, traits); + const FT d2 = internal::length_3(v2, traits); - \param d - the distance value + const FT A0 = internal::positive_area_3(p1, q, p0, traits); + const FT A2 = internal::positive_area_3(p2, q, p1, traits); - \pre d != 0 + const FT D0 = dot_product_3(v0, v); + const FT D2 = dot_product_3(v, v2); - \sa `tangent_half_angle()` - \sa `tangent_weight()` - */ - template - FT half_tangent_weight(const FT tan05, const FT d) { - return tangent_ns::half_weight(tan05, d); - } + return weight(d0, d2, d, A0, A2, D0, D2); +} - /*! - \ingroup PkgWeightsRefTangentWeights +// This version handles both positive and negative cases. +// However, it is less precise. +template +typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - \brief computes the half value of the tangent weight. + auto vector_3 = traits.construct_vector_3_object(); - This function constructs the half of the tangent weight using the precomputed - distance, area, and dot product values. The returned value is - \f$\frac{2\textbf{t}}{\textbf{d}}\f$ where - \f$\textbf{t} = \frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. + Vector_3 v0 = vector_3(q, p0); + Vector_3 v = vector_3(q, p1); + Vector_3 v2 = vector_3(q, p2); - \tparam FT - a model of `FieldNumberType` + const FT l2 = internal::length_3(v, traits); - \param d - the distance value + const double ha_rad_1 = internal::angle_3(v0, v, traits) / 2.0; + const double ha_rad_2 = internal::angle_3(v, v2, traits) / 2.0; + const FT t0 = static_cast(std::tan(ha_rad_1)); + const FT t2 = static_cast(std::tan(ha_rad_2)); - \param l - the distance value + return weight(t0, t2, l2); +} - \param A - the area value +} // namespace tangent_ns - \param D - the dot product value +/// \endcond - \pre (d * l + D) != 0 && d != 0 +// 2D ============================================================================================== - \sa `tangent_weight()` - */ - template - FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) { - const FT tan05 = tangent_half_angle(d, l, A, D); - return half_tangent_weight(tan05, d); - } +/*! + \ingroup PkgWeightsRefTangentWeights - #if defined(DOXYGEN_RUNNING) + \brief computes the half value of the tangent weight. - /*! - \ingroup PkgWeightsRefTangentWeights + This function constructs the half of the tangent weight using the precomputed + half angle tangent and distance values. The returned value is + \f$\frac{2\textbf{tan05}}{\textbf{d}}\f$. - \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } + \tparam FT a model of `FieldNumberType` - /*! - \ingroup PkgWeightsRefTangentWeights + \param tan05 the half angle tangent value + \param d the distance value - \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_3& p0, - const typename GeomTraits::Point_3& p1, - const typename GeomTraits::Point_3& p2, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } + \pre d != 0 - /*! - \ingroup PkgWeightsRefTangentWeights + \sa `tangent_half_angle()` + \sa `tangent_weight()` +*/ +template +FT half_tangent_weight(const FT tan05, const FT d) +{ + return tangent_ns::half_weight(tan05, d); +} - \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT tangent_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } +/*! + \ingroup PkgWeightsRefTangentWeights - /*! - \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent of the half angle. - \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT tangent_weight( - const CGAL::Point_3& p0, - const CGAL::Point_3& p1, - const CGAL::Point_3& p2, - const CGAL::Point_3& q) { } + This function computes the tangent of the half angle using the precomputed + distance, area, and dot product values. The returned value is + \f$\frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. - #endif // DOXYGEN_RUNNING + \tparam FT a model of `FieldNumberType` - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { + \param d the distance value + \param l the distance value + \param A the area value + \param D the dot product value - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); + \pre (d * l + D) != 0 - const auto v1 = construct_vector_2(q, t); - const auto v2 = construct_vector_2(q, r); - const auto v3 = construct_vector_2(q, p); + \sa `half_tangent_weight()` +*/ +template +FT tangent_half_angle(const FT d, const FT l, const FT A, const FT D) +{ + // tan(theta/2) = sin(theta) / ( 1 + cos(theta) ), also = (1 - cos(theta)) / sin(theta). + // = ( 2*A / |v1|*|v2| ) / ( 1 + v1.v2 / |v1|*|v2| ) + // = 2*A / ( |v1|*|v2| + v1.v2 ) - const FT l1 = internal::length_2(traits, v1); - const FT l2 = internal::length_2(traits, v2); - const FT l3 = internal::length_2(traits, v3); + FT t = FT(0); + const FT P = d * l + D; + CGAL_precondition(!is_zero(P)); + if (!is_zero(P)) + t = FT(2) * A / P; - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); + return t; +} - const FT D1 = dot_product_2(v1, v2); - const FT D2 = dot_product_2(v2, v3); +/*! + \ingroup PkgWeightsRefTangentWeights - return tangent_ns::weight( - l1, l2, l3, A1, A2, D1, D2); - } + \brief computes the half value of the tangent weight. - template - typename GeomTraits::FT tangent_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { + This function constructs the half of the tangent weight using the precomputed + distance, area, and dot product values. The returned value is + \f$\frac{2\textbf{t}}{\textbf{d}}\f$ where + \f$\textbf{t} = \frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. - const GeomTraits traits; - return tangent_weight(t, r, p, q, traits); - } + \tparam FT a model of `FieldNumberType` - template - typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { + \param d the distance value + \param l the distance value + \param A the area value + \param D the dot product value - // return tangent_ns::tangent_weight_v1(t, r, p, q, traits); - return tangent_ns::tangent_weight_v2(t, r, p, q, traits); - } + \pre (d * l + D) != 0 && d != 0 - template - typename GeomTraits::FT tangent_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { + \sa `tangent_weight()` +*/ +template +FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) +{ + const FT tan05 = tangent_half_angle(d, l, A, D); + return tangent_ns::half_weight(tan05, d); +} - const GeomTraits traits; - return tangent_weight(t, r, p, q, traits); - } +/// \cond SKIP_IN_MANUAL - // Undocumented tangent weight class. - // Its constructor takes a polygon mesh and a vertex to point map - // and its operator() is defined based on the halfedge_descriptor only. - // This version is currently used in: - // Surface_mesh_parameterizer -> Iterative_authalic_parameterizer_3.h - template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> - class Edge_tangent_weight { +template +typename GeomTraits::FT half_tangent_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& p2, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; + auto vector_2 = traits.construct_vector_2_object(); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto area_2 = traits.compute_area_2_object(); - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - const GeomTraits m_traits; + const Vector_2 v0 = vector_2(q, p0); + const Vector_2 v2 = vector_2(q, p2); - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + const FT l0 = internal::length_2(v0, traits); + const FT l2 = internal::length_2(v2, traits); + const FT A = area_2(p2, q, p0); + const FT D = dot_product_2(v0, v2); - Edge_tangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) : - m_pmesh(pmesh), m_pmap(pmap), m_traits() { } + return half_tangent_weight(l0, l2, A, D); +} - FT operator()(const halfedge_descriptor he) const { +template +typename GeomTraits::FT half_tangent_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& p2, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) { - const auto h1 = next(he, m_pmesh); + auto vector_3 = traits.construct_vector_3_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); + const Vector_3 v0 = vector_3(q, p0); + const Vector_3 v2 = vector_3(q, p2); - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); + const FT l0 = internal::length_3(v0, traits); + const FT l2 = internal::length_3(v2, traits); + const FT A = internal::area_3(p2, q, p0, traits); + const FT D = dot_product_3(v0, v2); - weight = internal::tangent_3(m_traits, p0, p2, p1); + return half_tangent_weight(l0, l2, A, D); +} - } else { - const auto h1 = next(he, m_pmesh); - const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); +/// \endcond - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - const auto v3 = source(h2, m_pmesh); +// 2D ============================================================================================== - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, and `p2` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; - weight = tangent_weight(p2, p1, p3, p0) / FT(2); - } - return weight; + auto vector_2 = traits.construct_vector_2_object(); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto area_2 = traits.compute_area_2_object(); + + const Vector_2 v0 = vector_2(q, p0); + const Vector_2 v = vector_2(q, p1); + const Vector_2 v2 = vector_2(q, p2); + + const FT l0 = internal::length_2(v0, traits); + const FT l = internal::length_2(v, traits); + const FT l2 = internal::length_2(v2, traits); + + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + + const FT D0 = dot_product_2(v0, v); + const FT D2 = dot_product_2(v, v2); + + return tangent_ns::weight(l0, l2, l, A0, A2, D0, D2); +} + +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, and `p2` + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT tangent_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + const Kernel traits; + return tangent_weight(p0, p1, p2, q, traits); +} + +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, and `p2` + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ +// return tangent_ns::tangent_weight_v1(p0, p1, p2, q, traits); + return tangent_ns::tangent_weight_v2(p0, p1, p2, q, traits); +} + +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, and `p2` + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT tangent_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + const Kernel traits; + return tangent_weight(p0, p1, p2, q, traits); +} + +/// \cond SKIP_IN_MANUAL + +// Undocumented tangent weight class. +// +// Its constructor takes a polygon mesh and a vertex to point map +// and its operator() is defined based on the halfedge_descriptor only. +// This version is currently used in: +// Surface_mesh_parameterizer -> Iterative_authalic_parameterizer_3.h +template< + typename PolygonMesh, + typename VertexPointMap, + typename GeomTraits> +class Edge_tangent_weight +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + using Point_ref = typename boost::property_traits::reference; + using FT = typename GeomTraits::FT; + + const PolygonMesh& m_pmesh; + const VertexPointMap m_pmap; + const GeomTraits m_traits; + +public: + + Edge_tangent_weight(const PolygonMesh& pmesh, + const VertexPointMap pmap, + const GeomTraits& traits) + : m_pmesh(pmesh), m_pmap(pmap), m_traits(traits) + { } + + FT operator()(halfedge_descriptor he) const + { + if(is_border(he, m_pmesh)) + return FT(0); + + FT weight = FT(0); + if (is_border_edge(he, m_pmesh)) // ie, opp(he, pmesh) is a border halfedge + { + const halfedge_descriptor h1 = next(he, m_pmesh); + + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(h1, m_pmesh); + + const Point_ref p0 = get(m_pmap, v0); + const Point_ref p1 = get(m_pmap, v1); + const Point_ref p2 = get(m_pmap, v2); + + weight = half_tangent_weight(p1, p0, p2, m_traits) / FT(2); } - }; + else + { + const halfedge_descriptor h1 = next(he, m_pmesh); + const halfedge_descriptor h2 = prev(opposite(he, m_pmesh), m_pmesh); - // Undocumented tangent weight class. - // Its constructor takes three points either in 2D or 3D. - // This version is currently used in: - // Surface_mesh_parameterizer -> MVC_post_processor_3.h - // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h - template - class Tangent_weight { - FT m_d_r, m_d_p, m_w_base; + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(h1, m_pmesh); + const vertex_descriptor v3 = source(h2, m_pmesh); - public: - template - Tangent_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { + const Point_ref p0 = get(m_pmap, v0); + const Point_ref p1 = get(m_pmap, v1); + const Point_ref p2 = get(m_pmap, v2); + const Point_ref p3 = get(m_pmap, v3); - const GeomTraits traits; - const auto scalar_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - m_d_r = internal::distance_2(traits, q, r); - CGAL_assertion(m_d_r != FT(0)); // two points are identical! - m_d_p = internal::distance_2(traits, q, p); - CGAL_assertion(m_d_p != FT(0)); // two points are identical! - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - - const auto A = internal::positive_area_2(traits, p, q, r); - CGAL_assertion(A != FT(0)); // three points are identical! - const auto S = scalar_product_2(v1, v2); - m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); + weight = tangent_weight(p2, p1, p3, p0, m_traits) / FT(2); } + return weight; + } +}; - template - Tangent_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { +// Undocumented tangent weight class. +// Returns - std::tan(theta/2); uses positive areas. +// +// Its constructor takes three points either in 2D or 3D. +// This version is currently used in: +// Surface_mesh_parameterizer -> MVC_post_processor_3.h +// Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h +template +class Tangent_weight +{ + FT m_d_r, m_d_p, m_w_base; - const GeomTraits traits; - const auto scalar_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); +public: + template + Tangent_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) + { + const Kernel traits; - m_d_r = internal::distance_3(traits, q, r); - CGAL_assertion(m_d_r != FT(0)); // two points are identical! - m_d_p = internal::distance_3(traits, q, p); - CGAL_assertion(m_d_p != FT(0)); // two points are identical! + using Vector_2 = typename Kernel::Vector_2; - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + auto vector_2 = traits.construct_vector_2_object(); + auto scalar_product_2 = traits.compute_scalar_product_2_object(); - const auto A = internal::positive_area_3(traits, p, q, r); - CGAL_assertion(A != FT(0)); // three points are identical! - const auto S = scalar_product_3(v1, v2); - m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); - } + m_d_r = internal::distance_2(q, r, traits); + CGAL_assertion(is_positive(m_d_r)); // two points are identical! + m_d_p = internal::distance_2(q, p, traits); + CGAL_assertion(is_positive(m_d_p)); // two points are identical! - FT get_w_r() const { - return half_tangent_weight(m_w_base, m_d_r) / FT(2); - } + const Vector_2 v1 = vector_2(q, r); + const Vector_2 v2 = vector_2(q, p); - FT get_w_p() const { - return half_tangent_weight(m_w_base, m_d_p) / FT(2); - } - }; + const FT A = internal::positive_area_2(p, q, r, traits); + CGAL_assertion(!is_zero(A)); - /// \endcond + const FT S = scalar_product_2(v1, v2); + m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); + } + + template + Tangent_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) + { + const Kernel traits; + + using Vector_3 = typename Kernel::Vector_3; + + auto vector_3 = traits.construct_vector_3_object(); + auto scalar_product_3 = traits.compute_scalar_product_3_object(); + + m_d_r = internal::distance_3(q, r, traits); + CGAL_assertion(is_positive(m_d_r)); // two points are identical! + m_d_p = internal::distance_3(q, p, traits); + CGAL_assertion(is_positive(m_d_p)); // two points are identical! + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); + + const FT A = internal::positive_area_3(p, q, r, traits); + CGAL_assertion(is_positive(A)); + + const FT S = scalar_product_3(v1, v2); + m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); + } + + FT get_w_r() const + { + return half_tangent_weight(m_w_base, m_d_r) / FT(2); + } + + FT get_w_p() const + { + return half_tangent_weight(m_w_base, m_d_p) / FT(2); + } +}; + +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/three_point_family_weights.h b/Weights/include/CGAL/Weights/three_point_family_weights.h index eca32f1b281..51bdf0eeb51 100644 --- a/Weights/include/CGAL/Weights/three_point_family_weights.h +++ b/Weights/include/CGAL/Weights/three_point_family_weights.h @@ -14,155 +14,122 @@ #ifndef CGAL_THREE_POINT_FAMILY_WEIGHTS_H #define CGAL_THREE_POINT_FAMILY_WEIGHTS_H -// Internal includes. #include +#include +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace three_point_family_ns { +/// \cond SKIP_IN_MANUAL +namespace three_point_family_ns { - template - typename GeomTraits::FT weight( - const GeomTraits& traits, - const typename GeomTraits::FT d1, - const typename GeomTraits::FT d2, - const typename GeomTraits::FT d3, - const typename GeomTraits::FT A1, - const typename GeomTraits::FT A2, - const typename GeomTraits::FT B, - const typename GeomTraits::FT p) { +template +FT weight(const FT d0, const FT d2, const FT d, + const FT A0, const FT A2, const FT B, + const FT p) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(A0) && !is_zero(A2)); + const FT prod = A0 * A2; + if (!is_zero(prod)) + { + const FT r0 = internal::power(d0, p); + const FT r = internal::power(d , p); + const FT r2 = internal::power(d2, p); - using FT = typename GeomTraits::FT; - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - FT r1 = d1; - FT r2 = d2; - FT r3 = d3; - if (p != FT(1)) { - r1 = internal::power(traits, d1, p); - r2 = internal::power(traits, d2, p); - r3 = internal::power(traits, d3, p); - } - w = (r3 * A1 - r2 * B + r1 * A2) * inv; - } - return w; - } + w = (r2 * A0 - r * B + r0 * A2) / prod; } - /// \endcond + return w; +} - #if defined(DOXYGEN_RUNNING) +} // namespace three_point_family_ns - /*! - \ingroup PkgWeightsRefThreePointFamilyWeights +/// \endcond - \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, - and `p2` and the power parameter `a`, given a traits class `traits` with geometric objects, - predicates, and constructions. - */ - template - typename GeomTraits::FT three_point_family_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefThreePointFamilyWeights +/*! + \ingroup PkgWeightsRefThreePointFamilyWeights + \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1` and `p2`, + and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT three_point_family_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q, - const typename K::FT a = typename K::FT(1)) { } + auto area_2 = traits.compute_area_2_object(); - #endif // DOXYGEN_RUNNING + const FT d0 = internal::distance_2(q, p0, traits); + const FT d = internal::distance_2(q, p1, traits); + const FT d2 = internal::distance_2(q, p2, traits); - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT three_point_family_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT B = area_2(p2, q, p0); - using FT = typename GeomTraits::FT; - const FT d1 = internal::distance_2(traits, q, t); - const FT d2 = internal::distance_2(traits, q, r); - const FT d3 = internal::distance_2(traits, q, p); + return three_point_family_ns::weight(d0, d2, d, A0, A2, B, a); +} - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); +/*! + \ingroup PkgWeightsRefThreePointFamilyWeights + \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1` and `p2`, + and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT three_point_family_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) +{ + const Kernel traits; + return three_point_family_weight(p0, p1, p2, q, a, traits); +} - return three_point_family_ns::weight( - traits, d1, d2, d3, A1, A2, B, a); - } +// 3D ============================================================================================== - template - typename GeomTraits::FT three_point_family_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { +/// \cond SKIP_IN_MANUAL - const GeomTraits traits; - return three_point_family_weight(t, r, p, q, a, traits); - } +template +typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; - namespace internal { + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2 , q, + p0f, p1f, p2f, qf, + traits); - template - typename GeomTraits::FT three_point_family_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { + return CGAL::Weights::three_point_family_weight(p0f, p1f, p2f, qf, a, traits); +} - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - three_point_family_weight(tf, rf, pf, qf, a, traits); - } +template +typename Kernel::FT three_point_family_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q, + const typename Kernel::FT a = {1}) +{ + const Kernel traits; + return three_point_family_weight(p0, p1, p2, q, a, traits); +} - template - typename GeomTraits::FT three_point_family_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - const GeomTraits traits; - return three_point_family_weight(t, r, p, q, a, traits); - } - - } // namespace internal - - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/triangular_region_weights.h b/Weights/include/CGAL/Weights/triangular_region_weights.h index d0605d8e1bf..aa4b20a567a 100644 --- a/Weights/include/CGAL/Weights/triangular_region_weights.h +++ b/Weights/include/CGAL/Weights/triangular_region_weights.h @@ -14,107 +14,73 @@ #ifndef CGAL_TRIANGULAR_REGION_WEIGHTS_H #define CGAL_TRIANGULAR_REGION_WEIGHTS_H -// Internal includes. #include +#include +#include + namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefTriangularRegionWeights +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 2D using the points `p`, `q`, and `r` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + return internal::positive_area_2(p, q, r, traits); +} - \brief computes the area of the triangular cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT triangular_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return triangular_area(p, q, r, traits); +} - /*! - \ingroup PkgWeightsRefTriangularRegionWeights +// 3D ============================================================================================== - \brief computes the area of the triangular cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 3D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return internal::positive_area_3(p, q, r, traits); +} - /*! - \ingroup PkgWeightsRefTriangularRegionWeights - - \brief computes the area of the triangular cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT triangular_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } - - /*! - \ingroup PkgWeightsRefTriangularRegionWeights - - \brief computes the area of the triangular cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT triangular_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } - - #endif // DOXYGEN_RUNNING - - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { - - return internal::positive_area_2(traits, p, q, r); - } - - template - typename GeomTraits::FT triangular_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return triangular_area(p, q, r, traits); - } - - template - typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { - - return internal::positive_area_3(traits, p, q, r); - } - - template - typename GeomTraits::FT triangular_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return triangular_area(p, q, r, traits); - } - /// \endcond +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT triangular_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return triangular_area(p, q, r, traits); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/uniform_region_weights.h b/Weights/include/CGAL/Weights/uniform_region_weights.h index 9d78a58b6b5..6ed0f0726b8 100644 --- a/Weights/include/CGAL/Weights/uniform_region_weights.h +++ b/Weights/include/CGAL/Weights/uniform_region_weights.h @@ -14,109 +14,73 @@ #ifndef CGAL_UNIFORM_REGION_WEIGHTS_H #define CGAL_UNIFORM_REGION_WEIGHTS_H -// Internal includes. -#include +#include +#include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefUniformRegionWeights +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 2D points. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const GeomTraits&) +{ + using FT = typename GeomTraits::FT; + return FT(1); +} - \brief this function always returns 1, given three points in 2D and a traits class - with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { } +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 2D points in 2D. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT uniform_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return uniform_area(p, q, r, traits); +} - /*! - \ingroup PkgWeightsRefUniformRegionWeights +// 3D ============================================================================================== - \brief this function always returns 1, given three points in 3D and a traits class - with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { } +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 3D points. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ +template +typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const GeomTraits&) +{ + using FT = typename GeomTraits::FT; + return FT(1); +} - /*! - \ingroup PkgWeightsRefUniformRegionWeights - - \brief this function always returns 1, given three points in 2D which are - parameterized by a `Kernel` K. - */ - template - typename K::FT uniform_area( - const CGAL::Point_2&, - const CGAL::Point_2&, - const CGAL::Point_2&) { } - - /*! - \ingroup PkgWeightsRefUniformRegionWeights - - \brief this function always returns 1, given three points in 3D which are - parameterized by a `Kernel` K. - */ - template - typename K::FT uniform_area( - const CGAL::Point_3&, - const CGAL::Point_3&, - const CGAL::Point_3&) { } - - #endif // DOXYGEN_RUNNING - - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { - - using FT = typename GeomTraits::FT; - return FT(1); - } - - template - typename GeomTraits::FT uniform_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return uniform_area(p, q, r, traits); - } - - template - typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { - - using FT = typename GeomTraits::FT; - return FT(1); - } - - template - typename GeomTraits::FT uniform_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return uniform_area(p, q, r, traits); - } - /// \endcond +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 3D points. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT uniform_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return uniform_area(p, q, r, traits); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/uniform_weights.h b/Weights/include/CGAL/Weights/uniform_weights.h index 9ce8d49d360..69d1cf2a288 100644 --- a/Weights/include/CGAL/Weights/uniform_weights.h +++ b/Weights/include/CGAL/Weights/uniform_weights.h @@ -14,134 +14,98 @@ #ifndef CGAL_UNIFORM_WEIGHTS_H #define CGAL_UNIFORM_WEIGHTS_H -// Internal includes. -#include +#include +#include + +#include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefUniformWeights +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT uniform_weight(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const GeomTraits&) +{ + return {1}; +} - \brief this function always returns 1, given four points in 2D and a traits class - with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { } +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam Kernel a model of `Kernel` +*/ +template +typename GeomTraits::FT uniform_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return uniform_weight(p0, p1, p2, q, traits); +} - /*! - \ingroup PkgWeightsRefUniformWeights +// 3D ============================================================================================== - \brief this function always returns 1, given four points in 3D and a traits class - with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { } +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT uniform_weight(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const GeomTraits&) +{ + return {1}; +} - /*! - \ingroup PkgWeightsRefUniformWeights +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam Kernel a model of `Kernel` +*/ +template +typename GeomTraits::FT uniform_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return uniform_weight(p0, p1, p2, q, traits); +} - \brief this function always returns 1, given four points in 2D which are - parameterized by a `Kernel` K. - */ - template - typename K::FT uniform_weight( - const CGAL::Point_2&, - const CGAL::Point_2&, - const CGAL::Point_2&, - const CGAL::Point_2&) { } +/// \cond SKIP_IN_MANUAL - /*! - \ingroup PkgWeightsRefUniformWeights +// Undocumented uniform weight class taking as input a polygon mesh. +// +// It is currently used in: +// Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_test.cpp +// Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_no_delaunay_test.cpp +// Polyhedron demo -> Fairing_plugin.cpp +// Polyhedron demo -> Hole_filling_plugin.cpp +template +class Uniform_weight +{ +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + double w_i(vertex_descriptor) { return 1.; } + double w_ij(halfedge_descriptor) { return 1.; } +}; - \brief this function always returns 1, given four points in 3D which are - parameterized by a `Kernel` K. - */ - template - typename K::FT uniform_weight( - const CGAL::Point_3&, - const CGAL::Point_3&, - const CGAL::Point_3&, - const CGAL::Point_3&) { } - - #endif // DOXYGEN_RUNNING - - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { - - using FT = typename GeomTraits::FT; - return FT(1); - } - - template - typename GeomTraits::FT uniform_weight( - const CGAL::Point_2& q, - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p) { - - const GeomTraits traits; - return uniform_weight(q, t, r, p, traits); - } - - template - typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { - - using FT = typename GeomTraits::FT; - return FT(1); - } - - template - typename GeomTraits::FT uniform_weight( - const CGAL::Point_3& q, - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p) { - - const GeomTraits traits; - return uniform_weight(q, t, r, p, traits); - } - - // Undocumented uniform weight class taking as input a polygon mesh. - // It is currently used in: - // Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_test.cpp - // Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_no_delaunay_test.cpp - // Polyhedron demo -> Fairing_plugin.cpp - // Polyhedron demo -> Hole_filling_plugin.cpp - template - class Uniform_weight { - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - double w_i(vertex_descriptor) { return 1; } - double w_ij(halfedge_descriptor) { return 1; } - }; - - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index 5636e00f296..67c10ce16c2 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -14,193 +14,242 @@ #ifndef CGAL_WEIGHTS_UTILS_H #define CGAL_WEIGHTS_UTILS_H -// Internal includes. #include +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT tangent( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL - return internal::tangent_2(traits, p, q, r); +// Computes cotangent between two 2D vectors. +template +typename GeomTraits::FT cotangent_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; + + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto determinant_2 = traits.compute_determinant_2_object(); + auto vector_2 = traits.construct_vector_2_object(); + + const Vector_2 v1 = vector_2(q, r); + const Vector_2 v2 = vector_2(q, p); + + const FT dot = dot_product_2(v1, v2); + const FT length = CGAL::abs(determinant_2(v1, v2)); + + if (!is_zero(length)) + return dot / length; + + return FT(0); // undefined +} + +template +typename GeomTraits::FT cotangent(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + return cotangent_2(p, q, r, traits); +} + +template +typename Kernel::FT cotangent(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return cotangent(p, q, r, traits); +} + +// ================================================================================================= + +// Computes cotangent between two 3D vectors. +template +typename GeomTraits::FT cotangent_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + const Vector_3 cross = cross_product_3(v1, v2); + + const FT length = internal::length_3(cross, traits); + if (!is_zero(length)) + return dot / length; + + return FT(0); // undefined +} + +template +typename GeomTraits::FT cotangent(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return cotangent_3(p, q, r, traits); +} + +template +typename Kernel::FT cotangent(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return cotangent(p, q, r, traits); +} + +// ================================================================================================= + +// Computes tangent between two 2D vectors. +template +typename GeomTraits::FT tangent_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; + + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto determinant_2 = traits.compute_determinant_2_object(); + auto vector_2 = traits.construct_vector_2_object(); + + const Vector_2 v1 = vector_2(q, r); + const Vector_2 v2 = vector_2(q, p); + + const FT dot = dot_product_2(v1, v2); + if (!is_zero(dot)) + { + const FT cross = determinant_2(v1, v2); + const FT length = CGAL::abs(cross); + return length / dot; } - template - typename GeomTraits::FT tangent( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { + return FT(0); // undefined +} - const GeomTraits traits; - return tangent(p, q, r, traits); +template +typename GeomTraits::FT tangent(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + return tangent_2(p, q, r, traits); +} + +template +typename Kernel::FT tangent(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return tangent(p, q, r, traits); +} + +// ================================================================================================= + +// Computes tangent between two 3D vectors. +template +typename GeomTraits::FT tangent_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + if (!is_zero(dot)) + { + const Vector_3 cross = cross_product_3(v1, v2); + const FT length = internal::length_3(cross, traits); + return length / dot; } - template - typename GeomTraits::FT tangent( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { + return FT(0); // undefined +} - return internal::tangent_3(traits, p, q, r); - } +template +typename GeomTraits::FT tangent(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return tangent_3(p, q, r, traits); +} - template - typename GeomTraits::FT tangent( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { +template +typename Kernel::FT tangent(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return tangent(p, q, r, traits); +} - const GeomTraits traits; - return tangent(p, q, r, traits); - } +// ================================================================================================= - template - typename GeomTraits::FT cotangent( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +// Computes a clamped cotangent between two 3D vectors. +// In the old version of weights in PMP, it was called "Cotangent_value_Meyer_secure". +// See Weights/internal/pmp_weights_deprecated.h for more information. +template +typename GeomTraits::FT cotangent_3_clamped(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - return internal::cotangent_2(traits, p, q, r); - } + using Get_sqrt = internal::Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); - template - typename GeomTraits::FT cotangent( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); - const GeomTraits traits; - return cotangent(p, q, r, traits); - } + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); - template - typename GeomTraits::FT cotangent( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { + const FT dot = dot_product_3(v1, v2); + const FT length_v1 = internal::length_3(v1, traits); + const FT length_v2 = internal::length_3(v2, traits); - return internal::cotangent_3(traits, p, q, r); - } + const FT lb = -FT(999) / FT(1000), + ub = FT(999) / FT(1000); + const FT cosine = boost::algorithm::clamp(dot / (length_v1 * length_v2), lb, ub); + const FT sine = sqrt(FT(1) - square(cosine)); - template - typename GeomTraits::FT cotangent( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { + CGAL_assertion(!is_zero(sine)); + if (!is_zero(sine)) + return cosine / sine; - const GeomTraits traits; - return cotangent(p, q, r, traits); - } - /// \endcond + return FT(0); // undefined +} - /// \cond SKIP_IN_MANUAL - // These are free functions to be used when building weights from parts rather - // than using the predefined weight functions. In principle, they can be removed. - // They are here to have unified interface within the Weights package and its - // construction weight system. - template - typename GeomTraits::FT squared_distance( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - return squared_distance_2(p, q); - } - - template - typename GeomTraits::FT squared_distance( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - const auto squared_distance_3 = - traits.compute_squared_distance_3_object(); - return squared_distance_3(p, q); - } - - template - typename GeomTraits::FT distance( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return internal::distance_2(traits, p, q); - } - - template - typename GeomTraits::FT distance( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return internal::distance_3(traits, p, q); - } - - template - typename GeomTraits::FT area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return internal::area_2(traits, p, q, r); - } - - template - typename GeomTraits::FT area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return internal::positive_area_3(traits, p, q, r); - } - - template - typename GeomTraits::FT scalar_product( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - const auto scalar_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - return scalar_product_2(v1, v2); - } - - template - typename GeomTraits::FT scalar_product( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - const auto scalar_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - return scalar_product_3(v1, v2); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/voronoi_region_weights.h b/Weights/include/CGAL/Weights/voronoi_region_weights.h index 569c26a6870..86d06a07243 100644 --- a/Weights/include/CGAL/Weights/voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/voronoi_region_weights.h @@ -14,131 +14,99 @@ #ifndef CGAL_VORONOI_REGION_WEIGHTS_H #define CGAL_VORONOI_REGION_WEIGHTS_H -// Internal includes. #include +#include +#include + namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +// 2D ============================================================================================== - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; - \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } + auto circumcenter_2 = traits.construct_circumcenter_2_object(); + auto midpoint_2 = traits.construct_midpoint_2_object(); - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights + const Point_2 center = circumcenter_2(p, q, r); + const Point_2 m1 = midpoint_2(q, r); + const Point_2 m2 = midpoint_2(q, p); - \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } + const FT A1 = internal::positive_area_2(q, m1, center,traits); + const FT A2 = internal::positive_area_2(q, center, m2, traits); - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights + return A1 + A2; +} - \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT voronoi_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return voronoi_area(p, q, r, traits); +} - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights +// 3D ============================================================================================== - \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 3D using the points `p`, `q`, and `r` + \tparam GeomTraits a model of `AnalyticWeightTraits_3`. +*/ +template +typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; - #endif // DOXYGEN_RUNNING + auto circumcenter_3 = traits.construct_circumcenter_3_object(); + auto midpoint_3 = traits.construct_midpoint_3_object(); - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { + const Point_3 center = circumcenter_3(p, q, r); + const Point_3 m1 = midpoint_3(q, r); + const Point_3 m2 = midpoint_3(q, p); - using FT = typename GeomTraits::FT; - const auto circumcenter_2 = - traits.construct_circumcenter_2_object(); - const auto midpoint_2 = - traits.construct_midpoint_2_object(); + const FT A1 = internal::positive_area_3(q, m1, center, traits); + const FT A2 = internal::positive_area_3(q, center, m2, traits); - const auto center = circumcenter_2(p, q, r); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + return A1 + A2; +} - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); - return A1 + A2; - } - - template - typename GeomTraits::FT voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return voronoi_area(p, q, r, traits); - } - - template - typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto circumcenter_3 = - traits.construct_circumcenter_3_object(); - const auto midpoint_3 = - traits.construct_midpoint_3_object(); - - const auto center = circumcenter_3(p, q, r); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); - - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); - return A1 + A2; - } - - template - typename GeomTraits::FT voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return voronoi_area(p, q, r, traits); - } - /// \endcond +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT voronoi_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return voronoi_area(p, q, r, traits); +} } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/wachspress_weights.h b/Weights/include/CGAL/Weights/wachspress_weights.h index 34299c24a52..9a1c9e7bd1b 100644 --- a/Weights/include/CGAL/Weights/wachspress_weights.h +++ b/Weights/include/CGAL/Weights/wachspress_weights.h @@ -14,409 +14,373 @@ #ifndef CGAL_WACHSPRESS_WEIGHTS_H #define CGAL_WACHSPRESS_WEIGHTS_H -// Internal includes. #include #include +#include +#include +#include + +#include + namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace wachspress_ns { +/// \cond SKIP_IN_MANUAL - template - FT weight(const FT A1, const FT A2, const FT C) { +namespace wachspress_ns { - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - w = C * inv; - } - return w; - } - } - /// \endcond +template +FT weight(const FT A0, const FT A2, const FT C) +{ + FT w = FT(0); + CGAL_precondition(!is_zero(A0) && !is_zero(A2)); + const FT prod = A0 * A2; + if (!is_zero(prod)) + w = C / prod; - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefWachspressWeights +} // namespace wachspress_ns - \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT wachspress_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } +/// \endcond - /*! - \ingroup PkgWeightsRefWachspressWeights +// 2D ============================================================================================== - \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT wachspress_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } +/*! + \ingroup PkgWeightsRefWachspressWeights + \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - #endif // DOXYGEN_RUNNING + auto area_2 = traits.compute_area_2_object(); + + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT C = area_2(p0, p1, p2); + + return wachspress_ns::weight(A0, A2, C); +} + +/*! + \ingroup PkgWeightsRefWachspressWeights + \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT wachspress_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ + const Kernel traits; + return wachspress_weight(p0, p1, p2, q, traits); +} + +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL + +template +typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2, q, + p0f, p1f, p2f, qf, + traits); + + return CGAL::Weights::wachspress_weight(p0f, p1f, p2f, qf, traits); +} + +template +typename Kernel::FT wachspress_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ + const Kernel traits; + return wachspress_weight(p0, p1, p2, q, traits); +} + +/// \endcond + +/*! + \ingroup PkgWeightsRefBarycentricWachspressWeights + + \brief 2D Wachspress weights for polygons. + + This class implements 2D Wachspress weights ( \cite cgal:bc:fhk-gcbcocp-06, + \cite cgal:bc:mlbd-gbcip-02, \cite cgal:bc:w-rfeb-75 ) which can be computed + at any point inside a strictly convex polygon. + + Wachspress weights are well-defined and non-negative inside a strictly convex polygon. + The weights are computed analytically using the formulation from the `wachspress_weight()`. + + \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and + value type is `Point_2`. The default is `CGAL::Identity_property_map`. + + \cgalModels `BarycentricWeights_2` +*/ +template > +class Wachspress_weights_2 +{ +public: + + /// \name Types + /// @{ /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT wachspress_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - using FT = typename GeomTraits::FT; - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT C = internal::area_2(traits, t, r, p); - return wachspress_ns::weight(A1, A2, C); - } + using Vertex_range = VertexRange; + using Geom_traits = GeomTraits; + using Point_map = PointMap; - template - typename GeomTraits::FT wachspress_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return wachspress_weight(t, r, p, q, traits); - } - - namespace internal { - - template - typename GeomTraits::FT wachspress_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - wachspress_weight(tf, rf, pf, qf, traits); - } - - template - typename GeomTraits::FT wachspress_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return wachspress_weight(t, r, p, q, traits); - } - - } // namespace internal + using Area_2 = typename GeomTraits::Compute_area_2; /// \endcond + /// Number type. + typedef typename GeomTraits::FT FT; + + /// Point type. + typedef typename GeomTraits::Point_2 Point_2; + + /// @} + + /// \name Initialization + /// @{ + /*! - \ingroup PkgWeightsRefBarycentricWachspressWeights + \brief initializes all internal data structures. - \brief 2D Wachspress weights for polygons. + This class implements the behavior of Wachspress weights + for 2D query points inside strictly convex polygons. - This class implements 2D Wachspress weights ( \cite cgal:bc:fhk-gcbcocp-06, - \cite cgal:bc:mlbd-gbcip-02, \cite cgal:bc:w-rfeb-75 ) which can be computed - at any point inside a strictly convex polygon. + \param polygon an instance of `VertexRange` with the vertices of a strictly convex polygon + \param traits a traits class with geometric objects, predicates, and constructions; + the default initialization is provided + \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; + the default initialization is provided - Wachspress weights are well-defined and non-negative inside a strictly convex polygon. - The weights are computed analytically using the formulation from the `wachspress_weight()`. - - \tparam VertexRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \tparam PointMap - a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. - - \cgalModels `BarycentricWeights_2` + \pre `polygon.size() >= 3` + \pre `polygon` is simple + \pre `polygon` is strictly convex */ - template< - typename VertexRange, - typename GeomTraits, - typename PointMap = CGAL::Identity_property_map > - class Wachspress_weights_2 { + Wachspress_weights_2(const VertexRange& polygon, + const GeomTraits traits = GeomTraits(), + const PointMap point_map = PointMap()) + : m_polygon(polygon), + m_traits(traits), + m_point_map(point_map), + m_area_2(m_traits.compute_area_2_object()) + { + CGAL_precondition(polygon.size() >= 3); + CGAL_precondition(internal::is_simple_2(polygon, traits, point_map)); + CGAL_precondition(internal::polygon_type_2(polygon, traits, point_map) == + internal::Polygon_type::STRICTLY_CONVEX); + resize(); + } - public: + /// @} - /// \name Types - /// @{ - - /// \cond SKIP_IN_MANUAL - using Vertex_range = VertexRange; - using Geom_traits = GeomTraits; - using Point_map = PointMap; - - using Area_2 = typename GeomTraits::Compute_area_2; - /// \endcond - - /// Number type. - typedef typename GeomTraits::FT FT; - - /// Point type. - typedef typename GeomTraits::Point_2 Point_2; - - /// @} - - /// \name Initialization - /// @{ - - /*! - \brief initializes all internal data structures. - - This class implements the behavior of Wachspress weights - for 2D query points inside strictly convex polygons. - - \param polygon - an instance of `VertexRange` with the vertices of a strictly convex polygon - - \param traits - a traits class with geometric objects, predicates, and constructions; - the default initialization is provided - - \param point_map - an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; - the default initialization is provided - - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex - */ - Wachspress_weights_2( - const VertexRange& polygon, - const GeomTraits traits = GeomTraits(), - const PointMap point_map = PointMap()) : - m_polygon(polygon), - m_traits(traits), - m_point_map(point_map), - m_area_2(m_traits.compute_area_2_object()) { - - CGAL_precondition( - polygon.size() >= 3); - CGAL_precondition( - internal::is_simple_2(polygon, traits, point_map)); - CGAL_precondition( - internal::polygon_type_2(polygon, traits, point_map) == - internal::Polygon_type::STRICTLY_CONVEX); - resize(); - } - - /// @} - - /// \name Access - /// @{ - - /*! - \brief computes 2D Wachspress weights. - - This function fills a destination range with 2D Wachspress weights computed - at the `query` point with respect to the vertices of the input polygon. - - The number of computed weights is equal to the number of polygon vertices. - - \tparam OutIterator - a model of `OutputIterator` whose value type is `FT` - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \return an output iterator to the element in the destination range, - one past the last weight stored - */ - template - OutIterator operator()(const Point_2& query, OutIterator w_begin) { - const bool normalize = false; - return operator()(query, w_begin, normalize); - } - - /// @} - - /// \cond SKIP_IN_MANUAL - template - OutIterator operator()(const Point_2& query, OutIterator w_begin, const bool normalize) { - return optimal_weights(query, w_begin, normalize); - } - /// \endcond - - private: - - // Fields. - const VertexRange& m_polygon; - const GeomTraits m_traits; - const PointMap m_point_map; - - const Area_2 m_area_2; - - std::vector A; - std::vector C; - std::vector w; - - // Functions. - void resize() { - A.resize(m_polygon.size()); - C.resize(m_polygon.size()); - w.resize(m_polygon.size()); - } - - template - OutputIterator optimal_weights( - const Point_2& query, OutputIterator weights, const bool normalize) { - - // Get the number of vertices in the polygon. - const std::size_t n = m_polygon.size(); - - // Compute areas A and C following the area notation from [1]. - // Split the loop to make this computation faster. - const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); - const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); - const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); - - A[0] = m_area_2(p1, p2, query); - C[0] = m_area_2(pn, p1, p2); - - for (std::size_t i = 1; i < n - 1; ++i) { - const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); - const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); - const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); - - A[i] = m_area_2(pi1, pi2, query); - C[i] = m_area_2(pi0, pi1, pi2); - } - - const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); - A[n - 1] = m_area_2(pn, p1, query); - C[n - 1] = m_area_2(pm, pn, p1); - - // Compute unnormalized weights following the formula (28) from [1]. - CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); - w[0] = C[0] / (A[n - 1] * A[0]); - - for (std::size_t i = 1; i < n - 1; ++i) { - CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); - w[i] = C[i] / (A[i - 1] * A[i]); - } - - CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); - w[n - 1] = C[n - 1] / (A[n - 2] * A[n - 1]); - - // Normalize if necessary. - if (normalize) { - internal::normalize(w); - } - - // Return weights. - for (std::size_t i = 0; i < n; ++i) { - *(weights++) = w[i]; - } - return weights; - } - }; + /// \name Access + /// @{ /*! - \ingroup PkgWeightsRefBarycentricWachspressWeights + \brief computes 2D Wachspress weights. - \brief computes 2D Wachspress weights for polygons. + This function fills a destination range with 2D Wachspress weights computed + at the `query` point with respect to the vertices of the input polygon. - This function computes 2D Wachspress weights at a given `query` point - with respect to the vertices of a strictly convex `polygon`, that is one - weight per vertex. The weights are stored in a destination range - beginning at `w_begin`. + The number of computed weights is equal to the number of polygon vertices. - Internally, the class `Wachspress_weights_2` is used. If one wants to process - multiple query points, it is better to use that class. When using the free function, - internal memory is allocated for each query point, while when using the class, - it is allocated only once which is much more efficient. However, for a few query - points, it is easier to use this function. It can also be used when the processing - time is not a concern. + \tparam OutIterator a model of `OutputIterator` whose value type is `FT` - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - and value type is `GeomTraits::Point_2` - - \tparam OutIterator - a model of `OutputIterator` whose value type is `GeomTraits::FT` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \param polygon - an instance of `PointRange` with 2D points which form a strictly convex polygon - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \param traits - a traits class with geometric objects, predicates, and constructions; - this parameter can be omitted if the traits class can be deduced from the point type + \param query a query point + \param w_begin the beginning of the destination range with the computed weights \return an output iterator to the element in the destination range, one past the last weight stored - - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex */ - template< - typename PointRange, - typename OutIterator, - typename GeomTraits> - OutIterator wachspress_weights_2( - const PointRange& polygon, const typename GeomTraits::Point_2& query, - OutIterator w_begin, const GeomTraits& traits) { - - Wachspress_weights_2 - wachspress(polygon, traits); - return wachspress(query, w_begin); + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin) + { + const bool normalize = false; + return operator()(query, w_begin, normalize); } + /// @} + /// \cond SKIP_IN_MANUAL - template< - typename PointRange, - typename OutIterator> - OutIterator wachspress_weights_2( - const PointRange& polygon, - const typename PointRange::value_type& query, - OutIterator w_begin) { - using Point_2 = typename PointRange::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - const GeomTraits traits; - return wachspress_weights_2( - polygon, query, w_begin, traits); + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin, + const bool normalize) + { + return optimal_weights(query, w_begin, normalize); } + /// \endcond +private: + const VertexRange& m_polygon; + const GeomTraits m_traits; + const PointMap m_point_map; + + const Area_2 m_area_2; + + std::vector A; + std::vector C; + std::vector w; + + void resize() + { + A.resize(m_polygon.size()); + C.resize(m_polygon.size()); + w.resize(m_polygon.size()); + } + + template + OutputIterator optimal_weights(const Point_2& query, + OutputIterator weights, + const bool normalize) + { + + // Get the number of vertices in the polygon. + const std::size_t n = m_polygon.size(); + + // Compute areas A and C following the area notation from [1]. + // Split the loop to make this computation faster. + const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); + const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); + const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); + + A[0] = m_area_2(p1, p2, query); + C[0] = m_area_2(pn, p1, p2); + + for (std::size_t i = 1; i < n - 1; ++i) + { + const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); + const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); + const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); + + A[i] = m_area_2(pi1, pi2, query); + C[i] = m_area_2(pi0, pi1, pi2); + } + + const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); + A[n - 1] = m_area_2(pn, p1, query); + C[n - 1] = m_area_2(pm, pn, p1); + + // Compute unnormalized weights following the formula (28) from [1]. + CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); + w[0] = C[0] / (A[n - 1] * A[0]); + + for (std::size_t i = 1; i < n - 1; ++i) + { + CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); + w[i] = C[i] / (A[i - 1] * A[i]); + } + + CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); + w[n - 1] = C[n - 1] / (A[n - 2] * A[n - 1]); + + // Normalize if necessary. + if (normalize) + internal::normalize(w); + + // Return weights. + for (std::size_t i = 0; i < n; ++i) + *(weights++) = w[i]; + + return weights; + } +}; + +/*! + \ingroup PkgWeightsRefBarycentricWachspressWeights + + \brief computes 2D Wachspress weights for polygons. + + This function computes 2D Wachspress weights at a given `query` point + with respect to the vertices of a strictly convex `polygon`, that is one + weight per vertex. The weights are stored in a destination range + beginning at `w_begin`. + + Internally, the class `Wachspress_weights_2` is used. If one wants to process + multiple query points, it is better to use that class. When using the free function, + internal memory is allocated for each query point, while when using the class, + it is allocated only once which is much more efficient. However, for a few query + points, it is easier to use this function. It can also be used when the processing + time is not a concern. + + \tparam PointRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + and value type is `GeomTraits::Point_2` + \tparam OutIterator a model of `OutputIterator` whose value type is `GeomTraits::FT` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + + \param polygon an instance of `PointRange` with 2D points which form a strictly convex polygon + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + \param traits a traits class with geometric objects, predicates, and constructions; + this parameter can be omitted if the traits class can be deduced from the point type + + \return an output iterator to the element in the destination range, one past the last weight stored + + \pre `polygon.size() >= 3` + \pre `polygon` is simple + \pre `polygon` is strictly convex +*/ +template +OutIterator wachspress_weights_2(const PointRange& polygon, + const typename GeomTraits::Point_2& query, + OutIterator w_begin, + const GeomTraits& traits) +{ + Wachspress_weights_2 wachspress(polygon, traits); + return wachspress(query, w_begin); +} + +/// \cond SKIP_IN_MANUAL + +template +OutIterator wachspress_weights_2(const PointRange& polygon, + const typename PointRange::value_type& query, + OutIterator w_begin) +{ + using Point_2 = typename PointRange::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + + const GeomTraits traits; + return wachspress_weights_2(polygon, query, w_begin, traits); +} + +/// \endcond + } // namespace Weights } // namespace CGAL diff --git a/Weights/test/Weights/CMakeLists.txt b/Weights/test/Weights/CMakeLists.txt index 9b7dddc43b7..90bb93b2ae5 100644 --- a/Weights/test/Weights/CMakeLists.txt +++ b/Weights/test/Weights/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Weights_Tests) - cmake_minimum_required(VERSION 3.1...3.23) +project(Weights_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("test_uniform_weights.cpp") diff --git a/Weights/test/Weights/include/utils.h b/Weights/test/Weights/include/utils.h index 89b9beb0911..90afd589149 100644 --- a/Weights/test/Weights/include/utils.h +++ b/Weights/test/Weights/include/utils.h @@ -1,113 +1,177 @@ #ifndef CGAL_WEIGHTS_TESTS_UTILS_H #define CGAL_WEIGHTS_TESTS_UTILS_H -// STL includes. +#include + +#include +#include + #include #include #include #include #include -// CGAL includes. -#include -#include -#include +namespace CGAL { +namespace Weights { +namespace internal { + +template +typename Kernel::FT squared_distance(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const Kernel traits; + auto squared_distance_2 = traits.compute_squared_distance_2_object(); + return squared_distance_2(p, q); +} + +template +typename Kernel::FT squared_distance(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const Kernel traits; + auto squared_distance_3 = traits.compute_squared_distance_3_object(); + return squared_distance_3(p, q); +} + +template +typename Kernel::FT distance(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const Kernel traits; + return CGAL::Weights::internal::distance_2(p, q, traits); +} + +template +typename Kernel::FT distance(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const Kernel traits; + return CGAL::Weights::internal::distance_3(p, q, traits); +} + +template +typename Kernel::FT area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return CGAL::Weights::internal::positive_area_2(p, q, r, traits); +} + +template +typename Kernel::FT area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return CGAL::Weights::internal::positive_area_3(p, q, r, traits); +} + +template +typename Kernel::FT scalar_product(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + auto scalar_product_2 = traits.compute_scalar_product_2_object(); + auto vector_2 = traits.construct_vector_2_object(); + + const auto v1 = vector_2(q, r); + const auto v2 = vector_2(q, p); + return scalar_product_2(v1, v2); +} + +template +typename Kernel::FT scalar_product(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + auto scalar_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const auto v1 = vector_3(q, r); + const auto v2 = vector_3(q, p); + + return scalar_product_3(v1, v2); +} + +} // namespace internal +} // namespace Weights +} // namespace CGAL namespace tests { template -FT get_tolerance() { - return FT(1) / FT(10000000000); -} +FT get_tolerance() { return FT(1e-10); } template std::vector< std::array > -get_all_triangles() { - +get_all_triangles() +{ using Point_2 = typename Kernel::Point_2; - const std::array triangle0 = { - Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) - }; - const std::array triangle1 = { - Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) - }; - const std::array triangle2 = { - Point_2(-2, 0), Point_2(-2, -2), Point_2(2, 0) - }; - const std::array triangle3 = { - Point_2(-2, 0), Point_2(2, -2), Point_2(2, 0) - }; + + const std::array triangle0 = { Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) }; + const std::array triangle1 = { Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) }; + const std::array triangle2 = { Point_2(-2, 0), Point_2(-2, -2), Point_2(2, 0) }; + const std::array triangle3 = { Point_2(-2, 0), Point_2(2, -2), Point_2(2, 0) }; + return { triangle0, triangle1, triangle2, triangle3 }; } template std::vector< std::array > -get_symmetric_triangles() { - +get_symmetric_triangles() +{ using Point_2 = typename Kernel::Point_2; - const std::array triangle0 = { - Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) - }; - const std::array triangle1 = { - Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) - }; - const std::array triangle2 = { - Point_2(-3, 0), Point_2(0, -1), Point_2(3, 0) - }; + + const std::array triangle0 = { Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) }; + const std::array triangle1 = { Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) }; + const std::array triangle2 = { Point_2(-3, 0), Point_2(0, -1), Point_2(3, 0) }; + return { triangle0, triangle1, triangle2 }; } template std::vector< std::array > -get_uniform_triangles() { - +get_uniform_triangles() +{ using Point_2 = typename Kernel::Point_2; - const std::array triangle0 = { - Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) - }; - const std::array triangle1 = { - Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0) - }; - const std::array triangle2 = { - Point_2(1, 0), Point_2(-1, 0), Point_2(-1, -2) - }; - const std::array triangle3 = { - Point_2(1, -2), Point_2(1, 0), Point_2(-1, 0) - }; + + const std::array triangle0 = { Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) }; + const std::array triangle1 = { Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0) }; + const std::array triangle2 = { Point_2(1, 0), Point_2(-1, 0), Point_2(-1, -2) }; + const std::array triangle3 = { Point_2(1, -2), Point_2(1, 0), Point_2(-1, 0) }; + return { triangle0, triangle1, triangle2, triangle3 }; } template std::vector< std::vector > -get_all_polygons() { - +get_all_polygons() +{ using Point_2 = typename Kernel::Point_2; - const std::vector polygon0 = { - Point_2(-2, -2), Point_2(2, -2), Point_2(0, 2) - }; - const std::vector polygon1 = { - Point_2(-1, -1), Point_2(1, -1), Point_2(1, 1), Point_2(-1, 1) - }; - const std::vector polygon2 = { - Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0), Point_2(0, 2) - }; - const std::vector polygon3 = { - Point_2(-2, -2), Point_2(2, -2), Point_2(2, 0), Point_2(0, 2), Point_2(-2, 0) - }; + + const std::vector polygon0 = { Point_2(-2, -2), Point_2(2, -2), Point_2(0, 2) }; + const std::vector polygon1 = { Point_2(-1, -1), Point_2(1, -1), Point_2(1, 1), Point_2(-1, 1) }; + const std::vector polygon2 = { Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0), Point_2(0, 2) }; + const std::vector polygon3 = { Point_2(-2, -2), Point_2(2, -2), Point_2(2, 0), + Point_2(0, 2), Point_2(-2, 0) }; + return { polygon0, polygon1, polygon2, polygon3 }; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_query( - const Weight_wrapper& wrapper, - const typename Kernel::Point_2& query, - const std::array& neighbors) { - +template +void test_query(const Weight_wrapper& wrapper, + const typename Kernel::Point_2& query, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT tol = get_tolerance(); // 2D configuration. @@ -122,36 +186,28 @@ bool test_query( const Point_3 p3(p2.x(), p2.y(), 1); const Point_3 q3(q2.x(), q2.y(), 1); - const auto a2 = wrapper.weight_a(t2, r2, p2, q2); - const auto b2 = wrapper.weight_b(t2, r2, p2, q2); + const FT a2 = wrapper.weight_a(t2, r2, p2, q2); + const FT b2 = wrapper.weight_b(t2, r2, p2, q2); assert(a2 >= FT(0) && b2 >= FT(0)); - if (a2 < FT(0) || b2 < FT(0)) return false; assert(CGAL::abs(a2 - b2) < tol); - if (CGAL::abs(a2 - b2) >= tol) return false; - if (wrapper.supports_3d()) { - const auto a3 = wrapper.weight_a(t3, r3, p3, q3); - const auto b3 = wrapper.weight_b(t3, r3, p3, q3); + if (wrapper.supports_3d()) + { + const FT a3 = wrapper.weight_a(t3, r3, p3, q3); + const FT b3 = wrapper.weight_b(t3, r3, p3, q3); assert(a3 >= FT(0) && b3 >= FT(0)); - if (a3 < FT(0) || b3 < FT(0)) return false; assert(CGAL::abs(a3 - b3) < tol); - if (CGAL::abs(a3 - b3) >= tol) return false; assert(CGAL::abs(a2 - a3) < tol); assert(CGAL::abs(b2 - b3) < tol); - if (CGAL::abs(a2 - a3) >= tol) return false; - if (CGAL::abs(b2 - b3) >= tol) return false; } - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_symmetry_x( - const Weight_wrapper& wrapper, - const std::array& neighbors, - const typename Kernel::FT& x) { - +template +void test_symmetry_x(const Weight_wrapper& wrapper, + const std::array& neighbors, + const typename Kernel::FT& x) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -167,41 +223,34 @@ bool test_symmetry_x( const Point_3 r3(r2.x(), r2.y(), 1); const Point_3 p3(p2.x(), p2.y(), 1); - const auto a2 = wrapper.weight_a(t2, r2, p2, Point_2(-x, 0)); - const auto b2 = wrapper.weight_a(t2, r2, p2, Point_2(+x, 0)); + const FT a2 = wrapper.weight_a(t2, r2, p2, Point_2(-x, 0)); + const FT b2 = wrapper.weight_a(t2, r2, p2, Point_2(+x, 0)); assert(a2 >= FT(0) && b2 >= FT(0)); - if (a2 < FT(0) || b2 < FT(0)) return false; assert(CGAL::abs(a2 - b2) < tol); - if (CGAL::abs(a2 - b2) >= tol) return false; - if (wrapper.supports_3d()) { - const auto a3 = wrapper.weight_a(t3, r3, p3, Point_3(-x, 0, 1)); - const auto b3 = wrapper.weight_a(t3, r3, p3, Point_3(+x, 0, 1)); + if (wrapper.supports_3d()) + { + const FT a3 = wrapper.weight_a(t3, r3, p3, Point_3(-x, 0, 1)); + const FT b3 = wrapper.weight_a(t3, r3, p3, Point_3(+x, 0, 1)); assert(a3 >= FT(0) && b3 >= FT(0)); - if (a3 < FT(0) || b3 < FT(0)) return false; assert(CGAL::abs(a3 - b3) < tol); - if (CGAL::abs(a3 - b3) >= tol) return false; assert(CGAL::abs(a2 - a3) < tol); assert(CGAL::abs(b2 - b3) < tol); - if (CGAL::abs(a2 - a3) >= tol) return false; - if (CGAL::abs(b2 - b3) >= tol) return false; } - return true; } -template< -typename Kernel, -typename Weight_wrapper_1, -typename Weight_wrapper_2> -bool test_compare( - const Weight_wrapper_1& wrapper1, - const Weight_wrapper_2& wrapper2, - const typename Kernel::Point_2& query, - const std::array& neighbors) { - +template +void test_compare(const Weight_wrapper_1& wrapper1, + const Weight_wrapper_2& wrapper2, + const typename Kernel::Point_2& query, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT tol = get_tolerance(); // 2D configuration. @@ -216,34 +265,29 @@ bool test_compare( const Point_3 p3(p2.x(), p2.y(), 1); const Point_3 q3(q2.x(), q2.y(), 1); - const auto a2 = wrapper1.weight_a(t2, r2, p2, q2); - const auto b2 = wrapper2.weight_a(t2, r2, p2, q2); + const FT a2 = wrapper1.weight_a(t2, r2, p2, q2); + const FT b2 = wrapper2.weight_a(t2, r2, p2, q2); assert(a2 >= FT(0) && b2 >= FT(0)); - if (a2 < FT(0) || b2 < FT(0)) return false; assert(CGAL::abs(a2 - b2) < tol); - if (CGAL::abs(a2 - b2) >= tol) return false; - if (wrapper1.supports_3d() && wrapper2.supports_3d()) { - const auto a3 = wrapper1.weight_a(t3, r3, p3, q3); - const auto b3 = wrapper2.weight_a(t3, r3, p3, q3); + if (wrapper1.supports_3d() && wrapper2.supports_3d()) + { + const FT a3 = wrapper1.weight_a(t3, r3, p3, q3); + const FT b3 = wrapper2.weight_a(t3, r3, p3, q3); assert(a3 >= FT(0) && b3 >= FT(0)); - if (a3 < FT(0) || b3 < FT(0)) return false; assert(CGAL::abs(a3 - b3) < tol); - if (CGAL::abs(a3 - b3) >= tol) return false; } - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_neighbors( - const Weight_wrapper& wrapper, - const std::array& neighbors) { - +template +void test_neighbors(const Weight_wrapper& wrapper, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT tol = get_tolerance(); // 2D configuration. @@ -256,22 +300,17 @@ bool test_neighbors( const Point_3 q3(q2.x(), q2.y(), 1); const Point_3 r3(r2.x(), r2.y(), 1); - const auto a2 = wrapper.weight(p2, q2, r2); - const auto a3 = wrapper.weight(p3, q3, r3); + const FT a2 = wrapper.weight(p2, q2, r2); + const FT a3 = wrapper.weight(p3, q3, r3); assert(a2 >= FT(0) && a3 >= FT(0)); - if (a2 < FT(0) || a3 < FT(0)) return false; assert(CGAL::abs(a2 - a3) < tol); - if (CGAL::abs(a2 - a3) >= tol) return false; - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_area( - const Weight_wrapper& wrapper, - const std::array& neighbors) { - +template +void test_area(const Weight_wrapper& wrapper, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -286,129 +325,105 @@ bool test_area( const Point_3 q3(q2.x(), q2.y(), 1); const Point_3 r3(r2.x(), r2.y(), 1); - const auto a2 = wrapper.weight(p2, q2, r2); - const auto a3 = wrapper.weight(p3, q3, r3); - assert(a2 <= CGAL::Weights::area(p2, q2, r2)); - assert(a3 <= CGAL::Weights::area(p3, q3, r3)); - if (a2 > CGAL::Weights::area(p2, q2, r2)) return false; - if (a3 > CGAL::Weights::area(p3, q3, r3)) return false; + const FT a2 = wrapper.weight(p2, q2, r2); + const FT a3 = wrapper.weight(p3, q3, r3); + assert(a2 <= CGAL::Weights::internal::area(p2, q2, r2)); + assert(a3 <= CGAL::Weights::internal::area(p3, q3, r3)); + assert(a2 >= FT(0)); assert(a3 >= FT(0)); - if (a2 < FT(0)) return false; - if (a3 < FT(0)) return false; - return true; } template -bool test_coordinates( - const Point& query, - const std::vector& polygon, - const std::vector& weights) { - +void test_coordinates(const Point& query, + const std::vector& polygon, + const std::vector& weights) +{ assert(weights.size() > 0); - if (weights.size() == 0) return false; // Compute the sum of weights. const FT tol = get_tolerance(); FT sum = FT(0); - for (const FT& weight : weights) { + for (const FT& weight : weights) sum += weight; - } assert(sum >= tol); - if (sum < tol) return false; // Compute coordinates. std::vector coordinates; coordinates.reserve(weights.size()); - for (const FT& weight : weights) { + for (const FT& weight : weights) coordinates.push_back(weight / sum); - } + assert(coordinates.size() == weights.size()); - if (coordinates.size() != weights.size()) return false; // Test partition of unity. sum = FT(0); - for (const FT& coordinate : coordinates) { + for (const FT& coordinate : coordinates) sum += coordinate; - } assert(CGAL::abs(FT(1) - sum) < tol); - if (CGAL::abs(FT(1) - sum) >= tol) return false; // Test linear precision. FT x = FT(0), y = FT(0); - for (std::size_t i = 0; i < polygon.size(); ++i) { + for (std::size_t i = 0; i < polygon.size(); ++i) + { x += coordinates[i] * polygon[i].x(); y += coordinates[i] * polygon[i].y(); } assert(CGAL::abs(query.x() - x) < tol); assert(CGAL::abs(query.y() - y) < tol); - if (CGAL::abs(query.x() - x) >= tol) return false; - if (CGAL::abs(query.y() - y) >= tol) return false; - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_on_polygon( - const Weight_wrapper& wrapper, - const typename Kernel::Point_2& query_2, - const std::vector& polygon_2) { - +template +void test_on_polygon(const Weight_wrapper& wrapper, + const typename Kernel::Point_2& query_2, + const std::vector& polygon_2) +{ // Get weights. using FT = typename Kernel::FT; assert(polygon_2.size() >= 3); - if (polygon_2.size() < 3) return false; // 2D version. std::vector weights_2; weights_2.reserve(polygon_2.size()); - wrapper.compute_on_polygon( - polygon_2, query_2, Kernel(), std::back_inserter(weights_2)); + wrapper.compute_on_polygon(polygon_2, query_2, Kernel(), std::back_inserter(weights_2)); assert(weights_2.size() == polygon_2.size()); - if (weights_2.size() != polygon_2.size()) return false; - if (!test_coordinates(query_2, polygon_2, weights_2)) return false; + test_coordinates(query_2, polygon_2, weights_2); // 3D version. using Point_3 = typename Kernel::Point_3; const Point_3 query_3(query_2.x(), query_2.y(), 1); std::vector polygon_3; polygon_3.reserve(polygon_2.size()); - for (const auto& vertex_2 : polygon_2) { - polygon_3.push_back(Point_3(vertex_2.x(), vertex_2.y(), 1)); - } + for (const auto& vertex_2 : polygon_2) + polygon_3.emplace_back(vertex_2.x(), vertex_2.y(), 1); assert(polygon_3.size() == polygon_2.size()); - if (polygon_3.size() != polygon_2.size()) return false; - const CGAL::Projection_traits_xy_3 ptraits; + const CGAL::Projection_traits_xy_3 ptraits; std::vector weights_3; weights_3.reserve(polygon_3.size()); - wrapper.compute_on_polygon( - polygon_3, query_3, ptraits, std::back_inserter(weights_3)); + wrapper.compute_on_polygon(polygon_3, query_3, ptraits, std::back_inserter(weights_3)); assert(weights_3.size() == polygon_3.size()); - if (weights_3.size() != polygon_3.size()) return false; - if (!test_coordinates(query_3, polygon_3, weights_3)) return false; - return true; + + test_coordinates(query_3, polygon_3, weights_3); } -template< -typename Kernel, -typename Weight_wrapper> -bool test_barycentric_properties( - const Weight_wrapper& wrapper, - const typename Kernel::Point_2& query, - const std::vector& polygon) { - +template +void test_barycentric_properties(const Weight_wrapper& wrapper, + const typename Kernel::Point_2& query, + const std::vector& polygon) +{ // Get weights. using FT = typename Kernel::FT; const std::size_t n = polygon.size(); assert(n >= 3); - if (n < 3) return false; // Check properties. std::vector weights; weights.reserve(n); - for (std::size_t i = 0; i < n; ++i) { + for (std::size_t i = 0; i < n; ++i) + { const std::size_t im = (i + n - 1) % n; const std::size_t ip = (i + 1) % n; const auto& t = polygon[im]; @@ -419,23 +434,19 @@ bool test_barycentric_properties( weights.push_back(weight); } assert(weights.size() == n); - if (weights.size() != n) return false; - if (!test_coordinates(query, polygon, weights)) return false; - return true; + + test_coordinates(query, polygon, weights); } -template< -typename Kernel, -typename Weight_wrapper_1, -typename Weight_wrapper_2> -bool test_analytic_weight( - const Weight_wrapper_1& weight, - const Weight_wrapper_2& alternative) { - +template +void test_analytic_weight(const Weight_wrapper_1& weight, + const Weight_wrapper_2& alternative) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; - // Data. const FT q = FT(1) / FT(4); const FT h = FT(1) / FT(2); const FT t = FT(3) / FT(4); @@ -449,66 +460,59 @@ bool test_analytic_weight( // Test query points. auto configs = get_all_triangles(); - for (const auto& config : configs) { - if (!test_query(weight, zero, config)) return false; - for (const auto& query : queries) { - if (!test_query(weight, query, config)) return false; - } + for (const auto& config : configs) + { + test_query(weight, zero, config); + for (const auto& query : queries) + test_query(weight, query, config); } // Test alternative formulations. - for (const auto& config : configs) { - if (!test_compare(weight, alternative, zero, config)) { - return false; - } - for (const auto& query : queries) { - if (!test_compare(weight, alternative, query, config)) { - return false; - } - } + for (const auto& config : configs) + { + test_compare(weight, alternative, zero, config); + for (const auto& query : queries) + test_compare(weight, alternative, query, config); } // Test symmetry along x axis. configs = get_symmetric_triangles(); - for (const auto& config : configs) { - if (!test_symmetry_x(weight, config, q)) return false; - if (!test_symmetry_x(weight, config, h)) return false; - if (!test_symmetry_x(weight, config, t)) return false; + for (const auto& config : configs) + { + test_symmetry_x(weight, config, q); + test_symmetry_x(weight, config, h); + test_symmetry_x(weight, config, t); } // Test barycentric properties. - if (weight.is_barycentric()) { + if (weight.is_barycentric()) + { const auto polygons = get_all_polygons(); - for (const auto& polygon : polygons) { - if (!test_barycentric_properties(weight, zero, polygon)) { - return false; - } - for (const auto& query : queries) { - if (!test_barycentric_properties(weight, query, polygon)) { - return false; - } - } + for (const auto& polygon : polygons) + { + test_barycentric_properties(weight, zero, polygon); + for (const auto& query : queries) + test_barycentric_properties(weight, query, polygon); } } - return true; + + return; } -template< -typename Kernel, -typename Weight_wrapper_1, -typename Weight_wrapper_2> -bool test_barycentric_weight( - const Weight_wrapper_1& weight, - const Weight_wrapper_2& alternative) { - +template +void test_barycentric_weight(const Weight_wrapper_1& weight, + const Weight_wrapper_2& alternative) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; - // Data. const FT q = FT(1) / FT(4); const FT h = FT(1) / FT(2); const Point_2 zero(0, 0); - const std::vector queries = { + const std::vector queries = + { Point_2(-h, 0), Point_2(+h, 0), Point_2(-q, 0), Point_2(+q, 0), Point_2( 0, -h), Point_2( 0, +h), Point_2( 0, -q), Point_2( 0, +q), Point_2(-h, -h), Point_2(+h, +h), Point_2(-q, -q), Point_2(+q, +q), @@ -516,40 +520,29 @@ bool test_barycentric_weight( }; // Test analytic formulations. - if (!test_analytic_weight(weight, alternative)) { - return false; - } + test_analytic_weight(weight, alternative); // Test on polygons. const auto polygons = get_all_polygons(); - for (const auto& polygon : polygons) { - if (!test_on_polygon(weight, zero, polygon)) return false; - for (const auto& query : queries) { - if (!test_on_polygon(weight, query, polygon)) { - return false; - } - } + for (const auto& polygon : polygons) + { + test_on_polygon(weight, zero, polygon); + for (const auto& query : queries) + test_on_polygon(weight, query, polygon); } - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_region_weight(const Weight_wrapper& weight) { - - // Test neighborhoods. +template +void test_region_weight(const Weight_wrapper& weight) +{ auto configs = get_all_triangles(); - for (const auto& config : configs) { - if (!test_neighbors(weight, config)) return false; - } + for (const auto& config : configs) + test_neighbors(weight, config); - // Test areas. configs = get_uniform_triangles(); - for (const auto& config : configs) { - if (!test_area(weight, config)) return false; - } - return true; + for (const auto& config : configs) + test_area(weight, config); } } // namespace tests diff --git a/Weights/test/Weights/include/wrappers.h b/Weights/test/Weights/include/wrappers.h index 9946236476a..2566a219a6c 100644 --- a/Weights/test/Weights/include/wrappers.h +++ b/Weights/test/Weights/include/wrappers.h @@ -1,261 +1,345 @@ #ifndef CGAL_WEIGHTS_TESTS_WRAPPERS_H #define CGAL_WEIGHTS_TESTS_WRAPPERS_H -// STL includes. +#include "utils.h" + +#include + #include #include -// CGAL includes. -#include - namespace wrappers { template -struct Authalic_wrapper { +struct Authalic_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::authalic_weight(t, r, p, q); + FT weight_a(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::authalic_weight(p0, p1, p2, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return - CGAL::Weights::half_authalic_weight( - CGAL::Weights::cotangent(t, r, q), - CGAL::Weights::squared_distance(q, r)) + - CGAL::Weights::half_authalic_weight( - CGAL::Weights::cotangent(q, r, p), - CGAL::Weights::squared_distance(q, r)); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::half_authalic_weight(CGAL::Weights::cotangent(p0, p1, q), + CGAL::Weights::internal::squared_distance(q, p1)) + + CGAL::Weights::half_authalic_weight(CGAL::Weights::cotangent(q, p1, p2), + CGAL::Weights::internal::squared_distance(q, p1)); } + bool supports_3d() const { return true; } bool is_barycentric() const { return true; } }; template -struct Cotangent_wrapper { +struct Cotangent_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::cotangent_weight(t, r, p, q); + FT weight_a(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::cotangent_weight(p0, p1, p2, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return - CGAL::Weights::half_cotangent_weight( - CGAL::Weights::cotangent(q, t, r)) + - CGAL::Weights::half_cotangent_weight( - CGAL::Weights::cotangent(r, p, q)); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::half_cotangent_weight(CGAL::Weights::cotangent(q, p0, p1)) + + CGAL::Weights::half_cotangent_weight(CGAL::Weights::cotangent(p1, p2, q)); } + bool supports_3d() const { return true; } bool is_barycentric() const { return true; } }; template -struct Tangent_wrapper { +struct Tangent_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::tangent_weight(t, r, p, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return - CGAL::Weights::half_tangent_weight( - CGAL::Weights::distance(r, q), - CGAL::Weights::distance(t, q), - CGAL::Weights::area(r, q, t), - CGAL::Weights::scalar_product(r, q, t)) + - CGAL::Weights::half_tangent_weight( - CGAL::Weights::distance(r, q), - CGAL::Weights::distance(p, q), - CGAL::Weights::area(p, q, r), - CGAL::Weights::scalar_product(p, q, r)); + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { + return CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), + CGAL::Weights::internal::distance(t, q), + CGAL::Weights::internal::area(r, q, t), + CGAL::Weights::internal::scalar_product(r, q, t)) + + CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), + CGAL::Weights::internal::distance(p, q), + CGAL::Weights::internal::area(p, q, r), + CGAL::Weights::internal::scalar_product(p, q, r)); } + bool supports_3d() const { return true; } bool is_barycentric() const { return true; } }; template -struct Wachspress_wrapper { +struct Wachspress_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { - return CGAL::Weights::wachspress_weight(t, r, p, q); + + FT weight_a(const Point_2& p0, const Point_2& p1, const Point_2& p2, const Point_2& q) const + { + return CGAL::Weights::wachspress_weight(p0, p1, p2, q); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return weight_a(t, r, p, q); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return weight_a(p0, p1, p2, q); } + template - void compute_on_polygon( - const Polygon& polygon, const Point& query, const Traits& traits, OutputIterator out) const { + void compute_on_polygon(const Polygon& polygon, + const Point& query, + const Traits& traits, + OutputIterator out) const + { CGAL::Weights::wachspress_weights_2(polygon, query, out, traits); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Discrete_harmonic_wrapper { +struct Discrete_harmonic_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { - return CGAL::Weights::discrete_harmonic_weight(t, r, p, q); + + FT weight_a(const Point_2& p0, const Point_2& p1, const Point_2& p2, const Point_2& q) const + { + return CGAL::Weights::discrete_harmonic_weight(p0, p1, p2, q); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return weight_a(t, r, p, q); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return weight_a(p0, p1, p2, q); } + template - void compute_on_polygon( - const Polygon& polygon, const Point& query, const Traits& traits, OutputIterator out) const { + void compute_on_polygon(const Polygon& polygon, + const Point& query, + const Traits& traits, + OutputIterator out) const + { CGAL::Weights::discrete_harmonic_weights_2(polygon, query, out, traits); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Mean_value_wrapper { +struct Mean_value_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { + + FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const + { return CGAL::Weights::mean_value_weight(t, r, p, q); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + template - void compute_on_polygon( - const Polygon& polygon, const Point& query, const Traits& traits, OutputIterator out) const { + void compute_on_polygon(const Polygon& polygon, + const Point& query, + const Traits& traits, + OutputIterator out) const + { CGAL::Weights::mean_value_weights_2(polygon, query, out, traits); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Three_point_family_wrapper { +struct Three_point_family_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT a; + Three_point_family_wrapper(const FT a) : a(a) { } - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { + FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const + { return CGAL::Weights::three_point_family_weight(t, r, p, q, a); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Uniform_region_wrapper { +struct Uniform_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::uniform_area(p, q, r); } }; template -struct Triangular_region_wrapper { +struct Triangular_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::triangular_area(p, q, r); } }; template -struct Barycentric_region_wrapper { +struct Barycentric_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::barycentric_area(p, q, r); } }; template -struct Voronoi_region_wrapper { +struct Voronoi_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::voronoi_area(p, q, r); } }; template -struct Mixed_voronoi_region_wrapper { +struct Mixed_voronoi_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::mixed_voronoi_area(p, q, r); } }; template -struct Uniform_wrapper { +struct Uniform_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::uniform_weight(t, r, p, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return true; } bool is_barycentric() const { return false; } }; template -struct Inverse_distance_wrapper { +struct Inverse_distance_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::inverse_distance_weight(t, r, p, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return true; } bool is_barycentric() const { return false; } }; template -struct Shepard_wrapper { +struct Shepard_wrapper +{ using FT = typename Kernel::FT; + const FT a; + Shepard_wrapper(const FT a) : a(a) { } + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::shepard_weight(t, r, p, q, a); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return true; } bool is_barycentric() const { return false; } }; diff --git a/Weights/test/Weights/test_authalic_weights.cpp b/Weights/test/Weights/test_authalic_weights.cpp index 1aa439a3523..68aa6553417 100644 --- a/Weights/test/Weights/test_authalic_weights.cpp +++ b/Weights/test/Weights/test_authalic_weights.cpp @@ -1,26 +1,29 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Authalic_wrapper aut; const wrappers::Wachspress_wrapper whp; - return tests::test_analytic_weight(aut, whp); + const wrappers::Three_point_family_wrapper tpf(0); + tests::test_analytic_weight(aut, whp); + tests::test_analytic_weight(aut, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_authalic_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_barycentric_region_weights.cpp b/Weights/test/Weights/test_barycentric_region_weights.cpp index 49be26810bf..39dfebe8c39 100644 --- a/Weights/test/Weights/test_barycentric_region_weights.cpp +++ b/Weights/test/Weights/test_barycentric_region_weights.cpp @@ -1,25 +1,48 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ + using FT = typename Kernel::FT; + using Point_2 = typename Kernel::Point_2; + using Point_3 = typename Kernel::Point_3; + + const Point_2 p( 1, 0); + const Point_2 q( 0, 6); + const Point_2 r(-1, 0); + const FT w1 = CGAL::Weights::barycentric_area(p, q, r); + const FT w2 = CGAL::Weights::barycentric_area(r, p, q); + const FT w3 = CGAL::Weights::barycentric_area(q, r, p); + assert(w1 == FT(2)); // medians subdivide a triangle into 6 triangles of equal areas + assert(w1 == w2 && w2 == w3); + + const Point_3 s( 0, -1, 0); + const Point_3 t( 0, 0, 6); + const Point_3 u( 0, 1, 0); + const FT w4 = CGAL::Weights::barycentric_area(s, t, u); + const FT w5 = CGAL::Weights::barycentric_area(t, u, s); + const FT w6 = CGAL::Weights::barycentric_area(u, s, t); + assert(w4 == FT(2)); + assert(w4 == w5 && w5 == w6); + const wrappers::Barycentric_region_wrapper bar; - return tests::test_region_weight(bar); + tests::test_region_weight(bar); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_barycentric_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_cotangent_weights.cpp b/Weights/test/Weights/test_cotangent_weights.cpp index 962ed140c44..e1bcb98da72 100644 --- a/Weights/test/Weights/test_cotangent_weights.cpp +++ b/Weights/test/Weights/test_cotangent_weights.cpp @@ -1,26 +1,39 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ + using FT = typename Kernel::FT; + using Point_2 = typename Kernel::Point_2; + + const Point_2 p0(-2, 1); + const Point_2 p1( 0, 1); + const Point_2 p2( 0, 3); + const Point_2 q( -2, 3); + const FT w = CGAL::Weights::cotangent_weight(p0, p1, p2, q); + assert(w == FT(0)); + const wrappers::Cotangent_wrapper cot; const wrappers::Discrete_harmonic_wrapper dhw; - return tests::test_analytic_weight(cot, dhw); + const wrappers::Three_point_family_wrapper tpf(2); + tests::test_analytic_weight(cot, dhw); + tests::test_analytic_weight(cot, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_cotangent_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_discrete_harmonic_weights.cpp b/Weights/test/Weights/test_discrete_harmonic_weights.cpp index b49d7beac51..f358f412191 100644 --- a/Weights/test/Weights/test_discrete_harmonic_weights.cpp +++ b/Weights/test/Weights/test_discrete_harmonic_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -19,36 +19,42 @@ void test_overloads() { const Point_2 r1( 0, -1); const Point_2 p1( 1, 0); const Point_2 q1( 0, 0); + const Point_3 t2(-1, 0, 1); const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::discrete_harmonic_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::discrete_harmonic_weight(t2, r2, p2, q2); - assert(a2 >= FT(0)); - assert(a3 >= FT(0)); + const FT a3 = CGAL::Weights::discrete_harmonic_weight(t2, r2, p2, q2); + assert(a2 == FT(4)); + assert(a3 == FT(4)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::discrete_harmonic_weight(t1, r1, p1, q1, Traits()) == a2); - assert(CGAL::Weights::internal::discrete_harmonic_weight(t2, r2, p2, q2, Traits()) == a3); + assert(CGAL::Weights::discrete_harmonic_weight(t2, r2, p2, q2, Traits()) == a3); + CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::discrete_harmonic_weight(t2, r2, p2, q2, ptraits); - assert(a23 >= FT(0)); - assert(a23 == a2 && a23 == a3); + assert(a23 == FT(4)); + assert(a23 == a2); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Discrete_harmonic_wrapper dhw; const wrappers::Cotangent_wrapper cot; - return tests::test_barycentric_weight(dhw, cot); + tests::test_barycentric_weight(dhw, cot); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_discrete_harmonic_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_inverse_distance_weights.cpp b/Weights/test/Weights/test_inverse_distance_weights.cpp index a19dec04749..5cccd29824b 100644 --- a/Weights/test/Weights/test_inverse_distance_weights.cpp +++ b/Weights/test/Weights/test_inverse_distance_weights.cpp @@ -1,47 +1,53 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; const Point_2 p1(0, 0); - const Point_2 q1(1, 0); + const Point_2 q1(2, 0); const Point_3 p2(0, 0, 1); - const Point_3 q2(1, 0, 1); - const FT a2 = CGAL::Weights::inverse_distance_weight(p1, q1); - const FT a3 = CGAL::Weights::inverse_distance_weight(p2, q2); - assert(a2 == FT(1)); - assert(a3 == FT(1)); - assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1) == a2); - assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2) == a3); + const Point_3 q2(2, 0, 1); + + const FT w1 = CGAL::Weights::inverse_distance_weight(p1, q1); + const FT w2 = CGAL::Weights::inverse_distance_weight(p2, q2); + assert(w1 == FT(1) / FT(2)); + assert(w2 == FT(1) / FT(2)); + assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1) == w1); + assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2) == w2); + struct Traits : public Kernel { }; - assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1, Traits()) == a2); - assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2, Traits()) == a3); + assert(CGAL::Weights::inverse_distance_weight(p1, q1, Traits()) == w1); + assert(CGAL::Weights::inverse_distance_weight(p2, q2, Traits()) == w2); + assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1, Traits()) == w1); + assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2, Traits()) == w2); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Inverse_distance_wrapper idw; const wrappers::Shepard_wrapper spw(1); - return tests::test_analytic_weight(idw, spw); + tests::test_analytic_weight(idw, spw); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_inverse_distance_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_mean_value_weights.cpp b/Weights/test/Weights/test_mean_value_weights.cpp index 883ff79d591..74ec6ffa4a5 100644 --- a/Weights/test/Weights/test_mean_value_weights.cpp +++ b/Weights/test/Weights/test_mean_value_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -23,14 +23,16 @@ void test_overloads() { const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::mean_value_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::mean_value_weight(t2, r2, p2, q2); + const FT a3 = CGAL::Weights::mean_value_weight(t2, r2, p2, q2); assert(a2 >= FT(0)); assert(a3 >= FT(0)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::mean_value_weight(t1, r1, p1, q1, Traits()) == a2); - assert(CGAL::Weights::internal::mean_value_weight(t2, r2, p2, q2, Traits()) == a3); + assert(CGAL::Weights::mean_value_weight(t2, r2, p2, q2, Traits()) == a3); CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::mean_value_weight(t2, r2, p2, q2, ptraits); assert(a23 >= FT(0)); @@ -38,17 +40,21 @@ void test_overloads() { } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Mean_value_wrapper mvw; const wrappers::Tangent_wrapper tan; - return tests::test_barycentric_weight(mvw, tan); + const wrappers::Three_point_family_wrapper tpf(1); + tests::test_barycentric_weight(mvw, tan); + tests::test_barycentric_weight(mvw, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_mean_value_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp b/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp index 3c78f1f18a2..d0c6571d95e 100644 --- a/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp +++ b/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp @@ -1,25 +1,26 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Mixed_voronoi_region_wrapper mix; - return tests::test_region_weight(mix); + tests::test_region_weight(mix); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_mixed_voronoi_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_projected_weights.cpp b/Weights/test/Weights/test_projected_weights.cpp index 96d01644499..874bc73d22b 100644 --- a/Weights/test/Weights/test_projected_weights.cpp +++ b/Weights/test/Weights/test_projected_weights.cpp @@ -1,18 +1,19 @@ #include #include #include + #include #include #include #include -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_kernel() { +void test_kernel() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -110,7 +111,8 @@ void test_kernel() { assert(CGAL::Weights::three_point_family_weight(t3, r3, p3, q3, 1, yz_traits) == ref_value); } -int main() { +int main(int, char**) +{ test_kernel(); test_kernel(); test_kernel(); diff --git a/Weights/test/Weights/test_shepard_weights.cpp b/Weights/test/Weights/test_shepard_weights.cpp index e178b574144..9806892d386 100644 --- a/Weights/test/Weights/test_shepard_weights.cpp +++ b/Weights/test/Weights/test_shepard_weights.cpp @@ -1,49 +1,55 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const Point_2 p1(0, 0); - const Point_2 q1(1, 0); + const Point_2 q1(2, 0); const Point_3 p2(0, 0, 1); - const Point_3 q2(1, 0, 1); - const FT a2 = CGAL::Weights::shepard_weight(p1, q1); - const FT a3 = CGAL::Weights::shepard_weight(p2, q2); - assert(a2 == FT(1)); - assert(a3 == FT(1)); - assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1) == a2); - assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2) == a3); + const Point_3 q2(2, 0, 1); + + const FT a2 = CGAL::Weights::shepard_weight(p1, q1, 3); + const FT a3 = CGAL::Weights::shepard_weight(p2, q2, 3); + assert(a2 == FT(1)/FT(8)); + assert(a3 == FT(1)/FT(8)); + + assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1, 3) == a2); + assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2, 3) == a3); + struct Traits : public Kernel { }; - assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1, 1, Traits()) == a2); - assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2, 1, Traits()) == a3); + assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1, 3, Traits()) == a2); + assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2, 3, Traits()) == a3); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Shepard_wrapper spwa(1); const wrappers::Shepard_wrapper spwb(2); const wrappers::Inverse_distance_wrapper idw; - assert(tests::test_analytic_weight(spwa, idw)); - return tests::test_analytic_weight(spwb, spwb); + tests::test_analytic_weight(spwa, idw); + tests::test_analytic_weight(spwb, spwb); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_shepard_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_tangent_weights.cpp b/Weights/test/Weights/test_tangent_weights.cpp index 8fe08620ad7..aece71cb567 100644 --- a/Weights/test/Weights/test_tangent_weights.cpp +++ b/Weights/test/Weights/test_tangent_weights.cpp @@ -1,26 +1,29 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Tangent_wrapper tan; const wrappers::Mean_value_wrapper mvw; - return tests::test_analytic_weight(tan, mvw); + const wrappers::Three_point_family_wrapper tpf(1); + tests::test_analytic_weight(tan, mvw); + tests::test_analytic_weight(tan, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_tangent_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_three_point_family_weights.cpp b/Weights/test/Weights/test_three_point_family_weights.cpp index e6ebfb0f64b..85f231b7eb0 100644 --- a/Weights/test/Weights/test_three_point_family_weights.cpp +++ b/Weights/test/Weights/test_three_point_family_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -23,14 +23,16 @@ void test_overloads() { const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::three_point_family_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::three_point_family_weight(t2, r2, p2, q2); + const FT a3 = CGAL::Weights::three_point_family_weight(t2, r2, p2, q2); assert(a2 >= FT(0)); assert(a3 >= FT(0)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::three_point_family_weight(t1, r1, p1, q1, 1, Traits()) == a2); - assert(CGAL::Weights::internal::three_point_family_weight(t2, r2, p2, q2, 1, Traits()) == a3); + assert(CGAL::Weights::three_point_family_weight(t2, r2, p2, q2, 1, Traits()) == a3); CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::three_point_family_weight(t2, r2, p2, q2, 0, ptraits); assert(a23 >= FT(0)); @@ -38,7 +40,8 @@ void test_overloads() { } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); using FT = typename Kernel::FT; const FT h = FT(1) / FT(2); @@ -49,16 +52,18 @@ bool test_kernel() { const wrappers::Wachspress_wrapper whp; const wrappers::Mean_value_wrapper mvw; const wrappers::Discrete_harmonic_wrapper dhw; - assert(tests::test_analytic_weight(tpfa, whp)); - assert(tests::test_analytic_weight(tpfb, mvw)); - assert(tests::test_analytic_weight(tpfc, dhw)); - return tests::test_analytic_weight(tpfd, tpfd); + + tests::test_analytic_weight(tpfa, whp); + tests::test_analytic_weight(tpfb, mvw); + tests::test_analytic_weight(tpfc, dhw); + tests::test_analytic_weight(tpfd, tpfd); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_three_point_family_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_triangular_region_weights.cpp b/Weights/test/Weights/test_triangular_region_weights.cpp index c6bde65c492..bafdc2ed189 100644 --- a/Weights/test/Weights/test_triangular_region_weights.cpp +++ b/Weights/test/Weights/test_triangular_region_weights.cpp @@ -1,25 +1,26 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Triangular_region_wrapper tri; - return tests::test_region_weight(tri); + tests::test_region_weight(tri); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_triangular_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_uniform_region_weights.cpp b/Weights/test/Weights/test_uniform_region_weights.cpp index 52124ede996..71d25a9a555 100644 --- a/Weights/test/Weights/test_uniform_region_weights.cpp +++ b/Weights/test/Weights/test_uniform_region_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -20,22 +20,25 @@ void test_overloads() { const Point_3 q(0, 0, 0); assert(CGAL::Weights::uniform_area(p, p, p) == a); assert(CGAL::Weights::uniform_area(q, q, q) == a); + struct Traits : public Kernel { }; assert(CGAL::Weights::uniform_area(p, p, p, Traits()) == a); assert(CGAL::Weights::uniform_area(q, q, q, Traits()) == a); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Uniform_region_wrapper uni; - return tests::test_region_weight(uni); + tests::test_region_weight(uni); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_uniform_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_uniform_weights.cpp b/Weights/test/Weights/test_uniform_weights.cpp index 68ae5af005c..00501f1f13d 100644 --- a/Weights/test/Weights/test_uniform_weights.cpp +++ b/Weights/test/Weights/test_uniform_weights.cpp @@ -1,41 +1,46 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT a = FT(1); const Point_2 p(0, 0); const Point_3 q(0, 0, 0); + assert(CGAL::Weights::uniform_weight(p, p, p, p) == a); assert(CGAL::Weights::uniform_weight(q, q, q, q) == a); + struct Traits : public Kernel { }; assert(CGAL::Weights::uniform_weight(p, p, p, p, Traits()) == a); assert(CGAL::Weights::uniform_weight(q, q, q, q, Traits()) == a); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Uniform_wrapper uni; - return tests::test_analytic_weight(uni, uni); + tests::test_analytic_weight(uni, uni); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_uniform_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_voronoi_region_weights.cpp b/Weights/test/Weights/test_voronoi_region_weights.cpp index a0d6bcc43d4..49b0fe672af 100644 --- a/Weights/test/Weights/test_voronoi_region_weights.cpp +++ b/Weights/test/Weights/test_voronoi_region_weights.cpp @@ -1,25 +1,42 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ + using FT = typename Kernel::FT; + using Point_2 = typename Kernel::Point_2; + using Point_3 = typename Kernel::Point_3; + + const Point_2 p( 2, 0); + const Point_2 q( 0, 2); + const Point_2 r(-2, 0); + const FT w1 = CGAL::Weights::voronoi_area(p, q, r); + assert(w1 == FT(2)); + + const Point_3 s( 0, -2, 0); + const Point_3 t( 0, 0, 2); + const Point_3 u( 0, 2, 0); + const FT w4 = CGAL::Weights::voronoi_area(s, t, u); + assert(w4 == FT(2)); + const wrappers::Voronoi_region_wrapper vor; - return tests::test_region_weight(vor); + tests::test_region_weight(vor); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_voronoi_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_wachspress_weights.cpp b/Weights/test/Weights/test_wachspress_weights.cpp index 75b43f46437..f370c383745 100644 --- a/Weights/test/Weights/test_wachspress_weights.cpp +++ b/Weights/test/Weights/test_wachspress_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -23,32 +23,38 @@ void test_overloads() { const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::wachspress_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::wachspress_weight(t2, r2, p2, q2); - assert(a2 >= FT(0)); - assert(a3 >= FT(0)); + const FT a3 = CGAL::Weights::wachspress_weight(t2, r2, p2, q2); + assert(a2 == FT(4)); + assert(a3 == FT(4)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::wachspress_weight(t1, r1, p1, q1, Traits()) == a2); - assert(CGAL::Weights::internal::wachspress_weight(t2, r2, p2, q2, Traits()) == a3); + assert(CGAL::Weights::wachspress_weight(t2, r2, p2, q2, Traits()) == a3); CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::wachspress_weight(t2, r2, p2, q2, ptraits); - assert(a23 >= FT(0)); - assert(a23 == a2 && a23 == a3); + assert(a23 == FT(4)); + assert(a23 == a2); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Wachspress_wrapper whp; const wrappers::Authalic_wrapper aut; - return tests::test_barycentric_weight(whp, aut); + const wrappers::Three_point_family_wrapper tpf(0); + tests::test_barycentric_weight(whp, aut); + tests::test_barycentric_weight(whp, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_wachspress_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; }