From 844bfddcac01258aa38c8ddb591cc2bad76d9868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 27 Feb 2020 10:19:35 +0100 Subject: [PATCH 01/14] avoid crash if the file is corrupted or empty --- CGAL_ImageIO/include/CGAL/read_vtk_image_data.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h index 158f020c28d..6923049d054 100644 --- a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h +++ b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h @@ -85,6 +85,8 @@ read_vtk_image_data(vtkImageData* vtk_image, Image_3::Own owning = Image_3::OWN_ image->wdim = imageio_type.wdim; image->wordKind = imageio_type.wordKind; image->sign = imageio_type.sign; + if (!vtk_image->GetPointData() || !vtk_image->GetPointData()->GetScalars()) + return Image_3(); CGAL_assertion(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]); if(owning == Image_3::OWN_THE_DATA) { image->data = ::ImageIO_alloc(dims[0]*dims[1]*dims[2]*image->wdim); From 715e8e3e8b7f6ff793cdbfef54257e159f8bb2f0 Mon Sep 17 00:00:00 2001 From: Sebastien Loriot Date: Thu, 27 Feb 2020 10:52:23 +0100 Subject: [PATCH 02/14] fix leak Co-Authored-By: Laurent Rineau --- CGAL_ImageIO/include/CGAL/read_vtk_image_data.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h index 6923049d054..a7ee0a371e2 100644 --- a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h +++ b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h @@ -85,8 +85,10 @@ read_vtk_image_data(vtkImageData* vtk_image, Image_3::Own owning = Image_3::OWN_ image->wdim = imageio_type.wdim; image->wordKind = imageio_type.wordKind; image->sign = imageio_type.sign; - if (!vtk_image->GetPointData() || !vtk_image->GetPointData()->GetScalars()) + if (!vtk_image->GetPointData() || !vtk_image->GetPointData()->GetScalars()) { + ::_freeImage(image); return Image_3(); + } CGAL_assertion(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]); if(owning == Image_3::OWN_THE_DATA) { image->data = ::ImageIO_alloc(dims[0]*dims[1]*dims[2]*image->wdim); From 661924f9bf38f2fb99b731843a6f4f093760266f Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 2 Mar 2020 17:15:16 +0100 Subject: [PATCH 03/14] Labeled_mesh_domain_3: Fix the `value_outside` parameter --- Mesh_3/include/CGAL/Labeled_mesh_domain_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index f5bd84ebd33..ac2ba6fb96a 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -843,7 +843,7 @@ protected: false> Wrapper; return Wrapper(image, transform_fct, - transform_fct(value_outside)); + value_outside) ; } template From dd2c0e4e894ba7783474ad394b8c8f839dbf3230 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 5 Mar 2020 12:27:20 +0100 Subject: [PATCH 04/14] consider surface patches border halfedges as PATCH_BORDERS surface patch borders should be considered similarly to constrained edges, so that they still represent the same polyline after remeshing + it is what is documented --- .../internal/Isotropic_remeshing/remesh_impl.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 f819fb9c751..6428062e6ac 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 @@ -1528,6 +1528,13 @@ private: set_status(h, PATCH_BORDER); has_border_ = true; } + if (status(h) == PATCH + && status(opposite(h, mesh_)) == PATCH + && get_patch_id(face(h, mesh_)) != get_patch_id(face(opposite(h, mesh_), mesh_))) + { + set_status(h, PATCH_BORDER); + has_border_ = true; + } } // update status using constrained edge map From f4665a83ecd65a6aadbf2d463c1178e6ff5128b8 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 5 Mar 2020 12:29:43 +0100 Subject: [PATCH 05/14] if `fpmap` is valid, then there is no need to call connected_components() calling connected_components() overwrites face patches, though isotropic_remeshing() keeps it valid + in the case where we have a valid face_patch_map, and no constrained edges, calling connected_components() entirely looses the surface patch information --- .../demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index e9c0e9f6256..abe71622042 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -611,7 +611,6 @@ public Q_SLOTS: } if (fpmap_valid) { - PMP::connected_components(pmesh, fpmap, PMP::parameters::edge_is_constrained_map(eif)); poly_item->setItemIsMulticolor(true); poly_item->show_feature_edges(true); } From 21ee697498ff02034040ee7c155895adedb63fcc Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 5 Mar 2020 15:02:55 +0100 Subject: [PATCH 06/14] merge both `if` conditions --- .../internal/Isotropic_remeshing/remesh_impl.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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 6428062e6ac..9d2c1201b4a 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 @@ -1523,14 +1523,9 @@ private: // tag patch border halfedges BOOST_FOREACH(halfedge_descriptor h, halfedges(mesh_)) { - if (status(h)==PATCH && status(opposite(h, mesh_))!=PATCH) - { - set_status(h, PATCH_BORDER); - has_border_ = true; - } if (status(h) == PATCH - && status(opposite(h, mesh_)) == PATCH - && get_patch_id(face(h, mesh_)) != get_patch_id(face(opposite(h, mesh_), mesh_))) + && ( status(opposite(h, mesh_)) != PATCH + || get_patch_id(face(h, mesh_)) != get_patch_id(face(opposite(h, mesh_), mesh_)))) { set_status(h, PATCH_BORDER); has_border_ = true; From f0a7a8f92f073456a0537981ff8f9e1c4cba97b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 6 Mar 2020 12:45:26 +0100 Subject: [PATCH 07/14] add missing const --- BGL/include/CGAL/boost/graph/Euler_operations.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index 11dd34b1922..98f6a6e0025 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -1332,7 +1332,7 @@ flip_edge(typename boost::graph_traits::halfedge_descriptor h, template bool does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor e, - Graph& g) + const Graph& g) { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -1432,7 +1432,7 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor template bool satisfies_link_condition(typename boost::graph_traits::edge_descriptor e, - Graph& g) + const Graph& g) { return does_satisfy_link_condition(e, g); } From bd9610446d0c4c804ad5c179f7f2b2a6006f06ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 14:54:44 +0100 Subject: [PATCH 08/14] Fix some links in Apollonius_graph_2's documentation --- .../doc/Apollonius_graph_2/Apollonius_graph_2.txt | 12 ++++++------ .../CGAL/Apollonius_graph_filtered_traits_2.h | 10 +++++----- .../CGAL/Apollonius_graph_traits_2.h | 8 ++++---- .../doc/Apollonius_graph_2/dependencies | 1 + 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt b/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt index 8f29331cbfb..68f2793ad35 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt @@ -369,9 +369,9 @@ concept. The second template parameter is a tag that indicates what operations are allowed in the computations that take place within the traits class. The two possible values of the `Method_tag` parameter are -`Ring_tag` and `Sqrt_field_tag`. When -`Ring_tag` is used, only ring operations are used during the -evaluation of the predicates, whereas if `Sqrt_field_tag` is +`Integral_domain_without_division_tag` and `Field_with_sqrt_tag`. When +`Integral_domain_without_division_tag` is used, only ring operations are used during the +evaluation of the predicates, whereas if `Field_with_sqrt_tag` is chosen, all four field operations, as well as square roots, are used during the predicate evaluation. @@ -379,8 +379,8 @@ The `Apollonius_graph_traits_2` class provides exact predicates if the number type in the kernel `K` is an exact number type. This is to be associated with the type of operations allowed for the predicate evaluation. For example `MP_Float` as number -type, with `Ring_tag` as tag will give exact predicates, -whereas `MP_Float` with `Sqrt_field_tag` will give +type, with `Integral_domain_without_division_tag` as tag will give exact predicates, +whereas `MP_Float` with `Field_with_sqrt_tag` will give inexact predicates. Since using an exact number type may be too slow, the @@ -393,7 +393,7 @@ operations, then kernel with number type `Filtered_exact` will yield exact predicates for the Apollonius graph traits. To give a concrete example, `CGAL::Filtered_exact` with -`Ring_tag` will produce exact predicates. +`Integral_domain_without_division_tag` will produce exact predicates. Another possibility for fast and exact predicate evaluation is to use the diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_filtered_traits_2.h b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_filtered_traits_2.h index a1b4a8003d5..c49c4a0bb76 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_filtered_traits_2.h +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_filtered_traits_2.h @@ -20,8 +20,8 @@ This class has six template parameters. The first, third and fifth template parameters must be a models of the `Kernel` concept. The second, fourth and sixth template parameters correspond to how predicates are evaluated. There are two predefined possible values for -`Method_tag`, namely `CGAL::Sqrt_field_tag` and -`CGAL::Ring_tag`. The first one must be used when the number type +`Method_tag`, namely `CGAL::Field_with_sqrt_tag` and +`CGAL::Integral_domain_without_division_tag`. The first one must be used when the number type used in the representation supports the exact evaluation of signs of expressions involving all four basic operations and square roots, whereas the second one requires the exact evaluation of signs of @@ -31,7 +31,7 @@ The way the predicates are evaluated is discussed in \cgalCite{cgal:ke-ppawv-02}, \cgalCite{cgal:ke-rctac-03}. The default values for the template parameters are as follows: -`CM = CGAL::Ring_tag`, +`CM = CGAL::Integral_domain_without_division_tag`, `EK = CGAL::Simple_cartesian`, `EM = CM`, `FK = CGAL::Simple_cartesian >`, @@ -41,8 +41,8 @@ The default values for the template parameters are as follows: \sa `Kernel` \sa `ApolloniusGraphTraits_2` -\sa `CGAL::Ring_tag` -\sa `CGAL::Sqrt_field_tag` +\sa `CGAL::Integral_domain_without_division_tag` +\sa `CGAL::Field_with_sqrt_tag` \sa `CGAL::Apollonius_graph_2` \sa `CGAL::Apollonius_graph_traits_2` diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_traits_2.h b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_traits_2.h index 6f3d11a7517..2b9ebca5625 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_traits_2.h +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/CGAL/Apollonius_graph_traits_2.h @@ -10,13 +10,13 @@ This class has two template parameters. The first template parameter must be a model of the `Kernel` concept. The second template parameter corresponds to how predicates are evaluated. There are two predefined possible values for `Method_tag`, namely -`CGAL::Sqrt_field_tag` and `CGAL::Ring_tag`. The first one +`CGAL::Field_with_sqrt_tag` and `CGAL::Integral_domain_without_division_tag`. The first one must be used when the number type used in the representation supports the exact evaluation of signs of expressions involving all four basic operations and square roots, whereas the second one requires the exact evaluation of signs of ring-type expressions, i.e., expressions involving only additions, subtractions and multiplications. The -default value for `Method_tag` is `CGAL::Ring_tag`. +default value for `Method_tag` is `CGAL::Integral_domain_without_division_tag`. The way the predicates are evaluated is discussed in \cgalCite{cgal:ke-ppawv-02}, \cgalCite{cgal:ke-rctac-03}. @@ -24,8 +24,8 @@ The way the predicates are evaluated is discussed in \sa `Kernel` \sa `ApolloniusGraphTraits_2` -\sa `CGAL::Ring_tag` -\sa `CGAL::Sqrt_field_tag` +\sa `CGAL::Integral_domain_without_division_tag` +\sa `CGAL::Field_with_sqrt_tag` \sa `CGAL::Apollonius_graph_2` \sa `CGAL::Apollonius_graph_filtered_traits_2` diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/dependencies b/Apollonius_graph_2/doc/Apollonius_graph_2/dependencies index 49ad6034b25..6270b1d0d3b 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/dependencies +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/dependencies @@ -5,5 +5,6 @@ Algebraic_foundations Circulator Stream_support Voronoi_diagram_2 +Number_types TDS_2 Triangulation_2 From 0729d1b0d175c706ad160eb0c1af7f71c83ffd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 15:17:50 +0100 Subject: [PATCH 09/14] Update documentations of SDG/AG2: Filtered_exact has been removed... ... 16 years ago ! --- .../Apollonius_graph_2/Apollonius_graph_2.txt | 28 ++++------- .../CGAL/Apollonius_graph_2/check_filter.h | 47 ------------------- .../Segment_Delaunay_graph_2.txt | 28 +++-------- 3 files changed, 16 insertions(+), 87 deletions(-) delete mode 100644 Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt b/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt index 68f2793ad35..d9183a9f592 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt @@ -383,28 +383,18 @@ type, with `Integral_domain_without_division_tag` as tag will give exact predica whereas `MP_Float` with `Field_with_sqrt_tag` will give inexact predicates. -Since using an exact number type may be too slow, the -`Apollonius_graph_traits_2` class is designed to -support the dynamic filtering of \cgal through the -`Filtered_exact` mechanism. In particular if `CT` -is an inexact number type that supports the operations denoted by the -tag `Method_tag` and `ET` is an exact number type for these -operations, then kernel with number type -`Filtered_exact` will yield exact predicates for the -Apollonius graph traits. To give a concrete example, -`CGAL::Filtered_exact` with -`Integral_domain_without_division_tag` will produce exact predicates. - -Another possibility for fast and exact predicate evaluation is to use -the -`Apollonius_graph_filtered_traits_2` -class. This class is the analog of a filtered kernel. It takes a +Although exact number types provide exact predicates and constructions, +their use often result in unacceptably large runtimes. +The class `Apollonius_graph_filtered_traits_2` +aims to paliate this shortcoming. Similar to a filtered kernel, it takes a constructions kernel `CK`, a filtering kernel `FK` and an exact kernel `EK`, as well as the corresponding tags (`CM`, `FM` and `EM`, respectively). -It evaluates the predicates by first using the filtering kernel, and -if this fails the evaluation is performed using the exact kernel. The -constructions are done using the kernel `CK`, which means that +Predicates are evaluated by first using the filtering kernel, and +if this fails the evaluation is performed using the exact kernel, +thus yielding exact predicates at a generally much cheaper cost +than directly using an exact number type. The constructions +are done using the kernel `CK`, which means that they are not necessarily exact. All template parameters except `CK` have default values, which are explained in the reference manual. diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h deleted file mode 100644 index c8fd059702c..00000000000 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2003,2004 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// 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. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0+ -// -// -// Author(s) : Menelaos Karavelas - - - -#ifndef CGAL_CHECK_FILTER_H -#define CGAL_CHECK_FILTER_H - -#include - - -#undef CGAL_IA_NEW_FILTERS - -namespace CGAL { - -template < class T> -void must_be_filtered(const T&) -{} - -#if defined CGAL_ARITHMETIC_FILTER_H -template < class CT, class ET, class Type, bool Protection, class Cache> -void must_be_filtered(const Filtered_exact &) -{ dont_compile(CT(), ET()); } -#endif - -} - -#endif diff --git a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt index d16811be5e6..32ea3863f64 100644 --- a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt +++ b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt @@ -404,31 +404,17 @@ classes: As mentioned above, performing computations with exact arithmetic can be very costly. For this reason we have devoted considerable -effort in implementing different kinds of arithmetic filtering -mechanisms. Presently, there two ways of performing arithmetic -filtering for the predicates involved in the computation of -segment Delaunay graphs: -
    -
  1. The user can define his/her kernel using as number type, a -number type of the form `Filtered_exact`. Then this -kernel can be entered as the first template parameter in the -`Segment_Delaunay_graph_2`. -
  2. The user can define up to three different kernels `CK`, +effort in implementing arithmetic filtering mechanisms +through special traits classes, `Segment_Delaunay_graph_filtered_traits_2` +and `Segment_Delaunay_graph_filtered_traits_without_intersections_2`. +These two traits class employ the `Filtered_predicate` mechanism, +and the user can define up to three different kernels `CK`, `FK` and `EK` (default values are provided for most parameters). The first kernel `CK` is used only for constructions. The second kernel `FK` is the filtering kernel: the traits class will attempt to compute the predicates using this kernel. If the filtering kernel fails to successfully compute a -predicate, the exact kernel `EK` will be used. These three -kernels are then used in the -`Segment_Delaunay_graph_filtered_traits_2` and -`Segment_Delaunay_graph_filtered_traits_without_intersections_2` -classes, which have been implemented using the -`Filtered_predicate` mechanism. -
