diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..369aadbb15f --- /dev/null +++ b/.clang-format @@ -0,0 +1,35 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +AccessModifierOffset: -2 +AllowShortFunctionsOnASingleLine: true +BinPackParameters: false +BreakConstructorInitializers: BeforeComma +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: MultiLine + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +ColumnLimit: 120 +# Force pointers to the type for C++. +DerivePointerAlignment: false +PointerAlignment: Left +# Control the spaces around conditionals +SpacesInConditionalStatement: false +SpaceBeforeParens: false +... diff --git a/AABB_tree/benchmark/AABB_tree/CMakeLists.txt b/AABB_tree/benchmark/AABB_tree/CMakeLists.txt index 63ac01c5851..bfcbb5454fa 100644 --- a/AABB_tree/benchmark/AABB_tree/CMakeLists.txt +++ b/AABB_tree/benchmark/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_traits_benchmark) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) @@ -13,7 +13,7 @@ create_single_source_cgal_program("tree_construction.cpp") find_package(benchmark QUIET) if(benchmark_FOUND) create_single_source_cgal_program("tree_creation.cpp") - target_link_libraries(tree_creation benchmark::benchmark) + target_link_libraries(tree_creation PRIVATE benchmark::benchmark) else() message(STATUS "NOTICE: The benchmark 'tree_creation.cpp' requires the Google benchmark library, and will not be compiled.") endif() diff --git a/AABB_tree/demo/AABB_tree/CMakeLists.txt b/AABB_tree/demo/AABB_tree/CMakeLists.txt index eabac21335c..3af9388139f 100644 --- a/AABB_tree/demo/AABB_tree/CMakeLists.txt +++ b/AABB_tree/demo/AABB_tree/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the AABB tree demo. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_tree_Demo) # Find includes in corresponding build directories diff --git a/AABB_tree/examples/AABB_tree/CMakeLists.txt b/AABB_tree/examples/AABB_tree/CMakeLists.txt index 620a79dccdb..ba856721722 100644 --- a/AABB_tree/examples/AABB_tree/CMakeLists.txt +++ b/AABB_tree/examples/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_tree_Examples) find_package(CGAL REQUIRED) diff --git a/AABB_tree/test/AABB_tree/CMakeLists.txt b/AABB_tree/test/AABB_tree/CMakeLists.txt index 72cd7d066a2..1e13ff0ba26 100644 --- a/AABB_tree/test/AABB_tree/CMakeLists.txt +++ b/AABB_tree/test/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_tree_Tests) find_package(CGAL REQUIRED) diff --git a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt index 3378a510767..255045d782d 100644 --- a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt +++ b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Advancing_front_surface_reconstruction_Examples) find_package(CGAL REQUIRED) diff --git a/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt b/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt index 27973a058d8..23e1dd2529b 100644 --- a/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt +++ b/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Advancing_front_surface_reconstruction_Tests) find_package(CGAL REQUIRED) diff --git a/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt b/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt index caa1060d544..9e12449ab5b 100644 --- a/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt +++ b/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgAlgebraicFoundationsRef -\todo check generated documentation \cgalPkgDescriptionBegin{Algebraic Foundations,PkgAlgebraicFoundations} \cgalPkgPicture{Algebraic_foundations2.png} diff --git a/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt b/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt index 186e8a01b2e..7150fdadd62 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt +++ b/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_foundations_Examples) find_package(CGAL REQUIRED) diff --git a/Algebraic_foundations/include/CGAL/number_utils.h b/Algebraic_foundations/include/CGAL/number_utils.h index 5a5bc2d242d..48d8fc48725 100644 --- a/Algebraic_foundations/include/CGAL/number_utils.h +++ b/Algebraic_foundations/include/CGAL/number_utils.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace CGAL { CGAL_NTS_BEGIN_NAMESPACE diff --git a/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt b/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt index 467fdca406f..170d443ae71 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt +++ b/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_foundations_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt b/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt index 4907d2a4192..b8107073f4a 100644 --- a/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt +++ b/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt @@ -16,7 +16,6 @@ /*! \addtogroup PkgAlgebraicKernelDRef -\todo check generated documentation \cgalPkgDescriptionBegin{Algebraic Kernel,PkgAlgebraicKernelD} \cgalPkgPicture{Algebraic_kernel_d.png} \cgalPkgSummaryBegin diff --git a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt index f93c12d0950..a06ae073399 100644 --- a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_d_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt index 1e6570dd393..0f0d16a3c9c 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_d_Tests) # CGAL and its components diff --git a/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt b/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt index 424bd86fd28..f957c0e835c 100644 --- a/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt +++ b/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_for_circles_Tests) find_package(CGAL REQUIRED) diff --git a/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt b/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt index 637387543f2..0167d0c1d98 100644 --- a/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt +++ b/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_for_spheres_Tests) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt index 493cacad635..35daf075ee4 100644 --- a/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_2_Examples) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h index 43be2407022..6df4b45c7b9 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h @@ -1442,7 +1442,7 @@ Alpha_shape_2::find_alpha_solid() const // takes O(#alpha_shape) time Type_of_alpha alpha_solid = 0; - if (number_of_vertices()<3) return alpha_solid; + if (dimension()!=2) return alpha_solid; Finite_vertices_iterator vertex_it; // only finite vertices diff --git a/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt index a4b13149993..94a0b7a934b 100644 --- a/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_2_Tests) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt index 1028c6f4ea4..097684b274e 100644 --- a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_3_Demo) # Find includes in corresponding build directories diff --git a/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt index 04f6565859d..892c164faa2 100644 --- a/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_3_Examples) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt index e4aca061940..fe6da11668c 100644 --- a/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_3_Tests) find_package(CGAL REQUIRED) diff --git a/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt b/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt index 23150027c4f..c118956dcbf 100644 --- a/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt +++ b/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_wrap_3_Benchmark) find_package(CGAL REQUIRED) diff --git a/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp b/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp index f8e54c488a4..12fa0690c9d 100644 --- a/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp +++ b/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp @@ -75,7 +75,7 @@ double mean_min_angle(const Mesh& mesh) const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh); std::array angles = triangle_angles(tr); - FT min_angle = std::min({angles[0], angles[1], angles[2]}); + FT min_angle = (std::min)({angles[0], angles[1], angles[2]}); min_angle = min_angle * (180.0 / CGAL_PI); mean_min_angle += min_angle; @@ -93,7 +93,7 @@ double mean_max_angle(const Mesh& mesh) const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh); std::array angles = triangle_angles(tr); - FT max_angle = std::max({angles[0], angles[1], angles[2]}); + FT max_angle = (std::max)({angles[0], angles[1], angles[2]}); max_angle = max_angle * (180.0 / CGAL_PI); mean_max_angle += max_angle; @@ -151,8 +151,8 @@ double mean_edge_ratio(const Mesh& mesh, FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1])); FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2])); FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0])); - FT min_edge = std::min({a, b, c}); - FT max_edge = std::max({a, b, c}); + FT min_edge = (std::min)({a, b, c}); + FT max_edge = (std::max)({a, b, c}); FT edge_ratio = max_edge / min_edge; mean_edge_ratio += edge_ratio; @@ -181,7 +181,7 @@ double mean_aspect_ratio(const Mesh& mesh, FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0])); FT s = 0.5 * (a + b + c); FT inscribed_radius = std::sqrt((s * (s - a) * (s - b) * (s - c)) / s); - FT max_edge = std::max({a, b, c}); + FT max_edge = (std::max)({a, b, c}); FT aspect_ratio = max_edge / inscribed_radius; aspect_ratio /= (2. * std::sqrt(3.)); // normalized mean_aspect_ratio += aspect_ratio; diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt b/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt index 8a1c8d1b9fe..ed779a17df5 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_wrap_3_Examples) find_package(CGAL REQUIRED) diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h index efaeb82d330..bcca1bd0143 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h @@ -97,7 +97,7 @@ template class Cell_base_with_timestamp : public Cb { - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: using Has_timestamp = CGAL::Tag_true; @@ -112,7 +112,7 @@ public: public: template Cell_base_with_timestamp(const Args&... args) - : Cb(args...), time_stamp_(-1) + : Cb(args...) { } Cell_base_with_timestamp(const Cell_base_with_timestamp& other) diff --git a/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt b/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt index d719fae8a63..4281c1efcda 100644 --- a/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt +++ b/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_wrap_3_Tests) find_package(CGAL REQUIRED) diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt b/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt index f82d98db1ed..102f019f68c 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgApolloniusGraph2Ref /*! \addtogroup PkgApolloniusGraph2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Apollonius Graphs (Delaunay Graphs of Disks),PkgApolloniusGraph2} \cgalPkgPicture{CircleVoronoi.png} \cgalPkgSummaryBegin diff --git a/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt b/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt index 8b4217331c6..758309e7dc0 100644 --- a/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Apollonius_graph_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt b/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt index c9d061984c7..51ea8576fa6 100644 --- a/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Apollonius_graph_2_Tests) find_package(CGAL REQUIRED) diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt index 2b62b5b12c9..a2df1177140 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt +++ b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arithmetic_kernel_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt index 990e8d5092e..5e94ede8117 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_Demo) if(NOT POLICY CMP0070 AND POLICY CMP0053) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt index fa18ff35df6..faf3db032af 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_earth_Demo) if(NOT POLICY CMP0070 AND POLICY CMP0053) @@ -16,27 +16,24 @@ find_package(Qt6 QUIET COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets Xml) find_package(CGAL COMPONENTS Qt6) find_package(nlohmann_json QUIET 3.9) -if (NOT CGAL_FOUND OR NOT CGAL_Qt6_FOUND OR NOT Qt6_FOUND OR NOT Boost_FOUND OR NOT nlohmann_json_FOUND) - if (NOT CGAL_FOUND) - set(MISSING_DEPS "the CGAL library, ${MISSING_DEPS}") - endif() - if (NOT CGAL_Qt6_FOUND) - set(MISSING_DEPS "the CGAL Qt6 component, ${MISSING_DEPS}") - endif() - if (NOT Qt6_FOUND) - set(MISSING_DEPS "the Qt6 library, ${MISSING_DEPS}") - endif() - if (NOT Boost_FOUND) - set(MISSING_DEPS "the Boost library, ${MISSING_DEPS}") - endif() - if (NOT nlohmann_json_FOUND) - set(MISSING_DEPS "JSON for Modern C++ 3.9+ (know as nlohmann_json), ${MISSING_DEPS}") - endif() - - message(STATUS "NOTICE: This project requires ${MISSING_DEPS} and will not be compiled.") - return() +set(MISSING_DEPS "") +if (NOT CGAL_FOUND) + set(MISSING_DEPS "the CGAL library, ${MISSING_DEPS}") +endif() +if (NOT CGAL_Qt6_FOUND) + set(MISSING_DEPS "the CGAL Qt6 component, ${MISSING_DEPS}") +endif() +if (NOT Qt6_FOUND) + set(MISSING_DEPS "the Qt6 library, ${MISSING_DEPS}") +endif() +if (NOT nlohmann_json_FOUND) + set(MISSING_DEPS "JSON for Modern C++ 3.9+ (know as nlohmann_json), ${MISSING_DEPS}") endif() +if (MISSING_DEPS) + message(STATUS "NOTICE: This project requires ${MISSING_DEPS}and will not be compiled.") + return() +endif() add_compile_definitions(QT_NO_VERSION_TAGGING) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp index 58bc34f3ca2..53f7aba4972 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp @@ -62,7 +62,7 @@ void GUI_country_pick_handler::mouse_press_event(QMouseEvent* e) { auto sd = sqrt(d); auto t1 = (-b - sd) / (2 * a); auto t2 = (-b + sd) / (2 * a); - if (t1 > 0 && t2 > 0) ti = std::min(t1, t2); + if (t1 > 0 && t2 > 0) ti = (std::min)(t1, t2); else if (t1 > 0) ti = t1; else ti = t2; } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp index f99c6c7e55b..decff54e3d5 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp @@ -140,7 +140,7 @@ void Main_widget::initializeGL() { for (auto& [country_name, triangle_points] : country_triangles_map) { auto country_triangles = std::make_unique(triangle_points); auto color = QVector4D(rndm(), rndm(), rndm(), 1); - auto m = std::max(color.x(), std::max(color.y(), color.z())); + auto m = (std::max)(color.x(), (std::max)(color.y(), color.z())); color /= m; color *= m_dimming_factor; color.setW(1); diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h index d4c30698e16..a900bd3f6e7 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h @@ -973,6 +973,7 @@ public: * u_1\f$ to \f$ u_2\f$. * \pre `e1` and `e2` share a common end-vertex, such that the two other * end-vertices of the two edges are associated with `c`'s endpoints. + * \pre `e1` and `e2` have the same direction. */ Halfedge_handle merge_edge(Halfedge_handle e1, Halfedge_handle e2, diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt index 300970a336e..62d1384f312 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt @@ -66,7 +66,6 @@ namespace ArrTraits {} /*! \addtogroup PkgArrangementOnSurface2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Arrangements,PkgArrangementOnSurface2} \cgalPkgPicture{Arrangement_2.png} \cgalPkgSummaryBegin diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt index 2784310f4ed..bb5566835ab 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Qt6) diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp index f8bc222897b..bb113edd04d 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp @@ -14,7 +14,6 @@ int main () #else -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp index aba48b9f222..1665af18e8f 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp @@ -14,7 +14,6 @@ int main () } #else -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp index a88e118f38c..1e4ff25b9af 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include "arr_inexact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp index 77137ced487..c7b0621eace 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp @@ -3,7 +3,6 @@ #include -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp index 5eaccf5db9e..fdb8852661d 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp index 55ea5aada14..86a07143360 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp @@ -2,7 +2,6 @@ // Associating a color attribute with segments using the consolidated // curve-data traits. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp index 4a7b7a57bdb..06c2b6b3f8b 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/curve_history.cpp // Constructing an arrangement with curve history. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp index 88140318fd2..63fec621829 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/dcel_extension.cpp // Extending all DCEL records (vertices, edges and faces). -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp index 441e4f7b6ca..5dab64d1041 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp @@ -3,7 +3,6 @@ #include -#include #include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp index 8ffb6688971..996728bd717 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp @@ -4,7 +4,6 @@ #include -#include #include #include "arr_linear.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp index bf1d504d4f6..92f8d96c893 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp // Removing curves and manipulating edges in an arrangement with history. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp index bc2403f2aeb..480b0eefe31 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp index d1bdaa8bb38..9850df520c4 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/face_extension.cpp // Extending the arrangement-face records. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp index 27459e6ff9e..255e4473822 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp index 72710580dee..55ac76ffb59 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp @@ -2,7 +2,6 @@ // Associating a name attribute with segments using the generic curve-data // traits. -#include #include #include "arr_polylines.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp index aa68c6c247f..8c165cac9f6 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp index 857a5ecdf01..a2d4c8e7f43 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/incremental_insertion.cpp // Using the global incremental insertion functions. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp index 4e38086f3ab..05f95776038 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp @@ -3,7 +3,6 @@ #include -#include #include #include "arr_inexact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp index b62c6a93ff9..6a37fd24094 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp index 5cf95522f18..1cb4d2161a8 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include "arr_linear.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp index b0f990e0ee9..071c118052e 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp index d4261d64dd2..88bbd31b83a 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/observer.cpp // Using a simple arrangement observer. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp index 4f2fa8a38dd..30b0fd90a23 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/overlay.cpp // A simple overlay of two arrangements. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp index 42c7f69aaff..1009abe7d95 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp @@ -3,7 +3,6 @@ #include -#include #include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp index 40d06f4f712..fd49d0fa95a 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp @@ -3,7 +3,6 @@ #include -#include #include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp index 2f3bf04bf61..7213b06f095 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp index 8f9c0458d55..10fbb71ab83 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/point_location.cpp // Answering point-location queries. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp index 309a849e64b..25c74a71836 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp @@ -13,7 +13,6 @@ int main() { #else -#include #include #include "arr_Bezier.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp index 742473a79bf..46432532c00 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp @@ -15,7 +15,6 @@ int main() { #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp index bdaafb9ebb0..7910a723c46 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp @@ -15,7 +15,6 @@ int main() { #include -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp index f0ed969d845..d238706a0df 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include "arr_exact_construction_segments.h" #include "arr_print.h" #include "read_objects.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp index ba27599b22d..e43b1df9ab8 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/spherical_overlay.cpp // Overlay of two arrangements embedded on the sphere. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp index df5715628f7..1f2a4407b16 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp index e870a714ccc..50ac2b19f3e 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp @@ -3,7 +3,6 @@ #include -#include #include #include "arr_linear.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp index e4e415bd825..c1e80f97c82 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/ex_vertical_ray_shooting.cpp // Answering vertical ray-shooting queries. -#include #include #include diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h index 51949d4546e..1e622f83d34 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h @@ -411,7 +411,7 @@ public: m_object(base.construct_opposite_2_object()), m_counter(counter) {} /*! operates */ - X_monotone_curve_2 operator()(const X_monotone_curve_2& xc) + X_monotone_curve_2 operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; @@ -429,7 +429,7 @@ public: m_object(base.compare_endpoints_xy_2_object()), m_counter(counter) {} /*! operates */ - Comparison_result operator()(const X_monotone_curve_2& xc) + Comparison_result operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt index adb6df001b3..60add4ac51b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_Tests) enable_testing() diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt index 96be1186c66..c4db7311c6d 100644 --- a/BGL/doc/BGL/BGL.txt +++ b/BGL/doc/BGL/BGL.txt @@ -88,7 +88,7 @@ boost::graph_traits::edge_iterator ei; Algorithms obtain incidence information in graphs with the help of global functions such as: - `std::pair vertices(const Graph& g);` to obtain an iterator range providing access to all the vertices, or -- `int num_vertices(const Graph&);` to obtain the number of vertices of a graph, or +- `vertices_size_type num_vertices(const Graph&);` to obtain the number of vertices of a graph, or - `vertex_descriptor source(edge_descriptor, const Graph&);` to obtain the source vertex of an edge. Note, that the way we have written the types is a simplification; in reality, diff --git a/BGL/doc/BGL/Concepts/FaceListGraph.h b/BGL/doc/BGL/Concepts/FaceListGraph.h index 40339f34e8f..0010e2c78e2 100644 --- a/BGL/doc/BGL/Concepts/FaceListGraph.h +++ b/BGL/doc/BGL/Concepts/FaceListGraph.h @@ -40,6 +40,6 @@ faces(const FaceListGraph& g); This is the case for implementations only marking faces deleted in the face container. */ template -boost::graph_traits::face_size_type +boost::graph_traits::faces_size_type num_faces(const FaceListGraph& g); diff --git a/BGL/doc/BGL/Concepts/HalfedgeListGraph.h b/BGL/doc/BGL/Concepts/HalfedgeListGraph.h index a709aadaa8b..d66abfdaaed 100644 --- a/BGL/doc/BGL/Concepts/HalfedgeListGraph.h +++ b/BGL/doc/BGL/Concepts/HalfedgeListGraph.h @@ -40,6 +40,6 @@ halfedges(const HalfedgeListGraph& g); This is the case for implementations only marking halfedges deleted in the halfedge container. */ template -boost::graph_traits::halfedge_size_type +boost::graph_traits::halfedges_size_type num_halfedges(const HalfedgeListGraph& g); diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt index e058589c3bf..39d72cd330d 100644 --- a/BGL/doc/BGL/PackageDescription.txt +++ b/BGL/doc/BGL/PackageDescription.txt @@ -741,6 +741,7 @@ user might encounter. - `CGAL::Euler::join_vertex()` - `CGAL::Euler::make_hole()` - `CGAL::Euler::remove_center_vertex()` +- `CGAL::Euler::remove_degree_2_vertex()` - `CGAL::Euler::remove_face()` - `CGAL::Euler::split_edge()` - `CGAL::Euler::split_face()` diff --git a/BGL/examples/BGL_LCC/CMakeLists.txt b/BGL/examples/BGL_LCC/CMakeLists.txt index da350e1ac2d..10fb6c09dc0 100644 --- a/BGL/examples/BGL_LCC/CMakeLists.txt +++ b/BGL/examples/BGL_LCC/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_LCC_Examples) # CGAL and its components diff --git a/BGL/examples/BGL_LCC/distance_lcc.cpp b/BGL/examples/BGL_LCC/distance_lcc.cpp index b19f0ab2b38..7baf0883ff4 100644 --- a/BGL/examples/BGL_LCC/distance_lcc.cpp +++ b/BGL/examples/BGL_LCC/distance_lcc.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) // Here we start at an arbitrary vertex // Any other vertex could be the starting point vertex_iterator vb, ve; - boost::tie(vb,ve)=vertices(lcc); + std::tie(vb,ve)=vertices(lcc); vertex_descriptor vd = *vb; std::cout << "We compute distances to " << vd->point() << std::endl; @@ -45,7 +45,7 @@ int main(int argc, char** argv) boost::on_tree_edge())))); // Traverse all vertices and show at what distance they are - for(boost::tie(vb,ve)=vertices(lcc); vb!=ve; ++vb) + for(std::tie(vb,ve)=vertices(lcc); vb!=ve; ++vb) { vd = *vb; std::cout<point()<<" is "<id()]<<" hops away."<point() << "\n"; } diff --git a/BGL/examples/BGL_LCC/normals_lcc.cpp b/BGL/examples/BGL_LCC/normals_lcc.cpp index b729b0b4792..b91f302563b 100644 --- a/BGL/examples/BGL_LCC/normals_lcc.cpp +++ b/BGL/examples/BGL_LCC/normals_lcc.cpp @@ -31,7 +31,7 @@ void calculate_face_normals(const HalfedgeGraph& g, typedef typename boost::property_traits::value_type normal; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(g); fb != fe; ++fb) + for(std::tie(fb, fe) = faces(g); fb != fe; ++fb) { halfedge_descriptor edg = halfedge(*fb, g); halfedge_descriptor edgb = edg; diff --git a/BGL/examples/BGL_LCC/range_lcc.cpp b/BGL/examples/BGL_LCC/range_lcc.cpp index cdf89714c30..e6aca96a397 100644 --- a/BGL/examples/BGL_LCC/range_lcc.cpp +++ b/BGL/examples/BGL_LCC/range_lcc.cpp @@ -42,10 +42,10 @@ void fct(const LCC& lcc) std::cout << vd->point() << std::endl; } - std::cout << "boost::tie + std::for_each" << std::endl; + std::cout << "std::tie + std::for_each" << std::endl; vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices_range(lcc); + std::tie(vb,ve) = vertices_range(lcc); std::for_each(vb,ve, Fct()); } diff --git a/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp b/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp index 988c0230bae..06153ecf2ce 100644 --- a/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp +++ b/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) typedef boost::transform_iterator,halfedge_around_target_iterator> adjacent_vertex_iterator; halfedge_around_target_iterator hb,he; - boost::tie(hb,he) = halfedges_around_target(halfedge(vd,lcc),lcc); + std::tie(hb,he) = halfedges_around_target(halfedge(vd,lcc),lcc); adjacent_vertex_iterator avib, avie; avib = boost::make_transform_iterator(hb, Source(lcc)); avie = boost::make_transform_iterator(he, Source(lcc)); diff --git a/BGL/examples/BGL_OpenMesh/CMakeLists.txt b/BGL/examples/BGL_OpenMesh/CMakeLists.txt index a5091363a51..c56f97d03d7 100644 --- a/BGL/examples/BGL_OpenMesh/CMakeLists.txt +++ b/BGL/examples/BGL_OpenMesh/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_OpenMesh_Examples) # CGAL and its components diff --git a/BGL/examples/BGL_arrangement_2/CMakeLists.txt b/BGL/examples/BGL_arrangement_2/CMakeLists.txt index b803d5b9a37..d0347efa6e0 100644 --- a/BGL/examples/BGL_arrangement_2/CMakeLists.txt +++ b/BGL/examples/BGL_arrangement_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_arrangement_2_Examples) find_package(CGAL REQUIRED) diff --git a/BGL/examples/BGL_graphcut/CMakeLists.txt b/BGL/examples/BGL_graphcut/CMakeLists.txt index 0de1b979314..8acc8de042c 100644 --- a/BGL/examples/BGL_graphcut/CMakeLists.txt +++ b/BGL/examples/BGL_graphcut/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_graphcut_Examples) diff --git a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt index 8c5c669409b..1141da29b73 100644 --- a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt +++ b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_polyhedron_3_Examples) # CGAL and its components diff --git a/BGL/examples/BGL_polyhedron_3/distance.cpp b/BGL/examples/BGL_polyhedron_3/distance.cpp index 4a289af9760..9547d9b6606 100644 --- a/BGL/examples/BGL_polyhedron_3/distance.cpp +++ b/BGL/examples/BGL_polyhedron_3/distance.cpp @@ -24,9 +24,9 @@ int main(int argc, char** argv) { vertex_iterator vb, ve; int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vit and ve - for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ + for(std::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ vertex_descriptor vd = *vb; vd->id() = index++; } @@ -37,7 +37,7 @@ int main(int argc, char** argv) { // Here we start at an arbitrary vertex // Any other vertex could be the starting point - boost::tie(vb,ve)=vertices(P); + std::tie(vb,ve)=vertices(P); vertex_descriptor vd = *vb; std::cout << "We compute distances to " << vd->point() << std::endl; @@ -54,7 +54,7 @@ int main(int argc, char** argv) { // Traverse all vertices and show at what distance they are - for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ + for(std::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ vd = *vb; std::cout << vd->point() << " is " << distance[vd->id()] << " hops away" << std::endl; } diff --git a/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp b/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp index b951c472d14..464bd9ecbb5 100644 --- a/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp +++ b/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp @@ -36,7 +36,7 @@ adjacent_vertices_V2(const Polyhedron& g, { halfedge_around_target_iterator hi, he; - for(boost::tie(hi, he) = halfedges_around_target(halfedge(vd,g),g); hi != he; ++hi) + for(std::tie(hi, he) = halfedges_around_target(halfedge(vd,g),g); hi != he; ++hi) { *out++ = source(*hi,g); } diff --git a/BGL/examples/BGL_polyhedron_3/kruskal.cpp b/BGL/examples/BGL_polyhedron_3/kruskal.cpp index 64371997377..36b3c625605 100644 --- a/BGL/examples/BGL_polyhedron_3/kruskal.cpp +++ b/BGL/examples/BGL_polyhedron_3/kruskal.cpp @@ -33,9 +33,9 @@ kruskal(const Polyhedron& P) vertex_iterator vb, ve; int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vb and ve - for(boost::tie(vb, ve)=vertices(P); vb!=ve; ++vb){ + for(std::tie(vb, ve)=vertices(P); vb!=ve; ++vb){ vertex_index_pmap[*vb]= index++; } @@ -59,7 +59,7 @@ kruskal(const Polyhedron& P) " coord Coordinate {\n" " point [ \n"; - for(boost::tie(vb, ve) = vertices(P); vb!=ve; ++vb){ + for(std::tie(vb, ve) = vertices(P); vb!=ve; ++vb){ std::cout << " " << (*vb)->point() << "\n"; } diff --git a/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp b/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp index a1280a1b479..1b8d467255c 100644 --- a/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp +++ b/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp @@ -41,7 +41,7 @@ kruskal( const Polyhedron& P) "point [ \n"; vertex_iterator vb, ve; - for(boost::tie(vb,ve) = vertices(P); vb!=ve; ++vb){ + for(std::tie(vb,ve) = vertices(P); vb!=ve; ++vb){ std::cout << (*vb)->point() << "\n"; } @@ -75,9 +75,9 @@ int main() { vertex_iterator vb, ve; int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vit and ve - for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ + for(std::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ vertex_descriptor vd = *vb; vd->id() = index++; } diff --git a/BGL/examples/BGL_polyhedron_3/normals.cpp b/BGL/examples/BGL_polyhedron_3/normals.cpp index 711800cb8ab..d6ed605de84 100644 --- a/BGL/examples/BGL_polyhedron_3/normals.cpp +++ b/BGL/examples/BGL_polyhedron_3/normals.cpp @@ -26,7 +26,7 @@ void calculate_face_normals(const HalfedgeGraph& g, typedef typename boost::property_traits::value_type normal; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(g); fb != fe; ++fb) + for(std::tie(fb, fe) = faces(g); fb != fe; ++fb) { halfedge_descriptor edg = halfedge(*fb, g); halfedge_descriptor edgb = edg; diff --git a/BGL/examples/BGL_polyhedron_3/range.cpp b/BGL/examples/BGL_polyhedron_3/range.cpp index bf54640120f..fcf325cba3b 100644 --- a/BGL/examples/BGL_polyhedron_3/range.cpp +++ b/BGL/examples/BGL_polyhedron_3/range.cpp @@ -40,10 +40,10 @@ void fct(const Polyhedron& p) std::cout << vd->point() << std::endl; } - std::cout << "boost::tie + std::for_each" << std::endl; + std::cout << "std::tie + std::for_each" << std::endl; vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices_range(p); + std::tie(vb,ve) = vertices_range(p); std::for_each(vb,ve, Fct()); } diff --git a/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp b/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp index 5642ab08d6a..3ff09778fe1 100644 --- a/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp +++ b/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) typedef boost::transform_iterator,halfedge_around_target_iterator> adjacent_vertex_iterator; halfedge_around_target_iterator hb,he; - boost::tie(hb,he) = halfedges_around_target(halfedge(vd,P),P); + std::tie(hb,he) = halfedges_around_target(halfedge(vd,P),P); adjacent_vertex_iterator avib, avie; avib = boost::make_transform_iterator(hb, Source(P)); avie = boost::make_transform_iterator(he, Source(P)); diff --git a/BGL/examples/BGL_surface_mesh/CMakeLists.txt b/BGL/examples/BGL_surface_mesh/CMakeLists.txt index 921104583dc..87982059ae9 100644 --- a/BGL/examples/BGL_surface_mesh/CMakeLists.txt +++ b/BGL/examples/BGL_surface_mesh/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_surface_mesh_Examples) find_package(CGAL REQUIRED) diff --git a/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp b/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp index 1f57a67524f..58704355d62 100644 --- a/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp +++ b/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv) std::ofstream outxyz("out.xyz"); outxyz.precision(17); boost::graph_traits::vertex_iterator vit, ve; - boost::tie(vit, ve) = vertices(sm); + std::tie(vit, ve) = vertices(sm); for(; vit!=ve; ++vit) { if(get(vertex_pid_map, *vit) == 0) diff --git a/BGL/examples/BGL_triangulation_2/CMakeLists.txt b/BGL/examples/BGL_triangulation_2/CMakeLists.txt index 7d479d36c4f..d597f2217dd 100644 --- a/BGL/examples/BGL_triangulation_2/CMakeLists.txt +++ b/BGL/examples/BGL_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_triangulation_2_Examples) find_package(CGAL REQUIRED) diff --git a/BGL/include/CGAL/boost/graph/Dual.h b/BGL/include/CGAL/boost/graph/Dual.h index 4ca45b9bcec..59156f7232d 100644 --- a/BGL/include/CGAL/boost/graph/Dual.h +++ b/BGL/include/CGAL/boost/graph/Dual.h @@ -306,7 +306,7 @@ edge(typename boost::graph_traits >::vertex_descriptor u, const Dual

& dual) { typename boost::graph_traits >::out_edge_iterator e, e_end; - for(boost::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) { + for(std::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) { if(target(*e, dual) == v) return std::make_pair(*e, true); } @@ -391,7 +391,7 @@ halfedge(typename boost::graph_traits >::vertex_descriptor u, const Dual

& dual) { typename boost::graph_traits >::out_edge_iterator e, e_end; - for(boost::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) { + for(std::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) { if(target(*e, dual) == v) return std::make_pair(halfedge(*e, dual), true); } diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index f8c79165bc5..ece862d5dc7 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -12,10 +12,6 @@ #ifndef CGAL_EULER_OPERATIONS_H #define CGAL_EULER_OPERATIONS_H -#include -#include -#include - #include #include @@ -27,6 +23,10 @@ #include +#include +#include +#include + namespace CGAL { /// \cond SKIP_IN_MANUAL @@ -136,7 +136,7 @@ join_vertex(typename boost::graph_traits::halfedge_descriptor h, CGAL_assertion( halfedge(v_to_remove, v, g).first == h ); halfedge_around_vertex_iterator ieb, iee; - for(boost::tie(ieb, iee) = halfedges_around_target(hop, g); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = halfedges_around_target(hop, g); ieb != iee; ++ieb) { CGAL_assertion( target(*ieb,g) == v_to_remove); set_target(*ieb ,v , g); } @@ -615,7 +615,7 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm) for(std::size_t i=0; i < N; ++i){ halfedge_descriptor hd; bool found; - boost::tie(hd,found) = halfedge(face[i],face[i+1],sm); + std::tie(hd,found) = halfedge(face[i],face[i+1],sm); if(found && (! is_border(hd,sm))){ return false; } @@ -1149,7 +1149,7 @@ void make_hole(typename boost::graph_traits::halfedge_descriptor h, face_descriptor fd = face(h, g); halfedge_around_face_iterator hafib, hafie; - for(boost::tie(hafib, hafie) = halfedges_around_face(h, g); + for(std::tie(hafib, hafie) = halfedges_around_face(h, g); hafib != hafie; ++hafib){ CGAL_assertion(! is_border(opposite(*hafib,g),g)); @@ -1361,7 +1361,7 @@ add_vertex_and_face_to_border(typename boost::graph_traits::halfedge_desc internal::set_border(he2,g); CGAL::Halfedge_around_face_iterator hafib,hafie; - for(boost::tie(hafib, hafie) = halfedges_around_face(ohe1, g); + for(std::tie(hafib, hafie) = halfedges_around_face(ohe1, g); hafib != hafie; ++hafib){ set_face(*hafib, f, g); @@ -1421,7 +1421,7 @@ add_face_to_border(typename boost::graph_traits::halfedge_descriptor h1, internal::set_border(newhop, g); CGAL::Halfedge_around_face_iterator hafib,hafie; - for(boost::tie(hafib, hafie) = halfedges_around_face(newh, g); + for(std::tie(hafib, hafie) = halfedges_around_face(newh, g); hafib != hafie; ++hafib){ set_face(*hafib, f, g); @@ -1458,7 +1458,7 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor // The following loop checks the link condition for v0_v1. // Specifically, that for every vertex 'k' adjacent to both 'p and 'q', 'pkq' is a face of the mesh. // - for ( boost::tie(eb1,ee1) = halfedges_around_source(v0,g) ; eb1 != ee1 ; ++ eb1 ) + for ( std::tie(eb1,ee1) = halfedges_around_source(v0,g) ; eb1 != ee1 ; ++ eb1 ) { halfedge_descriptor v0_k = *eb1; @@ -1466,7 +1466,7 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor { vertex_descriptor k = target(v0_k,g); - for ( boost::tie(eb2,ee2) = halfedges_around_source(k,g) ; eb2 != ee2 ; ++ eb2 ) + for ( std::tie(eb2,ee2) = halfedges_around_source(k,g) ; eb2 != ee2 ; ++ eb2 ) { halfedge_descriptor k_v1 = *eb2; @@ -1866,10 +1866,95 @@ bool satisfies_link_condition(typename boost::graph_traits::edge_descript } /// \endcond #endif + +/** + * removes the target vertex of `h`, merging its incident edges into a single edge linking + * the two vertices adjacent to the vertex being removed. + * + * \tparam Graph must be a model of `MutableFaceGraph` + * + * \param h halfedge descriptor + * \param g the graph + * + * \returns an halfedge linking the two vertices adjacent to the vertex being removed. + * + * \pre `degree(target(h, g), g) == 2`. + * + * \sa `remove_center_vertex()` + */ + +template +typename boost::graph_traits::halfedge_descriptor +remove_degree_2_vertex(const typename boost::graph_traits::halfedge_descriptor h, + Graph& g) +{ + typedef boost::graph_traits Traits; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::halfedge_descriptor halfedge_descriptor; + typedef typename Traits::face_descriptor face_descriptor; + + CGAL_precondition(degree(target(h, g), g) == 2); + + vertex_descriptor v = target(h, g); + halfedge_descriptor h1 = h; + halfedge_descriptor h2 = opposite(next(h1, g), g); + + if(is_border(h1, g)) + std::swap(h1, h2); + + vertex_descriptor v1 = source(h1, g); + vertex_descriptor v2 = source(h2, g); + + bool exists; + halfedge_descriptor huv; + std::tie(huv, exists) = halfedge(v1, v2, g); + + if(is_border(h2, g)) + { + CGAL_assertion(!is_border(h1, g)); + + if(exists) + { + Euler::remove_face(h1, g); + return huv; + } + else + { + halfedge_descriptor oh1 = opposite(h1, g); + halfedge_descriptor nnh1 = next(next(h1, g), g); + halfedge_descriptor ph2 = prev(h2, g); + face_descriptor f1 = face(h1, g); + + set_target(h1, v2, g); + set_halfedge(v2, ph2, g); + set_next(h1, nnh1, g); + set_next(ph2, oh1, g); + set_halfedge(f1, h1, g); // in case it was nh1 + + remove_edge(edge(h2, g), g); + remove_vertex(v, g); + + return h1; + } + } + else + { + CGAL_assertion(!is_border(h1, g) && !is_border(h2, g)); + + halfedge_descriptor ph1 = prev(h1, g); + halfedge_descriptor ph2 = prev(h2, g); + Euler::remove_center_vertex(h, g); + + if(exists) + return huv; + else + return Euler::split_face(ph1, ph2, g); + } +} + /// @} } // namespace Euler - } // namespace CGAL #endif /* CGAL_EULER_OPERATIONS_H */ diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index 362f6b241b1..00097ff1574 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -895,7 +895,7 @@ vertices(const Face_filtered_graph & w) typename Face_filtered_graph ::Is_simplex_valid predicate(&w); g_vertex_iterator b,e; - boost::tie(b,e) = vertices(w.graph()); + std::tie(b,e) = vertices(w.graph()); return make_range(vertex_iterator(predicate, b, e), vertex_iterator(predicate, e, e)); } @@ -912,7 +912,7 @@ edges(const Face_filtered_graph & w) typename Face_filtered_graph ::Is_simplex_valid predicate(&w); g_edge_iterator b,e; - boost::tie(b,e) = edges(w.graph()); + std::tie(b,e) = edges(w.graph()); return make_range(edge_iterator(predicate, b, e), edge_iterator(predicate, e, e)); } @@ -931,7 +931,7 @@ out_edges(typename boost::graph_traits ::Is_simplex_valid predicate(&w); g_out_edge_iterator b,e; - boost::tie(b,e) = out_edges(v, w.graph()); + std::tie(b,e) = out_edges(v, w.graph()); return make_range(out_edge_iterator(predicate, b, e), out_edge_iterator(predicate, e, e)); } @@ -950,7 +950,7 @@ in_edges(typename boost::graph_traits ::Is_simplex_valid predicate(&w); g_in_edge_iterator b,e; - boost::tie(b,e) = in_edges(v, w.graph()); + std::tie(b,e) = in_edges(v, w.graph()); return make_range(in_edge_iterator(predicate, b, e), in_edge_iterator(predicate, e, e)); } diff --git a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h index 368c5fca524..ad107978828 100644 --- a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h +++ b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h @@ -310,7 +310,7 @@ edge(typename boost::graph_traits >::ver CGAL_assertion(in_same_graph(v,w)); bool b; g_edge_descriptor ed; - boost::tie(ed,b) = edge(u.descriptor, v.descriptor, *w.graph); + std::tie(ed,b) = edge(u.descriptor, v.descriptor, *w.graph); return std::make_pair(edge_descriptor(ed,*w.graph),b); } @@ -320,7 +320,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::vertex_iterator b,e; - boost::tie(b,e) = vertices(*w.graph); + std::tie(b,e) = vertices(*w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::V2V(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::V2V(*w.graph))); } @@ -330,7 +330,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::edge_iterator b,e; - boost::tie(b,e) = edges(*w.graph); + std::tie(b,e) = edges(*w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::E2E(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::E2E(*w.graph))); } @@ -342,7 +342,7 @@ out_edges(typename boost::graph_traits > { CGAL_assertion(in_same_graph(v,w)); typename boost::graph_traits::out_edge_iterator b,e; - boost::tie(b,e) = out_edges(v.descriptor, *w.graph); + std::tie(b,e) = out_edges(v.descriptor, *w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::E2E(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::E2E(*w.graph))); } @@ -354,7 +354,7 @@ in_edges(typename boost::graph_traits >: { CGAL_assertion(in_same_graph(v,w)); typename boost::graph_traits::in_edge_iterator b,e; - boost::tie(b,e) = in_edges(v.descriptor, *w.graph); + std::tie(b,e) = in_edges(v.descriptor, *w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::E2E(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::E2E(*w.graph))); } @@ -557,7 +557,7 @@ halfedge(typename boost::graph_traits< Graph_with_descriptor_with_graph > bool b; CGAL_assertion(in_same_graph(u,w)); CGAL_assertion(in_same_graph(v,w)); - boost::tie(hd,b) = halfedge(u.descriptor, v.descriptor, *w.graph); + std::tie(hd,b) = halfedge(u.descriptor, v.descriptor, *w.graph); return std::make_pair(halfedge_descriptor(hd,*w.graph),b); } @@ -621,7 +621,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::halfedge_iterator b,e; - boost::tie(b,e) = halfedges(*w.graph); + std::tie(b,e) = halfedges(*w.graph); return std::make_pair(boost::make_transform_iterator(b, typename boost::graph_traits >::H2H(*w.graph)), boost::make_transform_iterator(e, typename boost::graph_traits >::H2H(*w.graph))); } @@ -661,7 +661,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::face_iterator b,e; - boost::tie(b,e) = faces(*w.graph); + std::tie(b,e) = faces(*w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::F2F(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::F2F(*w.graph))); } diff --git a/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h b/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h index 9a217389d82..32a2cb66294 100644 --- a/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h +++ b/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h @@ -61,7 +61,7 @@ void partition_dual_graph(const TriangleMesh& tm, // fill the adjacency info face_iterator fit, fe; - boost::tie(fit, fe) = faces(tm); + std::tie(fit, fe) = faces(tm); for(int i=0, j=0; fit!=fe; ++fit, ++i) { eptr[i] = j; diff --git a/BGL/include/CGAL/boost/graph/METIS/partition_graph.h b/BGL/include/CGAL/boost/graph/METIS/partition_graph.h index 42f8c240f01..362d8a1502b 100644 --- a/BGL/include/CGAL/boost/graph/METIS/partition_graph.h +++ b/BGL/include/CGAL/boost/graph/METIS/partition_graph.h @@ -47,7 +47,7 @@ struct Output_vertex_partition_ids VertexPartitionIDPmap vertex_partition_id_map) { typename boost::graph_traits::vertex_iterator vit, ve; - boost::tie(vit, ve) = vertices(tm); + std::tie(vit, ve) = vertices(tm); for(; vit!=ve; ++vit) put(vertex_partition_id_map, *vit, npart[get(indices, *vit)]); } @@ -64,7 +64,7 @@ struct Output_face_partition_ids FacePartitionIDPmap face_partition_id_map) { typename boost::graph_traits::face_iterator fit, fe; - boost::tie(fit, fe) = faces(tm); + std::tie(fit, fe) = faces(tm); for(int i=0; fit!=fe; ++fit, ++i) put(face_partition_id_map, *fit, epart[i]); } @@ -98,7 +98,7 @@ void partition_graph(const TriangleMesh& tm, // fill the adjacency info face_iterator fit, fe; - boost::tie(fit, fe) = faces(tm); + std::tie(fit, fe) = faces(tm); for(int i=0, j=0; fit!=fe; ++fit, ++i) { eptr[i] = j; diff --git a/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h b/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h index b2d6e1cc840..75014bd9371 100644 --- a/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h +++ b/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h @@ -238,7 +238,7 @@ public: // initialize vertex indices, it is necessary since we are using VertexList = listS Vertex_iterator v_begin, v_end; Traits::vertices_size_type index = 0; - for(boost::tie(v_begin, v_end) = vertices(graph); v_begin != v_end; ++v_begin) { + for(std::tie(v_begin, v_end) = vertices(graph); v_begin != v_end; ++v_begin) { boost::put(boost::vertex_index, graph, *v_begin, index++); } } @@ -269,8 +269,8 @@ public: Edge_descriptor v1_v2, v2_v1; bool v1_v2_added, v2_v1_added; - boost::tie(v1_v2, v1_v2_added) = boost::add_edge(v1, v2, graph); - boost::tie(v2_v1, v2_v1_added) = boost::add_edge(v2, v1, graph); + std::tie(v1_v2, v1_v2_added) = boost::add_edge(v1, v2, graph); + std::tie(v2_v1, v2_v1_added) = boost::add_edge(v2, v1, graph); CGAL_assertion(v1_v2_added && v2_v1_added); //put edge capacities @@ -360,7 +360,7 @@ public: // however from our edge_map, we know that each (2i, 2i + 1) is reverse pairs, how to facilitate that ? // will look it back Graph::edge_iterator ei, ee; - for(boost::tie(ei, ee) = boost::edges(graph); ei != ee; ++ei) { + for(std::tie(ei, ee) = boost::edges(graph); ei != ee; ++ei) { Graph::vertex_descriptor v1 = boost::source(*ei, graph); Graph::vertex_descriptor v2 = boost::target(*ei, graph); std::pair opp_edge = boost::edge(v2, v1, graph); diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 75673493e0d..26b358b3561 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -65,7 +65,7 @@ is_border(typename boost::graph_traits::vertex_descriptor vd, const FaceGraph& g) { CGAL::Halfedge_around_target_iterator havib, havie; - for(boost::tie(havib, havie) = halfedges_around_target(halfedge(vd, g), g); havib != havie; ++havib) { + for(std::tie(havib, havie) = halfedges_around_target(halfedge(vd, g), g); havib != havie; ++havib) { if(is_border(*havib,g)) { typename boost::graph_traits::halfedge_descriptor h = *havib; return h; diff --git a/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h b/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h index 679d48896f1..194bd6b95b1 100644 --- a/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h +++ b/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h @@ -147,7 +147,7 @@ void duplicate_terminal_vertices(Graph& graph, typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; vertex_iterator b,e; - boost::tie(b,e) = vertices(graph); + std::tie(b,e) = vertices(graph); std::vector V(b,e); for(vertex_descriptor v : V) { @@ -156,7 +156,7 @@ void duplicate_terminal_vertices(Graph& graph, if (deg != 2 || is_terminal(orig_v, orig)) { out_edge_iterator b, e; - boost::tie(b, e) = out_edges(v, graph); + std::tie(b, e) = out_edges(v, graph); std::vector out_edges_of_v(b, e); for (unsigned int i = 1; i < out_edges_of_v.size(); ++i) { diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index 53d474d67e2..bc18562bb6e 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_Tests) # CGAL and its components diff --git a/BGL/test/BGL/data/degree_2_collection.off b/BGL/test/BGL/data/degree_2_collection.off new file mode 100644 index 00000000000..629a920c99d --- /dev/null +++ b/BGL/test/BGL/data/degree_2_collection.off @@ -0,0 +1,52 @@ +OFF +29 19 0 + +0 0 0 +0.20000000000000001 0 0 +0.40000000000000002 0 0 +0.59999999999999998 0 0 +0.80000000000000004 0 0 +1 0 0 +0 0.20000000000000001 0 +0.20000000000000001 0.20000000000000001 0 +0 1 0 +0.59999999999999998 0.20000000000000001 0 +0.80000000000000004 0.20000000000000001 0 +1 0.20000000000000001 0 +0 0.40000000000000002 0 +0.20000000000000001 1 0 +0.40000000000000002 0.40000000000000002 0 +0.59999999999999998 0.40000000000000002 0 +1 1 0 +1 0.40000000000000002 0 +0 0.59999999999999998 0 +1 0.80000000000000004 0 +0.59999999999999998 1 0 +0.59999999999999998 0.59999999999999998 0 +0.80000000000000004 1 0 +1 0.59999999999999998 0 +0 0.80000000000000004 0 +0.20000000000000001 0.80000000000000004 0 +0.40000000000000002 1 0 +0.59999999999999998 0.80000000000000004 0 +0.80000000000000004 0.80000000000000004 0 +4 1 7 6 0 +3 28 19 22 +3 6 7 12 +3 4 10 9 +3 3 4 9 +3 27 20 26 +3 9 15 14 +3 5 11 10 +3 24 25 8 +3 25 13 8 +3 1 2 7 +8 17 23 28 27 21 15 10 11 +3 9 10 15 +3 19 16 22 +12 25 24 18 12 7 2 3 9 14 15 21 27 +3 4 5 10 +3 28 22 20 +3 27 28 20 +3 23 19 28 + diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 615a4fd756d..758825d0943 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -1,12 +1,15 @@ #include "test_Prefix.h" -#include + #include #include +#include +#include +#include #include -#include -#include + +#include template void @@ -97,7 +100,7 @@ join_face_test() bool found; halfedge_descriptor e; - boost::tie(e, found) = halfedge(f.w, f.v, f.m); + std::tie(e, found) = halfedge(f.w, f.v, f.m); assert(found); // manually set the halfedge of f.f1 to the edge that is to be // removed to provoke a special case @@ -108,7 +111,7 @@ join_face_test() assert(CGAL::internal::exact_num_edges(f.m) == 6); CGAL::Halfedge_around_face_iterator begin, end; - boost::tie(begin, end) = CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m); + std::tie(begin, end) = CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m); assert(std::distance(begin, end) == 4); for(; begin != end; ++begin) { @@ -119,7 +122,7 @@ join_face_test() } face_iterator fit, fend; - for(boost::tie(fit, fend) = faces(f.m); fit != fend; ++fit) { + for(std::tie(fit, fend) = faces(f.m); fit != fend; ++fit) { assert(*fit == f.f1 || *fit == f.f3); } @@ -141,7 +144,7 @@ remove_face_test_1() // find the edge between x and y bool found; halfedge_descriptor e; - boost::tie(e, found) = halfedge(f.x, f.y, f.m); + std::tie(e, found) = halfedge(f.x, f.y, f.m); assert(found); assert(face(e, f.m) == f.f3); @@ -156,7 +159,7 @@ remove_face_test_1() assert_EQUAL(CGAL::internal::exact_num_vertices(f.m) == 4); halfedge_iterator eb, ee; int count = 0; - for(boost::tie(eb, ee) = halfedges(f.m); eb != ee; ++eb) { + for(std::tie(eb, ee) = halfedges(f.m); eb != ee; ++eb) { if(face(*eb,f.m) == boost::graph_traits::null_face()) ++count; } @@ -177,9 +180,9 @@ remove_face_test_2() bool found; halfedge_descriptor e; - boost::tie(e, found) = halfedge(f.x, f.w, f.m); + std::tie(e, found) = halfedge(f.x, f.w, f.m); assert(found); - boost::tie(e, found) = halfedge(f.x, f.v, f.m); + std::tie(e, found) = halfedge(f.x, f.v, f.m); assert(found); assert(face(e, f.m) == f.f1); CGAL::Euler::remove_face(e,f.m); @@ -189,7 +192,7 @@ remove_face_test_2() assert(CGAL::internal::exact_num_edges(f.m) == 7); assert(CGAL::internal::exact_num_vertices(f.m) == 5); - boost::tie(e, found) = halfedge(f.x, f.w, f.m); + std::tie(e, found) = halfedge(f.x, f.w, f.m); assert(found); assert(face(e,f.m) == boost::graph_traits::null_face()); @@ -266,7 +269,7 @@ join_vertex_interior_test() halfedge_descriptor e; bool found; - boost::tie(e, found) = halfedge(f.w, f.x, f.m); + std::tie(e, found) = halfedge(f.w, f.x, f.m); assert(found); CGAL::Euler::join_vertex(e,f.m); assert(CGAL::internal::exact_num_faces(f.m) == 2); @@ -289,7 +292,7 @@ join_vertex_exterior_test() Surface_fixture_3 f; halfedge_descriptor e; bool found; - boost::tie(e, found) = halfedge(f.w, f.y, f.m); + std::tie(e, found) = halfedge(f.w, f.y, f.m); assert(source(e,f.m) == f.w); assert(target(e,f.m) == f.y); assert(found); @@ -307,7 +310,7 @@ join_vertex_exterior_test() Surface_fixture_3 f; halfedge_descriptor e; bool found; - boost::tie(e, found) = halfedge(f.y, f.w, f.m); + std::tie(e, found) = halfedge(f.y, f.w, f.m); assert(source(e,f.m) == f.y); assert(target(e,f.m) == f.w); @@ -335,9 +338,9 @@ split_vertex() Surface_fixture_3 f; halfedge_descriptor h1, h2; bool found; - boost::tie(h1, found) = halfedge(f.w, f.y, f.m); + std::tie(h1, found) = halfedge(f.w, f.y, f.m); assert(found); - boost::tie(h2, found) = halfedge(f.z, f.y, f.m); + std::tie(h2, found) = halfedge(f.z, f.y, f.m); assert(found); assert(face(h2, f.m) == Traits::null_face()); @@ -358,13 +361,13 @@ split_join_vertex_inverse() Surface_fixture_3 f; halfedge_descriptor h, h1, h2; bool found; - boost::tie(h, found) = halfedge(f.w, f.x, f.m); + std::tie(h, found) = halfedge(f.w, f.x, f.m); assert(found); CGAL::Euler::join_vertex(h,f.m); assert(CGAL::is_valid_polygon_mesh(f.m)); - boost::tie(h1, found) = halfedge(f.z, f.x, f.m); + std::tie(h1, found) = halfedge(f.z, f.x, f.m); assert(found); - boost::tie(h2, found) = halfedge(f.v, f.x, f.m); + std::tie(h2, found) = halfedge(f.v, f.x, f.m); assert(found); CGAL::Euler::join_vertex(CGAL::Euler::split_vertex(h1, h2,f.m),f.m); assert(CGAL::is_valid_polygon_mesh(f.m)); @@ -448,6 +451,67 @@ remove_center_vertex_test() assert(CGAL::internal::exact_num_halfedges(f.m) == nh-(2*deg)); } +template +void +remove_degree_2_vertex_test() +{ + CGAL_GRAPH_TRAITS_MEMBERS(T); + + // vertex at .first should be removable, and after removal, + // there should .second[0] nv, .second[1] ne, and .second[2] nf + // anything not in the map should not be removable + std::map > removable; + removable[0] = CGAL::make_array(28, 92, 19); + removable[13] = CGAL::make_array(28, 90, 18); + removable[14] = CGAL::make_array(28, 90, 18); + removable[16] = CGAL::make_array(28, 90, 18); + removable[17] = CGAL::make_array(28, 92, 19); + removable[18] = CGAL::make_array(28, 92, 19); + removable[21] = CGAL::make_array(28, 92, 19); + removable[26] = CGAL::make_array(28, 90, 18); + + auto test = [&removable](const std::size_t hi) // intentional copy of 'm' + { + T m; + const bool ok = CGAL::IO::read_polygon_mesh("data/degree_2_collection.off", m); + assert(ok); + assert(CGAL::is_valid_polygon_mesh(m)); + + auto vim = CGAL::get_initialized_vertex_index_map(m); + + const halfedge_descriptor h = *(std::next(halfedges(m).begin(), hi)); + const vertex_descriptor v = target(h, m); + auto vid = get(vim, v); + if(degree(v, m) != 2) + { + assert(removable.count(vid) == 0); + return; + } + + const halfedge_descriptor res = CGAL::Euler::remove_degree_2_vertex(h, m); + assert(res != boost::graph_traits::null_halfedge()); + + const std::array& ns = removable.at(vid); + + assert(ns[0] == vertices(m).size()); + assert(ns[1] == halfedges(m).size()); + assert(ns[2] == faces(m).size()); + }; + + T m; + const bool ok = CGAL::IO::read_polygon_mesh("data/degree_2_collection.off", m); + assert(ok); + assert(CGAL::is_valid_polygon_mesh(m)); + + std::size_t nv = num_vertices(m); + std::size_t nh = num_halfedges(m); + std::size_t nf = num_faces(m); + assert(nv == 29 && nh == 94 && nf == 19); + + for(std::size_t hi=0; hi void join_split_inverse() @@ -670,6 +734,8 @@ template void test_Euler_operations() { + std::cout << "== Test with Graph: " << typeid(Graph).name() << std::endl; + test_copy_face_graph_nm_umbrella(); test_copy_face_graph_isolated_vertices(); join_face_test(); @@ -684,6 +750,7 @@ test_Euler_operations() split_face_test(); make_hole_test(); remove_center_vertex_test(); + remove_degree_2_vertex_test(); join_split_inverse(); does_satisfy_link_condition(); test_swap_edges(); diff --git a/BGL/test/BGL/test_Face_filtered_graph.cpp b/BGL/test/BGL/test_Face_filtered_graph.cpp index 84e1bbbf69f..e6cfc53be6e 100644 --- a/BGL/test/BGL/test_Face_filtered_graph.cpp +++ b/BGL/test/BGL/test_Face_filtered_graph.cpp @@ -29,9 +29,9 @@ void test_halfedge_around_vertex_iterator(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); typename boost::graph_traits::vertex_iterator vit, vend; - for(boost::tie(vit, vend) = vertices(fg); vit != vend; ++vit) { + for(std::tie(vit, vend) = vertices(fg); vit != vend; ++vit) { halfedge_around_target_iterator havit, havend; - for(boost::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, fg), fg); + for(std::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, fg), fg); havit != havend; ++havit) { assert(target(*havit, fg) == *vit); @@ -56,11 +56,11 @@ void test_halfedge_around_face_iterator(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); face_iterator fit, fend; - for(boost::tie(fit, fend) = faces(fg); fit != fend; ++fit) { + for(std::tie(fit, fend) = faces(fg); fit != fend; ++fit) { halfedge_around_face_iterator hafit, hafend; - boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); + std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); assert(std::distance(hafit, hafend) != 0); - for(boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); hafit != hafend; ++hafit) { + for(std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); hafit != hafend; ++hafit) { assert(face(*hafit, fg) == *fit); } } @@ -78,11 +78,11 @@ void test_edge_iterators(const Graph& g) // do we iterate as many as that? edge_iterator eb, ee; - boost::tie(eb, ee) = edges(fg); + std::tie(eb, ee) = edges(fg); assert(static_cast(std::distance(eb, ee)) == num_edges(g)); id_map ids; unsigned int count = 0; - for(boost::tie(eb, ee) = edges(fg); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(fg); eb != ee; ++eb) { edge_descriptor e = *eb; std::pair r = ids.insert(get(boost::edge_index, g, e)); // unique? @@ -103,7 +103,7 @@ void test_vertex_iterators(Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); vertex_iterator vb, ve; std::size_t count = 0; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb){ + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb){ ++count; } @@ -113,7 +113,7 @@ void test_vertex_iterators(Graph& g) id_map ids; count = 0; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { std::pair r = ids.insert(get(boost::vertex_index, g, *vb)); assert(r.second); ++count; @@ -133,12 +133,12 @@ void test_out_edges(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { vertex_descriptor t = target(*oeb, fg); vertex_descriptor s = source(*oeb, fg); assert(s != t); @@ -162,11 +162,11 @@ void test_in_edges(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { vertex_descriptor t = target(*ieb, fg); vertex_descriptor s = source(*ieb, fg); assert(t == around); @@ -190,18 +190,18 @@ void test_in_out_edges(const Graph& g) // check that the sets of in out edges are the same vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { id_map v_ids; std::vector in, out; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, source(*ieb, fg))); assert(r.second); in.push_back(source(*ieb, fg)); } out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, target(*oeb, fg))); // insertion must fail @@ -232,7 +232,7 @@ void test_edge_find(const Graph& g) typedef std::pair ret; edge_iterator eb, ee; - for(boost::tie(eb, ee) = edges(fg); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(fg); eb != ee; ++eb) { vertex_descriptor s = source(*eb, fg); vertex_descriptor t = target(*eb, fg); ret found = edge(s, t, fg); @@ -256,14 +256,14 @@ void test_faces(const Graph& g) unsigned int count = 0; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(fg); fb != fe; ++fb) { + for(std::tie(fb, fe) = faces(fg); fb != fe; ++fb) { ++count; // reverse look-up halfedge_descriptor assoc = halfedge(*fb, fg); assert(face(assoc, fg) == *fb); // check the enclosure halfedge_around_face_iterator encb, ence; - for(boost::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, fg), fg); encb != ence; ++encb) { + for(std::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, fg), fg); encb != ence; ++encb) { assert(face(*encb, fg) == *fb); } } diff --git a/BGL/test/BGL/test_OpenMesh.cpp b/BGL/test/BGL/test_OpenMesh.cpp index 0dede3e68ed..e3ddcc9c2ca 100644 --- a/BGL/test/BGL/test_OpenMesh.cpp +++ b/BGL/test/BGL/test_OpenMesh.cpp @@ -10,13 +10,29 @@ typedef Traits::edge_descriptor edge_descriptor; typedef Traits::halfedge_descriptor halfedge_descriptor; typedef Traits::vertex_descriptor vertex_descriptor; typedef Traits::face_descriptor face_descriptor; -//typedef Kernel::Point_3 Point_3; int main() { Om om; - for (Om::EdgeHandle ed : edges(om)) { - std::cout << "edge" << std::endl; + for (Om::EdgeHandle ed : edges(om)) + { + CGAL_USE(ed); + } + for (edge_descriptor ed : edges(om)) + { + CGAL_USE(ed); + } + for (halfedge_descriptor hd : halfedges(om)) + { + CGAL_USE(hd); + } + for (face_descriptor fd : faces(om)) + { + CGAL_USE(fd); + } + for (vertex_descriptor vd : vertices(om)) + { + CGAL_USE(vd); } return 0; } diff --git a/BGL/test/BGL/test_Prefix.h b/BGL/test/BGL/test_Prefix.h index ca92ed230f2..fe866af6842 100644 --- a/BGL/test/BGL/test_Prefix.h +++ b/BGL/test/BGL/test_Prefix.h @@ -238,7 +238,7 @@ struct Surface_fixture_1 { pm = get(CGAL::vertex_point, const_cast(m)); typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(m); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(m); vb != ve; ++vb) { if (get(pm, *vb) == Point_3(0, 0, 0)) u = *vb; else if(get(pm, *vb) == Point_3(1, 0, 0)) @@ -259,13 +259,13 @@ struct Surface_fixture_1 { f1 = CGAL::is_border(halfedge(u, m),m) ? face(opposite(halfedge(u, m), m), m) : face(halfedge(u, m), m); assert(f1 != boost::graph_traits::null_face()); CGAL::Halfedge_around_face_iterator hafib, hafie; - for(boost::tie(hafib, hafie) = CGAL::halfedges_around_face(halfedge(f1, m), m); hafib != hafie; ++hafib) + for(std::tie(hafib, hafie) = CGAL::halfedges_around_face(halfedge(f1, m), m); hafib != hafie; ++hafib) { if(! CGAL::is_border(opposite(*hafib, m), m)) f2 = face(opposite(*hafib, m), m); } typename boost::graph_traits::face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(m); fb != fe; ++fb) { + for(std::tie(fb, fe) = faces(m); fb != fe; ++fb) { if(*fb != f1 && *fb != f2) f3 = *fb; } @@ -289,7 +289,7 @@ struct Surface_fixture_2 { pm = get(CGAL::vertex_point, const_cast(m)); typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(m); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(m); vb != ve; ++vb) { if (get(pm, *vb) == Point_3(0, 2, 0)) u = *vb; else if(get(pm, *vb) == Point_3(2, 2, 0)) @@ -308,25 +308,25 @@ struct Surface_fixture_2 { assert(y != boost::graph_traits::null_vertex()); typename boost::graph_traits::halfedge_descriptor h; bool found; - boost::tie(h, found) = halfedge(x, v, m); + std::tie(h, found) = halfedge(x, v, m); assert(found); assert(! CGAL::is_border(h,m)); f1 = face(h, m); assert(f1 != boost::graph_traits::null_face()); - boost::tie(h, found) = halfedge(v, u, m); + std::tie(h, found) = halfedge(v, u, m); assert(found); assert(!CGAL::is_border(h,m)); f2 = face(h, m); assert(f2 != boost::graph_traits::null_face()); - boost::tie(h, found) = halfedge(u, w, m); + std::tie(h, found) = halfedge(u, w, m); assert(found); assert(!CGAL::is_border(h,m)); f3 = face(h, m); assert(f3 != boost::graph_traits::null_face()); - boost::tie(h, found) = halfedge(w, x, m); + std::tie(h, found) = halfedge(w, x, m); assert(found); assert(!CGAL::is_border(h,m)); f4 = face(h, m); @@ -351,7 +351,7 @@ struct Surface_fixture_3 { pm = get(CGAL::vertex_point, const_cast(m)); typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(m); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(m); vb != ve; ++vb) { if (get(pm, *vb) == Point_3(0, 1, 0)) u = *vb; else if(get(pm, *vb) == Point_3(0, 0, 0)) @@ -399,7 +399,7 @@ struct Surface_fixture_4 { int found = 0; typename boost::graph_traits::halfedge_iterator hb, he; - for(boost::tie(hb, he) = halfedges(m); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(m); hb != he; ++hb) { if(CGAL::is_border(*hb,m)){ if(get(pm, target(*hb,m)) == Point_3(0,0,0)){ if(found == 0){ @@ -435,7 +435,7 @@ struct Surface_fixture_5 { int found = 0; typename boost::graph_traits::halfedge_iterator hb, he; - for(boost::tie(hb, he) = halfedges(m); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(m); hb != he; ++hb) { if(CGAL::is_border(*hb,m)){ if(get(pm, target(*hb,m)) == Point_3(2,1,0)){ h1 = *hb; @@ -500,7 +500,7 @@ struct Surface_fixture_8 { int found = 0; typename boost::graph_traits::halfedge_iterator hb, he; - for(boost::tie(hb, he) = halfedges(m); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(m); hb != he; ++hb) { if(get(pm, source(*hb,m)) == Point_3(0,0,0) && get(pm, target(*hb,m)) == Point_3(1,0,0)){ h1 = *hb; @@ -521,8 +521,6 @@ struct Surface_fixture_8 { Graph m; typename boost::graph_traits::halfedge_descriptor h1, h2, h3; - }; - #endif /* CGAL_TEST_PREFIX_H */ diff --git a/BGL/test/BGL/test_bgl_dual.cpp b/BGL/test/BGL/test_bgl_dual.cpp index 9a79832fcb9..e6a6330a256 100644 --- a/BGL/test/BGL/test_bgl_dual.cpp +++ b/BGL/test/BGL/test_bgl_dual.cpp @@ -42,13 +42,13 @@ int main() { out_edge_iterator b,e; - boost::tie(b,e) = out_edges(vd,dual); + std::tie(b,e) = out_edges(vd,dual); std::cerr << vd << " " << source(*b,dual) << std::endl; } { in_edge_iterator b,e; - boost::tie(b,e) = in_edges(vd,dual); + std::tie(b,e) = in_edges(vd,dual); std::cerr << vd << " " << source(*b,dual) << std::endl; } std::cerr << "done"<< std::endl; diff --git a/BGL/test/BGL/test_circulator.cpp b/BGL/test/BGL/test_circulator.cpp index 1c862324bb6..cd0a18cbbe4 100644 --- a/BGL/test/BGL/test_circulator.cpp +++ b/BGL/test/BGL/test_circulator.cpp @@ -102,7 +102,7 @@ int main(int argc, char* argv[]) { halfedge_around_target_iterator vit, end; vertex_descriptor vd = target(hd,P); - boost::tie(vit,end) = halfedges_around_target(hd,P); + std::tie(vit,end) = halfedges_around_target(hd,P); while(vit!= end) { halfedge_descriptor hd = *vit; assert(target(hd,P) == vd); @@ -113,7 +113,7 @@ int main(int argc, char* argv[]) { halfedge_around_face_iterator vit, end; - boost::tie(vit,end) = halfedges_around_face(hd,P); + std::tie(vit,end) = halfedges_around_face(hd,P); while(vit!= end) { halfedge_descriptor hd = *vit; @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) { out_edge_iterator ohi, end; - for(boost::tie(ohi,end) = out_edges(target(hd,P),P); ohi != end; ++ohi){ + for(std::tie(ohi,end) = out_edges(target(hd,P),P); ohi != end; ++ohi){ edge_descriptor ed = *ohi; halfedge_descriptor hd2 = halfedge(ed,P); std::cout << get(CGAL::vertex_point, P, target(hd2,P)) << std::endl; diff --git a/BGL/test/BGL/test_graph_traits.cpp b/BGL/test/BGL/test_graph_traits.cpp index 082469a58a9..19e03408f21 100644 --- a/BGL/test/BGL/test_graph_traits.cpp +++ b/BGL/test/BGL/test_graph_traits.cpp @@ -26,9 +26,9 @@ void test_halfedge_around_vertex_iterator(const Graph& g) { CGAL_GRAPH_TRAITS_MEMBERS(Graph); vertex_iterator vit, vend; - for(boost::tie(vit, vend) = vertices(g); vit != vend; ++vit) { + for(std::tie(vit, vend) = vertices(g); vit != vend; ++vit) { halfedge_around_target_iterator havit, havend; - for(boost::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, g), g); + for(std::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, g), g); havit != havend; ++havit) { assert(target(*havit, g) == *vit); @@ -47,11 +47,11 @@ void test_halfedge_around_face_iterator(const Graph& g) { CGAL_GRAPH_TRAITS_MEMBERS(Graph); face_iterator fit, fend; - for(boost::tie(fit, fend) = faces(g); fit != fend; ++fit) { + for(std::tie(fit, fend) = faces(g); fit != fend; ++fit) { halfedge_around_face_iterator hafit, hafend; - boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); + std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); assert(std::distance(hafit, hafend) != 0); - for(boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); hafit != hafend; ++hafit) { + for(std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); hafit != hafend; ++hafit) { assert(face(*hafit, g) == *fit); } } @@ -66,12 +66,12 @@ void test_halfedge_iterators(const G& g) // do we iterate as many as that? halfedge_iterator hb, he; - boost::tie(hb, he) = halfedges(g); + std::tie(hb, he) = halfedges(g); assert(static_cast(std::distance(hb, he)) == num_halfedges(g)); id_map ids; unsigned int count = 0; - for(boost::tie(hb, he) = halfedges(g); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(g); hb != he; ++hb) { std::pair r = ids.insert(get(boost::halfedge_index, g, *hb)); // unique? assert(r.second); @@ -92,12 +92,12 @@ void test_edge_iterators(const G& g) // do we iterate as many as that? edge_iterator eb, ee; - boost::tie(eb, ee) = edges(g); + std::tie(eb, ee) = edges(g); assert(static_cast(std::distance(eb, ee)) == num_edges(g)); id_map ids; unsigned int count = 0; - for(boost::tie(eb, ee) = edges(g); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(g); eb != ee; ++eb) { edge_descriptor e = *eb; std::pair r = ids.insert(get(boost::edge_index, g, e)); // unique? @@ -115,7 +115,7 @@ void test_vertex_iterators(const G& g) vertex_iterator vb, ve; std::size_t count = 0; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb){ + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb){ ++count; } @@ -125,7 +125,7 @@ void test_vertex_iterators(const G& g) id_map ids; count = 0; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { std::pair r = ids.insert(get(boost::vertex_index, g, *vb)); assert(r.second); ++count; @@ -142,12 +142,12 @@ void test_out_edges(const G& g) typedef typename Traits::vertex_descriptor vertex_descriptor; vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { vertex_descriptor t = target(*oeb, g); vertex_descriptor s = source(*oeb, g); assert(s != t); @@ -169,11 +169,11 @@ void test_in_edges(const G& g) typedef typename Traits::vertex_descriptor vertex_descriptor; vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { vertex_descriptor t = target(*ieb, g); vertex_descriptor s = source(*ieb, g); assert(t == around); @@ -196,18 +196,18 @@ void test_in_out_edges(const G& g) // check that the sets of in out edges are the same vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { id_map v_ids; std::vector in, out; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, source(*ieb, g))); assert(r.second); in.push_back(source(*ieb, g)); } out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, target(*oeb, g))); // insertion must fail @@ -239,13 +239,13 @@ void test_adjacent_vertices(const G& g) vertex_descriptor v = *(vertices(g).begin()); adjacency_iterator vb, ve; - boost::tie(vb, ve) = adjacent_vertices(v, g); + std::tie(vb, ve) = adjacent_vertices(v, g); in_edge_iterator ieb, iee; - boost::tie(ieb, iee) = in_edges(v, g); + std::tie(ieb, iee) = in_edges(v, g); out_edge_iterator oeb, oee; - boost::tie(oeb, oee) = out_edges(v, g); + std::tie(oeb, oee) = out_edges(v, g); assert(std::distance(vb, ve) == std::distance(ieb, iee)); assert(std::distance(vb, ve) == std::distance(oeb, oee)); @@ -271,7 +271,7 @@ void test_edge_find(const G& g) typedef std::pair ret; edge_iterator eb, ee; - for(boost::tie(eb, ee) = edges(g); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(g); eb != ee; ++eb) { vertex_descriptor s = source(*eb, g); vertex_descriptor t = target(*eb, g); ret found = edge(s, t, g); @@ -293,14 +293,14 @@ void test_faces(const G& g) unsigned int count = 0; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(g); fb != fe; ++fb) { + for(std::tie(fb, fe) = faces(g); fb != fe; ++fb) { ++count; // reverse look-up halfedge_descriptor assoc = halfedge(*fb, g); assert(face(assoc, g) == *fb); // check the enclosure halfedge_around_face_iterator encb, ence; - for(boost::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, g), g); encb != ence; ++encb) { + for(std::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, g), g); encb != ence; ++encb) { assert(face(*encb, g) == *fb); } } diff --git a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt index 11d40187de3..1d4deb97575 100644 --- a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt @@ -3,7 +3,7 @@ project(Barycentric_coordinates_2_Benchmarks) -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt index cd3533b5ca7..43a49733d1a 100644 --- a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Barycentric_coordinates_2_Examples) diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt index c50f052a490..7b01647d5c1 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Barycentric_coordinates_2_Tests) diff --git a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt index 305e502bd47..4106c9defb4 100644 --- a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt +++ b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt @@ -6,7 +6,7 @@ # Used in /CGAL/Documentation/doc/Documentation/Developer_manual/create_and_use_a_cmakelist.txt. # Careful when modifying -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Basic_viewer_Examples) #CGAL_Qt6 is needed for the drawing. diff --git a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp index 5c98556e0cf..f7f677e9660 100644 --- a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp +++ b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp @@ -92,7 +92,7 @@ int main(int argc, char* argv[]) Mesh::Property_map faces_size; bool created; - boost::tie(faces_size, created)=sm.add_property_map("f:size",0.); + std::tie(faces_size, created)=sm.add_property_map("f:size",0.); assert(created); for(face_descriptor fd : sm.faces()) diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt index a562dd4e48a..c36bb0cdd61 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt @@ -14,7 +14,6 @@ namespace ArrDirectionalTraits {} /*! \addtogroup PkgBooleanSetOperations2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Regularized Boolean Set-Operations,PkgBooleanSetOperations2} \cgalPkgPicture{Boolean_set_operations_2.png} \cgalPkgSummaryBegin diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt b/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt index aee59825ba1..99d2c05f6ce 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Boolean_set_operations_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Qt6) diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt b/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt index 60bd93b4d37..b7b8ec33bba 100644 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Boolean_set_operations_2_Tests) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt b/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt index 7ec2b717b7b..6777f112a5b 100644 --- a/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt +++ b/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgBoundingVolumesRef /*! \addtogroup PkgBoundingVolumesRef -\todo check generated documentation \cgalPkgDescriptionBegin{Bounding Volumes,PkgBoundingVolumes} \cgalPkgPicture{minCircle.png} \cgalPkgSummaryBegin diff --git a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt index aed57e369fc..1829009c9c0 100644 --- a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Approximate_min_ellipsoid_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt b/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt index 9c56c1f8cd2..4d968380aef 100644 --- a/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_annulus_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt b/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt index 9d537c51338..864ad950c98 100644 --- a/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_circle_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt b/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt index 5a8ff8b5094..8e54fb2aab0 100644 --- a/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_ellipse_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt b/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt index 4ec0538e65a..ee65337ea99 100644 --- a/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_quadrilateral_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt b/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt index 52f22930d06..7df4fa04f95 100644 --- a/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_sphere_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt b/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt index 04fdce0a6c7..5a4d610bd42 100644 --- a/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_sphere_of_spheres_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt b/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt index b4232b361a1..5f4df68a419 100644 --- a/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Rectangular_p_center_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt index a5b3adfd744..143e296e6ff 100644 --- a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt +++ b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Bounding_volumes_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt b/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt index f1de0dd7150..7cad98a5e06 100644 --- a/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Box_intersection_d_Examples) find_package(CGAL REQUIRED) diff --git a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt index a82e578f345..74af1828b43 100644 --- a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Box_intersection_d_Tests) find_package(CGAL REQUIRED) diff --git a/CGAL_Core/examples/Core/CMakeLists.txt b/CGAL_Core/examples/Core/CMakeLists.txt index 5f1d17eeb8a..a3552430f3c 100644 --- a/CGAL_Core/examples/Core/CMakeLists.txt +++ b/CGAL_Core/examples/Core/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Core_Examples) # CGAL and its components diff --git a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc index 3f53e34da44..b287edaecc7 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc +++ b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc @@ -544,7 +544,7 @@ template int BiPoly::getXdegree(){ int deg=-1; for(int i=0; i <=ydeg; i++) - deg = max(deg, coeffX[i].getTrueDegree()); + deg = (max)(deg, coeffX[i].getTrueDegree()); return deg; } diff --git a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt index ee152bc87a8..69a3b23a9d9 100644 --- a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt +++ b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGALimageIO_Examples) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt index 9a5154fe35a..92bc01f4576 100644 --- a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt +++ b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGAL_ImageIO_Tests) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt index 6c942000068..a27008458d1 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGAL_ipelets_Demo) if(NOT POLICY CMP0070 AND POLICY CMP0053) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp index f5423b0ab19..0aa825dcd77 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp @@ -85,7 +85,7 @@ void ASphapeIpelet::protected_run(int fn) Alpha_shape_2 A(LWP.begin(),LWP.end()); int alpha=-1; int nb_ret; - boost::tie(nb_ret,alpha)=request_value_from_user((boost::format("# Spectral critical value (0-%d)") % A.number_of_alphas()).str() ); + std::tie(nb_ret,alpha)=request_value_from_user((boost::format("# Spectral critical value (0-%d)") % A.number_of_alphas()).str() ); if (nb_ret == -1) return; if(alpha<0 || (std::size_t) alpha>A.number_of_alphas()){ diff --git a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp index 97aad8daa24..826ef549364 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp @@ -86,7 +86,7 @@ void Cone_spanners_ipelet::protected_run(int fn) } int ret_val; - boost::tie(ret_val,number_of_cones)=request_value_from_user("Enter the number of cones"); + std::tie(ret_val,number_of_cones)=request_value_from_user("Enter the number of cones"); if (ret_val < 0) { print_error_message("Incorrect value"); return; @@ -129,7 +129,7 @@ void Cone_spanners_ipelet::protected_run(int fn) } } boost::graph_traits::edge_iterator ei, ei_end; - for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + for (std::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { boost::graph_traits::edge_descriptor e = *ei; boost::graph_traits::vertex_descriptor u = source(e, g); boost::graph_traits::vertex_descriptor v = target(e, g); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp index 92104a15cff..0c35beae131 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp @@ -83,7 +83,7 @@ void generator::protected_run(int fn) origin= Kernel::Vector_2((bbox.xmin()+bbox.xmax())/2,(bbox.ymin()+bbox.ymax())/2); if (size<1){ size=200; - //boost::tie(ret_val,size)=request_value_from_user((boost::format("Size (default : %1%)") % size).str()); + //std::tie(ret_val,size)=request_value_from_user((boost::format("Size (default : %1%)") % size).str()); //if (ret_val == -1) return; //if (ret_val == 0) size=200; origin = Kernel::Vector_2(200,200); @@ -92,7 +92,7 @@ void generator::protected_run(int fn) int nbelements=30; - boost::tie(ret_val,nbelements)=request_value_from_user((boost::format("Number of elements (default : %1%)") % nbelements).str() ); + std::tie(ret_val,nbelements)=request_value_from_user((boost::format("Number of elements (default : %1%)") % nbelements).str() ); if (ret_val == -1) return; if (ret_val == 0) nbelements=30; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp index 8b4a70e49fe..f737113bbd6 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp @@ -94,7 +94,7 @@ void IpeletMesh2::protected_run(int fn) int y=static_cast( floor((bbox.max)().y()-(bbox.min)().y()) ); int ret_val; - boost::tie(ret_val,alpha)=request_value_from_user((boost::format("Max edge length (BBox %1%x%2%)") % x % y).str() ); + std::tie(ret_val,alpha)=request_value_from_user((boost::format("Max edge length (BBox %1%x%2%)") % x % y).str() ); if (ret_val == -1) return; if(alpha<0){ diff --git a/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp b/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp index 2d3f050d6cd..add1a29eb06 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp @@ -82,9 +82,9 @@ void mstIpelet::protected_run(int /*fn*/) vertex_iterator vit, ve; // Associate indices to the vertices int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vit and ve - for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){ + for(std::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){ vertex_descriptor vd = *vit; vertex_id_map[vd] = index++; } diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp index 9361353d575..56244ed708f 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp @@ -172,7 +172,7 @@ void MdelaunayIpelet::protected_run(int fn) if(fn==4 ||fn==9){ int order; int ret_val; - boost::tie(ret_val,order)=request_value_from_user("Enter order"); + std::tie(ret_val,order)=request_value_from_user("Enter order"); if (ret_val < 0){ print_error_message("Incorrect value"); return; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp index 3727c487040..731f8a1181f 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp @@ -80,7 +80,7 @@ void MregularIpelet::protected_run(int fn) if(fn==4 || fn==9){ int ret_val; - boost::tie(ret_val,order)=request_value_from_user("Enter order"); + std::tie(ret_val,order)=request_value_from_user("Enter order"); if (ret_val < 0){ print_error_message("Incorrect value"); return; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp b/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp index bf1954cf307..73f99255cb8 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp @@ -56,7 +56,7 @@ void nngIpelet::protected_run(int fn) int ret_val; int kNeighbors=1; - boost::tie(ret_val,kNeighbors)=request_value_from_user((boost::format("Number of nearest neighbors (default : k=%1%)") % kNeighbors).str() ); + std::tie(ret_val,kNeighbors)=request_value_from_user((boost::format("Number of nearest neighbors (default : k=%1%)") % kNeighbors).str() ); if (ret_val == -1) return; if (ret_val == 0) kNeighbors=1; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp index 71557e65968..6ba3994a584 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp @@ -124,7 +124,7 @@ void SkeletonIpelet::protected_run(int fn) if (fn==0 || fn==1) draw_straight_skeleton(*ss,max_edge); else{ - boost::tie(ret_val,dist)= + std::tie(ret_val,dist)= request_value_from_user( (boost::format("Offset value (BBox %1%x%2%)") % (bbox.xmax()-bbox.xmin()) % (bbox.ymax()-bbox.ymin())).str() ); diff --git a/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt index ae82aa48f7f..f52731322b7 100644 --- a/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGAL_ipelets_Tests) find_package(CGAL REQUIRED) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb6cbcce79a..c4ac65d480d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Top level CMakeLists.txt for CGAL-branchbuild # Minimal version of CMake: -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) message("== CMake setup ==") project(CGAL CXX C) diff --git a/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt b/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt index f596f9b0a1b..3092d4092ba 100644 --- a/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt +++ b/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt @@ -22,7 +22,6 @@ /*! \addtogroup PkgCircularKernel2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Circular Geometry Kernel,PkgCircularKernel2} \cgalPkgPicture{Boolean_operation_detail.png} \cgalPkgSummaryBegin diff --git a/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt index 7b2f5e9e627..33f717ffe50 100644 --- a/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_2_Examples) find_package(CGAL REQUIRED) diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h index b5830954ec7..0bfc65d0a55 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h @@ -1565,7 +1565,7 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a, double ymax = (is_on_upper) ? to_interval ( CircularFunctors::y_extremal_point(a.supporting_circle(),false).y() ).second : - CGAL::max(left_bb.ymax(),right_bb.ymax()); + (CGAL::max)(left_bb.ymax(),right_bb.ymax()); */ return Bbox_2(left_bb.xmin(),ymin,right_bb.xmax(),ymax); } diff --git a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt index c74331fa0da..18d14536942 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_2_Tests) find_package(CGAL REQUIRED) diff --git a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt index 15b323a35e4..eb14ee65d51 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_3_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt index dd790cb013e..6570aa61957 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_3_Examples) find_package(CGAL REQUIRED) diff --git a/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt index 11f64e04486..3194864b973 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_3_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Circulator/examples/Circulator/CMakeLists.txt b/Circulator/examples/Circulator/CMakeLists.txt index 45ce196888c..7ac0a4ca88c 100644 --- a/Circulator/examples/Circulator/CMakeLists.txt +++ b/Circulator/examples/Circulator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circulator_Examples) find_package(CGAL REQUIRED) diff --git a/Circulator/test/Circulator/CMakeLists.txt b/Circulator/test/Circulator/CMakeLists.txt index 379b55cc364..a502c47e06f 100644 --- a/Circulator/test/Circulator/CMakeLists.txt +++ b/Circulator/test/Circulator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circulator_Tests) find_package(CGAL REQUIRED) diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index 803d4279ead..e9e93a6d3a6 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Classification_Examples) # CGAL and its components diff --git a/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h b/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h index 2a5c8e6e9c7..53ef4ff89e5 100644 --- a/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h +++ b/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h @@ -127,7 +127,7 @@ public: continue; std::vector::iterator min_it, max_it; - boost::tie(min_it, max_it) + std::tie(min_it, max_it) = boost::minmax_element (hori.begin(), hori.end()); std::vector occupy (1 + (std::size_t)((*max_it - *min_it) / grid.resolution()), false); diff --git a/Classification/include/CGAL/Classification/Point_set_neighborhood.h b/Classification/include/CGAL/Classification/Point_set_neighborhood.h index c27c874f0c2..5a051426088 100644 --- a/Classification/include/CGAL/Classification/Point_set_neighborhood.h +++ b/Classification/include/CGAL/Classification/Point_set_neighborhood.h @@ -317,9 +317,8 @@ private: Point ref (std::floor(p.x() / voxel_size), std::floor(p.y() / voxel_size), std::floor(p.z() / voxel_size)); - typename std::map >::iterator it; - boost::tie (it, boost::tuples::ignore) - = grid.insert (std::make_pair (ref, std::vector())); + typename std::map >::iterator it + = grid.insert (std::make_pair (ref, std::vector())).first; it->second.push_back (i); } diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index 332dc9216d8..0135ea6f175 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Classification_Tests) # CGAL and its components diff --git a/Classification/test/Classification/test_classification_point_set.cpp b/Classification/test/Classification/test_classification_point_set.cpp index 0a1dc9cee79..bb0cce75796 100644 --- a/Classification/test/Classification/test_classification_point_set.cpp +++ b/Classification/test/Classification/test_classification_point_set.cpp @@ -53,9 +53,9 @@ int main (int, char**) map_added = pts.add_normal_map().second; assert (map_added); normal_map = pts.normal_map(); - boost::tie (echo_map, map_added) = pts.add_property_map ("echo"); + std::tie (echo_map, map_added) = pts.add_property_map ("echo"); assert (map_added); - boost::tie (color_map, map_added) = pts.add_property_map ("color"); + std::tie (color_map, map_added) = pts.add_property_map ("color"); assert (map_added); for (std::size_t i = 0; i < 1000; ++ i) diff --git a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt index 828f4756926..98a1e50f7e1 100644 --- a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Combinatorial_map_Examples) find_package(CGAL REQUIRED) diff --git a/Combinatorial_map/include/CGAL/Cell_iterators.h b/Combinatorial_map/include/CGAL/Cell_iterators.h index 93104ba01e2..9f73b23f232 100644 --- a/Combinatorial_map/include/CGAL/Cell_iterators.h +++ b/Combinatorial_map/include/CGAL/Cell_iterators.h @@ -86,7 +86,8 @@ namespace CGAL { Tag_true>::value); CGAL_assertion(amap.is_whole_map_unmarked(mcell_mark_number)); - mark_cell(amap, adart, mcell_mark_number); + if(this->cont()) + { mark_cell(amap, adart, mcell_mark_number); } } /// Destructor. @@ -126,7 +127,8 @@ namespace CGAL { { unmark_treated_darts(); Ite::rewind(); - mark_cell(*this->mmap, (*this), mcell_mark_number); + if(this->cont()) + { mark_cell(*this->mmap, (*this), mcell_mark_number); } } /// Prefix ++ operator. @@ -199,7 +201,8 @@ namespace CGAL { static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); - mark_cell(amap, adart, mmark_number); + if(this->cont()) + { mark_cell(amap, adart, mmark_number); } } /// Destructor. @@ -234,7 +237,8 @@ namespace CGAL { { unmark_treated_darts(); Ite::rewind(); - mark_cell(*this->mmap, (*this), mmark_number); + if(this->cont()) + { mark_cell(*this->mmap, (*this), mmark_number); } } /// Postfix ++ operator. @@ -253,7 +257,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } @@ -306,7 +310,8 @@ namespace CGAL { static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); - mark_cell(amap, (*this), mmark_number); + if(this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Constructor with a dart in parameter (for end iterator). @@ -314,8 +319,8 @@ namespace CGAL { Base(amap, adart), mmark_number(amap.get_new_mark()) { - if (adart!=this->mmap->null_descriptor) - mark_cell(amap, (*this), mmark_number); + if (this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Destructor. @@ -350,7 +355,8 @@ namespace CGAL { { unmark_treated_darts(); Base::rewind(); - mark_cell(*this->mmap, (*this), mmark_number); + if(this->cont()) + { mark_cell(*this->mmap, (*this), mmark_number); } } /// Postfix ++ operator. @@ -369,7 +375,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index b14fe21083a..7395743edb0 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -610,16 +610,16 @@ public: } iterator begin() { return empty()?end():iterator(this, 0, 0); } - iterator end() { return iterator(this, upper_bound()); } + iterator end() { return iterator(this, null_descriptor); } const_iterator begin() const { return empty()?end():const_iterator(this, 0, 0); } - const_iterator end() const { return const_iterator(this, upper_bound()); } + const_iterator end() const { return const_iterator(this, null_descriptor); } - reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rbegin() { return reverse_iterator(iterator(this, upper_bound())); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator - rbegin() const { return const_reverse_iterator(end()); } + rbegin() const { return const_reverse_iterator(iterator(this, upper_bound())); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } @@ -878,7 +878,8 @@ namespace internal { CC_iterator_with_index(const iterator &it): m_ptr_to_cc(it.m_ptr_to_cc), m_index(it.m_index) { - CGAL_assertion(m_index<=m_ptr_to_cc->upper_bound()); + CGAL_assertion(m_index<=m_ptr_to_cc->upper_bound() || + m_index==DSC::null_descriptor); } // Same for assignment operator @@ -928,14 +929,16 @@ namespace internal { // It's either pointing to end(), or valid. CGAL_assertion_msg(m_ptr_to_cc!=nullptr, "Incrementing a singular iterator or an empty container iterator ?"); - CGAL_assertion_msg(m_indexupper_bound(), - "Incrementing end() ?"); + CGAL_assertion_msg(m_indexupper_bound() && + m_index!=DSC::null_descriptor, + "Incrementing end() ?"); // If it's not end(), then it's valid, we can do ++. do { ++m_index; } while(m_indexupper_bound() && (!m_ptr_to_cc->is_used(m_index))); + if(m_index==m_ptr_to_cc->upper_bound()) { m_index=DSC::null_descriptor; } } void decrement() @@ -969,7 +972,7 @@ namespace internal { pointer operator->() const { return &((*m_ptr_to_cc)[m_index]); } - bool is_end() const { return m_index>=m_ptr_to_cc->upper_bound(); } + bool is_end() const { return m_index==DSC::null_descriptor; } // Can itself be used for bit-squatting. size_type for_compact_container() const diff --git a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt index b440e257636..028f26c9d93 100644 --- a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Combinatorial_map_Tests) find_package(CGAL REQUIRED) @@ -12,6 +12,8 @@ set(hfiles Combinatorial_map_2_test.h Combinatorial_map_3_test.h # create a target per cppfile create_single_source_cgal_program(Combinatorial_map_test.cpp ${hfiles}) create_single_source_cgal_program(Combinatorial_map_copy_test.cpp ${hfiles}) +create_single_source_cgal_program(cmap_test_split_attribute.cpp) +create_single_source_cgal_program(Combinatorial_map_empty_it_test.cpp) # Same targets, defining USE_COMPACT_CONTAINER_WITH_INDEX to test index version add_executable(Combinatorial_map_test_index Combinatorial_map_test.cpp ${hfiles}) @@ -24,7 +26,10 @@ target_compile_definitions(Combinatorial_map_copy_test_index PRIVATE USE_COMPACT target_link_libraries(Combinatorial_map_copy_test_index PRIVATE CGAL::CGAL CGAL::Data) cgal_add_compilation_test(Combinatorial_map_copy_test_index) -create_single_source_cgal_program(cmap_test_split_attribute.cpp) +add_executable(Combinatorial_map_empty_it_test_index Combinatorial_map_empty_it_test.cpp) +target_compile_definitions(Combinatorial_map_empty_it_test_index PRIVATE USE_COMPACT_CONTAINER_WITH_INDEX) +target_link_libraries(Combinatorial_map_empty_it_test_index PRIVATE CGAL::CGAL CGAL::Data) +cgal_add_compilation_test(Combinatorial_map_empty_it_test_index) # Link with OpenMesh if possible find_package(OpenMesh QUIET) diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_empty_it_test.cpp b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_empty_it_test.cpp new file mode 100644 index 00000000000..a7364439192 --- /dev/null +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_empty_it_test.cpp @@ -0,0 +1,53 @@ +#include + +struct Map_3_dart_items_3: public CGAL::Generic_map_min_items +{ +#ifdef USE_COMPACT_CONTAINER_WITH_INDEX + typedef CGAL::Tag_true Use_index; +#endif +}; + +using Map3=CGAL::Combinatorial_map<3, Map_3_dart_items_3>; +Map3 m; + +template +bool test_empty_it(const Range& r, const std::string& txt) +{ + bool res=true; + if(r.size()!=0) + { + std::cout<<"[ERROR "<(m.darts(), "Dart_range"); + res=res && test_empty_it + (const_cast(m).darts(), "Dart_const_range"); + + res=res && test_empty_it> + (m.one_dart_per_cell<3>(), "One_dart_per_cell_range<0>"); + + res=res && test_empty_it> + (const_cast(m).one_dart_per_cell<3>(), + "One_dart_per_cell_const_range<0>"); + + if(!res) + { return(EXIT_FAILURE); } + + std::cout<<"ALL SUCCESS."<::edge_iterator ei, ei_end; - for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + for (std::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { boost::graph_traits::edge_descriptor e = *ei; boost::graph_traits::vertex_descriptor u = source(e, g); boost::graph_traits::vertex_descriptor v = target(e, g); diff --git a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h index 3d1ebc15efb..5a6a73299fb 100644 --- a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h @@ -193,7 +193,7 @@ protected: const Less_by_direction orderMid(g, cw90(bisector_direction)); typename Graph_::vertex_iterator vit, ve; - boost::tie(vit, ve) = boost::vertices(g); + std::tie(vit, ve) = boost::vertices(g); // Step 1: Sort S according to order induced by D1 std::vector S(vit, ve); @@ -218,7 +218,7 @@ protected: typename Graph_::edge_descriptor existing_e; bool existing; // check whether the edge already exists - boost::tie(existing_e, existing)=boost::edge(*it, *ri, g); + std::tie(existing_e, existing)=boost::edge(*it, *ri, g); if (!existing) boost::add_edge(*it, *ri, g); } diff --git a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h index 7f6fdb16a17..58090bdd506 100644 --- a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h @@ -179,7 +179,7 @@ protected: const Less_by_direction orderD2 (g, cwBound); typename Graph_::vertex_iterator vit, ve; - boost::tie(vit, ve) = boost::vertices(g); + std::tie(vit, ve) = boost::vertices(g); // Step 1: Sort S according to order induced by D1 std::vector S(vit, ve); @@ -205,7 +205,7 @@ protected: typename Graph_::edge_descriptor existing_e; bool existing; // check whether the edge already exists - boost::tie(existing_e, existing)=boost::edge(*it, *min, g); + std::tie(existing_e, existing)=boost::edge(*it, *min, g); if (!existing) boost::add_edge(*it, *min, g); } diff --git a/Cone_spanners_2/include/CGAL/gnuplot_output_2.h b/Cone_spanners_2/include/CGAL/gnuplot_output_2.h index d2cb402e37a..ac3fcebb911 100644 --- a/Cone_spanners_2/include/CGAL/gnuplot_output_2.h +++ b/Cone_spanners_2/include/CGAL/gnuplot_output_2.h @@ -109,7 +109,7 @@ std::string gnuplot_edge_list (const Graph& g) ss << std::fixed; // Use fixed floating-point notation typename Graph::edge_iterator eit, ee; - for (boost::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) { + for (std::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) { typename Graph::vertex_descriptor src = boost::source(*eit, g); typename Graph::vertex_descriptor end = boost::target(*eit, g); ss << "set arrow from "; @@ -129,7 +129,7 @@ std::string gnuplot_vertex_list(const Graph& g) { ss << std::fixed; typename Graph::vertex_iterator vit, ve; - for (boost::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) { + for (std::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) { ss << to_double(g[*vit].x()) << " " << to_double(g[*vit].y()) << std::endl; } return ss.str(); diff --git a/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt b/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt index e4d05d60618..559a6418940 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt +++ b/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Cone_spanners_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt b/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt index 6fb39bf6485..3e4532f6ffc 100644 --- a/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt +++ b/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_decomposition_3_Examples) find_package(CGAL REQUIRED) diff --git a/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt b/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt index 660388d7120..e06420b426b 100644 --- a/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt +++ b/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_decomposition_3_Tests) find_package(CGAL REQUIRED) diff --git a/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt b/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt index dad37d65a65..76a81ede555 100644 --- a/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt +++ b/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_2_Examples) find_package(CGAL REQUIRED) diff --git a/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt b/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt index ba7b0c0b8c1..3a37f23f9aa 100644 --- a/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt +++ b/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_2_Tests) find_package(CGAL REQUIRED) diff --git a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt index add02f31d30..99b49365013 100644 --- a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_3_Examples) # CGAL and its components diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index eac14144073..b2089fdc53c 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -963,7 +963,7 @@ convex_hull_3(InputIterator first, InputIterator beyond, } CGAL_assertion(num_vertices(P)>=3); typename boost::graph_traits::vertex_iterator b,e; - boost::tie(b,e) = vertices(P); + std::tie(b,e) = vertices(P); if (num_vertices(P) == 3){ typename boost::property_map::type vpmap = get(CGAL::vertex_point, P); typedef typename Traits::Triangle_3 Triangle_3; diff --git a/Convex_hull_3/include/CGAL/convexity_check_3.h b/Convex_hull_3/include/CGAL/convexity_check_3.h index cd18bf1d394..b895641d98c 100644 --- a/Convex_hull_3/include/CGAL/convexity_check_3.h +++ b/Convex_hull_3/include/CGAL/convexity_check_3.h @@ -83,7 +83,7 @@ bool is_strongly_convex_3(const Polyhedron& P, const Traits& traits) typename boost::property_map::const_type vpmap = get(CGAL::vertex_point, P); vertex_iterator v_it, v_it_e; - boost::tie(v_it, v_it_e) = vertices(P); + std::tie(v_it, v_it_e) = vertices(P); if (v_it == v_it_e) return false; @@ -97,7 +97,7 @@ bool is_strongly_convex_3(const Polyhedron& P, const Traits& traits) typename Traits::Coplanar_3 coplanar = traits.coplanar_3_object(); face_iterator f_it, f_it_e; - boost::tie(f_it, f_it_e) = faces(P); + std::tie(f_it, f_it_e) = faces(P); Point_3 p; Point_3 q; Point_3 r; diff --git a/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt index 3f8e9eb6830..600579792d5 100644 --- a/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_3_Tests) find_package(CGAL REQUIRED) diff --git a/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt b/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt index a1a4b8a3de1..bf45d7bfeb3 100644 --- a/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt +++ b/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgConvexHullDRef /*! \addtogroup PkgConvexHullDRef -\todo check generated documentation \cgalPkgDescriptionBegin{dD Convex Hulls and Delaunay Triangulations,PkgConvexHullD} \cgalPkgPicture{convex_hull_d-teaser.png} \cgalPkgSummaryBegin diff --git a/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt b/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt index 5e04a505476..15d4dd6b201 100644 --- a/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt +++ b/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_d_Tests) find_package(CGAL REQUIRED) diff --git a/Distance_2/test/Distance_2/CMakeLists.txt b/Distance_2/test/Distance_2/CMakeLists.txt index 18adb56e7b8..944049ddb60 100644 --- a/Distance_2/test/Distance_2/CMakeLists.txt +++ b/Distance_2/test/Distance_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Distance_2_Tests) find_package(CGAL REQUIRED) diff --git a/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h b/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h index 73f4b0eb69c..f6bf77fd39b 100644 --- a/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h +++ b/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h @@ -207,7 +207,7 @@ squared_distance(const typename K::Triangle_3& tr1, FT sqd_q2 = CGAL::squared_distance(vertex(tr2, 1), tr1); FT sqd_r2 = CGAL::squared_distance(vertex(tr2, 2), tr1); - const FT m = std::min({sqd_p1, sqd_q1, sqd_r1, sqd_p2, sqd_q2, sqd_r2}); + const FT m = (std::min)({sqd_p1, sqd_q1, sqd_r1, sqd_p2, sqd_q2, sqd_r2}); return m; #endif diff --git a/Distance_3/test/Distance_3/CMakeLists.txt b/Distance_3/test/Distance_3/CMakeLists.txt index 9d4d21a31ec..0bdc29865c1 100644 --- a/Distance_3/test/Distance_3/CMakeLists.txt +++ b/Distance_3/test/Distance_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Distance_3_Tests) find_package(CGAL REQUIRED) diff --git a/Documentation/doc/CMakeLists.txt b/Documentation/doc/CMakeLists.txt index b251731cafc..323c3dc22d6 100644 --- a/Documentation/doc/CMakeLists.txt +++ b/Documentation/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Documentation NONE) # Check whether this cmake script is the top level one @@ -24,7 +24,7 @@ else() set(CGAL_ROOT "${CMAKE_SOURCE_DIR}") endif() -cmake_minimum_required(VERSION 3.18..3.29) # for list(SORT ... COMPARE NATURAL) +cmake_minimum_required(VERSION 3.18...3.31) # for list(SORT ... COMPARE NATURAL) find_package(Doxygen REQUIRED) find_package(Python3 REQUIRED COMPONENTS Interpreter) @@ -299,8 +299,8 @@ file(GLOB CGAL_DOXYGEN_RESOURCES_DIRS list(SORT CGAL_DOXYGEN_RESOURCES_DIRS COMPARE NATURAL) if(NOT CGAL_DOXYGEN_RESOURCES_DIRS STREQUAL CGAL_DOXYGEN_RESOURCES_VERSIONS) - message(FATAL "The directories in ${CGAL_DOC_RESOURCE_PREFIX_DIR} do not match the -expected versions: [${CGAL_DOXYGEN_RESOURCES_VERSIONS}] vs [${CGAL_DOXYGEN_RESOURCES_DIRS}]") + message(WARNING "The directories in ${CGAL_DOC_RESOURCE_PREFIX_DIR} do not match the expected versions:\n" + " [${CGAL_DOXYGEN_RESOURCES_DIRS}] vs [${CGAL_DOXYGEN_RESOURCES_VERSIONS}]") endif() function(CGAL_insert_in_sorted_list list_name value) @@ -312,14 +312,15 @@ function(CGAL_insert_in_sorted_list list_name value) set(${list_name} ${list} PARENT_SCOPE) endfunction() -if(DOXYGEN_VERSION IN_LIST CGAL_DOXYGEN_RESOURCES_VERSIONS) - list(FIND CGAL_DOXYGEN_RESOURCES_VERSIONS "${DOXYGEN_VERSION}" DOXYGEN_VERSION_INDEX) +if(DOXYGEN_VERSION IN_LIST CGAL_DOXYGEN_RESOURCES_DIRS) + list(FIND CGAL_DOXYGEN_RESOURCES_DIRS "${DOXYGEN_VERSION}" DOXYGEN_VERSION_INDEX) else() - CGAL_insert_in_sorted_list(CGAL_DOXYGEN_RESOURCES_VERSIONS ${DOXYGEN_VERSION}) - list(FIND CGAL_DOXYGEN_RESOURCES_VERSIONS ${DOXYGEN_VERSION} DOXYGEN_VERSION_INDEX) + CGAL_insert_in_sorted_list(CGAL_DOXYGEN_RESOURCES_DIRS ${DOXYGEN_VERSION}) + list(FIND CGAL_DOXYGEN_RESOURCES_DIRS ${DOXYGEN_VERSION} DOXYGEN_VERSION_INDEX) math(EXPR DOXYGEN_VERSION_INDEX "${DOXYGEN_VERSION_INDEX} - 1") endif() list(GET CGAL_DOXYGEN_RESOURCES_DIRS "${DOXYGEN_VERSION_INDEX}" CGAL_DOC_RESOURCE_DIR) + set(CGAL_DOC_RESOURCE_DIR "${CGAL_DOC_RESOURCE_PREFIX_DIR}/${CGAL_DOC_RESOURCE_DIR}") if(NOT EXISTS "${CGAL_DOC_RESOURCE_DIR}") message(FATAL_ERROR "Doxygen resources for version ${DOXYGEN_VERSION} not found") diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index 7875c5791d3..5739b44d85e 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -54,7 +54,7 @@ or `h The \stl comes with the compiler, and as such no installation is required. \subsection thirdpartyBoost Boost -Version 1.72 or later +Version 1.74 or later The \boost libraries are a set of portable C++ source libraries. Most of \boost libraries are header-only, but a few of them need to be compiled or @@ -86,7 +86,6 @@ Version supported are GMP Version 5.0.1 or later, MPFR Version 3.0.0 or later The \boost library also provides a module for multi precision integers and rational numbers: \boost multiprecision. -Versions supported are \boost Version 1.72 or later. The components \cgal, and `CGAL_Qt6` require either \gmp and \mpfr, or \boost multiprecision for multi precision numbers. `CGAL_Core` requires \boost multiprecision. diff --git a/Documentation/doc/Documentation/advanced/Configuration_variables.txt b/Documentation/doc/Documentation/advanced/Configuration_variables.txt index d4ac891a30f..399d3e3ea73 100644 --- a/Documentation/doc/Documentation/advanced/Configuration_variables.txt +++ b/Documentation/doc/Documentation/advanced/Configuration_variables.txt @@ -103,21 +103,11 @@ other but never both. \subsection installation_boost Boost Libraries -\subsubsection inst_boost_1_72_plus Version 1.72 and Later Starting from \boost 1.72, the cmake config mode can be used for configuring the \boost version to use by setting the environment variable `Boost_DIR` to the path containing the file `BoostConfig.cmake`. For example if you manually installed \boost 1.77 with `--prefix=`, then you should set `Boost_DIR=/lib/cmake/Boost-1.77.0`. -\subsubsection inst_boost_up_2_1_69 Version 1.69 and Earlier - -\warning If you have a version of Boost greater than 1.69 already installed on your system, and you want to configure and compile with an earlier version of Boost, then you will need to set the CMake variable `Boost_NO_BOOST_CMAKE` to `ON` (otherwise the `FindBoost.cmake` module of CMake will start searching for `BoostConfig.cmake`, and ignore the `BOOST_ROOT` variable). - -In most cases, if \boost is not automatically found, setting the `BOOST_ROOT` -variable is enough. If it is not, you can specify the header and library -directories individually. You can also provide the full pathname to a specific compiled library -if it cannot be found in the library directory or its name is non-standard. - By default, when \boost binary libraries are needed, the shared versions are used if present. You can set the variable `CGAL_Boost_USE_STATIC_LIBS` to `ON` if you want to link @@ -128,17 +118,6 @@ the `.dll` files are found by the dynamic linker, at run time. For example, you can add the path to the \boost `.dll` to the `PATH` environment variable. -| Variable | Description | Type | -| :- | :- | :- | -| `BOOST_ROOT`\cgalFootnote{The environment variable can be spelled either \cgalFootnoteCode{BOOST_ROOT} or \cgalFootnoteCode{BOOSTROOT}} | Root directory of your \boost installation | Either CMake or Environment | -| `Boost_INCLUDE_DIR` | Directory containing the `boost/version.hpp` file | CMake | -| `BOOST_INCLUDEDIR` | Idem | Environment | -| `Boost_LIBRARY_DIRS` | Directory containing the compiled \boost libraries | CMake | -| `BOOST_LIBRARYDIR` | Idem | Environment | -| `Boost_(xyz)_LIBRARY_RELEASE` | Full pathname to a release build of the compiled 'xyz' \boost library | CMake | -| `Boost_(xyz)_LIBRARY_DEBUG` | Full pathname to a debug build of the compiled 'xyz' \boost library | CMake | - - \subsection installation_gmp GMP and MPFR Libraries Under Windows, auto-linking is used, so only the directory diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index d1600747b48..26aa8fa6d61 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -425,7 +425,7 @@ Boissonnat} } @article{cgal:cgm-fobbo-11, - title={Fast Oriented Bounding Box Optimization on the Rotation Group $\SO(3, \mathrm{R})$}, + title={Fast Oriented Bounding Box Optimization on the Rotation Group $SO(3, \mathrm{R})$}, author={Chang, Chia-Tche and Gorissen, Bastien and Melchior, Samuel}, journal={ACM Transactions on Graphics (TOG)}, volume={30}, diff --git a/Envelope_2/doc/Envelope_2/PackageDescription.txt b/Envelope_2/doc/Envelope_2/PackageDescription.txt index 28824ca8e7d..0fe4c06e4ea 100644 --- a/Envelope_2/doc/Envelope_2/PackageDescription.txt +++ b/Envelope_2/doc/Envelope_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgEnvelope2Ref /*! \addtogroup PkgEnvelope2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Envelopes,PkgEnvelope2} \cgalPkgPicture{Envelope_2/fig/Envelope_2.png} \cgalPkgSummaryBegin diff --git a/Envelope_2/examples/Envelope_2/CMakeLists.txt b/Envelope_2/examples/Envelope_2/CMakeLists.txt index 54144877d58..4afdfc6f5f8 100644 --- a/Envelope_2/examples/Envelope_2/CMakeLists.txt +++ b/Envelope_2/examples/Envelope_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_2_Examples) find_package(CGAL REQUIRED) diff --git a/Envelope_2/test/Envelope_2/CMakeLists.txt b/Envelope_2/test/Envelope_2/CMakeLists.txt index 37225c2f3a0..9e771071fb6 100644 --- a/Envelope_2/test/Envelope_2/CMakeLists.txt +++ b/Envelope_2/test/Envelope_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_2_Tests) find_package(CGAL REQUIRED) diff --git a/Envelope_3/doc/Envelope_3/PackageDescription.txt b/Envelope_3/doc/Envelope_3/PackageDescription.txt index 7579fff2c1e..920f6b7054b 100644 --- a/Envelope_3/doc/Envelope_3/PackageDescription.txt +++ b/Envelope_3/doc/Envelope_3/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgEnvelope3Ref /*! \addtogroup PkgEnvelope3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Envelopes,PkgEnvelope3} \cgalPkgPicture{Envelope_3/fig/Envelope_3.png} \cgalPkgSummaryBegin diff --git a/Envelope_3/examples/Envelope_3/CMakeLists.txt b/Envelope_3/examples/Envelope_3/CMakeLists.txt index 089c44b56b4..283a2b54ce4 100644 --- a/Envelope_3/examples/Envelope_3/CMakeLists.txt +++ b/Envelope_3/examples/Envelope_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_3_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Envelope_3/test/Envelope_3/CMakeLists.txt b/Envelope_3/test/Envelope_3/CMakeLists.txt index 251474dc57a..b9038463e38 100644 --- a/Envelope_3/test/Envelope_3/CMakeLists.txt +++ b/Envelope_3/test/Envelope_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_3_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt index 9852fdad283..290027a019c 100644 --- a/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Filtered_kernel_test) add_executable(bench_simple_comparisons bench_simple_comparisons.cpp) diff --git a/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt index bd9a629f447..cd7bdb737ce 100644 --- a/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Filtered_kernel_Examples) find_package(CGAL REQUIRED) diff --git a/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt index da741c2f754..1536d81a950 100644 --- a/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Filtered_kernel_Tests) find_package(CGAL REQUIRED) diff --git a/Generalized_map/examples/Generalized_map/CMakeLists.txt b/Generalized_map/examples/Generalized_map/CMakeLists.txt index d0ec729d64c..84d5801abdc 100644 --- a/Generalized_map/examples/Generalized_map/CMakeLists.txt +++ b/Generalized_map/examples/Generalized_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generalized_map_Examples) find_package(CGAL REQUIRED) diff --git a/Generalized_map/include/CGAL/GMap_cell_iterators.h b/Generalized_map/include/CGAL/GMap_cell_iterators.h index 1dbef9dcd6e..d739d64d3c2 100644 --- a/Generalized_map/include/CGAL/GMap_cell_iterators.h +++ b/Generalized_map/include/CGAL/GMap_cell_iterators.h @@ -73,7 +73,8 @@ namespace CGAL { static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); - mark_cell(amap, (*this), mmark_number); + if(this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Constructor with a dart in parameter (for end iterator). @@ -81,8 +82,8 @@ namespace CGAL { Base(amap, adart), mmark_number(amap.get_new_mark()) { - if (adart!=this->mmap->null_descriptor) - mark_cell(amap, (*this), mmark_number); + if (this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Destructor. @@ -136,7 +137,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } @@ -249,7 +250,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } diff --git a/Generalized_map/test/Generalized_map/CMakeLists.txt b/Generalized_map/test/Generalized_map/CMakeLists.txt index 24ac67748cd..792b023745e 100644 --- a/Generalized_map/test/Generalized_map/CMakeLists.txt +++ b/Generalized_map/test/Generalized_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generalized_map_Tests) # CGAL and its components diff --git a/Generator/benchmark/Generator/CMakeLists.txt b/Generator/benchmark/Generator/CMakeLists.txt index e1daf72a299..b8d4c9b9e01 100644 --- a/Generator/benchmark/Generator/CMakeLists.txt +++ b/Generator/benchmark/Generator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Generator/examples/Generator/CMakeLists.txt b/Generator/examples/Generator/CMakeLists.txt index 39e4934705d..0575929b894 100644 --- a/Generator/examples/Generator/CMakeLists.txt +++ b/Generator/examples/Generator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_Examples) find_package(CGAL REQUIRED) diff --git a/Generator/test/Generator/CMakeLists.txt b/Generator/test/Generator/CMakeLists.txt index e7708299971..060c4b02905 100644 --- a/Generator/test/Generator/CMakeLists.txt +++ b/Generator/test/Generator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_Tests) find_package(CGAL REQUIRED) diff --git a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt index d421e758dc2..0f092bdddba 100644 --- a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt +++ b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt index 79a9c584324..0e495788267 100644 --- a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Apollonius_graph_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt index 7a1c55e2375..a28575fd8a7 100644 --- a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt +++ b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Bounding_volumes_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt index 3689b6a4495..7f84c3aa5e6 100644 --- a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt +++ b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Generator/CMakeLists.txt b/GraphicsView/demo/Generator/CMakeLists.txt index 75ab3c6083e..b1b3ef328c6 100644 --- a/GraphicsView/demo/Generator/CMakeLists.txt +++ b/GraphicsView/demo/Generator/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/GraphicsView/CMakeLists.txt b/GraphicsView/demo/GraphicsView/CMakeLists.txt index 9568fd3efae..357832f21b3 100644 --- a/GraphicsView/demo/GraphicsView/CMakeLists.txt +++ b/GraphicsView/demo/GraphicsView/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(GraphicsView_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt index 0a682e80fa8..b08284c8501 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(L1_Voronoi_diagram_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt index 2dbae37b697..970f4eb17ba 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt +++ b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Largest_empty_rect_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index f630c8c6e80..08f3756e10f 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_2_triangulation_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 85a964989c8..eb899f59ba3 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 Core) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt index 7f805e60986..2ea54637c3c 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 Core) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index fc773d81ace..d7aafeb267e 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_Linf_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 Core) diff --git a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt index 9d3c41854bf..ea60ca9c267 100644 --- a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt +++ b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Snap_rounding_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt index fd02ea6c1e9..a4a73095859 100644 --- a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt +++ b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt index 3c76339638a..d07003892d3 100644 --- a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt +++ b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_lines_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Triangulation_2/CMakeLists.txt b/GraphicsView/demo/Triangulation_2/CMakeLists.txt index 141852b3ed5..613df8d2348 100644 --- a/GraphicsView/demo/Triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_2_Demo) set(CMAKE_AUTOMOC ON) diff --git a/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf b/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf index 9a27c4e4f65..15cbfc98f09 100644 --- a/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf +++ b/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf @@ -1,5 +1,5 @@ %PDF-1.4 -%âãÏÓ +%âãÃÓ 1 0 obj << diff --git a/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h b/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h index e97c999ee10..24c60dcdcf6 100644 --- a/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h +++ b/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h @@ -90,7 +90,7 @@ private: template GraphicsViewPolygonWithHolesInput::GraphicsViewPolygonWithHolesInput(QObject *parent, QGraphicsScene* s) - : GraphicsViewInput(parent), scene_(s), polygon_input(false) + : GraphicsViewInput(parent), polygon_input(false), scene_(s) { pwhItem = new CGAL::Qt::PolygonWithHolesGraphicsItem(&pwh); pwhItem->setBrush(::Qt::yellow); @@ -151,7 +151,7 @@ GraphicsViewPolygonWithHolesInput::processInput(CGAL::Object o) template void -GraphicsViewPolygonWithHolesInput::keyPressEvent ( QKeyEvent * event ) +GraphicsViewPolygonWithHolesInput::keyPressEvent ( QKeyEvent * /* event */ ) { } diff --git a/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt b/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt index 48650817c57..ea6800cd6b1 100644 --- a/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt +++ b/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt @@ -19,7 +19,6 @@ /*! \addtogroup PkgHalfedgeDSRef -\todo check generated documentation \cgalPkgDescriptionBegin{Halfedge Data Structures,PkgHalfedgeDS} \cgalPkgPicture{HalfedgeDS/fig/HalfedgeDS-teaser-small.png} \cgalPkgSummaryBegin diff --git a/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt b/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt index 49a4bd1c16f..d2669e130dc 100644 --- a/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt +++ b/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(HalfedgeDS_Examples) find_package(CGAL REQUIRED) diff --git a/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h b/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h index a39cfd90715..3863b149e4f 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h +++ b/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h @@ -70,7 +70,7 @@ public: { unsigned int data = 0; typename boost::graph_traits::edge_iterator it, end; - for(boost::tie(it, end) = edges(p); it != end; ++it, ++data) + for(std::tie(it, end) = edges(p); it != end; ++it, ++data) (*map_)[*it] = data; } diff --git a/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt b/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt index bab4ef15f0a..cd29aa12692 100644 --- a/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt +++ b/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(HalfedgeDS_Tests) find_package(CGAL REQUIRED) diff --git a/Hash_map/benchmark/Hash_map/CMakeLists.txt b/Hash_map/benchmark/Hash_map/CMakeLists.txt index 51860317694..860f31fd055 100644 --- a/Hash_map/benchmark/Hash_map/CMakeLists.txt +++ b/Hash_map/benchmark/Hash_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hash_map) # CGAL and its components diff --git a/Hash_map/benchmark/Hash_map/hm.cpp b/Hash_map/benchmark/Hash_map/hm.cpp index 891ca23ef10..070b7c7cd4d 100644 --- a/Hash_map/benchmark/Hash_map/hm.cpp +++ b/Hash_map/benchmark/Hash_map/hm.cpp @@ -157,11 +157,11 @@ run(const G& g) #if 0 - std::cerr << "boost::tie(vb,ve) = vertices(g);\n"; + std::cerr << "std::tie(vb,ve) = vertices(g);\n"; t.reset(); t.start(); for(int i=0; i<100; i++){ typename boost::graph_traits::vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices(g); + std::tie(vb,ve) = vertices(g); for(; vb != ve; ++vb) { vertex_descriptor vd = *vb; #ifdef NOHASH diff --git a/Hash_map/test/Hash_map/CMakeLists.txt b/Hash_map/test/Hash_map/CMakeLists.txt index c2a6220bc7a..22e0de0f9a6 100644 --- a/Hash_map/test/Hash_map/CMakeLists.txt +++ b/Hash_map/test/Hash_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hash_map_Tests) find_package(CGAL REQUIRED) diff --git a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt index 250921f012f..8bc9d360ca3 100644 --- a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Heat_method_3_Examples) # CGAL and its components 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 a4510dd552c..16078898df6 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 @@ -297,7 +297,7 @@ private: } CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; for(face_descriptor f : faces(tm)) { - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); vertex_descriptor current = *(vbegin); vertex_descriptor neighbor_one = *(++vbegin); vertex_descriptor neighbor_two = *(++vbegin); @@ -350,7 +350,7 @@ private: Matrix indexD(dimension,1); CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; for(face_descriptor f : faces(tm)) { - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); vertex_descriptor current = *(vbegin); vertex_descriptor neighbor_one = *(++vbegin); vertex_descriptor neighbor_two = *(++vbegin); @@ -514,7 +514,7 @@ private: CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; for(face_descriptor f : faces(tm)) { - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); vertex_descriptor current = *(vbegin); vertex_descriptor neighbor_one = *(++vbegin); vertex_descriptor neighbor_two = *(++vbegin); diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index 77a399704ec..64a61c993ba 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -446,7 +446,7 @@ private: for(face_descriptor f : faces(m_intrinsic_tm)) { CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,m_intrinsic_tm),m_intrinsic_tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,m_intrinsic_tm),m_intrinsic_tm); halfedge_descriptor hd = halfedge(f,m_intrinsic_tm); if(face(hd,m_intrinsic_tm) != f) { hd = opposite(hd,m_intrinsic_tm); diff --git a/Heat_method_3/test/Heat_method_3/CMakeLists.txt b/Heat_method_3/test/Heat_method_3/CMakeLists.txt index 056f15040a3..f8b3f13f0b1 100644 --- a/Heat_method_3/test/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/test/Heat_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Heat_method_3_Tests) # CGAL and its components diff --git a/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt index 7664529ebee..55c2cce7fb5 100644 --- a/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_benchmark) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt index 7c0da4ed37b..c27e6da78fa 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_Demo) # Find includes in corresponding build directories diff --git a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h index ef2d984340b..b89c95f5656 100644 --- a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -200,7 +200,19 @@ public: /*! Returns the hyperbolic segment formed by the vertices of edge `e`. */ - Hyperbolic_segment hyperbolic_segment (const Edge& e) const; + Hyperbolic_segment hyperbolic_segment(const Edge& e) const; + + /*! + Returns the hyperbolic point given by the finite vertex `vh`. + */ + Point point(const Vertex_handle vh) const; + + /*! + Returns the point given by vertex `i` of face `fh`. + \pre `t.dimension()` \f$ \geq0\f$ and \f$ i \in\{0,1,2\}\f$ in dimension 2, \f$ i \in\{0,1\}\f$ in dimension 1, \f$ i = 0\f$ in dimension 0, and the vertex is finite. + */ + Point point(const Face_handle fh, const int i) const; + ///@} diff --git a/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt index 04291fd4612..48b87097c62 100644 --- a/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h index d95bfe27fba..0b79c1af1b3 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -740,6 +740,32 @@ public: Hyperbolic_segment segment(const Edge& e) const { return hyperbolic_segment(e); } Hyperbolic_segment segment(const Edge_circulator& e) const { return hyperbolic_segment(e); } + const Point& point(const Vertex_handle vh) const + { + CGAL_precondition(!is_infinite(vh)); + return vh->point(); + } + + const Point& point(const Face_handle fh, const int i) const + { + CGAL_precondition(!is_infinite(fh->vertex(i))); + CGAL_precondition(0 <= i && i <= 2); + return fh->vertex(i)->point(); + } + + Point& point(const Vertex_handle vh) + { + CGAL_precondition(!is_infinite(vh)); + return vh->point(); + } + + Point& point(const Face_handle fh, const int i) + { + CGAL_precondition(!is_infinite(fh->vertex(i))); + CGAL_precondition(0 <= i && i <= 2); + return fh->vertex(i)->point(); + } + size_type number_of_vertices() const { return Base::number_of_vertices(); } Vertex_circulator adjacent_vertices(Vertex_handle v) const { return Vertex_circulator(v, *this); } @@ -825,32 +851,6 @@ public: } public: - const Point& point(const Vertex_handle vh) const - { - CGAL_precondition(!is_infinite(vh)); - return vh->point(); - } - - const Point& point(const Face_handle fh, const int i) const - { - CGAL_precondition(!is_infinite(fh->vertex(i))); - CGAL_precondition(0 <= i && i <= 2); - return fh->vertex(i)->point(); - } - - Point& point(const Vertex_handle vh) - { - CGAL_precondition(!is_infinite(vh)); - return vh->point(); - } - - Point& point(const Face_handle fh, const int i) - { - CGAL_precondition(!is_infinite(fh->vertex(i))); - CGAL_precondition(0 <= i && i <= 2); - return fh->vertex(i)->point(); - } - bool is_valid() { if (!Base::is_valid()) diff --git a/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt index 4d4c4397245..4c251645f27 100644 --- a/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt b/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt index a15bb4b041c..aa77a9b9cc9 100644 --- a/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt +++ b/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgInscribedAreasRef -\todo check generated documentation \cgalPkgDescriptionBegin{Inscribed Areas,PkgInscribedAreas} \cgalPkgPicture{ler-detail.png} \cgalPkgSummaryBegin diff --git a/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt b/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt index ae8130bfe5d..b9a8add8e8e 100644 --- a/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt +++ b/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Inscribed_areas_Examples) find_package(CGAL REQUIRED) diff --git a/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt b/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt index afd79762867..0b5ba8ac02e 100644 --- a/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt +++ b/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Inscribed_areas_Tests) find_package(CGAL REQUIRED) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index f95d719aa56..bdae9dd56fb 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -3,15 +3,46 @@ ## [Release 6.1](https://github.com/CGAL/cgal/releases/tag/v6.1) +### General Changes +- The minimal supported version of Boost is now 1.74.0. + +### [Polygon Mesh Processing](https://doc.cgal.org/6.1/Manual/packages.html#PkgPolygonMeshProcessing) +- Added the function `CGAL::Polygon_mesh_processing::discrete_mean_curvature` and `CGAL::Polygon_mesh_processing::discrete_Guassian_curvature` to evaluate the discrete curvature at a vertex of a mesh. +- Added the function `CGAL::Polygon_mesh_processing::angle_sum` to compute the sum of the angles around a vertex. + + ### [Algebraic Kernel](https://doc.cgal.org/6.1/Manual/packages.html#PkgAlgebraicKernelD) - **Breaking change**: Classes based on the RS Library are no longer provided. +### [BGL](https://doc.cgal.org/6.1/Manual/packages.html#PkgBGL) +- Added the function `CGAL::Euler::remove_degree_2_vertex()`, which enables users to remove vertices which have exactly two incident edges. + ### [2D Arrangements](https://doc.cgal.org/6.1/Manual/packages.html#PkgArrangementOnSurface2) - Introduces two traits decorators, namely `Arr_tracing_traits_2` and `Arr_counting_traits_2`, which can be used to extract debugging and informative metadata about the traits in use while a program is being executed. - Fixed the Landmark point-location strategy so that it can be applied to arrangements on a sphere. +### [3D Mesh Generation](https://doc.cgal.org/6.1/Manual/packages.html#PkgMesh3) + +- Added two new meshing parameters that enable mesh initialization customization : + - `initial_points_generator` : enables the user to specify a functor that generates initial points, + - `initial_points` : enables the user to specify a `Range` of initial points. + + +### [2D Triangulations](https://doc.cgal.org/6.1/Manual/packages.html#PkgTriangulation2) + +- **Breaking change**: In the class template `Constrained_triangulation_plus_2`, the value type of the range returned + by `subconstraints()` has changed from `const std::pair*>` to `Subconstraint`. + The old range type is now returned by a new function named `subconstraints_and_contexts()`. + +### [Polygon Repair](https://doc.cgal.org/6.1/Manual/packages.html#PkgPolygonRepair) + +- Add a the non-zero rule, as well as functions to compute the conservative inner and outer hull of similar polygons. + +### Triangulations +- All triangulations now offer the functions `point(Vertex_handle)` and `point(Simplex, int)`, which enables users to access the geometric position of a vertex and of the i-th vertex of a simplex of a triangulation. + ## [Release 6.0.1](https://github.com/CGAL/cgal/releases/tag/v6.0.1) ### [Poisson Surface Reconstruction](https://doc.cgal.org/6.0.1/Manual/packages.html#PkgPoissonSurfaceReconstruction3) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 7ec3a5575ce..0cdd9edf184 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -4,7 +4,7 @@ # ${CGAL_SOURCE_DIR} and to the root binary directory of the project as # ${CGAL_BINARY_DIR} or ${CGAL_BINARY_DIR}. if(NOT PROJECT_NAME) - cmake_minimum_required(VERSION 3.12...3.29) + cmake_minimum_required(VERSION 3.12...3.31) project(CGAL CXX C) endif() @@ -826,36 +826,44 @@ if(NOT TARGET ALL_CGAL_TARGETS) add_custom_target(ALL_CGAL_TARGETS) endif() -macro(add_programs subdir target ON_OFF) +function(CGAL_add_subdirectories subdir name ON_OFF) + cmake_minimum_required(VERSION 3.14) + # CMake>=3.14 for `if(DEFINED CACHE{...})` + # see https://cmake.org/cmake/help/v3.31/command/if.html#defined cache_set(CGAL_EXECUTABLE_TARGETS "") - add_custom_target(${target}) - add_dependencies(ALL_CGAL_TARGETS ${target}) + add_custom_target(${name}) + add_dependencies(ALL_CGAL_TARGETS ${name}) - option(WITH_${target} "Select ${target}" ${ON_OFF}) - if(WITH_${target}) - add_subdirectory(${subdir} EXCLUDE_FROM_ALL) + if(DEFINED CACHE{WITH_${name}} AND "${WITH_${name}}" AND CMAKE_PROJECT_NAME STREQUAL "CGAL") + set(ON_OFF ON) + endif() + option(CGAL_WITH_${name} "Compile CGAL ${name}" ${ON_OFF}) + + if(CGAL_WITH_${name}) + CGAL_handle_subdirectories(${subdir} ${name}) endif() cache_get(CGAL_EXECUTABLE_TARGETS) foreach(CGAL_EXECUTABLE_TARGET ${CGAL_EXECUTABLE_TARGETS}) - add_dependencies(${target} ${CGAL_EXECUTABLE_TARGET}) + add_dependencies(${name} ${CGAL_EXECUTABLE_TARGET}) endforeach() -endmacro() +endfunction() # This allows programs to locate CGALConfig.cmake set(CGAL_DIR ${CGAL_BINARY_DIR}) if(NOT RUNNING_CGAL_AUTO_TEST) - add_programs(examples examples OFF) - add_programs(demo demos OFF) + CGAL_add_subdirectories(examples examples OFF) + CGAL_add_subdirectories(demo demos OFF) if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") - add_programs(test tests OFF) + CGAL_add_subdirectories(test tests OFF) endif() + CGAL_add_subdirectories(benchmark benchmarks OFF) endif() message("== Setting paths ==") diff --git a/Installation/cmake/modules/CGALHelpers.cmake b/Installation/cmake/modules/CGALHelpers.cmake new file mode 100644 index 00000000000..936ef591f03 --- /dev/null +++ b/Installation/cmake/modules/CGALHelpers.cmake @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 3.14) +include_guard(GLOBAL) + +function(process_CGAL_subdirectory entry subdir type_name) + # For example, subdir can be "examples", type_name "example", and entry "Mesh_2" + get_filename_component(ENTRY_DIR_NAME "${entry}" NAME) + + if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source + make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") + endif() + + message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}") + + set(source_dir "") + if(EXISTS ${entry}/CMakeLists.txt) + set(source_dir ${entry}) + else() + if(CGAL_CREATE_CMAKE_SCRIPT) + execute_process( + COMMAND bash ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir "${entry}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" + RESULT_VARIABLE RESULT_VAR OUTPUT_VARIABLE OUTPUT_VAR ERROR_VARIABLE ERROR_VAR) + if(RESULT_VAR) + message(AUTHOR_WARNING "Error with ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir ${entry}\n${OUTPUT_VAR}\n${ERROR_VAR}") + else() + set(source_dir "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") + endif() + endif() + endif() + if(source_dir) + add_subdirectory( "${source_dir}" "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" EXCLUDE_FROM_ALL) + endif() +endfunction() + +function(CGAL_handle_subdirectories subdir_name plural_name) + string(TOUPPER "${plural_name}" plural_name_upper) + if("${plural_name}" MATCHES "s$") + string(LENGTH "${plural_name}" plural_name_length) + math(EXPR plural_name_length_minus_one "${plural_name_length} - 1") + string(SUBSTRING "${plural_name}" 0 "${plural_name_length_minus_one}" singular_name) + else() + set(singular_name "${plural_name}") + endif() + + project(CGAL_${plural_name_upper}) + + if(CGAL_BRANCH_BUILD) + + foreach(package ${CGAL_CONFIGURED_PACKAGES}) + #message (STATUS "Current package: ${package}") + file(GLOB listtmp "${package}/${subdir_name}/*") + list(APPEND list CONFIGURE_DEPENDS ${listtmp}) + endforeach() + + else() + + file(GLOB list "${subdir_name}/*") + + endif() + + if(NOT list) + return() + endif() + + list(SORT list) + + message("== Generating build files for ${plural_name} ==") + foreach(entry ${list}) + + if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) + + file(GLOB files "${entry}/*.cpp") + + # If there is no .cpp files, ignore the sub-directory + if(files) + process_cgal_subdirectory("${entry}" ${subdir_name} ${singular_name}) + endif() + + endif() + + endforeach() + message("== Generating build files for ${plural_name} (DONE) ==\n") + +endfunction() diff --git a/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake index 0b0a2b80b1b..464d2bdd911 100644 --- a/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake +++ b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(Boost_IOSTREAMS_FOUND AND NOT TARGET CGAL::Boost_iostreams_support) if( WIN32 ) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index d6d992267bb..c0976f84628 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -6,6 +6,19 @@ set(CGAL_CreateSingleSourceCGALProgram_included TRUE) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_add_test.cmake) include(CMakeParseArguments) +function(CGAL_check_target_name target_name new_target_var_name) + set(cmake_reserved_names all ALL_BUILD help install + INSTALL preinstall clean edit_cache + rebuild_cache ZERO_CHECK package PACKAGE package_source test RUN_TESTS) + + while(TARGET "${target_name}" OR target_name IN_LIST cmake_reserved_names) + message(AUTHOR_WARNING "The executable name ${target_name} is reserved by CMake or already exists. Renaming it to ${target_name}_") + set(target_name "${target_name}_") + endwhile() + + set(${new_target_var_name} ${target_name} PARENT_SCOPE) +endfunction() + function(create_single_source_cgal_program firstfile ) set(options NO_TESTING) set(oneValueArgs) @@ -42,6 +55,7 @@ function(create_single_source_cgal_program firstfile ) set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} ) endforeach() + CGAL_check_target_name(${exe_name} exe_name) add_executable(${exe_name} ${all}) if(CXX_FEATURES) target_compile_features(${exe_name} PRIVATE ${CXX_FEATURES}) diff --git a/Installation/cmake/modules/CGAL_Macros.cmake b/Installation/cmake/modules/CGAL_Macros.cmake index 596bc592a15..49b6bf19ec2 100644 --- a/Installation/cmake/modules/CGAL_Macros.cmake +++ b/Installation/cmake/modules/CGAL_Macros.cmake @@ -456,51 +456,4 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) endif() -function(process_CGAL_subdirectory entry subdir type_name) - # For example, subdir can be "examples", type_name "example", and entry "Mesh_2" - get_filename_component(ENTRY_DIR_NAME "${entry}" NAME) - - if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source - make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - endif() - - set(ADD_SUBDIR TRUE) - - if(EXISTS ${entry}/../../dont_submit) - file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${ENTRY_DIR_NAME}/?\$") - if(dont_submit_grep) - set(ADD_SUBDIR FALSE) - endif() - file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/${ENTRY_DIR_NAME}/?\$") - if(dont_submit_grep) - set(ADD_SUBDIR FALSE) - endif() - file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/?\$") - if(dont_submit_grep) - set(ADD_SUBDIR FALSE) - endif() - endif() - - if(ADD_SUBDIR) - message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}") - if(EXISTS ${entry}/CMakeLists.txt) - set(source_dir ${entry}) - add_subdirectory( ${entry} ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME} ) - else() - if(CGAL_CREATE_CMAKE_SCRIPT) -# message("bah ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir ${entry}") - execute_process( - COMMAND bash ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir "${entry}" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" - RESULT_VARIABLE RESULT_VAR OUTPUT_QUIET) - if(NOT RESULT_VAR) -# message("Subdir ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - set(source_dir "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - add_subdirectory( "${source_dir}" "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - endif() - endif() - endif() - else() - message(STATUS "${subdir}/${ENTRY_DIR_NAME} is in dont_submit") - endif() -endfunction() +include(${CMAKE_CURRENT_LIST_DIR}/CGALHelpers.cmake) diff --git a/Installation/cmake/modules/CGAL_SetupBoost.cmake b/Installation/cmake/modules/CGAL_SetupBoost.cmake index ee561027370..abd5fe9fc0c 100644 --- a/Installation/cmake/modules/CGAL_SetupBoost.cmake +++ b/Installation/cmake/modules/CGAL_SetupBoost.cmake @@ -10,16 +10,13 @@ # # and defines the function :command:`use_CGAL_Boost_support`. -if ( CGAL_Boost_Setup ) - return() -endif() -set ( CGAL_Boost_Setup TRUE ) - +include_guard(GLOBAL) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake) -find_package( Boost 1.72 REQUIRED ) +cmake_policy(VERSION 3.12...3.30) +find_package( Boost 1.74 REQUIRED ) -if(Boost_FOUND AND Boost_VERSION VERSION_LESS 1.72) +if(Boost_FOUND AND Boost_VERSION VERSION_LESS 1.74) if(DEFINED Boost_DIR AND NOT Boost_DIR) # Unset that cache variable that is set in the cache by FindBoost # (while it was searching for boost-cmake). diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index e3dadc7b4e4..a73e12026d1 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -23,7 +23,7 @@ # If set, the `LEDA` library will be searched and used to provide # the exact number types used by CGAL kernels. # -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(CGAL_SetupCGALDependencies_included) return() endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake index 94d2d839375..710a5d7e579 100644 --- a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake @@ -48,7 +48,7 @@ set_property(GLOBAL PROPERTY CGAL_Core_FOUND TRUE) # function(CGAL_setup_CGAL_Core_dependencies target) - find_package( Boost 1.72 REQUIRED ) + find_package( Boost 1.74 REQUIRED ) if (NOT CGAL_DISABLE_GMP AND GMP_FOUND) use_CGAL_GMP_support(CGAL_Core INTERFACE) endif() diff --git a/Installation/cmake/modules/CGAL_SetupLEDA.cmake b/Installation/cmake/modules/CGAL_SetupLEDA.cmake index 171f6f39e9d..4037c21f5b1 100644 --- a/Installation/cmake/modules/CGAL_SetupLEDA.cmake +++ b/Installation/cmake/modules/CGAL_SetupLEDA.cmake @@ -9,7 +9,7 @@ # find_package(LEDA) # # and defines the function :command:`use_CGAL_LEDA_support`. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(CGAL_SetupLEDA_included) return() endif() 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 4559bf506d1..43d17a055f8 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -6,7 +6,7 @@ # the configuration. # # See https://stackoverflow.com/a/43300621/1728537 for the starting point. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(CGAL_SKIP_CMAKE_HOOKS) return() diff --git a/Installation/demo/CMakeLists.txt b/Installation/demo/CMakeLists.txt index 96c284fa9d8..92606a5b9d2 100644 --- a/Installation/demo/CMakeLists.txt +++ b/Installation/demo/CMakeLists.txt @@ -1,39 +1,7 @@ -cmake_minimum_required(VERSION 3.12...3.29) -project(CGAL_DEMOS) - -if(CGAL_BRANCH_BUILD) - - foreach(package ${CGAL_CONFIGURED_PACKAGES}) - #message (STATUS "Current package: ${package}") - file(GLOB listtmp "${package}/demo/*") - list(APPEND list ${listtmp}) - endforeach() - -else() - - file(GLOB list "*") +cmake_minimum_required(VERSION 3.12...3.31) +if(NOT CGAL_MODULES_DIR) + find_package(CGAL REQUIRED) endif() - -list(SORT list) - -find_package(CGAL REQUIRED) -include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) - -message("== Generating build files for demos ==") -foreach(entry ${list}) - - if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) - - file(GLOB files "${entry}/*.cpp") - - # If there is no .cpp files, ignore the sub-directory - if(files) - process_cgal_subdirectory("${entry}" demo demo) - # Note: process_CGAL_subdirectory is defined in cmake/modules/CGAL_Macros.cmake - endif() - - endif() - -endforeach() -message("== Generating build files for demos (DONE) ==\n") +include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) +CGAL_handle_subdirectories(demo demos) diff --git a/Installation/examples/CMakeLists.txt b/Installation/examples/CMakeLists.txt index e62d49c187d..e0034b4727f 100644 --- a/Installation/examples/CMakeLists.txt +++ b/Installation/examples/CMakeLists.txt @@ -1,39 +1,6 @@ -cmake_minimum_required(VERSION 3.12...3.29) -project(CGAL_EXAMPLES) - -if(CGAL_BRANCH_BUILD) - - foreach(package ${CGAL_CONFIGURED_PACKAGES}) - #message (STATUS "Current package: ${package}") - file(GLOB listtmp "${package}/examples/*") - list(APPEND list ${listtmp}) - endforeach() - -else() - - file(GLOB list "*") - +cmake_minimum_required(VERSION 3.12...3.31) +if(NOT CGAL_MODULES_DIR) + find_package(CGAL REQUIRED) endif() - -list(SORT list) - -find_package(CGAL REQUIRED) -include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) - -message("== Generating build files for examples ==") -foreach(entry ${list}) - - if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) - - file(GLOB files "${entry}/*.cpp") - - # If there is no .cpp files, ignore the sub-directory - if(files) - process_cgal_subdirectory("${entry}" examples example) - # Note: process_CGAL_subdirectory is defined in cmake/modules/CGAL_Macros.cmake - endif() - - endif() - -endforeach() -message("== Generating build files for examples (DONE) ==\n") +include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) +CGAL_handle_subdirectories(examples examples) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index a154b5caad8..a9e215f26e2 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -461,6 +461,11 @@ namespace CGAL { using cpp11::copy_n; } // end of the temporary compatibility with CGAL-4.14 #endif // CGAL_NO_DEPRECATED_CODE + +#if __has_include() +# include +#endif + namespace CGAL { // Typedef for the type of nullptr. @@ -501,7 +506,7 @@ namespace cpp11{ # define CGAL_FALLTHROUGH while(false){} #endif -#if __cpp_lib_format >= 201907L || (__has_include() && (__cplusplus >= 202000L || _MSVC_LANG >= 202000L)) +#if __cpp_lib_format >= 201907L # define CGAL_CAN_USE_CXX20_FORMAT 1 #endif diff --git a/Installation/test/CMakeLists.txt b/Installation/test/CMakeLists.txt index e0163f201ab..64d616edd57 100644 --- a/Installation/test/CMakeLists.txt +++ b/Installation/test/CMakeLists.txt @@ -1,39 +1,8 @@ -cmake_minimum_required(VERSION 3.12...3.29) -project(CGAL_TESTS) +cmake_minimum_required(VERSION 3.12...3.31) -if(CGAL_BRANCH_BUILD) - - foreach(package ${CGAL_CONFIGURED_PACKAGES}) - #message (STATUS "Current package: ${package}") - file(GLOB listtmp "${package}/test/*") - list(APPEND list ${listtmp}) - endforeach() - -else() - - file(GLOB list "*") +if(NOT CGAL_MODULES_DIR) + find_package(CGAL REQUIRED) endif() - -list(SORT list) - -find_package(CGAL REQUIRED) -include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) - -message("== Generating build files for tests ==") -foreach(entry ${list}) - - if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) - - file(GLOB files "${entry}/*.cpp") - - # If there is no .cpp files, ignore the sub-directory - if(files) - process_cgal_subdirectory("${entry}" test test) - # Note: process_CGAL_subdirectory is defined in cmake/modules/CGAL_Macros.cmake - endif() - - endif() - -endforeach() -message("== Generating build files for tests (DONE) ==\n") +include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) +CGAL_handle_subdirectories(test tests) diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index 5fb67b8eae2..183337517e3 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Installation_Tests ) diff --git a/Installation/test/Installation/test_configuration.cmake.in b/Installation/test/Installation/test_configuration.cmake.in index fa820a795a5..e300407f0c8 100644 --- a/Installation/test/Installation/test_configuration.cmake.in +++ b/Installation/test/Installation/test_configuration.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(test_configuration) find_package(CGAL) add_definitions(-DQT_NO_KEYWORDS) diff --git a/Installation/test/Installation/test_configuration_qt.cmake.in b/Installation/test/Installation/test_configuration_qt.cmake.in index 5dda5a91bc2..3e2e50894f4 100644 --- a/Installation/test/Installation/test_configuration_qt.cmake.in +++ b/Installation/test/Installation/test_configuration_qt.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(test_configuration) find_package(CGAL COMPONENTS Qt6) add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) diff --git a/Installation/test/Installation/test_find_package.cmake.in b/Installation/test/Installation/test_find_package.cmake.in index cf759c73b85..eab8e03ed2e 100644 --- a/Installation/test/Installation/test_find_package.cmake.in +++ b/Installation/test/Installation/test_find_package.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( test_find_package_${mode} ) find_package(CGAL ${VERSION} ${EXACT}REQUIRED PATHS ${CGAL_DIR} diff --git a/Interpolation/examples/Interpolation/CMakeLists.txt b/Interpolation/examples/Interpolation/CMakeLists.txt index 0277e9aaf30..7d49ebcd9ae 100644 --- a/Interpolation/examples/Interpolation/CMakeLists.txt +++ b/Interpolation/examples/Interpolation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interpolation_Examples) find_package(CGAL REQUIRED) diff --git a/Interpolation/test/Interpolation/CMakeLists.txt b/Interpolation/test/Interpolation/CMakeLists.txt index cbfc358658e..f0b23d66367 100644 --- a/Interpolation/test/Interpolation/CMakeLists.txt +++ b/Interpolation/test/Interpolation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interpolation_Tests) find_package(CGAL REQUIRED) diff --git a/Intersections_2/test/Intersections_2/CMakeLists.txt b/Intersections_2/test/Intersections_2/CMakeLists.txt index 5fc9f53991f..773045a2af5 100644 --- a/Intersections_2/test/Intersections_2/CMakeLists.txt +++ b/Intersections_2/test/Intersections_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Intersections_2_Tests) find_package(CGAL REQUIRED) diff --git a/Intersections_3/test/Intersections_3/CMakeLists.txt b/Intersections_3/test/Intersections_3/CMakeLists.txt index 9b9ae08edee..8d34a143d23 100644 --- a/Intersections_3/test/Intersections_3/CMakeLists.txt +++ b/Intersections_3/test/Intersections_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Intersections_3_Tests) find_package(CGAL REQUIRED) diff --git a/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt b/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt index 458b71b043f..e0750e6dada 100644 --- a/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt +++ b/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interval_skip_list_Examples) find_package(CGAL REQUIRED) diff --git a/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt b/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt index 690a918f787..12315e15177 100644 --- a/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt +++ b/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interval_skip_list_Tests) find_package(CGAL REQUIRED) diff --git a/Interval_support/test/Interval_support/CMakeLists.txt b/Interval_support/test/Interval_support/CMakeLists.txt index fd3788e50e9..d586b8c075f 100644 --- a/Interval_support/test/Interval_support/CMakeLists.txt +++ b/Interval_support/test/Interval_support/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interval_support_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt index cc0ea70929d..90af6ff6785 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt +++ b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgJetFitting3Ref /*! \addtogroup PkgJetFitting3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{Estimation of Local Differential Properties of Point-Sampled Surfaces,PkgJetFitting3} \cgalPkgPicture{DavidDetail.png} \cgalPkgSummaryBegin diff --git a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt index a8bcc29b90c..abb85906be2 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Jet_fitting_3_Examples) find_package(CGAL REQUIRED) diff --git a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt index 114067d5247..62b395e1d4b 100644 --- a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Jet_fitting_3_Tests) find_package(CGAL REQUIRED) diff --git a/Kernel_23/benchmark/Kernel_23/CMakeLists.txt b/Kernel_23/benchmark/Kernel_23/CMakeLists.txt index 3d2109157eb..2a5152a9e61 100644 --- a/Kernel_23/benchmark/Kernel_23/CMakeLists.txt +++ b/Kernel_23/benchmark/Kernel_23/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_23_benchmark) find_package(CGAL QUIET OPTIONAL_COMPONENTS Core) diff --git a/Kernel_23/examples/Kernel_23/CMakeLists.txt b/Kernel_23/examples/Kernel_23/CMakeLists.txt index f1a8ba7716f..a9f8d9090b5 100644 --- a/Kernel_23/examples/Kernel_23/CMakeLists.txt +++ b/Kernel_23/examples/Kernel_23/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_23_Examples) find_package(CGAL REQUIRED) diff --git a/Kernel_23/examples/Kernel_23/MyKernel.cpp b/Kernel_23/examples/Kernel_23/MyKernel.cpp index 834a22629b8..0894706db7b 100644 --- a/Kernel_23/examples/Kernel_23/MyKernel.cpp +++ b/Kernel_23/examples/Kernel_23/MyKernel.cpp @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 65baa5cd544..721ffe96827 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -933,22 +933,14 @@ namespace CommonKernelFunctors { typename K::Compute_scalar_product_3 scalar_product = k.compute_scalar_product_3_object(); - double product = CGAL::sqrt(to_double(scalar_product(u,u)) * to_double(scalar_product(v,v))); + double product = to_double(approximate_sqrt(scalar_product(u,u) * scalar_product(v,v))); if(product == 0) return 0; // cosine double dot = to_double(scalar_product(u,v)); - double cosine = dot / product; - - if(cosine > 1.){ - cosine = 1.; - } - if(cosine < -1.){ - cosine = -1.; - } - + double cosine = std::clamp(dot / product, -1., 1.); return std::acos(cosine) * 180./CGAL_PI; } diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 106eced3810..ce9af1c75bc 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_23_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h b/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h index aa572c2df9a..f2edc867e1d 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h @@ -98,7 +98,7 @@ in the plane spanned by the base vectors \f$ b_{e1}\f$ and \f$ b_{e2}\f$ in \f$ d\f$-space. Thus the default use delivers a planar rotation in the \f$ x\f$-\f$ y\f$ plane. -\pre \f$ sin_num^2 + cos_num^2 = den^2\f$ and \f$ 0 \leq e_1 < e_2 < d\f$. +\pre \f$ sin\_num^2 + cos\_num^2 = den^2\f$ and \f$ 0 \leq e_1 < e_2 < d\f$. \pre `den != 0`. */ diff --git a/Kernel_d/doc/Kernel_d/PackageDescription.txt b/Kernel_d/doc/Kernel_d/PackageDescription.txt index f8c024183a2..783f291db01 100644 --- a/Kernel_d/doc/Kernel_d/PackageDescription.txt +++ b/Kernel_d/doc/Kernel_d/PackageDescription.txt @@ -21,7 +21,6 @@ /*! \addtogroup PkgKernelDRef -\todo check generated documentation \cgalPkgDescriptionBegin{dD Geometry Kernel,PkgKernelD} \cgalPkgPicture{hypercube.png} \cgalPkgSummaryBegin diff --git a/Kernel_d/test/Kernel_d/CMakeLists.txt b/Kernel_d/test/Kernel_d/CMakeLists.txt index 6798d13a087..221d83e5d9c 100644 --- a/Kernel_d/test/Kernel_d/CMakeLists.txt +++ b/Kernel_d/test/Kernel_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_d_Tests) find_package(CGAL REQUIRED) diff --git a/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt b/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt index 0ae368020c1..5541e7b43ee 100644 --- a/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt +++ b/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_space_partition_Examples) diff --git a/Kinetic_space_partition/include/CGAL/KSP/debug.h b/Kinetic_space_partition/include/CGAL/KSP/debug.h index eae47856078..6615721be51 100644 --- a/Kinetic_space_partition/include/CGAL/KSP/debug.h +++ b/Kinetic_space_partition/include/CGAL/KSP/debug.h @@ -929,14 +929,6 @@ void dump_polygon(const std::vector& pts, const std::string saver.export_polygon_soup_3(pts2, filename); } -void dump_polygon(const std::vector& pts, const std::string& filename) { - Saver saver; - std::vector > pts2; - pts2.push_back(pts); - - saver.export_polygon_soup_3(pts2, filename); -} - void dump_polygona(const std::vector& pts, const std::string& filename) { Saver saver; std::vector > pts2; diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h b/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h index 85c93daeb05..8514cff93d8 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h @@ -159,7 +159,6 @@ public: } }; - // ToDo:: check all kind of iterators/circulators using PEdge_around_pvertex_iterator = boost::transform_iterator >; using PEdges_around_pvertex = CGAL::Iterator_range; @@ -1390,16 +1389,19 @@ public: return support_plane(support_plane_idx).to_2d(segment_3); } -/* - IkSegment_2 to_2d(const std::size_t support_plane_idx, const IkSegment_3& segment_3) const { + template + auto to_2d(const std::size_t support_plane_idx, const IkSegment_3& segment_3) const + -> std::enable_if_t, IkSegment_2> { return support_plane(support_plane_idx).to_2d(segment_3); - }*/ + } Point_2 to_2d(const std::size_t support_plane_idx, const Point_3& point_3) const { return support_plane(support_plane_idx).to_2d(point_3); } - IkPoint_2 to_2d(const std::size_t support_plane_idx, const IkPoint_3& point_3) const { + template + auto to_2d(const std::size_t support_plane_idx, const IkPoint_3& point_3) const + -> std::enable_if_t, IkPoint_2> { return support_plane(support_plane_idx).to_2d(point_3); } diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h b/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h index f3e5550a4d9..9942d696dcc 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h @@ -493,7 +493,7 @@ private: typename Intersection_graph::Kinetic_interval& kinetic_interval = m_data.igraph().kinetic_interval(e, sp_idx); crossing_iedges.push_back(e); - if (emin > s || std::isinf(min_speed)) { + if (emin > s || std::isinf(CGAL::to_double(min_speed))) { typename Intersection_kernel::FT bary_edge_exact = (emin - s) / (t - s); FT bary_edge = from_exact((emin - s) / (t - s)); CGAL_assertion(bary_edge_exact >= 0); @@ -505,7 +505,7 @@ private: kinetic_interval.push_back(std::pair(0, 0)); } - if (t > emax || std::isinf(max_speed)) { + if (t > emax || std::isinf(CGAL::to_double(max_speed))) { typename Intersection_kernel::FT bary_edge_exact = (emax - s) / (t - s); FT bary_edge = from_exact((emax - s) / (t - s)); CGAL_assertion(0 <= bary_edge_exact && bary_edge_exact <= 1); diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h b/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h index b85e37ea14d..c4f0e0c5ed9 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h @@ -377,7 +377,7 @@ public: for (const auto& pair : points) { const auto& point = pair.first; directions.push_back(typename Intersection_kernel::Vector_2(to_exact(m_data->centroid), point)); - const FT length = CGAL::sqrt(CGAL::abs(from_exact(directions.back() * directions.back()))); + const FT length = CGAL::approximate_sqrt(CGAL::abs(from_exact(directions.back() * directions.back()))); sum_length += length; num += 1; } @@ -676,8 +676,9 @@ public: m_data->plane.to_2d(Point_3(0, 0, 0) + vec)); } - template::type > - const typename Intersection_kernel::Point_2 to_2d(const typename Intersection_kernel::Point_3& point) const { + template + auto to_2d(const typename Intersection_kernel::Point_3& point) const + ->std::enable_if_t, const typename Intersection_kernel::Point_2> { return m_data->exact_plane.to_2d(point); } @@ -687,8 +688,9 @@ public: m_data->plane.to_2d(line.point() + line.to_vector())); } - template::type > - const typename Intersection_kernel::Line_2 to_2d(const typename Intersection_kernel::Line_3& line) const { + template + auto to_2d(const typename Intersection_kernel::Line_3& line) const + -> std::enable_if_t, const typename Intersection_kernel::Line_2> { return typename Intersection_kernel::Line_2( m_data->exact_plane.to_2d(line.point()), m_data->exact_plane.to_2d(line.point() + line.to_vector())); @@ -700,25 +702,21 @@ public: m_data->plane.to_2d(segment.target())); } - template::type > - const typename Intersection_kernel::Segment_2 to_2d(const typename Intersection_kernel::Segment_3& segment) const { + template + auto to_2d(const typename Intersection_kernel::Segment_3& segment) const + -> std::enable_if_t, const typename Intersection_kernel::Segment_2> { return typename Intersection_kernel::Segment_2( m_data->exact_plane.to_2d(segment.source()), m_data->exact_plane.to_2d(segment.target())); } - const Vector_3 to_3d(const Vector_2& vec) const { - return Vector_3( - m_data->plane.to_3d(Point_2(FT(0), FT(0))), - m_data->plane.to_3d(Point_2(FT(0), FT(0)) + vec)); - } - const Point_3 to_3d(const Point_2& point) const { return m_data->plane.to_3d(point); } - template::type > - const typename Intersection_kernel::Point_3 to_3d(const typename Intersection_kernel::Point_2& point) const { + template + auto to_3d(const typename Intersection_kernel::Point_2& point) const + ->std::enable_if_t, const typename Intersection_kernel::Point_3> { return m_data->exact_plane.to_3d(point); } diff --git a/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h b/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h index a11a1f9dc71..23a43b8f646 100644 --- a/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h +++ b/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h @@ -398,6 +398,8 @@ public: using NP_helper = Point_set_processing_3_np_helper; using PointMap = typename NP_helper::Point_map; + static_assert(std::is_same_v); + PointMap point_map = NP_helper::get_point_map(np); To_exact to_exact; diff --git a/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt b/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt index 3df57e9e4d0..edae7092c3f 100644 --- a/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt +++ b/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_space_partition_Tests) @@ -10,30 +10,24 @@ set(CMAKE_CXX_STANDARD 17) find_package(CGAL QUIET COMPONENTS Core) include(CGAL_CreateSingleSourceCGALProgram) -find_package(Boost REQUIRED) -if(Boost_FOUND) - message(STATUS "Found Boost") - - find_package(Eigen3 3.1.0 REQUIRED) - if(Eigen3_FOUND) - message(STATUS "Found Eigen") - include(CGAL_Eigen3_support) - - set(targets kinetic_3d_test_all issue_8624) - - set(project_linked_libraries) - set(project_compilation_definitions) - - foreach(target ${targets}) - create_single_source_cgal_program("${target}.cpp") - if(TARGET ${target}) - target_link_libraries(${target} PRIVATE ${project_linked_libraries} CGAL::Eigen3_support) - target_compile_definitions(${target} PRIVATE ${project_compilation_definitions}) - endif() - endforeach() - else() - message(ERROR "This program requires the Eigen library, and will not be compiled.") - endif() -else() - message(ERROR "This program requires the Boost library, and will not be compiled.") +find_package(Eigen3 3.1.0 REQUIRED) +if(NOT Eigen3_FOUND) + message(ERROR "This project requires the Eigen library, and will not be compiled.") + return() endif() + +message(STATUS "Found Eigen") +include(CGAL_Eigen3_support) + +set(targets kinetic_3d_test_all issue_8624) + +set(project_linked_libraries) +set(project_compilation_definitions) + +foreach(target ${targets}) + create_single_source_cgal_program("${target}.cpp") + if(TARGET ${target}) + target_link_libraries(${target} PRIVATE ${project_linked_libraries} CGAL::Eigen3_support) + target_compile_definitions(${target} PRIVATE ${project_compilation_definitions}) + endif() +endforeach() diff --git a/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt b/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt index 5445891abb0..9ec2ba71fb9 100644 --- a/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt +++ b/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_surface_reconstruction_Examples) diff --git a/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h b/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h index 9ff59a0202a..b2325f285d9 100644 --- a/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h +++ b/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h @@ -1546,7 +1546,7 @@ private: n = m_lcc.beta(n, 1); } while (n != dh); - KSP_3::internal::dump_polygon(face, fn); + KSP_3::internal::dump_polygon(face, fn); } void write_edge(typename LCC::Dart_descriptor dh, const std::string& fn) { @@ -1707,7 +1707,7 @@ private: m_face_area_lcc.resize(m_faces_lcc.size(), 0); for (std::size_t i = 0; i < m_faces_lcc.size(); i++) - m_face_area_lcc[i] = m_face_area_lcc[i] * 2.0 * m_total_inliers / total_area; + m_face_area_lcc[i] = m_face_area_lcc[i] * FT(2.0) * FT(m_total_inliers) / total_area; } FT area(typename LCC::Dart_descriptor face_dart, Plane_3 &pl, std::vector *tris = nullptr) { diff --git a/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt b/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt index bf6b5fc9d13..b4a355e2b65 100644 --- a/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt +++ b/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_surface_reconstruction_Tests) diff --git a/Lab/demo/Lab/CGAL_Lab.cpp b/Lab/demo/Lab/CGAL_Lab.cpp index 85880fb8add..ff4d0d3c598 100644 --- a/Lab/demo/Lab/CGAL_Lab.cpp +++ b/Lab/demo/Lab/CGAL_Lab.cpp @@ -83,7 +83,7 @@ CGAL_Lab::CGAL_Lab(int& argc, char **argv, tr("Ignore the autostart.js file, if any.")); parser.addOption(no_autostart); QCommandLineOption verbose("verbose", - tr("Print the paths explored byt the application searching for plugins.")); + tr("Print the paths explored by the application searching for plugins.")); parser.addOption(verbose); QCommandLineOption old("old", tr("Force OpenGL 2.1 context.")); diff --git a/Lab/demo/Lab/CGALlab.h b/Lab/demo/Lab/CGALlab.h index 0e40646762d..51afe5d0db0 100644 --- a/Lab/demo/Lab/CGALlab.h +++ b/Lab/demo/Lab/CGALlab.h @@ -20,7 +20,7 @@ public: * Constructor : calls the constructor of QApplication */ CGAL_Lab(int& argc, char **argv, - QString application_name = "Polyhedron_3 demo", + QString application_name = "CGAL Lab", QString main_window_title = "CGAL Lab", QStringList input_keywords = QStringList()); diff --git a/Lab/demo/Lab/CGALlab_macros.cmake b/Lab/demo/Lab/CGALlab_macros.cmake index 73f2733bc79..5a1756a0e43 100644 --- a/Lab/demo/Lab/CGALlab_macros.cmake +++ b/Lab/demo/Lab/CGALlab_macros.cmake @@ -63,30 +63,20 @@ add_dependencies(CGALlab_compile_all_plugins CGALlab_all_plugins) STRING(TOLOWER "${plugin_implementation_base_name}.json" base_name) SET(filename "${CMAKE_CURRENT_BINARY_DIR}/${base_name}") LIST(LENGTH ARG_KEYWORDS size) + SET(keywords "") if(${size} GREATER 0) - SET(keywords ) - FILE(WRITE ${filename} "{ \"Keywords\" : [") foreach(keyword ${ARG_KEYWORDS}) - LIST(APPEND keywords "\"${keyword}\", ") + SET(keywords "${keywords}\"${keyword}\", ") if(NOT TARGET ${keyword}) add_custom_target(${keyword}) endif() add_dependencies( ${keyword} ${plugin_name}) endforeach() - LIST(LENGTH keywords size) - math(EXPR size "${size} - 1") - LIST(GET keywords -1 last_element) - LIST(REMOVE_AT keywords ${size}) - STRING(LENGTH ${last_element} size) - math(EXPR size "${size} - 2") - STRING(SUBSTRING ${last_element} 0 ${size} last_element) - LIST(APPEND keywords ${last_element}) - foreach(keyword ${keywords}) - file(APPEND ${filename} ${keyword}) - endforeach() - file(APPEND ${filename} "], \n") - string(TIMESTAMP VERSION "%Y-%m-%d %H:%M") - file(APPEND ${filename} "\"ConfigDate\" : \"${VERSION}\" }") + # Remove the last comma and space + string(REGEX REPLACE ", $" "" keywords "${keywords}") endif() + file(WRITE ${filename} "{\n \"Keywords\" : [ ${keywords} ],\n") + string(TIMESTAMP VERSION "%Y-%m-%d %H:%M") + file(APPEND ${filename} " \"ConfigDate\" : \"${VERSION}\"\n}\n") CGAL_install_hooks() endmacro(cgal_lab_plugin) diff --git a/Lab/demo/Lab/CMakeLists.txt b/Lab/demo/Lab/CMakeLists.txt index 885cd774ce1..13e6104e252 100644 --- a/Lab/demo/Lab/CMakeLists.txt +++ b/Lab/demo/Lab/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Lab_Demo) include(FeatureSummary) diff --git a/Lab/demo/Lab/Color_map.h b/Lab/demo/Lab/Color_map.h index a7a608112eb..909fc2f6a93 100644 --- a/Lab/demo/Lab/Color_map.h +++ b/Lab/demo/Lab/Color_map.h @@ -23,9 +23,9 @@ compute_color_map(QColor base_color, std::size_t nb_of_colors, Output_color_iterator out) { - qreal hue = base_color.hueF(); - const qreal step = (static_cast(1)) / nb_of_colors; + const qreal step = (static_cast(0.85)) / nb_of_colors; + qreal hue = base_color.hueF(); qreal h = (hue == -1) ? 0 : hue; for(std::size_t i=0; ibbox(); - CGAL::qglviewer::Vec min(static_cast(bbox.xmin())+viewer->offset().x, static_cast(bbox.ymin())+viewer->offset().y, static_cast(bbox.zmin())+viewer->offset().z), - max(static_cast(bbox.xmax())+viewer->offset().x, static_cast(bbox.ymax())+viewer->offset().y, static_cast(bbox.zmax())+viewer->offset().z); + CGAL::qglviewer::Vec min{static_cast(bbox.xmin()) + viewer->offset().x, + static_cast(bbox.ymin()) + viewer->offset().y, + static_cast(bbox.zmin()) + viewer->offset().z}; + CGAL::qglviewer::Vec max{static_cast(bbox.xmax()) + viewer->offset().x, + static_cast(bbox.ymax()) + viewer->offset().y, + static_cast(bbox.zmax()) + viewer->offset().z}; viewer->setSceneBoundingBox(min, max); viewerShow(static_cast(min.x), static_cast(min.y), static_cast(min.z), static_cast(max.x), static_cast(max.y), static_cast(max.z)); diff --git a/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp index 5b7e647e96c..689d2c5b318 100644 --- a/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp +++ b/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp @@ -46,9 +46,9 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po std::cerr << m_clusters.size() << " cluster(s) found" << std::endl; bool training_found = false; - boost::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); + std::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); bool classif_found = false; - boost::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); + std::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); training_found = !training_found; // add_property_map returns false if classif_found = !classif_found; // property was already there diff --git a/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp index 11ef26725a6..a5169477661 100644 --- a/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp +++ b/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp @@ -41,9 +41,9 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n backup_existing_colors_and_add_new(); bool training_found = false; - boost::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); + std::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); bool classif_found = false; - boost::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); + std::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); training_found = !training_found; // add_property_map returns false if classif_found = !classif_found; // property was already there diff --git a/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp index f0eb9086215..ae298d99940 100644 --- a/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -350,11 +351,11 @@ private: template void displayMapLegend(const std::vector& values) { - const std::size_t size = (std::min)(color_map.size(), std::size_t(1024)); + const std::size_t size = (std::min)(color_map.size(), std::size_t(4096)); const int text_height = 20; const int height = text_height * static_cast(size) + text_height; - const int width = 140; + const int width = 200; const int cell_width = width / 3; const int top_margin = 15; const int left_margin = 5; @@ -381,13 +382,13 @@ private: tick_height, color); - QRect text_rect(left_margin + cell_width + 10, drawing_height - top_margin - j, 50, text_height); - painter.drawText(text_rect, Qt::AlignCenter, QObject::tr("%1").arg(values[i], 0, 'f', 3, QLatin1Char(' '))); + QRect text_rect(left_margin + cell_width + 10, drawing_height - top_margin - j, 100, text_height); + painter.drawText(text_rect, Qt::AlignCenter, QObject::tr("%1").arg(values[i], 0, 'f', 6, QLatin1Char(' '))); } if(color_map.size() > size) { - QRect text_rect(left_margin + cell_width + 10, 0, 50, text_height); + QRect text_rect(left_margin + cell_width + 10, 0, 100, text_height); painter.drawText(text_rect, Qt::AlignCenter, QObject::tr("[...]")); } @@ -463,6 +464,8 @@ private: "Largest Angle Per Face", "Scaled Jacobian", "Face Area", + "Discrete Mean Curvature", + "Discrete Gaussian Curvature", "Interpolated Corrected Mean Curvature", "Interpolated Corrected Gaussian Curvature"}); property_simplex_types = { Property_simplex_type::FACE, @@ -470,6 +473,8 @@ private: Property_simplex_type::FACE, Property_simplex_type::FACE, Property_simplex_type::VERTEX, + Property_simplex_type::VERTEX, + Property_simplex_type::VERTEX, Property_simplex_type::VERTEX }; detectSMScalarProperties(*(sm_item->face_graph())); } @@ -516,12 +521,12 @@ private Q_SLOTS: // Curvature property-specific slider const std::string& property_name = dock_widget->propertyBox->currentText().toStdString(); - const bool is_curvature_property = (property_name == "Interpolated Corrected Mean Curvature" || - property_name == "Interpolated Corrected Gaussian Curvature"); - dock_widget->expandingRadiusLabel->setVisible(is_curvature_property); - dock_widget->expandingRadiusSlider->setVisible(is_curvature_property); - dock_widget->expandingRadiusLabel->setEnabled(is_curvature_property); - dock_widget->expandingRadiusSlider->setEnabled(is_curvature_property); + const bool is_interpolated_curvature_property = (property_name == "Interpolated Corrected Mean Curvature" || + property_name == "Interpolated Corrected Gaussian Curvature"); + dock_widget->expandingRadiusLabel->setVisible(is_interpolated_curvature_property); + dock_widget->expandingRadiusSlider->setVisible(is_interpolated_curvature_property); + dock_widget->expandingRadiusLabel->setEnabled(is_interpolated_curvature_property); + dock_widget->expandingRadiusSlider->setEnabled(is_interpolated_curvature_property); } else // no or broken property { @@ -570,6 +575,16 @@ private: { displayArea(sm_item); } + else if(property_name == "Discrete Mean Curvature") + { + displayDiscreteCurvatureMeasure(sm_item, MEAN_CURVATURE); + sm_item->setRenderingMode(Gouraud); + } + else if(property_name == "Discrete Gaussian Curvature") + { + displayDiscreteCurvatureMeasure(sm_item, GAUSSIAN_CURVATURE); + sm_item->setRenderingMode(Gouraud); + } else if(property_name == "Interpolated Corrected Mean Curvature") { displayInterpolatedCurvatureMeasure(sm_item, MEAN_CURVATURE); @@ -682,6 +697,8 @@ private: removeDisplayPluginProperty(item, "f:display_plugin_largest_angle"); removeDisplayPluginProperty(item, "f:display_plugin_scaled_jacobian"); removeDisplayPluginProperty(item, "f:display_plugin_area"); + removeDisplayPluginProperty(item, "v:display_plugin_discrete_mean_curvature"); + removeDisplayPluginProperty(item, "v:display_plugin_discrete_Gaussian_curvature"); removeDisplayPluginProperty(item, "v:display_plugin_interpolated_corrected_mean_curvature"); removeDisplayPluginProperty(item, "v:display_plugin_interpolated_corrected_Gaussian_curvature"); } @@ -864,6 +881,35 @@ private: displaySMProperty("f:display_plugin_area", *sm); } +private: + void displayDiscreteCurvatureMeasure(Scene_surface_mesh_item* sm_item, + CurvatureType mu_index) + { + SMesh* sm = sm_item->face_graph(); + if(sm == nullptr) + return; + + if(mu_index != MEAN_CURVATURE && mu_index != GAUSSIAN_CURVATURE) + return; + + std::string vdc_name = (mu_index == MEAN_CURVATURE) ? "v:display_plugin_discrete_mean_curvature" + : "v:display_plugin_discrete_Gaussian_curvature"; + + bool not_initialized; + SMesh::Property_map vdc; + std::tie(vdc, not_initialized) = sm->add_property_map(vdc_name, 0); + + if(not_initialized) + { + if(mu_index == MEAN_CURVATURE) + PMP::discrete_mean_curvatures(*sm, vdc); + else + PMP::discrete_Gaussian_curvatures(*sm, vdc); + } + + displaySMProperty(vdc_name, *sm); + } + private Q_SLOTS: void setExpandingRadius() { @@ -1131,6 +1177,10 @@ private: zoomToSimplexWithPropertyExtremum(faces(mesh), mesh, "f:display_plugin_scaled_jacobian", extremum); else if(property_name == "Face Area") zoomToSimplexWithPropertyExtremum(faces(mesh), mesh, "f:display_plugin_area", extremum); + else if(property_name == "Discrete Mean Curvature") + zoomToSimplexWithPropertyExtremum(vertices(mesh), mesh, "v:display_plugin_discrete_mean_curvature", extremum); + else if(property_name == "Discrete Gaussian Curvature") + zoomToSimplexWithPropertyExtremum(vertices(mesh), mesh, "v:display_plugin_discrete_Gaussian_curvature", extremum); else if(property_name == "Interpolated Corrected Mean Curvature") zoomToSimplexWithPropertyExtremum(vertices(mesh), mesh, "v:display_plugin_interpolated_corrected_mean_curvature", extremum); else if(property_name == "Interpolated Corrected Gaussian Curvature") @@ -1470,6 +1520,8 @@ isSMPropertyScalar(const std::string& name, name == "f:display_plugin_largest_angle" || name == "f:display_plugin_scaled_jacobian" || name == "f:display_plugin_area" || + name == "v:display_plugin_discrete_mean_curvature" || + name == "v:display_plugin_discrete_Gaussian_curvature" || name == "v:display_plugin_interpolated_corrected_mean_curvature" || name == "v:display_plugin_interpolated_corrected_Gaussian_curvature") return false; diff --git a/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp index 58512209f23..9fcea780b98 100644 --- a/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp @@ -250,7 +250,7 @@ public: if(!c3t3_item || extension != "vtu") return false; - std::ofstream os(output_filename.data()); + std::ofstream os(output_filename.data(), std::ios::binary); os << std::setprecision(16); const C3t3& c3t3 = c3t3_item->c3t3(); @@ -447,8 +447,8 @@ public: cit != c3t3_item->c3t3().triangulation().finite_cells_end(); ++cit) { - CGAL_assertion(cit->info() >= 0); - c3t3_item->c3t3().add_to_complex(cit, cit->info()); + if(cit->info() != 0) + c3t3_item->c3t3().add_to_complex(cit, cit->info()); for(int i=0; i < 4; ++i) { if(cit->surface_patch_index(i)>0) diff --git a/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp index e55c30779bb..515ad8a999c 100644 --- a/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp @@ -124,7 +124,7 @@ void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, int constant_coordinat { typename Map::iterator it; bool insert_ok; - boost::tie(it,insert_ok) = + std::tie(it,insert_ok) = descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); if (insert_ok){ const Kernel::Point_3& pt=fit->vertex(i)->point(); diff --git a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt index 6edbaf4da55..b63737188ff 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt @@ -2,6 +2,8 @@ include(CGALlab_macros) remove_definitions(-DQT_STATICPLUGIN) +set(CMAKE_AUTOMOC ON) + qt6_wrap_cpp(VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_thread.h) qt6_wrap_cpp(VOLUME_MOC_OUTFILES diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp index 2aadc761957..f2c255a10fc 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -592,7 +592,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.protect->setChecked(features_protection_available); ui.facegraphCheckBox->setVisible(mesh_type == Mesh_type::SURFACE_ONLY); - ui.initializationGroup->setVisible(input_is_labeled_img); + ui.initializationGroup->setVisible(input_is_labeled_img || input_is_gray_img); ui.grayImgGroup->setVisible(input_is_gray_img); if(input_is_gray_img) diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp index e46ecd6c4de..d1e560c5aa7 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp @@ -20,19 +20,6 @@ using namespace CGAL::Three; typedef Tr::Bare_point Bare_point; -struct Compare_to_isovalue { - double iso_value; - bool less; - typedef bool result_type; - - Compare_to_isovalue(double iso_value, bool less) - : iso_value(iso_value), less(less) {} - - bool operator()(double x) const { - return (x < iso_value) == less; - } -}; - Meshing_thread* cgal_code_mesh_3(QList pMeshes, const Polylines_container& polylines, const SMesh* pBoundingMesh, @@ -355,6 +342,8 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, param.protect_features = protect_features || protect_borders || !polylines.empty(); param.detect_connected_components = detect_connected_components; + param.iso_value = iso_value; + param.inside_is_less = inside_is_less; param.facet_angle = facet_angle; param.facet_sizing = facet_sizing; param.facet_min_sizing = facet_min_sizing; diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h index 37d59c7e0a5..433d6cfc549 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h @@ -27,7 +27,8 @@ #include #include #include -#include +#include +#include #include "C3t3_type.h" #include "Meshing_thread.h" @@ -40,6 +41,19 @@ namespace CGAL { class Image_3; } +struct Compare_to_isovalue { + double iso_value; + bool less; + typedef bool result_type; + + Compare_to_isovalue(double iso_value, bool less) + : iso_value(iso_value), less(less) {} + + bool operator()(double x) const { + return (x < iso_value) == less; + } +}; + struct Mesh_parameters { double facet_angle; @@ -55,6 +69,8 @@ struct Mesh_parameters double edge_distance; bool protect_features; bool detect_connected_components; + float iso_value; + bool inside_is_less; int manifold; const CGAL::Image_3* image_3_ptr; const CGAL::Image_3* weights_ptr; @@ -111,6 +127,7 @@ private: void initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag); void initialize(const Mesh_criteria& criteria, Mesh_fnt::Labeled_image_domain_tag); + void initialize(const Mesh_criteria& criteria, Mesh_fnt::Gray_image_domain_tag); Edge_criteria edge_criteria(double b, double minb, double d, Mesh_fnt::Domain_tag); Edge_criteria edge_criteria(double b, double minb, double d, Mesh_fnt::Polyhedral_domain_tag); @@ -231,16 +248,61 @@ Mesh_function:: initialize(const Mesh_criteria& criteria, Mesh_fnt::Labeled_image_domain_tag) // for a labeled image { - if(p_.detect_connected_components) { - CGAL_IMAGE_IO_CASE(p_.image_3_ptr->image(), - initialize_triangulation_from_labeled_image(c3t3_ - , *domain_ - , *p_.image_3_ptr - , criteria - , Word() - , p_.protect_features); - ); - } else { + namespace p = CGAL::parameters; + // Initialization of the labeled image, either with the protection of sharp + // features, or with the initial points (or both). + if (p_.detect_connected_components) + { + CGAL::Mesh_3::internal::C3t3_initializer< + C3t3, + Domain, + Mesh_criteria, + CGAL::internal::has_Has_features::value >() + (c3t3_, + *domain_, + criteria, + p_.protect_features, + p::mesh_3_options(p::pointer_to_stop_atomic_boolean = &stop_, + p::nonlinear_growth_of_balls = true).v, + CGAL::Construct_initial_points_labeled_image(*p_.image_3_ptr, *domain_)); + } + else + { + initialize(criteria, Mesh_fnt::Domain_tag()); + } +} + +template < typename D_, typename Tag > +void +Mesh_function:: +initialize(const Mesh_criteria& criteria, Mesh_fnt::Gray_image_domain_tag) +// for a gray image +{ + namespace p = CGAL::parameters; + // Initialization of the gray image, either with the protection of sharp + // features, or with the initial points (or both). + if (p_.detect_connected_components) + { + CGAL::Construct_initial_points_gray_image generator + (*p_.image_3_ptr, + *domain_, + p_.iso_value, + Compare_to_isovalue(p_.iso_value, p_.inside_is_less)); + CGAL::Mesh_3::internal::C3t3_initializer< + C3t3, + Domain, + Mesh_criteria, + CGAL::internal::has_Has_features::value >() + (c3t3_, + *domain_, + criteria, + p_.protect_features, + p::mesh_3_options(p::pointer_to_stop_atomic_boolean = &stop_, + p::nonlinear_growth_of_balls = true).v, + generator); + } + else + { initialize(criteria, Mesh_fnt::Domain_tag()); } } @@ -254,8 +316,7 @@ initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag) namespace p = CGAL::parameters; // Initialization of the mesh, either with the protection of sharp // features, or with the initial points (or both). - // If `detect_connected_components==true`, the initialization is - // already done. + CGAL::Mesh_3::internal::C3t3_initializer< C3t3, Domain, diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp index df2f5ca5287..a21cdbbf655 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp @@ -1,7 +1,5 @@ #include "config.h" -#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER - #include #include "ui_Offset_meshing_dialog.h" @@ -761,5 +759,3 @@ inflate_mesh() } #include "Offset_meshing_plugin.moc" - -#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp index 15883fa976a..46539303a43 100644 --- a/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp @@ -375,7 +375,7 @@ void Basic_generator_plugin::generateCube() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -416,7 +416,7 @@ void Basic_generator_plugin::generateCube() if (list.size()!=6){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 6 doubles."); + msgBox->setText("ERROR : Input should consist of 6 doubles."); msgBox->exec(); return; } @@ -467,7 +467,7 @@ void Basic_generator_plugin::generatePrism() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -514,7 +514,7 @@ void Basic_generator_plugin::generatePyramid() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -557,7 +557,7 @@ void Basic_generator_plugin::generateSphere() if (list.size()!=4){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of four doubles."); + msgBox->setText("ERROR : Input should consist of four doubles."); msgBox->exec(); return; } @@ -607,7 +607,7 @@ void Basic_generator_plugin::generateTetrahedron() if (list.size() != 3) { QMessageBox* msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -641,7 +641,7 @@ void Basic_generator_plugin::generateTetrahedron() if (list.size() != 12) { QMessageBox* msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 12 doubles."); + msgBox->setText("ERROR : Input should consist of 12 doubles."); msgBox->exec(); return; } @@ -685,7 +685,7 @@ void Basic_generator_plugin::generatePoints() if (list.size()%3!=0){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of triplets."); + msgBox->setText("ERROR : Input should consist of triplets."); msgBox->exec(); return; } @@ -742,14 +742,14 @@ void Basic_generator_plugin::generateLines() if(!is_2d && list.size()%3!=0){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of triplets."); + msgBox->setText("ERROR : Input should consist of triplets."); msgBox->exec(); return false; } else if(is_2d && list.size()%2!=0){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of pairs."); + msgBox->setText("ERROR : Input should consist of pairs."); msgBox->exec(); return false; } @@ -912,7 +912,7 @@ void Basic_generator_plugin::generateGrid() if (list.size()!=6){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 6 doubles."); + msgBox->setText("ERROR : Input should consist of 6 doubles."); msgBox->exec(); return; } diff --git a/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui b/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui index eed6885a04c..f749ca97ab7 100644 --- a/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui +++ b/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui @@ -18,7 +18,7 @@ - 4 + 6 @@ -43,7 +43,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -180,7 +180,7 @@ QGroupBox::title { - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -198,7 +198,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -232,7 +232,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -315,7 +315,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -349,7 +349,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -495,7 +495,7 @@ QGroupBox::title { - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -513,7 +513,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -880,7 +880,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html> @@ -919,7 +919,7 @@ li.checked::marker { content: "\2612"; } - Qt::Vertical + Qt::Orientation::Vertical @@ -1045,7 +1045,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -1081,7 +1081,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html> @@ -1149,7 +1149,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html> @@ -1167,7 +1167,7 @@ li.checked::marker { content: "\2612"; } - Qt::Vertical + Qt::Orientation::Vertical @@ -1206,7 +1206,7 @@ li.checked::marker { content: "\2612"; } - Qt::Horizontal + Qt::Orientation::Horizontal diff --git a/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp index 1adc2ae81ea..b0a7ca79f35 100644 --- a/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp @@ -897,7 +897,7 @@ private: { typename Map::iterator it; bool insert_ok; - boost::tie(it,insert_ok) = + std::tie(it,insert_ok) = descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); if (insert_ok){ const EPICK::Point_2& pt=fit->vertex(i)->point(); diff --git a/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp index dbe630ad09f..9ffa83fe5ba 100644 --- a/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp @@ -67,7 +67,7 @@ void compute(SMesh* sMesh, bool created = false; SMesh::Property_map> principal_curvatures_and_directions_map; - boost::tie(principal_curvatures_and_directions_map, created) = sMesh->add_property_map> + std::tie(principal_curvatures_and_directions_map, created) = sMesh->add_property_map> ("v:principal_curvatures_and_directions_map", { 0, 0, Vector(0,0,0), Vector(0,0,0) }); @@ -84,7 +84,8 @@ void compute(SMesh* sMesh, for (Vertex_descriptor v : vertices(*sMesh)) { const PMP::Principal_curvatures_and_directions pc = principal_curvatures_and_directions_map[v]; - max_curvature_magnitude_on_mesh = std::max(max_curvature_magnitude_on_mesh, std::max(abs(pc.min_curvature), abs(pc.max_curvature))); + max_curvature_magnitude_on_mesh = + (std::max)(max_curvature_magnitude_on_mesh, (std::max)(abs(pc.min_curvature), abs(pc.max_curvature))); } for(Vertex_descriptor v : vertices(*sMesh)) diff --git a/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp index 7c333459555..884f0bb04f8 100644 --- a/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp @@ -692,7 +692,7 @@ if(!contracted_item) item->mcs->poles(pole_points); vertex_iterator vb, ve; int id = 0; - for (boost::tie(vb, ve) = vertices(*pMesh); vb != ve; ++vb) + for (std::tie(vb, ve) = vertices(*pMesh); vb != ve; ++vb) { std::vector line; line.clear(); diff --git a/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp index 12e6a6ead33..f668a2ffa37 100644 --- a/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp @@ -109,28 +109,28 @@ QList CGAL_Lab_orient_soup_plugin::actions() const { << actionClean; } -void set_vcolors(SMesh* smesh, std::vector colors) +void set_vcolors(SMesh* smesh, const std::vector& colors) { typedef SMesh SMesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; - SMesh::Property_map vcolors = - smesh->property_map("v:color").value(); + + SMesh::Property_map vcolors; bool created; - boost::tie(vcolors, created) = smesh->add_property_map("v:color",CGAL::IO::Color(0,0,0)); + std::tie(vcolors, created) = smesh->add_property_map("v:color",CGAL::IO::Color(0,0,0)); assert(colors.size()==smesh->number_of_vertices()); int color_id = 0; for(vertex_descriptor vd : vertices(*smesh)) vcolors[vd] = colors[color_id++]; } -void set_fcolors(SMesh* smesh, std::vector colors) +void set_fcolors(SMesh* smesh, const std::vector& colors) { typedef SMesh SMesh; typedef boost::graph_traits::face_descriptor face_descriptor; - SMesh::Property_map fcolors = - smesh->property_map("f:color").value(); + + SMesh::Property_map fcolors; bool created; - boost::tie(fcolors, created) = smesh->add_property_map("f:color",CGAL::IO::Color(0,0,0)); + std::tie(fcolors, created) = smesh->add_property_map("f:color",CGAL::IO::Color(0,0,0)); assert(colors.size()==smesh->number_of_faces()); int color_id = 0; for(face_descriptor fd : faces(*smesh)) diff --git a/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp index eaf633c7cf5..6daad328b43 100644 --- a/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp @@ -210,6 +210,7 @@ public: connect(ui_widget.Select_sharp_edges_button, SIGNAL(clicked()), this, SLOT(on_Select_sharp_edges_button_clicked())); connect(ui_widget.selectionOrEuler, SIGNAL(currentChanged(int)), this, SLOT(on_SelectionOrEuler_changed(int))); connect(ui_widget.editionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_editionBox_changed(int))); + connect(ui_widget.movePoint_pushButton, SIGNAL(clicked()), this, SLOT(on_movePoint_pushButton_clicked())); ui_widget.Sharp_edges_label->hide(); ui_widget.Sharp_angle_spinbox->hide(); @@ -701,7 +702,7 @@ public Q_SLOTS: begin != selection_item->selected_edges.end(); ++begin) { fg_vertex_descriptor source = target(opposite(halfedge(*begin,*poly),*poly),*poly); - boost::tie(it_find, insert_OK) + std::tie(it_find, insert_OK) = p2vd.insert(std::make_pair(source, Edge_graph::vertex_descriptor())); if (insert_OK) { @@ -711,7 +712,7 @@ public Q_SLOTS: Edge_graph::vertex_descriptor src=it_find->second; fg_vertex_descriptor targ = target(halfedge(*begin,*poly),*poly); - boost::tie(it_find, insert_OK) + std::tie(it_find, insert_OK) = p2vd.insert(std::make_pair(targ, Edge_graph::vertex_descriptor())); if (insert_OK) { @@ -987,6 +988,10 @@ public Q_SLOTS: { Q_EMIT set_operation_mode(mode); } + + ui_widget.movePointCoordinates_textEdit->setVisible(false); + ui_widget.movePoint_pushButton->setVisible(false); + switch(mode) { //Join vertex @@ -1025,24 +1030,97 @@ public Q_SLOTS: } //Add vertex and face to border case 9: + { + QPixmap pm(":/cgal/Lab/resources/euler_deg2.png"); + ui_widget.docImage_Label->setPixmap(pm); + break; + } + case 10: { QPixmap pm(":/cgal/Lab/resources/add_facet1.png"); ui_widget.docImage_Label->setPixmap(pm); break; } //add facet to border - case 10: + case 11: { QPixmap pm(":/cgal/Lab/resources/add_facet2.png"); ui_widget.docImage_Label->setPixmap(pm); break; } + // Move point + case 12: + { + ui_widget.docImage_Label->clear(); + ui_widget.movePointCoordinates_textEdit->setVisible(true); + ui_widget.movePoint_pushButton->setVisible(true); + ui_widget.movePoint_pushButton->setEnabled(true); + break; + } default: ui_widget.docImage_Label->clear(); break; } on_LassoCheckBox_changed(ui_widget.lassoCheckBox->isChecked()); } + + void on_movePoint_pushButton_clicked() + { + QString text = ui_widget.movePointCoordinates_textEdit->toPlainText(); + Scene_points_with_normal_item* item = new Scene_points_with_normal_item(); + QStringList list = text.split(QRegularExpression("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); + int counter = 0; + double coord[3]; + bool ok = true; + if (list.isEmpty()) return; + if (list.size() != 3){ + QMessageBox *msgBox = new QMessageBox; + msgBox->setWindowTitle("Error"); + msgBox->setText("ERROR : Input should consist of a triplet."); + msgBox->exec(); + return; + } + + for(QString s : list) + { + if(!s.isEmpty()) + { + double res = s.toDouble(&ok); + if(!ok) + { + QMessageBox *msgBox = new QMessageBox; + msgBox->setWindowTitle("Error"); + msgBox->setText("ERROR : Coordinates are invalid."); + msgBox->exec(); + break; + } + else + { + coord[counter++] = res; + } + } + } + + if(counter == 3) + { + const Kernel::Point_3 p(coord[0], coord[1], coord[2]); + item->point_set()->insert(p); + counter = 0; + + ui_widget.movePointCoordinates_textEdit->clear(); + + Scene_polyhedron_selection_item* selection_item = getSelectedItem(); + if(!selection_item) + selection_item = onTheFlyItem(); + if (!selection_item) { + print_message("Error: there is no selected polyhedron selection item!"); + return; + } + + selection_item->moveVertex(p); + } + } + void on_Select_sharp_edges_button_clicked() { Scene_polyhedron_selection_item* selection_item = getSelectedItem(); if(!selection_item) diff --git a/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui b/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui index d7b76c83d06..5a9dce0a662 100644 --- a/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui +++ b/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui @@ -7,7 +7,7 @@ 0 0 630 - 532 + 579 @@ -46,7 +46,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -61,7 +61,7 @@ - 0 + 1 @@ -176,7 +176,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -200,7 +200,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -218,7 +218,7 @@ Sharp edges angle: - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter @@ -274,7 +274,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -294,7 +294,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -367,7 +367,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -386,7 +386,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -479,7 +479,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -572,20 +572,7 @@ - - - Qt::Vertical - - - - 20 - 40 - - - - - - + @@ -633,6 +620,11 @@ Remove center vertex + + + Remove degree 2 vertex + + Add vertex and face to border (Advanced) @@ -659,6 +651,29 @@ + + + + true + + + + 0 + 0 + + + + New Coordinates: X Y Z + + + + + + + Apply move + + + @@ -666,15 +681,28 @@ - - - - Ctrl+Z to cancel the temporary selection. Ctrl+U to undo last operation (if applicable). - - - + + + + Ctrl+Z to cancel the temporary selection. Ctrl+U to undo last operation (if applicable). + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + @@ -685,7 +713,7 @@ - Qt::Vertical + Qt::Orientation::Vertical diff --git a/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index 1baaa63af33..5a0c76720ea 100644 --- a/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -277,7 +277,7 @@ private: Point_set::Property_map shape_id; if (dialog.add_property()) { bool added = false; - boost::tie(shape_id, added) = points->template add_property_map ("shape", -1); + std::tie(shape_id, added) = points->template add_property_map ("shape", -1); if (!added) { for (auto it = points->begin(); it != points->end(); ++ it) shape_id[*it] = -1; @@ -563,7 +563,7 @@ private: if (dialog.add_property()) { bool added = false; - boost::tie (shape_id, added) = points->template add_property_map ("shape", -1); + std::tie (shape_id, added) = points->template add_property_map ("shape", -1); if (!added) { for (Point_set::iterator it = points->begin(); it != points->end(); ++ it) diff --git a/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp index ea75b2286ca..95cff942339 100644 --- a/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp @@ -223,10 +223,10 @@ private Q_SLOTS: bool d, r, g, b; new_item->point_set()->remove_colors(); //bind pmaps - boost::tie(distance_map , d) = new_item->point_set()->add_property_map("distance",0); - boost::tie(fred_map , r) = new_item->point_set()->add_property_map("red",0); - boost::tie(fgreen_map, g) = new_item->point_set()->add_property_map("green",0); - boost::tie(fblue_map , b) = new_item->point_set()->add_property_map("blue",0); + std::tie(distance_map , d) = new_item->point_set()->add_property_map("distance",0); + std::tie(fred_map , r) = new_item->point_set()->add_property_map("red",0); + std::tie(fgreen_map, g) = new_item->point_set()->add_property_map("green",0); + std::tie(fblue_map , b) = new_item->point_set()->add_property_map("blue",0); new_item->point_set()->check_colors(); Point_set* points = new_item->point_set(); diff --git a/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp deleted file mode 100644 index 217e5888724..00000000000 --- a/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ /dev/null @@ -1,691 +0,0 @@ -#include "config.h" -#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER -#include -#include "ui_Remeshing_dialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include "Scene_surface_mesh_item.h" -#include "Scene_polygon_soup_item.h" -#include "Scene_polylines_item.h" -#include -#include -#include -#include - -#include "C3t3_type.h" - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include // std::shared_ptr - -namespace CGAL{ - -template -class Offset_function -{ - typedef AABB_face_graph_triangle_primitive Primitive; - typedef AABB_traits_3 Traits; - typedef AABB_tree Tree; - typedef Side_of_triangle_mesh Side_of; - -public: - - Offset_function(TriangleMesh& tm, double offset_distance) - : m_tree_ptr(new Tree(std::begin(faces(tm)), - std::end(faces(tm)), - tm) ) - , m_side_of_ptr( new Side_of(*m_tree_ptr) ) - , m_offset_distance(offset_distance) - , m_is_closed( is_closed(tm) ) - { - CGAL_assertion(!m_tree_ptr->empty()); - } - - double operator()(const typename GeomTraits::Point_3& p) const - { - using CGAL::sqrt; - - Bounded_side side = m_is_closed?m_side_of_ptr->operator()(p):ON_UNBOUNDED_SIDE; - if (side==ON_BOUNDARY) return m_offset_distance; - - typename GeomTraits::Point_3 closest_point = m_tree_ptr->closest_point(p); - double distance = sqrt(squared_distance(p, closest_point)); - - return (side == ON_UNBOUNDED_SIDE ? -distance : distance) + m_offset_distance; - } - -private: - std::shared_ptr m_tree_ptr; - std::shared_ptr m_side_of_ptr; - double m_offset_distance; - bool m_is_closed; - -}; - -class Polygon_soup_offset_function { - typedef Scene_polygon_soup_item::Points Points; - typedef Scene_polygon_soup_item::Polygons Polygons; - - typedef Polygons::const_iterator Polygon_iterator; - - - class Polygon_soup_point_property_map { - const Points* points_vector_ptr; - public: - typedef Polygon_iterator key_type; - typedef EPICK::Point_3 value_type; - typedef const value_type& reference; - typedef boost::readable_property_map_tag category; - - Polygon_soup_point_property_map() = default; - Polygon_soup_point_property_map(const Points* ptr) - : points_vector_ptr(ptr) - {} - - friend reference get(Polygon_soup_point_property_map map, - key_type polygon_it) - { - return (*map.points_vector_ptr)[*polygon_it->begin()]; - } - }; - - - class Polygon_soup_triangle_property_map { - const Points* points_vector_ptr; - public: - typedef Polygon_iterator key_type; - typedef EPICK::Triangle_3 value_type; - typedef value_type reference; - typedef boost::readable_property_map_tag category; - - Polygon_soup_triangle_property_map() = default; - Polygon_soup_triangle_property_map(const Points* ptr) - : points_vector_ptr(ptr) - {} - - friend value_type get(Polygon_soup_triangle_property_map map, - key_type polygon_it) - { - auto it = polygon_it->begin(); - CGAL_assertion(it != polygon_it->end()); - const auto id0 = *it++; - CGAL_assertion(it != polygon_it->end()); - const auto id1 = *it++; - CGAL_assertion(it != polygon_it->end()); - const auto id2 = *it++; - CGAL_assertion(it == polygon_it->end()); - - return value_type( (*map.points_vector_ptr)[id0], - (*map.points_vector_ptr)[id1], - (*map.points_vector_ptr)[id2] ); - } - }; - - struct AABB_primitive : - public CGAL::AABB_primitive - { - typedef CGAL::AABB_primitive Base; - - typedef Polygon_iterator Id; - - template - AABB_primitive(Id id, ObjectPmap&& opmap, PointPmap&& ppmap) - : Base(id, std::forward(opmap), std::forward(ppmap)) - {} - - template - AABB_primitive(Iterator it, ObjectPmap&& opmap, PointPmap&& ppmap) - : Base(*it, std::forward(opmap), std::forward(ppmap)) - {} - }; // end struct template AABB_primitive - - - typedef CGAL::AABB_traits_3 AABB_traits; - typedef CGAL::AABB_tree AABB_tree; - - std::shared_ptr m_tree_ptr; - double m_offset_distance; - - typedef Polygon_soup_triangle_property_map ObjectPmap; - typedef Polygon_soup_point_property_map PointPmap; -public: - Polygon_soup_offset_function(const Scene_polygon_soup_item* soup, - const double offset_distance) - : m_tree_ptr - (std::make_shared(begin(soup->polygons()), - end(soup->polygons()), - ObjectPmap(&soup->points()), - PointPmap(&soup->points())) - ) - , m_offset_distance(offset_distance) - { - CGAL_assertion(! m_tree_ptr->empty() ); - } - - double operator()(const EPICK::Point_3& p) const - { - using CGAL::sqrt; - - EPICK::Point_3 closest_point = m_tree_ptr->closest_point(p); - double distance = sqrt(squared_distance(p, closest_point)); - - return m_offset_distance - distance; - } - -}; // end class Polygon_soup_offset_function - -} //end of CGAL namespace - -Scene_surface_mesh_item* make_item(SMesh* sm) -{ - return new Scene_surface_mesh_item(sm); -} - -CGAL::Offset_function -offset_function(SMesh* surface_mesh_ptr, double offset_value) { - return { *surface_mesh_ptr, offset_value }; -} - -CGAL::Polygon_soup_offset_function -offset_function(Scene_polygon_soup_item* item, double offset_value) { - return { item, offset_value }; -} - -template -struct Result_type { - typedef T type; -}; - -template <> -struct Result_type { - typedef SMesh type; -}; - -template -CGAL::Bbox_3 bbox(Mesh* mesh_ptr) { - return CGAL::Polygon_mesh_processing::bbox(*mesh_ptr); -} - -CGAL::Bbox_3 bbox(Scene_polygon_soup_item* item) { - return item->bbox(); -} -class MeshGuard{ - SMesh* mesh; - bool done; -public: - MeshGuard(SMesh* mesh):mesh(mesh), done(false){} - void setDone(){done = true;} - ~MeshGuard(){ - if(!done) - delete mesh; - } -}; -// declare the CGAL function -template -SMesh* cgal_off_meshing(QWidget*, - Mesh* tm_ptr, - Scene_polylines_item* polylines_item, - const double offset_value, - const double angle, - const double sizing, - const double approx, - const double edge_size, - int tag) -{ - typedef EPICK GT; - typedef CGAL::Labeled_mesh_domain_3 Mesh_domain_base; - typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain; - typedef C3t3::Triangulation Tr; - typedef CGAL::Mesh_criteria_3 Mesh_criteria; - typedef GT::Sphere_3 Sphere_3; - - CGAL::Bbox_3 bbox = ::bbox(tm_ptr); - - GT::Point_3 center((bbox.xmax()+bbox.xmin())/2, - (bbox.ymax()+bbox.ymin())/2, - (bbox.zmax()+bbox.zmin())/2); - double sqrad = 0.6 * std::sqrt( CGAL::square(bbox.xmax()-bbox.xmin())+ - CGAL::square(bbox.ymax()-bbox.ymin())+ - CGAL::square(bbox.zmax()-bbox.zmin()) ) - + offset_value; - sqrad=CGAL::square(sqrad); - - CGAL::Timer timer; - timer.start(); - - namespace p = CGAL::parameters; - - Mesh_domain domain = - Mesh_domain::create_implicit_mesh_domain - (p::function = offset_function(tm_ptr, offset_value), - p::bounding_object = Sphere_3(center, sqrad), - p::relative_error_bound = 1e-7, - p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); }); - - const CGAL::Mesh_facet_topology topology = CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH; - auto manifold_option = p::non_manifold(); - if(tag == 1) manifold_option = p::manifold_with_boundary(); - if(tag == 2) manifold_option = p::manifold(); - Mesh_criteria criteria(p::facet_angle = angle, - p::facet_size = sizing, - p::facet_distance = approx, - p::facet_topology = topology, - p::edge_size = edge_size); - - if (polylines_item!=nullptr) - { - typedef std::vector Surface_patch_ids; - std::vector surface_patch_ids; - - domain.add_features_and_incidences(polylines_item->polylines.begin(), - polylines_item->polylines.end(), - CGAL::Identity_property_map(), - CGAL::Constant_property_map( - surface_patch_ids)); - } - - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - p::no_perturb(), - p::no_exude(), - manifold_option); - - const Tr& tr = c3t3.triangulation(); - - timer.stop(); - std::cerr << "done (" << timer.time() << " ms, " << tr.number_of_vertices() << " vertices)" << std::endl; - - if(tr.number_of_vertices() > 0) - { - typedef typename Result_type::type Result_mesh; - // add remesh as new polyhedron - Result_mesh *pRemesh = new Result_mesh; - //if the thread is interrupted before the mesh is returned, delete it. - MeshGuard guard(pRemesh); - CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, *pRemesh); - guard.setDone(); - if(CGAL::is_closed(*pRemesh) - && ! CGAL::Polygon_mesh_processing::is_outward_oriented(*pRemesh)) - { - CGAL::Polygon_mesh_processing::reverse_face_orientations(*pRemesh); - } - - return pRemesh; - } - else - return nullptr; -} - -struct Mesher_thread:public QThread{ - Q_OBJECT - -private: - SMesh* sMesh; - Scene_polygon_soup_item* soup_item; - Scene_polylines_item* polylines_item; - const double offset_value; - const double angle; - const double sizing; - const double approx; - const double edge_size; - int tag_index; -public: - Mesher_thread( SMesh* tm_ptr, - Scene_polygon_soup_item* soup_item, - Scene_polylines_item* polylines_item, - const double offset_value, - const double angle, - const double sizing, - const double approx, - const double edge_size, - int tag) - :sMesh(tm_ptr), soup_item(soup_item), polylines_item(polylines_item), - offset_value(offset_value), angle(angle), - sizing(sizing), approx(approx), edge_size(edge_size), tag_index(tag){ - } - void run() override { - SMesh* new_mesh= nullptr; - if(soup_item) - new_mesh = cgal_off_meshing(CGAL::Three::Three::mainWindow(), - soup_item, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - else - new_mesh = cgal_off_meshing(CGAL::Three::Three::mainWindow(), - sMesh, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::getWaitCondition()->wakeAll(); - CGAL::Three::Three::getMutex()->unlock(); - Q_EMIT resultReady(new_mesh); - } -Q_SIGNALS: - void resultReady(SMesh *new_mesh); -}; - -using namespace CGAL::Three; -class CGAL_Lab_offset_meshing_plugin : - public QObject, - protected CGAL_Lab_plugin_interface -{ - Q_OBJECT - Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") - -public: - void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { - this->scene = scene_interface; - this->mw = mainWindow; - actionOffsetMeshing = new QAction(tr("Offset Meshing"), mw); - actionOffsetMeshing->setProperty("subMenuName", "3D Surface Mesh Generation"); - if(actionOffsetMeshing) { - connect(actionOffsetMeshing, SIGNAL(triggered()), - this, SLOT(offset_meshing())); - } - - actionInflateMesh= new QAction(tr("Inflate Mesh"), mw); - actionInflateMesh->setProperty("subMenuName", "Operations on Polyhedra"); - if(actionInflateMesh) { - connect(actionInflateMesh, SIGNAL(triggered()), - this, SLOT(inflate_mesh())); - } - } - - bool applicable(QAction*) const { - if ( scene->selectionIndices().size() != 1 && - scene->selectionIndices().size() != 2 ) - { - return false; - } - - for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) - { - if ( qobject_cast(scene->item(index)) || - qobject_cast(scene->item(index)) ) - return true; - } - return false; - } - - QList actions() const { - return QList() << actionOffsetMeshing - << actionInflateMesh; - } -public Q_SLOTS: - void offset_meshing(); - void inflate_mesh(); - -private: - QAction* actionOffsetMeshing; - QAction* actionInflateMesh; - Scene_interface *scene; - QMainWindow *mw; -}; // end class CGAL_Lab_offset_meshing_plugin - -void CGAL_Lab_offset_meshing_plugin::inflate_mesh() -{ - const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_item* item = scene->item(index); - if(item == nullptr){ - return; - } - - Scene_surface_mesh_item* sm_item = - qobject_cast(item); - - if(sm_item == nullptr){ - return; - } - - SMesh* sMesh = sm_item->face_graph(); - - if(sMesh == nullptr){ - return; - } - - double diag = sm_item->diagonalBbox(); - double offset_value = QInputDialog::getDouble(mw, - QString("Choose Inflate Distance"), - QString("Inflate Distance (use negative number for deflate)"), - 0.1*diag, - -(std::numeric_limits::max)(), - (std::numeric_limits::max)(), 10); - - auto vpm = get(CGAL::vertex_point,*sMesh); - auto vnm = - sMesh->property_map("v:normal").value(); - - for(const auto& v : vertices(*sMesh)) - { - Point_3 p = get(vpm, v); - EPICK::Vector_3 n = get(vnm, v); - n/=(CGAL::sqrt(n.squared_length())); - put(vpm, v, p + offset_value*n); - } - sm_item->invalidateOpenGLBuffers(); -} - -void CGAL_Lab_offset_meshing_plugin::offset_meshing() -{ - Scene_surface_mesh_item* sm_item = nullptr; - Scene_polygon_soup_item* soup_item = nullptr; - Scene_polylines_item* polylines_item = nullptr; - Scene_item* item = nullptr; - - bool mesh_or_soup_item_found = false; - - for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) - { - if (!mesh_or_soup_item_found) - { - sm_item = qobject_cast(scene->item(index)); - if (sm_item == nullptr) - { - soup_item = qobject_cast(item); - if (soup_item != nullptr) - { - item=scene->item(index); - mesh_or_soup_item_found = true; - continue; - } - } - else - { - item=scene->item(index); - mesh_or_soup_item_found = true; - continue; - } - } - polylines_item = qobject_cast(scene->item(index)); - } - - SMesh* sMesh = nullptr; - double diag = 0; - Scene_item::Bbox box; - if(sm_item) - { - sMesh = sm_item->face_graph(); - if(!sMesh) - return; - box = bbox(sMesh); - } - else if(soup_item != nullptr) - { - box = bbox(soup_item); - } - else if(soup_item == nullptr) - return; - double X=(box.max)(0)-(box.min)(0), - Y = (box.max)(1)-(box.min)(1), - Z = (box.max)(2)-(box.min)(2); - diag = CGAL::sqrt(X*X+Y*Y+Z*Z); - double offset_value = QInputDialog::getDouble(mw, - QString("Choose Offset Value"), - QString("Offset Value (use negative number for inset)"), - 0.1*diag, - -(std::numeric_limits::max)(), - (std::numeric_limits::max)(), 10); - - QDialog dialog(mw); - Ui::Remeshing_dialog ui; - ui.setupUi(&dialog); - ui.angle->setRange(1.0, 30.0); - connect(ui.buttonBox, SIGNAL(accepted()), - &dialog, SLOT(accept())); - connect(ui.buttonBox, SIGNAL(rejected()), - &dialog, SLOT(reject())); - - ui.sizing->setRange(diag * 10e-6, // min - diag); // max - ui.sizing->setValue(diag * 0.05); // default value - - ui.approx->setRange(diag * 10e-7, // min - diag); // max - ui.approx->setValue(diag * 0.005); - - if (polylines_item!=nullptr) - { - ui.edge_sizing->setRange(diag * 10e-6, // min - diag); // max - ui.edge_sizing->setValue(diag * 0.05); // default value - } - else - ui.edge_sizing->setEnabled(false); - - int i = dialog.exec(); - if(i == QDialog::Rejected) - return; - - const double angle = ui.angle->value(); - const double approx = ui.approx->value(); - const double sizing = ui.sizing->value(); - const double edge_size=polylines_item!=nullptr?ui.edge_sizing->value():0; - const int tag_index = ui.tags->currentIndex(); - - if(tag_index < 0) return; - - QApplication::setOverrideCursor(Qt::WaitCursor); - - std::cerr << "mesh with:" - << "\n angle=" << angle - << "\n sizing=" << sizing - << "\n approx=" << approx - << "\n tag=" << tag_index - << std::boolalpha - << std::endl; - Mesher_thread* worker = nullptr; - if(soup_item) - worker = new Mesher_thread(nullptr, - soup_item, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - else - worker = new Mesher_thread(sMesh, - nullptr, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - connect(worker, &QThread::finished, worker, &QObject::deleteLater); - connect(worker, &Mesher_thread::resultReady, this, - [item, angle, sizing, approx, offset_value/* , index */] - (SMesh *new_mesh){ - QApplication::restoreOverrideCursor(); - if(!new_mesh){ - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = false; - CGAL::Three::Three::getMutex()->unlock(); - return; - } - Scene_surface_mesh_item* new_item = new Scene_surface_mesh_item(new_mesh); - new_item->setName(tr("%1 offset %5 (%2 %3 %4)") - .arg(item->name()) - .arg(angle) - .arg(sizing) - .arg(approx) - .arg(offset_value)); - new_item->setColor(Qt::magenta); - new_item->setWireframeMode(); - CGAL::Three::Three::scene()->addItem(new_item); -// CGAL::Three::Three::scene()->itemChanged(index); - QApplication::restoreOverrideCursor(); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = false; - CGAL::Three::Three::getMutex()->unlock(); - }); - QMessageBox* message_box = new QMessageBox(QMessageBox::NoIcon, - "Meshing", - "Offset meshing in progress...", - QMessageBox::Cancel, - mw); - message_box->setDefaultButton(QMessageBox::Cancel); - QAbstractButton* cancelButton = message_box->button(QMessageBox::Cancel); - cancelButton->setText(tr("Stop")); - - connect(cancelButton, &QAbstractButton::clicked, - this, [worker](){ - worker->terminate(); - QApplication::restoreOverrideCursor();//waitcursor - QApplication::restoreOverrideCursor();//busycursor - }); - connect(worker, &Mesher_thread::finished, - message_box, &QMessageBox::close); - message_box->open(); - - QApplication::setOverrideCursor(Qt::BusyCursor); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = true; - CGAL::Three::Three::getMutex()->unlock(); - worker->start(); -} - -#include "Offset_meshing_plugin.moc" - -#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp index 90477043da7..5ed52540c41 100644 --- a/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp @@ -562,7 +562,7 @@ bool Scene_polyhedron_shortest_path_item::deferred_load( std::vector listOfFaces; listOfFaces.reserve(CGAL::num_faces(*polyhedron())); face_iterator current, end; - for (boost::tie(current, end) = CGAL::faces(*polyhedron()); current != end; ++current) + for (std::tie(current, end) = CGAL::faces(*polyhedron()); current != end; ++current) { listOfFaces.push_back(*current); } diff --git a/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 786727bc145..9be866438e9 100644 --- a/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -1572,7 +1572,7 @@ void Scene_edit_polyhedron_item_priv::read_roi(const char* file_name, Mesh* mesh std::vector all_vertices; all_vertices.reserve(num_vertices(fs.get_deform_mesh(mesh)->halfedge_graph())); mesh_vi vb, ve; - for(boost::tie(vb, ve) = vertices(fs.get_deform_mesh(mesh)->halfedge_graph()); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fs.get_deform_mesh(mesh)->halfedge_graph()); vb != ve; ++vb) { all_vertices.push_back(*vb); } // read roi @@ -1731,7 +1731,7 @@ void Scene_edit_polyhedron_item::update_normals() { void Scene_edit_polyhedron_item::set_all_vertices_as_roi() { boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(*surface_mesh()); vb != ve; ++vb) + for(std::tie(vb, ve) = vertices(*surface_mesh()); vb != ve; ++vb) { insert_roi_vertex(*vb, surface_mesh()); } diff --git a/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt b/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt index 71dab011d58..ffa00e9b08d 100644 --- a/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Three_examples) if(NOT POLICY CMP0070 AND POLICY CMP0053) diff --git a/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp b/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp index 7df511b6169..a00454c375b 100644 --- a/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp +++ b/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp @@ -779,19 +779,26 @@ void Scene_polyhedron_selection_item::set_operation_mode(int mode) //set the selection type to vertex set_active_handle_type(static_cast(0)); break; - //Add vertex and face to border + //Remove degree 2 vertex case 9: - Q_EMIT updateInstructions("Select a border edge. (1/2)"); - //set the selection type to Edge - set_active_handle_type(static_cast(2)); + Q_EMIT updateInstructions("Select the vertex you want to remove." + "Warning: This will clear the undo stack."); + //set the selection type to vertex + set_active_handle_type(static_cast(0)); break; - //Add face to border + //Add vertex and face to border case 10: Q_EMIT updateInstructions("Select a border edge. (1/2)"); //set the selection type to Edge set_active_handle_type(static_cast(2)); break; + //Add face to border case 11: + Q_EMIT updateInstructions("Select a border edge. (1/2)"); + //set the selection type to Edge + set_active_handle_type(static_cast(2)); + break; + case 12: Q_EMIT updateInstructions("Select a vertex. (1/2)"); //set the selection type to Edge set_active_handle_type(static_cast(0)); @@ -1011,7 +1018,24 @@ bool Scene_polyhedron_selection_item::treat_selection(const std::setinvalidateOpenGLBuffers(); + } + else + { + d->tempInstructions("Vertex not selected: The vertex must have degree 2 (and not be incident to a triangle)", + "Select the vertex you want to remove." + "Warning: This will clear the undo stack."); + } + break; + } + //Move point + case 12: CGAL::QGLViewer* viewer = Three::mainViewer(); const CGAL::qglviewer::Vec offset = viewer->offset(); if(viewer->manipulatedFrame() != d->manipulated_frame) @@ -1032,7 +1056,7 @@ bool Scene_polyhedron_selection_item::treat_selection(const std::set= degree -/* -std::size_t facet_degree(fg_halfedge_descriptor h, const Face_graph& polyhedron) -{ - return degree(h,polyhedron); -} -*/ bool Scene_polyhedron_selection_item:: treat_selection(const std::set& selection) { VPmap vpm = get(CGAL::vertex_point, *polyhedron()); @@ -1203,7 +1220,7 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::setfirst_selected) @@ -1255,7 +1272,7 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::setfirst_selected) @@ -1963,6 +1980,23 @@ void Scene_polyhedron_selection_item::moveVertex() } } +void Scene_polyhedron_selection_item::moveVertex(const Point_3& new_position) +{ + const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); + fg_vertex_descriptor vh = *temp_selected_vertices.begin(); + + VPmap vpm = get(CGAL::vertex_point,*polyhedron()); + put(vpm, vh, Point_3(new_position.x() - offset.x, + new_position.y() - offset.y, + new_position.z() - offset.z)); + const Point_3& p = get(vpm,vh); + d->manipulated_frame->setPosition(p.x()+offset.x, p.y()+offset.y, p.z()+offset.z); + setProperty("need_invalidate_aabb_tree", true); + invalidateOpenGLBuffers(); + poly_item->updateVertex(vh); + // poly_item->invalidateOpenGLBuffers(); +} + void Scene_polyhedron_selection_item::validateMoveVertex() { temp_selected_vertices.clear(); diff --git a/Lab/demo/Lab/Scene_polyhedron_selection_item.h b/Lab/demo/Lab/Scene_polyhedron_selection_item.h index 7a2cc2f16bd..23af5a1cfee 100644 --- a/Lab/demo/Lab/Scene_polyhedron_selection_item.h +++ b/Lab/demo/Lab/Scene_polyhedron_selection_item.h @@ -415,7 +415,7 @@ public: fg_vertex_descriptor t = all_vertices[id2]; fg_halfedge_descriptor hd; bool exists; - boost::tie(hd,exists) = halfedge(s,t,*polyhedron()); + std::tie(hd,exists) = halfedge(s,t,*polyhedron()); if(! exists) { return false; } selected_edges.insert(edge(hd,*polyhedron())); } @@ -917,6 +917,7 @@ public Q_SLOTS: void updateTick(); void moveVertex(); + void moveVertex(const Point_3&); protected: bool eventFilter(QObject* /*target*/, QEvent * gen_event) { diff --git a/Lab/demo/Lab/Scene_surface_mesh_item.cpp b/Lab/demo/Lab/Scene_surface_mesh_item.cpp index 30e0d59ab83..cf8ed877f77 100644 --- a/Lab/demo/Lab/Scene_surface_mesh_item.cpp +++ b/Lab/demo/Lab/Scene_surface_mesh_item.cpp @@ -545,7 +545,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } if(name.testFlag(Scene_item_rendering_helper::NORMALS)) { - EPICK::Vector_3 n = fnormals[fd]; + const EPICK::Vector_3& n = fnormals[fd]; CPF::add_normal_in_buffer(n, flat_normals); } if(name.testFlag(Scene_item_rendering_helper::COLORS)) @@ -553,7 +553,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: if(has_fpatch_id) { //The sharp features detection produces patch ids >=1, this - //is meant to insure the wanted id is in the range [min,max] + //is meant to ensure the wanted id is in the range [min,max] QColor c = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; CGAL::IO::Color color(c.red(),c.green(),c.blue()); CPF::add_color_in_buffer(color, f_colors); diff --git a/Lab/demo/Lab/Viewer.cpp b/Lab/demo/Lab/Viewer.cpp index b93cb2cb7b1..00e98fa2b88 100644 --- a/Lab/demo/Lab/Viewer.cpp +++ b/Lab/demo/Lab/Viewer.cpp @@ -1838,7 +1838,7 @@ void Viewer::setLighting() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 floats."); + msgBox->setText("ERROR : Input should consist of 3 floats."); msgBox->exec(); return; } diff --git a/Lab/demo/Lab/implicit_functions/CMakeLists.txt b/Lab/demo/Lab/implicit_functions/CMakeLists.txt index 5b42135b28f..8a3b34484c5 100644 --- a/Lab/demo/Lab/implicit_functions/CMakeLists.txt +++ b/Lab/demo/Lab/implicit_functions/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the CGAL Mesh_3 demo implicit functions. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) include(CGALlab_macros) diff --git a/Lab/demo/Lab/include/Point_set_3.h b/Lab/demo/Lab/include/Point_set_3.h index fcfb3805c9e..a0444c9b744 100644 --- a/Lab/demo/Lab/include/Point_set_3.h +++ b/Lab/demo/Lab/include/Point_set_3.h @@ -135,7 +135,7 @@ public: bool add_radius() { bool out = false; - boost::tie (m_radius, out) = this->template add_property_map ("radius", 0.); + std::tie (m_radius, out) = this->template add_property_map ("radius", 0.); return out; } double& radius (const Index& index) { return m_radius[index]; } @@ -409,21 +409,15 @@ public: { if (other.template has_property_map("red")) { - boost::tie (m_red, boost::tuples::ignore) - = this->template add_property_map("red", 0); - boost::tie (m_green, boost::tuples::ignore) - = this->template add_property_map("green", 0); - boost::tie (m_blue, boost::tuples::ignore) - = this->template add_property_map("blue", 0); + m_red = this->template add_property_map("red", 0).first; + m_green = this->template add_property_map("green", 0).first; + m_blue = this->template add_property_map("blue", 0).first; } else { - boost::tie (m_red, boost::tuples::ignore) - = this->template add_property_map("r", 0); - boost::tie (m_green, boost::tuples::ignore) - = this->template add_property_map("g", 0); - boost::tie (m_blue, boost::tuples::ignore) - = this->template add_property_map("b", 0); + m_red = this->template add_property_map("r", 0).first; + m_green = this->template add_property_map("g", 0).first; + m_blue = this->template add_property_map("b", 0).first; } } diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt b/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt index 23999e2d847..78c8cb770db 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(LCC_performance_2) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) @@ -16,7 +16,7 @@ include_directories(BEFORE "/usr/include/libxml2/") #add_compile_definitions("-pg") #SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") # add_compile_definitions("-g") - +return() # OpenMesh find_package(OpenMesh REQUIRED) include(CGAL_OpenMesh_support) @@ -35,7 +35,7 @@ target_link_libraries(lcc_performance_2 CGAL::CGAL) add_executable( surface_mesh_performance performance_2.h surface_mesh_performance.h surface_mesh_performance.cpp) -target_link_libraries(surface_mesh_performance surface_mesh) +target_link_libraries(surface_mesh_performance lcc_surface_mesh_lib) # Open_mesh add_executable(openmesh_performance performance_2.h openmesh_performance.h @@ -79,7 +79,7 @@ add_executable( target_link_libraries( performance_2 CGAL::CGAL - surface_mesh + lcc_surface_mesh_lib algo assimp container diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt index 9c7a8ad46a4..b80ccb6d124 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB_RECURSE SRCS ./*.cpp) file(GLOB_RECURSE HDRS ./*.h) if(UNIX) - add_library(surface_mesh SHARED ${SRCS} ${HDRS}) + add_library(lcc_surface_mesh_lib SHARED ${SRCS} ${HDRS}) elseif(WIN32) - add_library(surface_mesh STATIC ${SRCS} ${HDRS}) + add_library(lcc_surface_mesh_lib STATIC ${SRCS} ${HDRS}) endif() diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt b/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt index 5166eee35ab..1a65d867deb 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(LCC_performance_3) +return() + if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. cmake_policy(SET CMP0053 OLD) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt index 16b346a7564..b71bfe57fe0 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. # cmake ../ -DCMAKE_BUILD_TYPE=Debug -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Linear_cell_complex_Demo) # Find includes in corresponding build directories diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 22760ad87b6..e9604793e4b 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Linear_cell_complex_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt index 3f12de77cee..d19fc827d59 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Linear_cell_complex_Tests) find_package(CGAL REQUIRED) diff --git a/Matrix_search/doc/Matrix_search/PackageDescription.txt b/Matrix_search/doc/Matrix_search/PackageDescription.txt index 202989f2da3..1dabc40e68c 100644 --- a/Matrix_search/doc/Matrix_search/PackageDescription.txt +++ b/Matrix_search/doc/Matrix_search/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgMatrixSearchRef -\todo check generated documentation \cgalPkgDescriptionBegin{Monotone and Sorted Matrix Search,PkgMatrixSearch} \cgalPkgPicture{matrix.png} \cgalPkgSummaryBegin diff --git a/Matrix_search/examples/Matrix_search/CMakeLists.txt b/Matrix_search/examples/Matrix_search/CMakeLists.txt index 489663a3b18..9fb3b898c53 100644 --- a/Matrix_search/examples/Matrix_search/CMakeLists.txt +++ b/Matrix_search/examples/Matrix_search/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Matrix_search_Examples) find_package(CGAL REQUIRED) diff --git a/Matrix_search/test/Matrix_search/CMakeLists.txt b/Matrix_search/test/Matrix_search/CMakeLists.txt index d4f61200d6f..9e9f6d6d7a2 100644 --- a/Matrix_search/test/Matrix_search/CMakeLists.txt +++ b/Matrix_search/test/Matrix_search/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Matrix_search_Tests) find_package(CGAL REQUIRED) diff --git a/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp b/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp index 22b2e16b82d..e5088183176 100644 --- a/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp +++ b/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp @@ -148,7 +148,7 @@ main( int argc, char* argv[]) */ // evt. update max_entry: - max_entry = max( a[dim - 1] + b[dim - 1], max_entry); + max_entry = (max)( a[dim - 1] + b[dim - 1], max_entry); // keep both vectors: vectors.push_back( a); diff --git a/Mesh_2/demo/Mesh_2/CMakeLists.txt b/Mesh_2/demo/Mesh_2/CMakeLists.txt index 4c827ece080..c66e7cf908d 100644 --- a/Mesh_2/demo/Mesh_2/CMakeLists.txt +++ b/Mesh_2/demo/Mesh_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script (and then adapted manually). # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_2_Demo) find_package(CGAL REQUIRED) diff --git a/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h b/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h index 35b4dda2756..5513693788b 100644 --- a/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h +++ b/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h @@ -6,6 +6,8 @@ namespace IO { //! //! The faces output are those for which `DelaunayMeshFaceBase_2::is_in_domain()` returns `true`, //! the edges are those for which `ConstrainedTriangulationFaceBase_2::is_constrained()` returns `true`. +//!\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of `os`. +//! //! \tparam CDT a `Constrained_Delaunay_triangulation_2` with face type model of `DelaunayMeshFaceBase_2`. //! //! \param os the stream used for writing. @@ -23,9 +25,12 @@ void write_VTU(std::ostream& os, //! \brief writes the faces of a domain and its constrained edges embedded in //! a 2D constrained Delaunay triangulation using the `PolyData` XML //! format. - //! The faces output are those for which `get(ipm, f)` returns - //! `true` where `f` is a `CDT::Face_handle`, +//! The faces output are those for which `get(ipm, f)` returns +//! `true` where `f` is a `CDT::Face_handle`, //! the edges are those for which `ConstrainedTriangulationFaceBase_2::is_constrained()` returns `true`. +//! +//!\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of `os`. +//! //! \tparam CDT a `Constrained_Delaunay_triangulation_2` with face //! type model of `DelaunayMeshFaceBase_2`. //! \tparam InDomainPmap a class model of `ReadWritePropertyMap` with diff --git a/Mesh_2/examples/Mesh_2/CMakeLists.txt b/Mesh_2/examples/Mesh_2/CMakeLists.txt index 474a477a39a..c94cec90f83 100644 --- a/Mesh_2/examples/Mesh_2/CMakeLists.txt +++ b/Mesh_2/examples/Mesh_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h b/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h index a3e54124402..5601684ed22 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h @@ -78,7 +78,7 @@ public: void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; } // namespace CGAL diff --git a/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h b/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h index 3093f3b49a9..0c62a20fb5c 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h @@ -67,7 +67,7 @@ public: void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); #endif // CGAL_MESH_2_DEBUG_REFINEMENT_POINTS }; diff --git a/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h b/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h index 1729fc795f6..fe316a611e6 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h @@ -63,7 +63,8 @@ private: Faces_level faces_level; Seeds seeds; - bool seeds_mark; + bool seeds_mark = false; + bool initialized = false; public: /** \name CONSTRUCTORS */ Delaunay_mesher_no_edge_refinement_2(Tr& tr_, const Criteria& criteria_ = Criteria()) @@ -72,20 +73,18 @@ public: null_level(), null_visitor(), edges_level(tr, null_level), - faces_level(tr, criteria, edges_level), - initialized(false) + faces_level(tr, criteria, edges_level) { } Delaunay_mesher_no_edge_refinement_2(Tr& tr_, Edges_level& edges_level_, - const Criteria& criteria_ = Criteria()) + const Criteria& criteria_ = Criteria()) : tr(tr_), criteria(criteria_), null_level(), null_visitor(), edges_level(edges_level_), - faces_level(tr, criteria, edges_level), - initialized(false) + faces_level(tr, criteria, edges_level) { } @@ -101,12 +100,6 @@ public: return seeds.end(); } -private: - /** \name INITIALIZED */ - - bool initialized; - -public: /** \name MARKING FUNCTIONS */ /** The value type of \a InputIterator should be `Point`, and represents diff --git a/Mesh_2/include/CGAL/Mesh_2/Clusters.h b/Mesh_2/include/CGAL/Mesh_2/Clusters.h index f52dcb16d20..13533041f46 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Clusters.h +++ b/Mesh_2/include/CGAL/Mesh_2/Clusters.h @@ -160,15 +160,14 @@ public: void create_clusters(Tag_true) { cluster_map.clear(); Unique_hash_map created(false); - for(typename Tr::Subconstraint_iterator it = tr.subconstraints_begin(); - it != tr.subconstraints_end(); ++it) { - Vertex_handle vh = it->first.first; + for(const auto& sc : tr.subconstraints()) { + Vertex_handle vh = sc.first; if(!created[vh]){ created[vh] = true; create_clusters_of_vertex(vh); } - vh = it->first.second; + vh = sc.second; if(!created[vh]){ created[vh] = true; create_clusters_of_vertex(vh); diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h index 852ec07faf0..2208f28fc45 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h @@ -344,14 +344,8 @@ protected: void scan_triangulation_impl(Tag_true) { - // with constraint hierarchy - - for(typename Tr::Subconstraint_iterator it = tr.subconstraints_begin(); - it != tr.subconstraints_end(); ++it) + for(const auto& [v1, v2] : tr.subconstraints()) { - const Vertex_handle& v1 = it->first.first; - const Vertex_handle& v2 = it->first.second; - if(!is_locally_conform(tr, v1, v2) ){ add_constrained_edge_to_be_conformed(v1, v2); } diff --git a/Mesh_2/test/Mesh_2/CMakeLists.txt b/Mesh_2/test/Mesh_2/CMakeLists.txt index 9ce291f819a..7b2093bebf5 100644 --- a/Mesh_2/test/Mesh_2/CMakeLists.txt +++ b/Mesh_2/test/Mesh_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) @@ -14,3 +14,7 @@ file( foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") endforeach() + +if(cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES) + target_compile_features(test_mesh_terrain PRIVATE cxx_std_20) +endif() diff --git a/Mesh_2/test/Mesh_2/conform_plus.cpp b/Mesh_2/test/Mesh_2/conform_plus.cpp index 83978e3d9ef..6e4128dd68e 100644 --- a/Mesh_2/test/Mesh_2/conform_plus.cpp +++ b/Mesh_2/test/Mesh_2/conform_plus.cpp @@ -18,15 +18,7 @@ int main() std::pair p; - for(CDT::Subconstraint_iterator sit = cdt.subconstraints_begin(); - sit != cdt.subconstraints_end(); - ++sit){ - - p = (*sit).first; - - Vertex_handle vh1 = p.first; - Vertex_handle vh2 = p.second; - + for(const auto& [vh1, vh2] : cdt.subconstraints()) { std::cerr << "subconstraint: " << vh1->point() << " -- " << vh2->point() << std::endl; } @@ -36,15 +28,8 @@ int main() int counter = 0; - for(CDT::Subconstraint_iterator sit = cdt.subconstraints_begin(); - sit != cdt.subconstraints_end(); - ++sit){ + for(const auto& [vh1, vh2] : cdt.subconstraints()) { ++counter; - p = (*sit).first; - - Vertex_handle vh1 = p.first; - Vertex_handle vh2 = p.second; - std::cerr << "subconstraint: " << vh1->point() << " -- " << vh2->point() << std::endl; } diff --git a/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp b/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp index 4ac052fab12..2fe8c8058de 100644 --- a/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp +++ b/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp @@ -1,3 +1,13 @@ +// Test also CGAL::Random_allocator +#if __has_include() +# include +# if __cpp_lib_format >= 201907L +# define CGAL_DEBUG_RANDOM_ALLOCATOR 1 +# endif +#endif +#include +#define CGAL_ALLOCATOR(T) CGAL::Random_allocator + #include #include #include @@ -21,6 +31,9 @@ typedef K::Point_3 Point; int main() { +#if CGAL_DEBUG_RANDOM_ALLOCATOR + std::clog << "CGAL::Random_allocator debug mode is enabled..." << std::endl; +#endif Delaunay dt; typedef Delaunay::Vertex_handle Vertex_handle; Vertex_handle va = dt.insert(Point(-4,0, 0)); diff --git a/Mesh_2/test/Mesh_2/test_meshing.cpp b/Mesh_2/test/Mesh_2/test_meshing.cpp index 48d6ccffaf0..db91f5a0c08 100644 --- a/Mesh_2/test/Mesh_2/test_meshing.cpp +++ b/Mesh_2/test/Mesh_2/test_meshing.cpp @@ -1,5 +1,4 @@ // 154 515 565 -#include #include "test_dependencies.h" #include #if CGAL_USE_CORE || CGAL_USE_LEDA diff --git a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt index 7e195ce1ff1..3d405fe7a39 100644 --- a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt +++ b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_3_benchmark) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h index acfb0b6efd8..018449f3585 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h @@ -451,6 +451,90 @@ unspecified_type odt(const Named_function_parameters& np = parameters::default_v template unspecified_type perturb(const Named_function_parameters& np = parameters::default_values()); +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::initial_points_generator()` enables the user to specify a functor that follows + * the `InitialPointsGenerator_3` concept to the mesh generation function `make_mesh_3()`. This functor is called + * for the initialization of the meshing process, by inserting well-distributed surface vertices. + * If this parameter is not specified, the default behavior + * is executed, which calls the domain's `construct_initial_points_object()` for the initialization of the meshing process. + * + * Initialization is considered to be complete if the triangulation is a 3D triangulation + * with at least one facet in the restricted Delaunay triangulation (i.e., its dual intersects the + * input surface). + * + * If one dimensional features are requested, their initialization is performed first. + * If provided, the points of `parameters::initial_points()` are inserted next. + * Then, `parameters::initial_points_generator()` is used to generate more initial points + * and complete the initialization. + * If the generator does not generate enough points for the initialization to be complete, + * the domain's `construct_initial_points_object()` will be called to generate enough input points. + * + * \tparam InitialPointsGenerator a model of the `InitialPointsGenerator_3` concept + * + * @param generator an instance of `InitialPointsGenerator` + * + * \cgalHeading{Example} + * + * \snippet mesh_3D_image_with_image_initialization.cpp Meshing + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::parameters::initial_points()` + * \sa `MeshDomain_3::Construct_initial_points` + * + */ +template +unspecified_type initial_points_generator(const InitialPointsGenerator& generator); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::initial_points()` enables the user to specify a container, model of `Range`, that contains + * initial points constructed on surfaces, + * to be used in the `make_mesh_3()` function for mesh generation. Items in the container are + * tuple-like objects containing a `Weighted_point_3`, an `int`, and a `MeshDomain::Index`, + * where `Weighted_point_3` represents the position and the weight of the point, + * `int` the dimension of the minimal subcomplex on which the point lies, + * and `MeshDomain::Index` the corresponding subcomplex index. + * These initial points are inserted after one dimensional features initialization. + * + * Initialization is considered to be complete if the triangulation is a 3D triangulation + * with at least one facet in the restricted Delaunay triangulation (i.e., its dual intersects the + * input surface). + * + * If the parameter `parameters::initial_points_generator()` is set, + * the points from this parameter will be inserted before calling the initial points generator. + * + * If after the insertion of initial points (possibly together with the input generator), + * the initialization is not complete, + * the domain's `construct_initial_points_object()` will be called. + * + * \tparam MeshDomain a model of `MeshDomain_3` + * \tparam C3t3 a model of `MeshComplex_3InTriangulation_3` + * \tparam InitialPointsRange a model of `Range` containing tuple-like objects of + * `C3t3::Triangulation::Geom_traits::Weighted_point_3, int, MeshDomain::Index`. + * + * @param initial_points an instance of `InitialPointsRange` + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Create the initial_points vector + * std::vector> initial_points; + * // Perform mesh generation from a labeled image with initial points + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::initial_points(std::cref(initial_points))); // Use std::cref to avoid a copy + * \endcode + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::parameters::initial_points_generator()` + * \sa `MeshDomain_3::Construct_initial_points` + * + */ +template +unspecified_type initial_points(const InitialPointsRange& initial_points); } /* namespace parameters */ } /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/InitialPointsGenerator_3.h b/Mesh_3/doc/Mesh_3/Concepts/InitialPointsGenerator_3.h new file mode 100644 index 00000000000..351ac34126f --- /dev/null +++ b/Mesh_3/doc/Mesh_3/Concepts/InitialPointsGenerator_3.h @@ -0,0 +1,64 @@ +/*! +\ingroup PkgMesh3SecondaryConcepts +\cgalConcept + +The function object concept `InitialPointsGenerator_3` is designed to construct +a set of initial points on the surface of the domain. + +\cgalHasModelsBegin +\cgalHasModels{CGAL::Construct_initial_points_labeled_image} +\cgalHasModels{CGAL::Construct_initial_points_gray_image} +\cgalHasModelsEnd + +*/ + +class InitialPointsGenerator_3 { +public: + +/// \name Types (exposition only) +/// @{ +/// These types are used in the concept's description but are not part of the concept itself. + +/*! +* Mesh domain type to be meshed, model of `MeshDomain_3` +*/ +typedef unspecified_type MeshDomain; + +/*! + * Type of the output mesh complex, model of `MeshComplex_3InTriangulation_3` + */ +typedef unspecified_type C3t3; +/// @} + +/// \name Operations +/// @{ +/// Initial points generators are designed to output, via their operators `operator(OutputIterator)`, +/// a set of surface points for mesh initialization to an output iterator. + +/*! +outputs a set of surface points for mesh initialization. + +If, after insertion of these points, the triangulation is still not 3D, +or does not have any facets +in the restricted Delaunay triangulation, then more points will be added automatically +by the mesh generator. + +@tparam OutputIterator model of `OutputIterator` whose value type is a tuple-like object made of 3 elements: + - a `C3t3::Triangulation::Point` : the point `p`, + - an `int` : the minimal dimension of the subcomplexes on which `p` lies, + - a `MeshDomain_3::Index` : the index of the corresponding subcomplex. + +@param pts an output iterator for the points +@param n a lower bound on the number of points to construct for initialization. + When `n` is set to its default value `0`, the functor must provide enough + points to initialize the mesh generation process, i.e., to have a 3D triangulation + with at least one facet in the restricted Delaunay triangulation. + If these conditions are not satisfied, then more points will be added automatically + by the mesh generator. +*/ +template +OutputIterator operator()(OutputIterator pts, const int n = 0); + +/// @} + +}; /* end InitialPointsGenerator_3 */ diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index 18c58c248e6..5355f1a2635 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -39,7 +39,9 @@ INPUT += \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Compact_mesh_cell_base_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_in_image.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_on_image_bbox.h \ - ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_labeled_image.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_gray_image.h PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation" HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \ diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index 47a0485d01a..7de626783d4 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -737,54 +737,29 @@ without the weights (left, 25563 vertices) and with the weights (right, 19936 ve \subsubsection Mesh_3DomainsFrom3DImagesWithCustomInitialization Domains From 3D Images, with a Custom Initialization -The example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp is a modification +The example \ref Mesh_3/mesh_3D_image_with_image_initialization.cpp is a modification of \ref Mesh_3/mesh_3D_image.cpp. The goal of that example is to show how the default initialization of the triangulation, using random rays, can be replaced by a new implementation. In this case, the initialization detects all connected components in the 3D segmented image, and inserts points in the triangulation for each connected component. -For the meshing, in the previous example (\ref Mesh_3/mesh_3D_image.cpp), we called `make_mesh_3()` as follows. +\snippet Mesh_3/mesh_3D_image_with_image_initialization.cpp Meshing -\snippet Mesh_3/mesh_3D_image.cpp Meshing +The parameter `CGAL::parameters::initial_points_generator` is used. +It expects a functor that returns a set of points for the mesh +initialization (following the concept `InitialPointsGenerator_3`). The functor +`Construct_initial_points_labeled_image` is used in this example. +It constructs points using the API of the mesh domain, as follows. +First, the functor `construct_intersection` is created: -In the example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp, -that call is replaced by: - -# the creation of an empty `%c3t3` object, - -# a call to a non-documented function - `initialize_triangulation_from_labeled_image()` that inserts points in - the triangulation, - -# then the call to `refine_mesh_3()`. - -\snippet Mesh_3/mesh_3D_image_with_custom_initialization.cpp Meshing - -The code of the function `initialize_triangulation_from_labeled_image()` is -in the non-documented header \ref -CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h. As it is -undocumented and may be removed or modified at any time, if you wish to -use it then you should copy-paste it to your user code. The code of that -function is rather complicated. The following lines show how to insert new -points in the `%c3t3` object, with the calls to -`MeshVertexBase_3::set_dimension()` and -`MeshVertexBase_3::set_index()`. - -\snippet CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h insert initial points - -The value of `index` must be consistent with the possible values of -`Mesh_domain::Index`. In \ref -CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h, it is -constructed using the API of the mesh domain, as follows. First the functor -`construct_intersect` is created - -\dontinclude CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h -\skip Construct_intersection construct_intersection = -\until construct_intersection_object +\snippet CGAL/Mesh_3/Construct_initial_points_labeled_image.h construct intersection then the `%Mesh_domain::Intersection` object (a `%tuple` with three elements) is constructed using a call to the functor `construct_intersection` -\skip Intersection intersect = -\until construct_intersection -and eventually `%index` is the element \#1 of `%intersect`. -\skipline get<1>(intersect) +\snippet CGAL/Mesh_3/Construct_initial_points_labeled_image.h use construct intersection +and eventually `%intersect_index` is the element \#1 of `%intersect`. +\snippet CGAL/Mesh_3/Construct_initial_points_labeled_image.h get construct intersection +The dimension of the underlying simplex is stored as the element \#2 of `%intersect``. The result of the custom initialization can be seen in \cgalFigureRef{mesh3custominitimage3D}. The generated 3D image contains a @@ -810,34 +785,25 @@ the center is meshed Right: the mesh generated after the initialization of all connected components \cgalFigureCaptionEnd - Note that the example \ref -Mesh_3/mesh_3D_image_with_custom_initialization.cpp also shows how to +Mesh_3/mesh_3D_image_with_image_initialization.cpp also shows how to create a 3D image using the undocumented API of CGAL_ImageIO. -\snippet Mesh_3/mesh_3D_image_with_custom_initialization.cpp Create the image +\snippet Mesh_3/mesh_3D_image_with_image_initialization.cpp Create_the_image The code of the function `%random_labeled_image()` is in the header file \ref Mesh_3/random_labeled_image.h. -The example \ref Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp is another -custom initialization example, for meshing of 3D gray-level images. Similarly to -the segmented image example above, the code consists in: - -# the creation of an empty `%c3t3` object, - -# a call to a non-documented function - `initialize_triangulation_from_gray_image()` that inserts points in - the triangulation, - -# then the call to `refine_mesh_3()`. +The example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp features +a custom functor that initializes the triangulation. -\snippet Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp Meshing - -The code of the function `initialize_triangulation_from_gray_image()` is -in the non-documented header \ref -CGAL/Mesh_3/initialize_triangulation_from_gray_image.h. As it is -undocumented and may be removed or modified at any time, if you wish to -use it then you should copy-paste it to your user code. +A struct `Custom_Initial_points_generator` that places 1D-feature points +alongside a line is created. +Finally, the example \ref Mesh_3/mesh_3D_image_with_initial_points.cpp features +a point container that initializes the triangulation using the meshing parameter +`parameters::initial_points()`. \subsection Mesh_3UsingVariableSizingField Using Variable Sizing Field diff --git a/Mesh_3/doc/Mesh_3/PackageDescription.txt b/Mesh_3/doc/Mesh_3/PackageDescription.txt index 79706cd0523..926491fc627 100644 --- a/Mesh_3/doc/Mesh_3/PackageDescription.txt +++ b/Mesh_3/doc/Mesh_3/PackageDescription.txt @@ -29,6 +29,9 @@ /// The two main functions to generate a mesh are `make_mesh_3()` and `refine_mesh_3()`. /// The other functions enable to optimize an existing mesh. +/// \defgroup PkgMesh3Initializers Mesh Initialization Functors +/// \ingroup PkgMesh3Ref +/// The functors in this group perform mesh initialization by providing initial points. /// \defgroup PkgMesh3Parameters Parameter Functions /// \ingroup PkgMesh3Ref @@ -77,6 +80,7 @@ related to the template parameters of some models of the main concepts: - `BisectionGeometricTraits_3` - `IntersectionGeometricTraits_3` +- `InitialPointsGenerator_3` - `MeshCellBase_3` - `MeshVertexBase_3` - `MeshDomainField_3` @@ -110,6 +114,11 @@ The following functors are available for feature detection: - `CGAL::Mesh_3::Detect_features_in_image` - `CGAL::Mesh_3::Detect_features_on_image_bbox` +The following functors are available for mesh initialization: + +- `CGAL::Construct_initial_points_labeled_image` +- `CGAL::Construct_initial_points_gray_image` + \cgalCRPSection{Function Templates} - `CGAL::make_mesh_3()` @@ -120,10 +129,12 @@ The following functors are available for feature detection: - `CGAL::odt_optimize_mesh_3()` - `CGAL::Mesh_3::generate_label_weights()` -\cgalCRPSection{CGAL::parameters Functions} +\cgalCRPSection{%CGAL::parameters Functions} - `CGAL::parameters::features()` - `CGAL::parameters::no_features()` +- `CGAL::parameters::initial_points()` +- `CGAL::parameters::initial_points_generator()` - `CGAL::parameters::exude()` - `CGAL::parameters::no_exude()` - `CGAL::parameters::perturb()` diff --git a/Mesh_3/doc/Mesh_3/examples.txt b/Mesh_3/doc/Mesh_3/examples.txt index 4b853a9847b..f045ee58b03 100644 --- a/Mesh_3/doc/Mesh_3/examples.txt +++ b/Mesh_3/doc/Mesh_3/examples.txt @@ -1,16 +1,15 @@ /*! \example Mesh_3/implicit_functions.cpp \example Mesh_3/mesh_3D_image.cpp -\example Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp \example Mesh_3/mesh_3D_image_with_features.cpp \example Mesh_3/mesh_3D_image_with_custom_initialization.cpp +\example Mesh_3/mesh_3D_image_with_initial_points.cpp +\example Mesh_3/mesh_3D_image_with_image_initialization.cpp \example Mesh_3/mesh_3D_image_with_detection_of_features.cpp \example Mesh_3/mesh_3D_image_with_input_features.cpp \example Mesh_3/mesh_3D_weighted_image.cpp \example Mesh_3/mesh_3D_weighted_image_with_detection_of_features.cpp \example Mesh_3/random_labeled_image.h -\example CGAL/Mesh_3/initialize_triangulation_from_gray_image.h -\example CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h \example Mesh_3/mesh_3D_image_variable_size.cpp \example Mesh_3/mesh_hybrid_mesh_domain.cpp \example Mesh_3/mesh_implicit_domains.cpp diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 18924a5dfeb..a1e2e345e97 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_3_Examples) add_compile_definitions(CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX @@ -157,10 +157,15 @@ if(TARGET CGAL::CGAL_ImageIO) PRIVATE CGAL::Eigen3_support) create_single_source_cgal_program( - "mesh_3D_gray_image_with_custom_initialization.cpp") - target_link_libraries(mesh_3D_gray_image_with_custom_initialization + "mesh_3D_image_with_image_initialization.cpp") + target_link_libraries(mesh_3D_image_with_image_initialization PRIVATE CGAL::Eigen3_support) + create_single_source_cgal_program( + "mesh_3D_image_with_initial_points.cpp") + target_link_libraries(mesh_3D_image_with_initial_points + PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") target_link_libraries(mesh_3D_image_variable_size PRIVATE CGAL::Eigen3_support) @@ -199,7 +204,8 @@ if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) mesh_3D_weighted_image_with_detection_of_features mesh_3D_image_variable_size mesh_3D_image_with_custom_initialization - mesh_3D_gray_image_with_custom_initialization + mesh_3D_image_with_initial_points + mesh_3D_image_with_image_initialization mesh_3D_image_with_features mesh_3D_image_with_detection_of_features mesh_3D_image_with_input_features diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp deleted file mode 100644 index afed1a34b52..00000000000 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -typedef float Image_word_type; - -// Domain -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; - -// Parallel tag -#ifdef CGAL_CONCURRENT_MESH_3 -typedef CGAL::Parallel_tag Concurrency_tag; -#else -typedef CGAL::Sequential_tag Concurrency_tag; -#endif - -// Triangulation -typedef CGAL::Mesh_triangulation_3::type Tr; -typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; - -// Criteria -typedef CGAL::Mesh_criteria_3 Mesh_criteria; - -namespace params = CGAL::parameters; - -int main(int argc, char* argv[]) -{ - const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("images/skull_2.9.inr"); - /// [Load image] - CGAL::Image_3 image; - if (!image.read(fname)) { - std::cerr << "Error: Cannot read file " << fname << std::endl; - return EXIT_FAILURE; - } - /// [Domain creation] - Mesh_domain domain = - Mesh_domain::create_gray_image_mesh_domain(image, params::iso_value(2.9f).value_outside(0.f)); - /// [Domain creation] - - /// [Mesh criteria] - Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(2). - cell_radius_edge_ratio(3).cell_size(8)); - - /// [Meshing] - C3t3 c3t3; - initialize_triangulation_from_gray_image(c3t3, - domain, - image, - criteria, - 2.9f,//isolevel - Image_word_type(0)); - CGAL::refine_mesh_3(c3t3, domain, criteria); - /// [Meshing] - - /// Output - CGAL::dump_c3t3(c3t3, "out"); - - return 0; -} diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp index ce8fc8db39c..d3d718138ad 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include #include @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/squircle.nii"); - vtkImageData* vtk_image = nullptr; + vtkSmartPointer vtk_image = nullptr; Image_word_type iso = (argc>2)? boost::lexical_cast(argv[2]): 1; double fs = (argc>3)? boost::lexical_cast(argv[3]): 1; double fd = (argc>4)? boost::lexical_cast(argv[4]): 0.1; @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) if (path.has_extension()){ fs::path stem = path.stem(); if ((path.extension() == ".nii") || (stem.has_extension() && (stem.extension() == ".nii") && (path.extension() == ".gz"))) { - vtkNIFTIImageReader* reader = vtkNIFTIImageReader::New(); + auto reader = vtkSmartPointer::New(); reader->SetFileName(fname.c_str()); reader->Update(); vtk_image = reader->GetOutput(); @@ -81,7 +81,7 @@ int main(int argc, char* argv[]) } } else if (fs::is_directory(path)) { - vtkDICOMImageReader* dicom_reader = vtkDICOMImageReader::New(); + auto dicom_reader = vtkSmartPointer::New(); dicom_reader->SetDirectoryName(argv[1]); vtkDemandDrivenPipeline* executive = @@ -91,7 +91,7 @@ int main(int argc, char* argv[]) executive->SetReleaseDataFlag(0, 0); // where 0 is the port index } - vtkImageGaussianSmooth* smoother = vtkImageGaussianSmooth::New(); + auto smoother = vtkSmartPointer::New(); smoother->SetStandardDeviations(1., 1., 1.); smoother->SetInputConnection(dicom_reader->GetOutputPort()); smoother->Update(); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp index 253c41a920b..fd07fd1090f 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp @@ -5,55 +5,85 @@ #include #include -#include - #include #include #include #include + +#include + // Domain -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Image_domain = CGAL::Labeled_mesh_domain_3; +using Mesh_domain = CGAL::Mesh_domain_with_polyline_features_3; #ifdef CGAL_CONCURRENT_MESH_3 -typedef CGAL::Parallel_tag Concurrency_tag; +using Concurrency_tag = CGAL::Parallel_tag; #else -typedef CGAL::Sequential_tag Concurrency_tag; +using Concurrency_tag = CGAL::Sequential_tag; #endif // Triangulation -typedef CGAL::Mesh_triangulation_3::type Tr; - -typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; +using Tr = CGAL::Mesh_triangulation_3::type; +using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; // Criteria -typedef CGAL::Mesh_criteria_3 Mesh_criteria; +using Mesh_criteria = CGAL::Mesh_criteria_3; namespace params = CGAL::parameters; int main() { - /// [Create the image] - CGAL::Image_3 image = random_labeled_image(); - /// [Create the image] + const std::string fname = CGAL::data_file_path("images/420.inr"); + // Loads image + CGAL::Image_3 image; + if(!image.read(fname)){ + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } // Domain - Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image + , params::features_detector(CGAL::Mesh_3::Detect_features_on_image_bbox())); // Mesh criteria - Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1). - cell_radius_edge_ratio(3).cell_size(3)); + const double edge_size = 3; + Mesh_criteria criteria(params::edge_size(edge_size) + .facet_angle(30).facet_size(3).facet_distance(1) + .cell_radius_edge_ratio(3).cell_size(3)); + + // custom_initial_points_generator will put points on the mesh for initialization. + // Those points are objects of type std::tuple. + // Weighted_point_3 is the point's position and weight, + // int is the dimension of the minimal dimension subcomplex on which the point lies, + // Index is the underlying subcomplex index. + auto custom_initial_points_generator = [&](auto pts_out_iterator, int) { + using Point_3 = K::Point_3; + using Weighted_point_3 = K::Weighted_point_3; + using Index = Mesh_domain::Index; + using Point_dim_index = std::tuple; + + Point_3 a{0.0, 50.0, 66.66}; + Point_3 b{100.0, 50.0, 66.66}; + + // Add points along the segment [a, b] + double dist_ab = CGAL::sqrt(CGAL::squared_distance(a, b)); + int nb = static_cast(std::floor(dist_ab / edge_size)); + auto vector = (b - a) / static_cast(nb); + + Point_3 p = a; + for(int i = 0; i < nb; ++i) { + *pts_out_iterator++ = Point_dim_index{Weighted_point_3{p}, 1, Index(1)}; + p += vector; + } + return pts_out_iterator; + }; /// [Meshing] - C3t3 c3t3; - initialize_triangulation_from_labeled_image(c3t3, - domain, - image, - criteria, - static_cast(0)); - CGAL::refine_mesh_3(c3t3, domain, criteria); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + params::initial_points_generator(custom_initial_points_generator)); /// [Meshing] // Output diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_image_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_image_initialization.cpp new file mode 100644 index 00000000000..1117c2ed351 --- /dev/null +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_image_initialization.cpp @@ -0,0 +1,64 @@ +#include "random_labeled_image.h" +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +// Domain +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; + +#ifdef CGAL_CONCURRENT_MESH_3 +typedef CGAL::Parallel_tag Concurrency_tag; +#else +typedef CGAL::Sequential_tag Concurrency_tag; +#endif + +// Triangulation +typedef CGAL::Mesh_triangulation_3::type Tr; + +typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + +// Criteria +typedef CGAL::Mesh_criteria_3 Mesh_criteria; + +namespace params = CGAL::parameters; + +int main() +{ + /// [Create_the_image] + CGAL::Image_3 image = random_labeled_image(); + /// [Create_the_image] + + // Domain + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); + + // Mesh criteria + Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1) + .cell_radius_edge_ratio(3).cell_size(3)); + + /// [Meshing] + // Mesh generation with a custom initialization that places points + // on the surface of each connected component of the image. + CGAL::Construct_initial_points_labeled_image img_pts_generator(image, domain); + + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + params::initial_points_generator(img_pts_generator)); + /// [Meshing] + + // Output + std::ofstream medit_file("out.mesh"); + CGAL::IO::write_MEDIT(medit_file, c3t3); + medit_file.close(); + + return 0; +} diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_initial_points.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_initial_points.cpp new file mode 100644 index 00000000000..947fe4d890d --- /dev/null +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_initial_points.cpp @@ -0,0 +1,77 @@ +#include "random_labeled_image.h" +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +// Domain +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Labeled_mesh_domain_3 Image_domain; +typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain; + +#ifdef CGAL_CONCURRENT_MESH_3 +typedef CGAL::Parallel_tag Concurrency_tag; +#else +typedef CGAL::Sequential_tag Concurrency_tag; +#endif + +// Triangulation +typedef CGAL::Mesh_triangulation_3::type Tr; + +typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + +// Criteria +typedef CGAL::Mesh_criteria_3 Mesh_criteria; + +namespace params = CGAL::parameters; + +int main() +{ + const std::string fname = CGAL::data_file_path("images/420.inr"); + // Loads image + CGAL::Image_3 image; + if(!image.read(fname)){ + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } + + // Domain + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image + , params::features_detector(CGAL::Mesh_3::Detect_features_in_image())); + + // Mesh criteria + Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1).edge_size(3) + .cell_radius_edge_ratio(3).cell_size(3)); + + using Point_3 = K::Point_3; + using Weighted_point_3 = K::Weighted_point_3; + using Index = Mesh_domain::Index; + using Initial_point_t = std::tuple; + + // Creation of the initial_points vector + std::vector initial_points = { + {Weighted_point_3(Point_3(30.0, 50.0, 83.33), 30.0), 1, Index(1)}, + {Weighted_point_3(Point_3(70.0, 50.0, 83.33), 50.0), 1, Index(1)} + }; + + /// [Meshing] + // Mesh generation from labeled image with initial points. + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + params::initial_points(std::cref(initial_points))); + /// [Meshing] + + // Output + std::ofstream ofs("out.mesh"); + CGAL::IO::write_MEDIT(ofs, c3t3); + + return 0; +} diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index 82380d7865b..e47d899faec 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -644,7 +644,7 @@ private: #ifdef CGAL_INTRUSIVE_LIST Cell_handle next_intrusive_ = {}, previous_intrusive_ = {}; #endif - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); std::array surface_center_index_table_ = {}; /// Stores visited facets (4 first bits) diff --git a/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_gray_image.h b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_gray_image.h new file mode 100644 index 00000000000..6dd6c4a3c9c --- /dev/null +++ b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_gray_image.h @@ -0,0 +1,114 @@ +// Copyright (c) 2015,2016 GeometryFactory +// 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) : Laurent Rineau, Jane Tournois and Ange Clement + +#ifndef CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H +#define CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H + +#include + +#include +#include + +#include + +namespace CGAL +{ + +/*! + * \ingroup PkgMesh3Initializers + * + * Functor for generating initial points in gray images. + * This functor is a model of the `InitialPointsGenerator_3` concept, + * and can be passed as a parameter to `CGAL::make_mesh_3` using the + * `CGAL::parameters::initial_points_generator()` parameter function. + * + * On images that contain multiple connected components, + * this functor will scan the full image and + * output enough points on the surface of each component + * to initialize them all. Each connected component is guaranteed to be + * represented by at least one cell of the triangulation. + * + * \cgalModels{InitialPointsGenerator_3} + * + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + * @tparam MeshDomain model of `MeshDomain_3` + * @tparam Functor a function object that takes the number type in which the image is encoded, + * and returns the `MeshDomain::Index` of the corresponding subcomplex index. + * The default type is `CGAL::Null_functor`. + * + * \sa `CGAL::parameters::initial_points_generator()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::Construct_initial_points_labeled_image` + */ +template +struct Construct_initial_points_gray_image +{ + const CGAL::Image_3 & image_; + const MeshDomain& domain_; + const typename MeshDomain::R::FT iso_value_; + Functor image_values_to_subdomain_indices_; + + /*! + * Constructs a functor for generating initial points in gray images. + * @param image the gray image that defines the mesh domain + * @param domain the mesh domain + * @param iso_value the iso value corresponding to the surface of the domain + * @param image_values_to_subdomain_indices a function object that takes + * the number type in which `image` is encoded, + * and returns the corresponding `MeshDomain::Index`. + * The default functor is `CGAL::Null_functor` + * and corresponds to meshing the areas where the image values are + * greater than `iso_value`. + */ + Construct_initial_points_gray_image(const CGAL::Image_3 & image, + const MeshDomain& domain, + const double iso_value, + const Functor image_values_to_subdomain_indices = CGAL::Null_functor()) + : image_(image) + , domain_(domain) + , iso_value_(static_cast(iso_value)) + , image_values_to_subdomain_indices_(image_values_to_subdomain_indices) + { } + + /*! + * \brief constructs at least `n` points by collecting them on the surface of all + * subdomains in the image, + * even if they are not connected components. + * Using this functor guarantees to initialize each connected component. + * + * @tparam OutputIterator model of `OutputIterator` for + * tuple-like objects containing + * - a `Weighted_point_3` for the point + * - an `int` for the minimal dimension of the subcomplexes on which the point lies + * - a `MeshDomain::Index` for the corresponding subcomplex index + * @tparam MeshDomain model of `MeshDomain_3` + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + * + */ + template + OutputIterator operator()(OutputIterator pts, const int n = 20) const + { + using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; + using C_i_v_t_s_i = Create_gray_image_values_to_subdomain_indices; + using Image_values_to_subdomain_indices = typename C_i_v_t_s_i::type; + + Image_values_to_subdomain_indices transform_fct = + C_i_v_t_s_i()(image_values_to_subdomain_indices_, iso_value_); + Construct_initial_points_labeled_image init_pts{ image_, domain_ }; + init_pts(pts, transform_fct, n); + return pts; + } +}; + +} // end namespace CGAL + +#endif // CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h new file mode 100644 index 00000000000..ac79ecce0b6 --- /dev/null +++ b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h @@ -0,0 +1,332 @@ +// Copyright (c) 2015,2016 GeometryFactory +// 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) : Laurent Rineau and Ange Clement + +#ifndef CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_LABELED_IMAGE_H +#define CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_LABELED_IMAGE_H + +#include + +#include + +#include +#include + +#include + +namespace CGAL +{ + +namespace Mesh_3 +{ +namespace internal +{ + +template +struct Get_point +{ + const double vx, vy, vz; + const double tx, ty, tz; + const std::size_t xdim, ydim, zdim; + Get_point(const CGAL::Image_3* image) + : vx(image->vx()) + , vy(image->vy()) + , vz(image->vz()) + , tx(image->tx()) + , ty(image->ty()) + , tz(image->tz()) + , xdim(image->xdim()) + , ydim(image->ydim()) + , zdim(image->zdim()) + {} + + Point operator()(const std::size_t i, + const std::size_t j, + const std::size_t k) const + { + double x = double(i) * vx + tx; + double y = double(j) * vy + ty; + double z = double(k) * vz + tz; + + if (i == 0) x += 1. / 6. * vx; + else if (i == xdim - 1) x -= 1. / 6. * vx; + if (j == 0) y += 1. / 6. * vy; + else if (j == ydim - 1) y -= 1. / 6. * vy; + if (k == 0) z += 1. / 6. * vz; + else if (k == zdim - 1) z -= 1. / 6. * vz; + + return Point(x, y, z); + } +}; + +} // end namespace internal +} // end namespace Mesh_3 + +/*! + * \ingroup PkgMesh3Initializers + * + * Functor for generating initial points in labeled images. + * This functor is a model of the `InitialPointsGenerator_3` concept, + * and can be passed as a parameter to `CGAL::make_mesh_3` using the + * `CGAL::parameters::initial_points_generator()` parameter function. + * + * This functor scans the complete image to detect all its connected components, + * and constructs points on the surface of each of them. + * Its goal is to initialize each component, each of them corresponding + * to a subdomain. + * It ensures that each component will be initialized, i.e. represented + * by at least one cell of the triangulation. + * + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + * @tparam MeshDomain model of `MeshDomain_3` + * + * \cgalModels{InitialPointsGenerator_3} + * + * \sa `CGAL::parameters::initial_points_generator()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::Construct_initial_points_gray_image` + */ +template +struct Construct_initial_points_labeled_image +{ + const CGAL::Image_3& image_; + const MeshDomain& domain_; + + /*! + * Constructs a functor for generating initial points in labeled images. + * @param image the labeled image that defines the mesh domain + * @param domain the mesh domain + */ + Construct_initial_points_labeled_image(const CGAL::Image_3& image, + const MeshDomain& domain) + : image_(image) + , domain_(domain) + { } + + /*! + * \brief constructs at least `n` initial points. + * + * @tparam OutputIterator model of `OutputIterator` for + * tuple-like objects containing + * - a `Weighted_point_3` for the point + * - an `int` for the minimal dimension of the subcomplexes on which the point lies + * - a `MeshDomain::Index` for the corresponding subcomplex index + */ + template + OutputIterator operator()(OutputIterator pts, const int n = 20) const + { + CGAL_IMAGE_IO_CASE(image_.image(), operator()(pts, CGAL::Identity(), n)); + return pts; + } + + /* //internal undocumented + * \brief Same as above, but a `TransformOperator` that transforms values of the image is used. + * + * @tparam OutputIterator model of `OutputIterator` for + * tuple-like objects containing + * - a `Weighted_point_3` for the point + * - an `int` for the minimal dimension of the subcomplexes on which the point lies + * - a `MeshDomain::Index` for the corresponding subcomplex index + * @tparam TransformOperator functor that transforms values of the image. + * It must provide the following type:
+ * `result_type`: a type that supports the '==' operator
+ * and the following operator:
+ * `result_type operator()(Word v)` + * with `Word` the type of the image values. + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + */ + template + OutputIterator operator()(OutputIterator pts, TransformOperator transform, int n = 20) const + { + typedef typename MeshDomain::Subdomain Subdomain; + typedef typename MeshDomain::Point_3 Point_3; + typedef typename MeshDomain::Index Index; + + typedef typename C3t3::Triangulation Tr; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename Tr::Weighted_point Weighted_point; + typedef typename Tr::Segment Segment_3; + typedef typename Tr::Vertex_handle Vertex_handle; + typedef typename Tr::Cell_handle Cell_handle; + typedef typename GT::Vector_3 Vector_3; + + C3t3 c3t3; + Tr& tr = c3t3.triangulation(); + + typename GT::Compare_weighted_squared_radius_3 cwsr = + tr.geom_traits().compare_weighted_squared_radius_3_object(); + typename GT::Construct_point_3 cp = + tr.geom_traits().construct_point_3_object(); + typename GT::Construct_weighted_point_3 cwp = + tr.geom_traits().construct_weighted_point_3_object(); + + const double max_v = (std::max)((std::max)(image_.vx(), + image_.vy()), + image_.vz()); + + struct Seed { + std::size_t i, j, k; + std::size_t radius; + }; + using Seeds = std::vector; + + Seeds seeds; + Mesh_3::internal::Get_point get_point(&image_); + std::cout << "Searching for connected components..." << std::endl; + CGAL_IMAGE_IO_CASE(image_.image(), search_for_connected_components_in_labeled_image(image_, + std::back_inserter(seeds), + CGAL::Emptyset_iterator(), + transform, + Word())); + std::cout << " " << seeds.size() << " components were found." << std::endl; + std::cout << "Construct initial points..." << std::endl; + for(const Seed seed : seeds) + { + const Point_3 seed_point = get_point(seed.i, seed.j, seed.k); + Cell_handle seed_cell = tr.locate(cwp(seed_point)); + + const Subdomain seed_label + = domain_.is_in_domain_object()(seed_point); + const Subdomain seed_cell_label + = ( tr.dimension() < 3 + || seed_cell == Cell_handle() + || tr.is_infinite(seed_cell)) + ? Subdomain() //seed_point is OUTSIDE_AFFINE_HULL + : domain_.is_in_domain_object()( + seed_cell->weighted_circumcenter(tr.geom_traits())); + + if ( seed_label != std::nullopt + && seed_cell_label != std::nullopt + && *seed_label == *seed_cell_label) + continue; //this means the connected component has already been initialized + + const double radius = double(seed.radius + 1)* max_v; + CGAL::Random_points_on_sphere_3 points_on_sphere_3(radius); + // [construct intersection] + typename MeshDomain::Construct_intersection construct_intersection = + domain_.construct_intersection_object(); + // [construct intersection] + + std::vector directions; + if(seed.radius < 2) { + // shoot in six directions + directions.push_back(Vector_3(-radius, 0, 0)); + directions.push_back(Vector_3(+radius, 0, 0)); + directions.push_back(Vector_3(0, -radius, 0)); + directions.push_back(Vector_3(0, +radius, 0)); + directions.push_back(Vector_3(0, 0, -radius)); + directions.push_back(Vector_3(0, 0, +radius)); + } else { + for(int i = 0; i < n; ++i) + { + // shoot n random directions + directions.push_back(*points_on_sphere_3++ - CGAL::ORIGIN); + } + } + + for(const Vector_3& v : directions) + { + const Point_3 test = seed_point + v; + const Segment_3 test_segment(seed_point, test); + + // [use construct intersection] + const typename MeshDomain::Intersection intersect = + construct_intersection(test_segment); + // [use construct intersection] + if (std::get<2>(intersect) != 0) + { + // [get construct intersection] + const Point_3& intersect_point = std::get<0>(intersect); + const Index& intersect_index = std::get<1>(intersect); + // [get construct intersection] + Weighted_point pi(intersect_point); + + // This would cause trouble to optimizers + // check pi will not be hidden + typename Tr::Locate_type lt; + int li, lj; + Cell_handle pi_cell = tr.locate(pi, lt, li, lj); + if(lt != Tr::OUTSIDE_AFFINE_HULL) { + switch (tr.dimension()) + { //skip dimension 0 + case 1: + if (tr.side_of_power_segment(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) + continue; + break; + case 2: + if (tr.side_of_power_circle(pi_cell, 3, pi, true) != CGAL::ON_BOUNDED_SIDE) + continue; + break; + case 3: + if (tr.side_of_power_sphere(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) + continue; + } + } + + //check pi is not inside a protecting ball + std::vector conflict_vertices; + if (tr.dimension() == 3) + { + tr.vertices_on_conflict_zone_boundary(pi, pi_cell + , std::back_inserter(conflict_vertices)); + } + else + { + for (typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin(); + vit != tr.finite_vertices_end(); ++vit) + { + const Weighted_point& wp = tr.point(vit); + if (cwsr(wp, FT(0)) == CGAL::SMALLER) // 0 < wp's weight + conflict_vertices.push_back(vit); + } + } + + bool pi_inside_protecting_sphere = false; + for(Vertex_handle cv : conflict_vertices) + { + if(tr.is_infinite(cv)) + continue; + + const Weighted_point& cv_wp = tr.point(cv); + if (cwsr(cv_wp, FT(0)) == CGAL::EQUAL) // 0 == wp's weight + continue; + + // if the (squared) distance between intersect_point and cv is smaller or equal than cv's weight + if (cwsr(cv_wp, - tr.min_squared_distance(intersect_point, cp(cv_wp))) != CGAL::LARGER) + { + pi_inside_protecting_sphere = true; + break; + } + } + if (pi_inside_protecting_sphere) + continue; + + // insert point in temporary triangulation + Vertex_handle v = tr.insert(pi); + + // `v` could be null if `pi` is hidden by other vertices of `tr`. + CGAL_assertion(v != Vertex_handle()); + + c3t3.set_dimension(v, 2); // by construction, points are on surface + c3t3.set_index(v, intersect_index); + + *pts++ = std::make_pair(pi, intersect_index); // dimension 2 by construction, points are on surface + } + } + } + return pts; + } +}; + +} // end namespace CGAL + +#endif // CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_LABELED_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index 036094d60b0..982681d4ac2 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -687,14 +687,16 @@ initialize() bbox.xmin() + 0.5*xdelta, bbox.ymin() + 0.5*ydelta, bbox.zmin() + 0.5*zdelta); -# ifdef CGAL_CONCURRENT_MESH_3_VERBOSE - std::cerr << "Adding points on a far sphere (radius = " << radius <<")..."; -# endif CGAL::Random rnd(0); Random_points_on_sphere_3 random_point(radius, rnd); const int NUM_PSEUDO_INFINITE_VERTICES = static_cast( float(std::thread::hardware_concurrency()) * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core); +#ifdef CGAL_MESH_3_VERBOSE + std::cerr << "Adding " << NUM_PSEUDO_INFINITE_VERTICES + << " points on a far sphere (radius = " << radius << ")..."; +#endif + for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point) r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_weighted_point_3_object() (r_c3t3_.triangulation().geom_traits().construct_translated_point_3_object()(*random_point, center))); @@ -745,11 +747,12 @@ initialize() bbox.xmin() + 0.5*xdelta, bbox.ymin() + 0.5*ydelta, bbox.zmin() + 0.5*zdelta); -# ifdef CGAL_MESH_3_VERBOSE - std::cerr << "Adding points on a far sphere (radius = " << radius << ")..."; -# endif Random_points_on_sphere_3 random_point(radius); const int NUM_PSEUDO_INFINITE_VERTICES = 12*2; +# ifdef CGAL_MESH_3_VERBOSE + std::cerr << "Adding " << NUM_PSEUDO_INFINITE_VERTICES + << " points on a far sphere (radius = " << radius << ")..."; +#endif for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point) r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_weighted_point_3_object() (r_c3t3_.triangulation().geom_traits().construct_translated_point_3_object()(*random_point, center))); diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index dfe2fb0a4ed..2e936424d62 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -234,6 +234,7 @@ private: Weight w, int dim, const Index& index, + Vertex_handle prev, ErasedVeOutIt out); /// Inserts balls between the points identified by the handles `vp` and `vq` @@ -549,7 +550,7 @@ Protect_edges_sizing_field:: operator()(const bool refine) { // This class is only meant to be used with non-periodic triangulations - CGAL_assertion(!(std::is_same::value)); + CGAL_assertion(!(std::is_same_v)); #ifdef CGAL_MESH_3_VERBOSE std::cerr << "Inserting protection balls..." << std::endl @@ -630,7 +631,7 @@ insert_corners() // Get weight (the ball radius is given by the 'query_size' function) const FT query_weight = CGAL::square(query_size(p, 0, p_index)); FT w = use_minimal_size() - ? (std::min)(minimal_weight_, query_weight) + ? (std::max)(minimal_weight(), query_weight) : query_weight; #if CGAL_MESH_3_PROTECTION_DEBUG & 1 @@ -639,7 +640,8 @@ insert_corners() // The following lines ensure that the weight w is small enough so that // corners balls do not intersect - if(dt.number_of_vertices() >= 2) + if( dt.number_of_vertices() >= 2 + && (!use_minimal_size() || w != minimal_weight())) { typename Dt::Vertex_handle vh; CGAL_assertion_code( bool p_found = ) @@ -656,10 +658,13 @@ insert_corners() dt, vh, finite_incident_cells); w = (std::min)(w, nearest_sq_dist / FT(9)); + + if(use_minimal_size()) + w = (std::max)(w, minimal_weight_); } // Insert corner with ball (dim is zero because p is a corner) - Vertex_handle v = smart_insert_point(p, w, 0, p_index, + Vertex_handle v = smart_insert_point(p, w, 0, p_index, Vertex_handle(), CGAL::Emptyset_iterator()).first; CGAL_assertion(v != Vertex_handle()); @@ -760,7 +765,7 @@ template std::pair::Vertex_handle, ErasedVeOutIt> Protect_edges_sizing_field:: -smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, +smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, Vertex_handle prev, ErasedVeOutIt out) { #if CGAL_MESH_3_PROTECTION_DEBUG & 1 @@ -791,7 +796,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, // Check that new point will not be inside a power sphere typename Tr::Locate_type lt; int li, lj; - Cell_handle ch = tr.locate(wp0, lt, li, lj); + Cell_handle ch = tr.locate(wp0, lt, li, lj, prev); Vertex_handle nearest_vh = tr.nearest_power_vertex(p, ch); FT sq_d = sq_distance(p, cp(tr.point(nearest_vh))); @@ -1059,6 +1064,7 @@ insert_balls_on_edges() CGAL::square(p_size), 1 /*dim*/, p_index, + Vertex_handle(), CGAL::Emptyset_iterator()).first; } // No 'else' because in that case 'is_vertex(..)' already filled @@ -1248,6 +1254,7 @@ insert_balls(const Vertex_handle& vp, point_weight, dim, index, + Vertex_handle(), out); if(forced_stop()) return out; const Vertex_handle new_vertex = pair.first; @@ -1338,7 +1345,7 @@ insert_balls(const Vertex_handle& vp, // Insert point into c3t3 std::pair pair = - smart_insert_point(new_point, point_weight, dim, index, out); + smart_insert_point(new_point, point_weight, dim, index, prev, out); Vertex_handle new_vertex = pair.first; out = pair.second; diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h deleted file mode 100644 index 1d3a6b7601e..00000000000 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2015,2016 GeometryFactory -// 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) : Laurent Rineau, Jane Tournois - -#ifndef CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H -#define CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H - -#include - -#include -#include - -#include - -template -void initialize_triangulation_from_gray_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - const FT& iso_value, - Image_word_type, - const Functor image_values_to_subdomain_indices = CGAL::Null_functor(), - bool protect_features = false) -{ - typedef typename CGAL::Default::Get::type Functor_; - - using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; - typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; - typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; - Image_values_to_subdomain_indices transform_fct = - C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); - - initialize_triangulation_from_labeled_image(c3t3, domain, image, criteria, - Image_word_type(), - protect_features, - transform_fct); -} - -#endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h deleted file mode 100644 index ec3e5761a9a..00000000000 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (c) 2015,2016 GeometryFactory -// 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) : Laurent Rineau - -#ifndef CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H -#define CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -template -struct Get_point -{ - const double vx, vy, vz; - const double tx, ty, tz; - const std::size_t xdim, ydim, zdim; - Get_point(const CGAL::Image_3* image) - : vx(image->vx()) - , vy(image->vy()) - , vz(image->vz()) - , tx(image->tx()) - , ty(image->ty()) - , tz(image->tz()) - , xdim(image->xdim()) - , ydim(image->ydim()) - , zdim(image->zdim()) - {} - - Point operator()(const std::size_t i, - const std::size_t j, - const std::size_t k) const - { - double x = double(i) * vx + tx; - double y = double(j) * vy + ty; - double z = double(k) * vz + tz; - - if (i == 0) x += 1. / 6. * vx; - else if (i == xdim - 1) x -= 1. / 6. * vx; - if (j == 0) y += 1. / 6. * vy; - else if (j == ydim - 1) y -= 1. / 6. * vy; - if (k == 0) z += 1. / 6. * vz; - else if (k == zdim - 1) z -= 1. / 6. * vz; - - return Point(x, y, z); - } -}; -template -void init_tr_from_labeled_image_call_init_features(C3T3&, - const MeshDomain&, - const MeshCriteria&, - CGAL::Tag_false) -{ -} -template -void init_tr_from_labeled_image_call_init_features(C3T3& c3t3, - const MeshDomain& domain, - const MeshCriteria& criteria, - CGAL::Tag_true) -{ - CGAL::Mesh_3::internal::init_c3t3_with_features(c3t3, - domain, - criteria); - std::cout << c3t3.triangulation().number_of_vertices() - << " initial points on 1D-features" << std::endl; -} - -template > -void initialize_triangulation_from_labeled_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - Image_word_type, - bool protect_features = false, - TransformOperator transform = CGAL::Identity()) -{ - typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits GT; - typedef typename GT::FT FT; - typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Bare_point Bare_point; - typedef typename Tr::Segment Segment_3; - typedef typename Tr::Vertex_handle Vertex_handle; - typedef typename Tr::Cell_handle Cell_handle; - - typedef typename GT::Vector_3 Vector_3; - - typedef MeshDomain Mesh_domain; - - Tr& tr = c3t3.triangulation(); - - typename GT::Compare_weighted_squared_radius_3 cwsr = - tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename GT::Construct_point_3 cp = - tr.geom_traits().construct_point_3_object(); - typename GT::Construct_weighted_point_3 cwp = - tr.geom_traits().construct_weighted_point_3_object(); - - if(protect_features) { - init_tr_from_labeled_image_call_init_features - (c3t3, domain, criteria, - CGAL::internal::Has_features()); - } - - const double max_v = (std::max)((std::max)(image.vx(), - image.vy()), - image.vz()); - - struct Seed { - std::size_t i, j, k; - std::size_t radius; - }; - using Seeds = std::vector; - using Subdomain = typename Mesh_domain::Subdomain; - - Seeds seeds; - Get_point get_point(&image); - std::cout << "Searching for connected components..." << std::endl; - search_for_connected_components_in_labeled_image(image, - std::back_inserter(seeds), - CGAL::Emptyset_iterator(), - transform, - Image_word_type()); - std::cout << " " << seeds.size() << " components were found." << std::endl; - std::cout << "Construct initial points..." << std::endl; - for(const Seed seed : seeds) - { - const Bare_point seed_point = get_point(seed.i, seed.j, seed.k); - Cell_handle seed_cell = tr.locate(cwp(seed_point)); - - const Subdomain seed_label - = domain.is_in_domain_object()(seed_point); - const Subdomain seed_cell_label - = ( tr.dimension() < 3 - || seed_cell == Cell_handle() - || tr.is_infinite(seed_cell)) - ? Subdomain() //seed_point is OUTSIDE_AFFINE_HULL - : domain.is_in_domain_object()( - seed_cell->weighted_circumcenter(tr.geom_traits())); - - if ( seed_label != std::nullopt - && seed_cell_label != std::nullopt - && *seed_label == *seed_cell_label) - continue; //this means the connected component has already been initialized - - const double radius = double(seed.radius + 1)* max_v; - CGAL::Random_points_on_sphere_3 points_on_sphere_3(radius); - typename Mesh_domain::Construct_intersection construct_intersection = - domain.construct_intersection_object(); - - std::vector directions; - if(seed.radius < 2) { - // shoot in six directions - directions.push_back(Vector_3(-radius, 0, 0)); - directions.push_back(Vector_3(+radius, 0, 0)); - directions.push_back(Vector_3(0, -radius, 0)); - directions.push_back(Vector_3(0, +radius, 0)); - directions.push_back(Vector_3(0, 0, -radius)); - directions.push_back(Vector_3(0, 0, +radius)); - } else { - for(int i = 0; i < 20; ++i) - { - // shoot 20 random directions - directions.push_back(*points_on_sphere_3++ - CGAL::ORIGIN); - } - } - - for(const Vector_3& v : directions) - { - const Bare_point test = seed_point + v; - - const typename Mesh_domain::Intersection intersect = - construct_intersection(Segment_3(seed_point, test)); - if (std::get<2>(intersect) != 0) - { - const Bare_point& bpi = std::get<0>(intersect); - Weighted_point pi = cwp(bpi); - - // This would cause trouble to optimizers - // check pi will not be hidden - typename Tr::Locate_type lt; - int li, lj; - Cell_handle pi_cell = tr.locate(pi, lt, li, lj); - if(lt != Tr::OUTSIDE_AFFINE_HULL) { - switch (tr.dimension()) - { //skip dimension 0 - case 1: - if (tr.side_of_power_segment(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) - continue; - break; - case 2: - if (tr.side_of_power_circle(pi_cell, 3, pi, true) != CGAL::ON_BOUNDED_SIDE) - continue; - break; - case 3: - if (tr.side_of_power_sphere(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) - continue; - } - } - - //check pi is not inside a protecting ball - std::vector conflict_vertices; - if (tr.dimension() == 3) - { - tr.vertices_on_conflict_zone_boundary(pi, pi_cell - , std::back_inserter(conflict_vertices)); - } - else - { - for (typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin(); - vit != tr.finite_vertices_end(); ++vit) - { - const Weighted_point& wp = tr.point(vit); - if (cwsr(wp, FT(0)) == CGAL::SMALLER) // 0 < wp's weight - conflict_vertices.push_back(vit); - } - } - - bool pi_inside_protecting_sphere = false; - for(Vertex_handle cv : conflict_vertices) - { - if(tr.is_infinite(cv)) - continue; - - const Weighted_point& cv_wp = tr.point(cv); - if (cwsr(cv_wp, FT(0)) == CGAL::EQUAL) // 0 == wp's weight - continue; - - // if the (squared) distance between bpi and cv is smaller or equal than cv's weight - if (cwsr(cv_wp, - tr.min_squared_distance(bpi, cp(cv_wp))) != CGAL::LARGER) - { - pi_inside_protecting_sphere = true; - break; - } - } - if (pi_inside_protecting_sphere) - continue; - const typename Mesh_domain::Index index = std::get<1>(intersect); - - /// The following lines show how to insert initial points in the - /// `c3t3` object. [insert initial points] - Vertex_handle v = tr.insert(pi); - - // `v` could be null if `pi` is hidden by other vertices of `tr`. - CGAL_assertion(v != Vertex_handle()); - - c3t3.set_dimension(v, 2); // by construction, points are on surface - c3t3.set_index(v, index); - /// [insert initial points] - } - // else - // { - // std::cerr << - // boost::format("Error. Segment (%1%, %2%) does not intersect the surface!\n") - // % it->first % test; - // } - } - } - std::cout << " " << tr.number_of_vertices() << " initial points." << std::endl; - if ( c3t3.triangulation().dimension() != 3 ) - { - std::cout << " not enough points: triangulation.dimension() == " - << c3t3.triangulation().dimension() << std::endl; - CGAL::Mesh_3::internal::init_c3t3(c3t3, domain, criteria, 20); - std::cout << " -> " << tr.number_of_vertices() << " initial points." << std::endl; - } -} - -#endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h b/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h index 31218f7c60d..db92293abf4 100644 --- a/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h +++ b/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h @@ -100,7 +100,7 @@ struct Graph_manipulations edge_descriptor edge; bool b; // test if the edge is already here, using add_edge - boost::tie(edge, b) = add_edge(va, vb, g); + std::tie(edge, b) = add_edge(va, vb, g); remove_edge(edge, g); if(!b) { // The edge was already here. @@ -129,7 +129,7 @@ struct Graph_manipulations if(v1 != v2) { edge_descriptor edge; bool b; - boost::tie(edge, b) = add_edge(v1, v2, g); + std::tie(edge, b) = add_edge(v1, v2, g); return b; } else return false; diff --git a/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h b/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h index f51af8cd0b3..8debd8dfdfc 100644 --- a/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h @@ -72,7 +72,7 @@ struct Angle_tester else { out_edge_iterator out_edge_it, out_edges_end; - boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); + std::tie(out_edge_it, out_edges_end) = out_edges(v, g); vertex_descriptor v1 = target(*out_edge_it++, g); vertex_descriptor v2 = target(*out_edge_it++, g); diff --git a/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h b/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h index 7b3dde34edc..67bcedd1a6b 100644 --- a/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h +++ b/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h @@ -325,7 +325,7 @@ struct Angle_tester else { out_edge_iterator out_edge_it, out_edges_end; - boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); + std::tie(out_edge_it, out_edges_end) = out_edges(v, g); vertex_descriptor v1 = target(*out_edge_it++, g); vertex_descriptor v2 = target(*out_edge_it++, g); diff --git a/Mesh_3/include/CGAL/Mesh_cell_base_3.h b/Mesh_3/include/CGAL/Mesh_cell_base_3.h index d2f09a0606a..ac5535f7090 100644 --- a/Mesh_3/include/CGAL/Mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_cell_base_3.h @@ -273,7 +273,7 @@ private: #ifdef CGAL_INTRUSIVE_LIST Cell_handle next_intrusive_, previous_intrusive_; #endif - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; // end class Mesh_cell_base_3 diff --git a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h index 454c0c94aff..04b6d247da1 100644 --- a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h +++ b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h @@ -41,10 +41,9 @@ private: typedef CGAL::HalfedgeDS_vertex_base Pdv_base; Set_of_indices indices; - std::size_t time_stamp_; - + std::size_t time_stamp_ = std::size_t(-2); public: - int nb_of_feature_edges; + int nb_of_feature_edges = 0; bool is_corner() const { return nb_of_feature_edges > 2; @@ -85,8 +84,8 @@ public: return indices; } - Mesh_polyhedron_vertex() : Pdv_base(), time_stamp_(-1), nb_of_feature_edges(0) {} - Mesh_polyhedron_vertex(const Point& p) : Pdv_base(p), time_stamp_(-1), nb_of_feature_edges(0) {} + Mesh_polyhedron_vertex() = default; + Mesh_polyhedron_vertex(const Point& p) : Pdv_base(p) {} }; template @@ -95,7 +94,7 @@ public CGAL::HalfedgeDS_halfedge_base { private: bool feature_edge; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: @@ -143,7 +142,7 @@ public CGAL::HalfedgeDS_face_base { private: Patch_id_ patch_id_; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: diff --git a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h index 46b09094e95..db43424ec4f 100644 --- a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h @@ -250,7 +250,7 @@ private: Vertex_handle next_intrusive_; Vertex_handle previous_intrusive_; #endif - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: friend std::istream& operator>>(std::istream &is, Mesh_vertex_3& v) diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 6cae4726dd1..4350b92faff 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -25,8 +25,11 @@ #include #include #include +#include +#include #include +#include #include @@ -38,46 +41,126 @@ namespace CGAL { namespace Mesh_3 { namespace internal { -template < typename C3T3, typename MeshDomain, typename MeshCriteria > +template +struct Push_to_initial_point { + // This struct cannot be a lambda-expression before C++20, because we need it to be copyable/assignable. + std::vector* points_vector_ptr; + C3T3* c3t3_ptr; + + Push_to_initial_point(std::vector* points_vector_ptr, C3T3* c3t3_ptr) + : points_vector_ptr(points_vector_ptr) + , c3t3_ptr(c3t3_ptr) + {} + + template + void operator()(const Initial_point_and_info& initial_pt) const { + using T = CGAL::cpp20::remove_cvref_t; + if constexpr (CGAL::STL_Extension::internal::tuple_like_of_size_2) + { + const auto& [pt, index] = initial_pt; + const auto& cwp = c3t3_ptr->triangulation().geom_traits().construct_weighted_point_3_object(); + points_vector_ptr->push_back(PointDimIndex{cwp(pt), 2, index}); + } + else + { + const auto& [weighted_pt, dim, index] = initial_pt; + points_vector_ptr->push_back(PointDimIndex{weighted_pt, dim, index}); + } + }; +}; + +template < typename C3T3, typename MeshDomain, typename InitialPointsGenerator > void -init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&, - const int nb_initial_points) +add_points_from_generator(C3T3& c3t3, + const MeshDomain&, + const int nb_initial_points, + const InitialPointsGenerator& generator) { - typedef typename MeshDomain::Point_3 Point_3; - typedef typename MeshDomain::Index Index; - typedef typename std::pair PI; - typedef std::vector Initial_points_vector; + typedef typename C3T3::Triangulation Tr; typedef typename C3T3::Vertex_handle Vertex_handle; - typedef CGAL::Mesh_3::Triangulation_helpers Th; + typedef CGAL::Mesh_3::Triangulation_helpers Th; - // Mesh initialization : get some points and add them to the mesh - Initial_points_vector initial_points; - if (nb_initial_points > -1) - domain.construct_initial_points_object()(std::back_inserter(initial_points), - nb_initial_points); - else //use default number of points - domain.construct_initial_points_object()(std::back_inserter(initial_points)); + struct PointDimIndex + { + typename Tr::Point m_wpt; + int m_dim; + typename MeshDomain::Index m_index; + }; - typename C3T3::Triangulation::Geom_traits::Construct_weighted_point_3 cwp = - c3t3.triangulation().geom_traits().construct_weighted_point_3_object(); + + std::vector initial_points; + Push_to_initial_point push_initial_point{&initial_points, &c3t3}; + auto output_it = boost::make_function_output_iterator(push_initial_point); + if (nb_initial_points > 0) + generator(output_it, nb_initial_points); + else + generator(output_it); // Insert points and set their index and dimension - for (const PI& pi : initial_points) + for (const auto& [wpoint, dimension, index] : initial_points) { - if(Th().inside_protecting_balls(c3t3.triangulation(), Vertex_handle(), pi.first)) + if(Th().inside_protecting_balls(c3t3.triangulation(), Vertex_handle(), wpoint.point())) continue; - Vertex_handle v = c3t3.triangulation().insert(cwp(pi.first)); + Vertex_handle v = c3t3.triangulation().insert(wpoint); // v could be null if point is hidden if ( v != Vertex_handle() ) { - c3t3.set_dimension(v,2); // by construction, points are on surface - c3t3.set_index(v, pi.second); + c3t3.set_dimension(v,dimension); + c3t3.set_index(v,index); } } } +template +bool +needs_more_init(C3T3& c3t3, const MeshDomain& domain) +{ + // If c3t3 initialization is not sufficient (may happen if + // the user has not specified enough points ), add some surface points + + if (c3t3.triangulation().dimension() != 3) + return true; + else // dimension is 3 but it may not be enough + { + CGAL::Mesh_3::C3T3_helpers helper(c3t3, domain); + helper.update_restricted_facets(); + + if (c3t3.number_of_facets() == 0) { + return true; + } + else + { + helper.update_restricted_cells(); + if (c3t3.number_of_cells() == 0) { + return true; + } + } + return false; + } +} + +template < typename C3T3, typename MeshDomain, typename MeshCriteria, typename InitializationOptions> +void +init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&, + const int nb_initial_points, + const InitializationOptions& init_options) +{ + // 1st insert points from initial_points range and initial_points_generator + add_points_from_generator(c3t3, domain, nb_initial_points, init_options); + + // If c3t3 initialization is not sufficient (may happen if + // the user has not specified enough points ), add some surface points + + // use mesh domain's Construct_initial_points to complete initialization + if(needs_more_init(c3t3, domain)) + { + add_points_from_generator(c3t3, domain, nb_initial_points, + domain.construct_initial_points_object()); + } +} + template < typename EdgeCriteria > struct Edge_criteria_sizing_field_wrapper { @@ -201,19 +284,23 @@ template < typename C3T3, typename MeshCriteria, bool MeshDomainHasHasFeatures, typename HasFeatures = int> -struct C3t3_initializer { }; +struct C3t3_initializer {}; // Partial specialization of C3t3_initializer // Handle cases where MeshDomain::Has_features is not a valid type -template < typename C3T3, typename MD, typename MC, typename HasFeatures > -struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures > +template < typename C3T3, typename MD, typename MC, typename HasFeatures> +struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures> { typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { if ( with_features ) { @@ -222,24 +309,29 @@ struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures > } init_c3t3(c3t3,domain,criteria, - mesh_options.number_of_initial_points); + mesh_options.number_of_initial_points, + init_options); } }; // Partial specialization of C3t3_initializer // Handles cases where MeshDomain::Has_features is a valid type -template < typename C3T3, typename MD, typename MC, typename HasFeatures > -struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures > +template < typename C3T3, typename MD, typename MC, typename HasFeatures> +struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures> { typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { C3t3_initializer < C3T3, MD, MC, true, typename MD::Has_features >() - (c3t3,domain,criteria,with_features,mesh_options); + (c3t3,domain,criteria,with_features,mesh_options,init_options); } }; @@ -247,47 +339,46 @@ struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures > // Handles cases where MeshDomain::Has_features is a valid type and is defined // to CGAL::Tag_true template < typename C3T3, typename MD, typename MC > -struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true > +struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true> : public C3t3_initializer_base < C3T3, MD, MC > { virtual ~C3t3_initializer() { } typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { if ( with_features ) { this->initialize_features(c3t3, domain, criteria,mesh_options); - // If c3t3 initialization is not sufficient (may happen if there is only - // a planar curve as feature for example), add some surface points - - bool need_more_init = c3t3.triangulation().dimension() != 3; - if(!need_more_init) { - CGAL::Mesh_3::C3T3_helpers helper(c3t3, domain); - helper.update_restricted_facets(); - - if (c3t3.number_of_facets() == 0) { - need_more_init = true; - } - else - { - helper.update_restricted_cells(); - if(c3t3.number_of_cells() == 0) { - need_more_init = true; - } - } + // If the initial points are not provided by the default generator, + // there is no need to count the restricted facets and cells for now + // because more vertices will be inserted anyway. + // The check will be done later in init_c3t3() + bool use_default_initializer = false; + if constexpr (std::is_same_v) // check default type + { + use_default_initializer = init_options.is_default(); //check it also has no additional vertices } - if(need_more_init) { + + // If c3t3 initialization from features initialization + // is not sufficient (may happen if there is only + // a planar curve as feature for example), add some surface points. + if (!use_default_initializer || CGAL::Mesh_3::internal::needs_more_init(c3t3, domain)) + { init_c3t3(c3t3, domain, criteria, - mesh_options.number_of_initial_points); + mesh_options.number_of_initial_points, init_options); } } else { init_c3t3(c3t3,domain,criteria, - mesh_options.number_of_initial_points); } + mesh_options.number_of_initial_points, init_options); } } }; @@ -295,14 +386,18 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true > // Handles cases where MeshDomain::Has_features is a valid type and is defined // to CGAL::Tag_false template < typename C3T3, typename MD, typename MC > -struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > +struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false> { typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { if ( with_features ) { @@ -311,7 +406,7 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > } init_c3t3(c3t3,domain,criteria, - mesh_options.number_of_initial_points); + mesh_options.number_of_initial_points, init_options); } }; @@ -442,6 +537,39 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > * } * \cgalParamDefault{`parameters::exude()`} * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh initialization with a functor} + * \cgalParamDescription{an `InitialPointsGenerator_3` can optionally be provided to start the meshing process. + * The following named parameter controls this option: + *

    + *
  • `parameters::initial_points_generator()` + *
} + * \cgalParamDefault{the domain's `construct_initial_points_object()` + * will be called for the points initialization.} + * \cgalParamExtra{If the generator does not generate enough points, + * the domain's `construct_initial_points_object()` will be called.} + * \cgalParamExtra{If the parameter `parameters::initial_points()` is set, + * the functor will be called after insertion of the points.} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh initialization with points} + * \cgalParamDescription{a `Range` of initial points, represented as + * tuple-like objects made of `tuple-like` objects of `` can optionally + * be provided to start the meshing process. + * `Weighted_point_3` is the point's position and weight, + * `int` is the dimension of the minimal dimension subcomplex on which + * the point lies, and + * `Index` is the corresponding subcomplex index. + * The following named parameter controls this option: + *
    + *
  • `parameters::initial_points()` + *
} + * \cgalParamDefault{`std::vector>()`} + * \cgalParamExtra{If this parameter is set, + * the domain's `construct_initial_points_object()` will be called + * only if there is no facet in the restricted Delaunay triangulation + * after points insertion.} + * \cgalParamExtra{If the parameter `parameters::initial_points_generator()` is set, + * the points will be inserted before calling the functor.} + * \cgalParamSectionEnd * \cgalNamedParamsEnd * * Note that regardless of which optimization processes are activated, @@ -469,7 +597,8 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C { using parameters::choose_parameter; using parameters::get_parameter; - C3T3 c3t3; + using parameters::get_parameter_reference; + parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v); parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); @@ -478,10 +607,31 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); + // range of initial points + using Initial_point = std::pair; + using Initial_points_range_ref = typename internal_np::Lookup_named_param_def>::reference; + using Initial_points_range = std::remove_cv_t>; + std::vector empty_vec; + Initial_points_range initial_points = choose_parameter(get_parameter_reference(np, internal_np::initial_points_param), empty_vec); + + // initial points generator + using Initial_points_generator = typename internal_np::Lookup_named_param_def::reference; + auto default_generator = domain.construct_initial_points_object(); + Initial_points_generator initial_points_generator = choose_parameter(get_parameter(np, internal_np::initial_points_generator_param), + default_generator); + const parameters::internal::Initialization_options + initial_points_gen_param(initial_points_generator, initial_points); + + C3T3 c3t3; make_mesh_3_impl(c3t3, domain, criteria, exude_param, perturb_param, odt_param, lloyd_param, features_param.features(), mesh_options_param, - manifold_options_param); + manifold_options_param, + initial_points_gen_param); return c3t3; } @@ -510,7 +660,7 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, * * @return The mesh as a C3T3 object */ -template +template void make_mesh_3_impl(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria& criteria, @@ -519,10 +669,10 @@ void make_mesh_3_impl(C3T3& c3t3, const parameters::internal::Odt_options& odt, const parameters::internal::Lloyd_options& lloyd, const bool with_features, - const parameters::internal::Mesh_3_options& - mesh_options = parameters::internal::Mesh_3_options(), - const parameters::internal::Manifold_options& - manifold_options = parameters::internal::Manifold_options()) + const parameters::internal::Mesh_3_options& mesh_options = {}, + const parameters::internal::Manifold_options& manifold_options = {}, + const parameters::internal::Initialization_options& + initialization_options = {}) { #ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING CGAL::get_default_random() = CGAL::Random(0); @@ -533,11 +683,13 @@ void make_mesh_3_impl(C3T3& c3t3, C3T3, MeshDomain, MeshCriteria, - ::CGAL::internal::has_Has_features::value > () (c3t3, - domain, - criteria, - with_features, - mesh_options); + ::CGAL::internal::has_Has_features::value, + int>()(c3t3, + domain, + criteria, + with_features, + mesh_options, + initialization_options); CGAL_assertion( c3t3.triangulation().dimension() >= 2 ); diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 38df3832193..de33e3d2024 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Mesh_3_Tests ) find_package(CGAL REQUIRED COMPONENTS ImageIO) @@ -49,6 +49,7 @@ create_single_source_cgal_program( "test_meshing_with_default_edge_size.cpp" ) create_single_source_cgal_program( "test_meshing_determinism.cpp" ) create_single_source_cgal_program( "test_meshing_without_features_determinism.cpp" ) create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) +create_single_source_cgal_program( "test_mesh_3_issue_8773.cpp" ) create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" ) create_single_source_cgal_program( "test_meshing_with_one_step.cpp" ) create_single_source_cgal_program( "test_meshing_with_one_step_with_features.cpp" ) @@ -79,6 +80,7 @@ foreach(target test_meshing_determinism test_meshing_without_features_determinism test_mesh_3_issue_1554 + test_mesh_3_issue_8773 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 test_meshing_with_one_step @@ -108,6 +110,7 @@ if(TARGET CGAL::TBB_support) test_meshing_determinism test_meshing_without_features_determinism test_mesh_3_issue_1554 + test_mesh_3_issue_8773 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 test_min_edge_length @@ -129,6 +132,7 @@ if(TARGET CGAL::TBB_support) "execution of test_meshing_polyhedral_complex" "execution of test_mesh_capsule_var_distance_bound" "execution of test_mesh_3_issue_1554" + "execution of test_mesh_3_issue_8773" "execution of test_mesh_polyhedral_domain_with_features_deprecated" "execution of test_mesh_cell_base_3" PROPERTY RUN_SERIAL 1) diff --git a/Mesh_3/test/Mesh_3/test_mesh_3_issue_8773.cpp b/Mesh_3/test/Mesh_3/test_mesh_3_issue_8773.cpp new file mode 100644 index 00000000000..bc348b25676 --- /dev/null +++ b/Mesh_3/test/Mesh_3/test_mesh_3_issue_8773.cpp @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Domain +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Polyhedron = CGAL::Surface_mesh; +using Mesh_domain = CGAL::Polyhedral_mesh_domain_with_features_3; + +// Triangulation +using Tr = CGAL::Mesh_triangulation_3::type; +using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; + +// Criteria +using Mesh_criteria = CGAL::Mesh_criteria_3; + +namespace params = CGAL::parameters; + +void check_stream(const std::ios& stream, + const std::string& filename, + const std::string& operation, + bool ok = true) { + if(!stream || !ok) { + std::cerr << "Stream error after " << operation << " file: " << filename << std::endl; + std::cerr << "Stream state: "; + if(stream.rdstate() == std::ios::goodbit) { + std::cerr << "no error"; + } else { + if(stream.rdstate() & std::ios::eofbit) { + std::cerr << "eofbit "; + } + if(stream.rdstate() & std::ios::failbit) { + std::cerr << "failbit "; + } + if(stream.rdstate() & std::ios::badbit) { + std::cerr << "badbit "; + } + } + std::cerr << std::endl; + std::exit(EXIT_FAILURE); + } +} + +int main(int argc, char* argv[]) { + const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cube.off"); + + // Create input polyhedron + Polyhedron polyhedron; + std::ifstream input(fname); + check_stream(input, fname, "opening"); + input >> polyhedron; + check_stream(input, fname, "reading polyhedron from"); + + // Create domain + Mesh_domain domain(polyhedron); + domain.detect_features(); + + // Mesh criteria (no cell_size set) + Mesh_criteria criteria(params::facet_angle(25).facet_size(0.15).facet_distance(0.05).cell_radius_edge_ratio(3)); + + // Mesh generation + const C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); + + const auto nb_vertices = c3t3.triangulation().number_of_vertices(); + const auto nb_far_vertices = c3t3.number_of_far_points(); + const auto nb_cells = c3t3.number_of_cells(); + + std::cout << "Created a c3t3 with " << c3t3.triangulation().number_of_vertices() << " vertices, and " + << c3t3.number_of_cells() << " cells" << std::endl; + + // Output + { + const std::string filename = "ascii.vtu"; + std::ofstream out(filename); + check_stream(out, filename, "opening"); + CGAL::IO::output_to_vtu(out, c3t3, CGAL::IO::ASCII); + check_stream(out, filename, "writing (ASCII)"); + } + + { + const std::string filename = "binary.vtu"; + std::ofstream out(filename, std::ios::binary); + check_stream(out, filename, "opening"); + CGAL::IO::output_to_vtu(out, c3t3, CGAL::IO::BINARY); + check_stream(out, filename, "writing (BINARY)"); + } + + const std::string filename = "mesh.binary.cgal"; + { + std::ofstream out(filename, std::ios::binary); + check_stream(out, filename, "opening"); + bool ok = CGAL::IO::save_binary_file(out, c3t3); + check_stream(out, filename, "writing (binary)", ok); + } + + // Input + C3t3 bis; + { + std::ifstream in(filename, std::ios::binary); + check_stream(in, filename, "opening (binary)"); + bool ok = CGAL::IO::load_binary_file(in, bis); + check_stream(in, filename, "reading binary file", ok); + } + + { + const std::string bis_filename = "bis.vtu"; + std::ofstream bis_os(bis_filename); + check_stream(bis_os, bis_filename, "opening (bis.vtu)"); + CGAL::IO::output_to_vtu(bis_os, bis, CGAL::IO::ASCII); + check_stream(bis_os, bis_filename, "writing (ASCII)"); + } + + assert(bis.number_of_cells() == nb_cells); + assert(bis.triangulation().number_of_vertices() == nb_vertices); + assert(bis.number_of_far_points() == nb_far_vertices); + + std::cout << "Mesh generation and output completed successfully." << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp b/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp index 5781f445050..3e62a7d11ae 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp @@ -10,6 +10,14 @@ #include +template class Non_copyable_range_view { + Range& r; +public: + Non_copyable_range_view(Range& r) : r(r) {} + auto begin() const { return r.begin(); } + auto end() const { return r.end(); } +}; + template struct Polyhedron_tester : public Tester { @@ -66,6 +74,30 @@ struct Polyhedron_tester : public Tester // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); + // test initial_points with a tuple-like object + using Weighted_point = typename K::Weighted_point_3; + using Index = typename Mesh_domain::Index; + struct Initial_point + { + Weighted_point weighted_point; + int dimension; + Index index; + }; + std::vector initial_points = { Initial_point{ Weighted_point(.5, .5, .5), 3, Index{}} }; + c3t3 = CGAL::make_mesh_3(domain, criteria, CGAL::parameters::initial_points(initial_points)); + + // test initial_points with a non-copyable range + Non_copyable_range_view initial_points_view{ initial_points }; + c3t3 = CGAL::make_mesh_3(domain, criteria, CGAL::parameters::initial_points(initial_points_view)); + + // test initial_points_generator with a non-const generator generating tuple-like object + auto initial_points_generator = [](auto oit, const int) mutable { + *oit++ = Initial_point{ Weighted_point(.5, .5, .5), 3, Index{} }; + return oit; + }; + c3t3 = CGAL::make_mesh_3(domain, criteria, + CGAL::parameters::initial_points_generator(initial_points_generator)); + CGAL::remove_far_points_in_mesh_3(c3t3); double vol = 1/6.; diff --git a/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt b/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt index 2675890b483..6d3c41dc210 100644 --- a/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt +++ b/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt b/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt index 8101b6f796f..ed1e8ab4b17 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt +++ b/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt b/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt index 55255f3db34..5f467e1e05f 100644 --- a/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt +++ b/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt @@ -2,7 +2,6 @@ /*! \addtogroup PkgMinkowskiSum3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Minkowski Sum of Polyhedra,PkgMinkowskiSum3} \cgalPkgPicture{Minkowski_sum_3/fig/Minkowski_sum_3_teaser.png} \cgalPkgSummaryBegin diff --git a/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt b/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt index ce370521c8d..aabbb66cef6 100644 --- a/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt +++ b/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_3_Examples) find_package(CGAL REQUIRED) diff --git a/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt b/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt index be42c09b870..e0ceeb5a0ae 100644 --- a/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt +++ b/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_3_Tests) find_package(CGAL REQUIRED) diff --git a/Modifier/test/Modifier/CMakeLists.txt b/Modifier/test/Modifier/CMakeLists.txt index f3e97f25058..b108e17d957 100644 --- a/Modifier/test/Modifier/CMakeLists.txt +++ b/Modifier/test/Modifier/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Modifier_Tests) find_package(CGAL REQUIRED) diff --git a/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt b/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt index 3c6dac4fb32..e5b0921efad 100644 --- a/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt +++ b/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Modular_arithmetic_Examples) find_package(CGAL REQUIRED) diff --git a/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt b/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt index 2e1de64de95..63f72c081cf 100644 --- a/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt +++ b/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Modular_arithmetic_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Nef_2/examples/Nef_2/CMakeLists.txt b/Nef_2/examples/Nef_2/CMakeLists.txt index 9ca8957decf..3c490beeff9 100644 --- a/Nef_2/examples/Nef_2/CMakeLists.txt +++ b/Nef_2/examples/Nef_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_2_Examples) find_package(CGAL REQUIRED) diff --git a/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h b/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h index 1eecd047efd..639b4781d6e 100644 --- a/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h +++ b/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h @@ -627,6 +627,7 @@ public: out << "SweepStatus:\n"; typename SweepStatus::iterator sit3; for( sit3 = YS.begin(); *sit3 != &sh; ++sit3 ) { + if (*sit3==&sl) continue; int b = orientation(sit3, p_sweep); if(*sit3 == &sl) out << " 1"; else if(*sit3 == &sh) out <<"-1"; diff --git a/Nef_2/test/Nef_2/CMakeLists.txt b/Nef_2/test/Nef_2/CMakeLists.txt index ef5af7b668c..cb3cc582064 100644 --- a/Nef_2/test/Nef_2/CMakeLists.txt +++ b/Nef_2/test/Nef_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_2_Tests) find_package(CGAL REQUIRED) diff --git a/Nef_3/doc/Nef_3/PackageDescription.txt b/Nef_3/doc/Nef_3/PackageDescription.txt index de1e15c2f1c..6f591bcfb6c 100644 --- a/Nef_3/doc/Nef_3/PackageDescription.txt +++ b/Nef_3/doc/Nef_3/PackageDescription.txt @@ -11,7 +11,6 @@ /*! \addtogroup PkgNef3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Boolean Operations on Nef Polyhedra,PkgNef3} \cgalPkgPicture{Nef_3-teaser.png} \cgalPkgSummaryBegin diff --git a/Nef_3/examples/Nef_3/CMakeLists.txt b/Nef_3/examples/Nef_3/CMakeLists.txt index 6518c16a63a..fcb40d9df4b 100644 --- a/Nef_3/examples/Nef_3/CMakeLists.txt +++ b/Nef_3/examples/Nef_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_3_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h index b1eb8d6b9ee..463b5f85f60 100644 --- a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h +++ b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h @@ -402,9 +402,9 @@ class Infimaximal_box { typename SNC_structure::Vertex_const_iterator v; CGAL_forall_vertices(v, snc) { Point_3 p(v->point()); - if(p.hx()[0] > eval) eval = p.hx()[0]; - if(p.hy()[0] > eval) eval = p.hy()[0]; - if(p.hz()[0] > eval) eval = p.hz()[0]; + if(abs(p.hx()[0]) > eval) eval = abs(p.hx()[0]); + if(abs(p.hy()[0]) > eval) eval = abs(p.hy()[0]); + if(abs(p.hz()[0]) > eval) eval = abs(p.hz()[0]); } eval *= 4; if(eval == 0) return 1; diff --git a/Nef_3/include/CGAL/Nef_3/K3_tree.h b/Nef_3/include/CGAL/Nef_3/K3_tree.h index 3bec191d7c2..15392c5d5b9 100644 --- a/Nef_3/include/CGAL/Nef_3/K3_tree.h +++ b/Nef_3/include/CGAL/Nef_3/K3_tree.h @@ -517,7 +517,7 @@ Node_handle build_kdtree(Vertex_list& V, Halfedge_list& E, Halffacet_list& F, int coord = depth%3; Point_3 point_on_plane = find_median_point(V, coord); - CGAL_NEF_TRACEN("build_kdtree: plane: "<second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M4) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -482,7 +482,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector()); make_twins(e1,e2); CGAL_assertion(e1->mark()==e2->mark()); @@ -493,7 +493,7 @@ public: CGAL_forall_iterators(it,M3) { // progress++; it->second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M3) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -502,7 +502,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector()); make_twins(e1,e2); CGAL_assertion(e1->mark()==e2->mark()); @@ -513,7 +513,7 @@ public: CGAL_forall_iterators(it,M2) { // progress++; it->second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M2) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -522,7 +522,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector()); make_twins(e1,e2); CGAL_assertion(e1->mark()==e2->mark()); @@ -533,7 +533,7 @@ public: CGAL_forall_iterators(it,M) { // progress++; it->second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -542,7 +542,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<< -e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<< -e2->vector()); CGAL_assertion(e1->source()->point() != e2->source()->point()); CGAL_assertion(e1->mark()==e2->mark()); make_twins(e1,e2); @@ -585,10 +585,16 @@ public: break; } else #endif + CGAL_assertion_code(bool found = false;) CGAL_For_all(cet,cete) if ( cet->circle() == ce->circle().opposite() && cet->source()->twin() == ce->source() ) + { + CGAL_assertion_code(found = true;) break; + } + + CGAL_assertion(found); #ifdef CGAL_USE_TRACE if( cet->circle() != ce->circle().opposite() ) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index a3a26fb3041..be8345069e2 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -139,7 +139,7 @@ class SNC_intersection { if( !CGAL::assign( p, o)) return false; CGAL_NEF_TRACEN( "-> intersection point: " << p ); - CGAL_NEF_TRACEN( "-> point in facet interior? "< point in facet interior? "< intersection point: " << p ); - CGAL_NEF_TRACEN( "-> point in facet interior? "< point in facet interior? "<source()->point() << "->" << e->twin()->source()->point()); if (SNC_intersection::does_contain_internally(e->source()->point(), e->twin()->source()->point(), p)) { - _CGAL_NEF_TRACEN("found on edge "<< ss); +// _CGAL_NEF_TRACEN("found on edge "<< ss); return make_object(e); } if((e->source() != v) && (e->twin()->source() != v) && @@ -557,7 +557,7 @@ private: if(SNC_intersection::does_intersect_internally( s, *f, q) ) { q = normalized(q); call_back( e0, *f, q); - _CGAL_NEF_TRACEN("edge intersects facet on plane "<plane()<<" on "<plane()<<" on "< +#include +#include + +using Kernel = CGAL::Extended_cartesian; +using Nef = CGAL::Nef_polyhedron_3; + +int main() +{ + Nef hspace_1(Nef::Plane_3(1.0, 0.0, 0.0, 0.0), Nef::INCLUDED); + Nef hspace_2(Nef::Plane_3(1.0, 0.0, 0.0, 1.0), Nef::INCLUDED); + Nef hspace_3(Nef::Plane_3(0.0, 0.0, 1.0, 1.0), Nef::INCLUDED); + + Nef intersection_1 = hspace_1*hspace_2; + Nef intersection_2 = hspace_2*hspace_3; + + return 0; +} diff --git a/Nef_S2/examples/Nef_S2/CMakeLists.txt b/Nef_S2/examples/Nef_S2/CMakeLists.txt index 98f9d50a745..ca59ec51f5f 100644 --- a/Nef_S2/examples/Nef_S2/CMakeLists.txt +++ b/Nef_S2/examples/Nef_S2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_S2_Examples) find_package(CGAL REQUIRED) diff --git a/Nef_S2/test/Nef_S2/CMakeLists.txt b/Nef_S2/test/Nef_S2/CMakeLists.txt index f017155ef25..0d7c5961cb5 100644 --- a/Nef_S2/test/Nef_S2/CMakeLists.txt +++ b/Nef_S2/test/Nef_S2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_S2_Tests) find_package(CGAL REQUIRED) diff --git a/NewKernel_d/test/NewKernel_d/CMakeLists.txt b/NewKernel_d/test/NewKernel_d/CMakeLists.txt index 9bdfee78314..aa9bf6f75f5 100644 --- a/NewKernel_d/test/NewKernel_d/CMakeLists.txt +++ b/NewKernel_d/test/NewKernel_d/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. # Then modified by hand to add Eigen3. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(NewKernel_d_Tests) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) diff --git a/Number_types/doc/Number_types/CGAL/double.h b/Number_types/doc/Number_types/CGAL/double.h index 5c48d4332c8..a0520d46957 100644 --- a/Number_types/doc/Number_types/CGAL/double.h +++ b/Number_types/doc/Number_types/CGAL/double.h @@ -4,10 +4,10 @@ This header provides all necessary functions so the fundamental type `double` is a model of the concepts `RealEmbeddable` and -`Field`. Due to rounding errors and overflow `double` is considered as +`FieldWithKthRoot`. Due to rounding errors and overflow `double` is considered as not exact. -\cgalModels{FieldWithSqrt,RealEmbeddable} +\cgalModels{FieldWithKthRoot,RealEmbeddable} */ diff --git a/Number_types/doc/Number_types/CGAL/float.h b/Number_types/doc/Number_types/CGAL/float.h index 84f782c4d82..ee5aab1d406 100644 --- a/Number_types/doc/Number_types/CGAL/float.h +++ b/Number_types/doc/Number_types/CGAL/float.h @@ -6,10 +6,10 @@ This header provides all necessary functions so the fundamental type `float` is a model of the concepts `RealEmbeddable` and -`FieldWithSqrt`. Due to rounding errors and overflow `float` is +`FieldWithKthRoot`. Due to rounding errors and overflow `float` is considered as not exact. -\cgalModels{FieldWithSqrt,RealEmbeddable} +\cgalModels{FieldWithKthRoot,RealEmbeddable} */ diff --git a/Number_types/doc/Number_types/CGAL/int.h b/Number_types/doc/Number_types/CGAL/int.h index 8f43eac76b7..6db0d8c9e5c 100644 --- a/Number_types/doc/Number_types/CGAL/int.h +++ b/Number_types/doc/Number_types/CGAL/int.h @@ -3,12 +3,10 @@ \ingroup nt_builtin This header provides all necessary functions so the fundamental types -`int`, `long int`, and `short int` become models of their respective algebraic concepts. - -- `int` is a model of `RealEmbeddable` and `EuclideanRing`, -- `long int` is a model of `RealEmbeddable` and `EuclideanRing` -- `short int` is a model of `RealEmbeddable` and `EuclideanRing` +`int`, `long int`, and `short int` are models of the concepts `RealEmbeddable` and +`EuclideanRing`. Due to overflow neither of those types is considered as exact. +\cgalModels{RealEmbeddable, EuclideanRing} */ diff --git a/Number_types/doc/Number_types/CGAL/long_double.h b/Number_types/doc/Number_types/CGAL/long_double.h index 74275b716d1..283a9458b16 100644 --- a/Number_types/doc/Number_types/CGAL/long_double.h +++ b/Number_types/doc/Number_types/CGAL/long_double.h @@ -5,8 +5,10 @@ This header provides all necessary functions so the fundamental type `long double` is a model of the concepts `RealEmbeddable` and -`FieldWithSqrt`. Due to rounding errors and overflow `long double` is +`FieldWithKthRoot`. Due to rounding errors and overflow `long double` is considered as not exact. + +\cgalModels{FieldWithKthRoot,RealEmbeddable} */ namespace CGAL { diff --git a/Number_types/doc/Number_types/CGAL/long_long.h b/Number_types/doc/Number_types/CGAL/long_long.h index 83e6e23a058..26885845e4c 100644 --- a/Number_types/doc/Number_types/CGAL/long_long.h +++ b/Number_types/doc/Number_types/CGAL/long_long.h @@ -1,8 +1,10 @@ -/// \file long_long.h -/// \ingroup nt_builtin -/// -/// This header provides all necessary functions so the fundamental -/// type `long long int` is an `RealEmbeddable` `EuclideanRing`. Due -/// to overflow `long long int` is considered as not exact. -/// -/// \cgalModels{EuclideanRing,RealEmbeddable} +/*! +\file long_long.h +\ingroup nt_builtin + +This header provides all necessary functions so the fundamental +type `long long int` is a model of the concepts `RealEmbeddable` and `EuclideanRing`. Due +to overflow `long long int` is considered as not exact. + +\cgalModels{RealEmbeddable, EuclideanRing} +*/ \ No newline at end of file diff --git a/Number_types/doc/Number_types/PackageDescription.txt b/Number_types/doc/Number_types/PackageDescription.txt index 84bfd6debbd..ba551f7c153 100644 --- a/Number_types/doc/Number_types/PackageDescription.txt +++ b/Number_types/doc/Number_types/PackageDescription.txt @@ -30,7 +30,6 @@ /*! \addtogroup PkgNumberTypesRef -\todo check generated documentation \cgalPkgDescriptionBegin{Number Types,PkgNumberTypes} \cgalPkgPicture{illustration.png} \cgalPkgSummaryBegin diff --git a/Number_types/include/CGAL/MP_Float.h b/Number_types/include/CGAL/MP_Float.h index f6811a0f116..f5790515241 100644 --- a/Number_types/include/CGAL/MP_Float.h +++ b/Number_types/include/CGAL/MP_Float.h @@ -167,7 +167,7 @@ public: low = static_cast(l & mask); //extract low bits from l high= static_cast((l - low) >> sizeof_limb); //extract high bits from l - CGAL_postcondition ( l == low + ( static_cast(high) << sizeof_limb ) ); + CGAL_postcondition ( l == low + ( high * (limb2(1) << sizeof_limb) ) ); } // Given a limb2, returns the higher limb. diff --git a/Number_types/include/CGAL/leda_bigfloat_interval.h b/Number_types/include/CGAL/leda_bigfloat_interval.h index 25b0e2d8c66..8e347812b9d 100644 --- a/Number_types/include/CGAL/leda_bigfloat_interval.h +++ b/Number_types/include/CGAL/leda_bigfloat_interval.h @@ -202,8 +202,8 @@ public: std::pair lower_I(CGAL::to_interval(x.lower())); std::pair upper_I(CGAL::to_interval(x.upper())); return std::pair< double, double >( - CGAL::min(lower_I.first , upper_I.first ), - CGAL::max(lower_I.second, upper_I.second)); + (CGAL::min)(lower_I.first , upper_I.first ), + (CGAL::max)(lower_I.second, upper_I.second)); } }; }; diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index cf016a80eb9..2866af70bbf 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -3,7 +3,7 @@ # that dependency so as to test all the number types not depending on CORE # when it is not installed -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Number_types_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt b/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt index 3037ca8cb79..dbff84b5cf6 100644 --- a/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt +++ b/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_bounding_box_Benchmark) # CGAL and its components diff --git a/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt b/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt index 816d10c0403..5e9acc6a48d 100644 --- a/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt +++ b/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_bounding_box_Examples) find_package(CGAL REQUIRED) diff --git a/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt b/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt index 760507a79dd..c2f277d1f6a 100644 --- a/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt +++ b/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_bounding_box_Tests) find_package(CGAL REQUIRED) diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt index 97595c0cf1a..4003e1cb641 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the Optimal_transportation_reconstruction_2 demo. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_transportation_reconstruction_2_Demo) # Find CGAL and CGAL Qt6 diff --git a/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt index bd9f655378c..b5deb81be03 100644 --- a/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_transportation_reconstruction_2_Examples) find_package(CGAL REQUIRED) diff --git a/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt index e29f69f4789..bef1792ee07 100644 --- a/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_transportation_reconstruction_2_Tests) find_package(CGAL REQUIRED) diff --git a/Orthtree/benchmark/Orthtree/CMakeLists.txt b/Orthtree/benchmark/Orthtree/CMakeLists.txt index db70e151365..80e8a7f627a 100644 --- a/Orthtree/benchmark/Orthtree/CMakeLists.txt +++ b/Orthtree/benchmark/Orthtree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Orthtree_benchmarks) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Orthtree/examples/Orthtree/CMakeLists.txt b/Orthtree/examples/Orthtree/CMakeLists.txt index d3f055198e0..ac8701d8606 100644 --- a/Orthtree/examples/Orthtree/CMakeLists.txt +++ b/Orthtree/examples/Orthtree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Orthtree_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Orthtree/test/Orthtree/CMakeLists.txt b/Orthtree/test/Orthtree/CMakeLists.txt index 95fe59cc1f3..dc748180184 100644 --- a/Orthtree/test/Orthtree/CMakeLists.txt +++ b/Orthtree/test/Orthtree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Orthtree_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Partition_2/doc/Partition_2/PackageDescription.txt b/Partition_2/doc/Partition_2/PackageDescription.txt index ec875293336..2d33fd123ce 100644 --- a/Partition_2/doc/Partition_2/PackageDescription.txt +++ b/Partition_2/doc/Partition_2/PackageDescription.txt @@ -7,7 +7,6 @@ /// \ingroup PkgPartition2Ref /*! \addtogroup PkgPartition2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Polygon Partitioning,PkgPartition2} \cgalPkgPicture{Partition_2/fig/Partition_2-teaser-small.png} \cgalPkgSummaryBegin diff --git a/Partition_2/examples/Partition_2/CMakeLists.txt b/Partition_2/examples/Partition_2/CMakeLists.txt index 24b09d7c89e..d49f9f442ac 100644 --- a/Partition_2/examples/Partition_2/CMakeLists.txt +++ b/Partition_2/examples/Partition_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Partition_2_Examples) find_package(CGAL REQUIRED) diff --git a/Partition_2/test/Partition_2/CMakeLists.txt b/Partition_2/test/Partition_2/CMakeLists.txt index a2ad0dec5b1..800296c631c 100644 --- a/Partition_2/test/Partition_2/CMakeLists.txt +++ b/Partition_2/test/Partition_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Partition_2_Tests) find_package(CGAL REQUIRED) diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h index 05f9da516bc..1124eeab784 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h @@ -579,7 +579,7 @@ public: /*! Converts the `Periodic_point` `pp` (point-offset pair) to the - corresponding `Point` in \f$ \mathbb R^3\f$. + corresponding `Point` in \f$ \mathbb R^2\f$. */ Point point(const Periodic_point & pp ) const; @@ -593,6 +593,18 @@ public: */ Triangle triangle(const Periodic_triangle & t) const; + /*! + Equivalent to + the call `t.point(t.periodic_point(fh,i));` + */ + Point point(Face_handle fh, int i) const; + + /*! + Equivalent to + the call `t.point(t.periodic_point(v));` + */ + Point point(Vertex_handle v) const; + /*! Equivalent to the call `t.segment(t.periodic_segment(f,i));` diff --git a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt index 671221a301b..85d443b4c6f 100644 --- a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt +++ b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_2_triangulation_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt index 3857996a534..97515a1033e 100644 --- a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt +++ b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_2_triangulation_2_Tests) find_package(CGAL REQUIRED) diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt index 1141a255ca4..f235193705c 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_mesh_3_Examples) # CGAL and its components diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h index 33420371bfc..fd1e0b9e104 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h @@ -52,8 +52,7 @@ #ifndef CGAL_NO_ASSERTIONS # include // for float_prior #endif -#include -#include + #include #include @@ -62,10 +61,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -393,7 +394,7 @@ private: const Curve_index& curve_index, const CGAL::Orientation orientation) const { Bare_point pa, pb; - boost::tie(pa, pb) = get_positions(va, vb, curve_index, orientation); + std::tie(pa, pb) = get_positions(va, vb, curve_index, orientation); return compute_distance(pa, pb); } @@ -511,11 +512,11 @@ private: const Vertex_handle v2, const Curve_index& curve_index) const; - boost::tuple get_positions(const Vertex_handle v1, - const Vertex_handle v2, - const Vertex_handle v3, - const Curve_index& curve_index, - const CGAL::Orientation orientation) const; + std::tuple get_positions(const Vertex_handle v1, + const Vertex_handle v2, + const Vertex_handle v3, + const Curve_index& curve_index, + const CGAL::Orientation orientation) const; private: C3T3& c3t3_; @@ -953,9 +954,9 @@ get_positions_with_unknown_orientation(const Vertex_handle v1, template -boost::tuple::Bare_point, - typename Protect_edges_sizing_field::Bare_point, - typename Protect_edges_sizing_field::Bare_point> +std::tuple::Bare_point, + typename Protect_edges_sizing_field::Bare_point, + typename Protect_edges_sizing_field::Bare_point> Protect_edges_sizing_field:: get_positions(const Vertex_handle v1, const Vertex_handle v2, @@ -965,11 +966,11 @@ get_positions(const Vertex_handle v1, { Bare_point p1, p2_check, p2, p3; - boost::tie(p1, p2) = get_positions(v1, v2, curve_index, orientation); - boost::tie(p2_check, p3) = get_positions(v2, v3, curve_index, orientation); + std::tie(p1, p2) = get_positions(v1, v2, curve_index, orientation); + std::tie(p2_check, p3) = get_positions(v2, v3, curve_index, orientation); CGAL_assertion(p2_check == p2); - return boost::make_tuple(p1, p2, p3); + return std::make_tuple(p1, p2, p3); } @@ -1674,7 +1675,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, Vertex_handle nearest_vh; FT sq_d; - boost::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); + std::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); CGAL_assertion(nearest_vh != Vertex_handle()); CGAL_assertion(tr.point(nearest_vh) != cwp(tr.canonicalize_point(p))); @@ -1710,7 +1711,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, // Iterate ch = tr.locate(wp0, lt, li, lj, nearest_vh); - boost::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); + std::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); CGAL_assertion(nearest_vh != Vertex_handle()); } @@ -2000,7 +2001,7 @@ insert_balls(const Vertex_handle& vp, { // Get size of p & q Bare_point vpp, vqp; - boost::tie(vpp, vqp) = get_positions(vp, vq, curve_index, orientation); + std::tie(vpp, vqp) = get_positions(vp, vq, curve_index, orientation); const FT sp = get_radius(vp); const FT sq = get_radius(vq); @@ -2049,7 +2050,7 @@ insert_balls(const Vertex_handle& vp, CGAL_precondition(sp <= sq); Bare_point vpp, vqp; - boost::tie(vpp, vqp) = get_positions(vp, vq, curve_index, d_sign); + std::tie(vpp, vqp) = get_positions(vp, vq, curve_index, d_sign); #if ! defined(CGAL_NO_PRECONDITIONS) if(sp <= 0) @@ -2749,7 +2750,7 @@ is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, curve_index == domain_.curve_index(v2->index())); Bare_point v1p, v2p; - boost::tie(v1p, v2p) = get_positions(v1, v2, curve_index, orientation); + std::tie(v1p, v2p) = get_positions(v1, v2, curve_index, orientation); FT arc_length = domain_.curve_segment_length(v1p, v2p, @@ -2816,7 +2817,7 @@ orientation_of_walk(const Vertex_handle& start, #endif Bare_point start_p, next_p; - boost::tie(start_p, next_p) = get_positions_with_unknown_orientation(start, next, curve_index); + std::tie(start_p, next_p) = get_positions_with_unknown_orientation(start, next, curve_index); #if CGAL_MESH_3_PROTECTION_DEBUG & 4 std::cerr << "positions to determine orientation: " << start_p << " " << next_p << std::endl; #endif @@ -3091,7 +3092,7 @@ is_sizing_field_correct(const Vertex_handle& v1, FT s3 = get_radius(v3); Bare_point p1, p2, p3; - boost::tie(p1, p2, p3) = get_positions(v1, v2, v3, curve_index, orientation); + std::tie(p1, p2, p3) = get_positions(v1, v2, v3, curve_index, orientation); FT D = domain_.curve_segment_length(p1, p3, curve_index, orientation); FT d = domain_.curve_segment_length(p1, p2, curve_index, orientation); diff --git a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt index aae24ad082f..9f3c5f07053 100644 --- a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_mesh_3_Tests) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt index c4c128de19b..6b90b0e0f25 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_triangulation_3_Demo) # Find CGAL diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt index d67cc64b6b1..d29a1ece79f 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_Lloyd_3_Demo) # Find includes in corresponding build directories diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index 254a7a26b11..8a4de97b43a 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -551,6 +551,24 @@ size_type number_of_stored_facets() const; /// `Periodic_triangle`, and `Periodic_tetrahedron`, which have inner type `Point`. /// @{ +/*! +Converts the `Periodic_point` `pp` (point-offset pair) to the +corresponding `Point` in \f$ \mathbb R^3\f$. +*/ +Point point(const Periodic_point& pp) const; + +/*! +Equivalent to +the call `t.point(t.periodic_point(v));` +*/ +Point point(Vertex_handle v) const; + +/*! +Equivalent to +the call `t.point(t.periodic_point(c,idx));` +*/ +Point point(Cell_handle c, int idx) const; + /*! Returns the periodic point given by vertex `v`. If `t` is represented in the 1-sheeted covering space, the offset is always diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt index f3e7a18fe8c..fb35b20f971 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_triangulation_3_Examples) find_package(CGAL REQUIRED) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 5848af0a527..516c3e7434d 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -4414,7 +4414,7 @@ test_next(const Periodic_3_triangulation_3& t1, queue.push_back(std::make_pair(c1,c2)); while(! queue.empty()) { - boost::tie(c1,c2) = queue.back(); + std::tie(c1,c2) = queue.back(); queue.pop_back(); // Precondition: c1, c2 have been registered as well as their 4 vertices. diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt index 815a9b879ee..05b76f88ab1 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_triangulation_3_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index 17ac086a9bb..ee71ca43dd8 100644 --- a/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Benchmarks) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index fc1fe3c37f5..c1caa76995d 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Demo) # Find includes in corresponding build directories diff --git a/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index 333f5b8bb70..fdd4bb5dba1 100644 --- a/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index e96c2cde310..da0ae01213d 100644 --- a/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Point_set_2/doc/Point_set_2/PackageDescription.txt b/Point_set_2/doc/Point_set_2/PackageDescription.txt index a191f6ff181..bf3a90fd689 100644 --- a/Point_set_2/doc/Point_set_2/PackageDescription.txt +++ b/Point_set_2/doc/Point_set_2/PackageDescription.txt @@ -10,7 +10,6 @@ /*! \addtogroup PkgPointSet2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Range and Neighbor Search,PkgPointSet2} \cgalPkgPicture{Point_set_2/fig/point_set.png} \cgalPkgSummaryBegin diff --git a/Point_set_2/examples/Point_set_2/CMakeLists.txt b/Point_set_2/examples/Point_set_2/CMakeLists.txt index 1647542ae82..976cbdd6252 100644 --- a/Point_set_2/examples/Point_set_2/CMakeLists.txt +++ b/Point_set_2/examples/Point_set_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_2_Examples) find_package(CGAL REQUIRED) diff --git a/Point_set_2/test/Point_set_2/CMakeLists.txt b/Point_set_2/test/Point_set_2/CMakeLists.txt index 7c16ce3b6e6..77cf12967f8 100644 --- a/Point_set_2/test/Point_set_2/CMakeLists.txt +++ b/Point_set_2/test/Point_set_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_2_Tests) find_package(CGAL REQUIRED) diff --git a/Point_set_3/examples/Point_set_3/CMakeLists.txt b/Point_set_3/examples/Point_set_3/CMakeLists.txt index a8246bf0f58..1019bcd4ef1 100644 --- a/Point_set_3/examples/Point_set_3/CMakeLists.txt +++ b/Point_set_3/examples/Point_set_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_3_Examples) # CGAL and its components diff --git a/Point_set_3/examples/Point_set_3/point_set_property.cpp b/Point_set_3/examples/Point_set_3/point_set_property.cpp index 98a32e10fce..b34f01737d0 100644 --- a/Point_set_3/examples/Point_set_3/point_set_property.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_property.cpp @@ -40,11 +40,11 @@ int main (int, char**) bool success = false; Color_map color; - boost::tie (color, success) = point_set.add_property_map ("color", black); + std::tie (color, success) = point_set.add_property_map ("color", black); assert (success); FT_map intensity; - boost::tie (intensity, success) = point_set.add_property_map ("intensity", 0.); + std::tie (intensity, success) = point_set.add_property_map ("intensity", 0.); assert (success); point_set.reserve (10); // For memory optimization diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h b/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h index 6fcffaee3d0..aa2de169bf2 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h @@ -219,86 +219,86 @@ bool write_LAS(std::ostream& os, Ushort_map intensity; bool remove_intensity; - boost::tie(intensity, remove_intensity) + std::tie(intensity, remove_intensity) = point_set.template add_property_map("intensity", 0); Uchar_map return_number; bool remove_return_number; - boost::tie(return_number, remove_return_number) + std::tie(return_number, remove_return_number) = point_set.template add_property_map("return_number", 0); Uchar_map number_of_returns; bool remove_number_of_returns; - boost::tie(number_of_returns, remove_number_of_returns) + std::tie(number_of_returns, remove_number_of_returns) = point_set.template add_property_map("number_of_returns", 0); Uchar_map scan_direction_flag; bool remove_scan_direction_flag; - boost::tie(scan_direction_flag, remove_scan_direction_flag) + std::tie(scan_direction_flag, remove_scan_direction_flag) = point_set.template add_property_map("scan_direction_flag", 0); Uchar_map edge_of_flight_line; bool remove_edge_of_flight_line; - boost::tie(edge_of_flight_line, remove_edge_of_flight_line) + std::tie(edge_of_flight_line, remove_edge_of_flight_line) = point_set.template add_property_map("edge_of_flight_line", 0); Uchar_map classification; bool remove_classification; - boost::tie(classification, remove_classification) + std::tie(classification, remove_classification) = point_set.template add_property_map("classification", 0); Uchar_map synthetic_flag; bool remove_synthetic_flag; - boost::tie(synthetic_flag, remove_synthetic_flag) + std::tie(synthetic_flag, remove_synthetic_flag) = point_set.template add_property_map("synthetic_flag", 0); Uchar_map keypoint_flag; bool remove_keypoint_flag; - boost::tie(keypoint_flag, remove_keypoint_flag) + std::tie(keypoint_flag, remove_keypoint_flag) = point_set.template add_property_map("keypoint_flag", 0); Uchar_map withheld_flag; bool remove_withheld_flag; - boost::tie(withheld_flag, remove_withheld_flag) + std::tie(withheld_flag, remove_withheld_flag) = point_set.template add_property_map("withheld_flag", 0); Float_map scan_angle; bool remove_scan_angle; - boost::tie(scan_angle, remove_scan_angle) + std::tie(scan_angle, remove_scan_angle) = point_set.template add_property_map("scan_angle", 0.); Uchar_map user_data; bool remove_user_data; - boost::tie(user_data, remove_user_data) + std::tie(user_data, remove_user_data) = point_set.template add_property_map("user_data", 0); Ushort_map point_source_ID; bool remove_point_source_ID; - boost::tie(point_source_ID, remove_point_source_ID) + std::tie(point_source_ID, remove_point_source_ID) = point_set.template add_property_map("point_source_ID", 0); Uint_map deleted_flag; bool remove_deleted_flag; - boost::tie(deleted_flag, remove_deleted_flag) + std::tie(deleted_flag, remove_deleted_flag) = point_set.template add_property_map("deleted_flag", 0); Double_map gps_time; bool remove_gps_time; - boost::tie(gps_time, remove_gps_time) + std::tie(gps_time, remove_gps_time) = point_set.template add_property_map("gps_time", 0); Ushort_map R; bool remove_R; - boost::tie(R, remove_R) = point_set.template add_property_map("R", 0); + std::tie(R, remove_R) = point_set.template add_property_map("R", 0); Ushort_map G; bool remove_G; - boost::tie(G, remove_G) = point_set.template add_property_map("G", 0); + std::tie(G, remove_G) = point_set.template add_property_map("G", 0); Ushort_map B; bool remove_B; - boost::tie(B, remove_B) = point_set.template add_property_map("B", 0); + std::tie(B, remove_B) = point_set.template add_property_map("B", 0); Ushort_map I; bool remove_I; - boost::tie(I, remove_I) = point_set.template add_property_map("I", 0); + std::tie(I, remove_I) = point_set.template add_property_map("I", 0); if(remove_R) { diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h index f4658b4926b..5cad538b3ea 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h @@ -57,7 +57,7 @@ private: PLY_property_to_point_set_property(Point_set& ps, const std::string& name) : m_name(name) { - boost::tie(m_map, boost::tuples::ignore) = ps.add_property_map(name, Type()); + m_map = ps.add_property_map(name, Type()).first; m_pmap = ps.push_property_map(m_map); } diff --git a/Point_set_3/test/Point_set_3/CMakeLists.txt b/Point_set_3/test/Point_set_3/CMakeLists.txt index b2c092e2aad..9e71a02f4d6 100644 --- a/Point_set_3/test/Point_set_3/CMakeLists.txt +++ b/Point_set_3/test/Point_set_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_3_Tests) # CGAL and its components diff --git a/Point_set_3/test/Point_set_3/point_set_test.cpp b/Point_set_3/test/Point_set_3/point_set_test.cpp index 086feabface..72563b63c54 100644 --- a/Point_set_3/test/Point_set_3/point_set_test.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test.cpp @@ -103,7 +103,7 @@ int main (int, char**) test (!(point_set.has_property_map ("color")), "point set shouldn't have colors."); Point_set::Property_map color_prop; bool garbage; - boost::tie (color_prop, garbage) = point_set.add_property_map ("color", Color()); + std::tie (color_prop, garbage) = point_set.add_property_map ("color", Color()); test (point_set.has_property_map ("color"), "point set should have colors."); for (Point_set::iterator it = point_set.begin(); it != point_set.end(); ++ it) diff --git a/Point_set_3/test/Point_set_3/point_set_test_join.cpp b/Point_set_3/test/Point_set_3/point_set_test_join.cpp index 986f1748cf1..bcd39c531bb 100644 --- a/Point_set_3/test/Point_set_3/point_set_test_join.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test_join.cpp @@ -72,7 +72,7 @@ int main (int, char**) Point_set::Property_map intensity; bool okay; - boost::tie (intensity, okay) = ps3.add_property_map("intensity", 0); + std::tie (intensity, okay) = ps3.add_property_map("intensity", 0); assert (okay); Point_set::iterator it = ps3.insert (Point (double(0), double(1), double(2)), diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 01a9ff49e64..8b5670a14d2 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_processing_3_Examples) # Find CGAL 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 f9ce5352b26..5c5cd75063c 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -388,7 +388,7 @@ create_riemannian_graph( // Add edge typename boost::graph_traits::edge_descriptor e; bool inserted; - boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), + std::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), vertex(neighbor_index, riemannian_graph), riemannian_graph); CGAL_assertion(inserted); @@ -410,7 +410,7 @@ create_riemannian_graph( { typename boost::graph_traits::edge_descriptor e; bool inserted; - boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), + std::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), vertex(source_point_index, riemannian_graph), riemannian_graph); CGAL_assertion(inserted); diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index b4389a10e2a..057375261ad 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_processing_3_Tests) # Find CGAL diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt index 3e6aeed0e53..3832688cbd9 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Poisson_surface_reconstruction_3_Examples) # Find CGAL diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h index abe83515408..488e15b0b3a 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h @@ -598,24 +598,24 @@ public: } #endif - boost::tuple special_func(const Point& p) const + std::tuple special_func(const Point& p) const { Cell_handle& hint = get_hint(); hint = m_tr->locate(p, hint); if(m_tr->is_infinite(hint)) { int i = hint->index(m_tr->infinite_vertex()); - return boost::make_tuple(hint->vertex((i+1)&3)->f(), - hint, true); + return std::make_tuple(hint->vertex((i+1)&3)->f(), + hint, true); } FT a,b,c,d; barycentric_coordinates(p,hint,a,b,c,d); - return boost::make_tuple(a * hint->vertex(0)->f() + - b * hint->vertex(1)->f() + - c * hint->vertex(2)->f() + - d * hint->vertex(3)->f(), - hint, false); + return std::make_tuple(a * hint->vertex(0)->f() + + b * hint->vertex(1)->f() + + c * hint->vertex(2)->f() + + d * hint->vertex(3)->f(), + hint, false); } /// \endcond diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h index fb0655be01c..36e56fe4d89 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h @@ -24,7 +24,7 @@ #include #include -#include +#include namespace CGAL { @@ -102,7 +102,7 @@ namespace CGAL { { const Self& oracle; - boost::tuple + std::tuple intersection_line_sphere_lambda(const Surface_3& sphere, const Point& a, const Point& b) const @@ -154,18 +154,18 @@ namespace CGAL { switch( CGAL::sign(deltaprime) ) { case ZERO: - return boost::make_tuple(1, ab_ac / ab2, 0); + return std::make_tuple(1, ab_ac / ab2, 0); case POSITIVE: { const FT sqrt_deltaprime = CGAL::sqrt(deltaprime); - return boost::make_tuple(2, - (ab_ac - sqrt_deltaprime) / ab2, - (ab_ac + sqrt_deltaprime) / ab2); + return std::make_tuple(2, + (ab_ac - sqrt_deltaprime) / ab2, + (ab_ac + sqrt_deltaprime) / ab2); } case NEGATIVE: break; } - return boost::make_tuple(0, 0, 0); + return std::make_tuple(0, 0, 0); } //end intersection_line_sphere_lambda template @@ -185,7 +185,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); const Vector ab = vector(a, b); @@ -291,7 +291,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); #ifdef CGAL_SURFACE_MESHER_DEBUG_IMPLICIT_ORACLE @@ -353,7 +353,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 && root_2 > FT(0) ) @@ -392,7 +392,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 ) diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h index 7ebcbbe814e..0be13053ada 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h @@ -286,8 +286,8 @@ namespace CGAL { Cell_handle c1, c2; bool c1_is_inf, c2_is_inf; - boost::tie(value_at_p1, c1, c1_is_inf) = surface.function().special_func(p1); - boost::tie(value_at_p2, c2, c2_is_inf) = surface.function().special_func(p2); + std::tie(value_at_p1, c1, c1_is_inf) = surface.function().special_func(p1); + std::tie(value_at_p2, c2, c2_is_inf) = surface.function().special_func(p2); // If both extremities are in the same volume component, returns // no intersection. @@ -320,7 +320,7 @@ namespace CGAL { Cell_handle c_at_mid; FT value_at_mid; bool c_is_inf; - boost::tie(value_at_mid, c_at_mid, c_is_inf) = surface.function().special_func(mid); + std::tie(value_at_mid, c_at_mid, c_is_inf) = surface.function().special_func(mid); if ( squared_distance(p1, p2) < squared_distance_bound ) // If the two points are close, then we must decide diff --git a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt index 6fdba5526cb..3592fc3e950 100644 --- a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Poisson_surface_reconstruction_3_Tests) # Find CGAL diff --git a/Polygon/examples/Polygon/CMakeLists.txt b/Polygon/examples/Polygon/CMakeLists.txt index 55e73061294..f41d86812bd 100644 --- a/Polygon/examples/Polygon/CMakeLists.txt +++ b/Polygon/examples/Polygon/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polygon/include/CGAL/Multipolygon_with_holes_2.h b/Polygon/include/CGAL/Multipolygon_with_holes_2.h index bdfd3cb47bc..9228850edf5 100644 --- a/Polygon/include/CGAL/Multipolygon_with_holes_2.h +++ b/Polygon/include/CGAL/Multipolygon_with_holes_2.h @@ -24,14 +24,14 @@ namespace CGAL { /*! \ingroup PkgPolygon2Ref * * The class `Multipolygon_with_holes_2` models the concept `MultipolygonWithHoles_2`. - * It is parameterized with two types (`Kernel` and `Container`) that are used to instantiate - * the types `Polygon_2` and `Polygon_with_holes_2`. + * It is parameterized with two types (`Kernel` and `Container_`) that are used to instantiate + * the types `Polygon_2` and `Polygon_with_holes_2`. * The latter is used to represent each polygon with holes. The former is converted to the latter. * * \cgalModels{MultipolygonWithHoles_2} */ template > + class Container_ = std::vector> class Multipolygon_with_holes_2 { public: /// \name Definition @@ -39,14 +39,15 @@ public: /// @{ /// polygon type - using Polygon_2 = CGAL::Polygon_2; + using Polygon_2 = CGAL::Polygon_2; /// polygon with holes type - using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; /// @} using Traits = Kernel; + using Container = Container_; using value_type = Polygon_with_holes_2; using Polygon_with_holes_container = std::deque; @@ -183,10 +184,10 @@ order. \relates Multipolygon_with_holes_2 */ -template +template std::ostream& operator<<(std::ostream& os, - const Multipolygon_with_holes_2& mp) { - typename Multipolygon_with_holes_2::Polygon_with_holes_const_iterator i; + const Multipolygon_with_holes_2& mp) { + typename Multipolygon_with_holes_2::Polygon_with_holes_const_iterator i; switch(IO::get_mode(os)) { case IO::ASCII : @@ -214,11 +215,11 @@ std::ostream& operator<<(std::ostream& os, } } -template -Multipolygon_with_holes_2 transform(const Transformation& t, - const Multipolygon_with_holes_2& mp) +template +Multipolygon_with_holes_2 transform(const Transformation& t, + const Multipolygon_with_holes_2& mp) { - Multipolygon_with_holes_2 result; + Multipolygon_with_holes_2 result; for(const auto& pwh : mp.polygons_with_holes()){ result.add_polygon_with_holes(transform(t, pwh)); } diff --git a/Polygon/include/CGAL/Polygon_2.h b/Polygon/include/CGAL/Polygon_2.h index c3300d939fa..cfe9b4f3472 100644 --- a/Polygon/include/CGAL/Polygon_2.h +++ b/Polygon/include/CGAL/Polygon_2.h @@ -60,8 +60,8 @@ namespace CGAL { /// algorithms were used and what complexity they have. /// -template > +template > class Polygon_2 { public: @@ -70,33 +70,33 @@ class Polygon_2 { /// @{ /// The traits type. - typedef Traits_P Traits; + typedef Traits_ Traits; /// The container type. - typedef Container_P Container; + typedef Container_ Container; /// The number type of the coordinates of the points of the polygon. - typedef typename Traits_P::FT FT; + typedef typename Traits_::FT FT; /// The point type of the polygon. - typedef typename Traits_P::Point_2 Point_2; + typedef typename Traits_::Point_2 Point_2; /// The type of a segment between two points of the polygon. - typedef typename Traits_P::Segment_2 Segment_2; + typedef typename Traits_::Segment_2 Segment_2; /// @} - typedef typename Container_P::difference_type difference_type; - typedef typename Container_P::value_type value_type; - typedef typename Container_P::pointer pointer; - typedef typename Container_P::reference reference; - typedef typename Container_P::const_reference const_reference; + typedef typename Container_::difference_type difference_type; + typedef typename Container_::value_type value_type; + typedef typename Container_::pointer pointer; + typedef typename Container_::reference reference; + typedef typename Container_::const_reference const_reference; //-------------------------------------------------------// // this intermediary step is required by Sun C++ 4.1 - typedef typename Container_P::iterator iterator; - typedef typename Container_P::const_iterator const_iterator; + typedef typename Container_::iterator iterator; + typedef typename Container_::const_iterator const_iterator; //-------------------------------------------------------// typedef typename Container::iterator Vertex_const_iterator; - typedef Polygon_circulator Vertex_const_circulator; + typedef Polygon_circulator Vertex_const_circulator; /// \name Iterators /// @@ -141,11 +141,11 @@ class Polygon_2 { // #else typedef Vertex_const_circulator Vertex_circulator; - typedef Polygon_2_edge_iterator Edge_const_iterator; - typedef Polygon_2_const_edge_circulator Edge_const_circulator; + typedef Polygon_2_edge_iterator Edge_const_iterator; + typedef Polygon_2_const_edge_circulator Edge_const_circulator; - typedef Polygon_2_edge_iterator Vertex_pair_iterator; typedef Iterator_range Edges; @@ -162,7 +162,7 @@ class Polygon_2 { Polygon_2(const Traits & p_traits) : traits(p_traits) {} // Move constructor - // Polygon_2(Polygon_2&& polygon) = default; + // Polygon_2(Polygon_2&& polygon) = default; /// Creates a polygon with vertices from the sequence /// defined by the range \c [first,last). @@ -260,7 +260,7 @@ class Polygon_2 { { if (size() <= 1) return; - typename Container_P::iterator i = d_container.begin(); + typename Container_::iterator i = d_container.begin(); std::reverse(++i, d_container.end()); } @@ -500,32 +500,32 @@ class Polygon_2 { { return d_container.empty(); } /// Returns a const reference to the sequence of vertices of the polygon. - const Container_P& container() const + const Container_& container() const { return d_container; } /// Returns a reference to the sequence of vertices of the polygon. - Container_P& container() + Container_& container() { return d_container; } /// Returns an iterator to the first vertex of the polygon. - typename Container_P::iterator begin() + typename Container_::iterator begin() { return container().begin(); } /// Returns an iterator to the element after the last vertex of the polygon. - typename Container_P::iterator end() + typename Container_::iterator end() { return container().end(); } /// Returns a const iterator to the first vertex of the polygon. - const typename Container_P::const_iterator begin() const + const typename Container_::const_iterator begin() const { return container().begin(); } /// Returns a const iterator to the element after the last vertex of the polygon. - const typename Container_P::const_iterator end() const + const typename Container_::const_iterator end() const { return container().end(); } @@ -544,14 +544,14 @@ class Polygon_2 { /// @} - bool identical(const Polygon_2 &q) const + bool identical(const Polygon_2 &q) const { return this == &q; } - Traits_P const &traits_member() const { return traits;} + Traits_ const &traits_member() const { return traits;} private: - Container_P d_container; - Traits_P traits; + Container_ d_container; + Traits_ traits; }; @@ -563,23 +563,23 @@ class Polygon_2 { /// equal to the vertices of `p1`. Note that the template argument /// `%Container` of `p1` and `p2` may be different. /// \memberof Polygon_2 -template -bool operator==( const Polygon_2 &p1, - const Polygon_2 &p2 ); +template +bool operator==( const Polygon_2 &p1, + const Polygon_2 &p2 ); /// Test for inequality. /// \memberof Polygon_2 -template +template inline bool -operator!=(const Polygon_2 &p1, - const Polygon_2 &p2); +operator!=(const Polygon_2 &p1, + const Polygon_2 &p2); /// Returns the image of the polygon \c p under the transformation \c t. /// \relates Polygon_2 -template -Polygon_2 -transform(const Transformation& t, const Polygon_2& p); +template +Polygon_2 +transform(const Transformation& t, const Polygon_2& p); /// @} // global operators @@ -591,14 +591,14 @@ transform(const Transformation& t, const Polygon_2& p); /// Reads a polygon from stream `is` and assigns it to `p`. /// \pre The extract operator must be defined for `Point_2`. /// \relates Polygon_2 -template -std::istream &operator>>(std::istream &is, Polygon_2& p); +template +std::istream &operator>>(std::istream &is, Polygon_2& p); /// Inserts the polygon `p` into the stream `os`. /// \pre The insert operator must be defined for `Point_2`. /// \relates Polygon_2 -template -std::ostream &operator<<(std::ostream &os, const Polygon_2& p); +template +std::ostream &operator<<(std::ostream &os, const Polygon_2& p); /// @} // IO @@ -612,11 +612,11 @@ std::ostream &operator<<(std::ostream &os, const Polygon_2 namespace CGAL { -template +template inline bool -operator!=(const Polygon_2 &x, - const Polygon_2 &y) +operator!=(const Polygon_2 &x, + const Polygon_2 &y) { return !(x==y); } diff --git a/Polygon/include/CGAL/Polygon_with_holes_2.h b/Polygon/include/CGAL/Polygon_with_holes_2.h index 032b2c52084..7d581a28150 100644 --- a/Polygon/include/CGAL/Polygon_with_holes_2.h +++ b/Polygon/include/CGAL/Polygon_with_holes_2.h @@ -29,21 +29,22 @@ namespace CGAL { The class `Polygon_with_holes_2` models the concept `GeneralPolygonWithHoles_2`. It represents a linear polygon with holes. It is parameterized with two -types (`Kernel` and `Container`) that are used to instantiate -the type `Polygon_2`. This poygon type is used to +types (`Kernel` and `Container_`) that are used to instantiate +the type `Polygon_2`. This polygon type is used to represent the outer boundary and the boundary of the holes (if any exist). \cgalModels{GeneralPolygonWithHoles_2} */ template > + class Container_ = std::vector > class Polygon_with_holes_2 : - public General_polygon_with_holes_2 > + public General_polygon_with_holes_2 > { public: - - typedef CGAL::Polygon_2 Polygon_2; + typedef Kernel Traits; + typedef Container_ Container; + typedef CGAL::Polygon_2 Polygon_2; typedef General_polygon_with_holes_2 Base; typedef typename Base::Hole_const_iterator Hole_const_iterator; typedef typename Base::Size Size; @@ -90,11 +91,11 @@ public: }; - template - Polygon_with_holes_2 transform(const Transformation& t, - const Polygon_with_holes_2& pwh) + template + Polygon_with_holes_2 transform(const Transformation& t, + const Polygon_with_holes_2& pwh) { - Polygon_with_holes_2 result(transform(t, pwh.outer_boundary())); + Polygon_with_holes_2 result(transform(t, pwh.outer_boundary())); for(const auto& hole : pwh.holes()){ result.add_hole(transform(t, hole)); } diff --git a/Polygon/test/Polygon/CMakeLists.txt b/Polygon/test/Polygon/CMakeLists.txt index 3f05c88ad8d..f8f4d524748 100644 --- a/Polygon/test/Polygon/CMakeLists.txt +++ b/Polygon/test/Polygon/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_Tests) find_package(CGAL REQUIRED) diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt index 11c27fb7f81..c24a90d7904 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_mesh_processing) # CGAL and its components diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index 6b74ce9696a..50f198e8317 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -25,7 +25,7 @@ /// \ingroup PkgPolygonMeshProcessingRef /// \defgroup PMP_measure_grp Geometric Measure Functions -/// Functions to compute lengths of edges and borders, areas of faces and patches, as well as volumes of closed meshes. +/// Functions to compute discrete curvatures, lengths of edges and borders, areas of faces and patches, volumes of closed meshes. /// \ingroup PkgPolygonMeshProcessingRef /// \defgroup PMP_orientation_grp Orientation Functions @@ -239,6 +239,11 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polygon_mesh_processing::sample_triangle_mesh()` \cgalCRPSection{Geometric Measure Functions} +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::angle_sum()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvatures()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvature()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_mean_curvature()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_mean_curvatures()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::edge_length()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::squared_edge_length()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::face_area()` \endlink @@ -248,7 +253,6 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::face_border_length()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::longest_border()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::centroid()` \endlink -- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::match_faces()` \endlink \cgalCRPSection{Feature Detection Functions} - `CGAL::Polygon_mesh_processing::sharp_edges_segmentation()` 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 08d8d798f41..c4bf5a424fc 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 @@ -1225,6 +1225,17 @@ compute the curvatures on a specific vertex. \cgalExample{Polygon_mesh_processing/interpolated_corrected_curvatures_vertex.cpp} +\subsection DCurvartures Discrete Curvatures + +The package also provides methods to compute the standard, non-interpolated discrete mean and Gaussian +curvatures on triangle meshes, based on the work of Meyer et al. \cgalCite{cgal:mdsb-ddgot-02}. +These curvatures are computed at each vertex of the mesh, and are based on the angles of the incident +triangles. The functions are: +- `CGAL::Polygon_mesh_processing::discrete_mean_curvature()` +- `CGAL::Polygon_mesh_processing::discrete_mean_curvatures()` +- `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvature()` +- `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvatures()` + **************************************** \section PMPSlicer Slicer diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 6f010df3bab..cbeb71cb6b9 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_mesh_processing_Examples) # CGAL and its components diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp index ac8378781fe..e549dad832d 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp @@ -32,11 +32,11 @@ int main(int argc, char* argv[]) Mesh::Property_map mean_curvature_map, Gaussian_curvature_map; - boost::tie(mean_curvature_map, created) = + std::tie(mean_curvature_map, created) = smesh.add_property_map("v:mean_curvature_map", 0); assert(created); - boost::tie(Gaussian_curvature_map, created) = + std::tie(Gaussian_curvature_map, created) = smesh.add_property_map("v:Gaussian_curvature_map", 0); assert(created); @@ -44,7 +44,7 @@ int main(int argc, char* argv[]) Mesh::Property_map> principal_curvatures_and_directions_map; - boost::tie(principal_curvatures_and_directions_map, created) = + std::tie(principal_curvatures_and_directions_map, created) = smesh.add_property_map> ("v:principal_curvatures_and_directions_map", { 0, 0, Epic_kernel::Vector_3(0,0,0), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/curvature.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/curvature.h new file mode 100644 index 00000000000..f612535dfc5 --- /dev/null +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/curvature.h @@ -0,0 +1,475 @@ +// Copyright (c) 2021 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) : Andreas Fabri, +// Mael Rouxel-Labbé + +#ifndef CGAL_PMP_CURVATURE_H +#define CGAL_PMP_CURVATURE_H + +#include + +#include +#include +#include +#include + +#include +#include + +namespace CGAL { +namespace Polygon_mesh_processing { + +/** + * \ingroup PMP_measure_grp + * + * computes the sum of the angles around a vertex. + * + * The angle sum is given in degrees. + * + * @tparam PolygonMesh a model of `FaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param v the vertex whose sum of angles is computed + * @param pmesh the polygon mesh to which `v` belongs + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `pmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, pmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must provide the nested functor `Compute_approximate_angle_3`, + * model of `Kernel::ComputeApproximateAngle_3`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @return the sum of angles around `v`. The return type `FT` is a number type either deduced + * from the `geom_traits` \ref bgl_namedparameters "Named Parameters" if provided, + * or the geometric traits class deduced from the point property map of `pmesh`. + * + * \warning This function involves trigonometry. + */ +template +#ifdef DOXYGEN_RUNNING +FT +#else +typename GetGeomTraits::type::FT +#endif +angle_sum(typename boost::graph_traits::vertex_descriptor v, + const PolygonMesh& pmesh, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + using Geom_traits = typename GetGeomTraits::type; + using FT = typename Geom_traits::FT; + + typename GetVertexPointMap::const_type + vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(CGAL::vertex_point, pmesh)); + + Geom_traits gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + CGAL_precondition(is_valid_vertex_descriptor(v, pmesh)); + + typename Geom_traits::Compute_approximate_angle_3 approx_angle = gt.compute_approximate_angle_3_object(); + + FT angle_sum = 0; + for(auto h : halfedges_around_source(v, pmesh)) + { + if(is_border(h, pmesh)) + continue; + + angle_sum += approx_angle(get(vpm, target(h, pmesh)), + get(vpm, source(h, pmesh)), + get(vpm, source(prev(h,pmesh), pmesh))); + } + + return angle_sum; +} + +// Discrete Gaussian Curvature + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete Gaussian curvature at a vertex. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete Gaussian curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param v the vertex whose discrete Gaussian curvature is being computed + * @param tmesh the triangle mesh to which `v` belongs + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @return the discrete Gaussian curvature at `v`. The return type `FT` is a number type either deduced + * from the `geom_traits` \ref bgl_namedparameters "Named Parameters" if provided, + * or the geometric traits class deduced from the point property map of `tmesh`. + * + * \warning This function involves trigonometry. + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +#ifdef DOXYGEN_RUNNING +FT +#else +typename GetGeomTraits::type::FT +#endif +discrete_Gaussian_curvature(typename boost::graph_traits::vertex_descriptor v, + const TriangleMesh& tmesh, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + using GeomTraits = typename GetGeomTraits::type; + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + using VertexPointMap = typename GetVertexPointMap::const_type; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + GeomTraits gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + VertexPointMap vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(vertex_point, tmesh)); + + typename GeomTraits::Construct_vector_3 vector = + gt.construct_vector_3_object(); + typename GeomTraits::Construct_cross_product_vector_3 cross_product = + gt.construct_cross_product_vector_3_object(); + typename GeomTraits::Compute_scalar_product_3 scalar_product = + gt.compute_scalar_product_3_object(); + typename GeomTraits::Compute_squared_length_3 squared_length = + gt.compute_squared_length_3_object(); + + FT angle_sum = 0; + + for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) + { + if(is_border(h, tmesh)) + continue; + + const Vector_3 v0 = vector(get(vpm, v), get(vpm, target(next(h, tmesh), tmesh))); // p1p2 + const Vector_3 v1 = vector(get(vpm, v), get(vpm, source(h, tmesh))); // p1p0 + + const FT dot = scalar_product(v0, v1); + const Vector_3 cross = cross_product(v0, v1); + const FT sqcn = squared_length(cross); + if(is_zero(dot)) + { + angle_sum += CGAL_PI/FT(2); + } + else + { + if(is_zero(sqcn)) // collinear + { + if(dot < 0) + angle_sum += CGAL_PI; + // else + // angle_sum += 0; + } + else + { + angle_sum += std::atan2(CGAL::approximate_sqrt(sqcn), dot); + } + } + } + + Weights::Secure_cotangent_weight_with_voronoi_area wc(tmesh, vpm, gt); + + const FT gaussian_curvature = (2 * CGAL_PI - angle_sum) / wc.voronoi(v); + + return gaussian_curvature; +} + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete Gaussian curvatures at the vertices of a mesh. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete Gaussian curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam VertexCurvatureMap must be a model of `WritablePropertyMap` with key type + * `boost::graph_traits::%vertex_descriptor` and value type `FT`, + * which is either `geom_traits::FT` if this named parameter is provided, + * or `kernel::FT` with the kernel deduced from from the point property map of `tmesh`. + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param tmesh the triangle mesh to which `v` belongs + * @param vcm the property map that contains the computed discrete curvatures + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \warning This function involves trigonometry. + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +void discrete_Gaussian_curvatures(const TriangleMesh& tmesh, + VertexCurvatureMap vcm, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + + for(vertex_descriptor v : vertices(tmesh)) + { + put(vcm, v, discrete_Gaussian_curvature(v, tmesh, np)); + // std::cout << "curvature: " << get(vcm, v) << std::endl; + } +} + +// Discrete Mean Curvature + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete mean curvature at a vertex. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete mean curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param v the vertex whose discrete mean curvature is being computed + * @param tmesh the triangle mesh to which `v` belongs + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @return the discrete mean curvature at `v`. The return type `FT` is a number type either deduced + * from the `geom_traits` \ref bgl_namedparameters "Named Parameters" if provided, + * or the geometric traits class deduced from the point property map of `tmesh`. + * + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +#ifdef DOXYGEN_RUNNING +FT +#else +typename GetGeomTraits::type::FT +#endif +discrete_mean_curvature(typename boost::graph_traits::vertex_descriptor v, + const TriangleMesh& tmesh, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + using GeomTraits = typename GetGeomTraits::type; + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + using VertexPointMap = typename GetVertexPointMap::const_type; + using Point_ref = typename boost::property_traits::reference; + + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + GeomTraits gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + VertexPointMap vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(vertex_point, tmesh)); + +#if 0 + typename GeomTraits::Compute_squared_distance_3 squared_distance = + gt.compute_squared_distance_3_object(); + typename GeomTraits::Compute_approximate_dihedral_angle_3 dihedral_angle = + gt.compute_approximate_dihedral_angle_3_object(); + + const FT two_pi = 2 * CGAL_PI; + + FT hi = 0; + for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) + { + const Point_3& p = get(vpm, source(h, tmesh)); + const Point_3& q = get(vpm, target(h, tmesh)); + const Point_3& r = get(vpm, target(next(h, tmesh), tmesh)); + const Point_3& s = get(vpm, target(next(opposite(h, tmesh), tmesh), tmesh)); + const FT l = squared_distance(p,q); + + FT phi = CGAL_PI * dihedral_angle(p, q, r, s) / FT(180); + + if(phi < 0) + phi += two_pi; + if(phi > two_pi) + phi = two_pi; + + hi += FT(0.5) * l * (CGAL_PI - phi); + } + + return FT(0.5) * hi; +#else + typename GeomTraits::Construct_vector_3 vector = + gt.construct_vector_3_object(); + typename GeomTraits::Construct_sum_of_vectors_3 vector_sum = + gt.construct_sum_of_vectors_3_object(); + typename GeomTraits::Construct_scaled_vector_3 scaled_vector = + gt.construct_scaled_vector_3_object(); + typename GeomTraits::Compute_squared_length_3 squared_length = + gt.compute_squared_length_3_object(); + + Weights::Secure_cotangent_weight_with_voronoi_area wc(tmesh, vpm, gt); + + Vector_3 kh = vector(CGAL::NULL_VECTOR); + for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) + { + const vertex_descriptor v1 = source(h, tmesh); + + const Point_ref p0 = get(vpm, v); + const Point_ref p1 = get(vpm, v1); + + FT local_c = 0; + if(!is_border(h, tmesh)) + { + const vertex_descriptor v2 = target(next(h, tmesh), tmesh); + const Point_ref p2 = get(vpm, v2); + local_c += Weights::cotangent_3_clamped(p0, p2, p1, gt); + } + + if(!is_border(opposite(h, tmesh), tmesh)) + { + const vertex_descriptor v3 = target(next(opposite(h, tmesh), tmesh), tmesh); + const Point_ref p3 = get(vpm, v3); + local_c += Weights::cotangent_3_clamped(p1, p3, p0, gt); + } + + kh = vector_sum(kh, scaled_vector(vector(p0, p1), local_c)); + } + + const FT khn = CGAL::approximate_sqrt(squared_length(kh)); + const FT va = wc.voronoi(v); + CGAL_assertion(!is_zero(va)); + + const FT mean_curvature = khn / (FT(4) * va); + return mean_curvature; +#endif +} + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete mean curvatures at the vertices of a mesh. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete mean curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam VertexCurvatureMap must be a model of `WritablePropertyMap` with key type + * `boost::graph_traits::%vertex_descriptor` and value type `FT`, + * which is either `geom_traits::FT` if this named parameter is provided, + * or `kernel::FT` with the kernel deduced from from the point property map of `tmesh`. + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param tmesh the triangle mesh to which `v` belongs + * @param vcm the property map that contains the computed discrete curvatures + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +void discrete_mean_curvatures(const TriangleMesh& tmesh, + VertexCurvatureMap vcm, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + + for(vertex_descriptor v : vertices(tmesh)) + put(vcm, v, discrete_mean_curvature(v, tmesh, np)); +} + +} // namespace Polygon_mesh_processing +} // namespace CGAL + +#endif //CGAL_PMP_CURVATURE_H 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 925303c6f32..60e20772372 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 @@ -2515,7 +2515,7 @@ public: typedef std::pair Hedge_pair; std::vector< Hedge_pair> hedges_to_link; typename CGAL::Halfedge_around_target_iterator hit, end; - boost::tie(hit,end) = halfedges_around_target(vd, tm1); + std::tie(hit,end) = halfedges_around_target(vd, tm1); for(; hit!=end; ++hit) { // look for a border halfedge incident to the non-manifold vertex that will not be 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 20e95e59610..38053bee8fe 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 @@ -67,7 +67,7 @@ void assign_tolerance_with_local_edge_length_bound(const HalfedgeRange& halfedge { const vertex_descriptor vd = target(hd, mesh); CGAL::Halfedge_around_target_iterator hit, hend; - boost::tie(hit, hend) = CGAL::halfedges_around_target(vd, mesh); + std::tie(hit, hend) = CGAL::halfedges_around_target(vd, mesh); CGAL_assertion(hit != hend); FT sq_length = gt.compute_squared_distance_3_object()(get(vpm, source(*hit, mesh)), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index c8653c0196d..7e804e6d094 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -1450,7 +1450,7 @@ void build_AABB_tree(const TriangleMesh& tm, >::value>* = 0) { typename boost::graph_traits::face_iterator ffirst, fbeyond; - boost::tie(ffirst, fbeyond) = faces(tm); + std::tie(ffirst, fbeyond) = faces(tm); outTree.rebuild(ffirst, fbeyond, tm, wrapped_vpm); outTree.build(); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index 44b52f55548..1e442ae768f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_mesh_processing_Tests) # CGAL and its components @@ -28,6 +28,7 @@ create_single_source_cgal_program("test_stitching.cpp") create_single_source_cgal_program("remeshing_test.cpp") create_single_source_cgal_program("remeshing_with_isolated_constraints_test.cpp" ) create_single_source_cgal_program("measures_test.cpp") +create_single_source_cgal_program("test_discrete_curvatures.cpp") create_single_source_cgal_program("triangulate_faces_test.cpp") create_single_source_cgal_program("triangulate_faces_hole_filling_dt3_test.cpp") create_single_source_cgal_program("triangulate_faces_hole_filling_all_search_test.cpp") diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_discrete_curvatures.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_discrete_curvatures.cpp new file mode 100644 index 00000000000..d37bf7471ad --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_discrete_curvatures.cpp @@ -0,0 +1,146 @@ +#include +#include +#include + +#include + +#include + +#include +#include + +#define ABS_ERROR 1e-6 + +namespace PMP = CGAL::Polygon_mesh_processing; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef K::FT FT; +typedef CGAL::Surface_mesh SMesh; +typedef CGAL::Polyhedron_3 Polyhedron; + +struct Average_test_info +{ + FT mean_curvature_avg; + FT gaussian_curvature_avg; + FT tolerance = 0.9; + + Average_test_info(FT mean_curvature_avg, + FT gaussian_curvature_avg) + : mean_curvature_avg(mean_curvature_avg), + gaussian_curvature_avg(gaussian_curvature_avg) + { } +}; + +bool passes_comparison(FT result, FT expected, FT tolerance) +{ + std::cout << "result: " << result << std::endl; + std::cout << "expected: " << expected << std::endl; + + if(abs(expected) < ABS_ERROR && abs(result) < ABS_ERROR) + return true; // expected 0, got 0 + else if (abs(expected) < ABS_ERROR) + return false; // expected 0, got non-0 + + return (std::min)(result, expected) / (std::max)(result, expected) > tolerance; +} + +template +void test_curvatures(std::string mesh_path, + Average_test_info test_info) +{ + std::cout << "test discrete curvatures of " << mesh_path << std::endl; + std::cout << "mesh type: " << typeid(mesh_path).name() << std::endl; + + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + TriangleMesh tmesh; + const std::string filename = CGAL::data_file_path(mesh_path); + + if(!CGAL::IO::read_polygon_mesh(filename, tmesh) || faces(tmesh).size() == 0) + { + std::cerr << "Invalid input file." << std::endl; + std::exit(1); + } + + typename boost::property_map>::type + mean_curvature_map = get(CGAL::dynamic_vertex_property_t(), tmesh), + gaussian_curvature_map = get(CGAL::dynamic_vertex_property_t(), tmesh); + + PMP::discrete_mean_curvatures(tmesh, mean_curvature_map); + PMP::discrete_Gaussian_curvatures(tmesh, gaussian_curvature_map); + + FT mean_curvature_avg = 0, gaussian_curvature_avg = 0; + for(vertex_descriptor v : vertices(tmesh)) + { + mean_curvature_avg += get(mean_curvature_map, v); + gaussian_curvature_avg += get(gaussian_curvature_map, v); + } + + mean_curvature_avg /= vertices(tmesh).size(); + gaussian_curvature_avg /= vertices(tmesh).size(); + + std::cout << "checking mean curvature..." << std::endl; + assert(passes_comparison(mean_curvature_avg, test_info.mean_curvature_avg, test_info.tolerance)); + + std::cout << "checking Gaussian curvature..." << std::endl; + assert(passes_comparison(gaussian_curvature_avg, test_info.gaussian_curvature_avg, test_info.tolerance)); +} + +template +void test_angle_sums(const std::string mesh_path, + const std::vector& expected_values) +{ + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + PolygonMesh pmesh; + const std::string filename = CGAL::data_file_path(mesh_path); + + if(!CGAL::IO::read_polygon_mesh(filename, pmesh) || faces(pmesh).size() == 0) + { + std::cerr << "Invalid input file." << std::endl; + std::exit(1); + } + + std::size_t pos = 0; + for(vertex_descriptor v : vertices(pmesh)) + { + FT angle_sum = PMP::angle_sum(v, pmesh, + CGAL::parameters::geom_traits(K()) + .vertex_point_map(get(CGAL::vertex_point, pmesh))); + assert(passes_comparison(angle_sum, expected_values[pos++], 0.9)); + } +} + +int main(int, char**) +{ + // testing on a simple sphere(r = 0.5), on both Polyhedron & SurfaceMesh: + // Expected: Mean Curvature = 2, Gaussian Curvature = 4 + test_curvatures("meshes/sphere.off", Average_test_info(2, 4)); + test_curvatures("meshes/sphere.off", Average_test_info(2, 4)); + + // testing on a simple sphere(r = 10), on both Polyhedron & SurfaceMesh: + // Expected: Mean Curvature = 0.1, Gaussian Curvature = 0.01 + test_curvatures("meshes/sphere966.off", Average_test_info(0.1, 0.01)); + test_curvatures("meshes/sphere966.off", Average_test_info(0.1, 0.01)); + + // testing on a simple half cylinder(r = 1), on both Polyhedron & SurfaceMesh: + // Expected: Mean Curvature = 0.5, Gaussian Curvature = 0 + // To be tested once the discrete curvatures are well defined for boundary vertices + // test_curvatures("meshes/cylinder.off", Average_test_info(0.5, 0)); + // test_curvatures("meshes/cylinder.off", Average_test_info(0.5, 0)); + + test_angle_sums("meshes/quad.off", std::vector(4, 90)); + test_angle_sums("meshes/quad.off", std::vector(4, 90)); + + test_angle_sums("meshes/regular_tetrahedron.off", std::vector(4, 180)); + test_angle_sums("meshes/regular_tetrahedron.off", std::vector(4, 180)); + + test_angle_sums("meshes/cube_quad.off", std::vector(8, 270)); + test_angle_sums("meshes/cube_quad.off", std::vector(8, 270)); + + test_angle_sums("meshes/cube_poly.off", std::vector(8, 270)); + test_angle_sums("meshes/cube_poly.off", std::vector(8, 270)); + + std::cout << "Done." << std::endl; + return EXIT_SUCCESS; +} diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp index 412443a42c7..a15258b0fc9 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp @@ -9,8 +9,9 @@ #include +#include #include -#include +#include #define ABS_ERROR 1e-6 @@ -181,7 +182,7 @@ void test_average_curvatures(std::string mesh_path, int main() { // testing on a simple sphere(r = 0.5), on both Polyhedron & SurfaceMesh: - // For this mesh, ina addition to the whole mesh functions, we also compare against the single vertex + // For this mesh, in addition to the whole mesh functions, we also compare against the single vertex // curvature functions to make sure the produce the same results // Expected: Mean Curvature = 2, Gaussian Curvature = 4, Principal Curvatures = 2 & 2 so 2 on avg. test_average_curvatures("meshes/sphere.off", Average_test_info(2, 4, 2), true); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp index b2250c03641..e33c34e45cb 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp @@ -378,7 +378,7 @@ void test_predicates(const G& g, CGAL::Random& rnd) // --------------------------------------------------------------------------- int max = 1000, counter = 0; typename boost::graph_traits::halfedge_iterator hit, hend; - boost::tie(hit, hend) = halfedges(g); + std::tie(hit, hend) = halfedges(g); for(; hit!=hend; ++hit) { const halfedge_descriptor h = *hit; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp index 17228d4603f..716a5a81654 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp @@ -78,7 +78,7 @@ void test_needles_and_caps(const std::string fname) const FT eps = std::numeric_limits::epsilon(); face_iterator fit, fend; - boost::tie(fit, fend) = faces(mesh); + std::tie(fit, fend) = faces(mesh); // (0 0 0) -- (1 0 0) -- (1 1 0) (90° cap angle) face_descriptor f = *fit; diff --git a/Polygon_repair/doc/Polygon_repair/PackageDescription.txt b/Polygon_repair/doc/Polygon_repair/PackageDescription.txt index 0bd41658ad4..3a311dd0cd1 100644 --- a/Polygon_repair/doc/Polygon_repair/PackageDescription.txt +++ b/Polygon_repair/doc/Polygon_repair/PackageDescription.txt @@ -1,10 +1,11 @@ -// PRETTY PACKAGE NAME should equal the project title in Doxyfile.in - /// \defgroup PkgPolygonRepairRef 2D Polygon Repair Reference /// \defgroup PkgPolygonRepairFunctions Functions /// \ingroup PkgPolygonRepairRef +/// \defgroup PkgPolygonRepairRules Repair Rules +/// \ingroup PkgPolygonRepairRef + /*! \addtogroup PkgPolygonRepairRef @@ -15,7 +16,8 @@ \cgalPkgAuthors{Ken Arroyo Ohori} \cgalPkgDesc{This package provides algorithms to repair 2D polygons, polygons with holes, and multipolygons with holes, by selecting faces of the arrangement of the input based on a selection rule. -Currently, only the even-odd rule is provided. } +The even-odd rule and the non-zero rule are provided for dealing with self intersections. +The %union and the %intersection rule enable to combine similar polygons. } \cgalPkgManuals{Chapter_2D_Polygon_repair,PkgPolygonRepairRef} \cgalPkgSummaryEnd @@ -32,7 +34,12 @@ Currently, only the even-odd rule is provided. } \cgalCRPSection{Functions} - `CGAL::Polygon_repair::repair()` +- `CGAL::Polygon_repair::join()` +- `CGAL::Polygon_repair::intersect()` -\cgalCRPSection{Simplification Rules} +\cgalCRPSection{Repair Rules} - `CGAL::Polygon_repair::Even_odd_rule` +- `CGAL::Polygon_repair::Non_zero_rule` +- `CGAL::Polygon_repair::Union_rule` +- `CGAL::Polygon_repair::Intersection_rule` */ diff --git a/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt b/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt index 26b6f6d62c7..f837f18e9eb 100644 --- a/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt +++ b/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt @@ -9,20 +9,25 @@ namespace CGAL { \section SectionPolygonRepair_Introduction Introduction -This package implements a polygon repair method. Starting from possibly +This package implements polygon repair methods. Starting from possibly invalid input in the form of a polygon, polygon with holes or multipolygon with holes, the method computes an arrangement of the input edges, labels each face according to what it represents (exterior, polygon interior or hole), and reconstructs the polygon(s) represented by the arrangement. The method returns valid output stored in a multipolygon with holes. -Different arrangement and labelling heuristics are possible, but -currently only the even-odd rule is implemented in this package. -This rule results in areas that are alternately assigned as polygon +Different labeling heuristics are possible. This package offers +the even-odd rule, the non-zero rule, the union rule, +as well as the intersection rule. +The even-odd rule results in areas that are alternately assigned as polygon interiors and exterior/holes each time that an input edge is passed. It does not distinguish between edges that are part of outer boundaries -from those of inner boundaries. In a next version we will add the -winding number rule. +from those of inner boundaries. +The non-zero rule results in areas with a non-zero winding number. +The union and intersection rules are useful when given +two or more similar valid polygons with holes. +The union rule results in areas that are contained in at least one of the input polygons with holes. +Similarly, the intersection rule results in areas that are contained in all input polygons with holes. \section SectionPolygonRepair_Definitions Definitions @@ -63,7 +68,51 @@ Invalid: (a) self-intersecting polygon self-intersection, (b) self-touching poly with overlapping polygons, and (h) multipolygon with polygons that touch at an edge. \cgalFigureEnd -\subsection SubsectionPolygonRepair_Output Stricter Conditions for Output + +\section SectionPolygonRepair_EvenOdd Even-Odd and Non-Zero Rule + +While the even-odd rule switches between inside/outside at each edge only taking +into account multiplicity, the non-zero rule takes also into account +the orientation of the edge. + +For some configurations this leads to different results, as can be seen in the figure below. + +\cgalFigureBegin{WindingNonZeroDifferent, WindingNonZeroDifferent.svg} +Input (left), non-zero (middle) even-odd (right). +\cgalFigureEnd + +And there are other configurations where the two rules lead to the same result. + +\cgalFigureBegin{WindingNonZero, WindingNonZero.svg} +Input (left), non-zero and even-odd (right). +\cgalFigureEnd + +A valid polygon with holes, obviously has the same result with both rules applied +as it is just the identity. However an invalid multipolygon with one polygon +enclosing the other one results in the union of the two, that is the enclosing one +for the non-zero rule, while it results in a polygon with hole for the even-odd rule. + +\cgalFigureBegin{MultipolygonHole, MultipolygonHole.svg} +Input (left), non-zero (middle) even-odd (right). +\cgalFigureEnd + +\section SectionPolygonRepair_UnionIntersection Union and Intersection Rule + +Given several valid polygons these rules apply a %Boolean operation: +In the arrangement of two valid multipolygons with holes, the faces that are in any and both multipolygons +with holes are in the resulting multipolygon with holes for a union and intersection, respectively. + +While this %Boolean operation works for any two valid multipolygons, in the scope of repairing +it serves to obtain an approximation from outside and inside when applying union and intersection, respectively, +when the input is similar. + +\cgalFigureBegin{UnionIntersection, UnionIntersection.svg} +Union (top) and Intersection (bottom). +\cgalFigureEnd + + + +\section SubsectionPolygonRepair_Output Notes on the Output The conditions listed above are sufficient to define valid polygons, polygons with holes and multipolygons with holes for most applications. However, in @@ -81,64 +130,10 @@ order - The polygons with holes of a multipolygon with holes are also stored in lexicographic order -\section SectionPolygonRepair_Algorithm Algorithm - -Broadly, the algorithm consists of three steps: - --# Arrangement: the edges in the polygon, polygon with -holes or multipolygon with holes are added as edges in the arrangement. --# Labeling of the faces: the resulting faces are labeled with ids -according to what they represent (exterior, polygon interior or hole). --# Reconstruction of the multipolygon: each boundary is reconstructed, -then these are assembled into individual polygons with holes and put into a -single multipolygon with holes. - -\cgalFigureBegin{inout, inout.svg} -Examples of polygons with holes (a-d) and multipolygons with holes -(e-h) before (left) and after (right) being repaired. -\cgalFigureEnd - -\subsection SubsectionPolygonRepair_Arrangement Arrangement - -For the purposes of the repair operation, the input polygon, polygon with holes -or multipolygon is merely used as a container of input line segments. These line -segments are added to the arrangement as edges. Internally, this is done using -a constrained triangulation where they are added as constraints. - -With the even-odd rule, only the edges that are present an odd number of -times in the input will be edges in the final arrangement. -When these edges are only partially overlapping, only the parts that overlap -an odd number of times will be edges in the final arrangement. - -This procedure is done in two steps: 1. preprocessing to eliminate identical -edges that are present an even number of times, and 2. adding edges incrementally -while applying an even-odd counting mechanism, which erases existing (parts of) -edges when new overlapping ones are added. - -\subsection SubsectionPolygonRepair_Labeling Labeling - -First, the polygon exterior is labeled. For this, all of the faces that can be -accessed from the exterior without passing through an edge are labeled as exterior -faces. - -Then, all other faces are labeled. For the even-odd rule, the label applied -alternates between polygon interior and hole every time that an edge is passed. - -\subsection SubsectionPolygonRepair_Reconstruction Reconstruction of the Multipolygon - -The algorithm reconstructs the multipolygon boundary by boundary, obtaining -counter-clockwise cycles for outer boundaries and clockwise cycles for inner -boundaries. Once all boundaries have been reconstructed, the boundaries are assembled -into multipolygons using the face labels to know which polygon with holes inner/outer -boundaries belong to, and using the orientation to distinguish between the outer and -inner boundaries of each polygon with holes. - -\subsection SubsectionPolygonRepair_Notes Notes on the Output If the input is already valid, the method will return a valid output representing the same area. However, the output might be different in order to conform to the -stricter conditions to generate deterministic output (see -\ref SubsectionPolygonRepair_Output). +stricter conditions to generate deterministic output. Also, it is worth noting that even the repair of a single polygon without holes but with self-intersections can result in a multipolygon with holes. This is why @@ -146,9 +141,11 @@ the repair function will always return a multipolygon with holes. The user can then check whether it consists of a single polygon with holes, and if a polygon with holes has zero holes and extract these if needed. + + \section SectionPolygonRepair_Examples Examples -\subsection SubsectionPolygonRepair_Repair Repairing a (Multi)polygon +\subsection SubsectionPolygonRepair_Repair Repairing a (Multi)polygon with the Even-Odd Rule It is possible to repair a polygon, polygon with holes or multipolygon with holes using the even-odd rule by calling the `Polygon_repair::repair()` function @@ -183,6 +180,8 @@ to edges, which enables correct counting even on partially overlapping edges. Ken Arroyo Ohori developed this package during the Google Summer of Code 2023 mentored by Sébastien Loriot and Andreas Fabri. +The GSoC project was limited to the even-odd rule. Further rules were added +with CGAL 6.1 by Andreas Fabri. */ } /* namespace CGAL */ diff --git a/Polygon_repair/doc/Polygon_repair/dependencies b/Polygon_repair/doc/Polygon_repair/dependencies index 6df3ace8d07..f5c7866adae 100644 --- a/Polygon_repair/doc/Polygon_repair/dependencies +++ b/Polygon_repair/doc/Polygon_repair/dependencies @@ -4,4 +4,5 @@ STL_Extension Algebraic_foundations Circulator Stream_support -Polygon \ No newline at end of file +Polygon +Triangulation_2 diff --git a/Polygon_repair/doc/Polygon_repair/examples.txt b/Polygon_repair/doc/Polygon_repair/examples.txt index e7d63a06e20..3ae4d468ea4 100644 --- a/Polygon_repair/doc/Polygon_repair/examples.txt +++ b/Polygon_repair/doc/Polygon_repair/examples.txt @@ -1,4 +1,6 @@ /*! \example Polygon_repair/repair_polygon_2.cpp +\example Polygon_repair/repair_non_zero_polygon_2.cpp \example Polygon_repair/repair_multipolygon_2.cpp +\example Polygon_repair/repair_union_intersect_2.cpp */ diff --git a/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.ipe b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.ipe new file mode 100644 index 00000000000..6da403058d4 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.ipe @@ -0,0 +1,564 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +64 528 m +64 464 l +192 464 l +192 528 l +h +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 528 m +64 464 l +192 464 l +192 528 l +h + + +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +64 528 m +64 464 l + + +96 480 m +160 480 l + + +160 480 m +160 512 l + + +160 512 m +96 512 l + + +96 512 m +96 480 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +64 528 m +64 464 l + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +480 512 m +544 512 l + + +544 512 m +544 480 l + + +544 480 m +480 480 l + + +448 528 m +448 464 l + + +480 480 m +480 512 l + + +256 464 m +384 464 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h + + +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +64 528 m +64 464 l + + +96 656 m +96 688 l + + +96 688 m +160 688 l + + +160 688 m +160 656 l + + +160 656 m +96 656 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +480 512 m +544 512 l + + +544 512 m +544 480 l + + +544 480 m +480 480 l + + +448 528 m +448 464 l + + +480 480 m +480 512 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +480 512 m +544 512 l + + +544 512 m +544 480 l + + +544 480 m +480 480 l + + +448 528 m +448 464 l + + +480 480 m +480 512 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.svg b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.svg new file mode 100644 index 00000000000..fb0747ad459 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.ipe b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.ipe new file mode 100644 index 00000000000..5d9ad8bfc53 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.ipe @@ -0,0 +1,446 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +138.353 615.529 m +201.6 633.6 l +229.895 638.316 l +261.333 629.333 l +304 608 l +317.333 613.333 l +336 608 l +432 640 l +480 640 l +501.333 645.333 l +544 624 l +544 592 l +496 592 l +464 576 l +448 576 l +408 560 l +368 560 l +276.364 546.909 l +256 552 l +256 560 l +208 560 l +200 552 l +176 544 l +130.286 562.286 l +112 576 l +138.353 615.529 l + + +96 720 m +130.286 706.286 l +176 672 l +200 696 l +224 704 l +256 696 l +256 688 l +276.364 690.909 l +288 688 l +368 688 l +408 704 l +432 704 l +464 720 l +512 720 l +544 736 l +560 736 l +544 800 l +501.333 789.333 l +480 800 l +432 784 l +384 784 l +317.333 757.333 l +261.333 773.333 l +240 784 l +229.895 782.316 l +224 784 l +201.6 777.6 l +144 768 l +138.353 759.529 l +112 752 l +96 720 l + + +112 720 m +176 672 l +208 704 l +256 704 l +256 688 l +368 704 l +432 704 l +496 736 l +560 736 l +544 800 l +480 784 l +384 784 l +304 752 l +240 784 l +144 768 l +112 720 l + + +96 720 m +176 688 l +224 704 l +288 688 l +368 688 l +448 720 l +512 720 l +544 736 l +544 768 l +480 800 l +336 752 l +224 784 l +112 752 l +96 720 l + + +112 720 m +176 672 l +208 704 l +256 704 l +256 688 l +368 704 l +432 704 l +496 736 l +560 736 l +544 800 l +480 784 l +384 784 l +304 752 l +240 784 l +144 768 l +112 720 l + + +96 720 m +176 688 l +224 704 l +288 688 l +368 688 l +448 720 l +512 720 l +544 736 l +544 768 l +480 800 l +336 752 l +224 784 l +112 752 l +96 720 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.svg b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.svg new file mode 100644 index 00000000000..5374b62ecce --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.ipe b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.ipe new file mode 100644 index 00000000000..131a5919dcc --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.ipe @@ -0,0 +1,515 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +64 704 m +192 704 l +192 768 l +64 768 l +h +32 752 m +128 752 l +128 720 l +32 720 l +h + + +64 704 m +192 704 l + + +192 704 m +192 768 l + + +192 768 m +64 768 l + + +64 768 m +64 704 l + + +128 720 m +32 720 l + + +32 720 m +32 752 l + + +32 752 m +128 752 l + + +128 752 m +128 720 l + + +384 640 m +256 640 l +256 592 l +320 592 l +320 576 l +304 576 l +304 608 l +384 608 l +h + + +384 528 m +256 528 l + + +256 528 m +256 480 l + + +256 480 m +320 480 l + + +320 480 m +320 464 l + + +320 464 m +304 464 l + + +304 464 m +304 496 l + + +304 496 m +384 496 l + + +384 496 m +384 528 l + + +384 640 m +256 640 l +256 592 l +320 592 l +320 576 l +304 576 l +304 608 l +384 608 l +h + + +384 528 m +256 528 l + + +256 528 m +256 480 l + + +304 496 m +384 496 l + + +384 496 m +384 528 l + + +64 704 m +192 704 l +192 768 l +64 768 l +h +32 752 m +128 752 l +128 720 l +32 720 l +h + + +64 704 m +192 704 l + + +192 704 m +192 768 l + + +192 768 m +64 768 l + + +256 592 m +304 592 l + + +304 592 m +304 608 l + + +304 576 m +320 576 l + + +320 576 m +320 592 l + + +320 592 m +304 592 l + + +304 592 m +304 576 l + + +256 768 m +256 752 l + + +256 752 m +320 752 l + + +320 752 m +320 720 l + + +320 720 m +256 720 l + + +256 720 m +256 704 l + + +224 720 m +256 720 l + + +256 720 m +256 752 l + + +256 752 m +224 752 l + + +224 752 m +224 720 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.svg b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.svg new file mode 100644 index 00000000000..75d37586db8 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.ipe b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.ipe new file mode 100644 index 00000000000..47617b1dcc9 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.ipe @@ -0,0 +1,650 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +304 576 m +384 576 l +384 640 l +256 640 l +256 592 l +304 592 l +h + + +256 688 m +384 688 l +384 768 l +304 768 l +304 752 l +256 752 l +h +272 736 m +304 736 l +304 720 l +368 720 l +368 704 l +272 704 l +h + + +256 688 m +384 688 l + + +384 688 m +384 768 l + + +368 720 m +368 704 l + + +368 704 m +272 704 l + + +272 704 m +272 736 l + + +256 752 m +256 688 l + + +336 752 m +256 752 l +256 688 l +384 688 l +384 768 l +304 768 l +304 720 l +368 720 l +368 704 l +272 704 l +272 736 l +336 736 l +h + + +256 688 m +384 688 l + + +384 688 m +384 768 l + + +384 768 m +304 768 l + + +304 768 m +304 720 l + + +304 720 m +368 720 l + + +368 720 m +368 704 l + + +368 704 m +272 704 l + + +272 704 m +272 736 l + + +256 752 m +256 688 l + + +384 640 m +256 640 l + + +256 640 m +256 592 l + + +304 576 m +384 576 l + + +384 576 m +384 640 l + + +192 640 m +64 640 l +64 592 l +128 592 l +128 608 l +112 608 l +112 576 l +192 576 l +h + + +384 640 m +256 640 l + + +256 640 m +256 592 l + + +304 608 m +304 576 l + + +304 576 m +384 576 l + + +384 576 m +384 640 l + + +336 752 m +256 752 l +256 688 l +384 688 l +384 768 l +304 768 l +304 720 l +368 720 l +368 704 l +272 704 l +272 736 l +336 736 l +h + + +256 688 m +384 688 l + + +384 688 m +384 768 l + + +384 768 m +304 768 l + + +304 768 m +304 720 l + + +304 720 m +368 720 l + + +368 720 m +368 704 l + + +368 704 m +272 704 l + + +272 704 m +272 736 l + + +272 736 m +336 736 l + + +336 736 m +336 752 l + + +336 752 m +256 752 l + + +256 752 m +256 688 l + + +384 768 m +304 768 l + + +272 736 m +304 736 l + + +304 736 m +304 720 l + + +304 720 m +368 720 l + + +304 768 m +304 752 l + + +304 752 m +256 752 l + + +496 768 m +496 752 l + + +496 752 m +528 752 l + + +528 752 m +528 736 l + + +528 736 m +496 736 l + + +464 736 m +496 736 l + + +496 736 m +496 752 l + + +496 752 m +448 752 l + + +192 640 m +64 640 l +64 592 l +128 592 l +128 608 l +112 608 l +112 576 l +192 576 l +h + + +384 640 m +256 640 l + + +256 640 m +256 592 l + + +256 592 m +320 592 l + + +320 592 m +320 608 l + + +320 608 m +304 608 l + + +304 608 m +304 576 l + + +304 576 m +384 576 l + + +384 576 m +384 640 l + + +512 592 m +496 592 l + + +496 592 m +496 608 l + + +496 608 m +512 608 l + + +512 608 m +512 592 l + + +448 592 m +496 592 l + + +256 592 m +304 592 l + + +304 592 m +304 576 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.svg b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.svg new file mode 100644 index 00000000000..537b74fa694 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Polygon_repair/examples/Polygon_repair/CMakeLists.txt b/Polygon_repair/examples/Polygon_repair/CMakeLists.txt index 93722bb7c3b..3453a093f10 100644 --- a/Polygon_repair/examples/Polygon_repair/CMakeLists.txt +++ b/Polygon_repair/examples/Polygon_repair/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_repair_Examples) -find_package(CGAL REQUIRED) +find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) # create a target per cppfile file( @@ -13,4 +13,11 @@ file( ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") -endforeach() \ No newline at end of file +endforeach() + + + +if(CGAL_Qt6_FOUND) + target_link_libraries(repair_non_zero_polygon_2 PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(repair_union_intersect_2 PUBLIC CGAL::CGAL_Basic_viewer) +endif() diff --git a/Polygon_repair/examples/Polygon_repair/data/winding.wkt b/Polygon_repair/examples/Polygon_repair/data/winding.wkt new file mode 100644 index 00000000000..6fd39f4923c --- /dev/null +++ b/Polygon_repair/examples/Polygon_repair/data/winding.wkt @@ -0,0 +1 @@ +POLYGON((0 0, 10 0, 10 6, 6 6, 6 4 , 10 4, 10 10, 0 10)) \ No newline at end of file diff --git a/Polygon_repair/examples/Polygon_repair/repair_non_zero_polygon_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_non_zero_polygon_2.cpp new file mode 100644 index 00000000000..3ce04501ab0 --- /dev/null +++ b/Polygon_repair/examples/Polygon_repair/repair_non_zero_polygon_2.cpp @@ -0,0 +1,37 @@ +#include +#include +#include + +#include +#include +#include +#ifdef CGAL_USE_BASIC_VIEWER +#include +#endif + +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using Point_2 = Kernel::Point_2; +using Polygon_2 = CGAL::Polygon_2; +using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; +using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + +int main(int argc, char* argv[]) { + + const char* filename = (argc > 1) ? argv[1] : "data/winding.wkt"; + + std::ifstream in(filename); + Polygon_with_holes_2 pin; + CGAL::IO::read_polygon_WKT(in, pin); + + Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(pin, CGAL::Polygon_repair::Non_zero_rule()); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mp); +#endif + + if (mp.number_of_polygons_with_holes() > 1) { + CGAL::IO::write_multi_polygon_WKT(std::cout, mp); + } else { + CGAL::IO::write_polygon_WKT(std::cout, mp.polygons_with_holes()[0]); + } + return 0; +} diff --git a/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp new file mode 100644 index 00000000000..bec35767d1c --- /dev/null +++ b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp @@ -0,0 +1,72 @@ +#include + +#include +#include + +#ifdef CGAL_USE_BASIC_VIEWER +#include +#endif + +#include + +#include + + +#include +#include + +using K = CGAL::Exact_predicates_inexact_constructions_kernel; + +using Point_2 = K::Point_2; +using Polygon_2 = CGAL::Polygon_2; +using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; +using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + +int +main(int argc, char* argv[]) +{ + Multipolygon_with_holes_2 pA; + if (argc == 2) { + { + std::ifstream in(argv[1]); + CGAL::IO::read_multi_polygon_WKT(in, pA); + } + } else { + std::istringstream is("MULTIPOLYGON( ((0 0, 20 0, 20 20, 0 20), (1 1, 1 19, 19 19, 19 1) ) , (( 10 -2, 12 -2, 12 22, 10 22)) )"); + //std::istringstream is("MULTIPOLYGON( ((0 0, 2 0, 2 3, 0 3) ) )"); // (0.1 0.1, 0.1 0.4, 0.4 0.1) + CGAL::IO::read_multi_polygon_WKT(is, pA); + } + + Multipolygon_with_holes_2 mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Union_rule()); + { + std::ofstream out("union.wkt"); + CGAL::IO::write_multi_polygon_WKT(out, mpwh); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mpwh); +#endif + } + mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Intersection_rule()); + { + std::ofstream out("intersection.wkt"); + CGAL::IO::write_multi_polygon_WKT(out, mpwh); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mpwh); +#endif + } + + { + Polygon_2 pB; + pB.push_back(Point_2(-1,-1)); + pB.push_back(Point_2(1,-1)); + pB.push_back(Point_2(1,1)); + pB.push_back(Point_2(-1,1)); + mpwh = CGAL::Polygon_repair::join(mpwh, pB); + + std::ofstream out("joinn.wkt"); + CGAL::IO::write_multi_polygon_WKT(out, mpwh); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mpwh); +#endif + } + return 0; +} diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h b/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h new file mode 100644 index 00000000000..a726139d70d --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h @@ -0,0 +1,396 @@ +// Copyright (c) 2024 GeometryFactory SARL (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) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_BOOLEAN_H +#define CGAL_POLYGON_REPAIR_BOOLEAN_H + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +namespace CGAL { +namespace Polygon_repair { + +/*! +\ingroup PkgTriangulation2Miscellaneous + +\tparam Kernel must be +*/ + +template +class Boolean { + +private: + struct FaceInfo { + + FaceInfo() + {} + + int label; + int layers; + bool processed; + + template + bool + in_domain(const Fct& fct) const + { + return fct(layers); + } + + }; + + using K = Kernel; + using Container = Container_; + using Point_2 = typename K::Point_2; + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + + using Itag = std::conditional_t, Exact_predicates_tag, Exact_intersections_tag>; + using Vb = CGAL::Triangulation_vertex_base_2; + using Fbb = CGAL::Triangulation_face_base_with_info_2; + using Fb = CGAL::Constrained_triangulation_face_base_2; + using Tds = CGAL::Triangulation_data_structure_2; + using CDT = CGAL::Constrained_Delaunay_triangulation_2; + using CDTplus = CGAL::Constrained_triangulation_plus_2; + using Face_handle = typename CDTplus::Face_handle; + using Face_circulator = typename CDTplus::Face_circulator; + using Vertex_handle = typename CDTplus::Vertex_handle; + using Constraint_id = typename CDTplus::Constraint_id; + using Edge = typename CDTplus::Edge; + using Context = typename CDTplus::Context; + + + // @todo taken from Polygon_repair should be factorized + struct Polygon_less { + + bool + operator()(const Polygon_2& pa, const Polygon_2& pb) const + { + typename Polygon_2::Vertex_iterator va = pa.vertices_begin(); + typename Polygon_2::Vertex_iterator vb = pb.vertices_begin(); + while (va != pa.vertices_end() && vb != pb.vertices_end()) { + if (*va != *vb) return *va < *vb; + ++va; + ++vb; + } + if (vb == pb.vertices_end()) return false; + return true; + } + + }; + + + // @todo taken from Polygon_repair should be factorized + struct Polygon_with_holes_less { + Polygon_less pl; + + bool + operator()(const Polygon_with_holes_2& pa, const Polygon_with_holes_2& pb) const + { + if (pl(pa.outer_boundary(), pb.outer_boundary())) return true; + if (pl(pb.outer_boundary(), pa.outer_boundary())) return false; + typename Polygon_with_holes_2::Hole_const_iterator ha = pa.holes_begin(); + typename Polygon_with_holes_2::Hole_const_iterator hb = pb.holes_begin(); + while (ha != pa.holes_end() && hb != pb.holes_end()) { + if (pl(*ha, *hb)) return true; + if (pl(*hb, *ha)) return false; + } + if (hb == pb.holes_end()) return false; + return true; + } + + }; + + + CDTplus cdt; + +public: + +/*! +default constructor. +*/ + Boolean() = default; + + +/*! +sets the polygons as input of the %Boolean operation. +*/ + void + insert(const Polygon_2& pA) + { + cdt.insert_constraint(pA.vertices_begin(), pA.vertices_end(), true); + } + + + void + insert(const Polygon_with_holes_2& pwh) + { + cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + + void + insert(const Multipolygon_with_holes_2& pA) + { + for(const auto& pwh : pA.polygons_with_holes()){ + cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + } +private: + + void + mark_domains(Face_handle start, + int index, + std::list& border) + { + if(start->info().layers != -1){ + return; + } + std::list queue; + queue.push_back(start); + + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + if(fh->info().layers == -1){ + fh->info().layers = index; + for(int i = 0; i < 3; i++){ + Edge e(fh,i); + Face_handle n = fh->neighbor(i); + if(n->info().layers == -1){ + if(cdt.is_constrained(e)){ + border.push_back(e); + }else{ + queue.push_back(n); + } + } + } + } + } + } + + public: + // this marks how many multipolygon interiors overlap a cell of the arrangement of mutipolygons + void + mark_domains() + { + for(Face_handle f : cdt.all_face_handles()){ + f->info().layers = -1; + } + + int overlays = 0; + std::list border; + mark_domains(cdt.infinite_face(), overlays, border); + + while(! border.empty()){ + Edge e = border.front(); + border.pop_front(); + Face_handle fh = e.first; + int fi = e.second; + Face_handle n = fh->neighbor(fi); + if(n->info().layers == -1){ + Vertex_handle u = fh->vertex(cdt.cw(fi)), v = fh->vertex(cdt.ccw(fi)); + int delta = 0; + for(Context c : cdt.contexts(u,v)){ + if(*c.current() ==u && *std::next(c.current()) == v){ + ++delta; + }else if(*c.current() ==v && *std::next(c.current()) == u){ + --delta; + }else{ + CGAL_assertion(false); + } + } + mark_domains(n, fh->info().layers+delta, border); + } + } + } + +private: + template + void + label_domain(Face_handle start, int label, const Fct& fct) + { + std::list queue; + start->info().label = label; + queue.push_back(start); + + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + + for(int i = 0; i < 3; i++){ + Face_handle n = fh->neighbor(i); + if(n->info().in_domain(fct)){ + if(n->info().label == 0){ + n->info().label = label; + queue.push_back(n); + } + } + } + } + } + + // this marks the domain for the Boolean operation applied on the two multipolygons + template + int + label_domains(const Fct& fct) + { + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + face->info().label = 0; + } + int label = 1; + for (auto const face: cdt.all_face_handles()) { + if(face->info().in_domain(fct) && face->info().label == 0){ + label_domain(face, label, fct); + ++label; + } + } + return label; + } + + + + // @todo taken from Polygon_repair and adapted; might be factorized + // Reconstruct ring boundary starting from an edge (face + opposite vertex) that is part of it + template + void + reconstruct_ring(std::list& ring, + Face_handle face_adjacent_to_boundary, + int opposite_vertex, + const Fct& CGAL_assertion_code(fct)) + { + // Create ring + Face_handle current_face = face_adjacent_to_boundary; + int current_opposite_vertex = opposite_vertex; + CGAL_assertion(face_adjacent_to_boundary->info().in_domain(fct)); + do { + CGAL_assertion(current_face->info().in_domain(fct) == face_adjacent_to_boundary->info().in_domain(fct)); + current_face->info().processed = true; + Vertex_handle pivot_vertex = current_face->vertex(current_face->cw(current_opposite_vertex)); + // std::cout << "\tAdding point " << pivot_vertex->point() << std::endl; + ring.push_back(pivot_vertex->point()); + Face_circulator fc = cdt.incident_faces(pivot_vertex, current_face); + do { + ++fc; + } while (fc->info().label != current_face->info().label); + current_face = fc; + current_opposite_vertex = fc->cw(fc->index(pivot_vertex)); + } while (current_face != face_adjacent_to_boundary || + current_opposite_vertex != opposite_vertex); + + // Start at lexicographically smallest vertex + typename std::list::iterator smallest_vertex = ring.begin(); + for (typename std::list::iterator current_vertex = ring.begin(); + current_vertex != ring.end(); ++current_vertex) { + if (*current_vertex < *smallest_vertex) smallest_vertex = current_vertex; + } + if (ring.front() != *smallest_vertex) { + ring.splice(ring.begin(), ring, smallest_vertex, ring.end()); + } + } + + +public: + + // @todo taken from Polygon_repair and adapted; might be factorized + +/*! +performs the Boolean operation applying `fct` and returns the result as a multipolygon with holes. + +\tparam Fct must have the operator `bool operator()(bool, bool)`. +*/ + template + Multipolygon_with_holes_2 + operator()(const Fct& fct) + { + int number_of_polygons = label_domains(fct) - 1; + Multipolygon_with_holes_2 mp; + std::vector polygons; // outer boundaries + std::vector> holes; // holes are ordered (per polygon) + polygons.resize(number_of_polygons); + holes.resize(number_of_polygons); + + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + } + + for (auto const &face: cdt.finite_face_handles()) { + if (! face->info().in_domain(fct)) continue; // exterior triangle + if (face->info().processed) continue; // already reconstructed + for (int opposite_vertex = 0; opposite_vertex < 3; ++opposite_vertex) { + if (face->info().in_domain(fct) == face->neighbor(opposite_vertex)->info().in_domain(fct)) continue; // not adjacent to boundary + + // Reconstruct ring + std::list ring; + reconstruct_ring(ring, face, opposite_vertex, fct); + + // Put ring in polygons + Polygon_2 polygon; + polygon.reserve(ring.size()); + polygon.insert(polygon.vertices_end(), ring.begin(), ring.end()); + if (polygon.orientation() == CGAL::COUNTERCLOCKWISE) { + polygons[face->info().label-1] = std::move(polygon); + } else { + holes[face->info().label-1].insert(std::move(polygon)); + } break; + } + } + + // Create polygons with holes and put in multipolygon + std::set ordered_polygons; + for (std::size_t i = 0; i < polygons.size(); ++i) { + ordered_polygons.insert(Polygon_with_holes_2(std::move(polygons[i]), + std::make_move_iterator(holes[i].begin()), + std::make_move_iterator(holes[i].end()))); + } + for (auto const& polygon: ordered_polygons) { + mp.add_polygon_with_holes(std::move(polygon)); + } + return mp; + } + + +/*! +access to the underlying constrained triangulation. +*/ + const CDTplus& + triangulation() const + { + return cdt; + } + +}; + + + +} // namespace Polygon_repair +} //namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_BOOLEAN_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h index b2dc51bfe36..372fb2479ee 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h @@ -18,11 +18,15 @@ namespace CGAL { namespace Polygon_repair { -/// \addtogroup PkgPolygonRepairRef +/// \addtogroup PkgPolygonRepairRules /// @{ /*! Tag class to select the even odd rule when calling `CGAL::Polygon_repair::repair()`. + The even-odd rule results in areas that are alternately assigned as polygon +interiors and exterior/holes each time that an input edge is passed. +It does not distinguish between edges that are part of outer boundaries +from those of inner boundaries. */ struct Even_odd_rule {}; diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Intersection_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Intersection_rule.h new file mode 100644 index 00000000000..7c2984b3c2d --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Intersection_rule.h @@ -0,0 +1,38 @@ +// Copyright (c) 2024 GeometryFactory. +// 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) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_INTERSECTION_RULE_H +#define CGAL_POLYGON_REPAIR_INTERSECTION_RULE_H + +#include + +namespace CGAL { + +namespace Polygon_repair { + +/// \addtogroup PkgPolygonRepairRules +/// @{ + +/*! + Tag class to select the %intersection rule when calling `CGAL::Polygon_repair::repair()`. + The intersection rule are useful when given +two or more similar valid polygons with holes. +The intersection rule results in areas that are contained in all input polygons with holes. + */ + struct Intersection_rule {}; + +///@} + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_INTERSECTION_RULE_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Non_zero_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Non_zero_rule.h new file mode 100644 index 00000000000..8df2f32ad61 --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Non_zero_rule.h @@ -0,0 +1,36 @@ +// Copyright (c) 2024 GeometryFactory. +// 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) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_NON_ZERO_RULE_H +#define CGAL_POLYGON_REPAIR_NON_ZERO_RULE_H + +#include + +namespace CGAL { + +namespace Polygon_repair { + +/// \addtogroup PkgPolygonRepairRules +/// @{ + +/*! + Tag class to select the non zero rule when calling `CGAL::Polygon_repair::repair()`. + The non-zero rule results in areas with a non-zero winding number. + */ + struct Non_zero_rule {}; + +///@} + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_NON_ZERO_RULE_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Union_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Union_rule.h new file mode 100644 index 00000000000..fbba8d1cbed --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Union_rule.h @@ -0,0 +1,37 @@ +// Copyright (c) 2024 GeometryFactory. +// 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) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_UNION_RULE_H +#define CGAL_POLYGON_REPAIR_UNION_RULE_H + +#include + +namespace CGAL { + +namespace Polygon_repair { + +/// \addtogroup PkgPolygonRepairRules +/// @{ + +/*! + Tag class to select the %union rule when calling `CGAL::Polygon_repair::repair()`. + The union rules are useful when given two or more similar valid polygons with holes. +The union rule results in areas that are contained in at least one of the input polygons with holes. + */ + struct Union_rule {}; + +///@} + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_UNION_RULE_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Winding.h b/Polygon_repair/include/CGAL/Polygon_repair/Winding.h new file mode 100644 index 00000000000..c40865c67e7 --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Winding.h @@ -0,0 +1,354 @@ +// Copyright (c) 2024 GeometryFactory SARL (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) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_WINDING_H +#define CGAL_POLYGON_REPAIR_WINDING_H + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +namespace CGAL { +namespace Polygon_repair { + +#ifndef DOXYGEN_RUNNING +/* +\ingroup PkgPolygonRepairFunctions + +\tparam Kernel must be +*/ + +template +class Winding { + +private: + struct FaceInfo { + + FaceInfo() + {} + + int wind; + int label; + int nesting_level[2]; + bool processed; + + bool + in_domain(int i) const + { + return nesting_level[i] % 2 == 1; + } + + template + bool + in_domain(const Fct& fct) const + { + return fct(in_domain(0), in_domain(1)); + } + + }; + + using K = Kernel; + using Point_2 = typename K::Point_2; + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + + using Itag = std::conditional_t, Exact_predicates_tag, Exact_intersections_tag>; + using Vb = CGAL::Triangulation_vertex_base_2; + using Fbb = CGAL::Triangulation_face_base_with_info_2; + using Fb = CGAL::Constrained_triangulation_face_base_2; + using Tds = CGAL::Triangulation_data_structure_2; + using CDT = CGAL::Constrained_Delaunay_triangulation_2; + using CDTplus = CGAL::Constrained_triangulation_plus_2; + using Face_handle = typename CDTplus::Face_handle; + using Face_circulator = typename CDTplus::Face_circulator; + using Vertex_handle = typename CDTplus::Vertex_handle; + using Constraint_id = typename CDTplus::Constraint_id; + using Edge = typename CDTplus::Edge; + using Context = typename CDTplus::Context; + + CDTplus cdt; + constexpr static int uninitialized = std::numeric_limits::lowest(); + + + struct Polygon_less { + bool operator()(const Polygon_2& pa, const Polygon_2& pb) const { + typename Polygon_2::Vertex_iterator va = pa.vertices_begin(); + typename Polygon_2::Vertex_iterator vb = pb.vertices_begin(); + while (va != pa.vertices_end() && vb != pb.vertices_end()) { + if (*va != *vb) return *va < *vb; + ++va; + ++vb; + } + if (vb == pb.vertices_end()) return false; + return true; + } + }; + + struct Polygon_with_holes_less { + Polygon_less pl; + bool operator()(const Polygon_with_holes_2& pa, const Polygon_with_holes_2& pb) const { + if (pl(pa.outer_boundary(), pb.outer_boundary())) return true; + if (pl(pb.outer_boundary(), pa.outer_boundary())) return false; + typename Polygon_with_holes_2::Hole_const_iterator ha = pa.holes_begin(); + typename Polygon_with_holes_2::Hole_const_iterator hb = pb.holes_begin(); + while (ha != pa.holes_end() && hb != pb.holes_end()) { + if (pl(*ha, *hb)) return true; + if (pl(*hb, *ha)) return false; + } + if (hb == pb.holes_end()) return false; + return true; + } + }; + +public: + +/*! +default constructor. +*/ + Winding() = default; + + +/*! +sets the polygon as input of the winding number computation. +*/ + void + insert(const Polygon_2& p) + { + Constraint_id cidA = cdt.insert_constraint(p.vertices_begin(), p.vertices_end(), true); + } + +/*! +sets the polygon as input of the winding number computation. +*/ + void + insert(const Polygon_with_holes_2& pwh) + { + Constraint_id cidA = cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cidA = cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + +/*! +sets the polygon as input of the winding number computation. +*/ + void + insert(const Multipolygon_with_holes_2& mpwh) + { + for(const auto& pwh : mpwh.polygons_with_holes()){ + Constraint_id cidA = cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cidA = cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + } + + void label(Face_handle f, int index, std::list>& border) + { + std::list queue; + queue.push_back(f); + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + fh->info().wind = index; + for(int i = 0; i < 3; i++){ + Edge e(fh,i); + Face_handle n = fh->neighbor(i); + if(! cdt.is_constrained(e)){ + if(n->info().wind != index){ + queue.push_back(n); + } + }else{ + if(n->info().wind == uninitialized){ + Vertex_handle u = e.first->vertex(cdt.cw(e.second)); + Vertex_handle v = e.first->vertex(cdt.ccw(e.second)); + int delta = 0; + for(Context c : cdt.contexts(u,v)){ + if(*c.current() ==u && *std::next(c.current()) == v){ + ++delta; + }else if(*c.current() ==v && *std::next(c.current()) == u){ + --delta; + }else{ + CGAL_assertion(false); + } + } + border.push_back(std::make_pair(Edge(n,n->index(fh)),index+delta)); + } + } + } + } + } + + void label() + { + std::list> border; + for(Face_handle f : cdt.all_face_handles()){ + f->info().wind = uninitialized; + } + int index = 0; + label(cdt.infinite_face(),index++, border); + while(! border.empty()){ + Edge e; + int wind; + std::tie(e,wind) = border.front(); + border.pop_front(); + if(e.first->info().wind == uninitialized){ + label(e.first, wind,border); + }else{ + CGAL_assertion(e.first->info().wind == wind); + } + } + } + + void + label_domain(Face_handle start, int label) + { + std::list queue; + queue.push_back(start); + + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + fh->info().label = label; + + for(int i = 0; i < 3; i++){ + Face_handle n = fh->neighbor(i); + if(n->info().wind != 0 && n->info().label == 0){ + queue.push_back(n); + } + } + } + } + + int + label_domains() + { + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + face->info().label = 0; + } + int label = 1; + for (auto const face: cdt.all_face_handles()) { + if(face->info().wind != 0 && face->info().label == 0){ + label_domain(face, label); + ++label; + } + } + return label; + } + + void + reconstruct_ring(std::list& ring, + Face_handle face_adjacent_to_boundary, + int opposite_vertex) + { + // Create ring + Face_handle current_face = face_adjacent_to_boundary; + int current_opposite_vertex = opposite_vertex; + CGAL_assertion(face_adjacent_to_boundary->info().wind != 0); + do { + current_face->info().processed = true; + Vertex_handle pivot_vertex = current_face->vertex(current_face->cw(current_opposite_vertex)); + // std::cout << "\tAdding point " << pivot_vertex->point() << std::endl; + ring.push_back(pivot_vertex->point()); + Face_circulator fc = cdt.incident_faces(pivot_vertex, current_face); + do { + ++fc; + } while (fc->info().label != current_face->info().label); + current_face = fc; + current_opposite_vertex = fc->cw(fc->index(pivot_vertex)); + } while (current_face != face_adjacent_to_boundary || + current_opposite_vertex != opposite_vertex); + + // Start at lexicographically smallest vertex + typename std::list::iterator smallest_vertex = ring.begin(); + for (typename std::list::iterator current_vertex = ring.begin(); + current_vertex != ring.end(); ++current_vertex) { + if (*current_vertex < *smallest_vertex) smallest_vertex = current_vertex; + } + if (ring.front() != *smallest_vertex) { + ring.splice(ring.begin(), ring, smallest_vertex, ring.end()); + } + } + + Multipolygon_with_holes_2 + operator()() + { + int number_of_polygons = label_domains() - 1; + + Multipolygon_with_holes_2 mp; + std::vector polygons; // outer boundaries + std::vector> holes; // holes are ordered (per polygon) + polygons.resize(number_of_polygons); + holes.resize(number_of_polygons); + + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + } + + for (auto const &face: cdt.finite_face_handles()) { + if (face->info().wind==0) continue; // exterior triangle + if (face->info().processed) continue; // already reconstructed + for (int opposite_vertex = 0; opposite_vertex < 3; ++opposite_vertex) { + + if ((face->info().wind != 0) == (face->neighbor(opposite_vertex)->info().wind != 0)) continue; // not adjacent to boundary + + // Reconstruct ring + std::list ring; + reconstruct_ring(ring, face, opposite_vertex); + + // Put ring in polygons + Polygon_2 polygon; + polygon.reserve(ring.size()); + polygon.insert(polygon.vertices_end(), ring.begin(), ring.end()); + if (polygon.orientation() == CGAL::COUNTERCLOCKWISE) { + polygons[face->info().label-1] = std::move(polygon); + } else { + holes[face->info().label-1].insert(std::move(polygon)); + } break; + } + } + + // Create polygons with holes and put in multipolygon + std::set ordered_polygons; + for (std::size_t i = 0; i < polygons.size(); ++i) { + ordered_polygons.insert(Polygon_with_holes_2(std::move(polygons[i]), + std::make_move_iterator(holes[i].begin()), + std::make_move_iterator(holes[i].end()))); + } + for (auto const& polygon: ordered_polygons) { + mp.add_polygon_with_holes(std::move(polygon)); + } + return mp; + } + +}; + +#endif + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_WINDING_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h b/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h index e75be739e61..1203d1882a2 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h @@ -9,8 +9,8 @@ // // Author(s) : Ken Arroyo Ohori -#ifndef CGAL_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H -#define CGAL_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H +#ifndef CGAL_POLYGON_REPAIR_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H +#define CGAL_POLYGON_REPAIR_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H #include #include @@ -124,4 +124,4 @@ public: } // namespace Polygon_repair } // namespace CGAL -#endif // CGAL_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H +#endif // CGAL_POLYGON_REPAIR_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/repair.h b/Polygon_repair/include/CGAL/Polygon_repair/repair.h index f6f2e84cfee..03961636059 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/repair.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/repair.h @@ -24,9 +24,14 @@ #include #include #include +#include +#include +#include #include #include +#include +#include namespace CGAL { @@ -39,9 +44,9 @@ class Polygon_repair; /// \ingroup PkgPolygonRepairFunctions /// repairs polygon `p` using the given rule -/// \tparam Kernel parameter of the input and output polygons +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` /// \tparam Container parameter of the input and output polygons -/// \tparam Rule must be `Even_odd_rule` +/// \tparam Rule must be `Even_odd_rule` or `Non_zero_rule` template Multipolygon_with_holes_2 repair(const Polygon_2& p , Rule = Rule()) { @@ -56,9 +61,9 @@ Multipolygon_with_holes_2 repair(const Polygon_2 Multipolygon_with_holes_2 repair(const Polygon_with_holes_2& p, Rule = Rule()) { @@ -71,11 +76,24 @@ Multipolygon_with_holes_2 repair(const Polygon_with_holes_2 +Multipolygon_with_holes_2 repair(const Polygon_with_holes_2& p, Non_zero_rule) +{ + Winding winding; + winding.insert(p); + winding.label(); + winding.label_domains(); + return winding(); +} + + /// \ingroup PkgPolygonRepairFunctions /// repairs multipolygon with holes `p` using the given rule -/// \tparam Kernel parameter of the input and output polygons +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` /// \tparam Container parameter of the input and output polygons -/// \tparam Rule must be `Even_odd_rule` +/// \tparam Rule may be any \ref PkgPolygonRepairRules +/// \pre If the rule is the `Union_rule` or `Non_zero_rule`, each polygon with hole must be free of self-intersections template Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Rule = Rule()) { @@ -88,6 +106,61 @@ Multipolygon_with_holes_2 repair(const Multipolygon_with_hole } return pr.multipolygon(); } + +template +Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Union_rule) +{ + struct Larger_than_zero { + bool operator()(int i) const + { + return i > 0; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(p); + bops.mark_domains(); + Larger_than_zero ltz; + return bops(ltz); +} + + +template +Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Intersection_rule) +{ + struct Equal { + int val; + Equal(int val) + : val(val) + {} + + bool operator()(int i) const + { + return i == val; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(p); + bops.mark_domains(); + Equal equal(p.number_of_polygons_with_holes()); + return bops(equal); +} + +/* +template +Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Non_zero_rule rule) +{ + static_assert(std::is_same_v); + CGAL::Polygon_repair::Polygon_repair pr; + pr.add_to_triangulation_even_odd(p); + if (pr.triangulation().number_of_faces() > 0) { + pr.label_triangulation_even_odd(); + pr.reconstruct_multipolygon(); + } return pr.multipolygon(); +} +*/ + template bool is_valid(const Polygon_2& polygon) { if (polygon.vertices().size() < 3) { @@ -514,7 +587,7 @@ public: static void label_region(T& tt, Face_handle face, int label, std::list& to_check, std::list& to_check_added_by) { - // std::cout << "Labelling region with " << label << std::endl; + // std::cout << "Labeling region with " << label << std::endl; std::list to_check_in_region; face->label() = label; to_check_in_region.push_back(face); @@ -712,6 +785,127 @@ protected: #endif // DOXYGEN_RUNNING + + +/// \ingroup PkgPolygonRepairFunctions +/// computes the union of all polygons with holes in `p` +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \pre Each polygon with hole must be free of self-intersections +template +Multipolygon_with_holes_2 +join(const Multipolygon_with_holes_2& pa) +{ + struct Larger_than_zero { + bool operator()(int i) const + { + return i > 0; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(pa); + bops.mark_domains(); + Larger_than_zero ltz; + return bops(ltz); +} + +/// \ingroup PkgPolygonRepairFunctions +/// computes the union of two polygonal domains +/// \tparam Kernel parameter of the output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \tparam PA must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \tparam PB must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \pre The polygons `pa` and `pb` must be free of self-intersections +template +#ifdef DOXYGEN_RUNNING +Multipolygon_with_holes_2 +#else +decltype(auto) +#endif +join(const PA& pa, const PB& pb, const Kernel& = Default(), const Container& = Default()) +{ + typedef typename Default::Get::type Traits; + typedef typename Default::Get::type Container_; + + struct Larger_than_zero { + bool operator()(int i) const + { + return i > 0; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(pa); + bops.insert(pb); + bops.mark_domains(); + Larger_than_zero ltz; + return bops(ltz); +} + + +/// \ingroup PkgPolygonRepairFunctions +/// computes the intersection of all polygons with holes in `p` +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \pre Each polygon with hole must be free of self-intersections +template +Multipolygon_with_holes_2 +intersect(const Multipolygon_with_holes_2& p) +{ + struct Equal { + int val; + Equal(int val) + : val(val) + {} + + bool operator()(int i) const + { + return i == val; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(p); + bops.mark_domains(); + Equal equal(p.number_of_polygons_with_holes()); + return bops(equal); +} + + +/// \ingroup PkgPolygonRepairFunctions +/// computes the intersection of two polygonal domains +/// \tparam Kernel parameter of the output polygon. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \tparam PA must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \tparam PB must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \pre The polygons `pa` and `pb` must be free of self-intersections +template +#ifdef DOXYGEN_RUNNING +Multipolygon_with_holes_2 +#else +decltype(auto) +#endif +intersect(const PA& pa, const PB& pb, const Kernel& = Default(), const Container& = Default()) +{ + typedef typename Default::Get::type Traits; + typedef typename Default::Get::type Container_; + + struct Equal { + bool operator()(int i) const + { + return i == 2; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(pa); + bops.insert(pb); + bops.mark_domains(); + Equal equal; + return bops(equal); +} + } // namespace Polygon_repair } // namespace CGAL diff --git a/Polygon_repair/package_info/Polygon_repair/dependencies b/Polygon_repair/package_info/Polygon_repair/dependencies index 8231db1007e..517729e1d03 100644 --- a/Polygon_repair/package_info/Polygon_repair/dependencies +++ b/Polygon_repair/package_info/Polygon_repair/dependencies @@ -20,3 +20,4 @@ Spatial_sorting Stream_support TDS_2 Triangulation_2 +BGL diff --git a/Polygon_repair/test/Polygon_repair/CMakeLists.txt b/Polygon_repair/test/Polygon_repair/CMakeLists.txt index a1564d5dd16..1ec7a341fc2 100644 --- a/Polygon_repair/test/Polygon_repair/CMakeLists.txt +++ b/Polygon_repair/test/Polygon_repair/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_repair_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index c2a83f6adaf..677cfe1d36f 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygonal_surface_reconstruction_Examples) diff --git a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt index 343c6c9bf8f..43ee357b3b4 100644 --- a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygonal_surface_reconstruction_Tests) diff --git a/Polyhedron/doc/Polyhedron/PackageDescription.txt b/Polyhedron/doc/Polyhedron/PackageDescription.txt index 7369093e05d..f0033c7efd7 100644 --- a/Polyhedron/doc/Polyhedron/PackageDescription.txt +++ b/Polyhedron/doc/Polyhedron/PackageDescription.txt @@ -13,7 +13,6 @@ /*! \addtogroup PkgPolyhedronRef -\todo check generated documentation \cgalPkgDescriptionBegin{3D Polyhedral Surface,PkgPolyhedron} \cgalPkgPicture{Polyhedron-teaser-small.png} \cgalPkgSummaryBegin diff --git a/Polyhedron/examples/Polyhedron/CMakeLists.txt b/Polyhedron/examples/Polyhedron/CMakeLists.txt index 3bd3c35604f..aa94d1a604a 100644 --- a/Polyhedron/examples/Polyhedron/CMakeLists.txt +++ b/Polyhedron/examples/Polyhedron/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyhedron_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polyhedron/test/Polyhedron/CMakeLists.txt b/Polyhedron/test/Polyhedron/CMakeLists.txt index 731cae0763b..d84cec3bf76 100644 --- a/Polyhedron/test/Polyhedron/CMakeLists.txt +++ b/Polyhedron/test/Polyhedron/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyhedron_Tests) find_package(CGAL REQUIRED) diff --git a/Polyline_simplification_2/benchmark/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/benchmark/Polyline_simplification_2/CMakeLists.txt new file mode 100644 index 00000000000..5c6747a2883 --- /dev/null +++ b/Polyline_simplification_2/benchmark/Polyline_simplification_2/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.12...3.29) +project(Polyline_simplification_2_Benchmarks) + +# Add Google Benchmark +find_package(benchmark REQUIRED) + +# Add CGAL +find_package(CGAL REQUIRED) + +add_executable(benchmark_simplify benchmark_simplify.cpp) +target_link_libraries(benchmark_simplify PRIVATE benchmark::benchmark CGAL::CGAL CGAL::Data) diff --git a/Polyline_simplification_2/benchmark/Polyline_simplification_2/benchmark_simplify.cpp b/Polyline_simplification_2/benchmark/Polyline_simplification_2/benchmark_simplify.cpp new file mode 100644 index 00000000000..6b78ba89142 --- /dev/null +++ b/Polyline_simplification_2/benchmark/Polyline_simplification_2/benchmark_simplify.cpp @@ -0,0 +1,98 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace PS = CGAL::Polyline_simplification_2; + +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Polygon_2 = CGAL::Polygon_2; +using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + +using Vb = PS::Vertex_base_2; +using Fb = CGAL::Constrained_triangulation_face_base_2; +using TDS = CGAL::Triangulation_data_structure_2; +using CDT = CGAL::Constrained_Delaunay_triangulation_2; +using CT = CGAL::Constrained_triangulation_plus_2; +using Stop = PS::Stop_below_count_ratio_threshold; +using Cost = PS::Squared_distance_cost; + +static void BM_Simplify(benchmark::State& state, std::string filename) { + using Point_2 = K::Point_2; + using MultiPoint = std::vector; + + using LineString = std::vector; + using MultiLineString = std::deque; + + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using MultiPolygon = std::deque; + + std::ifstream ifs(filename); + MultiPoint points; + MultiLineString polylines; + MultiPolygon polygons; + if(!CGAL::IO::read_WKT(ifs, points, polylines, polygons) && false) { + state.SkipWithError("Cannot read file " + filename); + return; + } + + state.counters["#points"] = points.size(); + state.counters["#polylines"] = polylines.size(); + state.counters["#polygons"] = polygons.size(); + + CT ct; + for(const auto& point : points) { + ct.insert(point); + } + for(const auto& polyline : polylines) { + ct.insert_constraint(polyline); + } + for(const auto& polygon_with_holes : polygons) { + const Polygon_2& outer_polygon = polygon_with_holes.outer_boundary(); + ct.insert_constraint(outer_polygon); + for(Polygon_with_holes_2::Hole_const_iterator it = polygon_with_holes.holes_begin(); + it != polygon_with_holes.holes_end(); ++it) + { + const Polygon_2& hole = *it; + ct.insert_constraint(hole); + } + } + + state.counters["nb of constraints"] = ct.number_of_constraints(); + state.counters["nb of vertices"] = ct.number_of_vertices(); + state.counters["nb of sub-constraints"] = ct.number_of_subconstraints(); + + for([[maybe_unused]] auto _ : state) { + state.PauseTiming(); + CT ct_copy = ct; // Copy the object `ct` in the loop + state.ResumeTiming(); + PS::simplify(ct_copy, Cost(), Stop(0.5)); + } +} + +int main(int argc, char** argv) { + std::string filename = CGAL::data_file_path("wkt/norway-MP.wkt"); + if(argc > 1) { + std::string_view arg1{argv[1]}; + if(arg1.size() < 2 || arg1[0] != '-' || arg1[1] != '-') { + --argc; + ++argv; + filename = arg1; + } + } + benchmark::RegisterBenchmark("simplify file " + filename, BM_Simplify, filename); + benchmark::Initialize(&argc, argv); + benchmark::RunSpecifiedBenchmarks(); + benchmark::Shutdown(); +} diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt index 97f1671d671..9f5b6aa8870 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyline_simplification_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt index 11ced7973c1..e0f8fe666df 100644 --- a/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyline_simplification_2_Examples) find_package(CGAL REQUIRED) diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h index 198928e2145..9e7fe636d01 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h @@ -154,8 +154,11 @@ public: (*it)->set_removable(false); ++it; for(; it != ite; ++it){ - if((std::next(it) != ite) && (std::prev(it)== std::next(it))){ - (*it)->set_removable(false); + if(std::next(it) != ite){ + Vertex_handle vp = *std::prev(it), vn = *std::next(it); + if(vp == vn){ + (*it)->set_removable(false); + } } } it = std::prev(it); diff --git a/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt index 6099c152bd8..3ef613d9a83 100644 --- a/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt @@ -1,12 +1,13 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyline_simplification_2_Tests) # CGAL and its components find_package(CGAL REQUIRED) create_single_source_cgal_program( "issue-5774.cpp" ) +create_single_source_cgal_program( "issue-8735.cpp" ) create_single_source_cgal_program( "simplify_polygon_test.cpp" ) create_single_source_cgal_program( "simplify_polyline_with_duplicate_points.cpp" ) diff --git a/Polyline_simplification_2/test/Polyline_simplification_2/issue-8735.cpp b/Polyline_simplification_2/test/Polyline_simplification_2/issue-8735.cpp new file mode 100644 index 00000000000..11f2cb75643 --- /dev/null +++ b/Polyline_simplification_2/test/Polyline_simplification_2/issue-8735.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +namespace PS = CGAL::Polyline_simplification_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel K; +typedef PS::Vertex_base_2 Vb; +typedef CGAL::Constrained_triangulation_face_base_2 Fb; +typedef CGAL::Triangulation_data_structure_2 TDS; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Constrained_triangulation_plus_2 CT; +typedef CT::Point Point; +typedef PS::Stop_above_cost_threshold Stop; +typedef PS::Squared_distance_cost Cost; + +int main() +{ + double tolerance = 100; + CT ct; + std::vector pts; + + pts.push_back(CT::Point(0, 0)); + pts.push_back(CT::Point(2, 0)); + pts.push_back(CT::Point(1, 0)); + pts.push_back(CT::Point(3, 0)); + pts.push_back(CT::Point(4, 1)); + tolerance = 100; + ct.insert_constraint(pts.begin(), pts.end(), false); + + PS::simplify(ct, Cost(), Stop(tolerance * tolerance), false); + + return 0; +} diff --git a/Polynomial/doc/Polynomial/PackageDescription.txt b/Polynomial/doc/Polynomial/PackageDescription.txt index 0f1de49b78b..96273a5ada8 100644 --- a/Polynomial/doc/Polynomial/PackageDescription.txt +++ b/Polynomial/doc/Polynomial/PackageDescription.txt @@ -9,7 +9,6 @@ /// \ingroup PkgPolynomialRef /*! \addtogroup PkgPolynomialRef -\todo check generated documentation \cgalPkgDescriptionBegin{Polynomial,PkgPolynomial} \cgalPkgPicture{Polynomial.png} \cgalPkgSummaryBegin diff --git a/Polynomial/examples/Polynomial/CMakeLists.txt b/Polynomial/examples/Polynomial/CMakeLists.txt index 330d6653e99..5b6244410d9 100644 --- a/Polynomial/examples/Polynomial/CMakeLists.txt +++ b/Polynomial/examples/Polynomial/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polynomial_Examples) find_package(CGAL REQUIRED) diff --git a/Polynomial/test/Polynomial/CMakeLists.txt b/Polynomial/test/Polynomial/CMakeLists.txt index e39eb04c74b..85669731c54 100644 --- a/Polynomial/test/Polynomial/CMakeLists.txt +++ b/Polynomial/test/Polynomial/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polynomial_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt b/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt index aaecb2b37da..b49377cf9ed 100644 --- a/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt +++ b/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt @@ -4,7 +4,6 @@ /*! \addtogroup PkgPolytopeDistanceDRef -\todo check generated documentation \cgalPkgDescriptionBegin{Optimal Distances,PkgPolytopeDistanceD} \cgalPkgPicture{dist.png} \cgalPkgSummaryBegin diff --git a/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt b/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt index 20a8fde663f..5635786cc3a 100644 --- a/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt +++ b/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polytope_distance_d_Examples) find_package(CGAL REQUIRED) diff --git a/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt b/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt index 12ea05b9a05..f229a4a3fc8 100644 --- a/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt +++ b/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polytope_distance_d_Tests) find_package(CGAL REQUIRED) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index 9f3d7cbefb7..bfcf7dcc124 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the PCA demo. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Principal_component_analysis_Demo) include_directories(./) diff --git a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt index c1640a1188d..03acad4f33b 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt +++ b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt @@ -17,7 +17,6 @@ /*! \addtogroup PkgPrincipalComponentAnalysisDRef -\todo check generated documentation \cgalPkgDescriptionBegin{Principal Component Analysis,PkgPrincipalComponentAnalysisD} \cgalPkgPicture{teaserLeastSquaresFitting.png} \cgalPkgSummaryBegin diff --git a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt index a7b0a40595b..13cdc5491b6 100644 --- a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Principal_component_analysis_Examples) find_package(CGAL REQUIRED) diff --git a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt index 5541cb45dff..1de7c904d88 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Principal_component_analysis_Tests) find_package(CGAL REQUIRED) diff --git a/Profiling_tools/examples/Profiling_tools/CMakeLists.txt b/Profiling_tools/examples/Profiling_tools/CMakeLists.txt index d43577af955..003528dd134 100644 --- a/Profiling_tools/examples/Profiling_tools/CMakeLists.txt +++ b/Profiling_tools/examples/Profiling_tools/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Profiling_tools_Examples) find_package(CGAL REQUIRED) diff --git a/Profiling_tools/test/Profiling_tools/CMakeLists.txt b/Profiling_tools/test/Profiling_tools/CMakeLists.txt index e366a8e9b9d..be4a6179e39 100644 --- a/Profiling_tools/test/Profiling_tools/CMakeLists.txt +++ b/Profiling_tools/test/Profiling_tools/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Profiling_tools_Tests) find_package(CGAL REQUIRED) diff --git a/Property_map/examples/Property_map/CMakeLists.txt b/Property_map/examples/Property_map/CMakeLists.txt index 79bb8862815..8e54346059c 100644 --- a/Property_map/examples/Property_map/CMakeLists.txt +++ b/Property_map/examples/Property_map/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Property_map_Examples) # CGAL and its components diff --git a/Property_map/test/Property_map/CMakeLists.txt b/Property_map/test/Property_map/CMakeLists.txt index a51a39b66d0..bd35081602c 100644 --- a/Property_map/test/Property_map/CMakeLists.txt +++ b/Property_map/test/Property_map/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Property_map_Tests) # CGAL and its components diff --git a/QP_solver/doc/QP_solver/PackageDescription.txt b/QP_solver/doc/QP_solver/PackageDescription.txt index e63fc8a3310..0da82f7f3b6 100644 --- a/QP_solver/doc/QP_solver/PackageDescription.txt +++ b/QP_solver/doc/QP_solver/PackageDescription.txt @@ -72,7 +72,6 @@ Programs can be written to an output stream in MPSFormat, using one of the follo /*! \addtogroup PkgQPSolverRef -\todo check generated documentation \cgalPkgDescriptionBegin{Linear and Quadratic Programming Solver,PkgQPSolver} \cgalPkgPicture{qp.png} \cgalPkgSummaryBegin diff --git a/QP_solver/examples/QP_solver/CMakeLists.txt b/QP_solver/examples/QP_solver/CMakeLists.txt index 530025ed487..29636c20e0b 100644 --- a/QP_solver/examples/QP_solver/CMakeLists.txt +++ b/QP_solver/examples/QP_solver/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(QP_solver_Examples) find_package(CGAL REQUIRED) diff --git a/QP_solver/test/QP_solver/CMakeLists.txt b/QP_solver/test/QP_solver/CMakeLists.txt index bf4d78ee26d..e113c1a0a72 100644 --- a/QP_solver/test/QP_solver/CMakeLists.txt +++ b/QP_solver/test/QP_solver/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(QP_solver_Tests) find_package(CGAL REQUIRED) diff --git a/Random_numbers/test/Random_numbers/CMakeLists.txt b/Random_numbers/test/Random_numbers/CMakeLists.txt index 9b06ba31570..3a3141fb5d9 100644 --- a/Random_numbers/test/Random_numbers/CMakeLists.txt +++ b/Random_numbers/test/Random_numbers/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Random_numbers_Tests) find_package(CGAL REQUIRED) diff --git a/Ridges_3/doc/Ridges_3/PackageDescription.txt b/Ridges_3/doc/Ridges_3/PackageDescription.txt index d34109ac8e3..5c06986a879 100644 --- a/Ridges_3/doc/Ridges_3/PackageDescription.txt +++ b/Ridges_3/doc/Ridges_3/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgRidges3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{Approximation of Ridges and Umbilics on Triangulated Surface Meshes,PkgRidges3} \cgalPkgPicture{RidgesMechPartDetail.png} \cgalPkgSummaryBegin diff --git a/Ridges_3/examples/Ridges_3/CMakeLists.txt b/Ridges_3/examples/Ridges_3/CMakeLists.txt index 6eab0514fad..a3bcb30ed91 100644 --- a/Ridges_3/examples/Ridges_3/CMakeLists.txt +++ b/Ridges_3/examples/Ridges_3/CMakeLists.txt @@ -1,5 +1,5 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Ridges_3_Examples) find_package(CGAL REQUIRED) diff --git a/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h b/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h index c3e5aefec98..72f9add2cb7 100644 --- a/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h +++ b/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h @@ -64,7 +64,7 @@ T_PolyhedralSurf_rings(const TPoly& P) { //init the ring_index_map Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for(;itb!=ite;itb++) ring_index_map[*itb] = -1; } diff --git a/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h b/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h index 775fec7d89d..5d4c57f7b43 100644 --- a/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h +++ b/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h @@ -158,7 +158,7 @@ T_PolyhedralSurf_neighbors(const TriangleMesh& P) { //init the is_visited_map Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for(;itb!=ite;itb++) is_visited_map[*itb] = false; } diff --git a/Ridges_3/include/CGAL/Ridges.h b/Ridges_3/include/CGAL/Ridges.h index d4052642864..c52aef7081b 100644 --- a/Ridges_3/include/CGAL/Ridges.h +++ b/Ridges_3/include/CGAL/Ridges.h @@ -336,7 +336,7 @@ Ridge_approximation(const TriangleMesh &p, { //init the is_visited_map and check that the mesh is a triangular one. face_iterator itb,ite; - boost::tie(itb,ite) = faces(P); + std::tie(itb,ite) = faces(P); for(;itb!=ite;itb++) { is_visited_map[*itb] = false; } @@ -411,10 +411,10 @@ compute_ridges(Ridge_interrogation_type r_type, OutputIterator ridge_lines_it, R //reinit the is_visited_map face_iterator itb,ite; - boost::tie(itb,ite) = faces(P); + std::tie(itb,ite) = faces(P); for(;itb!=ite;itb++) is_visited_map[*itb] = false; - boost::tie(itb,ite) = faces(P); + std::tie(itb,ite) = faces(P); for(;itb!=ite;itb++) { face_descriptor f = *itb; diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index f815b9c18ca..e56e0f000b8 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -184,7 +184,7 @@ compute(OutputIterator umbilics_it, FT size) //MAIN loop on P vertices Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for (;itb != ite; itb++) { vertex_descriptor vh = *itb; umbilicEstimatorVertex = cgal_abs(get(k1,vh)-get(k2,vh)); diff --git a/Ridges_3/test/Ridges_3/CMakeLists.txt b/Ridges_3/test/Ridges_3/CMakeLists.txt index 9e7305e6953..e61df02393c 100644 --- a/Ridges_3/test/Ridges_3/CMakeLists.txt +++ b/Ridges_3/test/Ridges_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Ridges_3_Tests) find_package(CGAL REQUIRED) diff --git a/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h b/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h index c3e5aefec98..72f9add2cb7 100644 --- a/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h +++ b/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h @@ -64,7 +64,7 @@ T_PolyhedralSurf_rings(const TPoly& P) { //init the ring_index_map Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for(;itb!=ite;itb++) ring_index_map[*itb] = -1; } diff --git a/SMDS_3/examples/SMDS_3/CMakeLists.txt b/SMDS_3/examples/SMDS_3/CMakeLists.txt index c00acbc0408..77d7ba6b6a8 100644 --- a/SMDS_3/examples/SMDS_3/CMakeLists.txt +++ b/SMDS_3/examples/SMDS_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(SMDS_3_Examples) diff --git a/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h b/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h index 92272897094..9f26f6f3b29 100644 --- a/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h +++ b/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h @@ -47,20 +47,7 @@ public: public: // Constructors - Compact_simplicial_mesh_cell_3() - : time_stamp_(std::size_t(-1)) - {} - - Compact_simplicial_mesh_cell_3(const Compact_simplicial_mesh_cell_3& rhs) - : N(rhs.N) - , V(rhs.V) - , time_stamp_(rhs.time_stamp_) - , subdomain_index_(rhs.subdomain_index_) - { - for(int i=0; i <4; i++){ - surface_index_table_[i] = rhs.surface_index_table_[i]; - } - } + Compact_simplicial_mesh_cell_3() = default; Compact_simplicial_mesh_cell_3(Vertex_handle v0, Vertex_handle v1, @@ -279,7 +266,7 @@ private: std::array N; std::array V; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); // The index of the cell of the input complex that contains me Subdomain_index subdomain_index_ = {}; diff --git a/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h b/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h index e7363047a92..9d3aa0c5d22 100644 --- a/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h +++ b/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h @@ -46,14 +46,13 @@ save_binary_file(std::ostream& os, , bool binary = true) #endif { - typedef typename C3T3::Triangulation::Geom_traits::FT FT; if(binary) os << "binary "; os << "CGAL c3t3 " << CGAL::Get_io_signature()() << "\n"; if(binary) { CGAL::IO::set_binary_mode(os); } else { CGAL::IO::set_ascii_mode(os); - os.precision(std::numeric_limits::digits10+2); + os.precision(std::numeric_limits::max_digits10); } return !!(os << c3t3); // call operator!() twice, because operator bool() is C++11 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 db0cc2fa28d..6255bb26104 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 @@ -973,7 +973,7 @@ private: typedef typename Vertex_map_iterator_first::reference pointer; typedef typename iterator_adaptor_::reference reference; - Vertex_map_iterator_first_dereference() : Self::iterator_adaptor_() { } + Vertex_map_iterator_first_dereference() = default; template < typename Iterator > Vertex_map_iterator_first_dereference(Iterator i) @@ -2034,6 +2034,7 @@ Mesh_complex_3_in_triangulation_3:: rescan_after_load_of_triangulation() { corners_.clear(); + far_vertices_.clear(); for(typename Tr::Finite_vertices_iterator vit = this->triangulation().finite_vertices_begin(), end = this->triangulation().finite_vertices_end(); @@ -2041,6 +2042,8 @@ rescan_after_load_of_triangulation() { if ( vit->in_dimension() == 0 ) { add_to_complex(vit, Corner_index(1)); + } else if(vit->in_dimension() == -1) { + far_vertices_.push_back(vit); } } diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h index 8ed8d332f59..a9a98b155ba 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h @@ -96,9 +96,7 @@ public: }; public: - Simplicial_mesh_cell_base_3() - : time_stamp_(std::size_t(-1)) - {} + Simplicial_mesh_cell_base_3() = default; Simplicial_mesh_cell_base_3(const Simplicial_mesh_cell_base_3& rhs) : Cb(static_cast(rhs)), @@ -191,7 +189,7 @@ private: /// Stores surface_index for each facet of the cell std::array surface_index_table_ = {}; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); // The index of the cell of the input complex that contains me Subdomain_index subdomain_index_ = {}; diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h index 96a2377355c..1a15aaf09d7 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h @@ -130,7 +130,6 @@ public: , index_() , dimension_(-1) , cache_validity(false) - , time_stamp_(std::size_t(-1)) {} // Default copy constructor and assignment operator are ok @@ -218,7 +217,7 @@ private: // that contains me. Negative values are a marker for special vertices. short dimension_; bool cache_validity; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: friend std::istream& operator>>(std::istream& is, diff --git a/SMDS_3/test/SMDS_3/CMakeLists.txt b/SMDS_3/test/SMDS_3/CMakeLists.txt index 75c24114c88..5e3c56f8260 100644 --- a/SMDS_3/test/SMDS_3/CMakeLists.txt +++ b/SMDS_3/test/SMDS_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(SMDS_3_Tests) find_package(CGAL REQUIRED) diff --git a/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp b/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp index 4373da1fdc0..1270c1d0db8 100644 --- a/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp +++ b/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp @@ -346,11 +346,10 @@ struct Tester // Test vertex iterators //------------------------------------------------------- std::cout << "Test vertex iterators\n"; - const Vertex_handle& vertex_to_modify = c3t3.vertices_in_complex_begin(); + Vertex_handle vertex_to_modify = c3t3.vertices_in_complex_begin(); Vertex_handle vertex_to_modify_copy = vertex_to_modify; c3t3.remove_from_complex(vertex_to_modify); - // now `vertex_to_modify` is a dangling ref to a `Vertex_handle` // use a copy of it: `vertex_to_modify_copy` c3t3.add_to_complex(vertex_to_modify_copy,corner_index_bis); diff --git a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt index 785873363e7..cfc92cf79eb 100644 --- a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Compact_container_benchmark) find_package(CGAL REQUIRED) diff --git a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt index beb128ff1da..91adfa06755 100644 --- a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(copy_n_benchmark_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h b/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h index 1c28472d34d..5331aaca8ab 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h @@ -21,7 +21,7 @@ namespace CGAL { \ingroup PkgSTLExtensionRef `CGAL::Iterator_range` encapsulates two iterators so they fulfill the `ForwardRange` concept. The class is essentially a clone of `boost::iterator_range`, - and it additionally is derived from `std::pair`, so that one can apply `boost::tie`. + and it additionally is derived from `std::pair`, so that one can apply `std::tie`. */ template class Iterator_range diff --git a/STL_Extension/examples/STL_Extension/CMakeLists.txt b/STL_Extension/examples/STL_Extension/CMakeLists.txt index be616289bff..e0124056098 100644 --- a/STL_Extension/examples/STL_Extension/CMakeLists.txt +++ b/STL_Extension/examples/STL_Extension/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(STL_Extension_Examples) find_package(CGAL REQUIRED) diff --git a/STL_Extension/include/CGAL/Base_with_time_stamp.h b/STL_Extension/include/CGAL/Base_with_time_stamp.h index 962eec8a1e1..5e19193c142 100644 --- a/STL_Extension/include/CGAL/Base_with_time_stamp.h +++ b/STL_Extension/include/CGAL/Base_with_time_stamp.h @@ -16,11 +16,11 @@ namespace CGAL { -template -class Base_with_time_stamp : public Base { +template +class Base_with_time_stamp : public B_w_ts_base { std::size_t time_stamp_ = std::size_t(-2); public: - using Base::Base; + using B_w_ts_base::B_w_ts_base; using Has_timestamp = CGAL::Tag_true; @@ -33,7 +33,7 @@ public: template < class TDS > struct Rebind_TDS { - typedef typename Base::template Rebind_TDS::Other Base2; + typedef typename B_w_ts_base::template Rebind_TDS::Other Base2; typedef Base_with_time_stamp Other; }; }; diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 073300c8a82..9b6cb202e93 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -220,6 +220,10 @@ class Compact_container CGAL_INCREMENT_COMPACT_CONTAINER_BLOCK_SIZE> >::type Increment_policy; typedef TimeStamper_ Ts; + + template using EraseCounterStrategy = + internal::Erase_counter_strategy::value>; + typedef Compact_container Self; typedef Compact_container_traits Traits; public: @@ -354,7 +358,7 @@ public: return all_items[block_number].first[index_in_block]; } - friend void swap(Compact_container& a, Compact_container b) { + friend void swap(Compact_container& a, Compact_container b) noexcept { a.swap(b); } @@ -390,22 +394,16 @@ public: // (just forward the arguments to the constructor, to optimize a copy). template < typename... Args > iterator - emplace(const Args&... args) + emplace(Args&&... args) { if (free_list == nullptr) allocate_new_block(); pointer ret = free_list; free_list = clean_pointee(ret); - std::size_t ts; - CGAL_USE(ts); - if constexpr (Time_stamper::has_timestamp) { - ts = ret->time_stamp(); - } - new (ret) value_type(args...); - if constexpr (Time_stamper::has_timestamp) { - ret->set_time_stamp(ts); - } + const auto ts = Time_stamper::time_stamp(ret); + new (ret) value_type(std::forward(args)...); + Time_stamper::restore_timestamp(ret, ts); Time_stamper::set_time_stamp(ret, time_stamp); CGAL_assertion(type(ret) == USED); ++size_; @@ -414,24 +412,7 @@ public: iterator insert(const T &t) { - if (free_list == nullptr) - allocate_new_block(); - - pointer ret = free_list; - free_list = clean_pointee(ret); - std::size_t ts; - CGAL_USE(ts); - if constexpr (Time_stamper::has_timestamp) { - ts = ret->time_stamp(); - } - std::allocator_traits::construct(alloc, ret, t); - if constexpr (Time_stamper::has_timestamp) { - ret->set_time_stamp(ts); - } - Time_stamper::set_time_stamp(ret, time_stamp); - CGAL_assertion(type(ret) == USED); - ++size_; - return iterator(ret, 0); + return emplace(t); } template < class InputIterator > @@ -450,22 +431,14 @@ public: void erase(iterator x) { - typedef internal::Erase_counter_strategy< - internal::has_increment_erase_counter::value> EraseCounterStrategy; + auto ptr = &*x; + CGAL_precondition(type(ptr) == USED); + EraseCounterStrategy::increment_erase_counter(*x); + const auto ts = Time_stamper::time_stamp(ptr); + std::allocator_traits::destroy(alloc, ptr); + Time_stamper::restore_timestamp(ptr, ts); - CGAL_precondition(type(&*x) == USED); - EraseCounterStrategy::increment_erase_counter(*x); - std::size_t ts; - CGAL_USE(ts); - if constexpr (Time_stamper::has_timestamp) { - ts = x->time_stamp(); - } - std::allocator_traits::destroy(alloc, &*x); - if constexpr (Time_stamper::has_timestamp) { - x->set_time_stamp(ts); - } - - put_on_free_list(&*x); + put_on_free_list(ptr); --size_; } @@ -598,25 +571,7 @@ public: while ( capacity_= 1; --i) - put_on_free_list(new_block + i); + auto [new_block, block_size] = all_items[curblock]; + put_block_on_free_list(new_block, block_size - 2); } while ( curblock>lastblock ); } private: - void allocate_new_block(); +std::pair push_back_new_block(); +void put_block_on_free_list(pointer new_block, size_type block_size); + +void allocate_new_block(); void put_on_free_list(pointer x) { @@ -697,7 +654,7 @@ public: static bool is_begin_or_end(const_pointer ptr) { return type(ptr)==START_END; } - void swap(Self &c) + void swap(Self &c) noexcept { std::swap(alloc, c.alloc); std::swap(capacity_, c.capacity_); @@ -803,23 +760,13 @@ void Compact_container::clear() } template < class T, class Allocator, class Increment_policy, class TimeStamper > -void Compact_container::allocate_new_block() +auto Compact_container::push_back_new_block() + -> std::pair { - typedef internal::Erase_counter_strategy< - internal::has_increment_erase_counter::value> EraseCounterStrategy; - pointer new_block = alloc.allocate(block_size + 2); + std::pair result{new_block, block_size}; all_items.push_back(std::make_pair(new_block, block_size + 2)); capacity_ += block_size; - // We don't touch the first and the last one. - // We mark them free in reverse order, so that the insertion order - // will correspond to the iterator order... - for (size_type i = block_size; i >= 1; --i) - { - EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); - Time_stamper::initialize_time_stamp(new_block + i); - put_on_free_list(new_block + i); - } // We insert this new block at the end. if (last_item == nullptr) // First time { @@ -836,8 +783,33 @@ void Compact_container::allocate_ne set_type(last_item, nullptr, START_END); // Increase the block_size for the next time. Increment_policy::increase_size(*this); + return result; } +template < class T, class Allocator, class Increment_policy, class TimeStamper > +void Compact_container:: +put_block_on_free_list(pointer new_block, size_type block_size) +{ + // The block actually has a size==block_size+2. + // We don't touch the first and the last one. + // We mark them free in reverse order, so that the insertion order + // will correspond to the iterator order... + for (size_type i = block_size; i >= 1; --i) + { + EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); + Time_stamper::initialize_time_stamp(new_block + i); + put_on_free_list(new_block + i); + } +} + +template < class T, class Allocator, class Increment_policy, class TimeStamper > +void Compact_container::allocate_new_block() +{ + auto [new_block, block_size] = push_back_new_block(); + put_block_on_free_list(new_block, block_size); +} + + template < class T, class Allocator, class Increment_policy, class TimeStamper > inline bool operator==(const Compact_container &lhs, diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 7f5533f92b7..653ea056e74 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -202,6 +202,9 @@ class Concurrent_compact_container typedef Concurrent_compact_container Self; typedef Concurrent_compact_container_traits Traits; + template using EraseCounterStrategy = + internal::Erase_counter_strategy::value>; + public: typedef CGAL::Time_stamper_impl Time_stamper; typedef Time_stamper Time_stamper_impl; // backward compatibility @@ -344,28 +347,21 @@ public: // (just forward the arguments to the constructor, to optimize a copy). template < typename... Args > iterator - emplace(const Args&... args) + emplace(Args&&... args) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; FreeList * fl = get_free_list(); pointer ret = init_insert(fl); - auto erase_counter = EraseCounterStrategy::erase_counter(*ret);; - new (ret) value_type(args...); - EraseCounterStrategy::set_erase_counter(*ret, erase_counter); + auto erase_counter = EraseCounterStrategy::erase_counter(*ret); + const auto ts = Time_stamper::time_stamp(ret); + new (ret) value_type(std::forward(args)...); + Time_stamper::restore_timestamp(ret, ts); + EraseCounterStrategy::set_erase_counter(*ret, erase_counter); return finalize_insert(ret, fl); } iterator insert(const T &t) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; - FreeList * fl = get_free_list(); - pointer ret = init_insert(fl); - auto erase_counter = EraseCounterStrategy::erase_counter(*ret);; - std::allocator_traits::construct(m_alloc, ret, t); - EraseCounterStrategy::set_erase_counter(*ret, erase_counter); - return finalize_insert(ret, fl); + return emplace(t); } template < class InputIterator > @@ -385,13 +381,13 @@ public: private: void erase(iterator x, FreeList * fl) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; - CGAL_precondition(type(x) == USED); - EraseCounterStrategy::increment_erase_counter(*x); + EraseCounterStrategy::increment_erase_counter(*x); + auto ptr = &*x; + const auto ts = Time_stamper::time_stamp(ptr); std::allocator_traits::destroy(m_alloc, &*x); + Time_stamper::restore_timestamp(ptr, ts); put_on_free_list(&*x, fl); } @@ -778,9 +774,6 @@ template < class T, class Allocator > void Concurrent_compact_container:: allocate_new_block(FreeList * fl) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; - size_type old_block_size; pointer new_block; @@ -818,7 +811,7 @@ void Concurrent_compact_container:: // will correspond to the iterator order... for (size_type i = old_block_size; i >= 1; --i) { - EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); + EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); Time_stamper::initialize_time_stamp(new_block + i); put_on_free_list(new_block + i, fl); } diff --git a/STL_Extension/include/CGAL/Has_timestamp.h b/STL_Extension/include/CGAL/Has_timestamp.h index ad608a4f6b6..3fe442576cc 100644 --- a/STL_Extension/include/CGAL/Has_timestamp.h +++ b/STL_Extension/include/CGAL/Has_timestamp.h @@ -36,6 +36,9 @@ namespace internal { // when T does not have a Has_timestamp tag {}; + template + constexpr bool has_timestamp_v = Has_timestamp::value; + } // end namespace internal } // end namespace CGAL diff --git a/STL_Extension/include/CGAL/Iterator_range.h b/STL_Extension/include/CGAL/Iterator_range.h index e42441e9858..2c41f38266a 100644 --- a/STL_Extension/include/CGAL/Iterator_range.h +++ b/STL_Extension/include/CGAL/Iterator_range.h @@ -18,56 +18,36 @@ namespace CGAL { - /*! -\ingroup PkgSTLExtensionRef - /// `CGAL::Iterator_range` is a... - */ - template - class Iterator_range - : public std::pair{ +/*! + \ingroup PkgSTLExtensionRef + `CGAL::Iterator_range` encapsulates two iterators so they fulfill the `ForwardRange` concept. + The class is essentially a clone of `boost::iterator_range`, + and it additionally is derived from `std::pair`, so that one can apply `boost::tie`. +*/ +template +class Iterator_range : public std::pair +{ + typedef std::pair Base; - typedef std::pair Base; +public: + typedef I iterator; + typedef I const_iterator; - public: + Iterator_range() = default; + Iterator_range(I b, I e) + : Base(b, e) {} + Iterator_range(const std::pair& ip) + : Base(ip) {} - typedef I iterator; - typedef I const_iterator; - - Iterator_range(I b, I e) - : Base(b,e) - {} - - - // Iterator_range(const Iterator_range& ip) - // : Base(ip) - // {} - - Iterator_range(const std::pair& ip) - : Base(ip) - {} - - I begin() const - { - return this->first; - } - - I end() const - { - return this->second; - } + I begin() const { return this->first; } + I end() const { return this->second; } /// returns `std::distance(begin(), end())` - std::size_t - size() const - { - return static_cast(std::distance(begin(), end())); - } + std::size_t size() const { return static_cast(std::distance(begin(), end())); } /// returns `std::distance(begin(), end())==0` - bool empty() const - { - return begin()==end(); - } + bool empty() const { return begin() == end(); } operator std::tuple() { @@ -87,37 +67,25 @@ namespace CGAL { } }; - template - Iterator_range - make_range(const T& b, const T&e) - { - return Iterator_range(b,e); - } +template +Iterator_range +make_range(const T& b, const T&e) +{ + return Iterator_range(b,e); +} - template - Iterator_range - make_range(const std::pair& p) - { - return Iterator_range(p.first,p.second); - } +template +Iterator_range +make_range(const std::pair& p) +{ + return Iterator_range(p.first,p.second); +} } // namespace CGAL -// At global scope... - +namespace boost::foreach { template -inline boost::mpl::true_ * - boost_foreach_is_lightweight_proxy( CGAL::Iterator_range *&, boost::foreach::tag ) -{ - return 0; + struct is_lightweight_proxy> : boost::mpl::true_ {}; } -namespace boost { namespace foreach -{ - template - struct is_lightweight_proxy< CGAL::Iterator_range > - : mpl::true_ - { - }; -}} #endif // CGAL_ITERATOR_RANGE_H diff --git a/STL_Extension/include/CGAL/Random_allocator.h b/STL_Extension/include/CGAL/Random_allocator.h new file mode 100644 index 00000000000..6c8b9dd49cf --- /dev/null +++ b/STL_Extension/include/CGAL/Random_allocator.h @@ -0,0 +1,201 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_RANDOM_ALLOCATOR_H +#define CGAL_RANDOM_ALLOCATOR_H + +#include +#include +#include +#include +#include + +#if CGAL_DEBUG_RANDOM_ALLOCATOR +# if __has_include() +# include +# include +# if __cpp_lib_format >= 201907L +# define CGAL_DEBUG_RANDOM_ALLOCATOR_OKAY 1 +# endif +# endif +# if ! CGAL_DEBUG_RANDOM_ALLOCATOR_OKAY +# error "CGAL_DEBUG_RANDOM_ALLOCATOR requires and C++20 std::format" +# endif +#endif + +namespace CGAL { + +// A random allocator that allocates blocks of memory and returns random +// locations. To use only for debugging purposes. That allocator is: +// - not efficient, +// - not thread-safe, +// - and increases memory-fragmentation and non-locality. +template > class Random_allocator +{ + constexpr static std::size_t minimal_block_size = 1024; + constexpr static std::size_t random_size = 64; + + struct Blocks + { + struct Block + { + T* data = nullptr; + boost::dynamic_bitset<> available; + std::size_t maximal_continuous_free_space = 0; + + auto size() const { return available.size(); } + }; + + Upstream_allocator alloc; + std::vector blocks; // List of allocated blocks + + void allocate_new_block(std::size_t block_size = minimal_block_size) + { + auto& block = blocks.emplace_back(); + block.data = alloc.allocate(block_size); + block.available.resize(block_size, true); + block.maximal_continuous_free_space = block_size; + } + + Blocks(const Upstream_allocator& alloc) : alloc(alloc) { allocate_new_block(); } + + ~Blocks() + { + for(auto& block : blocks) { + alloc.deallocate(block.data, block.size()); + } + } + }; + using Block = typename Blocks::Block; + using Ptr = std::shared_ptr; + + Ptr ptr_; + std::mt19937 gen; + +public: + using value_type = T; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using allocator_type = Upstream_allocator; + + Random_allocator(const Upstream_allocator& alloc = {}) noexcept; + + pointer allocate(size_type n, const void* hint = 0); + void deallocate(pointer p, size_type n); + + template void construct(U* p, Args&&... args); + template void destroy(U* p); + + size_type max_size() const noexcept; + + template struct rebind + { + using upstream_traits = std::allocator_traits; + using other_upstream_allocator = typename upstream_traits::template rebind_alloc; + using other = Random_allocator; + }; + + bool operator==(const Random_allocator&) const noexcept; + bool operator!=(const Random_allocator&) const noexcept; +}; + +// Implementation of Random_allocator methods +template +Random_allocator::Random_allocator(const Upstream_allocator& alloc) noexcept + : ptr_(std::make_shared(alloc)), gen(std::random_device()()) +{ +} + +template +typename Random_allocator::pointer +Random_allocator::allocate(size_type n, const void* hint) +{ + boost::container::static_vector, random_size> found_spaces; + for(auto it = ptr_->blocks.rbegin(), end = ptr_->blocks.rend(); it != end; ++it) { + auto& block = *it; + if(block.maximal_continuous_free_space < n) + continue; + auto& available = block.available; + const auto block_size = block.size(); + size_type found_max_free_space = 0; + auto index = available.find_first(); + while(index != boost::dynamic_bitset<>::npos) { + available.flip(); + const auto end_of_free_block = (std::min)(available.find_next(index), block_size); + available.flip(); + auto free_space = end_of_free_block - index; + found_max_free_space = (std::max)(found_max_free_space, free_space); + while(free_space > n && found_spaces.size() < found_spaces.capacity()) { + found_spaces.emplace_back(std::addressof(block), index); + free_space -= n; + index += n; + } + index = block.available.find_next(end_of_free_block); + } + block.maximal_continuous_free_space = found_max_free_space; + if(found_spaces.size() == found_spaces.capacity()) + break; + } + if(!found_spaces.empty()) { + std::uniform_int_distribution<> dis(0, found_spaces.size() - 1); + auto i = dis(gen); + auto [block, index] = found_spaces[i]; + block->available.set(index, n, false); +#if CGAL_DEBUG_RANDOM_ALLOCATOR + std::clog << std::format("CGAL::Random_allocator debug info: n = {}, found_spaces.size() = {}, i = {}," + " block id = {}, block size = {}, index = {}\n", + n, found_spaces.size(), i, block - ptr_->blocks.data(), block->size(), index); +#endif // CGAL_DEBUG_RANDOM_ALLOCATOR + return block->data + index; + } + size_type block_size = (std::max)(n * random_size, minimal_block_size); + ptr_->allocate_new_block(block_size); + return allocate(n, hint); +} + +template +void Random_allocator::deallocate(pointer p, size_type n) +{ + for(auto& block : ptr_->blocks) { + if(block.data <= p && p < block.data + block.size()) { + block.available.set(p - block.data, n, true); + return; + } + } +} + +template +template +void Random_allocator::construct(U* p, Args&&... args) +{ + ::new((void*)p) U(std::forward(args)...); +} + +template +template +void Random_allocator::destroy(U* p) +{ + p->~U(); +} + +template +typename Random_allocator::size_type +Random_allocator::max_size() const noexcept +{ + return (std::numeric_limits::max)() / sizeof(T); +} + +} // namespace CGAL + +#endif // CGAL_RANDOM_ALLOCATOR_H diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h index 09487cc44f9..10611ef80bd 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h @@ -12,6 +12,15 @@ #define CGAL_MESH_OPTION_CLASSES_H #include +#include +#include +#include + +#include + +#include +#include +#include namespace CGAL { @@ -165,6 +174,171 @@ private: bool b_; }; +// Mesh initialization +// Holds the two parameters `initial_points_generator` and `initial_points`, +// without knowing their types, into a single generator. +template +struct Initialization_options +{ + using Point = typename C3t3::Triangulation::Point; + using Default_initial_point_type + = std::tuple; + using Initial_points_range + = typename CGAL::Default::Get>::type; + + template + static auto cbegin(Range&& range) { + return std::cbegin(std::forward(range)); + } + + template + static auto cend(Range&& range) { + return std::cend(std::forward(range)); + } + using Initial_points_const_iterator = decltype(cbegin(std::declval())); + + struct Output_function_ref { + // This reference-like type uses type erasure to store a reference to a callable + // + // See the video "Breaking Dependencies - C++ Type Erasure - The Implementation Details" + // by Klaus Iglberger at CppCon 2022, from time code 49:57. + // URL: https://youtu.be/qn6OqefuH08?si=YzhwpgNLur8_jOeC&t=2997" + + using Erased_call_function_pointer_type = void(*)(void*, const Default_initial_point_type&); + + // store the address of the callable + void* const f_ = nullptr; + // and the call function (the non-capturing lambda generated by the templated constructor) + Erased_call_function_pointer_type const call_ = nullptr; + + template , + Output_function_ref> + > + > + Output_function_ref(Function&& f) + : f_(std::addressof(f)) + , call_( [](void* f, const Default_initial_point_type& p) { + using F = CGAL::cpp20::remove_cvref_t; + auto* real_f = static_cast(f); + (*real_f)(p); + } ) + { + } + + template + void operator()(Tuple_like&& p) const + { + using Tuple_like_no_cvref = CGAL::cpp20::remove_cvref_t; + if constexpr (CGAL::STL_Extension::internal::tuple_like_of_size_2) { + const auto& [pt, index] = p; + call_(f_, Default_initial_point_type(pt, 2, index)); + } else if constexpr (std::is_same_v) { + call_(f_, std::forward(p)); + } else { + const auto& [pt, dim, index] = p; + call_(f_, Default_initial_point_type(pt, dim, index)); + } + } + }; // end of struct Output_function_ref + + using Point_output_function_iterator = boost::function_output_iterator; + + struct Generator_ref { // type-erased reference to a generator, same as Output_function_ref + using Erased_call_function_pointer_type = Point_output_function_iterator(*)(void*, Point_output_function_iterator, const int); + + void * const generator_ = nullptr; + Erased_call_function_pointer_type const call_ = nullptr; + + template , + Generator_ref> + > + > + Generator_ref(Generator&& generator) + : generator_(std::addressof(generator)) + , call_( [](void* g, Point_output_function_iterator oit, const int n) { + using Real_generator = CGAL::cpp20::remove_cvref_t; + auto* real_g = static_cast(g); + return (*real_g)(oit, n); + } ) + { + } + + Generator_ref() = default; + + Point_output_function_iterator operator()(Point_output_function_iterator oit, const int n) const + { + return call_(generator_, oit, n); + } + + Point_output_function_iterator operator()(Point_output_function_iterator oit, const int n) + { + return call_(generator_, oit, n); + } + + bool operator==(std::nullptr_t) const { return generator_ == nullptr; } + }; // end of struct Generator_ref + + Initialization_options() + {} + + template + Initialization_options(Initial_points_generator& generator, + const Initial_points_range& initial_points) + : initial_points_generator_(std::forward(generator)) + , begin_it(cbegin(initial_points)) + , end_it(cend(initial_points)) + {} + + template + static OutputIterator call_operator(Self& self, OutputIterator pts_it, const int n) + { + // add initial_points + pts_it = std::copy(self.begin_it, self.end_it, pts_it); + + if(self.initial_points_generator_ == nullptr) { + return pts_it; + } + + // Now, create an output iterator type-erasing the type of `pts_it`... + auto output_to_pts_it = [&](const Default_initial_point_type& p) { *pts_it++ = p; }; + Output_function_ref function_ref{ output_to_pts_it }; // maintains a non-const reference to pts_it + Point_output_function_iterator output_iterator{ function_ref }; + + // ...and use the type-erased output iterator with the type-erased generator. + self.initial_points_generator_(output_iterator, n); + return pts_it; + } + + template + OutputIterator operator()(OutputIterator pts, const int n = 0) + { + return call_operator(*this, pts, n); + } + + template + OutputIterator operator()(OutputIterator pts, const int n = 0) const + { + return call_operator(*this, pts, n); + } + + bool is_default() const + { + return begin_it == end_it && initial_points_generator_ == nullptr; + } + +private: + Generator_ref initial_points_generator_; //reference that type-erases the generator type + + // The two iterators point to the `initial_points` container + Initial_points_const_iterator begin_it; + Initial_points_const_iterator end_it; +}; + // ----------------------------------- // Features generator // ----------------------------------- diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index c95d2933e89..8563e9f9a4e 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -346,6 +346,8 @@ CGAL_add_named_parameter_with_compatibility(do_reset_c3t3_t, do_reset_c3t3, do_r CGAL_add_named_parameter_with_compatibility(mesh_param_t, mesh_param, mesh_options) CGAL_add_named_parameter_with_compatibility(manifold_param_t, manifold_param, manifold_option) CGAL_add_named_parameter_with_compatibility(features_option_param_t,features_options_param,features_options) +CGAL_add_named_parameter_with_compatibility(initial_points_generator_param_t,initial_points_generator_param,initial_points_generator) +CGAL_add_named_parameter_with_compatibility(initial_points_param_t,initial_points_param,initial_points) CGAL_add_named_parameter_with_compatibility_cref_only(image_3_param_t, image_3_param, image) CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value) diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/tuple_like_helpers.h b/STL_Extension/include/CGAL/STL_Extension/internal/tuple_like_helpers.h new file mode 100644 index 00000000000..de9cc33c7eb --- /dev/null +++ b/STL_Extension/include/CGAL/STL_Extension/internal/tuple_like_helpers.h @@ -0,0 +1,33 @@ +// Copyright (c) 2024 GeometryFactory (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) : Laurent Rineau + +#ifndef CGAL_STL_EXTENSION_INTERNAL_TUPLE_LIKE_HELPERS_H +#define CGAL_STL_EXTENSION_INTERNAL_TUPLE_LIKE_HELPERS_H + +#include +#include + +namespace CGAL::STL_Extension::internal { + + template + constexpr bool has_tuple_size_v = false; + + template + constexpr bool has_tuple_size_v::value)>> = true; + + template > + constexpr bool tuple_like_of_size_2 = false; + + template + constexpr bool tuple_like_of_size_2 = (std::tuple_size_v == 2); + +} // end namespace CGAL::STL_Extension::internal + +#endif // CGAL_STL_EXTENSION_INTERNAL_TUPLE_LIKE_HELPERS_H diff --git a/STL_Extension/include/CGAL/Skiplist.h b/STL_Extension/include/CGAL/Skiplist.h index 3be7908c90c..e7d7b60b422 100644 --- a/STL_Extension/include/CGAL/Skiplist.h +++ b/STL_Extension/include/CGAL/Skiplist.h @@ -75,7 +75,7 @@ public: all_iterator , typename all_list::iterator , T - > + , std::bidirectional_iterator_tag> { public: all_iterator() {} @@ -91,7 +91,7 @@ public: skip_iterator , typename skip_list::iterator , T - > + , std::bidirectional_iterator_tag> { public: skip_iterator() {} diff --git a/STL_Extension/include/CGAL/Time_stamper.h b/STL_Extension/include/CGAL/Time_stamper.h index 081c003b69b..01187a33085 100644 --- a/STL_Extension/include/CGAL/Time_stamper.h +++ b/STL_Extension/include/CGAL/Time_stamper.h @@ -30,13 +30,17 @@ struct Time_stamper { static constexpr bool has_timestamp = true; + static bool is_valid(const T* pt) { + return pt != nullptr && pt->time_stamp() != std::size_t(-2); + } + static void initialize_time_stamp(T* pt) { pt->set_time_stamp(std::size_t(-1)); } template static void set_time_stamp(T* pt, time_stamp_t& time_stamp_) { - CGAL_assertion(pt->time_stamp() != std::size_t(-2)); + CGAL_assertion(is_valid(pt)); if(pt->time_stamp() == std::size_t(-1)) { const std::size_t new_ts = time_stamp_++; pt->set_time_stamp(new_ts); @@ -64,13 +68,18 @@ struct Time_stamper static std::size_t time_stamp(const T* pt) { - CGAL_assertion(pt == nullptr || pt->time_stamp() != std::size_t(-2)); + CGAL_assertion(is_valid(pt)); if(pt == nullptr){ return std::size_t(-1); } return pt->time_stamp(); } + static void restore_timestamp(T* pt, std::size_t ts) + { + pt->set_time_stamp(ts); + } + static auto display_id(const T* pt, int offset = 0) { if(pt == nullptr) @@ -80,7 +89,7 @@ struct Time_stamper } static std::size_t hash_value(const T* p) { - CGAL_assertion(p == nullptr || p->time_stamp() != std::size_t(-2)); + CGAL_assertion(nullptr== p || is_valid(p)); if(nullptr == p) return std::size_t(-1); else @@ -116,6 +125,10 @@ public: return 0; } + static void restore_timestamp(T*, std::size_t) + { + } + static auto display_id(const T* pt, int) { return static_cast(pt); diff --git a/STL_Extension/include/CGAL/unordered_flat_map.h b/STL_Extension/include/CGAL/unordered_flat_map.h new file mode 100644 index 00000000000..73ff2135033 --- /dev/null +++ b/STL_Extension/include/CGAL/unordered_flat_map.h @@ -0,0 +1,84 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_UNORDERED_FLAT_MAP_H +#define CGAL_UNORDERED_FLAT_MAP_H + +#include + +#include +#if BOOST_VERSION >= 108100 && !defined(CGAL_USE_BOOST_UNORDERED) +# define CGAL_USE_BOOST_UNORDERED 1 +#endif + +#if CGAL_USE_BARE_STD_SET +# define CGAL_USE_BARE_STD_MAP CGAL_USE_BARE_STD_SET +#endif + +#if CGAL_USE_BARE_STD_MAP // to benchmark with the ordered std::map +# include +# include +#elif CGAL_USE_BOOST_UNORDERED +# include +# include +#else // Boost before 1.81.0, use the C++11 std::unordered_map +# include +# include +#endif + +#include // for std::hash, std::equal_to +#include // for std::allocator + +namespace CGAL { + +template < + typename Key, + typename T, + typename Hash = std::hash, + typename KeyEqual = std::equal_to, + typename Allocator = std::allocator> + > +#if CGAL_USE_BARE_STD_MAP + + using unordered_flat_map = std::map, Allocator>; + +#elif CGAL_USE_BOOST_UNORDERED + + using unordered_flat_map = boost::unordered_flat_map; + +#else // use the C++11 std::unordered_map + + using unordered_flat_map = std::unordered_map; + +#endif + +template < + typename Key, + typename Hash = std::hash, + typename KeyEqual = std::equal_to, + typename Allocator = std::allocator + > +#if CGAL_USE_BARE_STD_MAP + + using unordered_flat_set = std::set, Allocator>; + +#elif CGAL_USE_BOOST_UNORDERED + + using unordered_flat_set = boost::unordered_flat_set; + +#else // use the C++11 std::unordered_set + + using unordered_flat_set = std::unordered_set; + +#endif + +} // end namespace CGAL + +#endif // CGAL_UNORDERED_FLAT_MAP_H diff --git a/STL_Extension/include/CGAL/unordered_flat_set.h b/STL_Extension/include/CGAL/unordered_flat_set.h new file mode 100644 index 00000000000..bf71b173013 --- /dev/null +++ b/STL_Extension/include/CGAL/unordered_flat_set.h @@ -0,0 +1,17 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_UNORDERED_FLAT_SET_H +#define CGAL_UNORDERED_FLAT_SET_H + +// lazy implementation: define the two template aliases in the same header file +#include + +#endif // CGAL_UNORDERED_FLAT_SET_H diff --git a/STL_Extension/test/STL_Extension/CMakeLists.txt b/STL_Extension/test/STL_Extension/CMakeLists.txt index fafddb64a21..b1007acfcb5 100644 --- a/STL_Extension/test/STL_Extension/CMakeLists.txt +++ b/STL_Extension/test/STL_Extension/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(STL_Extension_Tests) find_package(CGAL REQUIRED) diff --git a/STL_Extension/test/STL_Extension/test_Compact_container.cpp b/STL_Extension/test/STL_Extension/test_Compact_container.cpp index bf6b0d83948..8cb5d9726ec 100644 --- a/STL_Extension/test/STL_Extension/test_Compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Compact_container.cpp @@ -18,7 +18,6 @@ template struct Node_1 : public CGAL::Compact_container_base { - Node_1() {} // // it is important `time_stamp_` is not initialized bool operator==(const Node_1 &) const { return true; } bool operator!=(const Node_1 &) const { return false; } bool operator< (const Node_1 &) const { return false; } @@ -49,7 +48,7 @@ struct Node_1 } ///@} int m_erase_counter; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; class Node_2 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 a42676f8f7f..e919369cabf 100644 --- a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp @@ -32,7 +32,6 @@ int main() struct Node_1 : public CGAL::Compact_container_base { - Node_1() {} bool operator==(const Node_1 &) const { return true; } bool operator!=(const Node_1 &) const { return false; } bool operator< (const Node_1 &) const { return false; } @@ -45,7 +44,7 @@ struct Node_1 void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; class Node_2 diff --git a/STL_Extension/test/STL_Extension/test_namespaces.cpp b/STL_Extension/test/STL_Extension/test_namespaces.cpp index 63a9971c576..f7293e8a7c4 100644 --- a/STL_Extension/test/STL_Extension/test_namespaces.cpp +++ b/STL_Extension/test/STL_Extension/test_namespaces.cpp @@ -13,7 +13,7 @@ int main() { - CGAL::cpp0x::array arr; + CGAL::cpp0x::array arr{1, 2, 3}; std::array arr2; CGAL::cpp0x::tuple tuple; diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index 194a7c45a7a..5210e9a1e61 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Scale_space_reconstruction_3_Examples) find_package(CGAL REQUIRED) diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp index a562362bfcf..398e35353b9 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { // Also store the input points as vertex property Surface_mesh::Property_map original; bool created; - boost::tie(original, created) = mesh.add_property_map("v:original"); + std::tie(original, created) = mesh.add_property_map("v:original"); assert(created); int i = 0; diff --git a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake index b6312224eae..1d8a21b403e 100644 --- a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake +++ b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake @@ -10,7 +10,7 @@ # GPL_PACKAGE_LIST=path to a file containing the list of GPL packages to include in the release. If not provided all of them are. # GENERATE_TARBALLS=[ON/OFF] indicates if release tarballs should be created as DESTINATION -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_program(BASH NAMES bash sh) function(process_package pkg) if(VERBOSE) diff --git a/Scripts/scripts/cgal_create_CMakeLists b/Scripts/scripts/cgal_create_CMakeLists index e83f25c1286..122db278a79 100755 --- a/Scripts/scripts/cgal_create_CMakeLists +++ b/Scripts/scripts/cgal_create_CMakeLists @@ -85,7 +85,7 @@ create_cmake_script_with_options() # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) EOF #--------------------------------------------------------------------------- diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index 3b74a4a3da6..c3ca8376f43 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -31,7 +31,7 @@ create_cmake_script() # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( ${PROJECT}${TYPE} ) find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core ) @@ -49,7 +49,7 @@ EOF echo "include_directories (BEFORE \"${SOURCE_DIR}include\")" echo fi - + for file in `ls "$SOURCE_DIR"*.cc "$SOURCE_DIR"*.cp "$SOURCE_DIR"*.cxx "$SOURCE_DIR"*.cpp "$SOURCE_DIR"*.CPP "$SOURCE_DIR"*.c++ "$SOURCE_DIR"*.C 2>/dev/null | sort` ; do # Create an executable for each cpp that contains a function "main()" BASE=`basename $file .cc` @@ -90,18 +90,21 @@ while [ $1 ]; do -h|-help|--h|--help) usage; exit ;; - example) + example) if [ -z "$TYPE" ]; then TYPE=_Examples; shift; else usage; exit 1; fi ;; - demo) + demo) if [ -z "$TYPE" ]; then TYPE=_Demo; shift; else usage; exit 1; fi ;; - test) + test) if [ -z "$TYPE" ]; then TYPE=; shift; else usage; exit 1; fi ;; + benchmark) + if [ -z "$TYPE" ]; then TYPE=_Benchmarks; shift; else usage; exit 1; fi + ;; --source_dir) - if [ -d "$2" ]; then - SOURCE_DIR=$2; + if [ -d "$2" ]; then + SOURCE_DIR=$2; shift; shift; else @@ -112,7 +115,7 @@ while [ $1 ]; do echo "Error: \"$2\" is not a directory!" echo fi - usage; exit 1; + usage; exit 1; fi ;; *) diff --git a/SearchStructures/doc/SearchStructures/PackageDescription.txt b/SearchStructures/doc/SearchStructures/PackageDescription.txt index a2f35335bfc..3fdc12fd5b8 100644 --- a/SearchStructures/doc/SearchStructures/PackageDescription.txt +++ b/SearchStructures/doc/SearchStructures/PackageDescription.txt @@ -10,7 +10,6 @@ /*! \addtogroup PkgSearchStructuresRef -\todo check generated documentation \cgalPkgDescriptionBegin{dD Range and Segment Trees,PkgSearchStructures} \cgalPkgPicture{segment_tree.png} \cgalPkgSummaryBegin diff --git a/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt b/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt index cd2ca858e8c..e76de2ed570 100644 --- a/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt +++ b/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(RangeSegmentTrees_Examples) find_package(CGAL REQUIRED) diff --git a/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt b/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt index 661aac496bb..4d9c045cdca 100644 --- a/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt +++ b/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(RangeSegmentTrees_Tests) find_package(CGAL REQUIRED) diff --git a/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt b/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt index 7b51d363797..c8eaef98912 100644 --- a/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt index 947f7034f0d..8db5cfb3b9b 100644 --- a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt +++ b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgSegmentDelaunayGraph2Ref /*! \addtogroup PkgSegmentDelaunayGraph2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Segment Delaunay Graphs,PkgSegmentDelaunayGraph2} \cgalPkgPicture{svd.png} \cgalPkgSummaryBegin diff --git a/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt b/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt index 18da5df1518..5b83dc70bdf 100644 --- a/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt index 9507b4e0539..39174628037 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp index aabc32a7b35..57ed0cc3fd4 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp @@ -1,14 +1,11 @@ -#include -#include -#include -#include -#include -#include -#include + #include #include +#include +#include + #if defined(CGAL_USE_CORE) || defined(CGAL_USE_LEDA) #include #endif @@ -16,6 +13,10 @@ #include #include +#include +#include +#include +#include typedef CGAL::Simple_cartesian Double_Kernel; typedef CGAL::Simple_cartesian > IT_Kernel; diff --git a/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 490127d7e40..c6070560bce 100644 --- a/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt b/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt index 3b8dcdecfb0..42096623238 100644 --- a/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt +++ b/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt @@ -4,7 +4,6 @@ /*! \addtogroup PkgSegmentDelaunayGraphLinf2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{L Infinity Segment Delaunay Graphs,PkgSegmentDelaunayGraphLinf2} \cgalPkgPicture{sdglinf-small.png} diff --git a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 36922d90e81..85becfa330f 100644 --- a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_Linf_2_Examples) find_package(CGAL REQUIRED) diff --git a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 7c8b12dcd47..d4b41c10d96 100644 --- a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_Linf_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp index 570eb727a6f..0e96c246782 100644 --- a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp +++ b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp @@ -5,20 +5,20 @@ #define CGAL_SDG_DEBUG(a) { a } #endif +#include +#include + #include #include #include #include -#include #include #include #include #include #include -#include -#include diff --git a/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt b/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt index d8a58dc8c2e..95db7735c9c 100644 --- a/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt +++ b/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Set_movable_separability_2_Examples) find_package(CGAL REQUIRED) 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 7169e884959..633c1dc785c 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 @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Set_movable_separability_2_Tests) if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) diff --git a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt index 5b6beaced89..600d1b6b8b0 100644 --- a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt +++ b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_detection_Benchmarks) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_detection/examples/Shape_detection/CMakeLists.txt b/Shape_detection/examples/Shape_detection/CMakeLists.txt index 0a942592731..7e5581c3126 100644 --- a/Shape_detection/examples/Shape_detection/CMakeLists.txt +++ b/Shape_detection/examples/Shape_detection/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_detection_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_detection/test/Shape_detection/CMakeLists.txt b/Shape_detection/test/Shape_detection/CMakeLists.txt index 85d23cf07d2..b8976228add 100644 --- a/Shape_detection/test/Shape_detection/CMakeLists.txt +++ b/Shape_detection/test/Shape_detection/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_detection_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt b/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt index 58f2ab7b2b0..d9dd81993d4 100644 --- a/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt @@ -3,7 +3,7 @@ project(Shape_regularization_Benchmarks) -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt index ed0104fe41a..fc4314a4124 100644 --- a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_regularization_Examples) diff --git a/Shape_regularization/test/Shape_regularization/CMakeLists.txt b/Shape_regularization/test/Shape_regularization/CMakeLists.txt index 02762c7aa8a..a9ad0ee3e82 100644 --- a/Shape_regularization/test/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/test/Shape_regularization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_regularization_Tests) diff --git a/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt b/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt index 10bbb63a0e4..be6cde05f0e 100644 --- a/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt +++ b/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Skin_surface_3_Examples) find_package(CGAL REQUIRED) diff --git a/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt b/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt index 3e6401efc37..2b31a9b2e8c 100644 --- a/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt +++ b/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Skin_surface_3_Tests) find_package(CGAL REQUIRED) diff --git a/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt b/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt index 39d8c15bcd7..58e533bedcf 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt +++ b/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgSnapRounding2Ref /*! \addtogroup PkgSnapRounding2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Snap Rounding,PkgSnapRounding2} \cgalPkgPicture{snap-detail.png} \cgalPkgSummaryBegin diff --git a/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt index 5b3941923b9..e09fa21f5d5 100644 --- a/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Snap_rounding_2_Examples) find_package(CGAL REQUIRED) diff --git a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt index eba48480599..9add288c3ac 100644 --- a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Snap_rounding_2_Tests) find_package(CGAL REQUIRED) diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index f097c4238f3..0eb7b843212 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Solver_interface_Examples) find_package(CGAL REQUIRED) diff --git a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt index f22da933174..03b97f1de01 100644 --- a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp index 3dd0b399892..a9972641131 100644 --- a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp +++ b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp @@ -1002,7 +1002,7 @@ namespace nanoflann if(node->child1 == NULL && node->child2 == NULL) return 1; else{ - return std::max(depth(node->child1)+1,depth(node->child2)+1); + return (std::max)(depth(node->child1)+1,depth(node->child2)+1); } } @@ -1130,8 +1130,8 @@ namespace nanoflann node->sub.divhigh = right_bbox[cutfeat].low; for (int i=0; i<(DIM>0 ? DIM : dim); ++i) { - bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low); - bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high); + bbox[i].low = (std::min)(left_bbox[i].low, right_bbox[i].low); + bbox[i].high = (std::max)(left_bbox[i].high, right_bbox[i].high); } } diff --git a/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt index cf823429fee..be2a6e773f9 100644 --- a/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(tools_) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt index bd3f74a6223..71295e2562a 100644 --- a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_Examples) # CGAL and its components diff --git a/Spatial_searching/test/Spatial_searching/CMakeLists.txt b/Spatial_searching/test/Spatial_searching/CMakeLists.txt index c6bce28aef0..e078b954112 100644 --- a/Spatial_searching/test/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/test/Spatial_searching/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_Tests) find_package(CGAL REQUIRED) diff --git a/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt index 7311dc9811e..1b3fa5a4c03 100644 --- a/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_sorting_) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt index 1fc5703e5b2..152bcab93be 100644 --- a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_sorting_Examples) find_package(CGAL REQUIRED) diff --git a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt index 1aa81dc1929..7b94c7f8bf1 100644 --- a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_sorting_Tests) find_package(CGAL REQUIRED) diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h index dc4ec8c2d48..1331edf5f38 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h @@ -190,7 +190,7 @@ Straight_skeleton_builder_2& enter_contour( InputPointIterator aBegin, InputPoin /*! defines the weights of the contour last entered through `enter_contour()`. -\tparam InputPointIterator must be a model `InputIterator` whose `value_type` is `FT`. +\tparam WeightIterator must be a model `InputIterator` whose `value_type` is `FT`. \pre `std::distance(aBegin,aEnd)` must be equal to the number of vertices of the contour last entered. \pre Weights are (strictly) positive. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h index 551215202ae..e51856028e3 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h @@ -9,11 +9,11 @@ If `ss` is the interior skeleton of a polygon with holes, the offset polygons wi in its interior. If `ss` is the outer skeleton of a polygon with holes, the offset polygons will be generated in its exterior. -\tparam OfK must be a model of `Kernel`. It is used to instantiate - `Polygon_offset_builder_traits_2` for constructing the offset polygons. +\tparam OfKPolygon is a polygon without holes type determined from `OfK`, see Section \ref SLSOffsetPolygonReturnType. \tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT`. \tparam StraightSkeleton is an object of type `CGAL::Straight_skeleton_2`. -\tparam OfKPolygon is a polygon without holes type determined from `OfK`, see Section \ref SLSOffsetPolygonReturnType. +\tparam OfK must be a model of `Kernel`. It is used to instantiate + `Polygon_offset_builder_traits_2` for constructing the offset polygons. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -44,16 +44,16 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, it is advised to use `create_interior_straight_skeleton_2()` to create the skeleton only once, and then call `create_offset_polygons_2()` for each distance. -\tparam OfK must be a model of `Kernel`. It is used to instantiate - `Polygon_offset_builder_traits_2` for constructing the offset polygons. -\tparam SsK must be a model of `Kernel`. It is used to instantiate - `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. \tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. \tparam HoleIterator must be a model of `InputIterator` with value type being a model of `ConstRange` with value type `SsK::Point_2`. \tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`). -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. +\tparam OfK must be a model of `Kernel`. It is used to instantiate + `Polygon_offset_builder_traits_2` for constructing the offset polygons. +\tparam SsK must be a model of `Kernel`. It is used to instantiate + `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -84,20 +84,20 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, it is advised to use `create_interior_straight_skeleton_2()` to create the skeleton only once, and then call `create_offset_polygons_2()` for each distance +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. \pre `offset` is positive -\pre poly` is weakly simple, counterclockwise polygon. +\pre `poly` is weakly simple, counterclockwise polygon. \sa `CGAL::create_exterior_skeleton_and_offset_polygons_2()` \sa `CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2()` @@ -125,20 +125,20 @@ to obtain the offsets. The construction of this skeleton is the most expensive o therefore, to construct offsets at more than one single distance, use the separate functions `create_exterior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. \pre `offset` is positive -\pre poly` is weakly simple, counterclockwise polygon. +\pre `poly` is weakly simple, counterclockwise polygon. \sa `CGAL::create_interior_skeleton_and_offset_polygons_2()` \sa `CGAL::create_exterior_skeleton_and_offset_polygons_with_holes_2()` diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h index 839612ff6f3..e4aff14d810 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h @@ -8,15 +8,16 @@ of the 2D polygon with holes `poly_with_holes`. This is equivalent to `arrange_offset_polygons_2(create_interior_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))`. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. + \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -42,19 +43,19 @@ at distance `offset` of the 2D polygon `poly_with_holes`. Note that the offset of the outer frame is ignored. This is equivalent to a call to `CGAL::arrange_offset_polygons_2()` on the -output of \link CGAL::create_exterior_skeleton_and_offset_polygons_2() `create_exterior_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))` \endlink +output of \link CGAL::create_exterior_skeleton_and_offset_polygons_2() `create_exterior_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk)` \endlink after having filtered out the polygon corresponding to the offset of the outer frame and having reversed the orientation of all other polygons. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h index e08f4d7b1d2..cdc19eb8ffb 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h @@ -20,19 +20,19 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, it is advised to use the separate functions `create_interior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`). +\tparam HoleIterator must be a model of `InputIterator` with value type being a model of `ConstRange` + with value type `SsK::Point_2`. +\tparam InKWeights must be a model of `SequenceContainer` whose value type is `InK::FT`. +\tparam HoleWeightsIterator must be a model of `InputIterator` with value type being a model of `SequenceContainer` + with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`). -\tparam InKWeights must be a model of `Range` with value type `InK::FT`. -\tparam HoleIterator must be a model of `InputIterator` with value type being a model of `ConstRange` - with value type `SsK::Point_2`. -\tparam HoleWeightsIterator must be a model of `InputIterator` with value type being a model of `ConstRange` - with value type `InK::FT`. -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -45,9 +45,9 @@ template > create_interior_weighted_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& outer_boundary, - const InKWeights& outer_boundary_weights, HoleIterator holes_begin, HoleIterator holes_end, + const InKWeights& outer_boundary_weights, HoleWeightsIterator holes_weights_begin, HoleWeightsIterator holes_weights_end, OfK ofk = CGAL::Exact_predicates_inexact_constructions_kernel, @@ -66,16 +66,16 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, use the separate functions `create_interior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` with value type `InK::FT`. -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -109,21 +109,21 @@ to obtain the offsets. The construction of this skeleton is the most expensive o therefore, to construct offsets at more than one single distance, use the separate functions `create_exterior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` with value type `InK::FT`. -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. \pre `offset` is positive -\pre poly` is weakly simple, counterclockwise polygon. +\pre `poly` is weakly simple, counterclockwise polygon. \sa `CGAL::create_interior_skeleton_and_offset_polygons_2()` \sa `CGAL::create_exterior_skeleton_and_offset_polygons_with_holes_2()` diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h index e2f4f109648..7e05b15bc40 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h @@ -1,22 +1,23 @@ namespace CGAL { /*! -\ingroup PkgStraightSkeleton2OffsetFunctions +\ingroup PkgStraightSkeleton2WeightedOffsetFunctions \brief returns a container with all the inner offset polygons with holes at distance `offset` of the 2D polygon with holes `poly_with_holes`. This is equivalent to `arrange_offset_polygons_2(create_interior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))`. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the weighted straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed weighted straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -35,26 +36,27 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT offset, // ---------------------------------------------- EXTERIOR ----------------------------------------- /*! -\ingroup PkgStraightSkeleton2OffsetFunctions +\ingroup PkgStraightSkeleton2WeightedOffsetFunctions \brief returns a container with all the outer offset polygons with holes at distance `offset` of the 2D polygon `poly_with_holes`. Note that the offset of the outer frame is ignored. This is equivalent to a call to `CGAL::arrange_offset_polygons_2()` on the -output of \link CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2() `create_exterior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))` \endlink +output of \link CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2() `create_exterior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk)` \endlink after having filtered out the polygon corresponding to the offset of the outer frame and having reversed the orientation of all other polygons. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed weighted straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -65,7 +67,9 @@ having reversed the orientation of all other polygons. template std::vector > create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT offset, - const InKPolygon& poly_with_holes, + const InKPolygon& + poly_with_holes, + const InKWeights& weights, OfK ofk = Exact_predicates_inexact_constructions_kernel(), SsK ssk = Exact_predicates_inexact_constructions_kernel()); diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h index f036609721f..aeb39576705 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h @@ -87,14 +87,14 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice \brief creates a weighted straight skeleton in the interior of a 2D polygon, possibly with holes. -Range of weights `weights` must be provided in the same order as the contours (i.e., first +Weights must be provided in the same order as the contours (i.e., first the weights of the outer boundary, and then the weights of the holes, if there are any). Within each range of weights, the weights must be given in the same order as the vertices of the contour: the `i`-th weight in the range is associated to the contour edge between the `i-1`-th and `i`-th vertices. \tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`), or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` whose value type is itself a model of `Range` with value type `InK::FT`. +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam SsK must be a model of `Kernel`. \note `Cartesian_converter` and `NT_converter` are used to convert objects from `InK` to `SsK`, @@ -177,7 +177,7 @@ is associated to the contour edge between the `i-1`-th and `i`-th vertices. \tparam FT must be a model of `FieldNumberType` convertible to `SsK::FT`. \tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` whose value type is itself a model of `Range` with value type `InK::FT`. +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \note `Cartesian_converter` and `NT_converter` are used to convert objects from `InK` to `SsK`, if they differ. diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt index e5caf454fd7..5ddeeabc56c 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Straight_skeleton_2_Examples ) find_package(CGAL REQUIRED COMPONENTS Qt6 Core) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h index 30b1e25de59..102f4552a08 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include @@ -193,8 +195,8 @@ struct Default_return_polygon_type // Polygon type supports holes typename Kernel_traits::type>::Kernel, OfK>::value, - typename Polygon::Polygon_2, // correct kernel - CGAL::Polygon_2 /*incorrect kernel*/ >::type type; + typename Polygon::Polygon_2, // same kernel + CGAL::Polygon_2 /*different kernel*/ >::type type; }; template @@ -203,10 +205,14 @@ struct Default_return_polygon_type // Polygon type does NOT typedef typename std::conditional::type>::Kernel, OfK>::value, - Polygon, // correct kernel - CGAL::Polygon_2 /*incorrect kernel*/ >::type type; + Polygon, // same kernel + CGAL::Polygon_2 /*different kernel*/ >::type type; }; +template +using Polygon_return_type = typename CGAL::Default::Get::type>::type; + // The return type of create_interior/exterior_skeleton_and_offset_polygons_with_holes_2: // - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type should be the same // - if polygon input is just a sequence container of points (e.g. Polygon_2), then use @@ -234,6 +240,10 @@ struct Default_return_polygon_with_holes_type // Polygon ty CGAL::Polygon_with_holes_2 /*incorrect kernel*/ >::type type; }; +template +using Polygon_with_holes_return_type = typename CGAL::Default::Get::type>::type; + } // namespace CGAL_SS_i } // namespace CGAL diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h index 90110820a36..ffe8eaaba49 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h @@ -1454,10 +1454,10 @@ public: CGAL_assertion(fit != mSSkel->SSkel::Base::faces_end()); Halfedge_handle lBorder = fit->halfedge(); - FT lWeight = *aWeightsBegin; CGAL_assertion(lBorder->opposite()->is_border()); - CGAL_STSKEL_BUILDER_TRACE(4, "Assign " << lWeight << " cvt to " << cvt(lWeight) << " to E" << lBorder->id()); - lBorder->set_weight(cvt(lWeight)); + FT lWeight = cvt(*aWeightsBegin); + CGAL_STSKEL_BUILDER_TRACE(4, "Assign " << *aWeightsBegin << " (converted to " << cvt(lWeight) << ") to E" << lBorder->id()); + lBorder->set_weight(lWeight); } return *this; diff --git a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h index cd63666e9e7..2899fa00ed0 100644 --- a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h @@ -20,11 +20,11 @@ #include #include -#include #include #include #include +#include #include namespace CGAL { @@ -48,7 +48,9 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin { typedef typename std::iterator_traits::difference_type difference_type ; typedef typename std::iterator_traits::value_type PolygonPtr ; + typedef typename Kernel_traits::type>::Kernel OfK; + typedef typename PolygonWithHoles::Polygon_2 Inner_polygon; typedef std::shared_ptr PolygonWithHolesPtr ; difference_type lSize = std::distance(aBegin,aEnd); @@ -61,14 +63,16 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin const PolygonPtr lPoly = *it ; - Orientation lOrient = CGAL::Polygon::internal::orientation_2_no_precondition(lPoly->vertices().begin(), - lPoly->vertices().end(), - lPoly->traits_member()); + Orientation lOrient = CGAL::Polygon::internal::orientation_2_no_precondition( + CGAL_SS_i::vertices_begin(lPoly), CGAL_SS_i::vertices_end(lPoly), + OfK() /*lPoly->traits_member()*/); // It's an outer boundary if ( lOrient == COUNTERCLOCKWISE ) { - PolygonWithHolesPtr lOuter( new PolygonWithHoles(*lPoly) ); + PolygonWithHolesPtr lOuter = std::make_shared( + Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), + CGAL_SS_i::vertices_end(lPoly))); *rOut ++ = lOuter ; lTable[lIdx] = lOuter ; } @@ -100,7 +104,7 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin if (lParent == nullptr) return false; - lParent->add_hole(*lPoly); + lParent->add_hole(Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), CGAL_SS_i::vertices_end(lPoly))); } } diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h index bbdf0d15853..139675d2808 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -24,9 +24,8 @@ #include #include +#include #include -#include -#include #include #include @@ -129,7 +128,7 @@ create_partial_exterior_straight_skeleton_2 ( FT const& aMaxOffset std::vector holes ; holes.push_back(lPoly) ; - rSkeleton = create_partial_interior_straight_skeleton_2(aMaxOffset,frame, frame+4, holes.begin(), holes.end(), k ) ; + rSkeleton = create_partial_interior_straight_skeleton_2(aMaxOffset, frame, frame+4, holes.begin(), holes.end(), k ) ; } return rSkeleton ; @@ -142,7 +141,9 @@ template std::vector< std::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false ) { - typedef std::shared_ptr OutPolygonPtr ; + static_assert(!(std::is_same::value)); + + typedef std::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; typedef Straight_skeleton_2 OfSkeleton ; @@ -166,16 +167,18 @@ template std::vector< std::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true ) { - typedef std::shared_ptr OutPolygonPtr ; + static_assert(!(std::is_same::value)); + + typedef std::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; typedef Polygon_offset_builder_traits_2 OffsetBuilderTraits; typedef Polygon_offset_builder_2 OffsetBuilder; - OutPolygonPtrVector rR ; - OffsetBuilder ob(aSs); - ob.construct_offset_contours(aOffset, std::back_inserter(rR) ) ; + typename K::FT lOffset = aOffset; + OutPolygonPtrVector rR ; + ob.construct_offset_contours(lOffset, std::back_inserter(rR) ) ; return rR ; } @@ -190,43 +193,39 @@ Skeleton const& dereference ( std::shared_ptr const& ss ) } // namespace CGAL_SS_i -template -std::vector< std::shared_ptr > +template +std::vector > inline create_offset_polygons_2(const FT& aOffset, const Skeleton& aSs, - const K& k) + const K& k = K()) { typename CGAL_SS_i::Is_same_type::type same_kernel; return CGAL_SS_i::create_offset_polygons_2(aOffset, aSs, k, same_kernel); } -template, - class FT, class Skeleton> -std::vector< std::shared_ptr > -inline -create_offset_polygons_2(const FT& aOffset, - const Skeleton& aSs) -{ - return create_offset_polygons_2(aOffset, aSs, Exact_predicates_inexact_constructions_kernel()); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// INTERIOR -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, HoleIterator aHolesBegin, HoleIterator aHolesEnd, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), + std::enable_if_t::value>* = 0) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + return create_offset_polygons_2( aOffset, CGAL_SS_i::dereference( @@ -240,63 +239,26 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, ofk); } -template::type> -std::vector< std::shared_ptr > -inline -create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aOuterBoundary, - HoleIterator aHolesBegin, - HoleIterator aHolesEnd, - const OfK& ofk) -{ - return create_interior_skeleton_and_offset_polygons_2(aOffset, aOuterBoundary, - aHolesBegin, aHolesEnd, - ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -// Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +// Overload where APolygon is a simple polygon (no holes) +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + std::vector no_holes; - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, - no_holes.begin(), no_holes.end(), - ofk, ssk); -} - -// Overloads common to both polygons with and without holes, a simple polygon is returned in any case -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const OfK& ofk) -{ - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly) -{ - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); + return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, + no_holes.begin(), no_holes.end(), + ofk, ssk); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -307,17 +269,21 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, /*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + return create_offset_polygons_2( aOffset, CGAL_SS_i::dereference( @@ -329,31 +295,6 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, ofk); } -// Overloads common to both polygons with and without holes, a simple polygons is returned in any case -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const OfK& ofk) -{ - return create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly) -{ - return create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_OFFSET_POLYGONS_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h index ccedabda0b5..f22c3a8eea7 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h @@ -14,10 +14,9 @@ #include +#include #include #include -#include -#include #include @@ -36,60 +35,45 @@ namespace CGAL { /*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> // Hole-less polygon type -std::vector > +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), - aPoly.holes_begin(), aPoly.holes_end(), - ofk, ssk); + using OutPolygon = CGAL_SS_i::Polygon_return_type; + + return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), + aPoly.holes_begin(), aPoly.holes_end(), + ofk, ssk); } /*! create_interior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ -// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +// 'Polygon' might be a polygon with holes or not, but it returns a polygon with holes +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + return arrange_offset_polygons_2( - create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk)); -} - -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const OfK& ofk) -{ - return create_interior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly) -{ - return create_interior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); + create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk)); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -100,25 +84,34 @@ create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, /*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +template +std::vector > > inline create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { - typedef typename CGAL_SS_i::Default_return_polygon_type::type Polygon_; - std::vector > raw_output = - create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk); + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + + std::vector > raw_output = + create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk); // filter offset of the outer frame std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for (std::shared_ptr ptr : raw_output) - ptr->reverse_orientation(); + for (std::shared_ptr ptr : raw_output) { + if (ptr->size() > 1) { + // keep the first in place is just to get the same behavior as for Polygon_2 + auto first = std::next(ptr->begin()); + std::reverse(first, ptr->end()); + } + } return arrange_offset_polygons_2(raw_output); } @@ -126,58 +119,38 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, /*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> -std::vector > +template +std::vector > > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + std::vector > polygons = - create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), ofk, ssk); + create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), ofk, ssk); for (typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit) { typename PolygonWithHoles::Polygon_2 hole = *hit; hole.reverse_orientation(); std::vector > hole_polygons = - create_interior_skeleton_and_offset_polygons_2(aOffset, - hole, - ofk,ssk); + create_interior_skeleton_and_offset_polygons_2(aOffset, + hole, + ofk, ssk); polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end()); } return polygons; } -template::type> -std::vector > -inline -create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const OfK& ofk) -{ - return create_exterior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly) -{ - return create_exterior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h index c65e61ffc8c..5a2371e395f 100644 --- a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h @@ -32,14 +32,14 @@ namespace CGAL { -template +template std::shared_ptr< Straight_skeleton_2 > create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd , HoleIterator aHolesBegin , HoleIterator aHolesEnd - , K const& - ) + , const K& = K()) { typedef Straight_skeleton_2 Ss ; @@ -62,30 +62,13 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin return ssb.construct_skeleton(); } -template -std::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > -inline -create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin - , PointIterator aOuterContour_VerticesEnd - , HoleIterator aHolesBegin - , HoleIterator aHolesEnd - ) -{ - return create_interior_straight_skeleton_2(aOuterContour_VerticesBegin - ,aOuterContour_VerticesEnd - ,aHolesBegin - ,aHolesEnd - ,Exact_predicates_inexact_constructions_kernel() - ); -} - -template +template std::shared_ptr< Straight_skeleton_2 > inline create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd - , K const& k - ) + , const K& k = K()) { typedef typename std::iterator_traits::value_type InputPoint ; typedef typename Kernel_traits::Kernel InputKernel ; @@ -99,24 +82,12 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin ); } -template -std::shared_ptr< Straight_skeleton_2 > -inline -create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin - , PointIterator aOuterContour_VerticesEnd - ) -{ - return create_interior_straight_skeleton_2(aOuterContour_VerticesBegin - ,aOuterContour_VerticesEnd - ,Exact_predicates_inexact_constructions_kernel() - ); -} - -template +template std::shared_ptr< Straight_skeleton_2 > inline -create_interior_straight_skeleton_2 ( Polygon const& aOutContour, - K const& k, +create_interior_straight_skeleton_2 ( const Polygon& aOutContour, + const K& k = K(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { @@ -126,26 +97,18 @@ create_interior_straight_skeleton_2 ( Polygon const& aOutContour, ); } -template -std::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > -inline -create_interior_straight_skeleton_2 ( Polygon const& aOutContour ) -{ - return create_interior_straight_skeleton_2(aOutContour, Exact_predicates_inexact_constructions_kernel() ); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// EXTERIOR -template +template std::shared_ptr< Straight_skeleton_2 > create_exterior_straight_skeleton_2 ( FT const& aMaxOffset , PointIterator aVerticesBegin , PointIterator aVerticesEnd - , K const& k - ) + , const K& k = K()) { CGAL_precondition( aMaxOffset > 0 ) ; @@ -195,25 +158,13 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset return rSkeleton ; } -template -std::shared_ptr< Straight_skeleton_2 > -inline -create_exterior_straight_skeleton_2 ( FT const& aMaxOffset - , PointIterator aVerticesBegin - , PointIterator aVerticesEnd - ) -{ - return create_exterior_straight_skeleton_2(aMaxOffset - ,aVerticesBegin - ,aVerticesEnd - ,Exact_predicates_inexact_constructions_kernel() - ); -} - -template +template std::shared_ptr< Straight_skeleton_2 > inline -create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly, K const& k ) +create_exterior_straight_skeleton_2(const FT& aMaxOffset, + const Polygon& aPoly, + const K& k = K()) { return create_exterior_straight_skeleton_2(aMaxOffset ,CGAL_SS_i::vertices_begin(aPoly) @@ -222,17 +173,6 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly ); } -template -std::shared_ptr< Straight_skeleton_2 > -inline -create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly ) -{ - return create_exterior_straight_skeleton_2(aMaxOffset - ,aPoly - ,Exact_predicates_inexact_constructions_kernel() - ); -} - } // namespace CGAL #endif // CGAL_CREATE_STRAIGHT_SKELETON_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h index ae229d32e44..4e8f51dbee4 100644 --- a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h @@ -26,11 +26,12 @@ namespace CGAL { -template +template std::shared_ptr< Straight_skeleton_2 > inline -create_interior_straight_skeleton_2 ( Polygon const& aPolyWithHoles, - K const& k, +create_interior_straight_skeleton_2 ( const Polygon& aPolyWithHoles, + const K& k = K(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h index d2553849475..0fd2ca8236a 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include @@ -127,6 +125,8 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, typedef typename Kernel_traits::Kernel IK; typedef typename IK::FT IFT; + static_assert((std::is_same::value_type, IFT>::value)); + std::shared_ptr > rSkeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) @@ -169,11 +169,11 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, holes.push_back(lPoly) ; // put a weight large enough such that frame edges are not relevant - const FT frame_weight = FT(10) * *(std::max_element(aWeightsBegin, aWeightsEnd)); + const IFT frame_weight = FT(10) * *(std::max_element(aWeightsBegin, aWeightsEnd)); CGAL_STSKEL_BUILDER_TRACE(4, "Frame weight = " << frame_weight); - std::vector lFrameWeights(4, frame_weight); - std::vector > lHoleWeights; + std::vector lFrameWeights(4, frame_weight); + std::vector > lHoleWeights; lHoleWeights.emplace_back(aWeightsBegin, aWeightsEnd); // If w[0] pointed to v_0, then when we reverse the polygon, the last polygon is pointing to v_{n-1} @@ -200,10 +200,11 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, //////////////////////////////////////////////////////////////////////////////////////////////////// /// INTERIOR -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -212,9 +213,11 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const Weights& aWeights, HoleWeightsIterator aHoles_WeightsBegin, HoleWeightsIterator aHoles_WeightsEnd, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + if(aHolesBegin == aHolesEnd) // see @partial_wsls_pwh { return create_offset_polygons_2( @@ -252,69 +255,33 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, } } -template::type> -std::vector< std::shared_ptr > -inline -create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aOuterBoundary, - HoleIterator aHolesBegin, - HoleIterator aHolesEnd, - const Weights& aWeights, - const OfK& ofk) -{ - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aOuterBoundary, - aHolesBegin, aHolesEnd, - aWeights, - ofk, - Exact_predicates_inexact_constructions_kernel()); -} - // Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + + using IFT = typename boost::range_value::type>::type; + std::vector no_holes; - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, - no_holes.begin(), no_holes.end(), - aWeights, - ofk, ssk); -} + std::vector > no_hole_weights; -// Overloads common to both polygons with and without holes, a simple polygon is returned in any case -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights) -{ - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); + return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, + no_holes.begin(), no_holes.end(), + aWeights[0], + no_hole_weights.begin(), no_hole_weights.end(), + ofk, ssk); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -325,18 +292,22 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, /*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + return create_offset_polygons_2( aOffset, CGAL_SS_i::dereference( @@ -344,39 +315,12 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, aOffset, CGAL_SS_i::vertices_begin(aPoly), CGAL_SS_i::vertices_end (aPoly), - aWeights[0].begin(), - aWeights[0].end(), + std::begin(aWeights[0]), + std::end(aWeights[0]), ssk)), ofk); } -// Overloads common to both polygons with and without holes, a simple polygons is returned in any case -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h index 51e1fd3752e..ca6f8d8d64f 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h @@ -14,10 +14,9 @@ #include +#include #include -#include -#include -#include +#include #include @@ -35,67 +34,50 @@ namespace CGAL { /*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> // Hole-less polygon type -std::vector > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), - aPoly.holes_begin(), aPoly.holes_end(), - aWeights[0], - std::next(std::begin(aWeights)), - std::end(aWeights), - ofk, ssk); + using OutPolygon = CGAL_SS_i::Polygon_return_type; + + return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), + aPoly.holes_begin(), aPoly.holes_end(), + aWeights[0], + std::next(std::begin(aWeights)), + std::end(aWeights), + ofk, ssk); } /*! create_interior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + return arrange_offset_polygons_2( - create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk)); -} - -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights) -{ - return create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); + create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk)); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -103,28 +85,37 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf //////////////////////////////////////////////////////////////////////////////////////////////////// /// EXTERIOR -/*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ +/*! create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +template +std::vector > > create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { - typedef typename CGAL_SS_i::Default_return_polygon_type::type Polygon_; - std::vector > raw_output = - create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk); + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + + std::vector > raw_output = + create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk); // filter offset of the outer frame std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for(std::shared_ptr ptr : raw_output) - ptr->reverse_orientation(); + for (std::shared_ptr ptr : raw_output) { + if (ptr->size() > 1) { + // keep the first in place is just to get the same behavior as for Polygon_2 + auto first = std::next(ptr->begin()); + std::reverse(first, ptr->end()); + } + } return arrange_offset_polygons_2(raw_output); } @@ -132,22 +123,26 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf /*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> -std::vector > +template +std::vector > > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + CGAL_precondition(aWeights.size() == aPoly.number_of_holes() + 1); std::vector > polygons = - create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), {aWeights[0]}, ofk, ssk); + create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), aWeights, ofk, ssk); std::size_t weight_pos = 1; for(typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit, ++weight_pos) @@ -155,42 +150,16 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, typename PolygonWithHoles::Polygon_2 hole = *hit; hole.reverse_orientation(); std::vector > hole_polygons = - create_interior_skeleton_and_offset_polygons_2(aOffset, - hole, - {aWeights[weight_pos]}, - ofk, ssk); + create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, + hole, + Weights{aWeights[weight_pos]}, + ofk, ssk); polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end()); } return polygons; } -template::type> -std::vector > -inline -create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h index 96c42fb9925..64237b5924a 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h @@ -26,13 +26,14 @@ #include #include #include +#include #include namespace CGAL { template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, @@ -42,7 +43,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice WeightIterator outer_contour_weights_end, HoleWeightsIterator holes_weights_begin, HoleWeightsIterator holes_weights_end, - const K&) + const K& = K()) { using Skeleton = Straight_skeleton_2; @@ -76,37 +77,16 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice return ssb.construct_skeleton(); } -template -std::shared_ptr > -inline -create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, - PointIterator outer_contour_vertices_end, - HoleIterator holes_begin, - HoleIterator holes_end, - WeightIterator outer_contour_weights_begin, - WeightIterator outer_contour_weights_end, - HoleWeightsIterator holes_weights_begin, - HoleWeightsIterator holes_weights_end) -{ - return create_interior_weighted_straight_skeleton_2(outer_contour_vertices_begin, outer_contour_vertices_end, - holes_begin, holes_end, - outer_contour_weights_begin, outer_contour_weights_end, - holes_weights_begin, holes_weights_end, - Exact_predicates_inexact_constructions_kernel()); -} - template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, WeightIterator outer_contour_weights_begin, WeightIterator outer_contour_weights_end, - const K& k) + const K& k = K()) { using InputPoint = typename std::iterator_traits::value_type; using InputKernel = typename Kernel_traits::Kernel; @@ -126,51 +106,23 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice k); } -template -std::shared_ptr > -inline -create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, - PointIterator outer_contour_vertices_end, - WeightIterator outer_contour_weights_begin, - WeightIterator outer_contour_weights_end) -{ - return create_interior_weighted_straight_skeleton_2(outer_contour_vertices_begin, - outer_contour_vertices_end, - outer_contour_weights_begin, - outer_contour_weights_end, - Exact_predicates_inexact_constructions_kernel()); -} - template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, const Weights& weights, - const K& k, + const K& k = K(), std::enable_if_t::value>* = nullptr) { return create_interior_weighted_straight_skeleton_2(CGAL_SS_i::vertices_begin(out_contour), CGAL_SS_i::vertices_end(out_contour), - weights.begin(), - weights.end(), + weights[0].begin(), + weights[0].end(), k); } -template -std::shared_ptr > -inline -create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, - const Weights& weights) -{ - return create_interior_weighted_straight_skeleton_2(out_contour, - weights, - Exact_predicates_inexact_constructions_kernel()); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -179,14 +131,14 @@ create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > create_exterior_weighted_straight_skeleton_2(const FT& max_offset, PointIterator vertices_begin, PointIterator vertices_end, WeightIterator weights_begin, WeightIterator weights_end, - const K& k) + const K& k = K()) { CGAL_precondition(max_offset > 0); CGAL_precondition(std::distance(weights_begin, weights_end) == std::distance(vertices_begin, vertices_end)); @@ -195,6 +147,8 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, using IK = typename Kernel_traits::Kernel; using IFT = typename IK::FT; + static_assert((std::is_same::value_type, IFT>::value)); + std::shared_ptr > skeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) @@ -236,11 +190,11 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, holes.push_back(poly); // put a weight large enough such that frame edges are not relevant - const FT frame_weight = FT(10) * *(std::max_element(weights_begin, weights_end)); + const IFT frame_weight = IFT(10) * *(std::max_element(weights_begin, weights_end)); CGAL_STSKEL_BUILDER_TRACE(4, "Frame weight = " << frame_weight); - std::vector lFrameWeights(4, frame_weight); - std::vector > lHoleWeights; + std::vector lFrameWeights(4, frame_weight); + std::vector > lHoleWeights; lHoleWeights.emplace_back(weights_begin, weights_end); // If w[0] pointed to v_0, then when we reverse the polygon, the last polygon is pointing to v_{n-1} @@ -258,59 +212,25 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, return skeleton; } -template -std::shared_ptr > -inline -create_exterior_weighted_straight_skeleton_2(const FT& max_offset, - PointIterator vertices_begin, - PointIterator vertices_end, - WeightIterator weights_begin, - WeightIterator weights_end) -{ - return create_exterior_weighted_straight_skeleton_2(max_offset, - vertices_begin, - vertices_end, - weights_begin, - weights_end, - Exact_predicates_inexact_constructions_kernel()); -} - template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > inline create_exterior_weighted_straight_skeleton_2(const FT& max_offset, const Polygon& aPoly, Weights& weights, - const K& k) + const K& k = K()) { return create_exterior_weighted_straight_skeleton_2(max_offset, CGAL_SS_i::vertices_begin(aPoly), CGAL_SS_i::vertices_end(aPoly), - weights.begin(), - weights.end(), + weights[0].begin(), + weights[0].end(), k); } -template -std::shared_ptr > -inline -create_exterior_weighted_straight_skeleton_2(const FT& max_offset, - Weights& weights, - const Polygon& aPoly) -{ - return create_exterior_weighted_straight_skeleton_2(max_offset, - aPoly, - weights, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_WEIGHTED_STRAIGHT_SKELETON_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h index acc2046f2a6..df77c7da6d0 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h @@ -26,12 +26,12 @@ namespace CGAL { template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr< Straight_skeleton_2 > inline create_interior_weighted_straight_skeleton_2(const Polygon& poly_with_holes, const Weights& weights, - const K& k, + const K& k = K(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt index cbc1776327c..e08dcd859b2 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Straight_skeleton_2_Tests) find_package(CGAL REQUIRED COMPONENTS Qt6 Core) @@ -22,17 +22,19 @@ if(CGAL_Qt6_FOUND) endif() if (CGAL_Core_FOUND OR LEDA_FOUND) - create_single_source_cgal_program("test_sls_offset.cpp") - create_single_source_cgal_program("issue7284.cpp") - create_single_source_cgal_program("test_sls_simple.cpp") - create_single_source_cgal_program("test_sls_weighted_polygons_with_holes.cpp") create_single_source_cgal_program("issue7149.cpp") + create_single_source_cgal_program("issue7284.cpp") + create_single_source_cgal_program("test_sls_offset.cpp") + create_single_source_cgal_program("test_sls_weighted_offset.cpp") + create_single_source_cgal_program("test_sls_simple.cpp") + create_single_source_cgal_program("test_sls_weighted_polygons.cpp") + create_single_source_cgal_program("test_sls_weighted_polygons_with_holes.cpp") if(CGAL_Qt6_FOUND) target_link_libraries(issue7149 PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(issue7284 PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_offset PRIVATE CGAL::CGAL_Basic_viewer) + target_link_libraries(test_sls_weighted_offset PRIVATE CGAL::CGAL_Basic_viewer) + target_link_libraries(test_sls_weighted_polygons PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_weighted_polygons_with_holes PRIVATE CGAL::CGAL_Basic_viewer) endif() -else() - message("NOTICE: Some test require CGAL_Core (or LEDA), and will not be compiled.") endif() diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp index 90ed7dc9ef3..7259dd75e96 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp @@ -22,10 +22,13 @@ #include #include -#include +#include + +#include #include #include +#include #include #include @@ -34,90 +37,248 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; typedef CGAL::Timer Timer; + +namespace CGAL { + +template +class Test_polygon_2 : public CGAL::Polygon_2 { + typedef CGAL::Polygon_2 Base; + Test_polygon_2(const Base&); +public: + using Base::Base; +}; + +template +class Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2 { + typedef CGAL::Polygon_with_holes_2 Base; + Test_polygon_with_holes_2(const Base&); +public: + using Base::Base; +}; + +} // namespace CGAL + +using namespace CGAL; + template void test_API() { + typedef typename K::FT FT; + typedef typename K::Point_2 Point_2; + typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; typedef CGAL::Polygon_2 Polygon_2_EPICK; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2_EPICK; + typedef CGAL::Test_polygon_2 Test_Polygon_2; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2; + + typedef CGAL::Test_polygon_2 Test_Polygon_2_EPICK; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2_EPICK; + + std::vector v; Polygon_2 p; Polygon_with_holes_2 pwh; std::vector< std::shared_ptr > res; std::vector< std::shared_ptr > res_EPICK; - std::vector< std::shared_ptr > res_w; - std::vector< std::shared_ptr > res_w_EPICK; + std::vector< std::shared_ptr > res_wh; + std::vector< std::shared_ptr > res_wh_EPICK; + + std::vector< std::shared_ptr > res_test; + std::vector< std::shared_ptr > res_test_EPICK; + std::vector< std::shared_ptr > res_wh_test; + std::vector< std::shared_ptr > res_wh_test_EPICK; // First kernel is the offset construction (and thus output kernel), second kernel is the skeleton construction // simple interior, no holes res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p) ; res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK()) ; - res_EPICK = create_interior_skeleton_and_offset_polygons_2(0, p, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K()) ; - res = create_interior_skeleton_and_offset_polygons_2(0, p, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(0.1, v, K(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(FT(0.1), v, K(), K()) ; // simple interior, holes res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh) ; res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK()) ; - res_EPICK = create_interior_skeleton_and_offset_polygons_2(0, pwh, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K()) ; - res = create_interior_skeleton_and_offset_polygons_2(0, pwh, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; // simple exterior, no holes res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p) ; res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK()) ; - res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0, p, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K()) ; - res = create_exterior_skeleton_and_offset_polygons_2(0, p, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(0.1, v, K(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), v, K(), K()) ; // simple exterior, holes res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh) ; res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK()) ; - res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0, pwh, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K()) ; - res = create_exterior_skeleton_and_offset_polygons_2(0, pwh, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; // Same, but the result has holes -------------------- // arranged interior, no holes - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0, p, EPICK(), K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0, p, K(), EPICK()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, v, K(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, K(), K()) ; // arranged interior, holes - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0, pwh, EPICK(), K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0, pwh, K(), EPICK()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; + + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; // arranged exterior, no holes - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, p, EPICK(), K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, p, K(), EPICK()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, v, K(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, K(), K()) ; // arranged exterior, holes - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, pwh, EPICK(), K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, pwh, K(), EPICK()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; + + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; } template @@ -209,7 +370,7 @@ void test_offset_four_square_holes() outer.push_back(Point( 0, 0)); outer.push_back(Point(10, 0)); outer.push_back(Point(10, 10)); - outer.push_back(Point(0, 10)); + outer.push_back(Point( 0, 10)); hole1.push_back(Point(1, 1)); hole1.push_back(Point(1, 4.5)); @@ -969,9 +1130,8 @@ void test_kernel() std::cout.precision(17); std::cerr.precision(17); -#ifndef CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE - // test_API(); -#endif + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); // Artificial data test_offset_square(); diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp index d90bc8adf5f..4f5ad621567 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp @@ -34,10 +34,13 @@ void Straight_skeleton_traits_external_trace(std::string m) #include #include -#include +#include + +#include #include #include +#include #include #include #include @@ -221,9 +224,8 @@ void test_kernel() { // CGAL_STSKEL_TRAITS_ENABLE_TRACE -#ifndef CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE - // test_API(); -#endif + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); test_skeleton("data/pseudo_split_0.poly", 13, 40, 8); test_skeleton("data/pseudo_split_1.poly", 21, 68, 12); diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp new file mode 100644 index 00000000000..e4e64c2c95b --- /dev/null +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp @@ -0,0 +1,291 @@ +#define CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE +#define CGAL_ENABLE_DISABLE_ASSERTIONS_AT_RUNTIME + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; +typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; +typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; + +namespace CGAL { + +template +class Test_polygon_2 : public CGAL::Polygon_2 { + typedef CGAL::Polygon_2 Base; + Test_polygon_2(const Base&); +public: + using Base::Base; +}; + +template +class Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2 { + typedef CGAL::Polygon_with_holes_2 Base; + Test_polygon_with_holes_2(const Base&); +public: + using Base::Base; +}; + +} // namespace CGAL + +using namespace CGAL; + +template +void test_API() +{ + typedef typename K::FT FT; + typedef typename K::Point_2 Point_2; + + typedef CGAL::Polygon_2 Polygon_2; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + + typedef CGAL::Polygon_2 Polygon_2_EPICK; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2_EPICK; + + typedef CGAL::Test_polygon_2 Test_Polygon_2; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2; + + typedef CGAL::Test_polygon_2 Test_Polygon_2_EPICK; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2_EPICK; + + std::vector v; + Polygon_2 p; + Polygon_with_holes_2 pwh; + std::vector > weights; + + std::vector > res; + std::vector > res_EPICK; + std::vector > res_wh; + std::vector > res_wh_EPICK; + + std::vector > res_test; + std::vector > res_test_EPICK; + std::vector > res_wh_test; + std::vector > res_wh_test_EPICK; + + // First kernel is the offset construction (and thus output kernel), second kernel is the skeleton construction + + // simple interior, no holes + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, K(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), v, weights, K(), K()) ; + + // simple interior, holes + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + // simple exterior, no holes + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, K(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), v, weights, K(), K()) ; + + // simple exterior, holes + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + // Same, but the result has holes -------------------- + + // arranged interior, no holes + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, K(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, weights, K(), K()) ; + + // arranged interior, holes + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + + // arranged exterior, no holes + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, K(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, weights, K(), K()) ; + + // arranged exterior, holes + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; +} + +template +void test_kernel() +{ + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); +} + +int main(int, char**) +{ + std::cout.precision(17); + std::cerr.precision(17); + + test_kernel(); + test_kernel(); + test_kernel(); + + std::cout << "Done!" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp new file mode 100644 index 00000000000..54a3be0ad86 --- /dev/null +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp @@ -0,0 +1,147 @@ +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#include + +namespace SS = CGAL::CGAL_SS_i; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; +typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; +typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; + +template +void test_API() +{ + typedef typename K::FT FT; + + typedef CGAL::Polygon_2 Polygon_2; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + + typedef CGAL::Straight_skeleton_2 Straight_skeleton_EPICK; + typedef std::shared_ptr Straight_skeleton_Ptr_EPICK; + + typedef CGAL::Straight_skeleton_2 Straight_skeleton; + typedef std::shared_ptr Straight_skeleton_Ptr; + + std::vector > weights; + + Polygon_2 p; + Straight_skeleton_Ptr_EPICK ss_epick = CGAL::create_interior_weighted_straight_skeleton_2(p, weights); + Straight_skeleton_Ptr ss = CGAL::create_interior_weighted_straight_skeleton_2(p, weights, K()); + ss_epick = CGAL::create_exterior_weighted_straight_skeleton_2(double(1.01), p, weights); + ss = CGAL::create_exterior_weighted_straight_skeleton_2(int(2), p, weights, K()); + + Polygon_with_holes_2 pwh; + ss_epick = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights); + ss = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); + ss_epick = CGAL::create_exterior_weighted_straight_skeleton_2(double(1.01), p, weights); + ss = CGAL::create_exterior_weighted_straight_skeleton_2(int(2), p, weights, K()); +} + +template +void test_kernel(const int polygon_nv, CGAL::Random& rnd) +{ + using FT = typename K::FT; + using Point_2 = typename K::Point_2; + using Point_3 = typename K::Point_3; + + using Polygon_2 = CGAL::Polygon_2; + + using Straight_skeleton_2 = CGAL::Straight_skeleton_2; + using Straight_skeleton_2_ptr = std::shared_ptr; + + using Mesh = CGAL::Surface_mesh; + + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); + + typedef CGAL::Random_points_in_square_2 Point_generator; + Polygon_2 pol; + CGAL::random_polygon_2(polygon_nv, std::back_inserter(pol), Point_generator(0.25, rnd)); + + std::vector > weights(1); + for(int i=0; i& ws : weights) + { + for(FT w : ws) + std::cout << w << " "; + std::cout << std::endl; + } + + CGAL::draw(pol); + + Straight_skeleton_2_ptr ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pol, weights, K()); + assert(ss_ptr); + if(!ss_ptr) + { + std::cerr << "Error: failed to create straight skeleton" << std::endl; + return; + } + + CGAL::draw(*ss_ptr); + + ss_ptr = CGAL::create_exterior_weighted_straight_skeleton_2(0.1, pol, weights, K()); + assert(ss_ptr); + if(!ss_ptr) + { + std::cerr << "Error: failed to create straight skeleton" << std::endl; + return; + } + + CGAL::draw(*ss_ptr); + + Mesh sm; + bool success = extrude_skeleton(pol, sm, CGAL::parameters::weights(weights)); + assert(success); + if(!success) + { + std::cerr << "Error: failed to extrude skeleton" << std::endl; + return; + } + + std::cout << num_vertices(sm) << " vertices and " << num_faces(sm) << " faces" << std::endl; + + CGAL::draw(sm); +} + +int main(int argc, char** argv) +{ + std::cout.precision(17); + std::cerr.precision(17); + + const int polygon_nv = (argc > 1) ? std::atoi(argv[1]) : 10; + const int seed = (argc > 2) ? std::atoi(argv[2]) : std::time(nullptr); + + CGAL::Random rnd(seed); + std::cout << "Seed is " << rnd.get_seed() << std::endl; + + test_kernel(polygon_nv, rnd); + test_kernel(polygon_nv, rnd); + test_kernel(polygon_nv, rnd); + + return EXIT_SUCCESS; +} diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp index 7ebe00f75a4..e193238c601 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp @@ -1,6 +1,7 @@ #include #include #include + #include #include @@ -22,44 +23,33 @@ namespace SS = CGAL::CGAL_SS_i; -using K = CGAL::Exact_predicates_inexact_constructions_kernel; -using FT = K::FT; -using Point_2 = K::Point_2; -using Vector_2 = K::Vector_2; -using Point_3 = K::Point_3; +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; +typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; +typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; -using Polygon_2 = CGAL::Polygon_2; -using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; - -using Straight_skeleton_2 = CGAL::Straight_skeleton_2; -using Straight_skeleton_2_ptr = std::shared_ptr; - -using Mesh = CGAL::Surface_mesh; - -Polygon_2 generate_random_polygon(CGAL::Random& rnd) +template +void test_kernel(const int hole_n, const int hole_nv, CGAL::Random& rnd) { - typedef CGAL::Random_points_in_square_2 Point_generator; + using FT = typename K::FT; + using Point_2 = typename K::Point_2; + using Point_3 = typename K::Point_3; - Polygon_2 poly; - CGAL::random_polygon_2(10, std::back_inserter(poly), Point_generator(0.25, rnd)); - return poly; -} + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; -int main(int argc, char** argv) -{ - std::cout.precision(17); - std::cerr.precision(17); + using Straight_skeleton_2 = CGAL::Straight_skeleton_2; + using Straight_skeleton_2_ptr = std::shared_ptr; - int hole_n = (argc > 1) ? std::atoi(argv[1]) : 2; - int hole_nv = (argc > 2) ? std::atoi(argv[2]) : 10; - int seed = (argc > 3) ? std::atoi(argv[3]) : CGAL::get_default_random().get_seed(); + using Mesh = CGAL::Surface_mesh; - CGAL::Random rnd(seed); + auto generate_random_polygon = [&](CGAL::Random& rnd) -> Polygon_2 + { + typedef CGAL::Random_points_in_square_2 Point_generator; - std::cout << "Seed is " << rnd.get_seed() << std::endl; - std::cout << 2*hole_n << " holes of size " << hole_nv << std::endl; - - std::vector > weights(1); + Polygon_2 poly; + CGAL::random_polygon_2(hole_nv, std::back_inserter(poly), Point_generator(0.25, rnd)); + return poly; + }; // each hole is in a square of size 1 std::vector ob = { Point_2(-hole_n-1, -0.5), @@ -71,6 +61,8 @@ int main(int argc, char** argv) std::cout << "pwh.outer_boundary() = " << pwh.outer_boundary() << std::endl; + std::vector > weights(1); + // tiny weight (far-reaching) for vertical sides weights[0].push_back(rnd.get_double(0.05, 0.5)); weights[0].push_back(rnd.get_double(1, 10)); @@ -118,33 +110,49 @@ int main(int argc, char** argv) std::cout << std::endl; } -// CGAL::draw(pwh); // @tmp remove draw() calls - - auto ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); +// CGAL::draw(pwh); + Straight_skeleton_2_ptr ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); + assert(ss_ptr); if(!ss_ptr) { std::cerr << "Error: failed to create straight skeleton" << std::endl; - return EXIT_FAILURE; + return; } // CGAL::draw(*ss_ptr); - auto offsets = CGAL::create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights); - CGAL_USE(offsets); - Mesh sm; bool success = extrude_skeleton(pwh, sm, CGAL::parameters::weights(weights)); - + assert(success); if(!success) { std::cerr << "Error: failed to extrude skeleton" << std::endl; - return EXIT_FAILURE; + return; } std::cout << num_vertices(sm) << " vertices and " << num_faces(sm) << " faces" << std::endl; // CGAL::draw(sm); +} + +int main(int argc, char** argv) +{ + std::cout.precision(17); + std::cerr.precision(17); + + int hole_n = (argc > 1) ? std::atoi(argv[1]) : 2; + int hole_nv = (argc > 2) ? std::atoi(argv[2]) : 10; + int seed = (argc > 3) ? std::atoi(argv[3]) : std::time(nullptr); + + CGAL::Random rnd(seed); + + std::cout << "Seed is " << rnd.get_seed() << std::endl; + std::cout << 2*hole_n << " holes of size " << hole_nv << std::endl; + + test_kernel(hole_n, hole_nv, rnd); + test_kernel(hole_n, hole_nv, rnd); + test_kernel(hole_n, hole_nv, rnd); return EXIT_SUCCESS; } diff --git a/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt b/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt index a2ed8ab6571..ff03f42493d 100644 --- a/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt +++ b/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Straight_skeleton_extrusion_2_Tests) find_package(CGAL REQUIRED COMPONENTS Qt6 Core) diff --git a/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt b/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt index fde8f8a4077..6075d84f275 100644 --- a/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt +++ b/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_lines_2_Examples) find_package(CGAL REQUIRED) diff --git a/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt b/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt index dd57b219200..8c0a52900f0 100644 --- a/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt +++ b/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_lines_2_Tests) find_package(CGAL REQUIRED) diff --git a/Stream_support/benchmark/Stream_support/CMakeLists.txt b/Stream_support/benchmark/Stream_support/CMakeLists.txt index 365ada0dc3e..7ba9a8e0799 100644 --- a/Stream_support/benchmark/Stream_support/CMakeLists.txt +++ b/Stream_support/benchmark/Stream_support/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_support) # CGAL and its components diff --git a/Stream_support/examples/Stream_support/CMakeLists.txt b/Stream_support/examples/Stream_support/CMakeLists.txt index 899b86e7d9b..fc5a12d6f6e 100644 --- a/Stream_support/examples/Stream_support/CMakeLists.txt +++ b/Stream_support/examples/Stream_support/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_support_Examples) find_package(CGAL REQUIRED) diff --git a/Stream_support/include/CGAL/IO/VTK/VTK_writer.h b/Stream_support/include/CGAL/IO/VTK/VTK_writer.h index 9be80302861..2769b3ab0f0 100644 --- a/Stream_support/include/CGAL/IO/VTK/VTK_writer.h +++ b/Stream_support/include/CGAL/IO/VTK/VTK_writer.h @@ -25,6 +25,8 @@ template void write_vector(std::ostream& os, const std::vector& vect) { + if(vect.empty()) + return; const char* buffer = reinterpret_cast(&(vect[0])); std::size_t size = vect.size()*sizeof(FT); diff --git a/Stream_support/include/CGAL/IO/WKT.h b/Stream_support/include/CGAL/IO/WKT.h index bf53a7b3398..2706576b47c 100644 --- a/Stream_support/include/CGAL/IO/WKT.h +++ b/Stream_support/include/CGAL/IO/WKT.h @@ -44,18 +44,42 @@ namespace internal { template void pop_back_if_equal_to_front(CGAL::Polygon_2& poly) { - typename CGAL::Polygon_2::iterator it = poly.end(); - --it; - if((*poly.begin()) == *it) - poly.erase(it); + auto last_it = std::prev(poly.end()); + if((*poly.begin()) == *last_it) + poly.erase(last_it); } template void pop_back_if_equal_to_front(CGAL::Polygon_with_holes_2& pwh) { pop_back_if_equal_to_front(pwh.outer_boundary()); - for(auto i = pwh.holes_begin(); i!= pwh.holes_end(); ++i) - pop_back_if_equal_to_front(*i); + for(auto& hole : pwh.holes()) + pop_back_if_equal_to_front(hole); +} + +template +bool read_wkt_or_fail_stream(std::istream& in, + const std::string& line, + Geometry& geometry) +{ + try { + boost::geometry::read_wkt(line, geometry); + } catch(std::exception& e) { + std::cerr << "error: " << e.what() << std::endl; + in.clear(in.rdstate() | std::ios::failbit); + return false; + } + return true; +} + +bool get_a_new_line(std::istream& in, std::string& line) +{ + in >> std::ws; // skip whitespaces + if(in.good()) { + return !std::getline(in, line).fail(); + } else { + return false; + } } } // namespace internal @@ -76,28 +100,12 @@ template bool read_point_WKT(std::istream& in, Point& point) { - if(!in.good()) - return false; - std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 5).compare("POINT") == 0) + if(line.substr(0, 5).compare("POINT") == 0) { - try - { - boost::geometry::read_wkt(line, point); - } - catch(...) - { - std::cerr << "error." << std::endl; - return false; - } - + internal::read_wkt_or_fail_stream(in, line, point); break; } } @@ -124,25 +132,13 @@ template bool read_multi_point_WKT(std::istream& in, MultiPoint& mp) { - if(!in.good()) - return false; - - CGAL::internal::Geometry_container gc(mp); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 10).compare("MULTIPOINT") == 0) + if(line.substr(0, 10).compare("MULTIPOINT") == 0) { - try{ - boost::geometry::read_wkt(line, gc); - } catch(...){ - std::cerr << "error." << std::endl; - return false; - } + CGAL::internal::Geometry_container gc(mp); + internal::read_wkt_or_fail_stream(in, line, gc); break; } } @@ -171,25 +167,13 @@ template bool read_linestring_WKT(std::istream& in, LineString& polyline) { - if(!in.good()) - return false; - - CGAL::internal::Geometry_container gc(polyline); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 10).compare("LINESTRING") == 0) + if(line.substr(0, 10).compare("LINESTRING") == 0) { - try{ - boost::geometry::read_wkt(line, gc); - } catch(...){ - std::cerr << "error." << std::endl; - return false; - } + CGAL::internal::Geometry_container gc(polyline); + internal::read_wkt_or_fail_stream(in, line, gc); break; } } @@ -214,40 +198,26 @@ template bool read_multi_linestring_WKT(std::istream& in, MultiLineString& mls) { - if(!in.good()) - return false; - - typedef typename MultiLineString::value_type PointRange; - typedef CGAL::internal::Geometry_container LineString; - - std::vector pr_range; - CGAL::internal::Geometry_container, boost::geometry::multi_linestring_tag> gc(pr_range); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 15).compare("MULTILINESTRING") == 0) + if(line.substr(0, 15).compare("MULTILINESTRING") == 0) { - try - { - boost::geometry::read_wkt(line, gc); - } - catch(...) - { - std::cerr << "error." << std::endl; - return false; + using PointRange = typename MultiLineString::value_type; + using LineString = CGAL::internal::Geometry_container; + + std::vector pr_range; + CGAL::internal::Geometry_container, boost::geometry::multi_linestring_tag> gc(pr_range); + + internal::read_wkt_or_fail_stream(in, line, gc); + for(LineString& ls : gc) { + mls.push_back(*ls.range); } break; } } - for(LineString& ls : gc) - mls.push_back(*ls.range); - return !in.fail(); } @@ -266,28 +236,12 @@ template bool read_polygon_WKT(std::istream& in, Polygon& polygon) { - if(!in.good()) - return false; - std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 7).compare("POLYGON") == 0) + if(line.substr(0, 7).compare("POLYGON") == 0) { - try - { - boost::geometry::read_wkt(line, polygon); - } - catch( ...) - { - in.setstate(std::ios::failbit); - return false; - }; - + internal::read_wkt_or_fail_stream(in, line, polygon); internal::pop_back_if_equal_to_front(polygon); break; } @@ -313,31 +267,16 @@ template bool read_multi_polygon_WKT(std::istream& in, MultiPolygon& polygons) { - if(!in.good()) - return false; - - CGAL::internal::Geometry_container gc(polygons); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 12).compare("MULTIPOLYGON") == 0) + if(line.substr(0, 12).compare("MULTIPOLYGON") == 0) { - try - { - boost::geometry::read_wkt(line, gc); - } - catch( ...) - { - in.setstate(std::ios::failbit); - return false; - }; + CGAL::internal::Geometry_container gc(polygons); + internal::read_wkt_or_fail_stream(in, line, gc); - for(typename CGAL::internal::Geometry_container::iterator it = gc.begin(); it != gc.end(); ++it) - internal::pop_back_if_equal_to_front(*it); + for(auto& p : gc) + internal::pop_back_if_equal_to_front(p); break; } @@ -520,17 +459,15 @@ bool read_WKT(std::istream& is, MultiLineString& polylines, MultiPolygon& polygons) { - if(!is.good()) - return false; + auto fail = [&is]() { is.clear(is.rdstate() | std::ios::failbit); return false; }; - while(is.good() && !is.eof()) + std::string line; + while(is >> std::ws && is.good() && std::getline(is, line)) { typedef typename MultiPoint::value_type Point; typedef typename MultiLineString::value_type LineString; typedef typename MultiPolygon::value_type Polygon; - std::string line; - std::getline(is, line); std::string::size_type header_end = line.find("("); // } if(header_end == std::string::npos){ continue; @@ -552,42 +489,42 @@ bool read_WKT(std::istream& is, if(type == "POINT") { Point p; - CGAL::IO::read_point_WKT(iss, p); + if(!IO::read_point_WKT(iss, p) ) return fail(); points.push_back(p); } else if(type == "LINESTRING") { LineString l; - CGAL::IO::read_linestring_WKT(iss, l); - polylines.push_back(l); + if(!IO::read_linestring_WKT(iss, l)) return fail(); + polylines.push_back(std::move(l)); } else if(type == "POLYGON") { Polygon p; - CGAL::IO::read_polygon_WKT(iss, p); + if(!IO::read_polygon_WKT(iss, p)) return fail(); if(!p.outer_boundary().is_empty()) - polygons.push_back(p); + polygons.push_back(std::move(p)); } else if(type == "MULTIPOINT") { MultiPoint mp; - CGAL::IO::read_multi_point_WKT(iss, mp); + if(!IO::read_multi_point_WKT(iss, mp)) return fail(); for(const Point& point : mp) points.push_back(point); } else if(type == "MULTILINESTRING") { MultiLineString mls; - CGAL::IO::read_multi_linestring_WKT(iss, mls); - for(const LineString& ls : mls) - polylines.push_back(ls); + if(!IO::read_multi_linestring_WKT(iss, mls)) return fail(); + for(LineString& ls : mls) + polylines.push_back(std::move(ls)); } else if(type == "MULTIPOLYGON") { MultiPolygon mp; - CGAL::IO::read_multi_polygon_WKT(iss, mp); - for(const Polygon& poly : mp) - polygons.push_back(poly); + if(!IO::read_multi_polygon_WKT(iss, mp)) return fail(); + for(Polygon& poly : mp) + polygons.push_back(std::move(poly)); } } diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index 74f8dd34bab..631dfb6e5b7 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -216,6 +216,19 @@ public: } }; +template +class Output_rep +{ + Func f; + +public: + Output_rep(Func f) : f(f) {} + std::ostream& operator()(std::ostream& os) const + { + return f(os); + } +}; + /*! \relates Output_rep \brief stream output of the \c Output_rep calls its \c operator(). @@ -1004,12 +1017,53 @@ namespace std { template struct formatter, CharT> : public std::formatter> { + using context = std::basic_format_parse_context; + using context_iterator = typename context::iterator; + + constexpr context_iterator parse_non_precision_chars(context_iterator it, context_iterator end) + { + constexpr std::array letters = {CharT('A'), CharT('B'), CharT('P')}; + constexpr std::array modes = {CGAL::IO::ASCII, CGAL::IO::BINARY, CGAL::IO::PRETTY}; + + if(it == end) + throw "it != end is a precondition of `parse_non_precision_chars(it, end)`"; + + if(*it == CharT('}')) + return it; + if(*it == CharT('.')) + return it; + + for(const auto& letter : letters) { + if(*it == letter) { + mode = modes[std::addressof(letter) - letters.data()]; + return ++it; + } + } + + throw std::format_error(R"( +formatter for CGAL::Output_rep only support stream mode and precision, like `{:X.6}` where X is + - `A` (or missing) for ASCII mode, + - `B` for BINARY mode, or + - `P` for PRETTY mode +)"); + } + constexpr auto parse(std::basic_format_parse_context& ctx) { auto it = ctx.begin(); const auto end = ctx.end(); - if(it == end) - return it; + + if(it == end) return it; + + { + auto next = it; + do { + next = parse_non_precision_chars(it, end); + } while(next != it && (it = next) != end); + } + + if(it == end) return it; + if(*it != CharT('.')) { if(*it == CharT('}')) return it; throw std::format_error("formatter for CGAL::Output_rep only support precision, like `{:.6}`"); @@ -1031,12 +1085,14 @@ struct formatter, CharT> : public std::formatter &rep, FormatContext& ctx) const { std::basic_stringstream ss; + CGAL::IO::set_mode(ss, mode); ss.precision(precision); ss << rep; return std::formatter>::format(ss.str(), ctx); } int precision = 17; + CGAL::IO::Mode mode = CGAL::IO::ASCII; }; } // namespace std diff --git a/Stream_support/include/CGAL/IO/io_tags.h b/Stream_support/include/CGAL/IO/io_tags.h index 0d9f53a4ef7..2be29669531 100644 --- a/Stream_support/include/CGAL/IO/io_tags.h +++ b/Stream_support/include/CGAL/IO/io_tags.h @@ -51,7 +51,7 @@ template<> struct Io_traits { typedef io_Read_write Io_tag; }; template<> struct Io_traits { typedef io_Read_write Io_tag; }; template<> struct Io_traits { typedef io_Read_write Io_tag; }; - +struct IO_manip_tag{}; } //namespace CGAL diff --git a/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h b/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h index e3e26fe8b61..28a1aff6245 100644 --- a/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h +++ b/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h @@ -46,20 +46,16 @@ struct Geometry_container{ typedef typename Range::size_type size_type; typedef typename Range::value_type value_type; std::shared_ptr range; - bool must_delete; // // Default constructor. // Creates a new internal Range. // De-allocate memory after usage. - Geometry_container():range(new Range()), must_delete(true) - { - } + Geometry_container() : range(std::make_shared()) {} /* - Copy constructor. + Store a pointer to the given range. Memory NOT de-allocated after usage. */ - Geometry_container(Range& range) - :range(&range, Dummy_deleter()), must_delete(false){} + Geometry_container(Range& range) : range(&range, Dummy_deleter()) {} iterator begin() { return range->begin(); } diff --git a/Stream_support/test/Stream_support/CMakeLists.txt b/Stream_support/test/Stream_support/CMakeLists.txt index 217c1cc1de9..0247c46be05 100644 --- a/Stream_support/test/Stream_support/CMakeLists.txt +++ b/Stream_support/test/Stream_support/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_support_Tests) find_package(CGAL REQUIRED) find_path( diff --git a/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt b/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt index f7e403c4e81..e24a5f14ab4 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt +++ b/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Subdivision_method_3_Examples) find_package(CGAL REQUIRED) diff --git a/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt b/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt index 2e05ac1b014..05c94dc1e01 100644 --- a/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt +++ b/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Subdivision_method_3_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh/benchmark/CMakeLists.txt b/Surface_mesh/benchmark/CMakeLists.txt index c963412dd5b..af89e27a5f4 100644 --- a/Surface_mesh/benchmark/CMakeLists.txt +++ b/Surface_mesh/benchmark/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_performance) find_package(CGAL REQUIRED) diff --git a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt index 6b8821ccb12..bae80a7b2c2 100644 --- a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt @@ -6,7 +6,7 @@ # Used in /CGAL/Documentation/doc/Documentation/Developer_manual/create_and_use_a_cmakelist.txt. # Careful when modifying -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_Examples) #CGAL_Qt6 is needed for the drawing. diff --git a/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp b/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp index 05a166dc567..ca8593988b3 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp @@ -42,7 +42,7 @@ int main() { std::cout << "vertices around face " << f << std::endl; CGAL::Vertex_around_face_iterator vbegin, vend; - for(boost::tie(vbegin, vend) = vertices_around_face(m.halfedge(f), m); + for(std::tie(vbegin, vend) = vertices_around_face(m.halfedge(f), m); vbegin != vend; ++vbegin){ std::cout << *vbegin << std::endl; diff --git a/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp b/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp index 6fe9d48402e..0e16a7f0b38 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp @@ -44,8 +44,8 @@ int main() vb = std::begin(r); ve = std::end(r); - // or with boost::tie, as the CGAL range derives from std::pair - for(boost::tie(vb, ve) = m.vertices(); vb != ve; ++vb){ + // or with std::tie, as the CGAL range derives from std::pair + for(std::tie(vb, ve) = m.vertices(); vb != ve; ++vb){ // Print vertex index and vertex coordinates std::cout << *vb << " " << m.point(*vb) << std::endl; } diff --git a/Surface_mesh/examples/Surface_mesh/sm_join.cpp b/Surface_mesh/examples/Surface_mesh/sm_join.cpp index df0526992fe..d692035479a 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_join.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_join.cpp @@ -25,8 +25,8 @@ int main(int argc, char* argv[]) Mesh::Property_map name1, name2; bool created; sm1.add_property_map("v:weight",7812); - boost::tie(name1, created) = sm1.add_property_map("v:name","hello"); - boost::tie(name2, created) = sm2.add_property_map("v:name","world"); + std::tie(name1, created) = sm1.add_property_map("v:name","hello"); + std::tie(name2, created) = sm2.add_property_map("v:name","world"); sm1 += sm2; diff --git a/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp b/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp index 986b9e9d4e3..61f1f73745f 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp @@ -34,7 +34,7 @@ void kruskal(const Mesh& sm) " point [ \n"; vertex_iterator vb,ve; - for(boost::tie(vb, ve) = vertices(sm); vb!=ve; ++vb){ + for(std::tie(vb, ve) = vertices(sm); vb!=ve; ++vb){ std::cout << " " << sm.point(*vb) << "\n"; } diff --git a/Surface_mesh/examples/Surface_mesh/sm_properties.cpp b/Surface_mesh/examples/Surface_mesh/sm_properties.cpp index 5fa15d74058..9d591e8019c 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_properties.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_properties.cpp @@ -26,7 +26,7 @@ int main() // give each vertex a name, the default is empty Mesh::Property_map name; bool created; - boost::tie(name, created) = m.add_property_map("v:name","m1"); + std::tie(name, created) = m.add_property_map("v:name","m1"); assert(created); // add some names to the vertices name[v0] = "hello"; @@ -36,7 +36,7 @@ int main() // You get an existing property, and created will be false Mesh::Property_map name; bool created; - boost::tie(name, created) = m.add_property_map("v:name", ""); + std::tie(name, created) = m.add_property_map("v:name", ""); assert(! created); } diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 83ca6a3b4b7..86a3b498b6f 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -598,7 +598,7 @@ public: /// \name Range Types /// /// Each range `R` in this section has a nested type `R::iterator`, - /// is convertible to `std::pair`, so that one can use `boost::tie()`, + /// is convertible to `std::pair`, so that one can use `std::tie()`, /// and can be used with `BOOST_FOREACH()`, as well as with the C++11 range based for-loop. ///@{ diff --git a/Surface_mesh/test/Surface_mesh/CMakeLists.txt b/Surface_mesh/test/Surface_mesh/CMakeLists.txt index 62d2cb3bca7..3b516fc15d0 100644 --- a/Surface_mesh/test/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/test/Surface_mesh/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp b/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp index 5e932869a44..999d54de50d 100644 --- a/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp +++ b/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp @@ -75,7 +75,7 @@ struct test_emptiness : public Surface_fixture m.remove_vertex(iv); assert(m.is_removed(iv)); Sm::Vertex_iterator vb, ve; - for(boost::tie(vb, ve) = m.vertices(); vb != ve; ++vb) { + for(std::tie(vb, ve) = m.vertices(); vb != ve; ++vb) { Sm::Vertex_around_target_range vr = m.vertices_around_target(m.halfedge(*vb)); assert(!is_empty_range(std::begin(vr), std::end(vr))); } diff --git a/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp b/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp index 16fb699982c..d4e47e53b98 100644 --- a/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp +++ b/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp @@ -28,19 +28,19 @@ void standard_iterators() Surface_fixture f; Sm::Vertex_iterator vb, ve; - boost::tie(vb, ve) = f.m.vertices(); + std::tie(vb, ve) = f.m.vertices(); test_iterator(vb, ve, 5); Sm::Halfedge_iterator hb, he; - boost::tie(hb, he) = f.m.halfedges(); + std::tie(hb, he) = f.m.halfedges(); test_iterator(hb, he, 14); Sm::Edge_iterator eb, ee; - boost::tie(eb, ee) = f.m.edges(); + std::tie(eb, ee) = f.m.edges(); test_iterator(eb, ee, 7); Sm::Face_iterator fb, fe; - boost::tie(fb, fe) = f.m.faces(); + std::tie(fb, fe) = f.m.faces(); test_iterator(fb, fe, 3); } @@ -97,7 +97,7 @@ void memory_reuse_test() Faces faces; Sm::Face_iterator fb, fe; - for(boost::tie(fb, fe) = f.m.faces(); fb != fe; ++fb) { + for(std::tie(fb, fe) = f.m.faces(); fb != fe; ++fb) { faces.push_back(VecFace()); Sm::Vertex_around_face_circulator vafb(f.m.halfedge(*fb), f.m), vafe(vafb); if(vafb) @@ -108,7 +108,7 @@ void memory_reuse_test() } Sm::Vertex_iterator vb, ve; - for(boost::tie(vb, ve) = f.m.vertices(); vb != ve; ++vb) { + for(std::tie(vb, ve) = f.m.vertices(); vb != ve; ++vb) { f.m.set_halfedge(*vb, Sm::Halfedge_index()); } @@ -223,10 +223,10 @@ void properties () { Sm::Property_map prop; bool created = false; - boost::tie(prop,created) = f.m.add_property_map("illuminatiproperty", 23); + std::tie(prop,created) = f.m.add_property_map("illuminatiproperty", 23); assert(created == true); - boost::tie(prop, created)= f.m.add_property_map("illuminatiproperty"); + std::tie(prop, created)= f.m.add_property_map("illuminatiproperty"); assert(created == false); } diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt index 469d78b87a5..cb4def4fdcd 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_approximation_Benchmarks) # CGAL and its components diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt index d45a9693351..8da14e07439 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_approximation_Examples) # CGAL and its components diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt index d085b8cec23..35473846c94 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_approximation_Tests) # CGAL and its components diff --git a/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt b/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt index 19d66a7b1a3..c4b711d6aa4 100644 --- a/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt +++ b/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(benchmark_for_closest_rotation) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt index 58874d3f2dc..0f1a088904f 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_deformation_Demo) set_property(DIRECTORY PROPERTY CGAL_NO_TESTING TRUE) diff --git a/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp b/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp index 9f5036cc3c0..6b5c101ceb6 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp @@ -41,7 +41,7 @@ int main(int argc,char** argv) // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); //the selection is set by a file input.open(argv[2]); diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt index bc5d23347f0..496bc254011 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_deformation_Examples) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp index 5f429231d84..ed83fd3fb13 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp @@ -33,7 +33,7 @@ int main() // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Select two control vertices ... diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp index fe91ed58baf..4242008b653 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp @@ -29,7 +29,7 @@ int main(int argc, char** argv) // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Select two control vertices ... diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp index 74590db427b..d1927088526 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp @@ -81,7 +81,7 @@ int main() Vertex_index_map vertex_index_map(internal_vertex_index_map); vertex_iterator vb, ve; std::size_t counter = 0; - for(boost::tie(vb, ve) = vertices(mesh); vb != ve; ++vb, ++counter) { + for(std::tie(vb, ve) = vertices(mesh); vb != ve; ++vb, ++counter) { put(vertex_index_map, *vb, counter); } @@ -89,14 +89,14 @@ int main() Hedge_index_map hedge_index_map(internal_hedge_index_map); counter = 0; halfedge_iterator eb, ee; - for(boost::tie(eb, ee) = halfedges(mesh); eb != ee; ++eb, ++counter) { + for(std::tie(eb, ee) = halfedges(mesh); eb != ee; ++eb, ++counter) { put(hedge_index_map, *eb, counter); } Surface_mesh_deformation deform_mesh(mesh, vertex_index_map, hedge_index_map); // Insert the whole mesh as region of interest - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Insert two control vertices diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp index 88ad5c127df..f0acef64d8e 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp @@ -24,7 +24,7 @@ int main() // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Select two control vertices ... diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp index 112fdfb8467..afccc9903c7 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp @@ -51,7 +51,7 @@ int main(int argc,char** argv) // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); //the selection is set by a file input.open(sel_name); diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp index 61740ac320f..2adbedc0235 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) // Select and insert the vertices of the region of interest vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices(mesh); + std::tie(vb,ve) = vertices(mesh); std::vector roi = extract_k_ring(mesh, *std::next(vb, 47), 9); deform_mesh.insert_roi_vertices(roi.begin(), roi.end()); diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp index 79a82bc238b..08d82307bec 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp @@ -65,7 +65,7 @@ int main() // Select and insert the vertices of the region of interest vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices(mesh); + std::tie(vb,ve) = vertices(mesh); std::vector roi = extract_k_ring(mesh, *std::next(vb, 47), 9); deform_mesh.insert_roi_vertices(roi.begin(), roi.end()); diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt index b0c1b9bc196..354813c8e73 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_deformation_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h b/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h index bdc14cee74e..508cd98f3a6 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h @@ -27,13 +27,13 @@ void init_indices(Polyhedron& poly) { vertex_iterator vb, ve; std::size_t counter = 0; - for(boost::tie(vb, ve) = vertices(poly); vb != ve; ++vb, ++counter) { + for(std::tie(vb, ve) = vertices(poly); vb != ve; ++vb, ++counter) { (*vb)->id() = counter; } counter = 0; halfedge_iterator heb, hee; - for(boost::tie(heb, hee) = halfedges(poly); heb != hee; ++heb, ++counter) { + for(std::tie(heb, hee) = halfedges(poly); heb != hee; ++heb, ++counter) { (*heb)->id() = counter; } } @@ -59,7 +59,7 @@ read_rois(DeformMesh& deform_mesh, std::vector vvertices; vvertices.reserve(num_vertices(polyhedron)); vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(polyhedron); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(polyhedron); vb != ve; ++vb) { vvertices.push_back(*vb); } // load handles and roi from txt diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 5d74cdca661..6fb5830e133 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_parameterization_Examples) find_package(CGAL REQUIRED) 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 151165423f9..6ca9c4c8fe3 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 @@ -121,7 +121,7 @@ Error_code read_cones(const TriangleMesh& tm, std::ifstream& in, VertexIndexMap // Since the cones are unique, we only need to loop all the vertices once TM_vertex_iterator vit, end; - boost::tie(vit, end) = vertices(tm); + std::tie(vit, end) = vertices(tm); for(; vit!=end; ++vit) { for(std::size_t i=0; i::max)(); - for(boost::tie(b,e) = halfedges_around_face(bhd, mesh); b!=e; ++b, ++id) { + for(std::tie(b,e) = halfedges_around_face(bhd, mesh); b!=e; ++b, ++id) { double d = CGAL::abs(offset[id] - value); if(d < min) { best = b; @@ -160,7 +160,7 @@ private: double total_len = compute_border_length(mesh, bhd); halfedge_around_face_iterator b, e; - boost::tie(b,e) = halfedges_around_face(bhd, mesh); + std::tie(b,e) = halfedges_around_face(bhd, mesh); for(halfedge_around_face_iterator it = b; it!= e; ++it) { vertex_descriptor vs = source(*it, mesh); vertex_descriptor vt = target(*it, mesh); diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h index d9da2714623..6a8a74a4ebe 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h @@ -86,7 +86,7 @@ struct Index_map_filler { typename Map::iterator it; bool new_element; - boost::tie(it,new_element) = map->insert(std::make_pair(vd,1)); + std::tie(it,new_element) = map->insert(std::make_pair(vd,1)); if(new_element) { it->second = index++; } diff --git a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt index 36f681d45fd..0a0e459223a 100644 --- a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_parameterization_Tests) # Find CGAL diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt index e3f63874b1f..3f7e9457909 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_segmentation_Examples) # CGAL and its components diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h index 7afb29eecf2..7ad3cec0a83 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h @@ -80,7 +80,7 @@ public: smoothed_values.reserve(num_faces(mesh)); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { std::map neighbors; NeighborSelector()(mesh,*facet_it, window_size, @@ -126,7 +126,7 @@ public: } // put smoothed values back again to values pmap. std::vector::iterator smoothed_value_it = smoothed_values.begin(); - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it, ++smoothed_value_it) { put(values, *facet_it, *smoothed_value_it); @@ -162,7 +162,7 @@ public: std::vector smoothed_values; smoothed_values.reserve(num_faces(mesh)); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { std::map neighbors; NeighborSelector()(mesh, *facet_it, window_size, @@ -188,7 +188,7 @@ public: } // put smoothed values back again to values pmap. std::vector::iterator smoothed_value_it = smoothed_values.begin(); - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { values[*facet_it] = *smoothed_value_it; } diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h index 5709694f491..1baaa2b8c91 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #define CGAL_NUMBER_OF_MAD 1.5 @@ -90,11 +90,11 @@ private: typedef typename Tree::Primitive_id Primitive_id; // Sampled points from disk, t1 = coordinate-x, t2 = coordinate-y, t3 = weight. - typedef boost::tuple Disk_sample; + typedef std::tuple Disk_sample; typedef std::vector Disk_samples_list; // DiskSampling class responsible for the sampling points in a disk. It is used for generating rays in the cones. For different example see Disk_samplers.h - typedef Vogel_disk_sampling > + typedef Vogel_disk_sampling > Default_sampler; // member variables @@ -303,8 +303,8 @@ public: Primitive_id closest_id; Vector disk_vector = sum_functor( - scale_functor(v1, FT(disk_multiplier * sample_it->get<0>())), - scale_functor(v2, FT(disk_multiplier * sample_it->get<1>())) ); + scale_functor(v1, FT(disk_multiplier * std::get<0>(*sample_it))), + scale_functor(v2, FT(disk_multiplier * std::get<1>(*sample_it))) ); Vector ray_direction = sum_functor(scaled_normal, disk_vector); if(use_diagonal) { @@ -322,7 +322,7 @@ public: "A degenerate segment is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample."); } - boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id) + std::tie(is_intersected, intersection_is_acute, min_distance, closest_id) = cast_and_return_minimum(segment, skip, accept_if_acute); } else { Ray ray(center, ray_direction); @@ -332,7 +332,7 @@ public: "A degenerate ray is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample."); } - boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id) + std::tie(is_intersected, intersection_is_acute, min_distance, closest_id) = ray_casting(ray, skip, accept_if_acute); } @@ -342,7 +342,7 @@ public: visitor(closest_id, min_distance); - ray_distances.push_back(std::make_pair(min_distance, sample_it->get<2>())); + ray_distances.push_back(std::make_pair(min_distance, std::get<2>(*sample_it))); } if(ray_distances.empty()) { @@ -407,9 +407,9 @@ private: * - get<3> Primitive_id : closest intersected primitive if get<0> is true, else Primitive_id() */ template - boost::tuple cast_and_return_minimum( + std::tuple cast_and_return_minimum( const Query& query, SkipPrimitiveFunctor skip, bool accept_if_acute) const { - boost::tuple + std::tuple min_distance(false, false, 0.0, Primitive_id()); typedef typename Tree:: template Intersection_and_primitive_id::Type Intersection_and_primitive_id; @@ -440,16 +440,16 @@ private: Vector i_ray(*i_point, query.source()); double new_distance = to_double( i_ray.squared_length() ); - if(!min_distance.template get<0>() - || new_distance < min_distance.template get<2>()) { - min_distance.template get<3>() = id; - min_distance.template get<2>() = new_distance; - min_distance.template get<0>() = true; + if(!std::get<0>(min_distance) + || new_distance < std::get<2>(min_distance)) { + std::get<3>(min_distance) = id; + std::get<2>(min_distance) = new_distance; + std::get<0>(min_distance) = true; min_id = id; min_i_ray = i_ray; } } - if(!min_distance.template get<0>()) { + if(!std::get<0>(min_distance)) { return min_distance; } @@ -467,32 +467,32 @@ private: } } - min_distance.template get<1>() = true; // founded intersection is acceptable. - min_distance.template get<2>() = std::sqrt(min_distance.template get<2>()); + std::get<1>(min_distance) = true; // founded intersection is acceptable. + std::get<2>(min_distance) = std::sqrt(std::get<2>(min_distance)); return min_distance; } // function similar to `cast_and_return_minimum()` but using the function // first_intersection with a Ray to get the closest intersected primitive template - boost::tuple ray_casting( + std::tuple ray_casting( const Ray& query, SkipFunctor s, bool accept_if_acute) const { const std::optional< typename Tree::template Intersection_and_primitive_id::Type > min_intersection = tree.first_intersection(query, s); if(!min_intersection) - return boost::make_tuple(false, false, 0.0, Primitive_id()); + return std::make_tuple(false, false, 0.0, Primitive_id()); const Point* i_point = std::get_if( &min_intersection->first ); if (!i_point) //segment case ignored - return boost::make_tuple(false, false, 0.0, Primitive_id()); + return std::make_tuple(false, false, 0.0, Primitive_id()); Vector min_i_ray(*i_point, query.source()); - boost::tuple + std::tuple min_distance(true, false, to_double(min_i_ray.squared_length()), min_intersection->second); - const Primitive_id& min_id = min_distance.template get<3>(); + const Primitive_id& min_id = std::get<3>(min_distance); if(accept_if_acute) { // check whether the ray makes acute angle with intersected facet @@ -508,8 +508,8 @@ private: } } - min_distance.template get<1>() = true; // founded intersection is acceptable. - min_distance.template get<2>() = std::sqrt(min_distance.template get<2>()); + std::get<1>(min_distance) = true; // founded intersection is acceptable. + std::get<2>(min_distance) = std::sqrt(std::get<2>(min_distance)); return min_distance; } diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h index a2a2228f6f5..eb78e5ed48d 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h @@ -84,7 +84,7 @@ public: double min_sdf = (std::numeric_limits::max)(); // If there is any facet which has no sdf value, assign average sdf value of its neighbors face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { double sdf_value = get(sdf_values, *facet_it); CGAL_assertion(sdf_value == -1 || sdf_value >= 0); // validity check @@ -130,7 +130,7 @@ public: double min_sdf = (std::numeric_limits::max)(); double max_sdf = -min_sdf; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { double sdf_value = get(sdf_values, *facet_it); max_sdf = (std::max)(sdf_value, max_sdf); @@ -147,7 +147,7 @@ public: std::pair linear_normalize_sdf_values(const Polyhedron& mesh, SDFPropertyMap sdf_values) { double min_sdf, max_sdf; - boost::tie(min_sdf, max_sdf) = min_max_value(mesh, sdf_values); + std::tie(min_sdf, max_sdf) = min_max_value(mesh, sdf_values); if(min_sdf == max_sdf) { CGAL_warning_msg(min_sdf == max_sdf, "Linear normalization is not applicable!"); @@ -156,7 +156,7 @@ public: const double max_min_dif = max_sdf - min_sdf; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { put(sdf_values, *facet_it, (get(sdf_values, *facet_it) - min_sdf) / max_min_dif); } @@ -297,7 +297,7 @@ public: AlphaExpansionImplementationTag()); std::vector::iterator label_it = labels.begin(); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it, ++label_it) { put(segment_pmap, *facet_it, *label_it); // fill with cluster-ids @@ -354,7 +354,7 @@ private: std::vector& normalized_sdf_values) { normalized_sdf_values.reserve(num_faces(mesh)); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { double log_normalized = log(get(sdf_values, *facet_it) * CGAL_NORMALIZATION_ALPHA + 1) / log(CGAL_NORMALIZATION_ALPHA + 1); @@ -398,7 +398,7 @@ private: std::map facet_index_map; std::size_t facet_index = 0; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it, ++facet_index) { facet_index_map[*facet_it] = facet_index; @@ -407,7 +407,7 @@ private: const double epsilon = 5e-6; // edges and their weights. pair stores facet-id pairs (see above) (may be using boost::tuple can be more suitable) edge_iterator edge_it, eend; - for(boost::tie(edge_it,eend) = edges(mesh); + for(std::tie(edge_it,eend) = edges(mesh); edge_it != eend; ++edge_it) { halfedge_descriptor hd = halfedge(*edge_it,mesh); halfedge_descriptor ohd = opposite(hd,mesh); @@ -461,7 +461,7 @@ private: std::size_t segment_id = number_of_clusters; std::vector > segments_with_average_sdf_values; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { if(get(segments, *facet_it) < number_of_clusters) { // not visited by depth_first_traversal @@ -488,7 +488,7 @@ private: } // make one-pass on facets. First make segment-id zero based by subtracting number_of_clusters // . Then place its sorted index to pmap - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { std::size_t segment_id = get(segments, *facet_it) - number_of_clusters; put(segments, *facet_it, segment_id_to_sorted_id_map[segment_id]); diff --git a/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt b/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt index 9c2e4233b54..d30a6c96f63 100644 --- a/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_segmentation_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp index 412d7ed844f..811ab9345df 100644 --- a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp +++ b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp @@ -192,7 +192,7 @@ void run_benchmarks(CGAL::Random& rand, size_t numTrials, size_t numSources, siz outData.numFaces = num_faces(polyhedron); face_iterator startFace, endFace; - boost::tie(startFace, endFace) = faces(polyhedron); + std::tie(startFace, endFace) = faces(polyhedron); std::vector allFaces; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt index ba5a6455d26..a30dca613c3 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_shortest_path_Examples) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp index a3b7268b77d..fdf2afc0969 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp @@ -48,7 +48,7 @@ int main(int argc, char** argv) // into a file readable using CGAL Lab std::ofstream output("shortest_paths_with_id.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp index 34b337d95f4..4192f5e70b8 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) // into a file readable using the CGAL Tmesh demo std::ofstream output("shortest_paths_OpenMesh.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp index a0a05111c91..eab88444695 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) // by copying the faces in a vector to get a direct access to faces std::size_t nb_faces=num_faces(tmesh); face_iterator fit, fit_end; - boost::tie(fit, fit_end) = faces(tmesh); + std::tie(fit, fit_end) = faces(tmesh); std::vector face_vector(fit, fit_end); // and creating a vector of Face_location objects const std::size_t nb_source_points = 30; @@ -59,7 +59,7 @@ int main(int argc, char** argv) // into a file readable using the CGAL Tmesh demo std::ofstream output("shortest_paths_multiple_sources.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp index 8b51ee23d2b..678183446cf 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) // into a file readable using CGAL Lab std::ofstream output("shortest_paths_no_id.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp index 697146cc16b..ea434a51188 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp @@ -48,7 +48,7 @@ int main(int argc, char** argv) // into a file readable using CGAL Lab std::ofstream output("shortest_paths_with_id.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt index ea1eb891aab..f5ca543e44a 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_shortest_path_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp index 22b1869274a..e39457cf08f 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp @@ -50,7 +50,7 @@ void shortest_path_regular_tetrahedron() face_iterator startFace; face_iterator endFace; - boost::tie(startFace,endFace) = CGAL::faces(P); + std::tie(startFace,endFace) = CGAL::faces(P); face_descriptor firstFace = *startFace; @@ -66,7 +66,7 @@ void shortest_path_regular_tetrahedron() Kernel::FT halfSideLength = sideLength / Kernel::FT(2.0); Kernel::FT triangleHeight = CGAL::sqrt((sideLength*sideLength) - (halfSideLength*halfSideLength)); - for (boost::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) + for (std::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) { if ((*currentVertex)->point().y()==-1) { @@ -118,7 +118,7 @@ void test_simple_saddle_vertex_mesh() vertex_iterator startVertex; vertex_iterator endVertex; - boost::tie(startVertex, endVertex) = CGAL::vertices(P); + std::tie(startVertex, endVertex) = CGAL::vertices(P); vertex_iterator currentVertex = startVertex; @@ -368,7 +368,7 @@ void test_boundary_mesh() face_iterator startFace; face_iterator endFace; - boost::tie(startFace, endFace) = CGAL::faces(P); + std::tie(startFace, endFace) = CGAL::faces(P); vertex_iterator currentVertex; vertex_iterator endVertex; @@ -380,7 +380,7 @@ void test_boundary_mesh() Point_3 vertexLocations[10]; size_t currentVertexIndex = 0; - for (boost::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) + for (std::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) { vertexHandles[currentVertexIndex] = *currentVertex; vertexLocations[currentVertexIndex] = vpm[*currentVertex]; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp index 19bda236706..ceb07b5e178 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) std::vector vertices; - boost::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); + std::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); for (vertex_iterator it = verticesStart; it != verticesEnd; ++it) { @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) std::vector faces; - boost::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); + std::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); for (face_iterator it = facesStart; it != facesEnd; ++it) { diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp index 26da5f2d915..608a79b29c6 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) Surface_mesh_shortest_path shortestPaths(polyhedron, traits); face_iterator facesBegin, facesEnd; - boost::tie(facesBegin, facesEnd) = faces(polyhedron); + std::tie(facesBegin, facesEnd) = faces(polyhedron); std::vector facesList; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp index 1774d928a24..b0070bd17d0 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) Surface_mesh_shortest_path shortestPaths(polyhedron, traits); face_iterator facesBegin, facesEnd; - boost::tie(facesBegin, facesEnd) = faces(polyhedron); + std::tie(facesBegin, facesEnd) = faces(polyhedron); std::vector facesList; @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) } vertex_iterator startVertexIt, endVertexIt; - boost::tie(startVertexIt, endVertexIt) = vertices(polyhedron); + std::tie(startVertexIt, endVertexIt) = vertices(polyhedron); bool first = true; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp index 54e3c49e4dd..cc7ed1d29b8 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) std::vector faces; - boost::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); + std::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); for (face_iterator it = facesStart; it != facesEnd; ++it) { diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp index 784be8d0abd..e02ac923237 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp @@ -64,7 +64,7 @@ void test_simple_2D_barycentric_coordinatess() size_t outVertex0; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type b0Type; - boost::tie(b0Type, outVertex0) = classify_barycentric_coordinates(b0); + std::tie(b0Type, outVertex0) = classify_barycentric_coordinates(b0); CHECK_EQUAL(b0Type, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_VERTEX); CHECK_EQUAL(outVertex0, 0u); @@ -77,7 +77,7 @@ void test_simple_2D_barycentric_coordinatess() size_t outVertex1; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type b1Type; - boost::tie(b1Type, outVertex1) = classify_barycentric_coordinates(b1); + std::tie(b1Type, outVertex1) = classify_barycentric_coordinates(b1); CHECK_EQUAL(b1Type, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_VERTEX); CHECK_EQUAL(outVertex1, 1u); @@ -90,7 +90,7 @@ void test_simple_2D_barycentric_coordinatess() size_t outVertex2; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type b2Type; - boost::tie(b2Type, outVertex2) = classify_barycentric_coordinates(b2); + std::tie(b2Type, outVertex2) = classify_barycentric_coordinates(b2); CHECK_EQUAL(b2Type, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_VERTEX); CHECK_EQUAL(outVertex2, 2u); @@ -100,7 +100,7 @@ void test_simple_2D_barycentric_coordinatess() size_t dummyOut; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type bLocationType; - boost::tie(bLocationType, dummyOut) = classify_barycentric_coordinates(bLocation); + std::tie(bLocationType, dummyOut) = classify_barycentric_coordinates(bLocation); CHECK_EQUAL(bLocationType, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_BOUNDED_SIDE); @@ -282,7 +282,7 @@ void detect_is_saddle_vertex() vertex_iterator currentVertex; vertex_iterator endVertex; - for (boost::tie(currentVertex, endVertex) = vertices(P); currentVertex != endVertex; ++currentVertex) + for (std::tie(currentVertex, endVertex) = vertices(P); currentVertex != endVertex; ++currentVertex) { if (currentVertexIndex <= 3 || currentVertexIndex == 7) { 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 aaf41537b8b..35d2c0cab86 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 @@ -168,7 +168,7 @@ struct TestMeshProgramInstance std::vector vertices; - boost::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); + std::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); for (vertex_iterator it = verticesStart; it != verticesEnd; ++it) { @@ -180,7 +180,7 @@ struct TestMeshProgramInstance std::vector faces; - boost::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); + std::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); for (face_iterator it = facesStart; it != facesEnd; ++it) { diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt index 384067e6005..56a52dd5cc4 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_simplification_Examples) # CGAL and its components diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h index 5c23e83e94f..d53b3458d15 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h @@ -754,7 +754,7 @@ is_collapse_topologically_valid(const Profile& profile) // The following loop checks the link condition for v0_v1. // Specifically, that for every vertex 'k' adjacent to both 'p and 'q', 'pkq' is a face of the mesh. // - for(boost::tie(eb1,ee1) = halfedges_around_source(profile.v0(), m_tm); res && eb1 != ee1; ++eb1) + for(std::tie(eb1,ee1) = halfedges_around_source(profile.v0(), m_tm); res && eb1 != ee1; ++eb1) { halfedge_descriptor v0_k = *eb1; @@ -762,7 +762,7 @@ is_collapse_topologically_valid(const Profile& profile) { vertex_descriptor k = target(v0_k, m_tm); - for(boost::tie(eb2,ee2) = halfedges_around_source(k, m_tm); res && eb2 != ee2; ++eb2) + for(std::tie(eb2,ee2) = halfedges_around_source(k, m_tm); res && eb2 != ee2; ++eb2) { halfedge_descriptor k_v1 = *eb2; diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt index 6707d16ccd9..5453440119b 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_simplification_Tests) find_package(CGAL REQUIRED) 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 00e6cf68501..45eba38aa7a 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 @@ -136,7 +136,7 @@ public: Profile::Triangle_vector triangles; out_edge_iterator eb, ee; - for(boost::tie(eb,ee) = halfedges_around_source(opposite(halfedge(mV,tm()),tm()),tm()); eb != ee; ++ eb) + for(std::tie(eb,ee) = halfedges_around_source(opposite(halfedge(mV,tm()),tm()),tm()); eb != ee; ++ eb) { halfedge_descriptor out_edge1 = *eb; halfedge_descriptor out_edge2 = out_edge1->opposite()->next(); diff --git a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt index 66e08127abd..181714c3a51 100644 --- a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mean_curvature_skeleton) # CGAL and its components diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt index b5b8d4cd23f..60ccbd71f69 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_skeletonization_Examples) find_package(CGAL REQUIRED) 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 39b928852ea..b69e59d8e0c 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -344,7 +344,7 @@ double diagonal_length(const Bbox_3& bbox) double init_min_edge_length() { vertex_iterator vb, ve; - boost::tie(vb, ve) = vertices(m_tmesh); + std::tie(vb, ve) = vertices(m_tmesh); Vertex_to_point v_to_p(m_tmesh_point_pmap); Bbox_3 bbox = CGAL::bbox_3(boost::make_transform_iterator(vb, v_to_p), boost::make_transform_iterator(ve, v_to_p)); diff --git a/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h b/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h index f8a1f3eeb20..c1905924ba8 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h +++ b/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h @@ -177,7 +177,7 @@ public: bool exist; edge_desc edge; - boost::tie(edge, exist) = boost::edge(p1_vd, p2_vd, curve); + std::tie(edge, exist) = boost::edge(p1_vd, p2_vd, curve); if (!exist) { boost::add_edge(p1_vd, p2_vd, curve); @@ -353,7 +353,7 @@ private: // look for ei from p2's incident edges bool found; int ind; - boost::tie(found, ind) = find_edge(vertex_to_edge[p2], ei); + std::tie(found, ind) = find_edge(vertex_to_edge[p2], ei); if (!found) { continue; diff --git a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt index cfbd1507754..d581a0b6d1a 100644 --- a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_skeletonization_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt index ed4937594fc..287b89df09e 100644 --- a/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt @@ -1,6 +1,6 @@ project(Surface_mesh_topology_Benchmarks) -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp b/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp index 9a5f36d352b..e6d3b3d7104 100644 --- a/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp +++ b/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp @@ -118,13 +118,13 @@ int main(int argc, char** argv) if (!withE) { E=static_cast(random.get_int - (10, std::max(std::size_t(11), - cm.number_of_darts()/10))); } + (10, (std::max)(std::size_t(11), + cm.number_of_darts()/10))); } if (!withD) { D=static_cast(random.get_int - (10, std::max(std::size_t(11), - cm.number_of_darts()/10))); } + (10, (std::max)(std::size_t(11), + cm.number_of_darts()/10))); } diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt index ae6793d8270..b528c238d49 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_topology_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt index dc45d083c3e..298d2838256 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_topology_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Surface_mesher/doc/Surface_mesher/PackageDescription.txt b/Surface_mesher/doc/Surface_mesher/PackageDescription.txt index 39b9d967d97..091d2399df4 100644 --- a/Surface_mesher/doc/Surface_mesher/PackageDescription.txt +++ b/Surface_mesher/doc/Surface_mesher/PackageDescription.txt @@ -21,7 +21,6 @@ /*! \addtogroup PkgSurfaceMesher3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Surface Mesh Generation,PkgSurfaceMesher3} \cgalPkgPicture{segmented_head-small.png} \cgalPkgSummaryBegin diff --git a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt index 4613fe7dc45..56c3805ea0b 100644 --- a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesher_Examples) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h b/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h index 2e8cf47f695..92c9b08a56b 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace CGAL { @@ -96,7 +96,7 @@ namespace CGAL { { const Self& oracle; - boost::tuple + std::tuple intersection_line_sphere_lambda(const Surface_3& sphere, const Point& a, const Point& b) const @@ -148,18 +148,18 @@ namespace CGAL { switch( CGAL::sign(deltaprime) ) { case ZERO: - return boost::make_tuple(1, ab_ac / ab2, 0); + return std::make_tuple(1, ab_ac / ab2, 0); case POSITIVE: { const FT sqrt_deltaprime = CGAL::sqrt(deltaprime); - return boost::make_tuple(2, - (ab_ac - sqrt_deltaprime) / ab2, - (ab_ac + sqrt_deltaprime) / ab2); + return std::make_tuple(2, + (ab_ac - sqrt_deltaprime) / ab2, + (ab_ac + sqrt_deltaprime) / ab2); } case NEGATIVE: break; } - return boost::make_tuple(0, 0, 0); + return std::make_tuple(0, 0, 0); } //end intersection_line_sphere_lambda template @@ -179,7 +179,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); const Vector ab = vector(a, b); @@ -285,7 +285,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); #ifdef CGAL_SURFACE_MESHER_DEBUG_IMPLICIT_ORACLE @@ -347,7 +347,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 && root_2 > FT(0) ) @@ -386,7 +386,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 ) diff --git a/Surface_mesher/test/Surface_mesher/CMakeLists.txt b/Surface_mesher/test/Surface_mesher/CMakeLists.txt index 751de47ec99..555e184c83b 100644 --- a/Surface_mesher/test/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/test/Surface_mesher/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesher_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt b/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt index d6d239ae476..8f4d6fcc4d6 100644 --- a/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt +++ b/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt @@ -1,7 +1,6 @@ /// \defgroup PkgSurfaceSweep2Ref 2D Intersection of Curves Reference /*! \addtogroup PkgSurfaceSweep2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Intersection of Curves,PkgSurfaceSweep2} \cgalPkgPicture{Curve_intersections_2.png} \cgalPkgSummaryBegin diff --git a/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt index 9c8742904a3..efa3b73ce6e 100644 --- a/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_sweep_2_Examples) # CGAL and its components diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 4cf76b87681..66ada8c1f56 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_sweep_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/TDS_2/doc/TDS_2/PackageDescription.txt b/TDS_2/doc/TDS_2/PackageDescription.txt index d4dc2c2645e..95af343936f 100644 --- a/TDS_2/doc/TDS_2/PackageDescription.txt +++ b/TDS_2/doc/TDS_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgTDS2Ref /*! \addtogroup PkgTDS2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Triangulation Data Structure,PkgTDS2} \cgalPkgPicture{tds_small.png} \cgalPkgSummaryBegin diff --git a/TDS_2/test/TDS_2/CMakeLists.txt b/TDS_2/test/TDS_2/CMakeLists.txt index 283d2478e12..4eae9c44970 100644 --- a/TDS_2/test/TDS_2/CMakeLists.txt +++ b/TDS_2/test/TDS_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(TDS_2_Tests) find_package(CGAL REQUIRED) diff --git a/TDS_3/doc/TDS_3/PackageDescription.txt b/TDS_3/doc/TDS_3/PackageDescription.txt index 06523934036..9f2efbc741f 100644 --- a/TDS_3/doc/TDS_3/PackageDescription.txt +++ b/TDS_3/doc/TDS_3/PackageDescription.txt @@ -10,7 +10,6 @@ /// \ingroup PkgTDS3Ref /*! \addtogroup PkgTDS3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Triangulation Data Structure,PkgTDS3} \cgalPkgPicture{tds3_small.png} \cgalPkgSummaryBegin diff --git a/TDS_3/examples/TDS_3/CMakeLists.txt b/TDS_3/examples/TDS_3/CMakeLists.txt index c0ba49a3d79..21ee9b95fb0 100644 --- a/TDS_3/examples/TDS_3/CMakeLists.txt +++ b/TDS_3/examples/TDS_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(TDS_3_Examples) find_package(CGAL REQUIRED) diff --git a/TDS_3/test/TDS_3/CMakeLists.txt b/TDS_3/test/TDS_3/CMakeLists.txt index 5cca940fe98..90fffaac8da 100644 --- a/TDS_3/test/TDS_3/CMakeLists.txt +++ b/TDS_3/test/TDS_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(TDS_3_Tests) find_package(CGAL REQUIRED) diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt index 64bbdc1a194..1e2f8f0d0ca 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Tetrahedral_remeshing_Examples) diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt index de0fb965c4e..63bc0c06023 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Tetrahedral_remeshing_Tests) diff --git a/Three/doc/Three/Three.txt b/Three/doc/Three/Three.txt index 2156a47f8a9..a9d180059da 100644 --- a/Three/doc/Three/Three.txt +++ b/Three/doc/Three/Three.txt @@ -328,7 +328,7 @@ Configure CMake as you desire and fetch the right Qt6 packages : set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) - cmake_minimum_required(VERSION 3.12...3.29) + cmake_minimum_required(VERSION 3.12...3.31) #Find CGAL find_package(CGAL COMPONENTS Qt6) @@ -366,7 +366,7 @@ Notice that an external plugin will not be automatically loaded in the Lab. It m set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) - cmake_minimum_required(VERSION 3.12...3.29) + cmake_minimum_required(VERSION 3.12...3.31) #Find CGAL find_package(CGAL COMPONENTS Qt6) diff --git a/Triangulation/applications/Triangulation/CMakeLists.txt b/Triangulation/applications/Triangulation/CMakeLists.txt index 262c38e3bda..2ed210eb1ca 100644 --- a/Triangulation/applications/Triangulation/CMakeLists.txt +++ b/Triangulation/applications/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_apps) # CGAL and its components diff --git a/Triangulation/benchmark/Triangulation/CMakeLists.txt b/Triangulation/benchmark/Triangulation/CMakeLists.txt index 0abb1fc41f9..5a3787259ee 100644 --- a/Triangulation/benchmark/Triangulation/CMakeLists.txt +++ b/Triangulation/benchmark/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_benchmark) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Triangulation/examples/Triangulation/CMakeLists.txt b/Triangulation/examples/Triangulation/CMakeLists.txt index 44e2a96f1e0..34edb7814bc 100644 --- a/Triangulation/examples/Triangulation/CMakeLists.txt +++ b/Triangulation/examples/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_Examples) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) diff --git a/Triangulation/test/Triangulation/CMakeLists.txt b/Triangulation/test/Triangulation/CMakeLists.txt index ed03cdab900..23b67f9c497 100644 --- a/Triangulation/test/Triangulation/CMakeLists.txt +++ b/Triangulation/test/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_Tests) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h index 29d2b48d745..f9786d793f3 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h @@ -77,16 +77,17 @@ A default constructed `Constraint_id` is a singular value that can not be the ID typedef unspecified_type Constraint_id; /*! -An iterator to visit +A bidirectional iterator to visit all the input constraints. The order of visit is undefined. The value type of this iterator is `Constraint_id`. */ typedef unspecified_type Constraint_iterator; /*! -A range type for iterating over all constraints. +A range type for iterating over all constraints. The iterator type of +the range is `Constraint_iterator`. */ -typedef Iterator_range Constraints; +typedef unspecified_type Constraints; /*! @@ -95,22 +96,33 @@ A subconstraint is a pair of vertices that correspond to an `Edge`. typedef std::pair Subconstraint; /*! -An iterator -to visit all the subconstraints of the triangulation. +A bidirectional iterator to visit all the subconstraints of the triangulation. The order of visit is undefined. -The value type of this iterator is `std::pair*>` -corresponding to the vertices of the -subconstraint. +The value type of this iterator is `Subconstraint`. */ typedef unspecified_type Subconstraint_iterator; /*! -A range type for iterating over all subconstraints. +A range type for iterating over all subconstraints. The iterator type of +the range is `Subconstraint_iterator`. */ -typedef Iterator_range Subconstraints; +typedef unspecified_type Subconstraints; /*! -An iterator on the +A bidirectional iterator to visit all the subconstraints of the triangulation and the +contexts of their enclosing constraints. The order of visit is undefined. +The value type of this iterator is `const std::pair*>`. +*/ +typedef unspecified_type Subconstraint_and_contexts_iterator; + +/*! +A range type for iterating over all subconstraints. The iterator type of +the range is `Subconstraint_and_contexts_iterator`. +*/ +typedef unspecified_type Subconstraints_and_contexts; + +/*! +A bidirectional iterator on the vertices of the chain of subconstraints representing a constraint. The value type of this iterator is `Vertex_handle`. */ @@ -152,10 +164,8 @@ through a subconstraint. }; /*! -An iterator on -constraints enclosing a given subconstraint. The value type of this -iterator -is `Context`. +A bidirectional iterator on constraints enclosing a given subconstraint. +The value type of this iterator is `Context`. */ typedef unspecified_type Context_iterator; @@ -348,6 +358,11 @@ void remove_constraint(Constraint_id cid); /// \name Access /// @{ +/// +/// \note +/// Since CGAL-6.1, the value type of the range returned by `subconstraints()` has changed from +/// `const std::pair*>` to `Subconstraint`. +/// The old range type is now returned by the function `subconstraints_and_contexts()`. /*! returns a `Constraint_iterator` that points at the first @@ -381,6 +396,22 @@ returns a range of subconstraints. */ Subconstraints subconstraints() const; +/*! +returns a `Subconstraint_and_contexts_iterator` pointing at the first +subconstraint of the triangulation. +*/ +Subconstraint_and_contexts_iterator subconstraints_and_contexts_begin() const; + +/*! +returns the past-the-end iterator of the subconstraints of the triangulation. +*/ +Subconstraint_and_contexts_iterator subconstraints_and_contexts_end() const; + +/*! +returns a range of subconstraints with the contexts of their enclosing constraints. +*/ +Subconstraints_and_contexts subconstraints_and_contexts() const; + /*! returns the number of constraints enclosing the subconstraint `(va,vb)`. diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h index 14dff71d41f..ffc29f933bb 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h @@ -1192,6 +1192,18 @@ Returns the line segment corresponding to edge `*ei`. Segment segment(const Edge_iterator& ei) const; +/*! +Returns the point given by vertex `i` of face `f`. +\pre `t.dimension()` \f$ \geq0\f$ and \f$ i \in\{0,1,2\}\f$ in dimension 2, \f$ i \in\{0,1\}\f$ in dimension 1, \f$ i = 0\f$ in dimension 0, and the vertex is finite. +*/ +const Point& point(Face_handle f, int i) const; + +/*! +Same as the previous method for vertex `v`. +\pre `t.dimension()` \f$ \geq0\f$ and the vertex is finite. +*/ +const Point& point(Vertex_handle v) const; + /*! Compute the circumcenter of the face pointed to by f. This function is available only if the corresponding function is provided in the diff --git a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt index f84ffe376ba..815186bb141 100644 --- a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt +++ b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt @@ -27,7 +27,6 @@ /*! \addtogroup PkgTriangulation2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Triangulations,PkgTriangulation2} \cgalPkgPicture{cdt2d-small.png} \cgalPkgSummaryBegin diff --git a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt index 2e2b15634af..22051dcdf3c 100644 --- a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp b/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp index 950cb022632..d276b5a4d36 100644 --- a/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp +++ b/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp @@ -23,22 +23,23 @@ int main( ) { Triangulation cdt; - std::cout << "Inserting a grid 5 x 5 of constraints " << std::endl; + std::cout << "Inserting a grid 5 x 5 of 10 intersecting constraints " << std::endl; for (int i = 1; i < 6; ++i) cdt.insert_constraint( Point(0,i), Point(6,i)); for (int j = 1; j < 6; ++j) cdt.insert_constraint( Point(j,0), Point(j,6)); int count = 0; - for (Triangulation::Subconstraint_iterator scit = cdt.subconstraints_begin(); - scit != cdt.subconstraints_end(); - ++scit) ++count; + using Sc = Triangulation::Subconstraint; + for ([[maybe_unused]] const Sc& sc : cdt.subconstraints()) { + ++count; + } std::cout << "The number of resulting constrained edges is "; std::cout << count << std::endl; //verbose mode of is_valid ; shows the number of vertices at each level std::cout << "The number of vertices at successive levels" << std::endl; - assert(cdt.is_valid(true)); + bool valid = cdt.is_valid(true); - return 0; + return valid ? 0 : 1; } diff --git a/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp b/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp index bc00e7071ba..b2b38e93765 100644 --- a/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp +++ b/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp @@ -28,13 +28,14 @@ print(const CDTP& cdtp, Cid cid) void contexts(const CDTP& cdtp) { - for(auto sc : cdtp.subconstraints()){ - Vertex_handle vp = sc.first.first, vq = sc.first.second; + for(const auto& sc_and_contexts : cdtp.subconstraints_and_contexts()) { + const auto& [subconstraint, contexts_list_ptr] = sc_and_contexts; + Vertex_handle vp = subconstraint.first, vq = subconstraint.second; if(cdtp.number_of_enclosing_constraints(vp, vq) == 2){ std::cout << "subconstraint " << vp->point() << " " << vq->point() << " is on constraints starting at:\n"; - for(const CDTP::Context& c : cdtp.contexts(vp,vq)){ + for(const CDTP::Context& c : *contexts_list_ptr) { std::cout << (*(c.vertices_begin()))->point() << std::endl; } } diff --git a/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp b/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp index 5eadd29090f..80ef763b404 100644 --- a/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp +++ b/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp @@ -31,7 +31,8 @@ int main() cdtp.insert_constraint(Point(100,100), Point(200,200)); // Segment soup of 8 segments as input - std::cout << "Input CDT+ has " << cdtp.number_of_constraints() << " constraints/subconstraints" << std::endl; + std::cout << "Input CDT+ has " << cdtp.number_of_constraints() + << " constraints/subconstraints" << std::endl; std::cout << "Splitting subconstraints graph into constraints" << std::endl; cdtp.split_subconstraint_graph_into_constraints(); @@ -47,5 +48,11 @@ int main() std::cout << std::endl; } + if(cdtp.number_of_constraints() != 5) + { + std::cerr << "Error: expected 5 constraints/subconstraints" << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index caed792fa5e..8e9aa157817 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -40,7 +40,7 @@ struct Get_iterator_value_type{ template struct Get_iterator_value_type{ - typedef typename std::iterator_traits::value_type type; + using type = typename std::iterator_traits::value_type; }; } } //namespace CGAL::internal @@ -56,8 +56,8 @@ class Cdt_2_less_edge { const Tr* tr_ptr; - typedef typename Tr::Point Point; - typedef typename Tr::Edge Edge; + using Point = typename Tr::Point; + using Edge = typename Tr::Edge; public: Cdt_2_less_edge(const Tr* tr_ptr) : tr_ptr(tr_ptr) { } @@ -94,39 +94,49 @@ class Constrained_Delaunay_triangulation_2 : public Constrained_triangulation_2 { public: - typedef Constrained_triangulation_2 Ctr; - typedef typename Ctr::Tds Tds; - typedef typename Ctr::Itag Itag; + using Base = Constrained_triangulation_2; + using Ctr = Base; - typedef Constrained_Delaunay_triangulation_2 CDt; - typedef typename Ctr::Geom_traits Geom_traits; - typedef typename Ctr::Intersection_tag Intersection_tag; + // using-declarations, to import types from the base class + // (do not mix-up with type aliases) + // see: https://en.cppreference.com/w/cpp/language/type_alias + // https://en.cppreference.com/w/cpp/language/using_declaration + using typename Ctr::Tds; + using typename Ctr::Itag; - typedef typename Ctr::Constraint Constraint; - typedef typename Ctr::Vertex_handle Vertex_handle; - typedef typename Ctr::Face_handle Face_handle; - typedef typename Ctr::Edge Edge; - typedef typename Ctr::Finite_faces_iterator Finite_faces_iterator; - typedef typename Ctr::Constrained_edges_iterator Constrained_edges_iterator; - typedef typename Ctr::Face_circulator Face_circulator; - typedef typename Ctr::size_type size_type; - typedef typename Ctr::Locate_type Locate_type; + using typename Ctr::Geom_traits; + using typename Ctr::Intersection_tag; - typedef typename Ctr::List_edges List_edges; - typedef typename Ctr::List_faces List_faces; - typedef typename Ctr::List_vertices List_vertices; - typedef typename Ctr::List_constraints List_constraints; + using typename Ctr::Constraint; +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1920) + using Vertex_handle = typename Ctr::Vertex_handle; // workaround for VC++ 19.16 (from MSVC 2017) +#else + using typename Ctr::Vertex_handle; +#endif + using typename Ctr::Face_handle; + using typename Ctr::Edge; + using typename Ctr::Finite_faces_iterator; + using typename Ctr::Constrained_edges_iterator; + using typename Ctr::Face_circulator; + using typename Ctr::size_type; + using typename Ctr::Locate_type; - typedef internal::Cdt_2_less_edge Less_edge; - typedef boost::container::flat_set Edge_set; + using typename Ctr::List_edges; + using typename Ctr::List_faces; + using typename Ctr::List_vertices; + using typename Ctr::List_constraints; + + // type aliases (aka type defs) + using CDt = Constrained_Delaunay_triangulation_2; + using Point = typename Geom_traits::Point_2; //Tag to distinguish Delaunay from regular triangulations - typedef Tag_false Weighted_tag; + using Weighted_tag = Tag_false; // Tag to distinguish periodic triangulations from others - typedef Tag_false Periodic_tag; + using Periodic_tag = Tag_false; -#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 + // using-declarations to import member functions from the base class using Ctr::geom_traits; using Ctr::number_of_vertices; using Ctr::finite_faces_begin; @@ -151,9 +161,6 @@ public: using Ctr::delete_vertex; using Ctr::push_back; using Ctr::mirror_index; -#endif - - typedef typename Geom_traits::Point_2 Point; Constrained_Delaunay_triangulation_2(const Geom_traits& gt=Geom_traits()) : Ctr(gt) { } @@ -176,7 +183,7 @@ public: CGAL_postcondition( is_valid() ); } - virtual ~Constrained_Delaunay_triangulation_2() {} + ~Constrained_Delaunay_triangulation_2() override {} // Ensure rule-of-five: define the copy- and move- constructors @@ -293,17 +300,17 @@ public: bool is_valid(bool verbose = false, int level = 0) const; protected: - virtual Vertex_handle virtual_insert(const Point & a, - Face_handle start = Face_handle()); - virtual Vertex_handle virtual_insert(const Point& a, - Locate_type lt, - Face_handle loc, - int li ); + Vertex_handle virtual_insert(const Point & a, + Face_handle start = Face_handle()) override; + Vertex_handle virtual_insert(const Point& a, + Locate_type lt, + Face_handle loc, + int li ) override; //Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i); void remove_2D(Vertex_handle v ); - virtual void triangulate_hole(List_faces& intersected_faces, - List_edges& conflict_boundary_ab, - List_edges& conflict_boundary_ba); + void triangulate_hole(List_faces& intersected_faces, + List_edges& conflict_boundary_ab, + List_edges& conflict_boundary_ba) override; public: // MESHING @@ -388,8 +395,8 @@ private: indices.push_back(index++); } - typedef typename Pointer_property_map::type Pmap; - typedef Spatial_sort_traits_adapter_2 Search_traits; + using Pmap = typename Pointer_property_map::type; + using Search_traits = Spatial_sort_traits_adapter_2; spatial_sort(indices.begin(), indices.end(), @@ -604,6 +611,9 @@ public: Face_handle ni, f,ff; Edge ei,eni; + using Less_edge = internal::Cdt_2_less_edge; + using Edge_set = boost::container::flat_set; + Less_edge less_edge(this); Edge_set edge_set(less_edge); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 91d01e3e042..eb71d1223d6 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -51,7 +51,7 @@ struct CGAL_DEPRECATED No_intersection_tag : namespace internal { -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#if defined(CGAL_CDT_2_DEBUG_INTERSECTIONS) || defined(CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2) struct Indentation_level { int n; Indentation_level() : n(0) {} @@ -68,7 +68,7 @@ namespace internal { }; Exit_guard open_new_scope() { return Exit_guard(*this); } } cdt_2_indent_level; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS || CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 template struct Itag { @@ -738,7 +738,7 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) int i; if(this->is_edge(vp.first, vp.second, fh,i)){ fh->set_constraint(i,true); - boost::tie(fh,i) = mirror_edge(Edge(fh,i)); + std::tie(fh,i) = mirror_edge(Edge(fh,i)); fh->set_constraint(i,true); } } @@ -815,7 +815,7 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb) internal::Indentation_level::Exit_guard exit_guard = CGAL::internal::cdt_2_indent_level.open_new_scope(); #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS while(! stack.empty()){ - boost::tie(vaa,vbb) = stack.top(); + std::tie(vaa,vbb) = stack.top(); stack.pop(); CGAL_precondition( vaa != vbb); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index 10cdecc984f..1e0c27333ab 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -22,34 +22,44 @@ #include #include #include -#include #include #include #include +#include #include +#include namespace CGAL { // Comparison functor that compares two Vertex_handle. // Used as 'Compare' functor for the constraint hierarchy. template < class Tr > -class Pct2_vertex_handle_less_xy { +class Ctp_2_compare_vertex_handles { const Tr* tr_p; public: - Pct2_vertex_handle_less_xy(const Tr* tr_p) : tr_p(tr_p) {} + Ctp_2_compare_vertex_handles(const Tr* tr_p) : tr_p(tr_p) {} - typedef typename Tr::Vertex_handle Vertex_handle; + using Vertex_handle = typename Tr::Vertex_handle; bool operator()(const Vertex_handle& va, const Vertex_handle& vb) const { return tr_p->compare_xy(va->point(), vb->point()) == SMALLER; } -}; // end class template Pct2_vertex_handle_less_xy +}; // end class template Ctp_2_compare_vertex_handles + +template +using Ctp_2_point_type = typename Tr::Geom_traits::Point_2; + +template +using Ctp_2_hierarchy_type = + Polyline_constraint_hierarchy_2, + Ctp_2_point_type>; // Tr the base triangulation class // Tr has to be Constrained or Constrained_Delaunay with Constrained_triangulation_plus_vertex_base @@ -57,42 +67,45 @@ public: template < class Tr_> class Constrained_triangulation_plus_2 : public Tr_ + , protected Ctp_2_hierarchy_type { - typedef Tr_ Tr; +public: + using Self = Constrained_triangulation_plus_2; + using Base = Tr_; + using Constraint_hierarchy = Ctp_2_hierarchy_type; +protected: + const auto& hierarchy() const { return static_cast(*this); } + auto& hierarchy() { return static_cast(*this); } + +private: + using Tr = Tr_; template class Face_container { - typedef typename CDT::Vertex_handle Vertex_handle; - typedef typename CDT::Face_handle Face_handle; - private: - typedef boost::tuple TFace; - std::vector faces; + using Vertex_handle = typename CDT::Vertex_handle; + using Face_handle = typename CDT::Face_handle; + + using Array = std::array; + std::vector faces; CDT& cdt; public: - typedef Face_handle value_type; - typedef Face_handle& reference; - typedef const Face_handle& const_reference; - + using value_type = Face_handle; Face_container(CDT& cdt_ ) : cdt(cdt_) {} - void push_back(Face_handle fh) - { - faces.push_back(boost::make_tuple(fh->vertex(0), - fh->vertex(1), - fh->vertex(2))); + void push_back(Face_handle fh) { + faces.push_back(Array{fh->vertex(0), fh->vertex(1), fh->vertex(2)}); } template void write_faces(OutputIterator out) { - for(typename std::vector::reverse_iterator - it = faces.rbegin(); it != faces.rend(); ++it) { + for(auto [v0, v1, v2] : make_range(faces.rbegin(), faces.rend())) { Face_handle fh; - if(cdt.is_face(boost::get<0>(*it), boost::get<1>(*it), boost::get<2>(*it), fh)){ + if(cdt.is_face(v0, v1, v2, fh)) { *out++ = fh; } } @@ -100,108 +113,101 @@ class Constrained_triangulation_plus_2 }; public: - typedef Tr Triangulation; - typedef typename Tr::Intersection_tag Intersection_tag; - typedef Constrained_triangulation_plus_2 Self; - typedef Tr Base; + // type aliases (aka type defs) + using Triangulation = Tr; + using Intersection_tag = typename Tr::Intersection_tag; - -#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 + // using-declarations of types or member functions from the two bases using Triangulation::vertices_begin; using Triangulation::vertices_end; using Triangulation::is_infinite; using Triangulation::number_of_vertices; + + using typename Triangulation::Edge; + using typename Triangulation::Vertex; +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1920) + using Vertex_handle = typename Triangulation::Vertex_handle; // workaround for VC++ 19.16 (from MSVC 2017) +#else + using typename Triangulation::Vertex_handle; #endif + using typename Triangulation::Face_handle; + using typename Triangulation::Face_circulator; + using typename Triangulation::Vertex_iterator; + using typename Triangulation::Vertex_circulator; + using typename Triangulation::Locate_type; + using typename Triangulation::Line_face_circulator; + using typename Triangulation::Geom_traits; + using typename Triangulation::Constraint; + using typename Triangulation::size_type; + using typename Triangulation::List_edges; + using typename Triangulation::List_faces; + using typename Triangulation::List_vertices; + using typename Triangulation::List_constraints; + using typename Triangulation::Constrained_edges_iterator; + + using typename Constraint_hierarchy::Context; + using typename Constraint_hierarchy::Context_iterator; + using typename Constraint_hierarchy::Contexts; + using typename Constraint_hierarchy::Constraint_iterator; + using typename Constraint_hierarchy::Constraints; + using typename Constraint_hierarchy::Subconstraint_iterator; + using typename Constraint_hierarchy::Subconstraints; + using typename Constraint_hierarchy::Subconstraint_and_contexts_iterator; + using typename Constraint_hierarchy::Subconstraints_and_contexts; + using typename Constraint_hierarchy::Constraint_id; + using typename Constraint_hierarchy::Vertex_handle_compare; + #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS using Triangulation::display_vertex; #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typedef typename Triangulation::Edge Edge; - typedef typename Triangulation::Vertex Vertex; - typedef typename Triangulation::Vertex_handle Vertex_handle; - typedef typename Triangulation::Face_handle Face_handle; - typedef typename Triangulation::Face_circulator Face_circulator ; - typedef typename Triangulation::Vertex_iterator Vertex_iterator; - typedef typename Triangulation::Vertex_circulator Vertex_circulator; - typedef typename Triangulation::Locate_type Locate_type; - typedef typename Triangulation::Line_face_circulator Line_face_circulator; - typedef typename Triangulation::Geom_traits Geom_traits; - typedef typename Geom_traits::Point_2 Point; - typedef typename Geom_traits::Segment_2 Segment; - typedef typename Triangulation::Constraint Constraint; - typedef typename Triangulation::size_type size_type; + using Point = typename Triangulation::Geom_traits::Point_2; + using Segment = typename Triangulation::Geom_traits::Segment_2; - typedef typename Triangulation::List_edges List_edges; - typedef typename Triangulation::List_faces List_faces; - typedef typename Triangulation::List_vertices List_vertices; - typedef typename Triangulation::List_constraints List_constraints; - typedef typename Triangulation::Constrained_edges_iterator Constrained_edges_iterator; - - typedef Pct2_vertex_handle_less_xy Vh_less_xy; - typedef Polyline_constraint_hierarchy_2 - Constraint_hierarchy; -public: // Tag to mark the presence of a hierarchy of constraints - typedef Tag_true Constraint_hierarchy_tag; + using Constraint_hierarchy_tag = Tag_true; //Tag to distinguish Delaunay from regular triangulations - typedef Tag_false Weighted_tag; + using Weighted_tag = Tag_false; // Tag to distinguish periodic triangulations from others - typedef Tag_false Periodic_tag; + using Periodic_tag = Tag_false; // for user interface with the constraint hierarchy - typedef typename Constraint_hierarchy::Vertex_it - Vertices_in_constraint_iterator; + using Vertices_in_constraint_iterator = typename Constraint_hierarchy::Vertex_it; - typedef Iterator_range Vertices_in_constraint; + using Vertices_in_constraint = Iterator_range; - typedef typename Constraint_hierarchy::Point_it - Points_in_constraint_iterator; - typedef Iterator_range Points_in_constraint; + using Points_in_constraint_iterator = typename Constraint_hierarchy::Point_it; + using Points_in_constraint = Iterator_range; - typedef typename Constraint_hierarchy::Context Context; - typedef typename Constraint_hierarchy::Context_iterator Context_iterator; - typedef Iterator_range Contexts; - typedef typename Constraint_hierarchy::C_iterator Constraint_iterator; - typedef Iterator_range Constraints; - - typedef typename Constraint_hierarchy::Subconstraint_iterator Subconstraint_iterator; - typedef Iterator_range Subconstraints; - - typedef typename Constraint_hierarchy::Constraint_id Constraint_id; - - typedef std::pair Subconstraint; + using Subconstraint = std::pair; using Triangulation::geom_traits; using Triangulation::cw; using Triangulation::ccw; using Triangulation::incident_faces; -protected: - Constraint_hierarchy hierarchy; - public: Constraint_hierarchy& hierarchy_ref() { - return hierarchy; + return *this; } Constrained_triangulation_plus_2(const Geom_traits& gt=Geom_traits()) : Triangulation(gt) - , hierarchy(Vh_less_xy(this)) + , Constraint_hierarchy(Vertex_handle_compare(this)) { } Constrained_triangulation_plus_2(const Constrained_triangulation_plus_2& ctp) - : Triangulation() - , hierarchy(Vh_less_xy(this)) + : Constrained_triangulation_plus_2(ctp.geom_traits()) { copy_triangulation(ctp);} Constrained_triangulation_plus_2(Constrained_triangulation_plus_2&&) = default; - virtual ~Constrained_triangulation_plus_2() {} + ~Constrained_triangulation_plus_2() override {} Constrained_triangulation_plus_2 & operator=(const Constrained_triangulation_plus_2& ctp) { @@ -215,8 +221,7 @@ public: Constrained_triangulation_plus_2(InputIterator first, InputIterator last, const Geom_traits& gt=Geom_traits() ) - : Triangulation(gt) - , hierarchy(Vh_less_xy(this)) + : Constrained_triangulation_plus_2(gt) { insert_constraints(first, last); CGAL_postcondition( this->is_valid() ); @@ -225,14 +230,13 @@ public: Constrained_triangulation_plus_2(const std::list > &constraints, const Geom_traits& gt=Geom_traits() ) - : Triangulation(gt) - , hierarchy(Vh_less_xy(this)) + : Constrained_triangulation_plus_2(gt) { insert_constraints(constraints.begin(), constraints.end()); CGAL_postcondition( this->is_valid() ); } //Helping - void clear() { Base::clear(); hierarchy.clear(); } + void clear() { Base::clear(); hierarchy().clear(); } void copy_triangulation(const Constrained_triangulation_plus_2 &ctp); void swap(Constrained_triangulation_plus_2 &ctp); @@ -271,7 +275,7 @@ public: return Constraint_id(nullptr); } // protects against inserting twice the same constraint - Constraint_id cid = hierarchy.insert_constraint_old_API(va, vb); + Constraint_id cid = hierarchy().insert_constraint_old_API(va, vb); if (va != vb && (cid != Constraint_id(nullptr)) ) insert_subconstraint(va,vb); return cid; @@ -375,68 +379,82 @@ public: } + + // Removes pos from the constraint cid. + // Returns the iterator to vertex that was just after pos (or end()) + // Writes the modified faces to out template Vertices_in_constraint_iterator remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, OutputIterator out) { if(pos == vertices_in_constraint_begin(cid)){ - ++pos; - Constraint_id aux = hierarchy.split2(cid,pos); + // cid is [P, A, ..., B] -> split to aux=[P, A] and cid=[A...B] + Constraint_id aux = hierarchy().split_head(cid, std::next(pos)); remove_constraint(aux, out); - return pos; + return vertices_in_constraint_begin(cid); } - Vertices_in_constraint_iterator it = vertices_in_constraint_end(cid); - it--; - if(pos == it){ - --pos; - Constraint_id aux = hierarchy.split(cid, pos); + if(pos == std::prev(vertices_in_constraint_end(cid))){ + // cid is [A, ..., B, P] -> split to cid=[A...B] and aux=[B,P] + Constraint_id aux = hierarchy().split_tail(cid, std::prev(pos)); remove_constraint(aux, out); return vertices_in_constraint_end(cid); } - Vertices_in_constraint_iterator pp = pos; - --pp; - Vertex_handle a = *pp; - pp = pos; - ++pp; - Vertex_handle b = *pp; - --it; - Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid); - ++beg; - Face_container fc(*this); + const auto second_vertex_of_cid = std::next(vertices_in_constraint_begin(cid)); + const auto next_to_last_vertex_of_cid = std::prev(vertices_in_constraint_end(cid), 2); Constraint_id head = nullptr, tail = nullptr; - if(pos != beg){ + if(pos != second_vertex_of_cid){ + // cid is [A, ..., B, P, C, ..., D] + // split to: + // head = [A...B] and, + // cid = [B, P, C...D] // split off head - --pos; - head = hierarchy.split2(cid, pos); - ++pos; + head = hierarchy().split_head(cid, std::prev(pos)); } - if(pos != it){ + if(pos != next_to_last_vertex_of_cid){ + // cid is now [B, P, C, ..., D] + // split to: + // cid = [B, P, C] and, + // tail = [C...D] // split off tail - ++pos; - tail = hierarchy.split(cid,pos); + tail = hierarchy().split_tail(cid,std::next(pos)); } - Constraint_id aux = insert_constraint(a, b, std::back_inserter(fc)); - pos = vertices_in_constraint_end(aux); - --pos; - --pos; // this is not necessarily == vertices_in_constraint_begin(aux); - hierarchy.swap(cid, aux); - remove_constraint(aux, std::back_inserter(fc)); + // now: + // cid is [B, P, C] + // head is null or [A...B] + // tail is null or [C...D] + // Let create insert [C,D] and conditionally concatenate head and tail, + // and return the iterator to C - if(head.vl_ptr()){ - hierarchy.concatenate2(head, cid); + Vertex_handle b = *std::prev(pos); + Vertex_handle c = *std::next(pos); + + Face_container fc(*this); + Constraint_id bc = insert_constraint(b, c, std::back_inserter(fc)); + + auto pos_before_c = std::prev(vertices_in_constraint_end(bc), 2); + // `pos_before_c` is not necessarily == vertices_in_constraint_begin(bc) + // there might have been intersecting constraints + + hierarchy().swap(cid, bc); + remove_constraint(bc, std::back_inserter(fc)); // removes [B, P, C] + // now cid is [B, C] + + if(head != nullptr){ + hierarchy().prepend(std::move(head), cid); } - if(tail.vl_ptr()){ - hierarchy.concatenate(cid, tail); + if(tail != nullptr){ + hierarchy().concatenate(cid, std::move(tail)); } fc.write_faces(out); - ++pos; // we went one too far back because the last vertex gets removed by concatenate - return pos; + + // we went one too far back because the last vertex `c` gets removed by concatenate/prepend + return std::next(pos_before_c); } // Inserts vh before pos @@ -445,91 +463,101 @@ public: template Vertices_in_constraint_iterator insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, - Vertex_handle vh, OutputIterator out) + Vertex_handle v, OutputIterator out) { // Insertion before the first vertex if(pos == vertices_in_constraint_begin(cid)){ //std::cout << "insertion before first vertex" << std::endl; - Constraint_id head = insert_constraint(vh, *pos, out); - hierarchy.concatenate2(head, cid); + Constraint_id head = insert_constraint(v, *pos, out); + hierarchy().prepend(std::move(head), cid); return vertices_in_constraint_begin(cid); } // Insertion after the last vertex if(pos == vertices_in_constraint_end(cid)){ //std::cout << "insertion after last vertex" << std::endl; - pos--; - Constraint_id tail = insert_constraint(*pos, vh, out); - pos = vertices_in_constraint_end(tail); - --pos; - hierarchy.concatenate(cid, tail); - return pos; + Constraint_id tail = insert_constraint(*std::prev(pos), v, out); + auto new_pos = std::prev(vertices_in_constraint_end(tail)); + hierarchy().concatenate(cid, std::move(tail)); + CGAL_assertion(v == *new_pos); + return new_pos; } + Vertices_in_constraint_iterator pred = std::prev(pos); + Vertices_in_constraint_iterator latest_vertex = std::prev(vertices_in_constraint_end(cid)); + Vertex_handle a = *pred; Vertex_handle b = *pos; - --pos; - Vertex_handle a = *pos; - ++pos; - Face_container fc(*this); - Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid), vcit; - ++beg; - vcit = beg; - ++beg; - // If the constraint consists only of a segment, and we want to insert - // in the middle - if((pos == vcit) && (beg == vertices_in_constraint_end(cid))){ - //std::cout << "insertion in constraint which is a segment" << std::endl; - Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc)); - Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc)); - pos = vertices_in_constraint_begin(aux2); - concatenate(aux1, aux2); - hierarchy.swap(cid, aux1); - remove_constraint(aux1, std::back_inserter(fc)); - fc.write_faces(out); + if(v == a || v == b){ return pos; - } + + // cid is [..., A, B, ...] and V=*v will be inserted between A and B + + Face_container fc(*this); + Constraint_id a_v_b = insert_constraint(a, v, std::back_inserter(fc)); + Constraint_id aux = insert_constraint(v, b, std::back_inserter(fc)); + auto new_pos = vertices_in_constraint_begin(aux); + concatenate(a_v_b, std::move(aux)); + + // here: + // a_v_b is [A,.. V,.. B] + // aux is empty + // and new_pos is the iterator to V + CGAL_assertion(v == *new_pos); + + CGAL_assertion(std::distance(vertices_in_constraint_begin(a_v_b), new_pos) > 0 && + std::distance(new_pos, vertices_in_constraint_end(a_v_b)) > 0); + // new_pos still points to something in a_v_b. In general a_v_b should only have three vertices, + // but there might have been intersectiong constraints or vertices. + + const auto second_vertex_of_cid = std::next(vertices_in_constraint_begin(cid)); + // If the constraint consists only of a segment, and we want to insert + // in the middle: cid is just the segment [A, B] + if((pos == second_vertex_of_cid) && (second_vertex_of_cid == latest_vertex)){ + //std::cout << "insertion in constraint which is a segment" << std::endl; + hierarchy().swap(cid, a_v_b); + remove_constraint(a_v_b, std::back_inserter(fc)); + fc.write_faces(out); + return new_pos; + } + Constraint_id head = nullptr, tail = nullptr; - Vertices_in_constraint_iterator bit = vertices_in_constraint_begin(cid); - Vertices_in_constraint_iterator pred = pos; - --pred; - ++bit; - if(pos != bit){ + if(pos != second_vertex_of_cid){ //std::cout << "split head" << std::endl; - head = split(cid, pred); - std::swap(head,cid); // split2 does the job + head = hierarchy().split_head(cid, pred); pred = vertices_in_constraint_begin(cid); - pos = pred; - ++pos; + pos = std::next(pred); } - Vertices_in_constraint_iterator eit = vertices_in_constraint_end(cid); - --eit; - if(pos != eit){ + // head is now [..., A] or null + // cid is now [A, B, ...] + CGAL_assertion(*pred == a); + CGAL_assertion(*pos == b); + if(pos != latest_vertex){ //std::cout << "split tail" << std::endl; - tail = split(cid, pos); + tail = hierarchy().split_tail(cid, pos); } + // head is now [..., A] or null + // cid is now [A, B] + // tail is now [B, ...] or null - // make the new constraint - Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc)); - Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc)); - pos = vertices_in_constraint_begin(aux2); - concatenate(aux1, aux2); - - if(head.vl_ptr()){ + if(head != nullptr){ //std::cout << "concatenate head" << std::endl; - remove_constraint(cid, std::back_inserter(fc)); - hierarchy.concatenate(head, aux1); + hierarchy().concatenate(head, std::move(a_v_b)); + hierarchy().swap(cid, head); + remove_constraint(head, std::back_inserter(fc)); } else { - hierarchy.swap(cid, aux1); - remove_constraint(aux1, std::back_inserter(fc)); - head = cid; + hierarchy().swap(cid, a_v_b); + remove_constraint(a_v_b, std::back_inserter(fc)); } + // cid is now [..., A, V, B] + // head is now null empty + // a_v_b is now empty - if(tail.vl_ptr()){ + if(tail != nullptr){ //std::cout << "concatenate tail" << std::endl; - concatenate(head, tail); + concatenate(cid, std::move(tail)); } fc.write_faces(out); - return pos; + return new_pos; } template < class InputIterator, class OutputIterator> @@ -550,19 +578,17 @@ public: if(n == 1){ return nullptr; } - Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]); + Constraint_id ca = hierarchy().insert_constraint(vertices[0],vertices[1]); insert_subconstraint(vertices[0],vertices[1], std::back_inserter(fc)); if(n>2){ for(int j=1; jfixed() = true; // Vertices_in_constraint_iterator end = std::prev(vertices_in_constraint_end(ca)); @@ -593,16 +619,16 @@ private: std::size_t n = vertices.size(); if(n == 1){ - return nullptr; + return Constraint_id{}; } CGAL_assertion(n >= 2); - Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]); + Constraint_id ca = hierarchy().insert_constraint(vertices[0],vertices[1]); insert_subconstraint(vertices[0],vertices[1]); if(n>2){ for(std::size_t j=1; j(*this); Unique_hash_map V(0, number_of_vertices()); int inum = 0; - for(Vertex_iterator vit = vertices_begin(); vit != vertices_end() ; ++vit){ - if(! is_infinite(vit)){ - V[vit] = inum++; + for(auto vh : this->finite_vertex_handles()) { + V[vh] = inum++; + } + for(auto cid : constraints()) { + os << cid.size(); + for(Vertex_handle vh : vertices_in_constraint(cid)) { + os << " " << V[vh]; } + os << std::endl; } - - for(Constraint_iterator cit = constraints_begin(); cit != constraints_end(); ++cit){ - os << (*cit).second->all_size(); - for(Vertex_handle vh : vertices_in_constraint(*cit)){ - os << " " << V[vh]; - } - os << std::endl; - } + return os; } + friend std::ostream& operator<<(std::ostream& os, const Constrained_triangulation_plus_2& ctp) { + return ctp.file_output(os); + } - void file_input(std::istream& is) - { - + auto& file_input(std::istream& is) { is >> static_cast(*this); - std::vector V; - V.reserve(number_of_vertices()); - for(Vertex_iterator vit = vertices_begin(); vit != vertices_end() ; ++vit){ - if(! is_infinite(vit)){ - V.push_back(vit); - } - } - Constraint_id cid; - int n, i0, i1; - while(is >> n){ - is >> i0 >> i1; - cid = insert_constraint(V[i0],V[i1]); + std::vector vertices(number_of_vertices()); + auto [first, last] = this->finite_vertex_handles(); + std::copy(first, last, vertices.data()); - for(int i = 2; i < n; i++){ - i0 = i1; - is >> i1; - Constraint_id cid2 = insert_constraint(V[i0],V[i1]); - cid = concatenate(cid, cid2); + size_type n, id, id_next; + while(is >> n) { + is >> id >> id_next; + Constraint_id cid = insert_constraint(vertices[id], vertices[id_next]); + + for(size_type i = 2; i < n; ++i) { + id = id_next; + is >> id_next; + Constraint_id cid2 = insert_constraint(vertices[id], vertices[id_next]); + cid = concatenate(cid, std::move(cid2)); } } + return is; } + friend std::istream& operator>>(std::istream& is, Constrained_triangulation_plus_2& ctp) { + return ctp.file_input(is); + } template typename Constrained_triangulation_plus_2::Constraint_id @@ -672,23 +695,21 @@ public: { // protects against inserting a zero length constraint if(va == vb){ - return Constraint_id(nullptr); + return Constraint_id(); } // protects against inserting twice the same constraint - Constraint_id cid = hierarchy.insert_constraint(va, vb); + Constraint_id cid = hierarchy().insert_constraint(va, vb); if (va != vb && (cid != nullptr) ) insert_subconstraint(va,vb,out); - for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(cid); - vcit != vertices_in_constraint_end(cid); - vcit++){ - insert_incident_faces(vcit, out); + for(auto vh : vertices_in_constraint(cid)) { + out = insert_incident_faces(vh, out); } return cid; } - virtual Vertex_handle intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb); + Vertex_handle intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb) override; Vertex_handle intersect(Face_handle f, int i, Vertex_handle vaa, Vertex_handle vbb, @@ -711,19 +732,16 @@ public: template void remove_constraint(Constraint_id cid, OutputIterator out) { - std::list vertices(hierarchy.vertices_in_constraint_begin(cid), - hierarchy.vertices_in_constraint_end(cid)); + std::vector vertices(hierarchy().vertices_in_constraint_begin(cid), + hierarchy().vertices_in_constraint_end(cid)); - hierarchy.remove_constraint(cid); - for(typename std::list::iterator it = vertices.begin(), - succ = it; - ++succ != vertices.end(); - ++it){ + hierarchy().remove_constraint(cid); + for(auto it = vertices.begin(), succ = it; ++succ != vertices.end(); ++it){ if(! is_subconstraint(*it, *succ)){ // this checks whether other constraints pass Face_handle fh; - int i; - bool b = Triangulation::is_edge(*it, *succ, fh, i); - CGAL_assume(b); + int i = -1; + Triangulation::is_edge(*it, *succ, fh, i); + CGAL_assertion(i != -1); Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary. } } @@ -739,7 +757,7 @@ public: Vertices_in_constraint_iterator u = std::prev(v); Vertices_in_constraint_iterator w = std::next(v); bool unew = (*u != *w); - hierarchy.simplify(u,v,w); + hierarchy().simplify(u,v,w); Triangulation::remove_incident_constraints(*v); @@ -750,112 +768,73 @@ public: } } - std::size_t remove_points_without_corresponding_vertex(Constraint_id cid) - { - return hierarchy.remove_points_without_corresponding_vertex(cid); - } - std::size_t remove_points_without_corresponding_vertex() - { - return hierarchy.remove_points_without_corresponding_vertex(); - } - + using Constraint_hierarchy::remove_points_without_corresponding_vertex; // CONCATENATE AND SPLIT // concatenates two constraints - Constraint_id - concatenate(Constraint_id first, Constraint_id second); + using Constraint_hierarchy::concatenate; // split a constraint in two constraints, so that vcit becomes the first // vertex of the new constraint // returns the new constraint Constraint_id - split(Constraint_id first, Vertices_in_constraint_iterator vcit); + split(Constraint_id first, Vertices_in_constraint_iterator vcit) { + return hierarchy().split_tail(first, vcit); + } // Query of the constraint hierarchy - Constraint_iterator constraints_begin() const; - Constraint_iterator constraints_end() const; - Constraints constraints() const - { - return Constraints(constraints_begin(),constraints_end()); - } - Subconstraint_iterator subconstraints_begin() const; - Subconstraint_iterator subconstraints_end() const; - - Subconstraints subconstraints() const - { - return Subconstraints(subconstraints_begin(),subconstraints_end()); - } - - Context context(Vertex_handle va, Vertex_handle vb); //AF: const; - - bool is_subconstraint(Vertex_handle va, - Vertex_handle vb); - size_type number_of_enclosing_constraints(Vertex_handle va, - Vertex_handle vb) const; - Context_iterator contexts_begin(Vertex_handle va, - Vertex_handle vb) const; - Context_iterator contexts_end(Vertex_handle va, - Vertex_handle vb) const; - - Contexts contexts(Vertex_handle va, Vertex_handle vb) const - { - return Contexts(contexts_begin(va,vb),contexts_end(va,vb)); - } - - Vertices_in_constraint_iterator vertices_in_constraint_begin(Constraint_id cid) const; - Vertices_in_constraint_iterator vertices_in_constraint_end(Constraint_id cid) const; - - Vertices_in_constraint vertices_in_constraint(Constraint_id cid) const - { - return Vertices_in_constraint(vertices_in_constraint_begin(cid), vertices_in_constraint_end(cid)); - } - - Points_in_constraint_iterator points_in_constraint_begin(Constraint_id cid) const; - Points_in_constraint_iterator points_in_constraint_end(Constraint_id cid) const ; + using Constraint_hierarchy::constraints_begin; + using Constraint_hierarchy::constraints_end; + using Constraint_hierarchy::constraints; + using Constraint_hierarchy::subconstraints_begin; + using Constraint_hierarchy::subconstraints_end; + using Constraint_hierarchy::subconstraints; + using Constraint_hierarchy::subconstraints_and_contexts_begin; + using Constraint_hierarchy::subconstraints_and_contexts_end; + using Constraint_hierarchy::subconstraints_and_contexts; + using Constraint_hierarchy::context; + using Constraint_hierarchy::number_of_enclosing_constraints; + using Constraint_hierarchy::is_subconstraint; + using Constraint_hierarchy::contexts_begin; + using Constraint_hierarchy::contexts_end; + using Constraint_hierarchy::contexts; + using Constraint_hierarchy::vertices_in_constraint_begin; + using Constraint_hierarchy::vertices_in_constraint_end; + using Constraint_hierarchy::vertices_in_constraint; + using Constraint_hierarchy::points_in_constraint_begin; + using Constraint_hierarchy::points_in_constraint_end; Points_in_constraint points_in_constraint(Constraint_id cid) const { return Points_in_constraint(points_in_constraint_begin(cid), points_in_constraint_end(cid)); } - size_type number_of_constraints() { - return static_cast (hierarchy.number_of_constraints());} - size_type number_of_subconstraints(){ - return static_cast (hierarchy.number_of_subconstraints());} - - // public member, used by Mesh_2::Refine_edges - void split_constraint(Vertex_handle v1, Vertex_handle v2, - Vertex_handle va) { - hierarchy.split_constraint(v1,v2,va); - } + using Constraint_hierarchy::number_of_constraints; + using Constraint_hierarchy::number_of_subconstraints; + using Constraint_hierarchy::split_constraint; protected: template - void insert_incident_faces(Vertices_in_constraint_iterator vcit, OutputItertator out) + OutputItertator insert_incident_faces(Vertex_handle vh, OutputItertator out) { - Vertex_handle vh = *vcit; Face_circulator fc = incident_faces(vh), done = fc; - Face_circulator null ; - if ( fc != null ) - { + if(fc != nullptr) { do { Face_handle fh = fc; - out = fh; - out++; - fc++; - }while(fc != done); + *out++ = fh; + } while(++fc != done); } + return out; } - void insert_subconstraint(Vertex_handle vaa, Vertex_handle vbb) - { - insert_subconstraint(vaa,vbb,Emptyset_iterator()); - } +{ + insert_subconstraint(vaa,vbb,Emptyset_iterator()); +} @@ -883,7 +862,7 @@ insert_subconstraint(Vertex_handle vaa, stack.push(std::make_pair(vaa,vbb)); while(! stack.empty()){ - boost::tie(vaa,vbb) = stack.top(); + auto [vaa, vbb] = stack.top(); stack.pop(); CGAL_precondition( vaa != vbb); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS @@ -909,7 +888,7 @@ insert_subconstraint(Vertex_handle vaa, #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS this->mark_constraint(fr,i); if (vi != vbb) { - hierarchy.split_constraint(vaa,vbb,vi); + hierarchy().split_constraint(vaa,vbb,vi); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS std::cerr << CGAL::internal::cdt_2_indent_level << "CT_plus_2::insert_constraint (includes_edge) stack push [vi, vbb] ( " << display_vertex(vi) @@ -933,7 +912,7 @@ insert_subconstraint(Vertex_handle vaa, if ( intersection) { if (vi != vaa && vi != vbb) { - hierarchy.split_constraint(vaa,vbb,vi); + hierarchy().split_constraint(vaa,vbb,vi); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS std::cerr << CGAL::internal::cdt_2_indent_level << "CT_plus_2::insert_constraint stack push [vaa, vi] ( " << display_vertex(vaa) @@ -990,7 +969,7 @@ insert_subconstraint(Vertex_handle vaa, out); if (vi != vbb) { - hierarchy.split_constraint(vaa,vbb,vi); + hierarchy().split_constraint(vaa,vbb,vi); stack.push(std::make_pair(vi,vbb)); } } @@ -1000,7 +979,7 @@ insert_subconstraint(Vertex_handle vaa, //to debug public: - void print_hierarchy() { hierarchy.print(); } + void print_hierarchy(std::ostream& os = std::cout) { hierarchy().print(os); } //template member functions public: @@ -1045,7 +1024,7 @@ copy_triangulation(const Constrained_triangulation_plus_2 &ctp) CGAL_assertion(vit->point() == vvit->point()); vmap[vit] = vvit; } - hierarchy.copy(ctp.hierarchy, vmap); + hierarchy().copy(ctp.hierarchy(), vmap); } template @@ -1054,7 +1033,7 @@ Constrained_triangulation_plus_2:: swap(Constrained_triangulation_plus_2 &ctp) { Base::swap(ctp); - hierarchy.swap(ctp.hierarchy); + hierarchy().swap(ctp.hierarchy()); } template < class Tr > @@ -1098,7 +1077,7 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) << " , #" << v2->time_stamp() << "= " << v2->point() << std::endl; #endif - hierarchy.split_constraint(v1,v2,va); + hierarchy().split_constraint(v1,v2,va); } return va; } @@ -1150,16 +1129,12 @@ intersect(Face_handle f, int i, // (the constraint edge (f,i) will be split in hierarchy by insert) // and return the Vertex_handle of the new Vertex { - Vertex_handle vc, vd, va, vb; - Vertex_handle vcc, vdd; - vcc = f->vertex(cw(i)); - vdd = f->vertex(ccw(i)); - CGAL_assertion_code( bool b1 = ) - hierarchy.enclosing_constraint(vcc,vdd,vc,vd); - CGAL_assertion_code( bool b2 = ) - hierarchy.enclosing_constraint(vaa,vbb,va,vb); - CGAL_assertion(b1); - CGAL_assertion(b2); + const Vertex_handle vcc = f->vertex(cw(i)); + const Vertex_handle vdd = f->vertex(ccw(i)); + const auto [vc, vd] = hierarchy().enclosing_constraint(vcc, vdd); + const auto [va, vb] = hierarchy().enclosing_constraint(vaa, vbb); + CGAL_assertion(vc != vd); + CGAL_assertion(va != vb); const Point& pa = va->point(); const Point& pb = vb->point(); @@ -1220,7 +1195,7 @@ intersect(Face_handle f, int i, // vi == vc or vi == vd may happen even if intersection==true // due to approximate construction of the intersection if (vi != vcc && vi != vdd) { - hierarchy.split_constraint(vcc,vdd,vi); + hierarchy().split_constraint(vcc,vdd,vi); insert_subconstraint(vcc,vi); insert_subconstraint(vi, vdd); } @@ -1230,171 +1205,6 @@ intersect(Face_handle f, int i, return vi; } - // CONCATENATE AND SPLIT - - // concatenates two constraints -template -typename Constrained_triangulation_plus_2::Constraint_id -Constrained_triangulation_plus_2::concatenate(Constraint_id first, Constraint_id second) -{ - return hierarchy.concatenate(first,second); -} - - // split a constraint in two constraints, so that vcit becomes the first - // vertex of the new constraint - // returns the new constraint -template -typename Constrained_triangulation_plus_2::Constraint_id -Constrained_triangulation_plus_2::split(Constraint_id first, Vertices_in_constraint_iterator vcit) -{ - return hierarchy.split(first, vcit); -} - - -template -std::ostream & -operator<<(std::ostream& os, - const Constrained_triangulation_plus_2 &ct) -{ - ct.file_output(os); - return os ; -} - -template -std::istream & -operator>>(std::istream& is, - Constrained_triangulation_plus_2 &ct) -{ - ct.file_input(is); - return is ; -} - -// Constraint Hierarchy Queries - -template -inline -typename -Constrained_triangulation_plus_2::Constraint_iterator -Constrained_triangulation_plus_2:: -constraints_begin() const -{ - return hierarchy.c_begin(); -} - -template -inline -typename -Constrained_triangulation_plus_2::Constraint_iterator -Constrained_triangulation_plus_2:: -constraints_end() const -{ - return hierarchy.c_end(); -} - -template -inline -typename -Constrained_triangulation_plus_2::Subconstraint_iterator -Constrained_triangulation_plus_2:: -subconstraints_begin() const -{ - return hierarchy.subconstraint_begin(); -} - -template -inline -typename -Constrained_triangulation_plus_2::Subconstraint_iterator -Constrained_triangulation_plus_2:: -subconstraints_end() const -{ - return hierarchy.subconstraint_end(); -} - - -template -inline -typename Constrained_triangulation_plus_2::Context -Constrained_triangulation_plus_2:: -context(Vertex_handle va, Vertex_handle vb) // AF: const -{ - return hierarchy.context(va,vb); -} - - -template -inline -typename Constrained_triangulation_plus_2::size_type -Constrained_triangulation_plus_2:: -number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const -{ - return static_cast - (hierarchy.number_of_enclosing_constraints(va,vb)); -} - -template -inline bool -Constrained_triangulation_plus_2:: -is_subconstraint(Vertex_handle va, Vertex_handle vb) -{ - return hierarchy.is_subconstrained_edge(va,vb); -} - - -template -inline -typename Constrained_triangulation_plus_2::Context_iterator -Constrained_triangulation_plus_2:: -contexts_begin(Vertex_handle va, Vertex_handle vb) const -{ - return hierarchy.contexts_begin(va,vb); -} - -template -inline -typename Constrained_triangulation_plus_2::Context_iterator -Constrained_triangulation_plus_2:: -contexts_end(Vertex_handle va, Vertex_handle vb) const -{ - return hierarchy.contexts_end(va,vb); -} - -template -inline -typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator -Constrained_triangulation_plus_2:: -vertices_in_constraint_begin(Constraint_id cid) const -{ - return hierarchy.vertices_in_constraint_begin(cid); -} - -template -inline -typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator -Constrained_triangulation_plus_2:: -vertices_in_constraint_end(Constraint_id cid) const -{ - return hierarchy.vertices_in_constraint_end(cid); -} - -template -inline -typename Constrained_triangulation_plus_2::Points_in_constraint_iterator -Constrained_triangulation_plus_2:: -points_in_constraint_begin(Constraint_id cid) const -{ - return hierarchy.points_in_constraint_begin(cid); -} - -template -inline -typename Constrained_triangulation_plus_2::Points_in_constraint_iterator -Constrained_triangulation_plus_2:: -points_in_constraint_end(Constraint_id cid) const -{ - return hierarchy.points_in_constraint_end(cid); -} - } //namespace CGAL #include diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h index 5eab13d4c1e..e1dbe61c614 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020 GeometryFactory (France). All rights reserved. +// Copyright (c) 2020,2025 GeometryFactory (France). All rights reserved. // // This file is part of CGAL (www.cgal.org) // @@ -17,8 +17,6 @@ #include #include -#include - namespace CGAL { @@ -30,90 +28,71 @@ class CTP2_subconstraint_graph { CTP2& ctp2; public: + using vertex_descriptor = typename CTP2::Vertex_handle; + using edge_descriptor = typename CTP2::Subconstraint; + using directed_category = boost::undirected_tag; + using edge_parallel_category = boost::disallow_parallel_edge_tag; + struct CTP2_graph_traversal_category : public virtual boost::bidirectional_graph_tag, + public virtual boost::adjacency_graph_tag, + public virtual boost::edge_list_graph_tag, + public virtual boost::vertex_list_graph_tag + {}; + using traversal_category = CTP2_graph_traversal_category; + using vertex_iterator = + internal::Dereference_to_handle_enforcer; - typedef typename CTP2::Vertex_handle vertex_descriptor; - typedef typename CTP2::Subconstraint edge_descriptor; - typedef boost::undirected_tag directed_category; - typedef boost::disallow_parallel_edge_tag edge_parallel_category; - struct CTP2_graph_traversal_category : - public virtual boost::bidirectional_graph_tag, - public virtual boost::adjacency_graph_tag, - public virtual boost::edge_list_graph_tag, - public virtual boost::vertex_list_graph_tag - { }; - typedef CTP2_graph_traversal_category traversal_category; - typedef internal::Dereference_to_handle_enforcer< - CTP2, - typename CTP2::Finite_vertices_iterator, - vertex_descriptor> vertex_iterator; + using edge_iterator = typename CTP2::Subconstraint_iterator; - typedef typename CTP2::Subconstraint_iterator::value_type Subconstr_it_v_t; - typedef First_of_pair_property_map Subconstr_map; - typedef Property_map_to_unary_function Subconstr_uf; - typedef boost::transform_iterator edge_iterator; + CTP2_subconstraint_graph(CTP2& ctp2) + : ctp2(ctp2) {} - CTP2_subconstraint_graph (CTP2& ctp2) : ctp2(ctp2) { } - - friend Iterator_range vertices (const CTP2_subconstraint_graph& g) - { - return make_range (vertex_iterator(g.ctp2.finite_vertices_begin()), - vertex_iterator(g.ctp2.finite_vertices_end())); + friend Iterator_range vertices(const CTP2_subconstraint_graph& g) { + return make_range(vertex_iterator(g.ctp2.finite_vertices_begin()), vertex_iterator(g.ctp2.finite_vertices_end())); } - friend Iterator_range edges (const CTP2_subconstraint_graph& g) - { - return make_range (boost::make_transform_iterator(g.ctp2.subconstraints_begin(), Subconstr_uf(Subconstr_map())), - boost::make_transform_iterator(g.ctp2.subconstraints_end(), Subconstr_uf(Subconstr_map()))); + friend Iterator_range edges(const CTP2_subconstraint_graph& g) { + return g.ctp2.subconstraints(); } - friend vertex_descriptor source (edge_descriptor ed, const CTP2_subconstraint_graph&) - { - return ed.first; - } + friend vertex_descriptor source(edge_descriptor ed, const CTP2_subconstraint_graph&) { return ed.first; } - friend vertex_descriptor target (edge_descriptor ed, const CTP2_subconstraint_graph&) - { - return ed.second; - } + friend vertex_descriptor target(edge_descriptor ed, const CTP2_subconstraint_graph&) { return ed.second; } }; - template class CTP2_graph_visitor { private: + using Constraint_id = typename CTP2::Constraint_id; + using Vertex_handle = typename CTP2::Vertex_handle; CTP2& ctp2; - std::vector to_remove; - typename CTP2::Constraint_id current; - typename CTP2::Vertex_handle latest_vertex; + std::vector to_remove; + Constraint_id current{}; + Vertex_handle latest_vertex{}; public: + CTP2_graph_visitor(CTP2& ctp2) + : ctp2(ctp2) {} - CTP2_graph_visitor (CTP2& ctp2) : ctp2 (ctp2) { } - - void start_new_polyline() - { - latest_vertex = typename CTP2::Vertex_handle(); - current = typename CTP2::Constraint_id(); + void start_new_polyline() { + latest_vertex = Vertex_handle(); + current = Constraint_id(); } - void add_node (typename CTP2::Vertex_handle vh) - { - if (latest_vertex != typename CTP2::Vertex_handle()) - { - to_remove.push_back (ctp2.context(latest_vertex, vh).id()); - typename CTP2::Constraint_id cid = ctp2.insert_constraint(latest_vertex, vh); - if (current == typename CTP2::Constraint_id()) + void add_node(Vertex_handle vh) { + if(latest_vertex != Vertex_handle()) { + to_remove.push_back(ctp2.context(latest_vertex, vh).id()); + Constraint_id cid = ctp2.insert_constraint(latest_vertex, vh); + if(current == Constraint_id()) current = cid; else - current = ctp2.concatenate (current, cid); + current = ctp2.concatenate(current, std::move(cid)); } latest_vertex = vh; } - void end_polyline() - { - for (typename CTP2::Constraint_id id : to_remove) + void end_polyline() { + for(Constraint_id id : to_remove) ctp2.remove_constraint(id); to_remove.clear(); } diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h index 73a7db231ac..8fbc040d9bd 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h @@ -21,10 +21,23 @@ #include #include #include +#include +#include +#include + +#include + +#include #include +#include #include +#include +#include #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +# define CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 # include # include # include @@ -38,101 +51,226 @@ namespace CGAL { template class Polyline_constraint_hierarchy_2 { + using T_point_ref = decltype(std::declval()->point()); + static_assert(std::is_same_v, + "The point type of the vertex handle must be the same as the point type of the hierarchy."); public: - typedef T Vertex_handle; - typedef std::pair Edge; - typedef std::pair Constraint; - typedef std::pair Subconstraint; + using Vertex_handle = T; + using Vertex_handle_compare = Compare; + using Subconstraint = std::pair; + + using size_type = typename Vertex_handle::size_type; private: class Node { public: explicit Node(Vertex_handle vh, bool input = false) - : vertex_(vh), point_(vertex_->point()), input(input) + : vertex_(vh), point_(vertex_->point()), input_(input) {} const Point& point() const { return point_; } - Vertex_handle vertex() const { return vertex_; } + const Vertex_handle& vertex() const { return vertex_; } + bool& input() { return input_; } + const bool& input() const { return input_; } private: Vertex_handle vertex_; Point point_; - public: - bool input; + bool input_; }; - typedef CGAL::Skiplist Vertex_list; - typedef std::list Constraint_list; + using Vertex_list = CGAL::Skiplist; + using Vertex_list_ptr = Vertex_list*; public: // the base line is always - class Point_it - : public boost::iterator_adaptor< - Point_it - , typename Vertex_list::all_iterator - , const Point& - > + class Point_it : public boost::stl_interfaces::iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Point_it, +#endif + std::bidirectional_iterator_tag, + const Point> { - public: - Point_it() : Point_it::iterator_adaptor_() {} - Point_it(typename Vertex_list::all_iterator it) : Point_it::iterator_adaptor_(it) {} +public: + using Self = Point_it; + using Base = boost::stl_interfaces::iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Point_it, +#endif + std::bidirectional_iterator_tag, + const Point>; + using Base_it = typename Vertex_list::all_iterator; + + Base_it base() const { return it; } + Base_it& base_reference() { return it; } + const Base_it& base_reference() const { return it; } + + Point_it() = default; + Point_it(Base_it it) : it(it) {} + + const Point& operator*() const { return base()->point(); } + + Self& operator++() { ++it; return *this; } + Self operator++(int i) { return static_cast(Base::operator++(i)); } + + Self& operator--() { --it; return *this; } + Self operator--(int i) { return static_cast(Base::operator--(i)); } + private: - friend class boost::iterator_core_access; - const Point& dereference() const { return this->base()->point(); } + friend bool operator==(const Self& lhs, const Self& rhs) { + return lhs.base() == rhs.base(); + } + friend bool operator==(const Self& lhs, const Base_it& rhs) { + return lhs.base() == rhs; + } + friend bool operator==(const Base_it& lhs, const Self& rhs) { + return lhs == rhs.base(); + } + Base_it it; }; + BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(Point_it, std::bidirectional_iterator); +#if BOOST_VERSION >= 108300 + BOOST_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS(Point_it, std::bidirectional_iterator_tag, + std::bidirectional_iterator, Point, const Point&, const Point*, std::ptrdiff_t); +#endif + // only nodes with a vertex_handle that is still in the triangulation - class Vertex_it - : public boost::iterator_adaptor< - Vertex_it - , typename Vertex_list::skip_iterator - , Vertex_handle - , std::bidirectional_iterator_tag - , Vertex_handle> + class Vertex_it : public boost::stl_interfaces::iterator_interface< + #if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Vertex_it, + #endif + std::bidirectional_iterator_tag, + const Vertex_handle> { public: - Vertex_it() : Vertex_it::iterator_adaptor_() {} - Vertex_it(typename Vertex_list::skip_iterator it) : Vertex_it::iterator_adaptor_(it) {} + using Self = Vertex_it; + using Base = boost::stl_interfaces::iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Vertex_it, +#endif + std::bidirectional_iterator_tag, + const Vertex_handle>; + using Base_it = typename Vertex_list::skip_iterator; + + Base_it base() const { return it; } + + Base_it& base_reference() { return it; } + const Base_it& base_reference() const { return it; } + + Vertex_it() = default; + Vertex_it(Base_it it) : it(it) { + [[maybe_unused]] Vertex_it itt; + static_assert(std::is_same_v); + } + + const Vertex_handle& operator*() const { return this->base()->vertex(); } + + Self& operator++() { ++it; return *this; } + Self operator++(int i) { return static_cast(Base::operator++(i)); } + + Self& operator--() { --it; return *this; } + Self operator--(int i) { return static_cast(Base::operator--(i)); } + operator Point_it() const { return Point_it(this->base()); } - bool& input() { return this->base()->input; } + + bool& input() { return this->base()->input(); } + const bool& input() const { return this->base()->input(); } private: - friend class boost::iterator_core_access; - Vertex_handle dereference() const { return this->base()->vertex(); } + friend bool operator==(const Self& lhs, const Self& rhs) { + return lhs.base() == rhs.base(); + } + friend bool operator==(const Self& lhs, const Base_it& rhs) { + return lhs.base() == rhs; + } + friend bool operator==(const Base_it& lhs, const Self& rhs) { + return lhs == rhs.base(); + } + Base_it it; + }; + BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(Vertex_it, std::bidirectional_iterator); +#if BOOST_VERSION >= 108300 + BOOST_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS(Vertex_it, std::bidirectional_iterator_tag, + std::bidirectional_iterator, Vertex_handle, const Vertex_handle&, const Vertex_handle*, std::ptrdiff_t); +#endif + struct Vertex_list_with_info { + const Polyline_constraint_hierarchy_2* hierarchy_ptr = nullptr; + Vertex_list vl{}; + bool may_share_subconstraint_with_others = false; }; - typedef typename Constraint_list::iterator Constraint_it; + class Constraint_id + { + Vertex_list_with_info* vl_with_info_ptr = nullptr; + size_type id = (std::numeric_limits::max)(); + public: + Constraint_id(std::nullptr_t = nullptr) {} + Constraint_id(Vertex_list_with_info* ptr, size_type id) : vl_with_info_ptr(ptr), id(id) {} - struct Constraint_id { - Vertex_list* second; - - Constraint_id(): second(nullptr) {} - - Constraint_id(Vertex_list* vl) - : second(vl) - {} - - Vertex_list* vl_ptr() const {return second;} - - operator std::pair,Vertex_list*>() - { - if (second!=nullptr){ - return std::make_pair(std::make_pair(second->front().vertex(), - second->back().vertex()),second); + void destroy() { + if(vl_with_info_ptr != nullptr) { + delete vl_with_info_ptr; + (*this) = nullptr; } - return std::make_pair(std::make_pair(Vertex_handle(),Vertex_handle()),second); } - bool operator == (const Constraint_id& other) const - { - return second == other.second; - } - bool operator != (const Constraint_id& other) const - { - return second != other.second; + auto index() const { return id; } + + Vertex_list_ptr vl_ptr() const { + return vl_with_info_ptr == nullptr ? nullptr : std::addressof(vl_with_info_ptr->vl); } - bool operator<(const Constraint_id& other) const{ - return second < other.second; + bool may_share() const { return vl_with_info_ptr->may_share_subconstraint_with_others; } + bool& may_share() { return vl_with_info_ptr->may_share_subconstraint_with_others; } + + operator std::pair() const { + Subconstraint subconstraint = vl_with_info_ptr == nullptr + ? Subconstraint() + : Subconstraint(vl_ptr()->front().vertex(), vl_ptr()->back().vertex()); + return {subconstraint, vl_ptr()}; } - }; + + bool same_hierarchy(const Constraint_id& other) const { + return vl_with_info_ptr == nullptr || other.vl_with_info_ptr == nullptr || + vl_with_info_ptr->hierarchy_ptr == other.vl_with_info_ptr->hierarchy_ptr; + } + + Constraint_id& operator=(std::nullptr_t) { + *this = Constraint_id{}; + return *this; + } + bool operator==(std::nullptr_t n) const { return vl_with_info_ptr == n; } + bool operator!=(std::nullptr_t n) const { return vl_with_info_ptr != n; } + + bool operator==(const Constraint_id& other) const + { + CGAL_assertion(same_hierarchy(other)); + CGAL_assertion((vl_ptr() == other.vl_ptr()) == (index() == other.index())); + return vl_ptr() == other.vl_ptr(); + } + + bool operator!=(const Constraint_id& other) const + { + CGAL_assertion(same_hierarchy(other)); + CGAL_assertion((vl_ptr() == other.vl_ptr()) == (index() == other.index())); + return vl_ptr() != other.vl_ptr(); + } + + bool operator<(const Constraint_id& other) const + { + CGAL_assertion(same_hierarchy(other)); + CGAL_assertion((vl_ptr() == other.vl_ptr()) == (index() == other.index())); + return index() < other.index(); + } + + // forward a new Vertex_list operations + decltype(auto) begin() const { return vl_ptr()->skip_begin(); } + decltype(auto) end() const { return vl_ptr()->skip_end(); } + decltype(auto) elements() const { return vl_ptr()->skip_elements(); } + decltype(auto) clear() const { return vl_ptr()->clear(); } + decltype(auto) size() const { return vl_ptr()->skip_size(); } + decltype(auto) front() const { return vl_ptr()->front(); } + decltype(auto) back() const { return vl_ptr()->back(); } + + }; // end Constraint_id class Pair_compare { Compare comp; @@ -140,11 +278,11 @@ public: public: Pair_compare(const Compare& comp) : comp(comp) {} - bool operator()(const Edge& e1, const Edge& e2) const { - if(comp(e1.first, e2.first)) { + bool operator()(const Subconstraint& sc1, const Subconstraint& sc2) const { + if(comp(sc1.first, sc2.first)) { return true; - } else if((! comp(e2.first, e1.first)) && // !less(e1,e2) && !less(e2,e1) == equal - comp(e1.second, e2.second)) { + } else if((! comp(sc2.first, sc1.first)) && // !less(sc1,sc2) && !less(sc2,sc1) == equal + comp(sc1.second, sc2.second)) { return true; } else { return false; @@ -155,55 +293,262 @@ public: class Context { friend class Polyline_constraint_hierarchy_2; private: - Vertex_list* enclosing; - Vertex_it pos; + Constraint_id enclosing = nullptr; + Vertex_it pos{}; public: - Context() : enclosing(nullptr) {} + Context() = default; + Context(Constraint_id enclosing, Vertex_it pos) : enclosing(enclosing), pos(pos) {} + Context(Constraint_id enclosing, typename Vertex_list::skip_iterator pos) : enclosing(enclosing), pos(pos) {} - Vertex_it vertices_begin()const { return enclosing->skip_begin();} + Vertex_it vertices_begin()const { return enclosing.begin();} Vertex_it current()const {return pos;} - Vertex_it vertices_end()const {return enclosing->skip_end();} + Vertex_it vertices_end()const {return enclosing.end();} Constraint_id id()const { return enclosing; } - std::size_t number_of_vertices() const {return enclosing->skip_size(); } + size_type number_of_vertices() const {return enclosing.size(); } }; - typedef std::list Context_list; - typedef typename Context_list::iterator Context_iterator; + using Context_list = std::list; + using Context_iterator = typename Context_list::iterator; - typedef std::set Constraint_set; - typedef std::map Sc_to_c_map; - typedef typename Constraint_set::iterator C_iterator; - typedef typename Sc_to_c_map::const_iterator Sc_iterator; - typedef Sc_iterator Subconstraint_iterator; + static void fix_may_share_in_contexts_constraints(Context_list& context_list) { + const auto cl_size = context_list.size(); + switch(cl_size) { + case 0: + CGAL_unreachable(); + case 1: + return; + default: + for(auto& context : context_list) { + CGAL_assertion(context.enclosing != nullptr); + context.enclosing.may_share() = true; + } + } + } + + using Constraints_set = std::set; +#if CGAL_USE_BARE_STD_MAP + using Sc_to_c_map = std::map; +#else + using Sc_to_c_map = CGAL::unordered_flat_map>; +#endif + using Constraint_iterator = typename Constraints_set::iterator; + using Constraints = const Constraints_set&; + using Sc_iterator = typename Sc_to_c_map::const_iterator; + using Sc_it = typename Sc_to_c_map::iterator; + using Subconstraint_and_contexts_iterator = Sc_iterator; + using Subconstraints_and_contexts = const Sc_to_c_map&; + + class Subconstraint_iterator : public boost::stl_interfaces::proxy_iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Subconstraint_iterator, +#endif + std::bidirectional_iterator_tag, + Subconstraint> + { + using base_type = boost::stl_interfaces::proxy_iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Subconstraint_iterator, +#endif + std::bidirectional_iterator_tag, + Subconstraint>; + + const Polyline_constraint_hierarchy_2* hierarchy = nullptr; + Constraint_iterator constraint_it{}; + Vertex_it vertex_it{}; + + public: + // - The object is singular if and only if `hierarchy==nullptr`. + // + // - The end value is when `constraint_it` is the end iterator of `constraints_set`. + // In that case `vertex_it` must be singular. + // + // - Otherwise all members must be valid pointers or dereferenceable iterators. + + bool is_singular() const { + return hierarchy == nullptr; + } + + bool is_valid() const { + return (hierarchy != nullptr); + } + + bool is_end() const { + return constraint_it == hierarchy->constraints_end(); + } + + bool is_begin() const { + return constraint_it == hierarchy->constraints_begin() && + vertex_it == begin_or_null(constraint_it); + } + + bool is_dereferenceable() const { + return is_valid() && + constraint_it != hierarchy->constraints_end() && + vertex_it != constraint_it->end() && + std::next(vertex_it) != constraint_it->end(); + } + + bool equal(const Subconstraint_iterator& other) const { + if(hierarchy != other.hierarchy) return false; + if(is_singular()) return true; + + return (constraint_it == other.constraint_it) && (this->is_end() == other.is_end()); + } + + Vertex_it begin_or_null(Constraint_iterator constraint_it) const { + if(constraint_it == hierarchy->constraints_end()) { + return Vertex_it(); + } + return constraint_it->begin(); + } + + bool already_seen() const { + if(is_end()) { + return false; + } + if(false == constraint_it->may_share()) { + return false; + } + auto [va, vb] = this->operator*(); + auto it = hierarchy->find_contexts(va, vb); + CGAL_assertion(it != hierarchy->contexts_not_found()); + + const Context_list& ctx_list = *it->second; + + const Context& ctx = ctx_list.front(); + // if this context does not correspond to *this, return true + + if(ctx.enclosing != *constraint_it) { + return true; + } + + return (ctx.pos != vertex_it && ctx.pos != std::next(vertex_it)); + } + + static auto non_null(const Polyline_constraint_hierarchy_2* hierarchy) { + CGAL_precondition(hierarchy != nullptr); + return hierarchy; + } + + public: + Subconstraint_iterator() = default; + + // Constructors for begin and end. The constructors are public, but only the + // hierarchy can create an iterator of this class, through its friendship of + // the nested class `Construction_access`: Construction_access::begin_tag() and + // Construction_access::end_tag(). + class Construction_access + { + private: + friend class Subconstraint_iterator; + friend class Polyline_constraint_hierarchy_2; + + static auto begin_tag() { return Begin_tag(); } + static auto end_tag() { return End_tag(); } + + struct Begin_tag + {}; + struct End_tag + {}; + }; + // + // constructor for the begin iterator + explicit Subconstraint_iterator(typename Construction_access::Begin_tag, + const Polyline_constraint_hierarchy_2* hierarchy) + : hierarchy(non_null(hierarchy)) + , constraint_it(hierarchy->constraints_begin()) + , vertex_it(begin_or_null(hierarchy->constraints_begin())) + { + if(already_seen()) { + ++(*this); + } + } + // + // constructor for the end iterator + explicit Subconstraint_iterator(typename Construction_access::End_tag, + const Polyline_constraint_hierarchy_2* hierarchy) + : hierarchy(non_null(hierarchy)) + , constraint_it(hierarchy->constraints_end()) + , vertex_it() {} + + Subconstraint operator*() const { + CGAL_precondition(is_dereferenceable()); + return Subconstraint(*vertex_it, *std::next(vertex_it)); + } + + friend bool operator==(const Subconstraint_iterator& lhs, const Subconstraint_iterator& rhs) { + return lhs.equal(rhs); + } + + using base_type::operator++; + Subconstraint_iterator& operator++() { + CGAL_precondition(is_valid() && false == is_end()); + + do { + ++vertex_it; + CGAL_assertion(vertex_it != constraint_it->end()); + + if(std::next(vertex_it) == constraint_it->end()) { + ++constraint_it; + vertex_it = begin_or_null(constraint_it); + } + } while(already_seen()); + return *this; + } + + using base_type::operator--; + Subconstraint_iterator& operator--() { + CGAL_precondition(is_valid() && false == is_begin()); + + do { + if(constraint_it == hierarchy->constraints_end() || vertex_it == constraint_it->begin()) { + --constraint_it; + vertex_it = std::prev(constraint_it->end(), 2); + } else { + --vertex_it; + } + } while(already_seen()); + return *this; + } + }; // end class Subconstraint_iterator + using Subconstraints = Iterator_range; private: - // data for the 1d hierarchy - Compare comp; - Constraint_set constraint_set; - Sc_to_c_map sc_to_c_map; - -public: - Polyline_constraint_hierarchy_2(const Compare& comp) + struct Priv { // encapsulate the private members in a struct, to detect direct access to them + Priv(Compare comp) : comp(comp) + #if CGAL_USE_BARE_STD_MAP , sc_to_c_map(Pair_compare(comp)) - { } - Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); +#else + , sc_to_c_map() +#endif + {} + + Compare comp; + Sc_to_c_map sc_to_c_map; + std::queue free_ids; + Constraints_set constraints_set; + } priv; +public: + Polyline_constraint_hierarchy_2(const Compare& comp) : priv(comp) {} + Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch) : priv(ch.priv.comp) {} Polyline_constraint_hierarchy_2(Polyline_constraint_hierarchy_2&&) = default; + ~Polyline_constraint_hierarchy_2(){ clear();} void clear(); - Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch); + + Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch) { return copy(ch); } Polyline_constraint_hierarchy_2& operator=(Polyline_constraint_hierarchy_2&& ch) = default; // Query - bool is_subconstrained_edge(T va, T vb) const; - bool is_constrained_edge(T va, T vb) const; - bool is_constrained_vertex(T v) const; + bool is_subconstraint(T va, T vb) const; Vertex_it vertices_in_constraint_begin(Constraint_id cid) const - { return cid.vl_ptr()->skip_begin(); } + { return cid.begin(); } Vertex_it vertices_in_constraint_end(Constraint_id cid) const - { return cid.vl_ptr()->skip_end(); } + { return cid.end(); } + auto vertices_in_constraint(Constraint_id cid) const + { return Iterator_range(cid.begin(), cid.end()); } Point_it points_in_constraint_begin(Constraint_id cid) const @@ -211,211 +556,260 @@ public: Point_it points_in_constraint_end(Constraint_id cid) const { return cid.vl_ptr()->all_end(); } - bool enclosing_constraint(Edge he, Constraint& hc) const; - bool enclosing_constraint(T vaa, T vbb, T& va, T& vb) const; - bool enclosing_constraints(T vaa, T vbb, Constraint_list& hcl) const; - bool next_along_sc(T va, T vb, T& w) const; - void oriented_end(T va, T vb, T& vc) const; + std::array enclosing_constraint(T vaa, T vbb) const; Context context(T va, T vb); - std::size_t number_of_enclosing_constraints(T va, T vb) const; + size_type number_of_enclosing_constraints(T va, T vb) const; Context_iterator contexts_begin(T va, T vb) const; Context_iterator contexts_end(T va, T vb) const; - Iterator_range contexts_range(T va, T vb) const; - std::size_t number_of_constraints() const { return constraint_set.size();} - std::size_t number_of_subconstraints()const {return sc_to_c_map.size();} + using Contexts = Iterator_range; + Contexts contexts(T va, T vb) const; + Context_list* get_context_list(T va, T vb) const; + size_type number_of_constraints() const { return priv.constraints_set.size(); } + size_type number_of_subconstraints() const { return priv.sc_to_c_map.size(); } // insert/remove - void add_Steiner(T va, T vb, T vx); - Vertex_list* insert_constraint_old_API(T va, T vb); - Vertex_list* insert_constraint(T va, T vb); + void add_Steiner(const T va, const T vb, const T vx); + Constraint_id insert_constraint_old_API(T va, T vb); + Constraint_id insert_constraint(T va, T vb); void append_constraint(Constraint_id cid, T va, T vb); void swap(Constraint_id first, Constraint_id second); void remove_constraint(Constraint_id cid); void split_constraint(T va, T vb, T vc); - void simplify(Vertex_it u, - Vertex_it v, - Vertex_it w); + void simplify(Vertex_it u, Vertex_it v, Vertex_it w); - std::size_t remove_points_without_corresponding_vertex(Constraint_id); - std::size_t remove_points_without_corresponding_vertex(); + size_type remove_points_without_corresponding_vertex(Constraint_id); + size_type remove_points_without_corresponding_vertex(); - Constraint_id concatenate(Constraint_id first, Constraint_id second); - Constraint_id concatenate2(Constraint_id first, Constraint_id second); - Constraint_id split(Constraint_id first, Vertex_it vcit); - Constraint_id split2(Constraint_id first, Vertex_it vcit); - - void remove_Steiner(T v, T va, T vb); + Constraint_id concatenate(Constraint_id first, Constraint_id&& second); + Constraint_id prepend(Constraint_id&& first, Constraint_id second); + Constraint_id split_tail(Constraint_id first, Vertex_it vcit); + Constraint_id split_head(Constraint_id first, Vertex_it vcit); // iterators - Subconstraint_iterator subconstraint_begin() const + Subconstraint_and_contexts_iterator subconstraints_and_contexts_begin() const { - return sc_to_c_map.begin(); + return priv.sc_to_c_map.begin(); } - Subconstraint_iterator subconstraint_end() const + Subconstraint_and_contexts_iterator subconstraints_and_contexts_end() const { - return sc_to_c_map.end(); + return priv.sc_to_c_map.end(); } - Sc_iterator sc_begin() const{ return sc_to_c_map.begin(); } - Sc_iterator sc_end() const{ return sc_to_c_map.end(); } - C_iterator c_begin() const{ return constraint_set.begin(); } - C_iterator c_end() const{ return constraint_set.end(); } + Subconstraint_iterator subconstraints_begin() const { + BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(Subconstraint_iterator, std::bidirectional_iterator); +#if BOOST_VERSION >= 108300 + BOOST_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS( + Subconstraint_iterator, std::bidirectional_iterator_tag, std::bidirectional_iterator, + Subconstraint, Subconstraint, typename Subconstraint_iterator::pointer, std::ptrdiff_t); +#endif + return Subconstraint_iterator(Subconstraint_iterator::Construction_access::begin_tag(), + this); + } + + Subconstraint_iterator subconstraints_end() const { + return Subconstraint_iterator(Subconstraint_iterator::Construction_access::end_tag(), + this); + } + + Constraint_iterator constraints_begin() const{ return priv.constraints_set.begin(); } + Constraint_iterator constraints_end() const{ return priv.constraints_set.end(); } + + // Ranges + const auto& constraints() const { return priv.constraints_set; } + const auto& subconstraints_and_contexts() const { return priv.sc_to_c_map; } + auto subconstraints() const { + return Iterator_range(subconstraints_begin(), subconstraints_end()); + } // Helper functions - void copy(const Polyline_constraint_hierarchy_2& ch); - void copy(const Polyline_constraint_hierarchy_2& ch, std::map& vmap); + Polyline_constraint_hierarchy_2& copy(const Polyline_constraint_hierarchy_2& ch); + Polyline_constraint_hierarchy_2& copy(const Polyline_constraint_hierarchy_2& ch, + std::map& vmap); void swap(Polyline_constraint_hierarchy_2& ch); private: - Edge make_edge(T va, T vb) const; - Vertex_it get_pos(T va, T vb) const; - bool get_contexts(T va, T vb, - Context_iterator& ctxt, - Context_iterator& past) const; + // a few member functions to encapsulate more of the uses of `sc_to_c_map` + auto find_contexts(Vertex_handle va, Vertex_handle vb) { return priv.sc_to_c_map.find(sorted_pair(va, vb)); } + auto find_contexts(Vertex_handle va, Vertex_handle vb) const { return priv.sc_to_c_map.find(sorted_pair(va, vb)); } + auto contexts_not_found() { return priv.sc_to_c_map.end(); } + auto contexts_not_found() const { return priv.sc_to_c_map.end(); } + void erase_context(Sc_iterator it) { priv.sc_to_c_map.erase(it); } + auto& contexts_of(Vertex_handle va, Vertex_handle vb) { return priv.sc_to_c_map[sorted_pair(va, vb)]; } + // + // then the uses of `constraints_set` + Constraint_id create_new_constraint() { + size_type id; // uninitialized + if(priv.free_ids.empty()) { + id = priv.constraints_set.size(); + } else { + id = priv.free_ids.front(); + priv.free_ids.pop(); + } + Constraint_id cid{new Vertex_list_with_info{this}, id}; + priv.constraints_set.insert(cid); + return cid; + } - bool get_contexts(T va, T vb, Context_list*&) const; + void erase_constraint(Constraint_id cid) { + priv.free_ids.push(cid.index()); + priv.constraints_set.erase(cid); + cid.destroy(); + } + + // + // functions to traverse and act on the context lists + // + template + void for_context_lists_of_all_subconstraints(Constraint_id cid, const F& f) + { + auto vl = cid.vl_ptr(); + for(Vertex_it it = vl->skip_begin(), succ = it, end = vl->skip_end(); ++succ != end; ++it) { + auto scit = find_contexts(*it, *succ); + CGAL_assertion(scit != contexts_not_found()); + Context_list* hcl = scit->second; + f(hcl, it, scit); + } + } + // + static void replace_first_in_context_list(Context_list* hcl, Constraint_id old_id, Constraint_id new_id) + { + // std::find_if is a sort of std::for_each with a break when the lambda returns true + [[maybe_unused]] auto it = std::find_if(hcl->begin(), hcl->end(), [&](Context& ctxt) { + if(ctxt.enclosing == old_id) { + ctxt.enclosing = new_id; + return true; + } + return false; + }); + } + // + static void update_first_context_position(Context_list* hcl, Constraint_id id, Vertex_it new_pos) + { + [[maybe_unused]] auto it = std::find_if(hcl->begin(), hcl->end(), [&](Context& ctxt) { + if(ctxt.enclosing == id) { + ctxt.pos = new_pos; + return true; + } + return false; + }); + } + // + static void remove_first_in_context_list(Context_list* hcl, Constraint_id id) + { + auto it = std::find_if(hcl->begin(), hcl->end(), [&](Context& ctxt) { + return ctxt.enclosing == id; + }); + if(it != hcl->end()) { + hcl->erase(it); + } + } + + // + // other utilities as private member functions + // + Subconstraint sorted_pair(T va, T vb) const { + return priv.comp(va, vb) ? Subconstraint(va,vb) : Subconstraint(vb,va); + } + Subconstraint sorted_pair(Subconstraint sc) { + const auto& [va, vb] = sc; return sorted_pair(va, vb); + } - //to_debug public: - void print() const; + //to_debug + void print(std::ostream& os = std::cout) const; }; template -Polyline_constraint_hierarchy_2:: -Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch) - : comp(ch.comp) - , sc_to_c_map(Pair_compare(comp)) +auto Polyline_constraint_hierarchy_2:: +copy(const Polyline_constraint_hierarchy_2& other) -> Polyline_constraint_hierarchy_2& { - copy(ch); + // create a identity transfer vertex map + std::map vmap; + for(const auto& cid : other.constraints()) { + for(const auto& node : cid.elements()) { + auto v = node.vertex(); + vmap[v] = v; + } + } + return copy(other, vmap); } template -Polyline_constraint_hierarchy_2& -Polyline_constraint_hierarchy_2:: -operator=(const Polyline_constraint_hierarchy_2& ch){ - copy(ch); +auto Polyline_constraint_hierarchy_2:: +copy(const Polyline_constraint_hierarchy_2& other, std::map& vmap) + -> Polyline_constraint_hierarchy_2& +// copy with a transfer vertex map +{ + std::map cstr_map; + clear(); + // copy constraints_set + for(const auto& cid1: other.constraints()) { + Constraint_id cid2 = create_new_constraint(); + cstr_map[cid1] = cid2; + for(const auto& node : cid1.elements()) { + cid2.vl_ptr()->push_back(Node(vmap[node.vertex()], node.input())); + } + cid2.may_share() = cid1.may_share(); + } + // copy sc_to_c_map + for(const auto& [sc1, hcl1] : other.subconstraints_and_contexts()) { + Vertex_handle uu2 = vmap[sc1.first]; + Vertex_handle vv2 = vmap[sc1.second]; + Context_list* hcl2 = new Context_list; + contexts_of(uu2, vv2) = hcl2; + for(const auto& ctxt : *hcl1) { + const auto cid1 = ctxt.id(); + const auto pos1 = ctxt.current(); + // vertices of the enclosing constraints + Constraint_id cid2 = cstr_map[cid1]; + auto pos2 = std::next(Vertex_it(cid2.begin()), + std::distance(Vertex_it(cid1.begin()), pos1)); + hcl2->emplace_back(cid2, pos2); + } + } + + priv.comp = other.priv.comp; return *this; } -template -void -Polyline_constraint_hierarchy_2:: -copy(const Polyline_constraint_hierarchy_2& ch1) -{ - // create a identity transfer vertex map - std::map vmap; - C_iterator cit1 = ch1.c_begin(); - for( ; cit1 != ch1.c_end(); ++cit1) { - Vertex_it vit = cit1->second->begin(); - for( ; vit != cit1->second->end(); ++vit) { - vmap[*vit] = *vit; - } - } - copy(ch1, vmap); -} - -template -void -Polyline_constraint_hierarchy_2:: -copy(const Polyline_constraint_hierarchy_2& ch1, std::map& vmap) - // copy with a transfer vertex map -{ - std::map vlmap; - clear(); - // copy constraint_set - C_iterator cit1 = ch1.c_begin(); - for( ; cit1 != ch1.c_end(); ++cit1) { - Vertex_list* hvl1 = cit1->vl_ptr(); - Vertex_list* hvl2 = new Vertex_list; - vlmap[hvl1] = hvl2; - Vertex_it vit = hvl1->skip_begin(), end = hvl1->skip_end(); - for( ; vit != end; ++vit) hvl2->push_back(Node(vmap[*vit], vit.input())); - constraint_set.insert(hvl2); - } - // copy sc_to_c_map - Sc_iterator scit1 = ch1.sc_begin(); - for( ; scit1 != ch1.sc_end(); ++scit1) { - //vertices of the subconstraints - Vertex_handle uu2 = vmap[scit1->first.first]; - Vertex_handle vv2 = vmap[scit1->first.second]; - Context_list* hcl1 = scit1->second; - Context_list* hcl2 = new Context_list; - Context_iterator cit1 = hcl1->begin(); - for( ; cit1 != hcl1->end(); ++cit1){ - // vertices of the enclosing constraints - Context ctxt2; - ctxt2.enclosing = vlmap[cit1->enclosing]; - ctxt2.pos = ctxt2.enclosing->skip_begin(); - Vertex_it aux = cit1->enclosing->skip_begin(); - while( aux != cit1->pos) { - ++aux; - ++ctxt2.pos; - } - hcl2->push_back(ctxt2); - } - sc_to_c_map[make_edge(uu2,vv2)] = hcl2; - } - - comp = ch1.comp; - return; -} - - template void Polyline_constraint_hierarchy_2:: swap(Polyline_constraint_hierarchy_2& ch) { - constraint_set.swap(ch.constraint_set); - sc_to_c_map.swap(ch.sc_to_c_map); + using std::swap; + swap(priv.comp, ch.priv.comp); + priv.free_ids.swap(ch.priv.free_ids); + priv.constraints_set.swap(ch.priv.constraints_set); + priv.sc_to_c_map.swap(ch.priv.sc_to_c_map); } -/* template bool Polyline_constraint_hierarchy_2:: -is_constrained_edge(T va, T vb) const +is_subconstraint(T va, T vb) const { - return( c_to_sc_map.find(make_edge(va, vb)) != c_to_sc_map.end() ); -} -*/ - -template -bool Polyline_constraint_hierarchy_2:: -is_subconstrained_edge(T va, T vb) const -{ - return( sc_to_c_map.find(make_edge(va, vb)) != sc_to_c_map.end() ); -} - - -// af: obsolete -template -bool Polyline_constraint_hierarchy_2:: -enclosing_constraint(Edge he, Constraint& hc) const -{ - Context_iterator hcit, past; - if ( !get_contexts(he.first,he.second, hcit ,past)) return false; - hc = make_edge(hcit->enclosing->front(), hcit->enclosing->back()); - return true; + return( find_contexts(va, vb) != contexts_not_found() ); } // used by Constrained_triangulation_plus_2::intersect with Exact_intersection_tag template -bool Polyline_constraint_hierarchy_2:: -enclosing_constraint(T vaa, T vbb, T& va, T& vb) const +auto Polyline_constraint_hierarchy_2:: +enclosing_constraint(T vaa, T vbb) const -> std::array { - Context_iterator hcit, past; - if ( !get_contexts(vaa,vbb, hcit ,past)) return false; - // va = hcit->enclosing->front().vertex(); - // vb = hcit->enclosing->back().vertex(); - // Vertex_list* vl = hcit->enclosing; + std::array result; + auto [hcit, past] = contexts(vaa, vbb); + if (hcit == past) return result; + // va = hcit->enclosing.front().vertex(); + // vb = hcit->enclosing.back().vertex(); + // Vertex_list_ptr vl = hcit->enclosing; Vertex_it pos = hcit->pos; if(vaa != *pos){ std::swap(vaa,vbb); @@ -423,168 +817,85 @@ enclosing_constraint(T vaa, T vbb, T& va, T& vb) const while(!pos.input()){ --pos; } - va = *pos; - pos = hcit->pos; - ++pos; + result[0] = *pos; + pos = std::next(hcit->pos); CGAL_assertion(vbb == *pos); while(!pos.input()){ ++pos; } - vb = *pos; - return true; -} - -// af: obsolete -template -bool Polyline_constraint_hierarchy_2:: -enclosing_constraints(T vaa, T vbb , Constraint_list& hcl) const -{ - Context_iterator hcit, past; - if ( !get_contexts(vaa,vbb, hcit ,past)) return false; - for (; hcit!=past; hcit++) { - hcl.push_back(make_edge(hcit->enclosing->front(), - hcit->enclosing->back())); - } - return true; + result[1] = *pos; + return result; } template -typename Polyline_constraint_hierarchy_2::Context -Polyline_constraint_hierarchy_2:: -context(T va, T vb) +auto Polyline_constraint_hierarchy_2:: +context(T va, T vb) -> Context { - Context_iterator hcit, past; - if(!get_contexts(va,vb, hcit ,past)) CGAL_assertion(false); + auto [hcit, past] = contexts(va, vb); + CGAL_assertion(hcit != past); CGAL_USE(past); return *hcit; } template -std::size_t -Polyline_constraint_hierarchy_2:: -number_of_enclosing_constraints(T va, T vb) const +auto Polyline_constraint_hierarchy_2:: +number_of_enclosing_constraints(T va, T vb) const -> size_type { - Context_list* hcl = nullptr; - CGAL_assertion_code( bool found = ) get_contexts(va,vb,hcl); - CGAL_assertion(found); + Context_list* hcl = get_context_list(va,vb); + CGAL_assertion(nullptr != hcl); return hcl->size(); } template -typename Polyline_constraint_hierarchy_2::Context_iterator -Polyline_constraint_hierarchy_2:: -contexts_begin(T va, T vb) const +auto Polyline_constraint_hierarchy_2:: +contexts_begin(T va, T vb) const -> Context_iterator { - Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); - return first; + return contexts(va, vb).begin(); } template -typename Polyline_constraint_hierarchy_2::Context_iterator -Polyline_constraint_hierarchy_2:: -contexts_end(T va, T vb) const +auto Polyline_constraint_hierarchy_2:: +contexts_end(T va, T vb) const -> Context_iterator { - Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); - return last; -} - -template -auto -Polyline_constraint_hierarchy_2:: -contexts_range(T va, T vb) const -> Iterator_range { - Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) return { first, first }; - else return { first, last }; + return contexts(va, vb).end(); } template void Polyline_constraint_hierarchy_2:: -swap(Constraint_id first, Constraint_id second){ - // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; +swap(Constraint_id constr_a, Constraint_id constr_b) { + auto substitute_enclosing_in_vertex_list = [this](Constraint_id cid, Constraint_id old_id, Constraint_id new_id) { + for_context_lists_of_all_subconstraints(cid, [&](Context_list* hcl, Vertex_it, Sc_it) { + replace_first_in_context_list(hcl, old_id, new_id); + }); + }; - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = nullptr; - break; - } - } - } - // We have to look at all subconstraints - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + substitute_enclosing_in_vertex_list(constr_a, constr_a, nullptr); + substitute_enclosing_in_vertex_list(constr_b, constr_b, constr_a); + substitute_enclosing_in_vertex_list(constr_a, nullptr, constr_b); - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == second.vl_ptr()){ - ctit->enclosing = first.vl_ptr(); - break; - } - } - } - // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; - - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == nullptr){ - ctit->enclosing = second.vl_ptr(); - break; - } - } - } - first.vl_ptr()->swap(*second.vl_ptr()); + constr_a.vl_ptr()->swap(*constr_b.vl_ptr()); + std::swap(constr_a.may_share(), constr_b.may_share()); } - template void Polyline_constraint_hierarchy_2:: -remove_constraint(Constraint_id cid){ - constraint_set.erase(cid); +remove_constraint(Constraint_id cid) +{ + for_context_lists_of_all_subconstraints(cid, [&](Context_list* hcl, Vertex_it, Sc_it scit) { + remove_first_in_context_list(hcl, cid); - // We have to look at all subconstraints - for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; - - // and remove the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == cid.vl_ptr()){ - hcl->erase(ctit); - break; - } - } // If the constraint passes several times through the same subconstraint, - // the above loop maybe removes them in the wrong order + // the above call to `remove_first_in_context_list` may remove them in the wrong order. // If this was the only context in the list, delete the context list - if(hcl->empty()){ - sc_to_c_map.erase(scit); + if(hcl->empty()) { + erase_context(scit); delete hcl; } - } - delete cid.vl_ptr(); + }); + + erase_constraint(cid); } @@ -593,14 +904,13 @@ remove_constraint(Constraint_id cid){ // and for the case that the constrained edge u,w has no intersections template void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, - Vertex_it vc, - Vertex_it wc) - + Vertex_it vc, + Vertex_it wc) { // TODO: How do we (want to) deal with u == w ??? Vertex_handle u = *uc, v = *vc, w = *wc; - typename Sc_to_c_map::iterator uv_sc_iter = sc_to_c_map.find(make_edge(u, v)); - typename Sc_to_c_map::iterator vw_sc_iter = sc_to_c_map.find(make_edge(v, w)); + typename Sc_to_c_map::iterator uv_sc_iter = find_contexts(u, v); + typename Sc_to_c_map::iterator vw_sc_iter = find_contexts(v, w); Context_list* uv_hcl = uv_sc_iter->second; Context_list* vw_hcl = vw_sc_iter->second; // AF: what is input() about??? @@ -620,7 +930,7 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, it = uv_hcl->erase(it); }else{ // Remove the list item which points to v - Vertex_list* vertex_list = it->id().vl_ptr(); + Vertex_list_ptr vertex_list = it->id().vl_ptr(); Vertex_it vc_in_context = it->current(); vc_in_context = std::next(vc_in_context); vertex_list->skip(vc_in_context.base()); @@ -633,7 +943,7 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, it = vw_hcl->erase(it); }else{ // Remove the list item which points to v - Vertex_list* vertex_list = it->id().vl_ptr(); + Vertex_list_ptr vertex_list = it->id().vl_ptr(); Vertex_it vc_in_context = it->current(); vc_in_context = std::next(vc_in_context); vertex_list->skip(vc_in_context.base()); @@ -644,19 +954,19 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, uv_hcl->splice(uv_hcl->end(),*vw_hcl); delete vw_hcl; - sc_to_c_map.erase(uv_sc_iter); - sc_to_c_map.erase(vw_sc_iter); + erase_context(uv_sc_iter); + erase_context(vw_sc_iter); // reuse other context list - sc_to_c_map[make_edge(u,w)] = uv_hcl; + contexts_of(u,w) = uv_hcl; } template -std::size_t +typename Polyline_constraint_hierarchy_2::size_type Polyline_constraint_hierarchy_2::remove_points_without_corresponding_vertex(Constraint_id cid) { - std::size_t n = 0; + size_type n = 0; for(Point_it it = points_in_constraint_begin(cid); it != points_in_constraint_end(cid);) { if(cid.vl_ptr()->is_skipped(it.base())) { @@ -670,12 +980,12 @@ Polyline_constraint_hierarchy_2::remove_points_without_correspo } template -std::size_t +typename Polyline_constraint_hierarchy_2::size_type Polyline_constraint_hierarchy_2::remove_points_without_corresponding_vertex() { - std::size_t n = 0; - for(C_iterator it = constraint_set.begin(); it!= constraint_set.end(); ++it){ - n+= remove_points_without_corresponding_vertex(*it); + size_type n = 0; + for(const auto& cid : constraints()){ + n+= remove_points_without_corresponding_vertex(cid); } return n; } @@ -683,107 +993,82 @@ Polyline_constraint_hierarchy_2::remove_points_without_correspo template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::concatenate(Constraint_id first, Constraint_id second) +Polyline_constraint_hierarchy_2::concatenate(Constraint_id constr_a, Constraint_id&& constr_b) { - constraint_set.erase(first); - constraint_set.erase(second); - // We have to look at all subconstraints - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + if(constr_a == nullptr) { + swap(constr_a, constr_b); + }; + if(constr_b == nullptr) return constr_a; + + // constr_a is [A, ..., M] + // constr_b is [M, ..., B] + // we want: + // constr_a = [A, ..., M, ..., B] + // constr_b = [] + + // std::cerr << std::format("concatenate({}, {}) ", constr_a.id, constr_b.id) << std::endl; + Vertex_list_ptr constr_a_vl = constr_a.vl_ptr(); + Vertex_list_ptr constr_b_vl = constr_b.vl_ptr(); + + for_context_lists_of_all_subconstraints(constr_b, [&](Context_list* hcl, Vertex_it, Sc_it) { + replace_first_in_context_list(hcl, constr_b, constr_a); + }); - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == second.vl_ptr()){ - ctit->enclosing = first.vl_ptr(); - break; - } - } - } // now we really concatenate the vertex lists - // Note that all iterators pointing into second remain valid. + // Note that all iterators pointing into constr_a remain valid. // This concerns user code, as well as the data member "pos" of the Context class - first.vl_ptr()->pop_back(); // because it is the same as second.front() - Vertex_it back_it = first.vl_ptr()->skip_end(); - --back_it; - first.vl_ptr()->splice(first.vl_ptr()->skip_end(), *(second.vl_ptr()), second.vl_ptr()->skip_begin(), second.vl_ptr()->skip_end()); + CGAL_assertion(constr_a_vl->back().vertex() == constr_b_vl->front().vertex()); + constr_a_vl->pop_back(); // because it is the same as constr_b_vl.front() + constr_a_vl->splice(constr_a_vl->skip_end(), *constr_b_vl, constr_b_vl->skip_begin(), constr_b_vl->skip_end()); - // Note that for VC8 with iterator debugging the iterators pointing into second - // are NOT valid So we have to update them - for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + for_context_lists_of_all_subconstraints(constr_a, [&](Context_list* hcl, Vertex_it it, Sc_it) { + update_first_context_position(hcl, constr_a, it); + }); - // and update pos in the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->pos = it; - break; - } - } - } - constraint_set.insert(first); - - delete second.vl_ptr(); - return first; + if(constr_b.may_share()) { + constr_a.may_share() = true; + } + erase_constraint(constr_b); + return constr_a; } template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::concatenate2(Constraint_id first, Constraint_id second) +Polyline_constraint_hierarchy_2::prepend(Constraint_id&& constr_a, Constraint_id constr_b) { - constraint_set.erase(first); - constraint_set.erase(second); - // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + if(constr_b == nullptr) { + swap(constr_a, constr_b); + }; + if(constr_a == nullptr) return constr_b; + + // constr_a is [A, ..., M] + // constr_b is [M, ..., B] + // we want: + // constr_a = + // constr_b = [A, ..., M, ..., B] + + Vertex_list_ptr constr_a_vl = constr_a.vl_ptr(); + Vertex_list_ptr constr_b_vl = constr_b.vl_ptr(); + + for_context_lists_of_all_subconstraints(constr_a, [&](Context_list* hcl, Vertex_it, Sc_it) { // DIFF + replace_first_in_context_list(hcl, constr_a, constr_b); // DIFF + }); - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second.vl_ptr(); - break; - } - } - } // now we really concatenate the vertex lists - // Note that all iterators pointing into second remain valid. - first.vl_ptr()->pop_back(); // because it is the same as second.front() - Vertex_it back_it = second.vl_ptr()->skip_begin(); + // Note that all iterators pointing into constr_b remain valid. + CGAL_assertion(constr_a_vl->back().vertex() == constr_b_vl->front().vertex()); + constr_a_vl->pop_back(); // because it is the same as constr_b_vl.front() + constr_b_vl->splice(constr_b_vl->skip_begin(), *constr_a_vl, constr_a_vl->skip_begin(), constr_a_vl->skip_end()); // DIFF - second.vl_ptr()->splice(second.vl_ptr()->skip_begin(), *(first.vl_ptr()), first.vl_ptr()->skip_begin(), first.vl_ptr()->skip_end()); + for_context_lists_of_all_subconstraints(constr_b /*DIFF*/, [&](Context_list* hcl, Vertex_it it, Sc_it) { + update_first_context_position(hcl, constr_b, it); // DIFF + }); - // Note that for VC8 with iterator debugging the iterators pointing into second - // are NOT valid So we have to update them - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = back_it; - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; - - // and update pos in the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == second.vl_ptr()){ - ctit->pos = it; - break; - } - } + if(constr_a.may_share()) { + constr_b.may_share() = true; } - constraint_set.insert(second); - - delete first.vl_ptr(); - return second.vl_ptr(); + erase_constraint(constr_a); // DIFF + return constr_b; // DIFF } @@ -792,70 +1077,82 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir // returns the new constraint template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::split(Constraint_id first, Vertex_it vcit) +Polyline_constraint_hierarchy_2::split_tail(Constraint_id constr, Vertex_it vcit) { - constraint_set.erase(first); - Vertex_list* second = new Vertex_list; - second->splice(second->skip_end(), *(first.vl_ptr()), vcit.base(), first.vl_ptr()->skip_end()); - first.vl_ptr()->push_back(second->front()); // Duplicate the common vertex - Vertex_it vit = second->skip_begin(); - vit.input() = true; - vit = first.vl_ptr()->skip_end(); - --vit; - vit.input() = true; - constraint_set.insert(first); - constraint_set.insert(second); - // We have to look at all subconstraints - for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + // constr is [A, ..., B], vcit points to M in [A, ..., B] - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second; - break; - } + Constraint_id new_constr = create_new_constraint(); + + Vertex_list_ptr constr_vl = constr.vl_ptr(); + Vertex_list_ptr new_vl = new_constr.vl_ptr(); + + vcit.input() = true; + auto middle_node = Node(*vcit, true); + + // Let's split, that way: + // constr = [A, ..., M] + // new_constr = [M, ..., B] + + // The splice does: + // constr = [A, ..., M[ (without M) + // new_constr = [M, ..., B] + new_vl->splice(new_vl->skip_end(), *constr_vl, vcit.base(), constr_vl->skip_end()); + constr_vl->push_back(middle_node); // add M to the end of constr + + CGAL_assertion(vcit.base() == new_vl->skip_begin()); + CGAL_assertion(new_vl->front().input() == true); + CGAL_assertion(constr_vl->back().input() == true); + + bool new_constr_share = false; + for_context_lists_of_all_subconstraints(new_constr, [&](Context_list* hcl, Vertex_it, Sc_it) { + if(constr.may_share() && hcl->size() > 1) { + new_constr_share = true; } - } - return second; + replace_first_in_context_list(hcl, constr, new_constr); + }); + + new_constr.may_share() = new_constr_share; + return new_constr; } template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::split2(Constraint_id first, Vertex_it vcit) +Polyline_constraint_hierarchy_2::split_head(Constraint_id constr, Vertex_it vcit) { - constraint_set.erase(first); - Vertex_list* second = new Vertex_list; - second->splice(second->skip_end(), *first.vl_ptr(), first.vl_ptr()->skip_begin(), vcit.base()); - second->push_back(first.vl_ptr()->front()); // Duplicate the common vertex - Vertex_it vit = second->skip_end(); - --vit; - vit.input() = true; - vit = first.vl_ptr()->skip_begin(); - vit.input() = true; - constraint_set.insert(first); - constraint_set.insert(second); - // We have to look at all subconstraints - for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + // constr is [A, ..., B], vcit points to M in [A, ..., B] - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second; - break; - } + Constraint_id new_constr = create_new_constraint(); + + Vertex_list_ptr constr_vl = constr.vl_ptr(); + Vertex_list_ptr new_vl = new_constr.vl_ptr(); + + vcit.input() = true; + auto middle_node = Node(*vcit, true); + + // Let's split, that way: + // constr = [M, ..., B] + // new_constr = [A, ..., M] + + // The splice does: + // constr = [M, ..., B] + // new_constr = [A, ..., M[ (without M) + new_vl->splice(new_vl->skip_end(), *constr_vl, constr_vl->skip_begin(), vcit.base()); + new_vl->push_back(middle_node); // add M to the end of new_constr + + CGAL_assertion(vcit.base() == constr_vl->skip_begin()); + CGAL_assertion(constr_vl->front().input() == true); + CGAL_assertion(new_vl->back().input() == true); + + bool new_constr_share = false; + for_context_lists_of_all_subconstraints(new_constr, [&](Context_list* hcl, Vertex_it, Sc_it) { + if(constr.may_share() && hcl->size() > 1) { + new_constr_share = true; } - } - return second; + replace_first_in_context_list(hcl, constr, new_constr); + }); + + new_constr.may_share() = new_constr_share; + return new_constr; } @@ -864,71 +1161,36 @@ when a constraint is inserted, it is, at first, both a constraint and a subconstraint */ template -typename Polyline_constraint_hierarchy_2::Vertex_list* +typename Polyline_constraint_hierarchy_2::Constraint_id Polyline_constraint_hierarchy_2:: insert_constraint(T va, T vb){ - Edge he = make_edge(va, vb); - Vertex_list* children = new Vertex_list; - Context_list* fathers; - -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 using CGAL::IO::oformat; std::cerr << CGAL::internal::cdt_2_indent_level << "C_hierachy.insert_constraint( " << IO::oformat(va) << ", " << IO::oformat(vb) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); - if(scit == sc_to_c_map.end()){ - fathers = new Context_list; - sc_to_c_map.insert(std::make_pair(he,fathers)); - } else { - fathers = scit->second; +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 + Constraint_id cid = create_new_constraint(); + auto& context_list_ptr = contexts_of(va, vb); + if(context_list_ptr == nullptr){ + context_list_ptr = new Context_list; } - children->push_front(Node(va, true)); // was he.first - children->push_back(Node(vb, true)); // was he.second - constraint_set.insert(children); - Context ctxt; - ctxt.enclosing = children; - ctxt.pos = children->skip_begin(); - fathers->push_front(ctxt); + auto children = cid.vl_ptr(); + children->push_front(Node(va, true)); + children->push_back(Node(vb, true)); + context_list_ptr->emplace_front(cid, cid.begin()); + fix_may_share_in_contexts_constraints(*context_list_ptr); - return children; + return cid; } template -typename Polyline_constraint_hierarchy_2::Vertex_list* +typename Polyline_constraint_hierarchy_2::Constraint_id Polyline_constraint_hierarchy_2:: insert_constraint_old_API(T va, T vb){ - Edge he = make_edge(va, vb); - - Vertex_list* children = new Vertex_list; - Context_list* fathers; - -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS - using CGAL::IO::oformat; - std::cerr << CGAL::internal::cdt_2_indent_level - << "C_hierachy.insert_constraint_old_API( " - << IO::oformat(va) << ", " << IO::oformat(vb) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); - if(scit == sc_to_c_map.end()){ - fathers = new Context_list; - sc_to_c_map.insert(std::make_pair(he,fathers)); - } else { - fathers = scit->second; - } - - children->push_front(Node(va, true)); // was he.first - children->push_back(Node(vb, true)); // was he.second - constraint_set.insert(children); - Context ctxt; - ctxt.enclosing = children; - ctxt.pos = children->skip_begin(); - fathers->push_front(ctxt); - - return children; + return insert_constraint(va, vb); } @@ -936,30 +1198,22 @@ template void Polyline_constraint_hierarchy_2:: append_constraint(Constraint_id cid, T va, T vb){ - Edge he = make_edge(va, vb); - Context_list* fathers; - -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 using CGAL::IO::oformat; std::cerr << CGAL::internal::cdt_2_indent_level << "C_hierachy.append_constraint( ..., " << IO::oformat(va) << ", " << IO::oformat(vb) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); - if(scit == sc_to_c_map.end()){ - fathers = new Context_list; - sc_to_c_map.insert(std::make_pair(he,fathers)); - } else { - fathers = scit->second; +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 + auto& context_list_ptr = contexts_of(va, vb); + if(context_list_ptr == nullptr){ + context_list_ptr = new Context_list; } - typename Vertex_list::skip_iterator bit = cid.vl_ptr()->skip_end(); - --bit; + auto pos_va = std::prev(cid.end()); + CGAL_assertion(pos_va->vertex() == va); cid.vl_ptr()->push_back(Node(vb, true)); - Context ctxt; - ctxt.enclosing = cid.vl_ptr(); - ctxt.pos = bit; - fathers->push_front(ctxt); + context_list_ptr->emplace_front(cid, pos_va); + fix_may_share_in_contexts_constraints(*context_list_ptr); } @@ -967,80 +1221,20 @@ template void Polyline_constraint_hierarchy_2:: clear() { - C_iterator cit; - Sc_iterator scit; // clean and delete vertices lists - for(cit=constraint_set.begin(); cit != constraint_set.end(); cit++){ - cit->vl_ptr()->clear(); - delete cit->vl_ptr(); + for(auto cid : constraints()) { + cid.clear(); + cid.destroy(); } // clean and delete context lists - for(scit=sc_to_c_map.begin(); scit != sc_to_c_map.end(); scit++){ - (*scit).second->clear(); - delete (*scit).second; + for(auto& [_, cl_ptr] : priv.sc_to_c_map) { + cl_ptr->clear(); + delete cl_ptr; } - sc_to_c_map.clear(); - constraint_set.clear(); + priv = Priv(priv.comp); } -template -bool Polyline_constraint_hierarchy_2:: -next_along_sc(T va, T vb, T& w) const -{ - // find the next vertex after vb along any enclosing constrained - // return false if there is no .... - Context_iterator ctxtit, past; - if(!get_contexts(va, vb, ctxtit, past)) CGAL_assertion(false); - - Vertex_it pos; - for( ; ctxtit != past; ctxtit++){ - pos = ctxtit->pos; - if((*pos)==va) { - ++pos; ++pos; - if (pos != ctxtit->enclosing->end()) { w=(*pos); return true;} - } - else { - if (pos != ctxtit->enclosing->begin()) {--pos; w=(*pos); return true;} - } - } - return false; -} - - - -/* - Attention, le point v DOIT etre un point de Steiner, - et les segments va,v et v,vb sont des sous contraintes. -*/ -template -void Polyline_constraint_hierarchy_2:: -remove_Steiner(T v, T va, T vb) -{ - // remove a Steiner point - CGAL_precondition(!is_constrained_vertex(v)); - - Context_list* hcl1; - Context_list* hcl2; - if(!get_contexts(va,v,hcl1)) CGAL_assertion(false); - if(!get_contexts(v,vb,hcl2)) CGAL_assertion(false); - - Vertex_it pos; - for(Context_iterator ctit=hcl1->begin(); ctit != hcl1->end(); ctit++){ - pos = ctit->pos; - if((*pos)==va) pos++; - pos = ctit->enclosing->erase(pos); - ctit->pos = --pos; - } - - sc_to_c_map.erase(make_edge(va,v)); - sc_to_c_map.erase(make_edge(v,vb)); - delete hcl2; - sc_to_c_map.insert(std::make_pair(make_edge(va,vb),hcl1)); -} - - - /* same as add_Steiner precondition : va,vb est une souscontrainte. @@ -1055,189 +1249,159 @@ split_constraint(T va, T vb, T vc){ template void Polyline_constraint_hierarchy_2:: -add_Steiner(T va, T vb, T vc){ -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +add_Steiner(const T va, const T vb, const T vc){ +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 using CGAL::IO::oformat; std::cerr << CGAL::internal::cdt_2_indent_level << "C_hierachy.add_Steinter( " << IO::oformat(va) << ", " << IO::oformat(vb) << ", " << IO::oformat(vc) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - Context_list* hcl=nullptr; - if(!get_contexts(va,vb,hcl)) { -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 + Sc_iterator sc_iter_va_vb = find_contexts(va, vb); + if(sc_iter_va_vb == contexts_not_found()) { +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 std::cerr << CGAL::internal::cdt_2_indent_level << " -> the constraint is already split\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 return; } - Context_list* hcl2 = new Context_list; + Context_list* va_vb_cl = sc_iter_va_vb->second; + erase_context(sc_iter_va_vb); + Context_list*& vc_vb_cl_ref = contexts_of(vc,vb); - Vertex_it pos; - Context ctxt; - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - // insert vc in enclosing constraint - pos = ctit->current(); - ++pos; - pos = ctit->enclosing->insert(pos.base(), Node(vc)); - --pos; + if(vc_vb_cl_ref == nullptr) { + vc_vb_cl_ref = new Context_list; + } - // set ctxt to the context of (vc,vb) - // change *ctit in hcl to the context of (va,vc) - // add ctxt to hcl2 list - ctxt.enclosing = ctit->enclosing; - if(*pos == va) { - ctit->pos = pos; - ctxt.pos = ++pos; + Context_list* vc_vb_cl = vc_vb_cl_ref; + + for(Context& ctxt : *va_vb_cl) { + Vertex_it pos = ctxt.current(); + Vertex_it next_pos = std::next(pos); + + // [pos, next_pos] is the subconstraint (va,vb) or (vb,va) + CGAL_assertion( (va == *pos && vb == *next_pos) || (vb == *pos && va == *next_pos) ); + // insert vc in enclosing constraint, just before `next_pos` + Vertex_it pos_vc = ctxt.enclosing.vl_ptr()->insert(next_pos.base(), Node(vc)); + pos = std::prev(pos_vc); + + // now (pos, pos_vc, next_pos) is (va,vc,vb) or (vb,vc,va) + + // change ctxt in va_vb_cl to the context of (va,vc) + Context& va_vc_ctxt = ctxt; + Context vc_vb_ctxt{ctxt}; + if(*pos == va) { // (pos, pos_vc, next_pos) is (va,vc,vb) + va_vc_ctxt.pos = pos; + vc_vb_ctxt.pos = pos_vc; } - else { //(*pos)==vb - ctxt.pos = pos; - ctit->pos = ++pos; + else { // (pos, pos_vc, next_pos) is (vb,vc,va) + vc_vb_ctxt.pos = pos; + va_vc_ctxt.pos = pos_vc; } - hcl2->push_back(ctxt); + vc_vb_cl->push_back(vc_vb_ctxt); } - Context_list* hcl3; - if (get_contexts(va,vc,hcl3)) { // (va,vc) is already a subconstraint - hcl3->splice(hcl3->end(), *hcl); - delete hcl; + Context_list*& va_vc_cl = contexts_of(va,vc); + if (va_vc_cl != nullptr) { // (va,vc) was already a subconstraint + va_vc_cl->splice(va_vc_cl->end(), *va_vb_cl); + delete va_vb_cl; + } else { + va_vc_cl = va_vb_cl; } - else sc_to_c_map.insert(std::make_pair(make_edge(va,vc), hcl)); - if (get_contexts(vc,vb,hcl3)) {// (vc,vb) is already a subconstraint - hcl3->splice(hcl3->end(),*hcl2); - - delete hcl2; - } - else sc_to_c_map.insert(std::make_pair(make_edge(vc,vb), hcl2)); - - - sc_to_c_map.erase(make_edge(va,vb)); - return; + fix_may_share_in_contexts_constraints(*va_vc_cl); + fix_may_share_in_contexts_constraints(*vc_vb_cl); } template inline -typename Polyline_constraint_hierarchy_2::Edge +typename Polyline_constraint_hierarchy_2::Context_list* Polyline_constraint_hierarchy_2:: -make_edge(T va, T vb) const +get_context_list(T va, T vb) const { - return comp(va, vb) ? Edge(va,vb) : Edge(vb,va); -} - -template -inline -bool -Polyline_constraint_hierarchy_2:: -get_contexts(T va, T vb, Context_list* & hcl) const -{ - Sc_iterator sc_iter = sc_to_c_map.find(make_edge(va,vb)); - if( sc_iter == sc_to_c_map.end() ) return(false); - hcl = (*sc_iter).second; - return true; -} - -template -inline -bool -Polyline_constraint_hierarchy_2:: -get_contexts(T va, T vb, - Context_iterator& ctxt, - Context_iterator& past) const -{ - Context_list* hcl; - if (!get_contexts(va,vb,hcl)) return false; - ctxt = hcl->begin(); - past = hcl->end(); - return true; -} - - - -template -inline -typename Polyline_constraint_hierarchy_2::Vertex_it -Polyline_constraint_hierarchy_2:: -get_pos(T va, T vb) const - //return pos in the first context -{ - return (*sc_to_c_map.find(make_edge(va,vb))).second->begin().pos; -} - -template -void -Polyline_constraint_hierarchy_2:: -oriented_end(T va, T vb, T& vc) const -{ - Context_iterator ctxt, past; - if(!get_contexts(va,vb, ctxt, past) ) CGAL_assertion(false); - if(*(ctxt->pos) == va) - vc = ctxt->enclosing->back(); + Sc_iterator sc_iter = find_contexts(va, vb); + if(sc_iter == contexts_not_found()) + return nullptr; else - vc = ctxt->enclosing->front(); + return sc_iter->second; +} + +template +inline +auto Polyline_constraint_hierarchy_2:: +contexts(T va, T vb) const -> Iterator_range +{ + Context_list* hcl = get_context_list(va,vb); + if (nullptr == hcl) return {}; + else return {hcl->begin(), hcl->end()}; } template void Polyline_constraint_hierarchy_2:: -print() const +print(std::ostream& os) const { - C_iterator hcit; - std::map vertex_num; + std::map vertex_num_map; int num = 0; - for(hcit = c_begin(); hcit != c_end(); hcit++) { - Constraint_id cid = (*hcit); - Vertex_it vit =cid.vl_ptr()->skip_begin(), end = cid.vl_ptr()->skip_end(); - for (;vit != end; vit++){ - num ++; - vertex_num.insert(std::make_pair((*vit), num)); + for(const auto& cid : constraints()) { + for (const auto& node : cid.elements()){ + vertex_num_map.emplace(node.vertex(), ++num); } } -// typename std::map::iterator vnit = vertex_num.begin(); -// for(; vnit != vertex_num.end(); vnit++) { -// vnit->second = ++num; -// std::cerr << "vertex num " << num << " " << vnit->first->point() -// << std::endl; -// } - C_iterator cit=c_begin(); - Sc_iterator scit=sc_begin(); + auto disp_vertex = [&vertex_num_map](Vertex_handle v) { + return CGAL::IO::oformat( + [v, &vertex_num_map](auto& os) -> decltype(os)& { + constexpr bool star_v_has_timestamp = + internal::has_timestamp_v>; + if constexpr(star_v_has_timestamp) { + CGAL_USE(vertex_num_map); + return os << '#' << v->time_stamp(); + } else { + auto it = vertex_num_map.find(v); + auto n = (it == vertex_num_map.end()) ? -1 : it->second; + return os << n; + } + }, + IO_manip_tag{}); + }; - for(; cit != c_end(); cit++){ - std::cout << std::endl ; - std::cout << "constraint " ; - std::cout << cit->vl_ptr(); - std::cout << " subconstraints " ; - Vertex_it vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end(); - for(; vit != end; vit++){ - std::cout << vertex_num[*vit] <<" "; + os << "# number of constraints: " << number_of_constraints() << std::endl; + for(const auto& cid : constraints()) { + os << "constraint(" << cid.index() << ") "; + os << cid.vl_ptr(); + os << "\n vertex list "; + for(const auto& node : cid.elements()) { + os << disp_vertex(node.vertex()) << " "; } - vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end(); - for(; vit != end; vit++){ - std::cout << (*vit)->point() <<" "; + os << "\n corresponding points: "; + for(const auto& node : cid.elements()) { + os << node.point() << " "; } + if(cid.may_share()) { + os << "\n (may have non-simple context lists)"; + } + os << std::endl; } - std::cout << std::endl ; - for(;scit != sc_end(); scit++){ - std::cout << "subconstraint " ; - std::cout << vertex_num[scit->first.first] << " " - << vertex_num[scit->first.second]; - Context_iterator cb, ce; - get_contexts(scit->first.first, scit->first.second, cb, ce); + os << std::endl; + os << "# number of subconstraints: " << number_of_subconstraints() << std::endl; + for(const auto& subconstraint : subconstraints()) { + os << "subconstraint ("; + os << disp_vertex(subconstraint.first) << ", " + << disp_vertex(subconstraint.second) << ")"; - std::cout << " enclosing " ; - for(; cb != ce; cb++) { - std::cout << cb->id().vl_ptr(); - std::cout << " " ; + os << " enclosing: "; + for(const auto& ctxt : contexts(subconstraint.first, subconstraint.second)) { + os << "(cid " << ctxt.id().index() << ") " << ctxt.id().vl_ptr(); + os << ", pos: " << std::distance(ctxt.vertices_begin(), ctxt.pos) << " "; } - std::cout << std::endl ; + os << std::endl; } return; } - } //namespace CGAL #endif // CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H diff --git a/Triangulation_2/test/Triangulation_2/CMakeLists.txt b/Triangulation_2/test/Triangulation_2/CMakeLists.txt index 341976b159f..9f78f053245 100644 --- a/Triangulation_2/test/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/test/Triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_2_Tests) find_package(CGAL REQUIRED) diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h index e2cc92ba8b7..a571a364395 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h @@ -81,6 +81,9 @@ _test_cls_const_triang_plus_2( const TrP & ) assert( (*currentin2 == va && *++currentin2 == vb) || (*currentin2 == vb && *++currentin2 == va)); + //test copy of the hierarchy + auto hierarchy = trp.hierarchy_ref(); + //test copy and swap std::cout << "test copy and swap" << std::endl; TrP trp2(trp); @@ -151,7 +154,7 @@ _test_cls_const_triang_plus_2( const TrP & ) std::size_t n = 0; for(Constraint_iterator cit = trp.constraints_begin(); cit != trp.constraints_end(); ++cit){ Constraint_id cid = *cit; - n += cid.second->all_size(); + n += cid.vl_ptr()->all_size(); } assert( n == 9); } diff --git a/Triangulation_2/test/Triangulation_2/issue_4025.cpp b/Triangulation_2/test/Triangulation_2/issue_4025.cpp index b56894bd16c..784d4570860 100644 --- a/Triangulation_2/test/Triangulation_2/issue_4025.cpp +++ b/Triangulation_2/test/Triangulation_2/issue_4025.cpp @@ -1,89 +1,193 @@ -#include -#include +// This code was first submitted in an issue: +// https://github.com/CGAL/cgal/issues/4025 +// and then rewrote a lot, keeping the observed behavior. + +#include #include #include +#include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Exact_intersections_tag Itag_; -typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; -typedef CGAL::Constrained_triangulation_plus_2 CDTP; +#include +#include +#include -typedef CDTP::Point Point; -typedef CDTP::Constraint_id Cid; -typedef CDTP::Vertex_handle Vertex_handle; -typedef CDTP::Constraint_id Constraint_id; -typedef CDTP::Vertices_in_constraint_iterator Vertices_in_constraint_iterator; +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Polygon_2 = CGAL::Polygon_2; +using Itag_ = CGAL::Exact_intersections_tag; +using Vb = CGAL::Base_with_time_stamp>; +using Cb = CGAL::Base_with_time_stamp>; +using Tds = CGAL::Triangulation_data_structure_2; +using CDT = CGAL::Constrained_Delaunay_triangulation_2; +using CDTP = CGAL::Constrained_triangulation_plus_2; -int countVertex(CDTP &cdtp, CDTP::Constraint_id id) +using Point = CDTP::Point; +using Vertex_handle = CDTP::Vertex_handle; +using Constraint_id = CDTP::Constraint_id; +using Vertices_in_constraint_iterator = CDTP::Vertices_in_constraint_iterator; + +auto nb_of_vertices(CDTP &cdtp, Constraint_id id) { - Vertices_in_constraint_iterator v=cdtp.vertices_in_constraint_begin(id); - - int count=0; - while(v!=cdtp.vertices_in_constraint_end(id)) - { - count++; - v++; - } - - return count; + return static_cast(std::distance(cdtp.vertices_in_constraint_begin(id), + cdtp.vertices_in_constraint_end(id))); } +template +decltype(auto) value_check_expected(V&& value, [[maybe_unused]] const E& expected) +{ + assert(value == expected); + return std::forward(value); +}; + +auto oformat(Vertex_handle vh) +{ + return CGAL::IO::oformat(vh, CGAL::With_point_tag{}); +}; int main() { CDTP cdtp; - std::list pointsListCollinear; + auto print_cdtp = [&cdtp](std::string_view msg) + { + std::cout << msg << std::endl; + cdtp.print_hierarchy(std::cout); + }; - pointsListCollinear.push_back(Point(0,0)); - pointsListCollinear.push_back(Point(0,1)); - pointsListCollinear.push_back(Point(0,2)); - pointsListCollinear.push_back(Point(0,3)); - pointsListCollinear.push_back(Point(0,4)); - pointsListCollinear.push_back(Point(0,5)); + const std::array collinear_points = { + Point(0,0), Point(0,1), Point(0,2), Point(0,3), Point(0,4), Point(0,5) + }; - std::list pointsListNoCollinear; + const std::array non_collinear_points = { + Point(1,0), Point(2,1), Point(4,2), Point(2,3), Point(4,4), Point(1,5) + }; - pointsListNoCollinear.push_back(Point(1,0)); - pointsListNoCollinear.push_back(Point(2,1)); - pointsListNoCollinear.push_back(Point(4,2)); - pointsListNoCollinear.push_back(Point(2,3)); - pointsListNoCollinear.push_back(Point(4,4)); - pointsListNoCollinear.push_back(Point(1,5)); + Constraint_id collinear_cid = cdtp.insert_constraint(collinear_points.begin(), collinear_points.end()); + Constraint_id non_collinear_cid = cdtp.insert_constraint(non_collinear_points.begin(), non_collinear_points.end()); + + print_cdtp("Initial state"); + + Vertices_in_constraint_iterator vertex_it = std::next(cdtp.vertices_in_constraint_begin(collinear_cid), 2); + Vertex_handle v = *vertex_it; + [[maybe_unused]] auto next_it = std::next(vertex_it); + std::cout << "\n-> attempt to remove vertex " << oformat(*vertex_it) << std::endl; + vertex_it = cdtp.remove_vertex_from_constraint(collinear_cid, vertex_it); + std::cout << " cdtp.remove_vertex_from_constraint(collinear_cid, vertex_it) returned the vertex " + << oformat(*vertex_it) << std::endl; + assert(vertex_it == next_it); + assert(cdtp.tds().is_vertex(v)); // v (0, 2) is still in the triangulation + + print_cdtp("\nAfter removing third vertex from the collinear constraint"); + + // The first constraint (ID `collinear_cid`) is collinear. `cdtp.remove_vertex_from_constraint` + // cannot remove the third vertex from it, because it is collinear with the triangulation vertex + // with the point (0, 2). + + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 10U) << std::endl; + std::cout << "number of constraints: " + << value_check_expected(cdtp.number_of_constraints(), 2U) << std::endl; + std::cout << "number of vertex in collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, collinear_cid), 6U) << std::endl; + + vertex_it = std::next(cdtp.vertices_in_constraint_begin(non_collinear_cid), 2); + Vertex_handle v2 = *vertex_it; + next_it = std::next(vertex_it); + std::cout << "\n-> attempt to remove vertex " << oformat(*vertex_it) << std::endl; + vertex_it = cdtp.remove_vertex_from_constraint(non_collinear_cid, vertex_it); + std::cout << " cdtp.remove_vertex_from_constraint(non_collinear_cid, vertex_it) returned the vertex " + << oformat(*vertex_it) << std::endl; + assert(vertex_it == next_it); + assert(cdtp.tds().is_vertex(v2)); // v2 (4, 2) is still in the triangulation + + print_cdtp("\nAfter removing third vertex from the non-collinear constraint"); + + std::cout << "number of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 9U) << std::endl; + std::cout << "number of constraints: " + << value_check_expected(cdtp.number_of_constraints(), 2U) << std::endl; + std::cout << "number of vertex in non-collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, non_collinear_cid), 5U) << std::endl; + + // re-insert v and v2 in the their constraints + vertex_it = cdtp.insert_vertex_in_constraint(collinear_cid, + std::next(cdtp.vertices_in_constraint_begin(collinear_cid), 2), + v); + assert(*vertex_it == v); + assert(std::distance(cdtp.vertices_in_constraint_begin(collinear_cid), vertex_it) == 2); + vertex_it = cdtp.insert_vertex_in_constraint(non_collinear_cid, + std::next(cdtp.vertices_in_constraint_begin(non_collinear_cid), 2), + v2); + assert(*vertex_it == v2); + assert(std::distance(cdtp.vertices_in_constraint_begin(non_collinear_cid), vertex_it) == 2); + + print_cdtp("\nAfter re-inserting the two vertices in their constraint"); + + std::cout << "number of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 10U) << std::endl; + std::cout << "number of constraints: " + << value_check_expected(cdtp.number_of_constraints(), 2U) << std::endl; + std::cout << "number of vertex in collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, collinear_cid), 6U) << std::endl; + std::cout << "number of vertex in non-collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, non_collinear_cid), 6U) << std::endl; + + // NOW test another scenario, that has nothing to do with the issue #4025 + cdtp.clear(); + print_cdtp("\nAfter clearing the constrained triangulation"); - Constraint_id ctIdCollinear=cdtp.insert_constraint(pointsListCollinear.begin(),pointsListCollinear.end()); - Constraint_id ctIdNoCollinear=cdtp.insert_constraint(pointsListNoCollinear.begin(),pointsListNoCollinear.end()); + // Let's insert a constraint with a loop + // (1,1) + // / | + // / | + // start-->(0,0) X-->(1,0) + // / + // / + // (-1,-1) + const std::array looping_cid = { + Point(0,0), Point(1,0), Point(1,1), Point(-1,-1) + }; + cdtp.insert_constraint(looping_cid.begin(), looping_cid.end()); + print_cdtp("\nAfter inserting a looping constraint"); + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 4U) << std::endl; - //******************************* attempt with the collinear constraint - Vertices_in_constraint_iterator vertexToRemoveCollinear=cdtp.vertices_in_constraint_begin(ctIdCollinear); - vertexToRemoveCollinear++; - vertexToRemoveCollinear++; + // NOW test another scenario + cdtp.clear(); + print_cdtp("\nAfter clearing the constrained triangulation"); + // Let's insert a constraint with identical sub-constraints + // (1,1) + // / | + // / | + // start-->(0,0)-->(1,0)--->(3,0) + const std::array overlaping_cid = {Point(0, 0), Point(1, 0), Point(1, 1), + Point(0, 0), Point(3, 0)}; + cdtp.insert_constraint(overlaping_cid.begin(), overlaping_cid.end()); + print_cdtp("\nAfter inserting a constraint with overlapping subconstraints"); + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 4U) + << "\ncdtp.subconstraints.size(): " + << value_check_expected(cdtp.subconstraints().size(), 4U) << std::endl; - - std::cout<<"attempt to remove vertex "<<(*vertexToRemoveCollinear)->point().x()<<" , "<<(*vertexToRemoveCollinear)->point().y() < 5, expected 4 - std::cout<<"number of constraints "< 1 - std::cout<<"number of vertex in constraint "< 6, expected 5 - - - //******************************* attempt with the collinear constraint - Vertices_in_constraint_iterator vertexToRemoveNoCollinear=cdtp.vertices_in_constraint_begin(ctIdNoCollinear); - vertexToRemoveNoCollinear++; - vertexToRemoveNoCollinear++; - - std::cout<<"attempt to remove vertex "<<(*vertexToRemoveNoCollinear)->point().x()<<" , "<<(*vertexToRemoveNoCollinear)->point().y() << std::endl; - cdtp.remove_vertex_from_constraint(ctIdNoCollinear,vertexToRemoveNoCollinear); - - std::cout<<"number of subconstraints "< 4, ok - std::cout<<"number of constraints "< 1 - std::cout<<"number of vertex in constraint "< 5, ok + // NOW test another scenario + cdtp.clear(); + print_cdtp("\nAfter clearing the constrained triangulation"); + // Let's insert two constraints with four points each and one common segment in the middle + // start-->(0,1) (3,1) + // \ / + // \ / + // start-->(0,0)--->(1,0)===>(2,0)--->(3,0) + const std::array first_cid = {Point(0, 0), Point(1, 0), Point(2, 0), Point(3, 0)}; + const std::array second_cid = {Point(0, 1), Point(1, 0), Point(2, 0), Point(3, 1)}; + cdtp.insert_constraint(first_cid.begin(), first_cid.end()); + cdtp.insert_constraint(second_cid.begin(), second_cid.end()); + print_cdtp("\nAfter inserting two constraints with a common segment in the middle"); + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 5U) + << "\ncdtp.subconstraints.size(): " + << value_check_expected(cdtp.subconstraints().size(), 5U) << std::endl; return 0; - } diff --git a/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt b/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt index 5a6b5b4474c..419938ed36e 100644 --- a/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt @@ -1,29 +1,13 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3) # CGAL and its components find_package(CGAL REQUIRED) -# Boost and its components -find_package(Boost REQUIRED) - -if(NOT Boost_FOUND) - - message( - STATUS "This project requires the Boost library, and will not be compiled.") - - return() - -endif() - -# include for local directory - -# include for local package - # Creating entries for all C++ files with "main" routine # ########################################################## diff --git a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt index df83176883d..a46df3c2e84 100644 --- a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3_Demo) # Find includes in corresponding build directories diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index 1c8eb7b1584..2a9989ce852 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index b90ecd55af3..70cc966fc1f 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3_Tests) find_package(CGAL REQUIRED) diff --git a/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt index 7b4e8858a12..b69f26cca91 100644 --- a/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Triangulation_on_sphere_2_Benchmarks ) diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt index 076adb04ea7..380d8b0ad72 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project (Triangulation_on_sphere_2_Demo) diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp index 71cae05953d..1579f45389a 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp @@ -69,7 +69,7 @@ public slots: if (list.size()!=4){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 4 doubles: The radius first, then the coordinates of the center."); + msgBox->setText("ERROR : Input should consist of 4 doubles: The radius first, then the coordinates of the center."); msgBox->exec(); return; } diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt index 80173de13c7..da864c07bb8 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Triangulation_on_sphere_2_Examples ) diff --git a/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt index 6120e72d373..f41b7819920 100644 --- a/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Triangulation_on_sphere_2_Tests ) diff --git a/Union_find/test/Union_find/CMakeLists.txt b/Union_find/test/Union_find/CMakeLists.txt index 1fa61d78d72..5026bd87ee7 100644 --- a/Union_find/test/Union_find/CMakeLists.txt +++ b/Union_find/test/Union_find/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Union_find_Tests) find_package(CGAL REQUIRED) diff --git a/Visibility_2/examples/Visibility_2/CMakeLists.txt b/Visibility_2/examples/Visibility_2/CMakeLists.txt index 6a95ae841ca..545c4e885e0 100644 --- a/Visibility_2/examples/Visibility_2/CMakeLists.txt +++ b/Visibility_2/examples/Visibility_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Visibility_2_Examples) find_package(CGAL REQUIRED) diff --git a/Visibility_2/test/Visibility_2/CMakeLists.txt b/Visibility_2/test/Visibility_2/CMakeLists.txt index 8cb1638680b..10500645465 100644 --- a/Visibility_2/test/Visibility_2/CMakeLists.txt +++ b/Visibility_2/test/Visibility_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Visibility_2_Tests) find_package(CGAL REQUIRED) diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt index 58edde2ec5a..898f2932d71 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt @@ -20,7 +20,6 @@ /*! \addtogroup PkgVoronoiDiagram2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Voronoi Diagram Adaptor,PkgVoronoiDiagram2} \cgalPkgPicture{voronoi.png} \cgalPkgSummaryBegin diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt index a0c18e3d250..f7e5cdd4475 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Voronoi_diagram_2_Examples) find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Qt6) diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt index de9e0f7256e..e08fd207164 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Voronoi_diagram_2_Tests) diff --git a/Weights/examples/Weights/CMakeLists.txt b/Weights/examples/Weights/CMakeLists.txt index 629ba82340d..6679efdee36 100644 --- a/Weights/examples/Weights/CMakeLists.txt +++ b/Weights/examples/Weights/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Weights_Examples) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 4f389e3b06b..34a6d79f178 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -344,7 +344,6 @@ public: return cotangent_weight_calculator(he); } -private: FT voronoi(const vertex_descriptor v0) const { auto squared_length_3 = m_traits.compute_squared_length_3_object(); @@ -354,11 +353,12 @@ private: 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; + CGAL_assertion(CGAL::is_triangle(he, m_pmesh)); + const vertex_descriptor v1 = source(he, m_pmesh); const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 850fccff1e8..80822b68c84 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -44,7 +44,7 @@ private: public: FT operator()(const FT value) const { - return static_cast(CGAL::sqrt(CGAL::to_double(CGAL::abs(value)))); + return CGAL::approximate_sqrt(CGAL::abs(value)); } }; diff --git a/Weights/test/Weights/CMakeLists.txt b/Weights/test/Weights/CMakeLists.txt index 02aef6a76c5..36e7ba70117 100644 --- a/Weights/test/Weights/CMakeLists.txt +++ b/Weights/test/Weights/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Weights_Tests)