-Our experience so far has shown that for all reasonable and valid -values of the template parameters, the second method for arithmetic -filtering is more efficient among the two. +predicate, the exact kernel `EK` will be used. Let's consider once more the class `Segment_Delaunay_graph_2`. @@ -507,7 +493,7 @@ for inputs consisting of more than about 1,000 sites. \subsection Segment_Delaunay_graph_2FirstExample First Example using the Filtered Traits The following example shows how to use the segment Delaunay graph traits -in conjunction with the `Filtered_exact` mechanism. In +in conjunction with filtered traits mechanism. In addition it shows how to use a few of the iterators provided by the `Segment_Delaunay_graph_2` class in order to count a few site-related quantities. From 5c694722a9dc8181c2638ee38f5fdcd438bc02fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 15:18:55 +0100 Subject: [PATCH 10/14] Clean some AG2 tests : Filtered_exact does not exist anymore --- .../test/Apollonius_graph_2/test_ag2.cpp | 57 ++---------------- .../test_ag_hierarchy_2.cpp | 60 ++----------------- .../Apollonius_graph_2/test_ag_traits_2.cpp | 60 +++---------------- 3 files changed, 19 insertions(+), 158 deletions(-) diff --git a/Apollonius_graph_2/test/Apollonius_graph_2/test_ag2.cpp b/Apollonius_graph_2/test/Apollonius_graph_2/test_ag2.cpp index 1fc81aaa1ba..03f6ef34cb2 100644 --- a/Apollonius_graph_2/test/Apollonius_graph_2/test_ag2.cpp +++ b/Apollonius_graph_2/test/Apollonius_graph_2/test_ag2.cpp @@ -4,76 +4,31 @@ #include #include -#define DONT_USE_FILTERED_EXACT // choose number type #include -#ifndef DONT_USE_FILTERED_EXACT -# include -#endif typedef double inexact_type; typedef CGAL::MP_Float exact_type; -#ifndef DONT_USE_FILTERED_EXACT -typedef CGAL::Filtered_exact number_t; -#endif - #include -#ifndef DONT_USE_FILTERED_EXACT -typedef CGAL::Simple_cartesian Kernel; -#endif - typedef CGAL::Integral_domain_without_division_tag Method_tag; #include "./include/test.h" - typedef CGAL::Simple_cartesian CK; typedef CGAL::Simple_cartesian EK; - int main() { -#ifndef DONT_USE_FILTERED_EXACT - { - std::ifstream ifs_algo("./data/algo.dat"); + std::ifstream ifs_algo("./data/algo.dat"); + assert( ifs_algo ); - assert( ifs_algo ); - - std::cout << "testing the Apollonius graph class..." << std::flush; - bool algo_ok = - CGAL::test_algo(ifs_algo); - - assert( algo_ok ); - std::cout << " done!" << std::endl; - - ifs_algo.close(); - - std::cout << std::endl; - } -#endif - //------------------------------------------------------------------------ - - { - std::ifstream ifs_algo("./data/algo.dat"); - - assert( ifs_algo ); - - std::cout << "testing the Apollonius graph class" - << " with filtered traits..." << std::flush; - bool algo_ok = - CGAL::test_filtered_traits_algo(ifs_algo); - - assert( algo_ok ); - std::cout << " done!" << std::endl; - - ifs_algo.close(); - - std::cout << std::endl; - } + std::cout << "testing the Apollonius graph class" << " with filtered traits..." << std::flush; + bool algo_ok = CGAL::test_filtered_traits_algo(ifs_algo); + assert( algo_ok ); + std::cout << " done!" << std::endl; return 0; } diff --git a/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_hierarchy_2.cpp b/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_hierarchy_2.cpp index 7546bd42bed..d8eaa78abf6 100644 --- a/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_hierarchy_2.cpp +++ b/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_hierarchy_2.cpp @@ -4,79 +4,31 @@ #include #include -#define DNOT_USE_FILTERED_EXACT - // choose number type #include -#ifndef DNOT_USE_FILTERED_EXACT -# include -#endif - typedef double inexact_type; typedef CGAL::MP_Float exact_type; -#ifndef DNOT_USE_FILTERED_EXACT -typedef CGAL::Filtered_exact number_t; -#endif - #include -#ifndef DNOT_USE_FILTERED_EXACT -typedef CGAL::Simple_cartesian K; -#endif - typedef CGAL::Integral_domain_without_division_tag Method_tag; #include "./include/test.h" - typedef CGAL::Simple_cartesian CK; typedef CGAL::Simple_cartesian EK; - int main() { -#ifndef DNOT_USE_FILTERED_EXACT - { - std::ifstream ifs_hierarchy("./data/hierarchy.dat"); + std::ifstream ifs_hierarchy("./data/hierarchy.dat"); + assert( ifs_hierarchy ); - assert( ifs_hierarchy ); + std::cout << "testing the Apollonius graph hierarchy class" << " with filtered traits..." << std::flush; + bool hierarchy_ok = CGAL::test_filtered_traits_hierarchy_algo(ifs_hierarchy); - std::cout << "testing the Apollonius graph hierarchy class..." - << std::flush; - bool hierarchy_ok = - CGAL::test_hierarchy_algo(ifs_hierarchy); - - assert( hierarchy_ok ); - std::cout << " done!" << std::endl; - - ifs_hierarchy.close(); - - std::cout << std::endl; - } -#endif - //------------------------------------------------------------------------ - - { - std::ifstream ifs_hierarchy("./data/hierarchy.dat"); - - assert( ifs_hierarchy ); - - std::cout << "testing the Apollonius graph hierarchy class" - << " with filtered traits..." << std::flush; - bool hierarchy_ok = - CGAL::test_filtered_traits_hierarchy_algo(ifs_hierarchy); - - assert( hierarchy_ok ); - std::cout << " done!" << std::endl; - - ifs_hierarchy.close(); - - std::cout << std::endl; - } + assert( hierarchy_ok ); + std::cout << " done!" << std::endl; return 0; } diff --git a/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_traits_2.cpp b/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_traits_2.cpp index 3739b77cad4..1a8d4781bd9 100644 --- a/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_traits_2.cpp +++ b/Apollonius_graph_2/test/Apollonius_graph_2/test_ag_traits_2.cpp @@ -2,79 +2,33 @@ #include #include -#define DONT_USE_FILTERED_EXACT - // choose number type #include -#ifndef DONT_USE_FILTERED_EXACT -# include -#endif typedef double inexact_type; typedef CGAL::MP_Float exact_type; -#ifndef DONT_USE_FILTERED_EXACT -typedef CGAL::Filtered_exact number_t; -#endif - #include -#ifndef DONT_USE_FILTERED_EXACT -typedef CGAL::Simple_cartesian Kernel; -#endif - typedef CGAL::Integral_domain_without_division_tag Method_tag; #include "./include/test.h" - typedef CGAL::Simple_cartesian CK; typedef CGAL::Simple_cartesian EK; - int main() { -#ifndef DONT_USE_FILTERED_EXACT - { - std::ifstream ifs_traits("./data/traits.dat"); + std::ifstream ifs_traits("./data/traits.dat"); + assert( ifs_traits ); - assert( ifs_traits ); + std::cout << "testing the filtered traits class..." << std::flush; - // bool is_ok = - // CGAL::test_traits(ifs_traits); + CGAL::Filtered_traits_tester test_traits; + bool traits_ok = test_traits(); + assert( traits_ok ); - std::cout << "testing the traits class..." << std::flush; - - CGAL::Traits_tester test_traits; - bool traits_ok = test_traits(); - - assert( traits_ok ); - std::cout << " done!" << std::endl; - - ifs_traits.close(); - - std::cout << std::endl; - } -#endif - //------------------------------------------------------------------------ - - { - std::ifstream ifs_traits("./data/traits.dat"); - - assert( ifs_traits ); - - std::cout << "testing the filtered traits class..." << std::flush; - - CGAL::Filtered_traits_tester test_traits; - bool traits_ok = test_traits(); - - assert( traits_ok ); - std::cout << " done!" << std::endl; - - ifs_traits.close(); - - std::cout << std::endl; - } + std::cout << " done!" << std::endl; return 0; } From fe7c4629c18a6427688ff3bd4ab617b867588e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 15:20:16 +0100 Subject: [PATCH 11/14] Tiny punctuation change --- .../doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt index 32ea3863f64..5b212279b9d 100644 --- a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt +++ b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt @@ -410,7 +410,7 @@ and `Segment_Delaunay_graph_filtered_traits_without_intersections_2` mechanism, and the user can define up to three different kernels `CK`, `FK` and `EK` (default values are provided for most -parameters). The first kernel `CK` is used only for +parameters): the first kernel `CK` is used only for constructions. The second kernel `FK` is the filtering kernel: the traits class will attempt to compute the predicates using this kernel. If the filtering kernel fails to successfully compute a From 57465431e8aa9f11ce2eab77f1e1a656c73feacc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 15:26:34 +0100 Subject: [PATCH 12/14] Fix grammar --- .../doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt index 5b212279b9d..e5651b18ac2 100644 --- a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt +++ b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2.txt @@ -493,7 +493,7 @@ for inputs consisting of more than about 1,000 sites. \subsection Segment_Delaunay_graph_2FirstExample First Example using the Filtered Traits The following example shows how to use the segment Delaunay graph traits -in conjunction with filtered traits mechanism. In +in conjunction with filtered traits mechanisms. In addition it shows how to use a few of the iterators provided by the `Segment_Delaunay_graph_2` class in order to count a few site-related quantities. From 22b0cc6efb70df80936e007f4acc61b85840b129 Mon Sep 17 00:00:00 2001 From: Mael Date: Tue, 10 Mar 2020 16:40:50 +0100 Subject: [PATCH 13/14] Fix typo --- .../doc/Apollonius_graph_2/Apollonius_graph_2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt b/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt index d9183a9f592..196fc8451f1 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/Apollonius_graph_2.txt @@ -384,7 +384,7 @@ whereas `MP_Float` with `Field_with_sqrt_tag` will give inexact predicates. Although exact number types provide exact predicates and constructions, -their use often result in unacceptably large runtimes. +their use often results in unacceptably large runtimes. The class `Apollonius_graph_filtered_traits_2` aims to paliate this shortcoming. Similar to a filtered kernel, it takes a constructions kernel `CK`, a filtering kernel `FK` and an From f454510de7ecffd74a720b03b9ad1076cab167e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 11 Mar 2020 10:33:40 +0100 Subject: [PATCH 14/14] if a vertex is on a border, its halfedge is not necessarily on the border --- .../CGAL/boost/graph/Euler_operations.h | 38 ++++++++++++------ BGL/test/BGL/test_Euler_operations.cpp | 39 +++++++++++++++++++ 2 files changed, 66 insertions(+), 11 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index 11dd34b1922..2e4656b691c 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -711,19 +711,35 @@ add_face(const VertexRange& vr, Graph& g) break; case 3: // both are new - if (halfedge(v, g) == boost::graph_traits::null_halfedge()) { - set_halfedge(v, outer_prev, g); - next_cache.push_back(NextCacheEntry(outer_prev, outer_next)); + // try to pick a border halfedge with v as target + halfedge_descriptor hv = halfedge(v, g); + if (hv != boost::graph_traits::null_halfedge() && !is_border(hv, g)) + { + BOOST_FOREACH(halfedge_descriptor h_around_v, halfedges_around_target(hv, g)) + if (is_border(h_around_v, g)) + { + hv = h_around_v; + break; + } + if (!is_border(hv, g)) + hv = boost::graph_traits::null_halfedge(); + } + + if (hv == boost::graph_traits::null_halfedge()) + { + set_halfedge(v, outer_prev, g); + next_cache.push_back(NextCacheEntry(outer_prev, outer_next)); + } + else + { + border_prev = hv; + border_next = next(border_prev, g); + next_cache.push_back(NextCacheEntry(border_prev, outer_next)); + next_cache.push_back(NextCacheEntry(outer_prev, border_next)); + } + break; } - else - { - border_prev = halfedge(v, g); - border_next = next(border_prev, g); - next_cache.push_back(NextCacheEntry(border_prev, outer_next)); - next_cache.push_back(NextCacheEntry(outer_prev, border_next)); - } - break; } // set inner link diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 3ae73d6c38d..3f394ed85c0 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -402,6 +402,44 @@ test_swap_edges() } } +template +void +add_face_bug() +{ + typedef boost::graph_traits GT; + typedef typename GT::vertex_descriptor vertex_descriptor; + typedef typename GT::halfedge_descriptor halfedge_descriptor; + + T g; + + std::vector vs; + vs.push_back( add_vertex(g) ); // Kernel::Point_3(0,1,0) + vs.push_back( add_vertex(g) ); // Kernel::Point_3(4,1,0) + vs.push_back( add_vertex(g) ); // Kernel::Point_3(5,2,0) + vs.push_back( add_vertex(g) ); // Kernel::Point_3(4,0,0) + + CGAL::Euler::add_face(CGAL::make_array(vs[0], vs[1], vs[2]), g); + CGAL::Euler::add_face(CGAL::make_array(vs[1], vs[3], vs[2]), g); + + // force vertex halfedge to not be a border halfedge + BOOST_FOREACH(vertex_descriptor v, vertices(g)) + { + halfedge_descriptor h = halfedge(v, g); + if ( CGAL::is_border(h, g) ) + set_halfedge(v, prev(opposite(h, g), g), g); + assert(target(halfedge(v, g), g)==v); + } + + vs.push_back( add_vertex(g) ); // Kernel::Point_3(0,0,0) + vs.push_back( add_vertex(g) ); // Kernel::Point_3(1,0,0) + CGAL::Euler::add_face(CGAL::make_array(vs[4],vs[5],vs[0]), g); + + vs.push_back( add_vertex(g) ); // Kernel::Point_3(2,0,0) + vs.push_back( add_vertex(g) ); // Kernel::Point_3(3,0,0) + CGAL::Euler::add_face(CGAL::make_array(vs[6],vs[7],vs[1]), g); + CGAL::Euler::add_face(CGAL::make_array(vs[7],vs[3],vs[1]), g); +} + template void test_Euler_operations() @@ -421,6 +459,7 @@ test_Euler_operations() join_split_inverse(); does_satisfy_link_condition(); test_swap_edges(); + add_face_bug(); } int main()