diff --git a/.travis.yml b/.travis.yml index 0adae4a60b4..80677c4c030 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ before_script: - sudo chmod +x /usr/bin/doxygen - mkdir -p build - cd build - - /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++11" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON .. + - /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++1y" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON .. - /usr/bin/time -f 'Spend time of %C -- %E (real)' make - /usr/bin/time -f 'Spend time of %C -- %E (real)' sudo make install &>/dev/null - cd .. diff --git a/.travis/template.txt b/.travis/template.txt index 5c70fa11ca0..48d2facb8ce 100644 --- a/.travis/template.txt +++ b/.travis/template.txt @@ -19,7 +19,7 @@ before_script: - sudo chmod +x /usr/bin/doxygen - mkdir -p build - cd build - - /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++11" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON .. + - /usr/bin/time -f 'Spend time of %C -- %E (real)' cmake -DCMAKE_CXX_FLAGS="-std=c++1y" -DCGAL_HEADER_ONLY=ON -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON .. - /usr/bin/time -f 'Spend time of %C -- %E (real)' make - /usr/bin/time -f 'Spend time of %C -- %E (real)' sudo make install &>/dev/null - cd .. diff --git a/AABB_tree/benchmark/AABB_tree/CMakeLists.txt b/AABB_tree/benchmark/AABB_tree/CMakeLists.txt index 077df0007ca..0716a91ec94 100644 --- a/AABB_tree/benchmark/AABB_tree/CMakeLists.txt +++ b/AABB_tree/benchmark/AABB_tree/CMakeLists.txt @@ -1,19 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( AABB_traits_benchmark) - -cmake_minimum_required(VERSION 3.1) - cmake_policy(VERSION 3.1) - - -if ( COMMAND cmake_policy ) - - cmake_policy( SET CMP0003 NEW ) - -endif() - # CGAL and its components find_package( CGAL QUIET) if ( CGAL_FOUND ) diff --git a/AABB_tree/demo/AABB_tree/CMakeLists.txt b/AABB_tree/demo/AABB_tree/CMakeLists.txt index 11a5922ccf6..a0c5d53950a 100644 --- a/AABB_tree/demo/AABB_tree/CMakeLists.txt +++ b/AABB_tree/demo/AABB_tree/CMakeLists.txt @@ -1,12 +1,12 @@ # This is the CMake script for compiling the AABB tree demo. +cmake_minimum_required(VERSION 3.1...3.15) project( AABB_tree_Demo ) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -cmake_minimum_required(VERSION 3.1) 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/AABB_tree/examples/AABB_tree/CMakeLists.txt b/AABB_tree/examples/AABB_tree/CMakeLists.txt index c3317a79f65..87fa3857ab5 100644 --- a/AABB_tree/examples/AABB_tree/CMakeLists.txt +++ b/AABB_tree/examples/AABB_tree/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( AABB_tree_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/AABB_tree/test/AABB_tree/CMakeLists.txt b/AABB_tree/test/AABB_tree/CMakeLists.txt index 38a39723ead..7e06dbb8700 100644 --- a/AABB_tree/test/AABB_tree/CMakeLists.txt +++ b/AABB_tree/test/AABB_tree/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( AABB_tree_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 761ad7dd237..269a60864e8 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Advancing_front_surface_reconstruction_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 3eeeba604c0..4112e7a65ce 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Advancing_front_surface_reconstruction_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt b/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt index d30a4c846c8..64184b35a89 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt +++ b/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Algebraic_foundations_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt b/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt index 1eacdbebbfa..9b3ee11b5e7 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt +++ b/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Algebraic_foundations_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt index d6a7178ec13..901221f91d0 100644 --- a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Algebraic_kernel_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 a75ee88082e..35f3eb4d27a 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Algebraic_kernel_d_Tests ) -cmake_minimum_required(VERSION 3.1) # 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 4261dd0c584..f3b3894ae76 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Algebraic_kernel_for_circles_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 6b8567c4727..f6ef2f9d943 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Algebraic_kernel_for_spheres_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt index 79131b56ac0..977ebf3923a 100644 --- a/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Alpha_shapes_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt index 8724fa225f4..0399340218c 100644 --- a/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Alpha_shapes_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt index 6df765a5b7a..15a15504881 100644 --- a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt @@ -1,13 +1,13 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Alpha_shapes_3_Demo) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -cmake_minimum_required(VERSION 3.1) 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/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt index c9d88b3942e..749ba649534 100644 --- a/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Alpha_shapes_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt index 600a2a8ae41..9350624cb63 100644 --- a/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Alpha_shapes_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt b/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt index 07f5f6688ba..e61205e45ae 100644 --- a/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Apollonius_graph_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 65c0c68062b..a98b5dd6571 100644 --- a/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Apollonius_graph_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt index 0df7f74c0f2..2807ba14ea0 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt +++ b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Arithmetic_kernel_Tests ) -cmake_minimum_required(VERSION 3.1) 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 449c2d25303..cbb231c76f5 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,8 +1,8 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Arrangement_on_surface_2_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt index 9968ed5dfae..5f226853d87 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Arrangement_on_surface_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) 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 6df47f3371d..0ffdc893571 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 @@ -2,11 +2,11 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Arrangement_on_surface_2_Tests ) enable_testing() -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) diff --git a/BGL/examples/BGL_LCC/CMakeLists.txt b/BGL/examples/BGL_LCC/CMakeLists.txt index 1139bccedb8..0df74650e87 100644 --- a/BGL/examples/BGL_LCC/CMakeLists.txt +++ b/BGL/examples/BGL_LCC/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( BGL_LCC_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/BGL/examples/BGL_OpenMesh/CMakeLists.txt b/BGL/examples/BGL_OpenMesh/CMakeLists.txt index 118d52a20df..848b02e2604 100644 --- a/BGL/examples/BGL_OpenMesh/CMakeLists.txt +++ b/BGL/examples/BGL_OpenMesh/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( BGL_OpenMesh_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/BGL/examples/BGL_arrangement_2/CMakeLists.txt b/BGL/examples/BGL_arrangement_2/CMakeLists.txt index 55c9036e43a..676d1347aa3 100644 --- a/BGL/examples/BGL_arrangement_2/CMakeLists.txt +++ b/BGL/examples/BGL_arrangement_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( BGL_arrangement_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt index 9b1542ef967..ac3bd5256f2 100644 --- a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt +++ b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( BGL_polyhedron_3_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/BGL/examples/BGL_surface_mesh/CMakeLists.txt b/BGL/examples/BGL_surface_mesh/CMakeLists.txt index c885f703675..13ba8575799 100644 --- a/BGL/examples/BGL_surface_mesh/CMakeLists.txt +++ b/BGL/examples/BGL_surface_mesh/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( BGL_surface_mesh_Examples ) -cmake_minimum_required(VERSION 3.1) find_package( CGAL QUIET ) diff --git a/BGL/examples/BGL_triangulation_2/CMakeLists.txt b/BGL/examples/BGL_triangulation_2/CMakeLists.txt index b3e337d3040..d6bb35f7d47 100644 --- a/BGL/examples/BGL_triangulation_2/CMakeLists.txt +++ b/BGL/examples/BGL_triangulation_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( BGL_triangulation_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index 0949c353647..e7209f704d9 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -1,10 +1,10 @@ # 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.1...3.15) project( BGL_Tests ) -cmake_minimum_required(VERSION 3.1) diff --git a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt index afb44332279..2bfc68a24f3 100644 --- a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Barycentric_coordinates_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt index 1d55dbc2fd2..01ca0f52145 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Barycentric_coordinates_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Boolean_set_operations_2/archive/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt b/Boolean_set_operations_2/archive/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt index d7246839fe3..91381c3a6b5 100644 --- a/Boolean_set_operations_2/archive/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt +++ b/Boolean_set_operations_2/archive/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Boolean_set_operations_2_GraphicsView_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt b/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt index 98df7ce7446..e96e127c29f 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Boolean_set_operations_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) 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 f1069ba938b..c846aae2c29 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Boolean_set_operations_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt index 16a7ff583b6..8802463b72d 100644 --- a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Approximate_min_ellipsoid_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt b/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt index b406ed77552..6a578245a37 100644 --- a/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Min_annulus_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt b/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt index d1db7e242fe..2361ab9059e 100644 --- a/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Min_circle_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt b/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt index d0e44baa048..82d3b642425 100644 --- a/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Min_ellipse_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt b/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt index b59e56f2286..7b6caab79f6 100644 --- a/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Min_quadrilateral_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt b/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt index 685ac2e938b..158d28cebbb 100644 --- a/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Min_sphere_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 39ba7fb4af5..df0cadc7874 100644 --- a/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Min_sphere_of_spheres_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt b/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt index 76fb954b161..75e7de0f867 100644 --- a/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Rectangular_p_center_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt index f6a82d575ee..403e652475c 100644 --- a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt +++ b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Bounding_volumes_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 1d5ab39100c..15ece488e70 100644 --- a/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Box_intersection_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt index bcdb064e633..1beb02ff8d0 100644 --- a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Box_intersection_d_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/CGAL_Core/examples/Core/CMakeLists.txt b/CGAL_Core/examples/Core/CMakeLists.txt index ad932d6731a..1ff71a69b29 100644 --- a/CGAL_Core/examples/Core/CMakeLists.txt +++ b/CGAL_Core/examples/Core/CMakeLists.txt @@ -1,7 +1,7 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Core_Examples ) -cmake_minimum_required(VERSION 3.1) diff --git a/CGAL_ImageIO/archive/demo/CGALimageIO/CMakeLists.txt b/CGAL_ImageIO/archive/demo/CGALimageIO/CMakeLists.txt index a5f3c89d94b..1a27c127533 100644 --- a/CGAL_ImageIO/archive/demo/CGALimageIO/CMakeLists.txt +++ b/CGAL_ImageIO/archive/demo/CGALimageIO/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(CGALimageIO_Demo) -cmake_minimum_required(VERSION 3.1) 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/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt index 3dcdf8d8c3d..58de82637bb 100644 --- a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt +++ b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( CGALimageIO_Examples ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) diff --git a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt index 81eec777452..a5a57186c4b 100644 --- a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt +++ b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( CGAL_ImageIO_Tests ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt index 80fcb5d2695..64206c30223 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(CGAL_ipelets_Demo) -cmake_minimum_required(VERSION 3.1) 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/CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt index 25e4407eaf9..eda52201269 100644 --- a/CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/examples/CGAL_ipelets/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( CGAL_ipelets_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc901cea606..16935eafc15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ # Top level CMakeLists.txt for CGAL-branchbuild message( "== CMake setup ==" ) +cmake_minimum_required(VERSION 3.1...3.15) project(CGAL CXX C) export(PACKAGE CGAL) # Minimal version of CMake: -cmake_minimum_required(VERSION 3.1) set( CGAL_BRANCH_BUILD ON CACHE INTERNAL "Create CGAL from a Git branch" FORCE) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h index ca07a5066df..544113d0fc6 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h @@ -37,6 +37,7 @@ template < class R > class Aff_transformation_repC2; template < class R > class Translation_repC2; template < class R > class Rotation_repC2; template < class R > class Scaling_repC2; +template < class R > class Reflection_repC2; } //namespace CGAL @@ -44,6 +45,7 @@ template < class R > class Scaling_repC2; #include #include #include +#include namespace CGAL { @@ -107,6 +109,11 @@ public: else initialize_with(Scaling_repC2(s)); } + + Aff_transformationC2(const Reflection, const Line_2& l) + { + initialize_with(Reflection_repC2(l)); + } // The general case: // a 3x2 matrix for the operations combining rotation, scaling, translation @@ -128,6 +135,7 @@ public: { initialize_with(Aff_transformation_repC2(m11/w, m12/w, m21/w, m22/w)); } + Point_2 transform(const Point_2 &p) const diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h index 935f9135f4f..5a723f8ca5d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h @@ -63,6 +63,9 @@ public: virtual Aff_transformation_2 compose( const Scaling_repC2 &t) const = 0; + + virtual Aff_transformation_2 compose( + const Reflection_repC2 &t) const = 0; virtual Aff_transformation_2 inverse() const = 0; virtual bool is_even() const = 0; @@ -86,6 +89,7 @@ public: friend class Translation_repC2; friend class Rotation_repC2; friend class Scaling_repC2; +friend class Reflection_repC2; Aff_transformation_repC2() {} @@ -131,6 +135,7 @@ friend class Scaling_repC2; Aff_transformation_2 compose(const Translation_repC2 &t) const; Aff_transformation_2 compose(const Rotation_repC2 &t) const; Aff_transformation_2 compose(const Scaling_repC2 &t) const; + Aff_transformation_2 compose(const Reflection_repC2 &t) const; bool is_even() const { @@ -252,6 +257,17 @@ compose(const Scaling_repC2 &t) const t.scalefactor_ * t23); } +template < class R > +CGAL_KERNEL_LARGE_INLINE +typename Aff_transformation_repC2::Aff_transformation_2 +Aff_transformation_repC2:: +compose(const Reflection_repC2 &r) const +{ + return Aff_transformation_2( + r.cosinus_*t11+r.sinus_*t21, r.cosinus_*t12+r.sinus_*t22, r.cosinus_*(t13-r.t.x())+r.sinus_*(t23-r.t.y())+r.t.x(), + r.sinus_*(t11)-r.cosinus_*(t21), r.sinus_*(t12)-r.cosinus_*(t22), r.sinus_*(t13-r.t.x())-r.cosinus_*(t23-r.t.y())+r.t.y()); +} + } //namespace CGAL #endif // CGAL_CARTESIAN_AFF_TRANSFORMATION_REP_2_H diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Reflection_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Reflection_rep_2.h new file mode 100644 index 00000000000..33cc545a354 --- /dev/null +++ b/Cartesian_kernel/include/CGAL/Cartesian/Reflection_rep_2.h @@ -0,0 +1,208 @@ +// Copyright (c) 2018 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_CARTESIAN_REFLECTION_REP_2_H +#define CGAL_CARTESIAN_REFLECTION_REP_2_H +#include +namespace CGAL { + +template < class R > +class Reflection_repC2: public Aff_transformation_rep_baseC2 +{ + friend class Translation_repC2; + friend class Rotation_repC2; + friend class Scaling_repC2; + friend class Aff_transformation_repC2; + +public: + typedef Aff_transformation_rep_baseC2 Aff_t_base; + typedef typename Aff_t_base::FT FT; + typedef typename Aff_t_base::Point_2 Point_2; + typedef typename Aff_t_base::Vector_2 Vector_2; + typedef typename Aff_t_base::Direction_2 Direction_2; +typedef typename CGAL::Line_2 Line_2; + typedef typename Aff_t_base::Aff_transformation_2 Aff_transformation_2; + typedef Aff_transformation_repC2 Transformation; + typedef Reflection_repC2 Reflection; + typedef Scaling_repC2 Scaling; + typedef Rotation_repC2 Rotation; + typedef Translation_repC2 Translation; + + Reflection_repC2(const Line_2 &l) + { + if(l.a() == 0) + t = -Vector_2(0, l.c()/l.b()); + else + t = -Vector_2(l.c()/l.a(),0); + + Vector_2 l_to_v = l.to_vector(); + FT scal = l_to_v.x(); //Projection of l_to_v on Ox. = |L|*cos(a) + FT det = l_to_v.y();// = |L|*sin(a) + sinus_ = 2*det*scal/l_to_v.squared_length(); //sin(2a) = 2*sin(a)*cos(a) + FT sq_cos = scal*scal/l_to_v.squared_length(); //cos(a)*cos(a) + cosinus_ = 2*sq_cos-1; + } + + ~Reflection_repC2() + {} + + Point_2 transform(const Point_2 &p) const + { + return Point_2( + cosinus_*p.x()+sinus_*p.y()-cosinus_*t.x()-sinus_*t.y()+t.x(), + sinus_*p.x()-cosinus_*p.y()-sinus_*t.x()+cosinus_*t.y()+t.y()); + } + + Vector_2 transform(const Vector_2 &p) const + { + return Vector_2( + cosinus_*p.x()+sinus_*p.y()-cosinus_*t.x()-sinus_*t.y()+t.x(), + sinus_*p.x()-cosinus_*p.y()-sinus_*t.x()+cosinus_*t.y()+t.y()); + } + + Direction_2 transform(const Direction_2 &d) const + { + + return transform(d.vector()).direction(); + } + + Aff_transformation_2 operator*(const Aff_t_base &t) const + { + return t.compose(*this); + } + + Aff_transformation_2 compose(const Translation &tr) const + { + return Aff_transformation_2(cosinus_, sinus_, t13()+tr.translationvector_.x(), + sinus_, -cosinus_, t23()+tr.translationvector_.y()); + } + + Aff_transformation_2 compose(const Scaling &s) const + { + return Aff_transformation_2(s.scalefactor_ * cosinus_, + s.scalefactor_ * sinus_, + s.scalefactor_ * t13(), + s.scalefactor_ * sinus_, + -s.scalefactor_ * cosinus_, + s.scalefactor_ * t23()); + } + + Aff_transformation_2 compose(const Transformation &tr) const + { + return Aff_transformation_2( + tr.t11*cosinus_+tr.t12*sinus_, + tr.t11*sinus_-tr.t12*cosinus_, + tr.t11*t13()+tr.t12*t23()+tr.t13, + tr.t21*cosinus_+tr.t22*sinus_, + tr.t21*sinus_-tr.t22*cosinus_, + tr.t21*t13()+tr.t22*t23()+tr.t23); + } + + Aff_transformation_2 compose(const Rotation &r) const + { + return Aff_transformation_2( + r.cosinus_*cosinus_-r.sinus_*sinus_, + r.cosinus_*sinus_+r.sinus_*cosinus_, + r.cosinus_*t13() + -r.sinus_*t23(), + r.sinus_*cosinus_+r.cosinus_*sinus_, + r.sinus_*sinus_-r.cosinus_*cosinus_, + r.sinus_*t13() + +r.cosinus_*t23()); + } + + Aff_transformation_2 compose(const Reflection &r) const + { + return Aff_transformation_2( + cosinus_*r.cosinus_+sinus_*r.sinus_, + r.cosinus_*sinus_-r.sinus_*cosinus_, + r.cosinus_*(t13()-r.t.x()) + r.sinus_*(t23()-r.t.y())+r.t.x(), + + r.sinus_*cosinus_ - r.cosinus_*sinus_, + r.sinus_*sinus_+r.cosinus_*cosinus_, + r.sinus_*(t13()-r.t.x()) -r.cosinus_*(t23()-r.t.y())+r.t.y()); + } + + Aff_transformation_2 inverse() const + { + return Aff_transformation_2(cartesian(0,0), cartesian(0,1), cartesian(0,2), + cartesian(1,0), cartesian(1,1), cartesian(1,2)); + } + + bool is_even() const + { + return true; + } + + FT cartesian(int i, int j) const + { + switch (i) + { + case 0: switch (j) + { + case 0: return cosinus_; + case 1: return sinus_; + default: return FT(0); + } + case 1: switch (j) + { + case 0: return sinus_; + case 1: return -cosinus_; + default: return FT(0); + } + case 2: switch (j) + { + case 0: return FT(0); + case 1: return FT(0); + default: return FT(1); + } + } + return FT(0); + } + + std::ostream &print(std::ostream &os) const + { + os << "Aff_transformationC2(" << sinus_ << ", " << cosinus_ << "; "<< t <<")"; + return os; + } + + //convevience functions for composition + FT t13()const + { + return FT(-cosinus_*t.x()-sinus_*t.y()+t.x()); + } + FT t23()const + { + return FT(-sinus_*t.x()+cosinus_*t.y()+t.y()); + } + +private: + Vector_2 t; + FT sinus_, cosinus_; +}; + +} //namespace CGAL + +#endif // CGAL_CARTESIAN_REFLECTION_REP_2_H diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h index cf876f8511e..439d66f0139 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h @@ -36,6 +36,7 @@ class Rotation_repC2: public Aff_transformation_rep_baseC2 friend class Aff_transformation_repC2; friend class Translation_repC2; friend class Scaling_repC2; +friend class Reflection_repC2; public: typedef Aff_transformation_rep_baseC2 Aff_t_base; @@ -48,6 +49,7 @@ public: typedef Translation_repC2 Translation; typedef Rotation_repC2 Rotation; typedef Scaling_repC2 Scaling; + typedef Reflection_repC2 Reflection; Rotation_repC2() {} @@ -126,6 +128,17 @@ public: t.scalefactor_*cosinus_); } + Aff_transformation_2 compose(const Reflection &r) const + { + return Aff_transformation_2( + r.cosinus_*cosinus_+r.sinus_*sinus_, + -r.cosinus_*sinus_+r.sinus_*cosinus_, + r.t13(), + r.sinus_*cosinus_-r.cosinus_*sinus_, + -r.sinus_*sinus_-r.cosinus_*cosinus_ + , r.t23()); + } + Aff_transformation_2 compose(const Transformation &t) const { return Aff_transformation_2(cosinus_*t.t11 + sinus_*t.t12, @@ -135,7 +148,6 @@ public: -sinus_*t.t21 + cosinus_*t.t22, t.t23); } - bool is_even() const { return true; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h index d98313e689f..6eeb72323e9 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h @@ -34,6 +34,7 @@ class Scaling_repC2: public Aff_transformation_rep_baseC2 friend class Aff_transformation_repC2; friend class Translation_repC2; friend class Rotation_repC2; +friend class Reflection_repC2; public: typedef Aff_transformation_rep_baseC2 Aff_t_base; @@ -45,6 +46,7 @@ public: typedef Aff_transformation_repC2 Transformation; typedef Translation_repC2 Translation; typedef Rotation_repC2 Rotation; + typedef Reflection_repC2 Reflection; typedef Scaling_repC2 Scaling; Scaling_repC2() @@ -96,6 +98,12 @@ public: scalefactor_ * t.cosinus_); } + Aff_transformation_2 compose(const Reflection &r) const + { + return Aff_transformation_2(scalefactor_*r.cosinus_, scalefactor_*r.sinus_,-r.cosinus_*r.t.x()-r.sinus_*r.t.y()+r.t.x(), + scalefactor_*r.sinus_, -scalefactor_*r.cosinus_, -r.sinus_*r.t.x()+r.cosinus_*r.t.y()-r.t.y()); + } + Aff_transformation_2 compose(const Scaling &t) const { return Aff_transformation_2(SCALING, scalefactor_*t.scalefactor_); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h index 9bab526c7be..4b1fc030fa3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h @@ -36,6 +36,7 @@ class Translation_repC2 : public Aff_transformation_rep_baseC2 friend class Aff_transformation_repC2; friend class Rotation_repC2; friend class Scaling_repC2; +friend class Reflection_repC2; public: typedef typename R::FT FT; @@ -43,6 +44,7 @@ public: typedef Aff_transformation_repC2 Transformation; typedef Translation_repC2 Translation; typedef Rotation_repC2 Rotation; + typedef Reflection_repC2 Reflection; typedef Scaling_repC2 Scaling; typedef typename Aff_t_base::Point_2 Point_2; typedef typename Aff_t_base::Vector_2 Vector_2; @@ -114,6 +116,14 @@ public: + t.t22*translationvector_.y() + t.t23); } + + Aff_transformation_2 compose(const Reflection &r) const + { + return Aff_transformation_2(r.cosinus_, r.sinus_, + r.cosinus_*(translationvector_.x()-r.t.x())+r.sinus_*(translationvector_.y() - r.t.y()) +r.t.x(), + r.sinus_, -r.cosinus_, + r.sinus_*(translationvector_.x()-r.t.x())-r.cosinus_*(translationvector_.y() - r.t.y())+r.t.y()); + } Aff_transformation_2 inverse() const { diff --git a/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt index 8072b3720da..1d1bb36d2cf 100644 --- a/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Circular_kernel_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt index ac9e483e25f..74f626a1326 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt @@ -2,10 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Circular_kernel_2_Tests ) -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) - find_package(CGAL QUIET) if ( CGAL_FOUND ) diff --git a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt index f66a1c8c7b7..34fb62f0475 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project (Circular_kernel_3_Demo) -cmake_minimum_required(VERSION 3.1) 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/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt index fceddecd46a..5c5a8f42781 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Circular_kernel_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt index 285115758a5..eb56bd82adf 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt @@ -2,10 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Circular_kernel_3_Tests ) -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) - find_package(CGAL QUIET COMPONENTS Core ) if ( CGAL_FOUND ) diff --git a/Circulator/examples/Circulator/CMakeLists.txt b/Circulator/examples/Circulator/CMakeLists.txt index 25ebaaa3029..df3050fb2ac 100644 --- a/Circulator/examples/Circulator/CMakeLists.txt +++ b/Circulator/examples/Circulator/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Circulator_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Circulator/test/Circulator/CMakeLists.txt b/Circulator/test/Circulator/CMakeLists.txt index 330c0553644..413c1cdbfd2 100644 --- a/Circulator/test/Circulator/CMakeLists.txt +++ b/Circulator/test/Circulator/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Circulator_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index 73e009c7868..79ad8c5bf03 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Classification_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index ba75c6ae11f..ae7699281d1 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Classification_Tests ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt index 78868a0c372..8a7390bdcb0 100644 --- a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Combinatorial_map_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt index f8dd901b528..6beb2c68493 100644 --- a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Combinatorial_map_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Cone_spanners_2/examples/Cone_spanners_2/CMakeLists.txt b/Cone_spanners_2/examples/Cone_spanners_2/CMakeLists.txt index 720ae284d4c..815413763a5 100644 --- a/Cone_spanners_2/examples/Cone_spanners_2/CMakeLists.txt +++ b/Cone_spanners_2/examples/Cone_spanners_2/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1...3.13) +cmake_minimum_required(VERSION 3.1...3.15) project( Cone_spanners_2_Examples ) find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core) diff --git a/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt b/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt index a859efd04e6..1a9a18f5016 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt +++ b/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Cone_spanners_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 459d14c78b5..a2e6d17d236 100644 --- a/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt +++ b/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_decomposition_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt b/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt index 8de39c59399..91dd854c203 100644 --- a/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt +++ b/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_decomposition_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt b/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt index fb81c4d6131..35f20791847 100644 --- a/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt +++ b/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_hull_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt b/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt index a39a58f5f99..e5373558182 100644 --- a/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt +++ b/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_hull_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Convex_hull_3/demo/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/demo/Convex_hull_3/CMakeLists.txt index 59c80f4ec0e..37a6dd85f0c 100644 --- a/Convex_hull_3/demo/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/demo/Convex_hull_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_hull_3_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt index a2a70fa2592..18d983da969 100644 --- a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_hull_3_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt index beb28619ce8..8282bc77bab 100644 --- a/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_hull_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt b/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt index fc19860c41c..39cd11743b1 100644 --- a/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt +++ b/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Convex_hull_d_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Distance_2/test/Distance_2/CMakeLists.txt b/Distance_2/test/Distance_2/CMakeLists.txt index 0b93c5f718c..73491efcd2e 100644 --- a/Distance_2/test/Distance_2/CMakeLists.txt +++ b/Distance_2/test/Distance_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Distance_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Distance_3/test/Distance_3/CMakeLists.txt b/Distance_3/test/Distance_3/CMakeLists.txt index ce608ba48c7..9467abf2744 100644 --- a/Distance_3/test/Distance_3/CMakeLists.txt +++ b/Distance_3/test/Distance_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Distance_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Documentation/doc/CMakeLists.txt b/Documentation/doc/CMakeLists.txt index 1049c44db07..83b0918e75f 100644 --- a/Documentation/doc/CMakeLists.txt +++ b/Documentation/doc/CMakeLists.txt @@ -1,7 +1,7 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(Documentation NONE) # Minimal version of CMake: -cmake_minimum_required(VERSION 3.1) # Check whether this cmake script is the top level one if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Envelope_2/examples/Envelope_2/CMakeLists.txt b/Envelope_2/examples/Envelope_2/CMakeLists.txt index 936b6d1dabb..4a25f90e742 100644 --- a/Envelope_2/examples/Envelope_2/CMakeLists.txt +++ b/Envelope_2/examples/Envelope_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Envelope_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Envelope_2/test/Envelope_2/CMakeLists.txt b/Envelope_2/test/Envelope_2/CMakeLists.txt index 01cd46d3976..5ea14d5d6cb 100644 --- a/Envelope_2/test/Envelope_2/CMakeLists.txt +++ b/Envelope_2/test/Envelope_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Envelope_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Envelope_3/examples/Envelope_3/CMakeLists.txt b/Envelope_3/examples/Envelope_3/CMakeLists.txt index 4f3dd717ad7..27e66795501 100644 --- a/Envelope_3/examples/Envelope_3/CMakeLists.txt +++ b/Envelope_3/examples/Envelope_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Envelope_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Envelope_3/test/Envelope_3/CMakeLists.txt b/Envelope_3/test/Envelope_3/CMakeLists.txt index da3fdcc438a..8ccc89c8780 100644 --- a/Envelope_3/test/Envelope_3/CMakeLists.txt +++ b/Envelope_3/test/Envelope_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Envelope_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt index 5f557e993c4..c39a9422005 100644 --- a/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Filtered_kernel_test ) -cmake_minimum_required(VERSION 3.1) 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 ebcff9060b2..95f51a659ec 100644 --- a/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Filtered_kernel_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 47e7dbbaf77..1fed337bf35 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -35,8 +35,11 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -61,42 +64,42 @@ template class Lazy_kernel_base; -template class Lazy; +template class Lazy; template class Lazy_exact_nt; -template +template inline const AT& -approx(const Lazy& l) +approx(const Lazy& l) { return l.approx(); } // Where is this one (non-const) needed ? Is it ? -template +template inline AT& -approx(Lazy& l) +approx(Lazy& l) { return l.approx(); } -template +template inline const ET& -exact(const Lazy& l) +exact(const Lazy& l) { return l.exact(); } -template +template inline unsigned -depth(const Lazy& l) +depth(const Lazy& l) { return l.depth(); } @@ -107,27 +110,27 @@ depth(const Lazy& l) inline const T & exact (const T& d) { return d; } \ inline unsigned depth (const T& ) { return 0; } - -CGAL_LAZY_FORWARD(long double) -CGAL_LAZY_FORWARD(double) -CGAL_LAZY_FORWARD(float) -CGAL_LAZY_FORWARD(int) -CGAL_LAZY_FORWARD(unsigned int) -CGAL_LAZY_FORWARD(long) -CGAL_LAZY_FORWARD(unsigned long) -#ifdef CGAL_USE_LONG_LONG -CGAL_LAZY_FORWARD(long long) -CGAL_LAZY_FORWARD(unsigned long long) -#endif -CGAL_LAZY_FORWARD(Return_base_tag) -CGAL_LAZY_FORWARD(Null_vector) -CGAL_LAZY_FORWARD(Origin) -CGAL_LAZY_FORWARD(Orientation) CGAL_LAZY_FORWARD(Bbox_2) CGAL_LAZY_FORWARD(Bbox_3) - #undef CGAL_LAZY_FORWARD +templateinline std::enable_if_t::value||std::is_enum::value, T> approx(T d){return d;} +templateinline std::enable_if_t::value||std::is_enum::value, T> exact (T d){return d;} +templateinline std::enable_if_t::value||std::is_enum::value, unsigned> depth(T){return 0;} + +// For tag classes: Return_base_tag, Homogeneous_tag, Null_vector, Origin +templateinline std::enable_if_t::value, T> exact(T){return {};} +templateinline std::enable_if_t::value, T> approx(T){return {};} +templateinline std::enable_if_t::value, unsigned> depth(T){return 0;} + +// For an iterator, exact/approx applies to the objects it points to +template ::value>> +auto exact(T const& t) {return make_transforming_iterator(t,[](auto const&u){return CGAL::exact(u);});} +template ::value>> +auto approx(T const& t) {return make_transforming_iterator(t,[](auto const&u){return CGAL::approx(u);});} +template ::value>> +unsigned depth(T const&) {return 1;} // FIXME: depth(*t) would be better when t is valid, but not for end iterators, and the true answer would iterate on the range, but we can't do that with only one iterator... We need to replace iterators with ranges to solve that. + #ifdef CGAL_LAZY_KERNEL_DEBUG template void @@ -158,10 +161,10 @@ print_at(std::ostream& os, const std::pair & at) } -template +template inline void -print_dag(const Lazy& l, std::ostream& os, int level = 0) +print_dag(const Lazy& l, std::ostream& os, int level = 0) { l.print_dag(os, level); } @@ -235,7 +238,7 @@ struct Depth_base { template class Lazy_rep : public Rep, public Depth_base { - Lazy_rep (const Lazy_rep&); // cannot be copied. + Lazy_rep (const Lazy_rep&) = delete; // cannot be copied. public: @@ -247,11 +250,13 @@ public: Lazy_rep () : at(), et(nullptr){} - Lazy_rep (const AT& a) - : at(a), et(nullptr){} + template + Lazy_rep (A&& a) + : at(std::forward(a)), et(nullptr){} - Lazy_rep (const AT& a, const ET& e) - : at(a), et(new ET(e)) {} + template + Lazy_rep (A&& a, E&& e) + : at(std::forward(a)), et(new ET(std::forward(e))) {} const AT& approx() const { @@ -311,6 +316,52 @@ public: }; +template +class Lazy_rep_n : + public Lazy_rep< AT, ET, E2A >, private EC +{ + // Lazy_rep_0 does not inherit from EC or take a parameter AC. It has different constructors. + static_assert(sizeof...(L)>0, "Use Lazy_rep_0 instead"); + template friend class Lazy_kernel_base; + mutable std::tuple l; // L...l; is not yet allowed. + const EC& ec() const { return *this; } + template + void update_exact_helper(std::index_sequence) const { + this->et = new ET(ec()( CGAL::exact( std::get(l) ) ... ) ); + this->at = E2A()(*(this->et)); + l = std::tuple{}; + } + public: + void update_exact() const { + update_exact_helper(std::make_index_sequence{}); + } + template + Lazy_rep_n(const AC& ac, const EC& ec, LL&&...ll) : + Lazy_rep(ac(CGAL::approx(ll)...)), EC(ec), l(std::forward(ll)...) + { + this->set_depth((std::max)({ -1, (int)CGAL::depth(ll)...}) + 1); + } +#ifdef CGAL_LAZY_KERNEL_DEBUG + private: + template + void print_dag_helper(std::ostream& os, int level, std::index_sequence) const { + this->print_at_et(os, level); + if(this->is_lazy()){ +# ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID + CGAL::msg(os, level, typeid(AC).name()); +# endif + CGAL::msg(os, level, "DAG with " "3" " child nodes:"); + using expander = int[]; + expander{0,(CGAL::print_dag(std::get(l), os, level+1),0)...}; + } + } + public: + void print_dag(std::ostream& os, int level) const { + print_dag_helper(os, level, std::make_index_sequence{}); + } +#endif +}; + //____________________________________________________________ // The rep for the leaf node @@ -330,14 +381,23 @@ public: Lazy_rep_0() : Lazy_rep() {} - Lazy_rep_0(const AT& a, const ET& e) - : Lazy_rep(a, e) {} + template + Lazy_rep_0(A&& a, E&& e) + : Lazy_rep(std::forward(a), std::forward(e)) {} +#if 0 + // unused. Find a less ambiguous placeholder if necessary Lazy_rep_0(const AT& a, void*) : Lazy_rep(a) {} +#endif - Lazy_rep_0(const ET& e) - : Lazy_rep(E2A()(e), e) {} + // E2A()(e) and std::forward(e) could be evaluated in any order, but + // that's ok, "forward" itself does not modify e, it may only mark it as + // modifyable by the outer call, which is obviously sequenced after the inner + // call E2A()(e). + template + Lazy_rep_0(E&& e) + : Lazy_rep(E2A()(e), std::forward(e)) {} void print_dag(std::ostream& os, int level) const @@ -352,116 +412,6 @@ public: #define CGAL_LEXACT(z,n,t) CGAL::exact( l##n ) #define CGAL_LARGS(z, n, t) L##n const& l##n -#define CGAL_TMAP(z, n, d) typename Type_mapper< L##n, d##K, LK >::type -#define CGAL_PRUNE_TREE(z, n, d) l##n = L##n (); -#define CGAL_LINIT(z, n, d) l##n(l##n) -#define CGAL_LN(z, n, d) d(l##n) -#define CGAL_MLIST(z, n, d) mutable L##n l##n; - -//____________________________________________________________ - -template -class Lazy_rep_1 - : public Lazy_rep - , private EC -{ - typedef Lazy_rep Base; - - mutable L1 l1_; - - const EC& ec() const { return *this; } - -public: - - void - update_exact() const - { - this->et = new ET(ec()(CGAL::exact(l1_))); - this->at = E2A()(*(this->et)); - // Prune lazy tree - l1_ = L1(); - } - - Lazy_rep_1(const AC& ac, const EC& ec, const L1& l1) - : Lazy_rep(ac(CGAL::approx(l1))), EC(ec), l1_(l1) - { - this->set_depth(CGAL::depth(l1_) + 1); - } - -#ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID -# define CGAL_LAZY_PRINT_TYPEID CGAL::msg(os, level, typeid(AC).name()); -#else // not CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID -# define CGAL_LAZY_PRINT_TYPEID -#endif // not CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID - -#ifdef CGAL_LAZY_KERNEL_DEBUG - void - print_dag(std::ostream& os, int level) const - { - this->print_at_et(os, level); - if(this->is_lazy()){ - CGAL_LAZY_PRINT_TYPEID - CGAL::msg(os, level, "DAG with one child node:"); - CGAL::print_dag(l1_, os, level+1); - } - } -#endif -}; - -#ifdef CGAL_LAZY_KERNEL_DEBUG -# define CGAL_PRINT_DAG_LN(z, n, d) \ - CGAL::print_dag(l##n, os, level+1); -# define CGAL_LAZY_REP_PRINT_DAG(n) \ - void print_dag(std::ostream& os, int level) const { \ - this->print_at_et(os, level); \ - if(this->is_lazy()){ \ - CGAL_LAZY_PRINT_TYPEID \ - CGAL::msg(os, level, "DAG with " #n " child nodes:"); \ - BOOST_PP_REPEAT(n, CGAL_PRINT_DAG_LN, _) \ - } \ - } -#else // not CGAL_LAZY_KERNEL_DEBUG -# define CGAL_LAZY_REP_PRINT_DAG(n) -#endif // not CGAL_LAZY_KERNEL_DEBUG - -#define CGAL_LAZY_REP(z, n, d) \ - template< typename AT, typename ET, typename AC, typename EC, typename E2A, BOOST_PP_ENUM_PARAMS(n, typename L)> \ -class Lazy_rep_##n :public Lazy_rep< AT, \ - ET, \ - E2A >, \ - private EC \ -{ \ - \ - template \ - friend class Lazy_kernel_base; \ - BOOST_PP_REPEAT(n, CGAL_MLIST, _) \ - const EC& ec() const { return *this; } \ -public: \ - void update_exact() const { \ - this->et = new ET(ec()( BOOST_PP_ENUM(n, CGAL_LEXACT, _) ) ); \ - this->at = E2A()(*(this->et)); \ - BOOST_PP_REPEAT(n, CGAL_PRUNE_TREE, _) \ - } \ - Lazy_rep_##n(const AC& ac, const EC&, BOOST_PP_ENUM(n, CGAL_LARGS, _)) \ - : Lazy_rep(ac( BOOST_PP_ENUM(n, CGAL_LN, CGAL::approx) )), BOOST_PP_ENUM(n, CGAL_LINIT, _) \ - { this->set_depth(max_n( BOOST_PP_ENUM(n, CGAL_LN, CGAL::depth) ) + 1); } \ - \ - CGAL_LAZY_REP_PRINT_DAG(n) \ -}; - -BOOST_PP_REPEAT_FROM_TO(2, 9, CGAL_LAZY_REP, _) - -#undef CGAL_TMAP -#undef CGAL_PRUNE_TREE -#undef CGAL_LINIT -#undef CGAL_LAZY_REP -#undef CGAL_LN -#undef CGAL_MLIST -#undef CGAL_PRINT_DAG_LN -#undef CGAL_LAZY_REP_PRINT_DAG #undef CGAL_LAZY_PRINT_TYPEID template < typename K1, typename K2 > @@ -723,7 +673,7 @@ public: //____________________________________________________________ // The handle class -template +template class Lazy : public Handle { template Self; + typedef Lazy Self; typedef Lazy_rep Self_rep; typedef AT_ AT; // undocumented @@ -785,6 +735,11 @@ public : PTR = new Lazy_rep_0(e); } + Lazy(ET&& e) + { + PTR = new Lazy_rep_0(std::move(e)); + } + const AT& approx() const { return ptr()->approx(); } @@ -832,8 +787,8 @@ struct Lazy_construction_bbox typedef typename LK::Exact_kernel EK; typedef typename AC::result_type result_type; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; template result_type operator()(const L1& l1) const @@ -854,6 +809,8 @@ struct Lazy_construction_bbox template struct Lazy_construction_nt { + Lazy_construction_nt(){} + Lazy_construction_nt(LK const&){} static const bool Protection = true; @@ -861,8 +818,8 @@ struct Lazy_construction_nt { typedef typename LK::Exact_kernel EK; typedef typename LK::E2A E2A; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; template struct result { }; @@ -878,30 +835,23 @@ struct Lazy_construction_nt { BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _) -#define CGAL_NT_OPERATOR(z, n, d) \ - template \ - typename cpp11::result_of::type \ - operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \ - typedef typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \ - typedef typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ - Protect_FPU_rounding P; \ - try { \ - return new Lazy_rep_##n, BOOST_PP_ENUM_PARAMS(n, L) >(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)); \ - } catch (Uncertain_conversion_exception&) { \ - CGAL_BRANCH_PROFILER_BRANCH(tmp); \ - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); \ - return new Lazy_rep_0 >(ec( BOOST_PP_ENUM(n, CGAL_LEXACT, _) )); \ - } \ - } \ + template + auto operator()(L const&...l) const -> + Lazy_exact_nt>> + { + typedef std::remove_cv_t> ET; + typedef std::remove_cv_t> AT; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Protect_FPU_rounding P; + try { + return new Lazy_rep_n, L... >(ac, ec, l...); + } catch (Uncertain_conversion_exception&) { + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + return new Lazy_rep_0 >(ec( CGAL::exact(l)... )); + } + } - BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_NT_OPERATOR, _) - -#undef INTERVAL_OPERATOR #undef CGAL_RESULT_NT }; @@ -1043,8 +993,8 @@ struct Lazy_cartesian_const_iterator_2 typedef typename LK::Exact_kernel EK; typedef typename LK::Cartesian_const_iterator_2 result_type; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; public: @@ -1072,8 +1022,8 @@ struct Lazy_cartesian_const_iterator_3 typedef typename LK::Exact_kernel EK; typedef typename LK::Cartesian_const_iterator_3 result_type; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; public: @@ -1098,14 +1048,14 @@ public: // In a first version we assume that the references are of type Lazy, // and that the result type is void -template +template struct Lazy_functor_2_1 { static const bool Protection = true; typedef void result_type; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; public: @@ -1166,11 +1116,10 @@ struct Lazy_functor_2_2 typedef void result_type; typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename EK::FT EFT; typedef typename LK::E2A E2A; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; public: @@ -1178,16 +1127,16 @@ public: void operator()(const L1& l1, const L2& l2, R1& r1, R2& r2) const { - typedef Lazy Handle_1; - typedef Lazy Handle_2; + typedef Lazy Handle_1; + typedef Lazy Handle_2; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; try { - typedef Lazy, std::pair, EFT, E2A> Lazy_pair; + typedef Lazy, std::pair, E2A> Lazy_pair; Lazy_pair lv(new Lazy_rep_2_2(ac, ec, l1, l2)); // lv->approx() is a std::pair; - r1 = R1(Handle_1(new Lazy_rep_1 >, First >, E2A, Lazy_pair>(First >(), First >(), lv))); - r2 = R2(Handle_2(new Lazy_rep_1 >, Second >, E2A, Lazy_pair>(Second >(), Second >(), lv))); + r1 = R1(Handle_1(new Lazy_rep_n >, First >, E2A, Lazy_pair>(First >(), First >(), lv))); + r2 = R2(Handle_2(new Lazy_rep_n >, Second >, E2A, Lazy_pair>(Second >(), Second >(), lv))); } catch (Uncertain_conversion_exception&) { CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding P2(CGAL_FE_TONEAREST); @@ -1208,14 +1157,13 @@ struct Lazy_intersect_with_iterators static const bool Protection = true; typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename EK::FT EFT; typedef typename LK::E2A E2A; typedef void result_type; - typedef Lazy Lazy_object; - typedef Lazy, std::vector, EFT, E2A> Lazy_vector; + typedef Lazy Lazy_object; + typedef Lazy, std::vector, E2A> Lazy_vector; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; public: @@ -1234,7 +1182,7 @@ public: for (unsigned int i = 0; i < lv.approx().size(); i++) { // FIXME : I'm not sure how this work... #define CGAL_Kernel_obj(X) if (object_cast(& (lv.approx()[i]))) { \ - *it++ = make_object(typename LK::X(new Lazy_rep_1, \ + *it++ = make_object(typename LK::X(new Lazy_rep_n, \ Ith, E2A, Lazy_vector> \ (Ith(i), Ith(i), lv))); \ continue; \ @@ -1287,16 +1235,15 @@ struct Lazy_construction_object typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename EK::FT EFT; typedef typename LK::E2A E2A; typedef typename AC::result_type AT; typedef typename EC::result_type ET; typedef Object result_type; - typedef Lazy Lazy_object; + typedef Lazy Lazy_object; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; public: @@ -1307,14 +1254,14 @@ public: CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; try { - Lazy_object lo(new Lazy_rep_1(ac, ec, l1)); + Lazy_object lo(new Lazy_rep_n(ac, ec, l1)); if(lo.approx().is_empty()) return Object(); #define CGAL_Kernel_obj(X) \ if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_1< typename AK::X, typename EK::X, Object_cast, Object_cast, E2A, Lazy_object> Lcr; \ + typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast, Object_cast, E2A, Lazy_object> Lcr; \ Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ return make_object(typename LK::X(lcr)); \ } @@ -1340,14 +1287,14 @@ public: CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; try { - Lazy_object lo(new Lazy_rep_2(ac, ec, l1, l2)); + Lazy_object lo(new Lazy_rep_n(ac, ec, l1, l2)); if(lo.approx().is_empty()) return Object(); #define CGAL_Kernel_obj(X) \ if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_1, Object_cast, E2A, Lazy_object> Lcr; \ + typedef Lazy_rep_n, Object_cast, E2A, Lazy_object> Lcr; \ Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ return make_object(typename LK::X(lcr)); \ } @@ -1363,7 +1310,7 @@ public: std::vector V;\ V.resize(v_ptr->size()); \ for (unsigned int i = 0; i < v_ptr->size(); i++) { \ - V[i] = typename LK::X(new Lazy_rep_1, \ + V[i] = typename LK::X(new Lazy_rep_n, \ Ith_for_intersection, E2A, Lazy_object> \ (Ith_for_intersection(i), Ith_for_intersection(i), lo)); \ } \ @@ -1394,14 +1341,14 @@ CGAL_Kernel_obj(Point_3) CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; try { - Lazy_object lo(new Lazy_rep_3(ac, ec, l1, l2, l3)); + Lazy_object lo(new Lazy_rep_n(ac, ec, l1, l2, l3)); if(lo.approx().is_empty()) return Object(); #define CGAL_Kernel_obj(X) \ if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_1, Object_cast, E2A, Lazy_object> Lcr; \ + typedef Lazy_rep_n, Object_cast, E2A, Lazy_object> Lcr; \ Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ return make_object(typename LK::X(lcr)); \ } @@ -1472,7 +1419,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> { typedef typename Type_mapper::type EKT; typedef typename Type_mapper::type LKT; - typedef Lazy_rep_1, Variant_cast, typename LK::E2A, Origin> Lcr; + typedef Lazy_rep_n, Variant_cast, typename LK::E2A, Origin> Lcr; Lcr * lcr = new Lcr(Variant_cast(), Variant_cast(), *o); *r = LKT(lcr); @@ -1487,7 +1434,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> { std::vector V; V.resize(t.size()); for (unsigned int i = 0; i < t.size(); i++) { - V[i] = LKT(new Lazy_rep_1, + V[i] = LKT(new Lazy_rep_n, Ith_for_intersection, typename LK::E2A, Origin> (Ith_for_intersection(i), Ith_for_intersection(i), *o)); } @@ -1535,7 +1482,6 @@ struct Lazy_construction_variant { typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename EK::FT EFT; typedef typename LK::E2A E2A; @@ -1569,7 +1515,7 @@ struct Lazy_construction_variant { Protect_FPU_rounding P; try { - Lazy lazy(new Lazy_rep_2(AC(), EC(), l1, l2)); + Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2)); // the approximate result requires the trait with types from the AK AT approx_v = lazy.approx(); @@ -1582,7 +1528,7 @@ struct Lazy_construction_variant { } // the static visitor fills the result_type with the correct unwrapped type - internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); + internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); boost::apply_visitor(visitor, *approx_v); return res; @@ -1618,7 +1564,7 @@ struct Lazy_construction_variant { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; try { - Lazy lazy(new Lazy_rep_3(AC(), EC(), l1, l2, l3)); + Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); // the approximate result requires the trait with types from the AK AT approx_v = lazy.approx(); @@ -1631,7 +1577,7 @@ struct Lazy_construction_variant { } // the static visitor fills the result_type with the correct unwrapped type - internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); + internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); boost::apply_visitor(visitor, *approx_v); return res; @@ -1670,23 +1616,22 @@ struct Lazy_construction { typedef typename boost::remove_cv< typename boost::remove_reference < typename EC::result_type >::type >::type ET; - typedef typename EK::FT EFT; typedef typename Default::Get::type E2A; typedef typename Type_mapper::type result_type; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; #define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \ template \ result_type \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ - typedef Lazy< AT, ET, EFT, E2A> Handle; \ + typedef Lazy< AT, ET, E2A> Handle; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ Protect_FPU_rounding P; \ try { \ - return result_type( Handle(new Lazy_rep_##n(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \ + return result_type( Handle(new Lazy_rep_n(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \ } catch (Uncertain_conversion_exception&) { \ CGAL_BRANCH_PROFILER_BRANCH(tmp); \ Protect_FPU_rounding P2(CGAL_FE_TONEAREST); \ @@ -1701,7 +1646,7 @@ struct Lazy_construction { result_type operator()() const { - typedef Lazy Handle; + typedef Lazy Handle; return result_type( Handle(new Lazy_rep_0()) ); } @@ -1717,7 +1662,6 @@ struct Lazy_construction typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename EK::FT EFT; typedef typename Default::Get::type E2A; template @@ -1726,8 +1670,8 @@ struct Lazy_construction // you are on your own }; - AC ac; - EC ec; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; // acquire the result_type of the approximate kernel, map it back to the lazy kernel object #define CGAL_RESULT(z, n, d) \ @@ -1749,12 +1693,12 @@ struct result { \ typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \ typedef typename boost::remove_cv< typename boost::remove_reference < \ typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \ - typedef Lazy< AT, ET, EFT, E2A> Handle; \ + typedef Lazy< AT, ET, E2A> Handle; \ typedef typename cpp11::result_of::type result_type; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ Protect_FPU_rounding P; \ try { \ - return result_type( Handle(new Lazy_rep_##n(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \ + return result_type( Handle(new Lazy_rep_n(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \ } catch (Uncertain_conversion_exception&) { \ CGAL_BRANCH_PROFILER_BRANCH(tmp); \ Protect_FPU_rounding P2(CGAL_FE_TONEAREST); \ @@ -1771,7 +1715,7 @@ struct result { \ { typedef typename cpp11::result_of::type AT; typedef typename cpp11::result_of::type ET; - typedef Lazy Handle; + typedef Lazy Handle; typedef typename Type_mapper< typename cpp11::result_of::type ,AK, LK>::type result_type; return result_type( Handle(new Lazy_rep_0()) ); diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 399d2f8f0dd..0c8aea3e100 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -164,7 +164,7 @@ public: typedef CGAL::Object Object_3; #define CGAL_Kernel_obj(X) \ - typedef Lazy X; + typedef Lazy X; CGAL_Kernel_obj(Data_accessor_2) CGAL_Kernel_obj(Conic_2) @@ -325,7 +325,7 @@ public: FT operator()(const Weighted_point_2& p) const { - typedef Lazy_rep_3(p.ptr()); if(lr && (! lr->et)){ - return lr->l2; + return std::get<2>(lr->l); } return BaseClass().compute_weight_2_object()(p); } @@ -355,7 +355,7 @@ public: FT operator()(const Weighted_point_3& p) const { - typedef Lazy_rep_3(p.ptr()); if(lr && (! lr->et)){ - return lr->l2; + return std::get<2>(lr->l); } return BaseClass().compute_weight_3_object()(p); } @@ -403,7 +403,7 @@ public: Point_2 operator()(const Weighted_point_2& p) const { - typedef Lazy_rep_3 LR; - typedef Lazy_rep_3(p.ptr()); if(lr && (! lr->et)){ - return lr->l1; + return std::get<1>(lr->l); } else { LRint* lrint = dynamic_cast(p.ptr()); if(lrint && (! lrint->et)){ - return lrint->l1; + return std::get<1>(lrint->l); } } @@ -465,7 +465,7 @@ public: Point_3 operator()(const Weighted_point_3& p) const { - typedef Lazy_rep_3 LR; - typedef Lazy_rep_3(p.ptr()); if(lr && (! lr->et)){ - return lr->l1; + return std::get<1>(lr->l); }else{ LRint* lrint = dynamic_cast(p.ptr()); if(lrint && (! lrint->et)){ - return lrint->l1; + return std::get<1>(lrint->l); } } return BaseClass().construct_point_3_object()(p); diff --git a/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt index 6b3d72637c4..ebe71fe250d 100644 --- a/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Filtered_kernel_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Generalized_map/examples/Generalized_map/CMakeLists.txt b/Generalized_map/examples/Generalized_map/CMakeLists.txt index 2fde81ed252..96e14762a6f 100644 --- a/Generalized_map/examples/Generalized_map/CMakeLists.txt +++ b/Generalized_map/examples/Generalized_map/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Generalized_map_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Generalized_map/test/Generalized_map/CMakeLists.txt b/Generalized_map/test/Generalized_map/CMakeLists.txt index 2fc8c4ac4a4..42a97871fe6 100644 --- a/Generalized_map/test/Generalized_map/CMakeLists.txt +++ b/Generalized_map/test/Generalized_map/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Generalized_map_Tests ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Generator/benchmark/Generator/CMakeLists.txt b/Generator/benchmark/Generator/CMakeLists.txt index cef6304650d..2fc34e54fd5 100644 --- a/Generator/benchmark/Generator/CMakeLists.txt +++ b/Generator/benchmark/Generator/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Generator_example ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Generator/examples/Generator/CMakeLists.txt b/Generator/examples/Generator/CMakeLists.txt index b5fc21b2fd3..8ef7883800d 100644 --- a/Generator/examples/Generator/CMakeLists.txt +++ b/Generator/examples/Generator/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Generator_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Generator/test/Generator/CMakeLists.txt b/Generator/test/Generator/CMakeLists.txt index a5606234f16..8842178b20b 100644 --- a/Generator/test/Generator/CMakeLists.txt +++ b/Generator/test/Generator/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Generator_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Geomview/demo/Geomview/CMakeLists.txt b/Geomview/demo/Geomview/CMakeLists.txt index fdba135eb21..0e03866d452 100644 --- a/Geomview/demo/Geomview/CMakeLists.txt +++ b/Geomview/demo/Geomview/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Geomview_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Geomview/test/Geomview/CMakeLists.txt b/Geomview/test/Geomview/CMakeLists.txt index 82a744ca346..960bdbb70c0 100644 --- a/Geomview/test/Geomview/CMakeLists.txt +++ b/Geomview/test/Geomview/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Geomview_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt index f7a8bc079d6..5f7ab12f0a5 100644 --- a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt +++ b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Alpha_shapes_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt index 275cbce4285..a7010daf3a3 100644 --- a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Apollonius_graph_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Bounding_volumes/CMakeLists.txt b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt index b05e83971bd..3e5c460cf57 100644 --- a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt +++ b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Bounding_volumes_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt index fcbf3c053aa..c41827b6ce9 100644 --- a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt +++ b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Circular_kernel_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Generator/CMakeLists.txt b/GraphicsView/demo/Generator/CMakeLists.txt index b4087d159f3..80b2e0b418f 100644 --- a/GraphicsView/demo/Generator/CMakeLists.txt +++ b/GraphicsView/demo/Generator/CMakeLists.txt @@ -1,8 +1,8 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Generator_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/GraphicsView/CMakeLists.txt b/GraphicsView/demo/GraphicsView/CMakeLists.txt index 68f0d001b0a..7a2a221bce6 100644 --- a/GraphicsView/demo/GraphicsView/CMakeLists.txt +++ b/GraphicsView/demo/GraphicsView/CMakeLists.txt @@ -1,8 +1,8 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (GraphicsView_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt index 87cc95e584f..af449d606ac 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (L1_Voronoi_diagram_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt index 66a9c615dc7..f9ea83c3ec3 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt +++ b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Largest_empty_rect_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index 8f4739f959c..7e50b5f1351 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project (Periodic_2_triangulation_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index bceee253d9a..8d0df276e19 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Polygon_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt index aa0672531f5..ac922296998 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Segment_Delaunay_graph_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 978a1c71b40..a87600e4507 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Segment_Delaunay_graph_Linf_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt index c7adc44e8dd..f4eb6c8b9d7 100644 --- a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt +++ b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Snap_rounding_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt index 47cb364fa44..fb30598a70e 100644 --- a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt +++ b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Spatial_searching_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Stream_lines_2/CMakeLists.txt b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt index 1ed1cb9be2a..b856b704cb9 100644 --- a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt +++ b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Stream_lines_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/GraphicsView/demo/Triangulation_2/CMakeLists.txt b/GraphicsView/demo/Triangulation_2/CMakeLists.txt index ec05e490664..a4be4c94ca3 100644 --- a/GraphicsView/demo/Triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Triangulation_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Triangulation_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt b/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt index 447e7b6ba16..bce6a8ffd4d 100644 --- a/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt +++ b/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( HalfedgeDS_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt b/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt index f5f9cd20dc2..05a364aad47 100644 --- a/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt +++ b/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( HalfedgeDS_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Hash_map/benchmark/Hash_map/CMakeLists.txt b/Hash_map/benchmark/Hash_map/CMakeLists.txt index 69c35aa6cf8..5a97491ec5e 100644 --- a/Hash_map/benchmark/Hash_map/CMakeLists.txt +++ b/Hash_map/benchmark/Hash_map/CMakeLists.txt @@ -1,19 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Hash_map ) - -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - - # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Hash_map/test/Hash_map/CMakeLists.txt b/Hash_map/test/Hash_map/CMakeLists.txt index dc3c46af912..7cacc28f58d 100644 --- a/Hash_map/test/Hash_map/CMakeLists.txt +++ b/Hash_map/test/Hash_map/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Hash_map_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt index bd784bb1f76..ee40274e08e 100644 --- a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Heat_method_3_Examples ) -cmake_minimum_required(VERSION 2.8.11) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Heat_method_3/test/Heat_method_3/CMakeLists.txt b/Heat_method_3/test/Heat_method_3/CMakeLists.txt index d498076d5b6..adb6cfa80c0 100644 --- a/Heat_method_3/test/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/test/Heat_method_3/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Heat_method_3_Tests ) -cmake_minimum_required(VERSION 2.8.11) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h index b3f054d611a..695caf75c22 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h @@ -453,14 +453,12 @@ class Reflection_repH2 : public Aff_transformation_rep_baseH2 virtual Direction_2 transform(const Direction_2 & d) const - { return transform( Vector_2(d) ).direction(); } + { return transform( d.vector() ).direction(); } virtual Aff_transformationH2 inverse() const { - return Aff_transformationH2( - static_cast< Aff_transformation_rep_baseH2* > - ( const_cast< Reflection_repH2*> (this) ) ); + return Aff_transformationH2(REFLECTION, l); } virtual bool diff --git a/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt index 9d590a059a8..dc3db6a4d0b 100644 --- a/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Hyperbolic_triangulation_2_benchmark ) -cmake_minimum_required(VERSION 2.8.10) find_package(CGAL QUIET 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 2a5cc5b55a4..f74d3a16aff 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1...3.13) +cmake_minimum_required(VERSION 3.1...3.15) project (Hyperbolic_triangulation_2_Demo) # Find includes in corresponding build directories diff --git a/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt index e0d12591bab..cfec6f7b943 100644 --- a/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Hyperbolic_triangulation_2_Examples ) -cmake_minimum_required(VERSION 3.1...3.13) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt index 73ee571e17d..61144763f2f 100644 --- a/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Hyperbolic_triangulation_2_Tests ) -cmake_minimum_required(VERSION 3.1...3.13) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt b/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt index 3d5706c5c0d..9246a135634 100644 --- a/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt +++ b/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Inscribed_areas_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt b/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt index bbf3e5e4984..4f80ea65904 100644 --- a/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt +++ b/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Inscribed_areas_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 8b15a579867..65d068fd24f 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -20,8 +20,9 @@ Release date: September 2019 - Added concepts and models for solving Mixed Integer Programming (MIP) problems with or without constraints. -### 2D Triangulations - +## 2D Triangulations +- Added range types and functions that return ranges, for example + for all vertices, which enables to use C++11 for-loops. - **Breaking change**: Removed the functions `CGAL::Constrained_triangulation_plus_2:: vertices_in_constraint_{begin/end}(Vertex_handle va, Vertex_handle vb) const;`, and `CGAL::Constrained_triangulation_plus_2::remove_constraint((Vertex_handle va, Vertex_handle vb)`, @@ -33,6 +34,8 @@ Release date: September 2019 - Add constructor and `insert()` function to `CGAL::Triangulation_2` that takes a range of points with info. ### 3D Triangulations +- Added range types and functions that return ranges, for example + for all vertices, which enables to use C++11 for-loops. - **Breaking change**: The constructor and the `insert()` function of `CGAL::Triangulation_3` which takes a range of points as argument no longer performs a `spatial_sort()` of the points. - Add constructor and `insert()` function to `CGAL::Triangulation_3` that takes a range of points with info. @@ -51,6 +54,13 @@ Release date: September 2019 for optional parameters is now removed (it was deprecated since CGAL 4.12). The current (and now only) API uses ranges and Named Parameters. + - Added the possibility to use the named parameter + `neighbor_radius` to use spherical neighbor queries instead of + K-nearest neighbors queries for the following functions: + `CGAL::bilateral_smooth_point_set()`, + `CGAL::jet_estimate_normals()`, `CGAL::jet_smooth_point_set()`, + `CGAL::mst_orient_normals()`, `CGAL::pca_estimate_normals()` and + `CGAL::remove_outliers()`. ### Polygon Mesh Processing - Added the function `CGAL::Polygon_mesh_processing::centroid()`, which computes @@ -91,6 +101,9 @@ Release date: September 2019 `CGAL::Sphere_3`, `CGAL::Vector_2`, `CGAL::Vector_3`, `CGAL::Weighted_point_2` and `CGAL::Weighted_point_3`. +### dD Geometry Kernel +- New exact kernel `Epeck_d` + ### IO Streams - Added new functions to support some parts of the WKT file format: - `CGAL::read_point_WKT()` diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 67c02505d4e..43ecf358f28 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -4,14 +4,10 @@ # ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as # ${CMAKE_BINARY_DIR} or ${CMAKE_BINARY_DIR}. if(NOT PROJECT_NAME) + cmake_minimum_required(VERSION 3.1...3.15) project(CGAL CXX C) endif() -# Minimal version of CMake: -cmake_minimum_required(VERSION 3.1) - -# Tested version: -cmake_policy(VERSION 3.1) if(POLICY CMP0056) # https://cmake.org/cmake/help/v3.2/policy/CMP0056.html diff --git a/Installation/demo/CMakeLists.txt b/Installation/demo/CMakeLists.txt index bc7742627a1..d418f55efc5 100644 --- a/Installation/demo/CMakeLists.txt +++ b/Installation/demo/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(CGAL_DEMOS) -cmake_minimum_required(VERSION 3.1) if (CGAL_BRANCH_BUILD) diff --git a/Installation/examples/CMakeLists.txt b/Installation/examples/CMakeLists.txt index 643083964e5..4bfe831125a 100644 --- a/Installation/examples/CMakeLists.txt +++ b/Installation/examples/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(CGAL_EXAMPLES) -cmake_minimum_required(VERSION 3.1) if (CGAL_BRANCH_BUILD) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 1d363b6bf38..e3ea931db2f 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -554,6 +554,12 @@ using std::max; # define CGAL_NORETURN #endif +// Macro to specify [[no_unique_address]] if supported +#if __has_cpp_attribute(no_unique_address) +# define CGAL_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +# define CGAL_NO_UNIQUE_ADDRESS +#endif // Macro CGAL_ASSUME // Call a builtin of the compiler to pass a hint to the compiler diff --git a/Installation/test/CMakeLists.txt b/Installation/test/CMakeLists.txt index b3d48f783e6..4191a3d8132 100644 --- a/Installation/test/CMakeLists.txt +++ b/Installation/test/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(CGAL_TESTS) -cmake_minimum_required(VERSION 3.1) if (CGAL_BRANCH_BUILD) diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index a8e11520ed3..1428689fa6b 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Installation_Tests ) -cmake_minimum_required(VERSION 3.1) macro(create_link_to_program COMPONENT ) diff --git a/Interpolation/demo/Interpolation/CMakeLists.txt b/Interpolation/demo/Interpolation/CMakeLists.txt index 17bf86f2500..c725480248b 100644 --- a/Interpolation/demo/Interpolation/CMakeLists.txt +++ b/Interpolation/demo/Interpolation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Interpolation_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Interpolation/examples/Interpolation/CMakeLists.txt b/Interpolation/examples/Interpolation/CMakeLists.txt index d12b05c9cf7..e67f810beaf 100644 --- a/Interpolation/examples/Interpolation/CMakeLists.txt +++ b/Interpolation/examples/Interpolation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Interpolation_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Interpolation/test/Interpolation/CMakeLists.txt b/Interpolation/test/Interpolation/CMakeLists.txt index d0cf0974741..cd63391899a 100644 --- a/Interpolation/test/Interpolation/CMakeLists.txt +++ b/Interpolation/test/Interpolation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Interpolation_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Intersections_2/test/Intersections_2/CMakeLists.txt b/Intersections_2/test/Intersections_2/CMakeLists.txt index 8776da99898..ca7c9af6f7f 100644 --- a/Intersections_2/test/Intersections_2/CMakeLists.txt +++ b/Intersections_2/test/Intersections_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Intersections_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Intersections_2/test/Intersections_2/test_intersections_2.cpp b/Intersections_2/test/Intersections_2/test_intersections_2.cpp index f501bf75211..073adae0846 100644 --- a/Intersections_2/test/Intersections_2/test_intersections_2.cpp +++ b/Intersections_2/test/Intersections_2/test_intersections_2.cpp @@ -798,9 +798,9 @@ int main() { CGAL::Set_ieee_double_precision pfr; - Test< CGAL::Simple_cartesian::Type > >().run(); + Test< CGAL::Simple_cartesian::Type > >().run(); Test< CGAL::Cartesian >().run(); - Test< CGAL::Homogeneous::Type > >().run(); + Test< CGAL::Homogeneous::Type > >().run(); Test< CGAL::Exact_predicates_inexact_constructions_kernel >().run(); Test< CGAL::Exact_predicates_exact_constructions_kernel >().run(); } diff --git a/Intersections_3/test/Intersections_3/CMakeLists.txt b/Intersections_3/test/Intersections_3/CMakeLists.txt index f218d33bd42..9c0b854325c 100644 --- a/Intersections_3/test/Intersections_3/CMakeLists.txt +++ b/Intersections_3/test/Intersections_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Intersections_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt b/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt index 2d26929b883..5e56b2e0441 100644 --- a/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt +++ b/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Interval_skip_list_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt b/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt index 9245b8e32a4..ddd8e03515e 100644 --- a/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt +++ b/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Interval_skip_list_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Interval_support/test/Interval_support/CMakeLists.txt b/Interval_support/test/Interval_support/CMakeLists.txt index 220902b3b7d..f2b07259aaa 100644 --- a/Interval_support/test/Interval_support/CMakeLists.txt +++ b/Interval_support/test/Interval_support/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Interval_support_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Inventor/test/Inventor/CMakeLists.txt b/Inventor/test/Inventor/CMakeLists.txt index cf2ec4f6944..0d296008396 100644 --- a/Inventor/test/Inventor/CMakeLists.txt +++ b/Inventor/test/Inventor/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Inventor_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt index 51cf4c4b351..19a1b9d32bd 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Jet_fitting_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt index 14e3e10e01b..c1cbc58150d 100644 --- a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Jet_fitting_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h b/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h index a8d6d43f269..aca6cf82c8b 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Aff_transformation_2.h @@ -40,6 +40,7 @@ therefore do not appear in the constructors. \sa `Rotation` \sa `Scaling` \sa `Translation` +\sa `Reflection` \sa `rational_rotation_approximation_grp` \cgalHeading{Example} @@ -129,6 +130,12 @@ Aff_transformation_2(const Scaling, const Kernel::RT &s, const Kernel::RT &hw = RT(1)); +/*! +introduces a reflection by a line `l`. +*/ +Aff_transformation_2(const Reflection, +const Line_2& l); + /*! introduces a general affine transformation in the \f$3 \times 3\f$ matrix form diff --git a/Kernel_23/examples/Kernel_23/CMakeLists.txt b/Kernel_23/examples/Kernel_23/CMakeLists.txt index efa36a2a3e9..0a49ed4e2b5 100644 --- a/Kernel_23/examples/Kernel_23/CMakeLists.txt +++ b/Kernel_23/examples/Kernel_23/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Kernel_23_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 4a2dec20634..e75adb41e34 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Kernel_23_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h index a17c5ee31ca..41682ebbdf7 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_aff_transformation_2.h @@ -121,7 +121,7 @@ _test_cls_aff_transformation_2(const R& ) CGAL::Aff_transformation_2 xrefl(-n4, n0, n0, n0, n4, n0, n4 ); - + CGAL::Aff_transformation_2 gat4( gat3); CGAL::Aff_transformation_2 gat5( n7, n9, @@ -556,6 +556,7 @@ _test_cls_aff_transformation_2(const R& ) assert( FT( ident.hm(2,1) ) / FT( ident.hm(2,2) ) == FTzero ); assert( FT( ident.hm(2,2) ) / FT( ident.hm(2,2) ) == FTone ); + // samples // cartesian == m assert( gat1.cartesian(1,2) == gat1.m(1,2) ); @@ -582,13 +583,74 @@ _test_cls_aff_transformation_2(const R& ) assert( ident.homogeneous(1,2) == ident.hm(1,2) ); assert( gscale.homogeneous(1,1) == gscale.hm(1,1) ); + //tests for reflection + CGAL::Aff_transformation_2 refl(CGAL::REFLECTION, CGAL::Line_2( + CGAL::Point_2(1,3), + CGAL::Point_2(2,1))); + CGAL::Point_2 p(4,2); + assert(p.transform(refl) == CGAL::Point_2(0,0)); + + + //with translation + CGAL::Aff_transformation_2 trans(CGAL::TRANSLATION, CGAL::Vector_2(1,-2)); + CGAL::Aff_transformation_2 comp1(refl*trans), + comp2(trans*refl); + p1 = p.transform(trans); + p1 = p1.transform(refl); + assert(p1 == CGAL::Point_2(1,-2)); + assert(p1 == p.transform(comp1) || nonexact); + p1 = p.transform(refl); + p1 = p1.transform(trans); + assert(p1 == p.transform(comp2)); + //with scaling + CGAL::Aff_transformation_2 scal(CGAL::SCALING, 2); + comp1 = refl*scal; + comp2 = scal*refl; + p1 = p.transform(scal); + p1 = p1.transform(refl); + assert(p1 == p.transform(comp1)); + p1 = p.transform(refl); + p1 = p1.transform(scal); + assert(p1 == p.transform(comp2)); + //with rotation + CGAL::Aff_transformation_2 rot(CGAL::ROTATION, 1, 0); + comp1 = refl*rot; + comp2 = rot*refl; + p1 = p.transform(rot); + p1 = p1.transform(refl); + assert(p1 == p.transform(comp1)); + p1 = p.transform(refl); + p1 = p1.transform(rot); + assert(p1 == p.transform(comp2)); + //with reflection + CGAL::Aff_transformation_2 refl2(CGAL::REFLECTION, CGAL::Line_2( + CGAL::Point_2(0,0), + CGAL::Point_2(1,1))); + comp1 = refl*refl2; + comp2 = refl2*refl; + p1 = p.transform(refl2); + p1 = p1.transform(refl); + assert(p1 == p.transform(comp1)); + p1 = p.transform(refl); + p1 = p1.transform(refl2); + assert(p1 == p.transform(comp2)); + //with transformation + CGAL::Aff_transformation_2 afft(1,2,3,4,5,6); + comp1 = refl*afft; + comp2 = afft*refl; + p1 = p.transform(afft); + p1 = p1.transform(refl); + assert(p1 == p.transform(comp1)); + p1 = p.transform(refl); + p1 = p1.transform(afft); + assert(p1 == p.transform(comp2)); + //equality CGAL::Aff_transformation_2 a2(0,1,0,1), a3(0,1,0,1), a4(0,0,1,1); assert(a2 == a3); assert(a3 != a4); - std::cout << "done" << std::endl; return true; } diff --git a/Kernel_d/doc/Kernel_d/CGAL/Epeck_d.h b/Kernel_d/doc/Kernel_d/CGAL/Epeck_d.h new file mode 100644 index 00000000000..5e2faa6a59f --- /dev/null +++ b/Kernel_d/doc/Kernel_d/CGAL/Epeck_d.h @@ -0,0 +1,139 @@ + +namespace CGAL { + +/*! +\ingroup PkgKernelDKernels + +\cgalModifBegin +A model for `Kernel_d`, minus `Kernel_d::Point_of_sphere_d`, that uses %Cartesian coordinates to represent the +geometric objects. + +This kernel is default constructible and copyable. It does not carry any +state so it is possible to use objects created by one instance with +functors created by another one. + +This kernel supports construction of points from `double` %Cartesian +coordinates. It provides exact geometric predicates and constructions. The +geometric predicates are made exact without sacrificing speed thanks to the use +of filters. The geometric constructions are made exact without sacrificing +speed thanks to a lazy mechanism, similar to +`Exact_predicates_exact_constructions_kernel`. A construction creates an +approximate object, and stores a directed acyclic graph (DAG) of the operation +and arguments used. When an operation needs more precision on an object than is +currently available, which should be rare, %CGAL reconstructs exactly all the +ancestors of the object and replaces this part of the graph with exact objects. +This should be transparent for users, those details do not affect the +functionality, but they can cause surprising running time where the costly part +of an algorithm is not the construction itself, but a seemingly trivial use +afterwards that causes exact reconstruction of a large part of the structure. + +`Sphere_d` is represented internally with a center and a squared radius, and the exact type used by the kernel is a rational type. This means that `Kernel_d::Point_of_sphere_d` cannot be implemented exactly in dimensions up to 3 (higher dimensions would require a decomposition of an integer as a sum of `d` squares), so currently it is not provided at all. + +\tparam DimensionTag is a tag representing the dimension of the +ambient Euclidean space. It may be either `Dimension_tag` where `d` is +an integer +or `Dynamic_dimension_tag`. In the latter case, the dimension of the space is specified for each point when it is constructed, so it does not need to be known at compile-time. + + +\attention Only the interfaces specific to this class are listed below. Refer to the +concepts for the rest. + +\attention Known bugs: the functor `Kernel_d::Intersect_d` is not yet implemented. `Kernel_d::Contained_in_affine_hull` assumes that the iterators refer to an affinely independent family. `Kernel_d::Orientation_d` only works for points, not vectors. Visual Studio 2015 is not supported. + +\attention This kernel requires the \ref thirdpartyEigen "Eigen" library. + + + +\cgalModels `Kernel_d` +\cgalModels `DelaunayTriangulationTraits` +\cgalModels `RegularTriangulationTraits` +\cgalModels `SearchTraits` +\cgalModels `RangeSearchTraits` + +\sa `CGAL::Cartesian_d` +\sa `CGAL::Homogeneous_d` +\sa `CGAL::Epick_d` + +*/ +template< typename DimensionTag > +struct Epeck_d { +/*! +represents a point in the Euclidean space +\cgalModels `DefaultConstructible` +\cgalModels `Assignable` +*/ +class Point_d { +public: +/*! introduces a point with coordinates (x0, x1, ...) where the number of + coordinates matches the dimension. + \pre `DimensionTag` is a fixed dimension, not `Dynamic_dimension_tag`. */ +Point_d(double x0, double x1, ...); + +/*! introduces a point with coordinate set `[first,end)`. + \pre If `DimensionTag` is a fixed dimension, it matches `distance(first,end)`. + \tparam ForwardIterator has its value type that is convertible to `double`. + */ +template +Point_d(ForwardIterator first, ForwardIterator end); + +/*! returns the i'th coordinate of a point. + \pre `i` is non-negative and less than the dimension. */ +double operator[](int i)const; + +/*! returns an iterator pointing to the zeroth Cartesian coordinate. */ +Cartesian_const_iterator_d cartesian_begin()const; +/*! returns an iterator pointing beyond the last Cartesian coordinate. */ +Cartesian_const_iterator_d cartesian_end()const; +}; + +/*! +represents a weighted point in the Euclidean space +\cgalModels `DefaultConstructible` +\cgalModels `Assignable` +*/ +class Weighted_point_d { +public: +/*! introduces a weighted point with point p and weight w. */ +Weighted_point_d(const Point_d& p, const double& w); +/*! extracts the point of a weighted point. */ +Point_d point() const; +/*! extracts the weight of a weighted point. */ +double weight() const; +}; + +/*! \cgalModels `Kernel_d::Center_of_sphere_d` + */ +class Construct_circumcenter_d { +public: +/*! returns the center of the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and passes through all the points of A. The order of the points of A does not matter. + \pre A is affinely independant. + \tparam ForwardIterator has `Epeck_d::Point_d` as value type. + */ +template +Point_d operator()(ForwardIterator first, ForwardIterator last); +}; +class Compute_squared_radius_d { +public: +/*! returns the radius of the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and passes through all the points of A. The order of the points of A does not matter. + \pre A is affinely independant. + \tparam ForwardIterator has `Epeck_d::Point_d` as value type. + */ +template +FT operator()(ForwardIterator first, ForwardIterator last); +}; +/*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d` + */ +class Side_of_bounded_sphere_d { +public: +/*! returns the relative position of point p to the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and passes through all the points of A. The order of the points of A does not matter. + \pre A is affinely independant. + \tparam ForwardIterator has `Epeck_d::Point_d` as value type. + */ +template +Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Point_d&p); +}; +Construct_circumcenter_d construct_circumcenter_d_object(); +Compute_squared_radius_d compute_squared_radius_d_object(); +}; /* end Epeck_d */ +} /* end namespace CGAL */ +/// \cgalModifEnd diff --git a/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h b/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h index 7b733fe2f87..1999d676423 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/Epick_d.h @@ -5,7 +5,7 @@ namespace CGAL { \ingroup PkgKernelDKernels A model for `Kernel_d` that uses %Cartesian coordinates to represent the -geometric objects. +geometric objects. This kernel is default constructible and copyable. It does not carry any state so it is possible to use objects created by one instance with @@ -26,10 +26,7 @@ or `Dynamic_dimension_tag`. In the latter case, the dimension of the space is sp \attention Only the interfaces specific to this class are listed below. Refer to the concepts for the rest. -\attention Known bugs: the functor `Intersect_d` is not yet implemented. `Contained_in_affine_hull` assumes that the iterators refer to an affinely independent family. `Orientation_d` only works for points, not vectors. - -\attention Ancient compilers like gcc-4.2 or icc 14 are not supported, but gcc-4.4 and -icc 15 work. +\attention Known bugs: the functor `Kernel_d::Intersect_d` is not yet implemented. `Kernel_d::Contained_in_affine_hull` assumes that the iterators refer to an affinely independent family. `Kernel_d::Orientation_d` only works for points, not vectors. \attention This kernel requires the \ref thirdpartyEigen "Eigen" library. @@ -43,6 +40,7 @@ icc 15 work. \sa `CGAL::Cartesian_d` \sa `CGAL::Homogeneous_d` +\sa `CGAL::Epeck_d` */ template< typename DimensionTag > @@ -109,7 +107,7 @@ public: \tparam ForwardIterator has `Epick_d::Point_d` as value type. */ template -Point_d operator()(ForwardIterator first, ForwardIterator last); +FT operator()(ForwardIterator first, ForwardIterator last); }; /*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d` */ diff --git a/Kernel_d/doc/Kernel_d/Concepts/Kernel_d.h b/Kernel_d/doc/Kernel_d/Concepts/Kernel_d.h index 121402955d7..4de476b3f58 100644 --- a/Kernel_d/doc/Kernel_d/Concepts/Kernel_d.h +++ b/Kernel_d/doc/Kernel_d/Concepts/Kernel_d.h @@ -21,6 +21,7 @@ replacing operators, especially for equality testing. \cgalHasModel `CGAL::Cartesian_d` \cgalHasModel `CGAL::Homogeneous_d` \cgalHasModel `CGAL::Epick_d` +\cgalHasModel `CGAL::Epeck_d` */ class Kernel_d { public: diff --git a/Kernel_d/doc/Kernel_d/Kernel_d.txt b/Kernel_d/doc/Kernel_d/Kernel_d.txt index bdfa7b73a6e..2808516bb04 100644 --- a/Kernel_d/doc/Kernel_d/Kernel_d.txt +++ b/Kernel_d/doc/Kernel_d/Kernel_d.txt @@ -210,7 +210,7 @@ type `LinearAlgebra`. \subsection Kernel_dEpickKernel Epick_d Kernel The kernel `Epick_d`, short for Exact Predicates Inexact -Constructions Kernel is a kernel particularly useful when the dimension of +Constructions %Kernel is a kernel particularly useful when the dimension of the space is known at compile-time; The template parameter `DimensionTag` is then `Dimension_tag` where `d` is an integer representing the dimension. It may also be used with parameter `Dynamic_dimension_tag`, in which case the @@ -224,6 +224,24 @@ Note that it provides few interfaces in addition to those documented in the `Kernel_d` concept. In particular, the type of a point is only available as `Epick_d::%Point_d`, not `Point_d>`. +\cgalModifBegin +\subsection Kernel_dEpeckKernel Epeck_d Kernel + +The kernel `Epeck_d`, short for Exact Predicates Exact +Constructions %Kernel is a kernel particularly useful when the dimension of +the space is known at compile-time; The template parameter `DimensionTag` is then +`Dimension_tag` where `d` is an integer representing the dimension. It +may also be used with parameter `Dynamic_dimension_tag`, in which case the +dimension does not need to be known at compile-time. +It uses a %Cartesian representation and +supports construction of points from `double` coordinates. It provides exact +geometric predicates and constructions. + +Note that it provides few interfaces in addition to those documented in the +`Kernel_d` concept. In particular, the type of a point is only available as +`Epeck_d::%Point_d`, not `Point_d>`. +\cgalModifEnd + \subsection Kernel_dNamingconventions Naming Conventions @@ -538,7 +556,7 @@ evolution of the low-dimensional kernel. The kernel was revised based on suggestions by Hervé Brönnimann, Michael Hoffmann, and Stefan Schirra. -Epick_d was added by Marc Glisse in 2014. +Marc Glisse added Epick_d in 2014 and Epeck_d in 2019. \subsection Kernel_dAcknowledgments Acknowledgments diff --git a/Kernel_d/doc/Kernel_d/PackageDescription.txt b/Kernel_d/doc/Kernel_d/PackageDescription.txt index d1360b409c1..f8c024183a2 100644 --- a/Kernel_d/doc/Kernel_d/PackageDescription.txt +++ b/Kernel_d/doc/Kernel_d/PackageDescription.txt @@ -49,6 +49,7 @@ - `CGAL::Cartesian_d` - `CGAL::Homogeneous_d` - `CGAL::Epick_d` +- `CGAL::Epeck_d` \cgalCRPSection{%Kernel Objects} - `CGAL::Point_d` diff --git a/Kernel_d/test/Kernel_d/CMakeLists.txt b/Kernel_d/test/Kernel_d/CMakeLists.txt index d762e532a7a..a51d50d4063 100644 --- a/Kernel_d/test/Kernel_d/CMakeLists.txt +++ b/Kernel_d/test/Kernel_d/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Kernel_d_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 f80ad42a2ee..104ba1e1e06 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(LCC_performance_2) -cmake_minimum_required(VERSION 3.1) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) 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 e3eff7e6d85..5deb9decee3 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,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(LCC_performance_3) -cmake_minimum_required(VERSION 3.1) 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 d23afa5eb3d..23122c42449 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. # cmake ../ -DCMAKE_BUILD_TYPE=Debug +cmake_minimum_required(VERSION 3.1...3.15) project (Linear_cell_complex_Demo) -cmake_minimum_required(VERSION 3.1) 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/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 4ed3f8f2f2c..270c76321d8 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Linear_cell_complex_Examples ) -cmake_minimum_required(VERSION 3.1) 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/test/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt index 9ae14e0d428..83ce4a56d3d 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Linear_cell_complex_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Matrix_search/examples/Matrix_search/CMakeLists.txt b/Matrix_search/examples/Matrix_search/CMakeLists.txt index d72870c96af..06b6e55653e 100644 --- a/Matrix_search/examples/Matrix_search/CMakeLists.txt +++ b/Matrix_search/examples/Matrix_search/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Matrix_search_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Matrix_search/test/Matrix_search/CMakeLists.txt b/Matrix_search/test/Matrix_search/CMakeLists.txt index fd3de9c33ab..b64f9a2ce51 100644 --- a/Matrix_search/test/Matrix_search/CMakeLists.txt +++ b/Matrix_search/test/Matrix_search/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Matrix_search_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Mesh_2/demo/Mesh_2/CMakeLists.txt b/Mesh_2/demo/Mesh_2/CMakeLists.txt index f50101e391a..5d2a871c8bd 100644 --- a/Mesh_2/demo/Mesh_2/CMakeLists.txt +++ b/Mesh_2/demo/Mesh_2/CMakeLists.txt @@ -1,9 +1,9 @@ # 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.1...3.15) project( Mesh_2_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Mesh_2/examples/Mesh_2/CMakeLists.txt b/Mesh_2/examples/Mesh_2/CMakeLists.txt index 69148ac52ee..dba5c15ac7f 100644 --- a/Mesh_2/examples/Mesh_2/CMakeLists.txt +++ b/Mesh_2/examples/Mesh_2/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Mesh_2/test/Mesh_2/CMakeLists.txt b/Mesh_2/test/Mesh_2/CMakeLists.txt index e5bb16314ee..dbad6bab456 100644 --- a/Mesh_2/test/Mesh_2/CMakeLists.txt +++ b/Mesh_2/test/Mesh_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Mesh_3/archive/applications/CMakeLists.txt b/Mesh_3/archive/applications/CMakeLists.txt index 9ce425b3cd8..688379dab15 100644 --- a/Mesh_3/archive/applications/CMakeLists.txt +++ b/Mesh_3/archive/applications/CMakeLists.txt @@ -2,10 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_3_applications ) -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) - include_directories(../include) diff --git a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt index 27422304a52..5192a5b79a1 100644 --- a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt +++ b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_3_benchmark ) -cmake_minimum_required(VERSION 3.1) # Creates a new CMake option, turned ON by default diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 629102a8891..363821b8f97 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_3_Examples ) -cmake_minimum_required(VERSION 3.1) add_definitions(-DCGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 9416ffb65a5..03f021a7172 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_3_Tests ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) diff --git a/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt b/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt index 2f136a10e3f..b6eba1ecf06 100644 --- a/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt +++ b/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Minkowski_sum_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 d33c2b035fc..1399a98fe6b 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt +++ b/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Minkowski_sum_2_Tests ) -cmake_minimum_required(VERSION 3.1) # Commented out C++11 for now # list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_generalized_initializers has_cpp11) diff --git a/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt b/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt index 48979916032..1139a09ca1a 100644 --- a/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt +++ b/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Minkowski_sum_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt b/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt index 6dd6ab412ca..3e63dc654a9 100644 --- a/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt +++ b/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Minkowski_sum_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Modifier/test/Modifier/CMakeLists.txt b/Modifier/test/Modifier/CMakeLists.txt index 5725a932f98..3963e02285c 100644 --- a/Modifier/test/Modifier/CMakeLists.txt +++ b/Modifier/test/Modifier/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Modifier_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt b/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt index 7938201664d..4fd088120ec 100644 --- a/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt +++ b/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Modular_arithmetic_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt b/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt index 87d9c78a2c2..0af90f16bab 100644 --- a/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt +++ b/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Modular_arithmetic_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Nef_2/examples/Nef_2/CMakeLists.txt b/Nef_2/examples/Nef_2/CMakeLists.txt index f9e6a9469f4..291dbb406ef 100644 --- a/Nef_2/examples/Nef_2/CMakeLists.txt +++ b/Nef_2/examples/Nef_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Nef_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Nef_2/test/Nef_2/CMakeLists.txt b/Nef_2/test/Nef_2/CMakeLists.txt index d7b38938cf1..4807a0e67e1 100644 --- a/Nef_2/test/Nef_2/CMakeLists.txt +++ b/Nef_2/test/Nef_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Nef_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Nef_3/examples/Nef_3/CMakeLists.txt b/Nef_3/examples/Nef_3/CMakeLists.txt index c2f45ea20a4..ec12fc129f2 100644 --- a/Nef_3/examples/Nef_3/CMakeLists.txt +++ b/Nef_3/examples/Nef_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Nef_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Nef_3/test/Nef_3/CMakeLists.txt b/Nef_3/test/Nef_3/CMakeLists.txt index d7661acf34e..298c66dea57 100644 --- a/Nef_3/test/Nef_3/CMakeLists.txt +++ b/Nef_3/test/Nef_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Nef_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Nef_S2/examples/Nef_S2/CMakeLists.txt b/Nef_S2/examples/Nef_S2/CMakeLists.txt index 7b698fa8636..6eaf799c38c 100644 --- a/Nef_S2/examples/Nef_S2/CMakeLists.txt +++ b/Nef_S2/examples/Nef_S2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Nef_S2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Nef_S2/test/Nef_S2/CMakeLists.txt b/Nef_S2/test/Nef_S2/CMakeLists.txt index 2690878885b..e4005c20794 100644 --- a/Nef_S2/test/Nef_S2/CMakeLists.txt +++ b/Nef_S2/test/Nef_S2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Nef_S2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/NewKernel_d/include/CGAL/Epeck_d.h b/NewKernel_d/include/CGAL/Epeck_d.h index e8fa035db94..0ae68f32aec 100644 --- a/NewKernel_d/include/CGAL/Epeck_d.h +++ b/NewKernel_d/include/CGAL/Epeck_d.h @@ -26,19 +26,18 @@ #include #include #include +#include +#include #include +#include - +// TODO: add static filters somewhere namespace CGAL { -#define CGAL_BASE \ - Cartesian_base_d::Type, Dim> -template -struct Epeck_d_help1 -: CGAL_BASE -{ - CGAL_CONSTEXPR Epeck_d_help1(){} - CGAL_CONSTEXPR Epeck_d_help1(int d):CGAL_BASE(d){} -}; +#define CGAL_KA Cartesian_base_d +#define CGAL_KE Cartesian_base_d::Type, Dim> +template using Epeck_d_help1 = Lazy_cartesian>; +#undef CGAL_KE +#undef CGAL_KA #undef CGAL_BASE #define CGAL_BASE \ Kernel_d_interface< \ @@ -49,8 +48,8 @@ template struct Epeck_d : CGAL_BASE { - CGAL_CONSTEXPR Epeck_d(){} - CGAL_CONSTEXPR Epeck_d(int d):CGAL_BASE(d){} + constexpr Epeck_d(){} + constexpr Epeck_d(int d):CGAL_BASE(d){} }; #undef CGAL_BASE } diff --git a/NewKernel_d/include/CGAL/Epick_d.h b/NewKernel_d/include/CGAL/Epick_d.h index 5728e41e745..f26a9faa547 100644 --- a/NewKernel_d/include/CGAL/Epick_d.h +++ b/NewKernel_d/include/CGAL/Epick_d.h @@ -44,8 +44,8 @@ template struct Epick_d_help1 : CGAL_BASE { - CGAL_CONSTEXPR Epick_d_help1(){} - CGAL_CONSTEXPR Epick_d_help1(int d):CGAL_BASE(d){} + constexpr Epick_d_help1(){} + constexpr Epick_d_help1(int d):CGAL_BASE(d){} }; #undef CGAL_BASE #define CGAL_BASE \ @@ -54,8 +54,8 @@ template struct Epick_d_help2 : CGAL_BASE { - CGAL_CONSTEXPR Epick_d_help2(){} - CGAL_CONSTEXPR Epick_d_help2(int d):CGAL_BASE(d){} + constexpr Epick_d_help2(){} + constexpr Epick_d_help2(int d):CGAL_BASE(d){} }; #undef CGAL_BASE #define CGAL_BASE \ @@ -67,8 +67,8 @@ template struct Epick_d : CGAL_BASE { - CGAL_CONSTEXPR Epick_d(){} - CGAL_CONSTEXPR Epick_d(int d):CGAL_BASE(d){} + constexpr Epick_d(){} + constexpr Epick_d(int d):CGAL_BASE(d){} }; #undef CGAL_BASE } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_base.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_base.h index 8b95c286aa6..2b1b0fa9ec9 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_base.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_base.h @@ -89,6 +89,7 @@ struct Cartesian_LA_base_d : public Dimension_base ::add::type ::add::type ::add::type + ::add::type Object_list; typedef typeset< Point_cartesian_const_iterator_tag>::type @@ -170,8 +171,8 @@ struct Cartesian_LA_base_d : public Dimension_base typedef CartesianDVectorBase::Identity_functor type; }; - CGAL_CONSTEXPR Cartesian_LA_base_d(){} - CGAL_CONSTEXPR Cartesian_LA_base_d(int d):Dimension_base(d){} + constexpr Cartesian_LA_base_d(){} + constexpr Cartesian_LA_base_d(int d):Dimension_base(d){} }; } //namespace CGAL diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h index b15b44fe3ec..65f73a2a182 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h @@ -28,38 +28,13 @@ #include #include #include +#include namespace CGAL { namespace CartesianDVectorBase { -#ifndef CGAL_CXX11 -namespace internal { -template struct Construct_LA_vector_ { - struct Never_use {}; - void operator()(Never_use)const; -}; -#define CGAL_CODE(Z,N,_) template struct Construct_LA_vector_ > { \ - typedef typename R::Constructor Constructor; \ - typedef typename Get_type::type RT; \ - typedef typename R::Vector_ result_type; \ - result_type operator() \ - (BOOST_PP_ENUM_PARAMS(N,RT const& t)) const { \ - return typename Constructor::Values()(BOOST_PP_ENUM_PARAMS(N,t)); \ - } \ - result_type operator() \ - (BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N),RT const& t)) const { \ - return typename Constructor::Values_divide()(t##N,BOOST_PP_ENUM_PARAMS(N,t)); \ - } \ - }; -BOOST_PP_REPEAT_FROM_TO(2, 11, CGAL_CODE, _ ) -#undef CGAL_CODE -} -#endif template struct Construct_LA_vector : private Store_kernel -#ifndef CGAL_CXX11 -, public internal::Construct_LA_vector_ -#endif { //CGAL_FUNCTOR_INIT_IGNORE(Construct_LA_vector) CGAL_FUNCTOR_INIT_STORE(Construct_LA_vector) @@ -87,15 +62,12 @@ template struct Construct_LA_vector result_type operator()(result_type const& v)const{ return v; } -#ifdef CGAL_CXX11 result_type operator()(result_type&& v)const{ return std::move(v); } -#endif -#ifdef CGAL_CXX11 template typename std::enable_if::value && - boost::is_same, Dimension>::value, + std::is_same, Dimension>::value, result_type>::type operator()(U&&...u)const{ return typename Constructor::Values()(std::forward(u)...); @@ -103,22 +75,19 @@ template struct Construct_LA_vector //template::value>::type,class=typename std::enable_if<(sizeof...(U)==static_dim+1)>::type,class=void> template typename std::enable_if::value && - boost::is_same, Dimension>::value, + std::is_same, Dimension>::value, result_type>::type operator()(U&&...u)const{ return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward(u)...); } -#else - using internal::Construct_LA_vector_::operator(); -#endif template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (Iter f,Iter g,Cartesian_tag t)const { return this->operator()((int)std::distance(f,g),f,g,t); } template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (int d,Iter f,Iter g,Cartesian_tag)const { CGAL_assertion(d==std::distance(f,g)); @@ -126,28 +95,28 @@ template struct Construct_LA_vector return typename Constructor::Iterator()(d,f,g); } template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (Iter f,Iter g,Homogeneous_tag)const { --g; return this->operator()((int)std::distance(f,g),f,g,*g); } template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (int d,Iter f,Iter g,Homogeneous_tag)const { --g; return this->operator()(d,f,g,*g); } template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (Iter f,Iter g)const { // Shouldn't it try comparing dist(f,g) to the dimension if it is known? return this->operator()(f,g,typename R::Rep_tag()); } template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (int d,Iter f,Iter g)const { return this->operator()(d,f,g,typename R::Rep_tag()); @@ -155,7 +124,7 @@ template struct Construct_LA_vector // Last homogeneous coordinate given separately template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (int d,Iter f,Iter g,NT const&l)const { CGAL_assertion(d==std::distance(f,g)); @@ -164,7 +133,7 @@ template struct Construct_LA_vector return typename Constructor::Iterator()(d,CGAL::make_transforming_iterator(f,Divide(l)),CGAL::make_transforming_iterator(g,Divide(l))); } template inline - typename boost::enable_if,result_type>::type operator() + typename std::enable_if_t::value,result_type> operator() (Iter f,Iter g,NT const&l)const { return this->operator()((int)std::distance(f,g),f,g,l); @@ -178,15 +147,10 @@ template struct Compute_cartesian_coordinate { typedef typename R::Vector_ first_argument_type; typedef int second_argument_type; typedef Tag_true Is_exact; -#ifdef CGAL_CXX11 typedef decltype(std::declval()[0]) result_type; -#else - typedef RT const& result_type; - // RT const& doesn't work with some LA (Eigen2 for instance) so we - // should use plain RT or find a way to detect this. -#endif - result_type operator()(first_argument_type const& v,int i)const{ + template + result_type operator()(first_argument_type const& v,index_type i)const{ return v[i]; } }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h index 72595f1a355..c7c6ed97ef4 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h @@ -31,8 +31,8 @@ namespace CGAL { template < typename FT_, typename Dim_, typename Derived_=Default> struct Cartesian_base_d : public CGAL_BASE { - CGAL_CONSTEXPR Cartesian_base_d(){} - CGAL_CONSTEXPR Cartesian_base_d(int d):CGAL_BASE(d){} + constexpr Cartesian_base_d(){} + constexpr Cartesian_base_d(int d):CGAL_BASE(d){} }; #undef CGAL_BASE diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_change_FT.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_change_FT.h index c4bd9292612..6d1725ac42e 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_change_FT.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_change_FT.h @@ -32,8 +32,8 @@ template < typename Base_, typename FT_, typename LA_=CGAL::LA_eigen Vector_cartesian_const_iterator; //FIXME: use Iterator_list! /* - template::value_tag,FT_tag>::value> + template::value_tag,FT_tag>::value> struct Iterator : Get_type {}; template struct Iterator { typedef transforming_iterator::type> type; @@ -109,8 +109,8 @@ template < typename Base_, typename FT_> struct Cartesian_change_FT : public Cartesian_change_FT_base { - CGAL_CONSTEXPR Cartesian_change_FT(){} - CGAL_CONSTEXPR Cartesian_change_FT(int d):Cartesian_change_FT_base(d){} + constexpr Cartesian_change_FT(){} + constexpr Cartesian_change_FT(int d):Cartesian_change_FT_base(d){} }; } //namespace CGAL diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h index 7fa283baf11..50d24b3cf25 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h @@ -33,12 +33,12 @@ template < typename Base_, typename AK_, typename EK_ > struct Cartesian_filter_K : public Base_, private Store_kernel, private Store_kernel2 { - CGAL_CONSTEXPR Cartesian_filter_K(){} - CGAL_CONSTEXPR Cartesian_filter_K(int d):Base_(d){} + constexpr Cartesian_filter_K(){} + constexpr Cartesian_filter_K(int d):Base_(d){} //FIXME: or do we want an instance of AK and EK belonging to this kernel, //instead of a reference to external ones? - CGAL_CONSTEXPR Cartesian_filter_K(AK_ const&a,EK_ const&b):Base_(),Store_kernel(a),Store_kernel2(b){} - CGAL_CONSTEXPR Cartesian_filter_K(int d,AK_ const&a,EK_ const&b):Base_(d),Store_kernel(a),Store_kernel2(b){} + constexpr Cartesian_filter_K(AK_ const&a,EK_ const&b):Base_(),Store_kernel(a),Store_kernel2(b){} + constexpr Cartesian_filter_K(int d,AK_ const&a,EK_ const&b):Base_(d),Store_kernel(a),Store_kernel2(b){} typedef Base_ Kernel_base; typedef AK_ AK; typedef EK_ EK; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_NT.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_NT.h index d4219348199..51a5cef6dd9 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_NT.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_NT.h @@ -30,8 +30,8 @@ namespace CGAL { template < typename Base_ > struct Cartesian_filter_NT : public Base_ { - CGAL_CONSTEXPR Cartesian_filter_NT(){} - CGAL_CONSTEXPR Cartesian_filter_NT(int d):Base_(d){} + constexpr Cartesian_filter_NT(){} + constexpr Cartesian_filter_NT(int d):Base_(d){} typedef Base_ Kernel_base; typedef Cartesian_change_FT K1; typedef typename internal::Exact_field_selector::type>::Type Exact_nt; @@ -49,7 +49,6 @@ struct Cartesian_filter_NT : public Base_ type(Cartesian_filter_NT const&k):p1(reinterpret_cast(k)),p2(reinterpret_cast(k)){} //FIXME: if predicate's constructor takes a kernel as argument, how do we translate that? reinterpret_cast is really ugly and possibly unsafe. -#ifdef CGAL_CXX11 template result_type operator()(U&&...u)const{ { Protect_FPU_rounding p; @@ -60,31 +59,6 @@ struct Cartesian_filter_NT : public Base_ } return p2(std::forward(u)...); } -#else - result_type operator()()const{ // does it make sense to have 0 argument? - { - Protect_FPU_rounding p; - try { - typename P1::result_type res=p1(); - if(is_certain(res)) return get_certain(res); - } catch (Uncertain_conversion_exception&) {} - } - return p2(); - } -#define CGAL_CODE(Z,N,_) template result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t))const{ \ - { \ - Protect_FPU_rounding p; \ - try { \ - typename P1::result_type res=p1(BOOST_PP_ENUM_PARAMS(N,t)); \ - if(is_certain(res)) return get_certain(res); \ - } catch (Uncertain_conversion_exception&) {} \ - } \ - return p2(BOOST_PP_ENUM_PARAMS(N,t)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - -#endif }; }; }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 0963f87991d..49e6ae3a6e7 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -69,14 +69,14 @@ template struct Orientation_of_points_2 : private Store_k template struct Cartesian_static_filters : public R_ { - CGAL_CONSTEXPR Cartesian_static_filters(){} - CGAL_CONSTEXPR Cartesian_static_filters(int d):R_(d){} + constexpr Cartesian_static_filters(){} + constexpr Cartesian_static_filters(int d):R_(d){} }; template struct Cartesian_static_filters, R_, Derived_> : public R_ { - CGAL_CONSTEXPR Cartesian_static_filters(){} - CGAL_CONSTEXPR Cartesian_static_filters(int d):R_(d){} + constexpr Cartesian_static_filters(){} + constexpr Cartesian_static_filters(int d):R_(d){} typedef Cartesian_static_filters, R_, Derived_> Self; typedef typename Default::Get::type Derived; template struct Functor : Inherit_functor {}; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Coaffine.h b/NewKernel_d/include/CGAL/NewKernel_d/Coaffine.h index a9307329fc1..0596db79019 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Coaffine.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Coaffine.h @@ -37,13 +37,11 @@ struct Flat_orientation { // For debugging purposes inline std::ostream& operator<< (std::ostream& o, Flat_orientation const& f) { o << "Proj: "; - for(std::vector::const_iterator i=f.proj.begin(); - i!=f.proj.end(); ++i) - o << *i << ' '; + for(int i : f.proj) + o << i << ' '; o << "\nRest: "; - for(std::vector::const_iterator i=f.rest.begin(); - i!=f.rest.end(); ++i) - o << *i << ' '; + for(int i : f.rest) + o << i << ' '; o << "\nInv: " << f.reverse; return o << '\n'; } @@ -155,8 +153,8 @@ template struct Contained_in_affine_hull : private Store_kernel { int d = (int)proj.size()+1; Matrix m (d, d); for(int i=0; i::iterator it=rest.begin();it!=rest.end();++it) { for(int i=0; i struct Contained_in_affine_hull : private Store_kernel { int d = (int)proj.size()+1; Matrix m (d, d); for(int i=0; i::iterator it=rest.begin();it!=rest.end();++it) { - for(int i=0; i struct In_flat_orientation : private Store_kernel { if(*it != d) m(i,1+*it)=1; } - result_type ret = LA::sign_of_determinant(CGAL_MOVE(m)); + result_type ret = LA::sign_of_determinant(std::move(m)); if(o.reverse) ret=-ret; return ret; } @@ -264,7 +262,7 @@ template struct In_flat_side_of_oriented_sphere : private Store_kernel m(d+1,d+1)+=CGAL_NTS square(m(d+1,j+1)); } - result_type ret = -LA::sign_of_determinant(CGAL_MOVE(m)); + result_type ret = -LA::sign_of_determinant(std::move(m)); if(o.reverse) ret=-ret; return ret; } @@ -282,7 +280,7 @@ template struct In_flat_power_side_of_power_sphere_raw : private Store typedef typename LA::Square_matrix Matrix; template - result_type operator()(Flat_orientation const&o, Iter f, Iter e, IterW fw, Point const&x, Wt const&w) const { + result_type operator()(Flat_orientation const&o, Iter f, Iter const&e, IterW fw, IterW const&/*ew*/, Point const&x, Wt const&w) const { // TODO: can't work in the projection, but we should at least remove the row of 1s. typename Get_functor::type c(this->kernel()); typename Get_functor::type pd(this->kernel()); @@ -313,7 +311,7 @@ template struct In_flat_power_side_of_power_sphere_raw : private Store m(d+1,d+1)+=CGAL_NTS square(m(d+1,j+1)); } - result_type ret = -LA::sign_of_determinant(CGAL_MOVE(m)); + result_type ret = -LA::sign_of_determinant(std::move(m)); if(o.reverse) ret=-ret; return ret; } @@ -321,6 +319,12 @@ template struct In_flat_power_side_of_power_sphere_raw : private Store } + +// For the lazy kernel +inline CartesianDKernelFunctors::Flat_orientation const& exact(CartesianDKernelFunctors::Flat_orientation const& o){return o;} +inline CartesianDKernelFunctors::Flat_orientation const& approx(CartesianDKernelFunctors::Flat_orientation const& o){return o;} +inline unsigned depth(CartesianDKernelFunctors::Flat_orientation const&){return 0;} + CGAL_KD_DEFAULT_TYPE(Flat_orientation_tag,(CGAL::CartesianDKernelFunctors::Flat_orientation),(),()); CGAL_KD_DEFAULT_FUNCTOR(In_flat_orientation_tag,(CartesianDKernelFunctors::In_flat_orientation),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag)); CGAL_KD_DEFAULT_FUNCTOR(In_flat_side_of_oriented_sphere_tag,(CartesianDKernelFunctors::In_flat_side_of_oriented_sphere),(Point_tag),(Compute_point_cartesian_coordinate_tag,Point_dimension_tag)); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Define_kernel_types.h b/NewKernel_d/include/CGAL/NewKernel_d/Define_kernel_types.h index 92f39a7e842..74df9d5b232 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Define_kernel_types.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Define_kernel_types.h @@ -23,11 +23,6 @@ #include #include #include -#ifdef CGAL_CXX11 -#include -#else -#include -#endif namespace CGAL { namespace internal { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h index 920a7d70735..a35d1c5bcd3 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h @@ -55,12 +55,10 @@ class Filtered_predicate2 //TODO: pack (at least use a tuple) //FIXME: is it better to store those, or just store enough to recreate them //(i.e. possibly references to the kernels)? - EP ep; - AP ap; - C2E c2e; - C2A c2a; - - typedef typename AP::result_type Ares; + CGAL_NO_UNIQUE_ADDRESS EP ep; + CGAL_NO_UNIQUE_ADDRESS AP ap; + CGAL_NO_UNIQUE_ADDRESS C2E c2e; + CGAL_NO_UNIQUE_ADDRESS C2A c2a; public: @@ -81,7 +79,6 @@ public: : ep(k.exact_kernel()), ap(k.approximate_kernel()), c2e(k,k.exact_kernel()), c2a(k,k.approximate_kernel()) {} -#ifdef CGAL_CXX11 template result_type operator()(Args&&... args) const @@ -93,7 +90,7 @@ public: try { // No forward here, the arguments may still be needed - Ares res = ap(c2a(args)...); + auto res = ap(c2a(args)...); if (is_certain(res)) return get_certain(res); } @@ -103,34 +100,6 @@ public: Protect_FPU_rounding p(CGAL_FE_TONEAREST); return ep(c2e(std::forward(args))...); } -#else - -#define CGAL_VAR(Z,N,C) C(a##N) -#define CGAL_CODE(Z,N,_) \ - template \ - result_type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a)) const \ - { \ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ - { \ - Protect_FPU_rounding p; \ - try \ - { \ - Ares res = ap(BOOST_PP_ENUM(N,CGAL_VAR,c2a)); \ - if (is_certain(res)) \ - return get_certain(res); \ - } \ - catch (Uncertain_conversion_exception&) {} \ - } \ - CGAL_BRANCH_PROFILER_BRANCH(tmp); \ - Protect_FPU_rounding p(CGAL_FE_TONEAREST); \ - return ep(BOOST_PP_ENUM(N,CGAL_VAR,c2e)); \ - } - BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_CODE, _ ) -#undef CGAL_CODE -#undef CGAL_VAR - -#endif }; } //namespace CGAL diff --git a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h index ce32236d774..f92eb11d1cd 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h @@ -81,7 +81,7 @@ class KernelD_converter_ typedef typename Get_type::type K2_Obj; typedef typename Get_functor >::type K1_Conv; typedef KO_converter KOC; - typedef CGAL_BOOSTD is_same no_converter; + typedef std::is_same no_converter; typedef typename internal::Map_taglist_to_typelist::type::template contains duplicate; // Disable the conversion in some cases: @@ -99,10 +99,10 @@ class KernelD_converter_ //typedef typename KOC::result_type K2_Obj; public: using Base::operator(); // don't use directly, just make it accessible to the next level - K2_Obj helper(K1_Obj const& o,CGAL_BOOSTD true_type)const{ + K2_Obj helper(K1_Obj const& o, std::true_type)const{ return KOC()(this->myself().kernel(),this->myself().kernel2(),this->myself(),o); } - K2_Obj helper(K1_Obj const& o,CGAL_BOOSTD false_type)const{ + K2_Obj helper(K1_Obj const& o, std::false_type)const{ return K1_Conv(this->myself().kernel())(this->myself().kernel2(),this->myself(),o); } K2_Obj operator()(argument_type const& o)const{ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index c1cb7ce07e1..e536b083f0a 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -29,8 +29,8 @@ namespace CGAL { template struct Kernel_d_interface : public Base_ { - CGAL_CONSTEXPR Kernel_d_interface(){} - CGAL_CONSTEXPR Kernel_d_interface(int d):Base_(d){} + constexpr Kernel_d_interface(){} + constexpr Kernel_d_interface(int d):Base_(d){} typedef Base_ Base; typedef Kernel_d_interface Kernel; @@ -89,7 +89,6 @@ template struct Kernel_d_interface : public Base_ { Point_d operator()(Weighted_point_d const&wp)const{ return typename Get_functor::type(this->kernel())(wp); } -#ifdef CGAL_CXX11 Point_d operator()(Weighted_point_d &wp)const{ return typename Get_functor::type(this->kernel())(wp); } @@ -100,26 +99,10 @@ template struct Kernel_d_interface : public Base_ { return typename Get_functor::type(this->kernel())(std::move(wp)); } template -# if CGAL_CXX14 decltype(auto) -# else - Point_d -# endif operator()(T&&...t)const{ return CP(this->kernel())(std::forward(t)...); - //return CP(this->kernel())(t...); } -#else // not CGAL_CXX11 -# define CGAL_CODE(Z,N,_) template \ - Point_d operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t))const{ \ - return CP(this->kernel())(BOOST_PP_ENUM_PARAMS(N,t)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -# undef CGAL_CODE - Point_d operator()()const{ \ - return CP(this->kernel())(); \ - } -#endif // not CGAL_CXX11 }; typedef typename Get_functor >::type Construct_vector_d; typedef typename Get_functor >::type Construct_segment_d; @@ -151,30 +134,33 @@ template struct Kernel_d_interface : public Base_ { CGAL_FUNCTOR_INIT_STORE(Construct_cartesian_const_iterator_d) typedef typename Get_functor >::type CPI; typedef typename Get_functor >::type CVI; - // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. For now, rely on result_type. + // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d. //typedef typename CGAL::decay::type>::type result_type; - typedef typename CGAL::decay::type result_type; + //typedef typename CGAL::decay::type result_type; + //typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; + // HACK + typedef typename Base::Point_cartesian_const_iterator result_type; // Kernel_d requires a common iterator type for points and vectors // TODO: provide this mixed functor in preKernel? //CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); - CGAL_static_assertion((boost::is_same::type, result_type>::value)); + //CGAL_static_assertion((boost::is_same::type, result_type>::value)); template - result_type operator()(Point_d const&p, Tag_ t)const{ + auto operator()(Point_d const&p, Tag_ t)const{ return CPI(this->kernel())(p,t); } template - result_type operator()(typename First_if_different::Type const&v, Tag_ t)const{ + auto operator()(typename First_if_different::Type const&v, Tag_ t)const{ return CVI(this->kernel())(v,t); } template - result_type operator()(Obj const&o)const{ + auto operator()(Obj const&o)const{ return operator()(o, Begin_tag()); } - result_type operator()(Point_d const&p, int)const{ + auto operator()(Point_d const&p, int)const{ return operator()(p, End_tag()); } - result_type operator()(typename First_if_different::Type const&v, int)const{ + auto operator()(typename First_if_different::Type const&v, int)const{ return operator()(v, End_tag()); } }; @@ -182,8 +168,8 @@ template struct Kernel_d_interface : public Base_ { typedef Kernel R_; // for the macro CGAL_FUNCTOR_INIT_STORE(Compute_squared_radius_d) typedef FT result_type; - template FT operator()(CGAL_FORWARDABLE(S) s)const{ - return typename Get_functor::type(this->kernel())(CGAL_FORWARD(S,s)); + template FT operator()(S&& s)const{ + return typename Get_functor::type(this->kernel())(std::forward(s)); } template FT operator()(I b, I e)const{ return typename Get_functor::type(this->kernel())(b,e); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_object_converter.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_object_converter.h index 9d8c2280297..93d279361dc 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_object_converter.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_object_converter.h @@ -42,25 +42,24 @@ struct Point_converter_help { return cp(conv(i(p,Begin_tag())),conv(i(p,End_tag()))); } }; -#ifdef CGAL_CXX11 + // This doesn't seem so useful, the compiler should be able to handle // the iterators just as efficiently. template struct Point_converter_help,K1,K2> { typedef typename Get_type::type argument_type; typedef typename Get_type::type result_type; - template - result_type help(Indices, K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const { + template + result_type help(std::index_sequence, K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const { typename Get_functor::type cc(k1); typename Get_functor >::type cp(k2); return cp(conv(cc(p,I))...); } template result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const { - return help(typename N_increasing_indices::type(),k1,k2,conv,p); + return help(std::make_index_sequence(),k1,k2,conv,p); } }; -#endif } template struct KO_converter : internal::Point_converter_help @@ -95,6 +94,18 @@ template struct KO_converter{ } }; +template struct KO_converter{ + typedef typename Get_type::type argument_type; + typedef typename Get_type::type result_type; + template + result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& s) const { + typename Get_functor::type f(k1); + typename Get_functor::type g(k1); + typename Get_functor >::type cib(k2); + return cib(conv(f(s)),conv(g(s))); + } +}; + template struct KO_converter{ typedef typename Get_type::type argument_type; typedef typename Get_type::type result_type; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h b/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h index 57507b27815..b3d23ea32e3 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h @@ -58,11 +58,7 @@ template struct LA_eigen { #if (EIGEN_WORLD_VERSION>=3) typedef NT const* Vector_const_iterator; #else - typedef Iterator_from_indices Vector_const_iterator; + typedef Iterator_from_indices Vector_const_iterator; #endif templatestatic Vector_const_iterator vector_begin(Vec_ const&a){ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/constructors.h b/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/constructors.h index f82517e9b13..8194ed14ea3 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/constructors.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/constructors.h @@ -89,17 +89,16 @@ namespace CGAL { struct Iterator_and_last { template - result_type operator()(int d,Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const { + result_type operator()(int d,Iter const& f,Iter const& e,T&& t) const { check_dim(d); CGAL_assertion(d==std::distance(f,e)+1); result_type a(d); std::copy(f,e,&a[0]); - a[d-1]=CGAL_FORWARD(T,t); + a[d-1]=std::forward(t); return a; } }; -#ifdef CGAL_CXX11 struct Initializer_list { // Fix T==NT? template @@ -107,7 +106,6 @@ namespace CGAL { return Iterator()(l.size(),l.begin(),l.end()); } }; -#endif struct Values { #ifdef CGAL_CXX11 diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h index 0ea81b53900..8385d6c42f4 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace CGAL { @@ -36,9 +37,9 @@ struct Nth_iterator_element : private Store_kernel { Nth_iterator_element(){} Nth_iterator_element(K const&k):Store_kernel(k){} typedef typename Get_type::value_tag>::type result_type; - template result_type operator()(CGAL_FORWARDABLE(U) u, int i) const { + template result_type operator()(U&& u, int i) const { typename Get_functor >::type ci(this->kernel()); - return *std::next(ci(CGAL_FORWARD(U,u),Begin_tag()),i); + return *cpp0x::next(ci(std::forward(u),Begin_tag()),i); } }; //typedef typename Functor::nth_element>::type nth_elem; @@ -61,6 +62,140 @@ namespace internal { }; } +// Whenever a construction takes iterator pairs as input, whether they point to double of Lazy objects, copy the ranges inside the lazy result so they are available for update_exact(). We analyze the input to try and guess where iterator pairs are. I would prefer if each functor had a specific signature (no overload in this layer) so we wouldn't have to guess. +namespace Lazy_internal { +templatestruct typelist{}; +templatestruct arg_i{}; +templatestruct arg_i_begin{}; +templatestruct arg_i_end{}; +templatestruct arg_i_ip1_range{}; +templatestruct analyze_args; +templatestruct analyze_args> { + typedef T creator; + typedef U reader; +}; +template +struct analyze_args,typelist,typelist,std::enable_if_t::value>> : +analyze_args>,typelist>,typelist> {}; +template +struct analyze_args,typelist,typelist,std::enable_if_t::value>> : +analyze_args>,typelist,arg_i_end>,typelist> {}; +template using analyze_args_for_lazy = analyze_args,typelist<>,typelist>; +templatestruct extract1; +templatestruct extract1,T>:std::tuple_element{}; +templatestruct extract1,T>{ + typedef std::tuple_element_t E; + typedef std::remove_cv_t> It; + typedef typename std::iterator_traits::value_type element_type; + // TODO: find a way to use an array of the right size, at least for the most frequent constructions + typedef std::vector type; +}; +templatedecltype(auto) +do_extract(arg_i,std::tupleconst&t) +{return std::get(t);} +templatedecltype(auto) +do_extract(arg_i_begin,std::tupleconst&t) +{return std::begin(std::get(t));} +templatedecltype(auto) +do_extract(arg_i_end,std::tupleconst&t) +{return std::end(std::get(t));} +templatedecltype(auto) +do_extract(arg_i_ip1_range,std::tupleconst&t) +{ + typedef std::tuple L; + typedef std::tuple_element_t E; + typedef std::remove_cv_t> It; + typedef typename std::iterator_traits::value_type element_type; + typedef std::vector type; + return type(std::get(t),std::get(t)); +} +templatestruct data_from_input; +templatestruct data_from_input,U> { + typedef std::tuple::type...> type; +}; +} +template +class Lazy_rep_XXX : + public Lazy_rep< AT, ET, E2A >, private EC +{ + // Lazy_rep_0 does not inherit from EC or take a parameter AC. It has different constructors. + static_assert(sizeof...(L)>0, "Use Lazy_rep_0 instead"); + template friend class Lazy_kernel_base; + typedef Lazy_internal::analyze_args_for_lazy Args; + // How to go from l to Lazy_rep's data + typedef typename Args::creator Creator; + // How to go back + typedef typename Args::reader Reader; + // what Lazy_rep should store + typedef typename Lazy_internal::data_from_input>::type LL; + mutable LL l; // L...l; is not yet allowed. + const EC& ec() const { return *this; } + template + void update_exact_helper(Lazy_internal::typelist) const { + this->et = new ET(ec()( CGAL::exact( Lazy_internal::do_extract(T{},l) ) ... ) ); + this->at = E2A()(*(this->et)); + l = LL(); // There should be a nicer way to clear. Destruction for instance. With this->et as a witness of whether l has already been destructed. + } + public: + void update_exact() const { + update_exact_helper(Reader{}); + } + template + Lazy_rep_XXX(const AC& ac, const EC& ec, LL const&...ll) : + Lazy_rep_XXX(Creator{},ac,ec,std::forward_as_tuple(ll...),ll...){}; + private: + // Currently we construct the vectors, then move them into the tuple. It would be nicer to construct them in their final destination, because eventually we will also have arrays instead of vectors. + template + Lazy_rep_XXX(Lazy_internal::typelist, const AC& ac, const EC& ec, LLL const&lll, LL const&...ll) : + Lazy_rep(ac(CGAL::approx(ll)...)), EC(ec), l(Lazy_internal::do_extract(T{},lll)...) + { + //this->set_depth(std::max({ -1, (int)CGAL::depth(ll)...}) + 1); + this->set_depth(1); // FIXME: now that we have ranges, we could actually compute the depth if we cared... + } + // TODO: print_dag needs a specific implementation for Lazy_rep_XXX +}; +templatestruct Select_converter { typedef typename LK::E2A type; }; +templatestruct Select_converter { typedef To_interval type; }; +template +struct Lazy_construction2 { + static const bool Protection = true; + + typedef typename LK::Approximate_kernel AK; + typedef typename LK::Exact_kernel EK; + typedef typename Get_functor::type AC; + typedef typename Get_functor::type EC; + typedef typename map_result_tag::type result_tag; + typedef typename Get_type::type AT; + typedef typename Get_type::type ET; + typedef typename Get_type::type result_type; + // same as Handle = Lazy< AT, ET, E2A> + typedef typename Select_converter::type, LK, ET>::type E2A; + + Lazy_construction2(){} + Lazy_construction2(LK const&k):ac(k.approximate_kernel()),ec(k.exact_kernel()){} + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; + + template + std::enable_if_t<(sizeof...(L)>0), result_type> operator()(L const&...l) const { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Protect_FPU_rounding P; + try { + return new Lazy_rep_XXX(ac, ec, l...); + } catch (Uncertain_conversion_exception&) { + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + return new Lazy_rep_0(ec(CGAL::exact(l)...)); + } + } + // FIXME: this forces us to have default constructors for all types, try to make its instantiation lazier + // Actually, that may be the clearing in update_exact(). + result_type operator()() const + { + return new Lazy_rep_0(); + } +}; + template struct Lazy_cartesian_types { @@ -79,7 +214,6 @@ struct Lazy_cartesian_types typedef Lazy< typename Get_type::type, typename Get_type::type, - typename Get_type::type, E2A_> type; }; template struct Type { @@ -92,6 +226,7 @@ struct Lazy_cartesian_types typedef typename Select_nth_element_functor::type AF; typedef typename Select_nth_element_functor::type EF; + // TODO: we should use Lazy_construction2, but this seems ok for now, we never construct iterators from iterators. typedef typename internal::Lazy_construction_maybe_nt< Kernel_, AF, EF, is_NT_tag::value >::type nth_elem; @@ -104,20 +239,30 @@ struct Lazy_cartesian_types }; template -struct Lazy_cartesian : Dimension_base, +struct Lazy_cartesian : Lazy_cartesian_types > { - //CGAL_CONSTEXPR Lazy_cartesian(){} - //CGAL_CONSTEXPR Lazy_cartesian(int d):Base_(d){} + constexpr Lazy_cartesian(){} + constexpr Lazy_cartesian(int d):ak(d),ek(d){} //TODO: Do we want to store an AK and an EK? Or just references? //FIXME: references would be better I guess. //TODO: In any case, make sure that we don't end up storing this kernel for //nothing (it is not empty but references empty kernels or something) - AK_ ak; EK_ ek; + CGAL_NO_UNIQUE_ADDRESS AK_ ak; + CGAL_NO_UNIQUE_ADDRESS EK_ ek; AK_ const& approximate_kernel()const{return ak;} EK_ const& exact_kernel()const{return ek;} + int dimension()const{return ak.dimension();} + void set_dimension(int dim){ak.set_dimension(dim);ek.set_dimension(dim);} + + // For compilers that do not handle [[no_unique_address]] + typedef boost::mpl::and_< + internal::Do_not_store_kernel, + internal::Do_not_store_kernel > Do_not_store_kernel; + + typedef typename EK_::Dimension Dimension; // ? typedef Lazy_cartesian Self; typedef Lazy_cartesian_types Base; //typedef typename Default::Get::type Kernel; @@ -125,8 +270,18 @@ struct Lazy_cartesian : Dimension_base, typedef AK_ Approximate_kernel; typedef EK_ Exact_kernel; typedef E2A_ E2A; - typedef Approx_converter C2A; - typedef Exact_converter C2E; + //typedef Approx_converter C2A; + //typedef Exact_converter C2E; + struct C2A { + C2A(){} + C2A(Kernel const&, Approximate_kernel const&){} + templatedecltype(auto)operator()(T const&t)const{return CGAL::approx(t);} + }; + struct C2E { + C2E(){} + C2E(Kernel const&, Exact_kernel const&){} + templatedecltype(auto)operator()(T const&t)const{return CGAL::exact(t);} + }; typedef typename Exact_kernel::Rep_tag Rep_tag; typedef typename Exact_kernel::Kernel_tag Kernel_tag; @@ -145,19 +300,61 @@ struct Lazy_cartesian : Dimension_base, typedef Filtered_predicate2 type; }; template struct Functor { - typedef typename Get_functor::type FA; - typedef typename Get_functor::type FE; - typedef Lazy_construction_nt type; + typedef Lazy_construction2 type; }; template struct Functor { - typedef typename Get_functor::type FA; - typedef typename Get_functor::type FE; - typedef Lazy_construction type; + typedef Lazy_construction2 type; + }; + template struct Functor { + typedef typename Get_functor::type FA; + struct type { + FA fa; + type(){} + type(Kernel const&k):fa(k.approximate_kernel()){} + template + int operator()(P const&p)const{return fa(CGAL::approx(p));} + }; + }; + template struct Functor { + typedef typename Get_functor::type FA; + struct type { + FA fa; + type(){} + type(Kernel const&k):fa(k.approximate_kernel()){} + template + int operator()(V const&v)const{return fa(CGAL::approx(v));} + }; + }; + template struct Functor { + // Don't filter that one, as there is no guarantee that the interval + // basis would be in any way related to the exact basis, the most obvious + // difference being the order of the vectors. + // Don't try to be generic until we have more than just this one. + typedef typename Get_functor::type FE; + typedef typename Get_type::type AT; + typedef typename Get_type::type ET; + typedef typename Base::template Type::type V; // Lazy + struct type { + FE fe; + type(){} + type(Kernel const&k):fe(k.exact_kernel()){} + template + void operator()(Iter i, Iter e, Oter o)const{ + fe(CGAL::exact(i), CGAL::exact(e), + boost::make_function_output_iterator( + [&o](ET const&v){ + *o++ = V(new Lazy_rep_0(v)); + } + ) + ); + } + }; }; - //typedef typename Iterator::type Point_cartesian_const_iterator; - //typedef typename Iterator::type Vector_cartesian_const_iterator; + typedef typename Base::template Iterator::type Point_cartesian_const_iterator; + typedef typename Base::template Iterator::type Vector_cartesian_const_iterator; + // This is really specific to point/vector coordinate iterators template struct Construct_iter : private Store_kernel { Construct_iter(){} @@ -170,7 +367,8 @@ struct Lazy_cartesian : Dimension_base, } template result_type operator()(T const& t,End_tag)const{ - return result_type(t,Self().dimension(),this->kernel()); + typedef typename Get_functor::type PD; + return result_type(t,PD(this->kernel().approximate_kernel())(CGAL::approx(t)),this->kernel()); } }; template struct Functor { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Aff_transformation.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Aff_transformation.h index f1da46fa1a2..cf0465bbcaa 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Aff_transformation.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Aff_transformation.h @@ -36,21 +36,8 @@ template struct Construct_aff_transformation { CGAL_FUNCTOR_INIT_IGNORE(Construct_aff_transformation) typedef R_ R; typedef typename Get_type::type result_type; -#ifdef CGAL_CXX11 template result_type operator()(T&&...)const{return result_type();} -#else - result_type operator()()const{ - return result_type(); - } -#define CGAL_CODE(Z,N,_) template \ - result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const& BOOST_PP_INTERCEPT))const{ \ - return result_type(); \ - } - BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CODE, _ ) -#undef CGAL_CODE - -#endif }; } CGAL_KD_DEFAULT_TYPE(Aff_transformation_tag,(CGAL::Aff_transformation),(),()); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h index 979f7fd83ee..c23334cb102 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h @@ -33,6 +33,7 @@ template class Hyperplane { FT_ s_; public: + Hyperplane(){} Hyperplane(Vector_ const&v, FT_ const&s): v_(v), s_(s) {} // TODO: Add a piecewise constructor? diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Segment.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Segment.h index 3290cfd2c2b..b30d124e7b0 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Segment.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Segment.h @@ -35,7 +35,7 @@ template class Segment { public: //typedef Segmentd Segment; #ifdef CGAL_CXX11 - //FIXME: don't forward directly, piecewise_constuct should call the point construction functor (I guess? or is it unnecessary?) + //FIXME: don't forward directly, piecewise_construct should call the point construction functor (I guess? or is it unnecessary?) template::type...>,std::tuple>::value>::type> Segment(U&&...u):data(std::forward(u)...){} #else @@ -89,11 +89,11 @@ template struct Construct_segment : Store_kernel { } // T should only be std::piecewise_construct_t, but we shouldn't fail if it doesn't exist. template - result_type operator()(CGAL_FORWARDABLE(T),CGAL_FORWARDABLE(U) u,CGAL_FORWARDABLE(V) v)const{ + result_type operator()(T&&, U&& u, V&& v)const{ CP cp(this->kernel()); result_type r = {{ - call_on_tuple_elements(cp, CGAL_FORWARD(U,u)), - call_on_tuple_elements(cp, CGAL_FORWARD(V,v)) }}; + call_on_tuple_elements(cp, std::forward(u)), + call_on_tuple_elements(cp, std::forward(v)) }}; return r; } }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h index 0ddee5a493f..e94c7a0916a 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h @@ -30,6 +30,7 @@ template class Sphere { FT_ r2_; public: + Sphere(){} Sphere(Point_ const&p, FT_ const&r2): c_(p), r2_(r2) {} // TODO: Add a piecewise constructor? @@ -66,7 +67,7 @@ template struct Construct_sphere : Store_kernel { // It should be possible to avoid copying the center by moving this code to a constructor. Point center = cc(f, e); FT const& r2 = sd(center, *f); - return this->operator()(CGAL_MOVE(center), r2); + return this->operator()(std::move(center), r2); } }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h index 1581bb26a16..8f0a80280b1 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h @@ -31,6 +31,7 @@ template class Weighted_point { FT_ w_; public: + Weighted_point(){} Weighted_point(Point_ const&p, FT_ const&w): c_(p), w_(w) {} // TODO: Add a piecewise constructor? @@ -124,6 +125,7 @@ template struct Power_side_of_power_sphere : private Store_kernel make_transforming_iterator (f, pdw), make_transforming_iterator (e, pdw), make_transforming_iterator (f, pw), + make_transforming_iterator (e, pw), pdw (p0), pw (p0)); } @@ -144,6 +146,7 @@ template struct In_flat_power_side_of_power_sphere : private Store_ker make_transforming_iterator (f, pdw), make_transforming_iterator (e, pdw), make_transforming_iterator (f, pw), + make_transforming_iterator (e, pw), pdw (p0), pw (p0)); } @@ -192,11 +195,11 @@ template struct Power_center : Store_kernel { CGAL_assertion (i == d); Vec res = typename CVec::Dimension()(d);; //std::cout << "Mat: " << m << "\n Vec: " << one << std::endl; - LA::solve(res, CGAL_MOVE(m), CGAL_MOVE(b)); + LA::solve(res, std::move(m), std::move(b)); //std::cout << "Sol: " << res << std::endl; Point center = cp(d,LA::vector_begin(res),LA::vector_end(res)); FT const& r2 = pdp (wp0, center); - return cwp(CGAL_MOVE(center), r2); + return cwp(std::move(center), r2); } }; } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h index 47175a71a05..a70554267e2 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h @@ -93,60 +93,33 @@ template struct Array_vector { struct Iterator_and_last { template - Vector operator()(unsigned CGAL_assertion_code(d),Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const { + Vector operator()(unsigned CGAL_assertion_code(d),Iter const& f,Iter const& e,T&& t) const { CGAL_assertion(d==std::distance(f,e)+1); CGAL_assertion(d<=d_); //TODO: optimize for forward iterators Vector a; std::copy(f,e,a.begin()); - a.back()=CGAL_FORWARD(T,t); + a.back()=std::forward(t); return a; } }; struct Values { -#ifdef CGAL_CXX11 template Vector operator()(U&&...u) const { static_assert(sizeof...(U)<=d_,"too many arguments"); Vector a={{forward_safe(u)...}}; return a; } -#else - -#define CGAL_CODE(Z,N,_) Vector operator()(BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \ - CGAL_assertion(N<=d_); \ - Vector a={{BOOST_PP_ENUM_PARAMS(N,t)}}; \ - return a; \ -} -BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ ) -#undef CGAL_CODE - -#endif }; struct Values_divide { -#ifdef CGAL_CXX11 template Vector operator()(H const& h,U&&...u) const { static_assert(sizeof...(U)<=d_,"too many arguments"); Vector a={{Rational_traits().make_rational(std::forward(u),h)...}}; return a; } -#else - -#define CGAL_VAR(Z,N,_) Rational_traits().make_rational( t##N , h) -#define CGAL_CODE(Z,N,_) template Vector \ - operator()(H const&h, BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \ - CGAL_assertion(N<=d_); \ - Vector a={{BOOST_PP_ENUM(N,CGAL_VAR,_)}}; \ - return a; \ - } - BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ ) -#undef CGAL_CODE -#undef CGAL_VAR - -#endif }; }; @@ -162,6 +135,8 @@ BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ ) } }; +// Do not try to instantiate the above +template struct Array_vector {}; } #endif diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Vector/mix.h b/NewKernel_d/include/CGAL/NewKernel_d/Vector/mix.h index de8aac8845a..2e7145f6003 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Vector/mix.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Vector/mix.h @@ -33,6 +33,7 @@ struct Mix_vector }; }; +// FIXME: shouldn't we dispatch based on Max_dim_ instead? template struct Mix_vector, Max_dim_> : Static_::template Rebind_dimension, Max_dim_>::Other diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Vector/vector.h b/NewKernel_d/include/CGAL/NewKernel_d/Vector/vector.h index 1c173a13901..17157fb950b 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Vector/vector.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Vector/vector.h @@ -73,12 +73,12 @@ template struct Vector_vector { struct Iterator_and_last { template - Vector operator()(int d,Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const { + Vector operator()(int d,Iter const& f,Iter const& e,T&& t) const { CGAL_assertion(d==std::distance(f,e)+1); Vector a; a.reserve(d+1); a.insert(a.end(),f,e); - a.push_back(CGAL_FORWARD(T,t)); + a.push_back(std::forward(t)); return a; } }; @@ -100,31 +100,15 @@ template struct Vector_vector { #endif struct Values { -#ifdef CGAL_CXX11 template Vector operator()(U&&...u) const { //TODO: check the right number of {}, g++ accepts one and two Vector a={forward_safe(u)...}; return a; } -#else - -#define CGAL_VAR(Z,N,_) a.push_back(t##N); -#define CGAL_CODE(Z,N,_) Vector operator()(BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \ - Vector a; \ - a.reserve(N); \ - BOOST_PP_REPEAT(N,CGAL_VAR,) \ - return a; \ -} -BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ ) -#undef CGAL_CODE -#undef CGAL_VAR - -#endif }; struct Values_divide { -#ifdef CGAL_CXX11 template Vector operator()(H const&h,U&&...u) const { //TODO: do we want to cast at some point? @@ -133,21 +117,6 @@ BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ ) Vector a={Rational_traits().make_rational(std::forward(u),h)...}; return a; } -#else - -#define CGAL_VAR(Z,N,_) a.push_back(Rational_traits().make_rational( t##N ,h)); -#define CGAL_CODE(Z,N,_) template Vector \ - operator()(H const&h, BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \ - Vector a; \ - a.reserve(N); \ - BOOST_PP_REPEAT(N,CGAL_VAR,) \ - return a; \ - } - BOOST_PP_REPEAT_FROM_TO(1, 11, CGAL_CODE, _ ) -#undef CGAL_CODE -#undef CGAL_VAR - -#endif }; }; typedef typename Vector::const_iterator Vector_const_iterator; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h index 7a1b826dd7a..26fb156b6f9 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h @@ -122,8 +122,8 @@ CGAL_REGISTER_OBJECT_WRAPPER(Weighted_point); template < typename Base_ , typename Derived_ = Default > struct Cartesian_wrap : public Base_ { - CGAL_CONSTEXPR Cartesian_wrap(){} - CGAL_CONSTEXPR Cartesian_wrap(int d):Base_(d){} + constexpr Cartesian_wrap(){} + constexpr Cartesian_wrap(int d):Base_(d){} typedef Base_ Kernel_base; typedef Cartesian_wrap Self; // TODO: pass the 2 types Self and Derived to the wrappers, they can use Self for most purposes and Derived only for Kernel_traits' typedef R. @@ -145,30 +145,9 @@ struct Cartesian_wrap : public Base_ B b; type(){} type(Self const&k):b(k){} - typedef typename B::result_type result_type; -#ifdef CGAL_CXX11 - template result_type operator()(U&&...u)const{ + template decltype(auto) operator()(U&&...u)const{ return b(internal::Forward_rep()(u)...); } -#else -#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N) -#define CGAL_CODE(Z,N,_) template result_type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \ - return b(BOOST_PP_ENUM(N,CGAL_VAR,)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE -#undef CGAL_VAR -// In case the last argument needs to be non-const. Fragile... -#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N) -#define CGAL_CODE(Z,N,_) template result_type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u),V&v)const{ \ - return b(BOOST_PP_ENUM(N,CGAL_VAR,),internal::Forward_rep()(v)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,8,CGAL_CODE,_) -#undef CGAL_CODE -#undef CGAL_VAR -#endif }; }; @@ -188,20 +167,9 @@ struct Cartesian_wrap : public Base_ typedef typename map_result_tag::type result_tag; // FIXME: Self or Derived? typedef typename Get_type::type result_type; -#ifdef CGAL_CXX11 template result_type operator()(U&&...u)const{ return result_type(Eval_functor(),b,internal::Forward_rep()(u)...); } -#else -#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N) -#define CGAL_CODE(Z,N,_) template result_type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \ - return result_type(Eval_functor(),b,BOOST_PP_ENUM(N,CGAL_VAR,)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE -#undef CGAL_VAR -#endif }; }; @@ -210,8 +178,8 @@ struct Cartesian_wrap : public Base_ template < typename Base_ > struct Cartesian_refcount : public Base_ { - CGAL_CONSTEXPR Cartesian_refcount(){} - CGAL_CONSTEXPR Cartesian_refcount(int d):Base_(d){} + constexpr Cartesian_refcount(){} + constexpr Cartesian_refcount(int d):Base_(d){} typedef Base_ Kernel_base; typedef Cartesian_refcount Self; @@ -242,23 +210,9 @@ struct Cartesian_refcount : public Base_ type(){} type(Self const&k):b(k){} typedef typename B::result_type result_type; -#ifdef CGAL_CXX11 template result_type operator()(U&&...u)const{ return b(internal::Forward_rep()(u)...); } -#else - result_type operator()()const{ - return b(); - } -#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N) -#define CGAL_CODE(Z,N,_) template result_type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \ - return b(BOOST_PP_ENUM(N,CGAL_VAR,)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE -#undef CGAL_VAR -#endif }; }; @@ -275,23 +229,9 @@ struct Cartesian_refcount : public Base_ type(Self const&k):b(k){} typedef typename map_result_tag::type result_tag; typedef typename Get_type::type result_type; -#ifdef CGAL_CXX11 template result_type operator()(U&&...u)const{ return result_type(Eval_functor(),b,internal::Forward_rep()(u)...); } -#else - result_type operator()()const{ - return result_type(Eval_functor(),b); - } -#define CGAL_VAR(Z,N,_) internal::Forward_rep()(u##N) -#define CGAL_CODE(Z,N,_) template result_type \ - operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \ - return result_type(Eval_functor(),b,BOOST_PP_ENUM(N,CGAL_VAR,)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE -#undef CGAL_VAR -#endif }; }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h index 1dff1b59f20..0b9547646fb 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h @@ -26,10 +26,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif -#include namespace CGAL { namespace Wrap { @@ -67,7 +63,6 @@ public: typedef R_ R; -#ifdef CGAL_CXX11 template::type...>,std::tuple >::value>::type> explicit Hyperplane_d(U&&...u) : Rep(CHBase()(std::forward(u)...)){} @@ -89,30 +84,6 @@ public: Hyperplane_d(Rep& v) : Rep(static_cast(v)) {} Hyperplane_d(Rep&& v) : Rep(std::move(v)) {} -#else - - Hyperplane_d() : Rep(CHBase()()) {} - - Hyperplane_d(Rep const& v) : Rep(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Hyperplane_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(CHBase()( \ - BOOST_PP_ENUM_PARAMS(N,t))) {} \ - \ - template \ - Hyperplane_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {} - /* - template \ - Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {} - */ - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - -#endif //TODO: if OVBase returns a reference to a base vector, cast it to a //reference to a wrapper vector. Ugly but should be safe. diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 85a3bb33640..6153c237fb3 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -30,10 +30,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif -#include namespace CGAL { namespace Wrap { @@ -76,7 +72,6 @@ public: typedef R_ R; -#ifdef CGAL_CXX11 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1900) # pragma warning(push) # pragma warning(disable: 4309) @@ -115,47 +110,19 @@ public: Point_d(Origin&& v) : Rep(CPBase()(std::move(v))) {} -#else - Point_d() : Rep(CPBase()()) {} - - Point_d(Rep const& v) : Rep(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Point_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(CPBase()( \ - BOOST_PP_ENUM_PARAMS(N,t))) {} \ - \ - template \ - Point_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {} - /* - template \ - Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {} - */ - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - - // this one should be implicit - Point_d(Origin const& o) - : Rep(CPBase()(o)) {} - -#endif - - typename boost::result_of::type cartesian(int i)const{ + decltype(auto) cartesian(int i)const{ return CCBase()(rep(),i); } - typename boost::result_of::type operator[](int i)const{ + decltype(auto) operator[](int i)const{ return CCBase()(rep(),i); } - typename boost::result_of::type cartesian_begin()const{ + decltype(auto) cartesian_begin()const{ return CPI()(rep(),Begin_tag()); } - typename boost::result_of::type cartesian_end()const{ + decltype(auto) cartesian_end()const{ return CPI()(rep(),End_tag()); } @@ -164,159 +131,68 @@ public: return PDBase()(rep()); } - /* - Direction_d direction() const - { - return R().construct_direction_d_object()(*this); + friend auto operator==(Point_d const&p, Point_d const&q) { + typedef typename Get_functor::type EPBase; + return EPBase()(p.rep(), q.rep()); } - Vector_d transform(const Aff_transformation_d &t) const + friend auto operator!=(Point_d const&p, Point_d const&q) { return !(p==q); } + + friend std::ostream& operator <<(std::ostream& os, const Point_d& p) { - return t.transform(*this); + auto b = p.cartesian_begin(); + auto e = p.cartesian_end(); + if(is_ascii(os)) + { + os << p.dimension(); + for(; b != e; ++b){ + os << " " << *b; + } + } + else + { + write(os, p.dimension()); + for(; b != e; ++b){ + write(os, *b); + } + } + return os; } - Vector_d operator/(const RT& c) const + // TODO: test if the stream is binary or text? + friend std::istream& operator>>(std::istream &is, Point_d & p) { - return R().construct_divided_vector_d_object()(*this,c); - } + int dim; + if( is_ascii(is) ) + is >> dim; + else + { + read(is, dim); + } - Vector_d operator/(const typename First_if_different::Type & c) const - { - return R().construct_divided_vector_d_object()(*this,c); - } + if(!is) return is; + std::vector coords(dim); + if(is_ascii(is)) + { + for(int i=0;i> iformat(coords[i]); + } + else + { + for(int i=0;i::type - x() const - { - return R().compute_x_3_object()(*this); + // FIXME: with Epeck_d, currently, this stores pointers to coords which will soon be dead. + if(is) + p = Point_d(coords.begin(), coords.end()); + return is; } - - typename Qualified_result_of::type - y() const - { - return R().compute_y_3_object()(*this); - } - - typename Qualified_result_of::type - z() const - { - return R().compute_z_3_object()(*this); - } - - typename Qualified_result_of::type - hx() const - { - return R().compute_hx_3_object()(*this); - } - - typename Qualified_result_of::type - hy() const - { - return R().compute_hy_3_object()(*this); - } - - typename Qualified_result_of::type - hz() const - { - return R().compute_hz_3_object()(*this); - } - - typename Qualified_result_of::type - hw() const - { - return R().compute_hw_3_object()(*this); - } - - typename Qualified_result_of::type - cartesian(int i) const - { - CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); - if (i==0) return x(); - if (i==1) return y(); - return z(); - } - - typename Qualified_result_of::type - homogeneous(int i) const - { - CGAL_kernel_precondition( (i >= 0) || (i <= 3) ); - if (i==0) return hx(); - if (i==1) return hy(); - if (i==2) return hz(); - return hw(); - } - - typename Qualified_result_of::type - squared_length() const - { - return R().compute_squared_length_3_object()(*this); - } -*/ }; #if 0 template Point_d::Point_d(Point_d &)=default; #endif -template -std::ostream& operator <<(std::ostream& os, const Point_d& p) -{ - typedef typename R_::Kernel_base Kbase; - typedef typename Get_functor >::type CPI; - // Should just be "auto"... - typename CGAL::decay::Rep,Begin_tag) - >::type>::type - b = p.cartesian_begin(), - e = p.cartesian_end(); - if(is_ascii(os)) - { - os << p.dimension(); - for(; b != e; ++b){ - os << " " << *b; - } - } - else - { - write(os, p.dimension()); - for(; b != e; ++b){ - write(os, *b); - } - } - return os; -} - -// TODO: test if the stream is binary or text? -template -std::istream & -operator>>(std::istream &is, Point_d & p) -{ - typedef typename Get_type::type P; - typedef typename Get_type::type FT; - int dim; - if( is_ascii(is) ) - is >> dim; - else - { - read(is, dim); - } - - if(!is) return is; - std::vector coords(dim); - if(is_ascii(is)) - { - for(int i=0;i> iformat(coords[i]); - } - else - { - for(int i=0;i //Vector_d operator+(const Vector_d& v,const Vector_d& w) const diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h index be1de7fd5ed..403eeb6ba9f 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h @@ -29,10 +29,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif -#include // no need for a fancy interface here, people can use the Point_d wrapper on // top. @@ -67,7 +63,6 @@ public: return CGAL::get_pointee_or_identity(data); } -#ifdef CGAL_CXX11 template::type...>,std::tuple >::value>::type> explicit Ref_count_obj(U&&...u) : data(Eval_functor(),CBase(),std::forward(u)...){} @@ -88,32 +83,6 @@ public: // Ref_count_obj(Origin&& v) // : data(Eval_functor(),CBase(),std::move(v)) {} -#else - - Ref_count_obj() : data(Eval_functor(),CBase()) {} - - Ref_count_obj(Rep const& v) : data(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Ref_count_obj(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : data(Eval_functor(),CBase(),BOOST_PP_ENUM_PARAMS(N,t)) {} \ - \ - template \ - Ref_count_obj(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : data(Eval_functor(),f,BOOST_PP_ENUM_PARAMS(N,t)) {} - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - template - Ref_count_obj(Eval_functor,F const& f) - : data(Eval_functor(),f) {} - -// // this one should be implicit -// Ref_count_obj(Origin const& o) -// : data(Eval_functor(),CBase(),o) {} - -#endif - }; } //namespace CGAL diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h index 5194c8bc2bc..080960f795a 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h @@ -28,10 +28,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif -#include namespace CGAL { namespace Wrap { @@ -70,7 +66,6 @@ public: typedef R_ R; -#ifdef CGAL_CXX11 template::type...>,std::tuple >::value>::type> explicit Segment_d(U&&...u) : Rep(CSBase()(std::forward(u)...)){} @@ -92,30 +87,6 @@ public: Segment_d(Rep& v) : Rep(static_cast(v)) {} Segment_d(Rep&& v) : Rep(std::move(v)) {} -#else - - Segment_d() : Rep(CSBase()()) {} - - Segment_d(Rep const& v) : Rep(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Segment_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(CSBase()( \ - BOOST_PP_ENUM_PARAMS(N,t))) {} \ - \ - template \ - Segment_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {} - /* - template \ - Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {} - */ - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - -#endif //TODO: if CSEBase returns a reference to a base point, cast it to a //reference to a wrapper point. Ugly but should be safe. diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h index c56d7f43beb..118a01ab154 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h @@ -26,10 +26,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif -#include namespace CGAL { namespace Wrap { @@ -67,7 +63,6 @@ public: typedef R_ R; -#ifdef CGAL_CXX11 template::type...>,std::tuple >::value>::type> explicit Sphere_d(U&&...u) : Rep(CSBase()(std::forward(u)...)){} @@ -89,30 +84,6 @@ public: Sphere_d(Rep& v) : Rep(static_cast(v)) {} Sphere_d(Rep&& v) : Rep(std::move(v)) {} -#else - - Sphere_d() : Rep(CSBase()()) {} - - Sphere_d(Rep const& v) : Rep(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Sphere_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(CSBase()( \ - BOOST_PP_ENUM_PARAMS(N,t))) {} \ - \ - template \ - Sphere_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {} - /* - template \ - Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {} - */ - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - -#endif //TODO: if COSBase returns a reference to a base point, cast it to a //reference to a wrapper point. Ugly but should be safe. diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h index f0ee18d30ff..f62b349b846 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h @@ -31,9 +31,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif #include namespace CGAL { @@ -75,7 +72,6 @@ public: typedef R_ R; -#ifdef CGAL_CXX11 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1900) # pragma warning(push) # pragma warning(disable: 4309) @@ -113,48 +109,20 @@ public: Vector_d(Null_vector&& v) : Rep(CVBase()(std::move(v))) {} -#else - Vector_d() : Rep(CVBase()()) {} - - Vector_d(Rep const& v) : Rep(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Vector_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(CVBase()( \ - BOOST_PP_ENUM_PARAMS(N,t))) {} \ - \ - template \ - Vector_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {} - /* - template \ - Vector_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {} - */ - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - - // this one should be implicit - Vector_d(Null_vector const& v) - : Rep(CVBase()(v)) {} - -#endif - - typename boost::result_of::type cartesian(int i)const{ + decltype(auto) cartesian(int i)const{ return CCBase()(rep(),i); } - typename boost::result_of::type operator[](int i)const{ + decltype(auto) operator[](int i)const{ return CCBase()(rep(),i); } - typename boost::result_of::type cartesian_begin()const{ + decltype(auto) cartesian_begin()const{ return CVI()(rep(),Begin_tag()); } - typename boost::result_of::type cartesian_end()const{ + decltype(auto) cartesian_end()const{ return CVI()(rep(),End_tag()); } @@ -163,180 +131,80 @@ public: return typename Get_functor::type()(*this); } - /* - Direction_d direction() const - { - return R().construct_direction_d_object()(*this); - } - - Vector_d transform(const Aff_transformation_d &t) const - { - return t.transform(*this); - } - - Vector_d operator/(const RT& c) const - { - return R().construct_divided_vector_d_object()(*this,c); - } - - Vector_d operator/(const typename First_if_different::Type & c) const - { - return R().construct_divided_vector_d_object()(*this,c); - } - - typename Qualified_result_of::type - x() const - { - return R().compute_x_3_object()(*this); - } - - typename Qualified_result_of::type - y() const - { - return R().compute_y_3_object()(*this); - } - - typename Qualified_result_of::type - z() const - { - return R().compute_z_3_object()(*this); - } - - typename Qualified_result_of::type - hx() const - { - return R().compute_hx_3_object()(*this); - } - - typename Qualified_result_of::type - hy() const - { - return R().compute_hy_3_object()(*this); - } - - typename Qualified_result_of::type - hz() const - { - return R().compute_hz_3_object()(*this); - } - - typename Qualified_result_of::type - hw() const - { - return R().compute_hw_3_object()(*this); - } - - typename Qualified_result_of::type - cartesian(int i) const - { - CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); - if (i==0) return x(); - if (i==1) return y(); - return z(); - } - - typename Qualified_result_of::type - homogeneous(int i) const - { - CGAL_kernel_precondition( (i >= 0) || (i <= 3) ); - if (i==0) return hx(); - if (i==1) return hy(); - if (i==2) return hz(); - return hw(); - } - - int dimension() const // bad idea? - { - return rep.dimension(); - } -*/ int dimension() const { typedef typename Get_functor::type VDBase; return VDBase()(rep()); } - typename boost::result_of::type squared_length()const{ + decltype(auto) squared_length()const{ return SLBase()(rep()); } + + friend std::ostream& operator <<(std::ostream& os, const Vector_d& v) + { + auto b = v.cartesian_begin(); + auto e = v.cartesian_end(); + if(is_ascii(os)) + { + os << v.dimension(); + for(; b != e; ++b){ + os << " " << *b; + } + } + else + { + write(os, v.dimension()); + for(; b != e; ++b){ + write(os, *b); + } + } + + return os; + } + + friend std::istream & operator>>(std::istream &is, Vector_d & v) + { + int dim; + if( is_ascii(is) ) + is >> dim; + else + { + read(is, dim); + } + if(!is) return is; + + std::vector coords(dim); + if(is_ascii(is)) + { + for(int i=0;i> iformat(coords[i]); + } + else + { + for(int i=0;i::type()(v,w); + } + + friend Vector_d operator-(const Vector_d& v,const Vector_d& w) + { + return typename Get_functor::type()(v,w); + } }; #if 0 template Vector_d::Vector_d(Vector_d &)=default; #endif -template -std::ostream& operator <<(std::ostream& os, const Vector_d& v) -{ - typedef typename R_::Kernel_base Kbase; - typedef typename Get_functor >::type CVI; - // Should just be "auto"... - typename CGAL::decay::Rep,Begin_tag) - >::type>::type - b = v.cartesian_begin(), - e = v.cartesian_end(); - if(is_ascii(os)) - { - os << v.dimension(); - for(; b != e; ++b){ - os << " " << *b; - } - } - else - { - write(os, v.dimension()); - for(; b != e; ++b){ - write(os, *b); - } - } - - return os; -} - - -template -std::istream & -operator>>(std::istream &is, Vector_d & v) -{ - typedef typename Get_type::type V; - typedef typename Get_type::type FT; - int dim; - if( is_ascii(is) ) - is >> dim; - else - { - read(is, dim); - } - if(!is) return is; - - std::vector coords(dim); - if(is_ascii(is)) - { - for(int i=0;i> iformat(coords[i]); - } - else - { - for(int i=0;i -Vector_d operator+(const Vector_d& v,const Vector_d& w) -{ - return typename Get_functor::type()(v,w); -} - -template -Vector_d operator-(const Vector_d& v,const Vector_d& w) -{ - return typename Get_functor::type()(v,w); -} } //namespace Wrap } //namespace CGAL diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Weighted_point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Weighted_point_d.h index 3b5ceb6bb31..f86cda64c04 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Weighted_point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Weighted_point_d.h @@ -29,10 +29,6 @@ #include #include #include -#ifndef CGAL_CXX11 -#include -#endif -#include namespace CGAL { namespace Wrap { @@ -70,7 +66,6 @@ public: typedef R_ R; -#ifdef CGAL_CXX11 template::type...>,std::tuple >::value>::type> explicit Weighted_point_d(U&&...u) : Rep(CWPBase()(std::forward(u)...)){} @@ -92,30 +87,6 @@ public: Weighted_point_d(Rep& v) : Rep(static_cast(v)) {} Weighted_point_d(Rep&& v) : Rep(std::move(v)) {} -#else - - Weighted_point_d() : Rep(CWPBase()()) {} - - Weighted_point_d(Rep const& v) : Rep(v) {} // try not to use it - -#define CGAL_CODE(Z,N,_) template \ - explicit Weighted_point_d(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(CWPBase()( \ - BOOST_PP_ENUM_PARAMS(N,t))) {} \ - \ - template \ - Weighted_point_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(f(BOOST_PP_ENUM_PARAMS(N,t))) {} - /* - template \ - Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \ - : Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {} - */ - - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE - -#endif //TODO: use references? Point_ point()const{ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h index 1e7a34b3e1e..cf82d299a45 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -35,9 +35,7 @@ #include #include #include -#ifdef CGAL_CXX11 #include -#endif namespace CGAL { namespace CartesianDKernelFunctors { @@ -70,10 +68,9 @@ template,typename R::Default_ambient_dimension>::value>::type> template =3)>::type> @@ -85,28 +82,8 @@ template l) const { return operator()(l.begin(),l.end()); } -#else - //should we make it template to avoid instantiation for wrong dim? - //or iterate outside the class? -#define CGAL_VAR(Z,J,I) m(I,J)=c(p##I,J)-c(x,J); -#define CGAL_VAR2(Z,I,N) BOOST_PP_REPEAT(N,CGAL_VAR,I) -#define CGAL_CODE(Z,N,_) \ - result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \ - typename Get_functor::type c(this->kernel()); \ - Matrix m(N,N); \ - BOOST_PP_REPEAT(N,CGAL_VAR2,N) \ - return R::LA::sign_of_determinant(CGAL_MOVE(m)); \ - } - -BOOST_PP_REPEAT_FROM_TO(7, 10, CGAL_CODE, _ ) - // No need to do it for <=6, since that uses a different code path -#undef CGAL_CODE -#undef CGAL_VAR2 -#undef CGAL_VAR -#endif }; -#ifdef CGAL_CXX11 template struct Orientation_of_points,true> : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) typedef R_ R; @@ -114,7 +91,7 @@ template struct Orientation_of_points,true> typedef typename Get_type::type Point; typedef typename Get_type::type result_type; templatestruct Help; - templatestruct Help > { + templatestruct Help > { template result_type operator()(C const&c,P const&x,T&&t)const{ return sign_of_determinant(c(std::get(t),I%d)-c(x,I%d)...); } @@ -122,7 +99,7 @@ template struct Orientation_of_points,true> template result_type operator()(P0 const&x,P&&...p)const{ static_assert(d==sizeof...(P),"Wrong number of arguments"); typename Get_functor::type c(this->kernel()); - return Help::type>()(c,x,std::forward_as_tuple(std::forward

(p)...)); + return Help>()(c,x,std::forward_as_tuple(std::forward

(p)...)); } @@ -139,40 +116,6 @@ template struct Orientation_of_points,true> return help2(Dimension_tag(),f,e); } }; -#else -#define CGAL_VAR(Z,J,I) c(p##I,J)-x##J -#define CGAL_VAR2(Z,I,N) BOOST_PP_ENUM(N,CGAL_VAR,I) -#define CGAL_VAR3(Z,N,_) Point const&p##N=*++f; -#define CGAL_VAR4(Z,N,_) RT const&x##N=c(x,N); -#define CGAL_CODE(Z,N,_) \ -template struct Orientation_of_points,true> : private Store_kernel { \ - CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) \ - typedef R_ R; \ - typedef typename Get_type::type RT; \ - typedef typename Get_type::type Point; \ - typedef typename Get_type::type result_type; \ - result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \ - typename Get_functor::type c(this->kernel()); \ - BOOST_PP_REPEAT(N,CGAL_VAR4,) \ - return sign_of_determinant(BOOST_PP_ENUM(N,CGAL_VAR2,N)); \ - } \ - template \ - result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ \ - Point const&x=*f; \ - BOOST_PP_REPEAT(N,CGAL_VAR3,) \ - CGAL_assertion(++f==e); \ - return operator()(x,BOOST_PP_ENUM_PARAMS(N,p)); \ - } \ -}; - - BOOST_PP_REPEAT_FROM_TO(2, 7, CGAL_CODE, _ ) -#undef CGAL_CODE -#undef CGAL_VAR4 -#undef CGAL_VAR3 -#undef CGAL_VAR2 -#undef CGAL_VAR - -#endif template struct Orientation_of_points,true> : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) @@ -208,8 +151,7 @@ template struct Orientation_of_vectors : private Store_kernel { template result_type operator()(Iter f, Iter e)const{ typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); - // FIXME: Uh? Using it on a vector ?! + typename Get_functor::type vd(this->kernel()); Vector const& v0=*f; int d=vd(v0); Matrix m(d,d); @@ -222,10 +164,9 @@ template struct Orientation_of_vectors : private Store_kernel { m(i,j)=c(v,j); } } - return R::LA::sign_of_determinant(CGAL_MOVE(m)); + return R::LA::sign_of_determinant(std::move(m)); } -#ifdef CGAL_CXX11 template =3)>::type> result_type operator()(U&&...u) const { return operator()({std::forward(u)...}); @@ -235,13 +176,10 @@ template struct Orientation_of_vectors : private Store_kernel { result_type operator()(std::initializer_list l) const { return operator()(l.begin(),l.end()); } -#else - //TODO -#endif }; } -CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Orientation_of_vectors),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag)); +CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Orientation_of_vectors),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag)); namespace CartesianDKernelFunctors { template struct Linear_rank : private Store_kernel { @@ -255,11 +193,10 @@ template struct Linear_rank : private Store_kernel { template result_type operator()(Iter f, Iter e)const{ typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); + typename Get_functor::type vd(this->kernel()); std::ptrdiff_t n=std::distance(f,e); if (n==0) return 0; Vector const& v0 = *f; - // FIXME: Uh? Using it on a vector ?! int d=vd(v0); Matrix m(d,n); for(int j=0;j struct Linear_rank : private Store_kernel { m(j,i)=c(v,j); } } - return R::LA::rank(CGAL_MOVE(m)); + return R::LA::rank(std::move(m)); } }; } -CGAL_KD_DEFAULT_FUNCTOR(Linear_rank_tag,(CartesianDKernelFunctors::Linear_rank),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag)); +CGAL_KD_DEFAULT_FUNCTOR(Linear_rank_tag,(CartesianDKernelFunctors::Linear_rank),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag)); namespace CartesianDKernelFunctors { template struct Linearly_independent : private Store_kernel { @@ -286,9 +223,8 @@ template struct Linearly_independent : private Store_kernel { template result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type vd(this->kernel()); + typename Get_functor::type vd(this->kernel()); std::ptrdiff_t n=std::distance(f,e); - // FIXME: Uh? Using it on a vector ?! int d=vd(*f); if (n>d) return false; typename Get_functor::type lr(this->kernel()); @@ -297,7 +233,7 @@ template struct Linearly_independent : private Store_kernel { }; } -CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Linearly_independent),(Vector_tag),(Point_dimension_tag,Linear_rank_tag)); +CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Linearly_independent),(Vector_tag),(Vector_dimension_tag,Linear_rank_tag)); namespace CartesianDKernelFunctors { template struct Contained_in_linear_hull : private Store_kernel { @@ -311,10 +247,9 @@ template struct Contained_in_linear_hull : private Store_kernel { template result_type operator()(Iter f, Iter e,V const&w)const{ typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); + typename Get_functor::type vd(this->kernel()); std::ptrdiff_t n=std::distance(f,e); if (n==0) return false; - // FIXME: Uh? Using it on a vector ?! int d=vd(w); Matrix m(d,n+1); for(int i=0; f!=e; ++f,++i){ @@ -329,14 +264,14 @@ template struct Contained_in_linear_hull : private Store_kernel { int r1 = R::LA::rank(m); // FIXME: Don't use eigen directly, go through an interface in LA... m.conservativeResize(Eigen::NoChange, n); - int r2 = R::LA::rank(CGAL_MOVE(m)); + int r2 = R::LA::rank(std::move(m)); return r1 == r2; // TODO: This is very very far from optimal... } }; } -CGAL_KD_DEFAULT_FUNCTOR(Contained_in_linear_hull_tag,(CartesianDKernelFunctors::Contained_in_linear_hull),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag)); +CGAL_KD_DEFAULT_FUNCTOR(Contained_in_linear_hull_tag,(CartesianDKernelFunctors::Contained_in_linear_hull),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag)); namespace CartesianDKernelFunctors { template struct Affine_rank : private Store_kernel { @@ -363,7 +298,7 @@ template struct Affine_rank : private Store_kernel { // TODO: cache p0[j] in case it is computed? } } - return R::LA::rank(CGAL_MOVE(m)); + return R::LA::rank(std::move(m)); } }; } @@ -428,8 +363,8 @@ template struct Contained_in_simplex : private Store_kernel { } // If the simplex has full dimension, there must be a solution, only the signs need to be checked. if (n == d+1) - LA::solve(a,CGAL_MOVE(m),CGAL_MOVE(b)); - else if (!LA::solve_and_check(a,CGAL_MOVE(m),CGAL_MOVE(b))) + LA::solve(a,std::move(m),std::move(b)); + else if (!LA::solve_and_check(a,std::move(m),std::move(b))) return false; for(int i=0;i struct Linear_base : private Store_kernel { typedef typename R::LA::Dynamic_matrix Matrix; template - result_type operator()(Iter f, Iter e, Oter&o)const{ + result_type operator()(Iter f, Iter e, Oter o)const{ typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); + typename Get_functor::type vd(this->kernel()); typename Get_functor >::type cv(this->kernel()); std::ptrdiff_t n=std::distance(f,e); if (n==0) return; Vector const& v0 = *f; - // FIXME: Uh? Using it on a vector ?! int d=vd(v0); Matrix m(d,n); for(int j=0;j struct Linear_base : private Store_kernel { m(i,j)=c(v,j); } } - Matrix b = R::LA::basis(CGAL_MOVE(m)); + Matrix b = R::LA::basis(std::move(m)); for(int i=0; i < R::LA::columns(b); ++i){ //*o++ = Vector(b.col(i)); typedef -#ifdef CGAL_CXX11 decltype(std::declval()(0,0)) -#else - FT -#endif Ref; typedef Iterator_from_indices > IFI; @@ -499,7 +429,7 @@ template struct Linear_base : private Store_kernel { }; } -CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag)); +CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base),(Vector_tag),(Vector_dimension_tag,Compute_vector_cartesian_coordinate_tag)); #if 0 namespace CartesianDKernelFunctors { @@ -569,7 +499,7 @@ template struct Power_side_of_power_sphere_raw : private Store_kernel< typedef typename LA::Square_matrix Matrix; template - result_type operator()(IterP f, IterP const& e, IterW fw, Pt const& p0, Wt const& w0) const { + result_type operator()(IterP f, IterP const& e, IterW fw, IterW const&/*ew*/, Pt const& p0, Wt const& w0) const { typedef typename Get_functor::type Sqdo; typename Get_functor::type c(this->kernel()); typename Get_functor::type pd(this->kernel()); @@ -599,9 +529,9 @@ template struct Power_side_of_power_sphere_raw : private Store_kernel< } } if(d%2) - return -LA::sign_of_determinant(CGAL_MOVE(m)); + return -LA::sign_of_determinant(std::move(m)); else - return LA::sign_of_determinant(CGAL_MOVE(m)); + return LA::sign_of_determinant(std::move(m)); } }; } @@ -621,11 +551,13 @@ template struct Side_of_oriented_sphere : private Store_kernel { typedef typename R::LA::template Rebind_dimension::Other LA; typedef typename LA::Square_matrix Matrix; + /* Undocumented, removed template result_type operator()(Iter f, Iter const& e)const{ Point const& p0=*f++; // *--e ? return this->operator()(f,e,p0); } + */ template result_type operator()(Iter f, Iter const& e, Point const& p0) const { @@ -657,12 +589,11 @@ template struct Side_of_oriented_sphere : private Store_kernel { } } if(d%2) - return -LA::sign_of_determinant(CGAL_MOVE(m)); + return -LA::sign_of_determinant(std::move(m)); else - return LA::sign_of_determinant(CGAL_MOVE(m)); + return LA::sign_of_determinant(std::move(m)); } -#ifdef CGAL_CXX11 template =4)>::type> result_type operator()(U&&...u) const { return operator()({std::forward(u)...}); @@ -672,9 +603,6 @@ template struct Side_of_oriented_sphere : private Store_kernel { result_type operator()(std::initializer_list

l) const { return operator()(l.begin(),l.end()); } -#else - //TODO -#endif }; } @@ -718,7 +646,7 @@ template struct Construct_circumcenter : Store_kernel { CGAL_assertion (i == d); Vec res = typename CVec::Dimension()(d);; //std::cout << "Mat: " << m << "\n Vec: " << one << std::endl; - LA::solve(res, CGAL_MOVE(m), CGAL_MOVE(b)); + LA::solve(res, std::move(m), std::move(b)); //std::cout << "Sol: " << res << std::endl; return cp(d,LA::vector_begin(res),LA::vector_end(res)); } @@ -762,7 +690,7 @@ template struct Construct_circumcenter : Store_kernel { for(j=0;j struct Side_of_bounded_sphere : private Store_kernel { return enum_cast (sos (f, e, p0) * op (f, e)); } -#ifdef CGAL_CXX11 template =4)>::type> result_type operator()(U&&...u) const { return operator()({std::forward(u)...}); @@ -831,9 +758,6 @@ template struct Side_of_bounded_sphere : private Store_kernel { result_type operator()(std::initializer_list

l) const { return operator()(l.begin(),l.end()); } -#else - //TODO -#endif }; } @@ -1218,15 +1142,9 @@ template struct Compare_lexicographically : private Store_kernel { CI c(this->kernel()); -#ifdef CGAL_CXX11 auto a_begin=c(a,Begin_tag()); auto b_begin=c(b,Begin_tag()); auto a_end=c(a,End_tag()); -#else - typename CI::result_type a_begin=c(a,Begin_tag()); - typename CI::result_type b_begin=c(b,Begin_tag()); - typename CI::result_type a_end=c(a,End_tag()); -#endif result_type res; // can't we do slightly better for Uncertain<*> ? // after res=...; if(is_uncertain(res))return indeterminate(); @@ -1290,15 +1208,9 @@ template struct Equal_points : private Store_kernel { CI c(this->kernel()); -#ifdef CGAL_CXX11 auto a_begin=c(a,Begin_tag()); auto b_begin=c(b,Begin_tag()); auto a_end=c(a,End_tag()); -#else - typename CI::result_type a_begin=c(a,Begin_tag()); - typename CI::result_type b_begin=c(b,Begin_tag()); - typename CI::result_type a_end=c(a,End_tag()); -#endif result_type res = true; // Is using CGAL::possibly for Uncertain really an optimization? diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index 3ed395c4403..ebe4eae4382 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -22,10 +22,8 @@ #define CGAL_FUNCTOR_TAGS_H #include // for Null_tag #include -#ifdef CGAL_CXX11 #include #include -#endif #include #include #include @@ -42,10 +40,8 @@ namespace CGAL { : K::template Type {}; template struct Get_functor : K::template Functor {}; -#ifdef CGAL_CXX11 template using Type = typename Get_type::type; template using Functor = typename Get_functor::type; -#endif class Null_type {~Null_type();}; // no such object should be created @@ -203,7 +199,11 @@ namespace CGAL { typedef Null_tag value_tag; }; + templatestruct map_result_tag{typedef Null_type type;}; + templatestruct map_result_tag >{typedef T type;}; + #define CGAL_DECL_COMPUTE(X) struct X##_tag {}; \ + template<>struct map_result_tag{typedef FT_tag type;}; \ templatestruct Get_functor_category{typedef Compute_tag type;} CGAL_DECL_COMPUTE(Compute_point_cartesian_coordinate); CGAL_DECL_COMPUTE(Compute_vector_cartesian_coordinate); @@ -241,9 +241,6 @@ namespace CGAL { CGAL_DECL_ITER_OBJ(Point_cartesian_const_iterator, FT, Compute_point_cartesian_coordinate, Point); #undef CGAL_DECL_ITER_OBJ - templatestruct map_result_tag{typedef Null_type type;}; - templatestruct map_result_tag >{typedef T type;}; - templatestruct Get_functor_category,B,C> : boost::mpl::if_c::is_iterator, Construct_iterator_tag, diff --git a/NewKernel_d/include/CGAL/NewKernel_d/utils.h b/NewKernel_d/include/CGAL/NewKernel_d/utils.h index 306eaaba76c..725a3c86697 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/utils.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/utils.h @@ -29,19 +29,8 @@ // https://lists.boost.org/boost-users/2014/11/83291.php #endif -#ifdef CGAL_CXX11 #include #include -#define CGAL_FORWARDABLE(T) T&& -#define CGAL_FORWARD(T,t) std::forward(t) -#define CGAL_MOVE(t) std::move(t) -#define CGAL_CONSTEXPR constexpr -#else -#define CGAL_FORWARDABLE(T) T const& -#define CGAL_FORWARD(T,t) t -#define CGAL_MOVE(t) t -#define CGAL_CONSTEXPR -#endif #include #include #include @@ -50,12 +39,6 @@ #include #include -#ifdef CGAL_CXX11 -#define CGAL_BOOSTD std:: -#else -#define CGAL_BOOSTD boost:: -#endif - namespace CGAL { namespace internal { BOOST_MPL_HAS_XXX_TRAIT_DEF(type) @@ -81,17 +64,10 @@ struct Has_type_different_from // like std::forward, except for basic types where it does a cast, to // avoid issues with narrowing conversions -#ifdef CGAL_CXX11 template inline typename std::conditional::value&&std::is_arithmetic::type>::value,T,U&&>::type forward_safe(V&& u) { return std::forward(u); } -#else - template inline U const& forward_safe(U const& u) { - return u; - } -#endif -#ifdef CGAL_CXX11 template struct Constructible_from_each; template struct Constructible_from_each{ enum { value=std::is_convertible::value&&Constructible_from_each::value }; @@ -99,27 +75,14 @@ struct Has_type_different_from template struct Constructible_from_each{ enum { value=true }; }; -#else -// currently only used in C++0X code -#endif template struct Scale { -#ifndef CGAL_CXX11 - template struct result; - template struct result { - typedef FT type; - }; -#endif T const& scale; Scale(T const& t):scale(t){} template -#ifdef CGAL_CXX11 - auto operator()(FT&& x)const->decltype(scale*std::forward(x)) -#else - FT operator()(FT const& x)const -#endif + decltype(auto) operator()(FT&& x)const { - return scale*CGAL_FORWARD(FT,x); + return (scale*std::forward(x)); } }; template struct Divide { @@ -135,16 +98,12 @@ struct Has_type_different_from T const& scale; Divide(T const& t):scale(t){} template -#ifdef CGAL_CXX11 //FIXME: gcc complains for Gmpq - //auto operator()(FT&& x)const->decltype(Rational_traits().make_rational(std::forward(x),scale)) + //decltype(auto) operator()(FT&& x)const NT operator()(FT&& x)const -#else - NT operator()(FT const& x)const -#endif { return Rational_traits(). - make_rational(CGAL_FORWARD(FT,x),scale); + make_rational(std::forward(x),scale); } }; @@ -158,39 +117,25 @@ struct Has_type_different_from template < class Ret > struct multiplies { template -#ifdef CGAL_CXX11 - auto operator()(A&&a,B&&b)const->decltype(std::forward(a)*std::forward(b)) -#else - Ret operator()(A const& a, B const& b)const -#endif + decltype(auto) operator()(A&&a,B&&b)const { - return CGAL_FORWARD(A,a)*CGAL_FORWARD(B,b); + return std::forward(a)*std::forward(b); } }; template < class Ret > struct division { template -#ifdef CGAL_CXX11 - auto operator()(A&&a,B&&b)const->decltype(std::forward(a)/std::forward(b)) -#else - Ret operator()(A const& a, B const& b)const -#endif + decltype(auto) operator()(A&&a,B&&b)const { - return CGAL_FORWARD(A,a)/CGAL_FORWARD(B,b); + return std::forward(a)/std::forward(b); } }; -#ifdef CGAL_CXX11 using std::decay; -#else - template struct decay : boost::remove_cv::type> {}; -#endif template struct Type_copy_ref { typedef U type; }; template struct Type_copy_ref { typedef U& type; }; -#ifdef CGAL_CXX11 template struct Type_copy_ref { typedef U&& type; }; -#endif template struct Type_copy_cv { typedef U type; }; template struct Type_copy_cv { typedef U const type; }; template struct Type_copy_cv { typedef U volatile type; }; @@ -204,67 +149,29 @@ struct Has_type_different_from template struct result { typedef typename std::iterator_traits::reference type; }; - template typename result::type + template decltype(auto) operator()(It const&i)const{ return *i; } }; -#ifdef CGAL_CXX11 - template struct Indices{}; - template struct Next_increasing_indices; - template struct Next_increasing_indices > { - typedef Indices type; - }; - template struct N_increasing_indices { - typedef typename Next_increasing_indices::type>::type type; - }; - template<> struct N_increasing_indices<0> { typedef Indices<> type; }; namespace internal { - template inline typename std::result_of::type - do_call_on_tuple_elements(F&&f, std::tuple&&t, Indices&&) { + template inline decltype(auto) + do_call_on_tuple_elements(F&&f, std::tuple&&t, std::index_sequence&&) { return f(std::get(std::move(t))...); } } // internal - template - inline typename std::result_of::type + template + inline decltype(auto) call_on_tuple_elements(F&&f, std::tuple&&t) { return internal::do_call_on_tuple_elements(std::forward(f),std::move(t), - typename N_increasing_indices::type()); + std::make_index_sequence()); } -#else -#define CGAL_VAR(Z,N,_) std::get(t) -#define CGAL_CODE(Z,N,_) template \ - inline Res call_on_tuple_elements(F const&f, \ - std::tuple const&t) { \ - return f(BOOST_PP_ENUM(N,CGAL_VAR,)); \ - } - template - inline Res call_on_tuple_elements(F const&f, std::tuple<>) { - return f(); - } -BOOST_PP_REPEAT_FROM_TO(1, 8, CGAL_CODE, _ ) -#undef CGAL_CODE -#undef CGAL_VAR -#endif - template struct Factory { typedef A result_type; -#ifdef CGAL_CXX11 template result_type operator()(U&&...u)const{ return A(std::forward(u)...); } -#else - result_type operator()()const{ - return A(); - } -#define CGAL_CODE(Z,N,_) template \ - result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,U,const&u))const{ \ - return A(BOOST_PP_ENUM_PARAMS(N,u)); \ - } -BOOST_PP_REPEAT_FROM_TO(1, 8, CGAL_CODE, _ ) -#undef CGAL_CODE -#endif }; } diff --git a/NewKernel_d/include/CGAL/argument_swaps.h b/NewKernel_d/include/CGAL/argument_swaps.h index b23e3b6d1dc..8bedaff6f39 100644 --- a/NewKernel_d/include/CGAL/argument_swaps.h +++ b/NewKernel_d/include/CGAL/argument_swaps.h @@ -24,15 +24,7 @@ #include #include -#ifndef CGAL_CXX11 -#include -#include -#endif - namespace CGAL { - -#ifdef CGAL_CXX11 - namespace internal { template struct Apply_to_last_then_rest_; @@ -55,10 +47,8 @@ struct Apply_to_last_then_rest_<0,F,T,U...> { return std::forward(f)(std::forward(t), std::forward(u)...); } }; - } // namespace internal - struct Apply_to_last_then_rest { template inline typename internal::Apply_to_last_then_rest_::result_type @@ -70,20 +60,6 @@ struct Apply_to_last_then_rest { } }; -#else // CGAL_CXX11 - -struct Apply_to_last_then_rest { -#define CGAL_CODE(Z,N,_) template \ - typename boost::result_of::type \ - operator()(F const&f, BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t), T const&t) const { \ - return f(t,BOOST_PP_ENUM_PARAMS(N,t)); \ - } - BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) -#undef CGAL_CODE -}; - -#endif // CGAL_CXX11 - } // namespace CGAL #endif // CGAL_ARGUMENT_SWAPS_H diff --git a/NewKernel_d/include/CGAL/iterator_from_indices.h b/NewKernel_d/include/CGAL/iterator_from_indices.h index 22e772a5031..f79a3e89bf2 100644 --- a/NewKernel_d/include/CGAL/iterator_from_indices.h +++ b/NewKernel_d/include/CGAL/iterator_from_indices.h @@ -33,11 +33,7 @@ struct Default_coordinate_access { //TODO: default type for Value_: typename same_cv::type::value_type>::type template ()[0]) -#else - Value_& -#endif , class Coord_access = Default_coordinate_access > class Iterator_from_indices @@ -50,7 +46,7 @@ class Iterator_from_indices typedef std::ptrdiff_t index_t; Container_* cont; index_t index; - Coord_access ca; + CGAL_NO_UNIQUE_ADDRESS Coord_access ca; void increment(){ ++index; } void decrement(){ --index; } void advance(std::ptrdiff_t n){ index+=n; } @@ -66,6 +62,7 @@ class Iterator_from_indices return ca(*cont,index); } public: + Iterator_from_indices(){} Iterator_from_indices(Container_& cont_,std::size_t n) : cont(&cont_), index(n) {} template diff --git a/NewKernel_d/include/CGAL/typeset.h b/NewKernel_d/include/CGAL/typeset.h index 1bba56618e9..ba6a04ec37f 100644 --- a/NewKernel_d/include/CGAL/typeset.h +++ b/NewKernel_d/include/CGAL/typeset.h @@ -21,17 +21,12 @@ #ifndef CGAL_TYPESET_H #define CGAL_TYPESET_H #include -#ifdef CGAL_CXX11 #include -#else -#include -#endif // Sometimes using tuple just to list types is overkill (takes forever to // instantiate). namespace CGAL { -#ifdef CGAL_CXX11 template struct typeset; template struct typeset { typedef H head; @@ -55,33 +50,6 @@ namespace CGAL { template using contains = std::false_type; template using add = typeset; }; -#else - template struct typeset; - template, void, typeset >::type > - struct typeset { - typedef typeset type; - typedef H head; - typedef T tail; - template struct contains : - boost::mpl::if_,boost::true_type,typename tail::template contains >::type - {}; - template struct add; - //boost::mpl::if_,typeset,typeset >::type - }; - template<> struct typeset<> { - typedef typeset type; - template struct contains : boost::false_type {}; - template struct add : CGAL::typeset {}; - }; - - template - template - struct typeset::add : typeset::type> {}; - template - template - struct typeset::add : typeset {}; -#endif template struct typeset_union_ : typeset_union_::type, typename T2::tail> @@ -93,26 +61,15 @@ namespace CGAL { typedef typename T1::head H; typedef typename typeset_intersection_::type U; typedef typename -#ifdef CGAL_CXX11 std::conditional::value, -#else - boost::mpl::if_, -#endif typename U::template add::type, U>::type type; }; template struct typeset_intersection_,T> : typeset<> {}; -#ifdef CGAL_CXX11 template using typeset_union = typename typeset_union_::type; template using typeset_intersection = typename typeset_intersection_::type; -#else - template - struct typeset_union : typeset_union_::type {}; - template - struct typeset_intersection : typeset_intersection_::type {}; -#endif } #endif diff --git a/NewKernel_d/test/NewKernel_d/CMakeLists.txt b/NewKernel_d/test/NewKernel_d/CMakeLists.txt index 36b37c8bb60..9cbe76d8204 100644 --- a/NewKernel_d/test/NewKernel_d/CMakeLists.txt +++ b/NewKernel_d/test/NewKernel_d/CMakeLists.txt @@ -3,9 +3,9 @@ # Then modified by hand to add Eigen3. +cmake_minimum_required(VERSION 3.1...3.15) project( NewKernel_d_Tests ) -cmake_minimum_required(VERSION 3.1) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) message(STATUS "NOTICE: this directory requires a version of gcc >= 4.4, and will not be compiled.") diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index 30aa5f79882..197e5cd85f9 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -11,6 +11,7 @@ int main() //#define BOOST_RESULT_OF_USE_DECLTYPE 1 #include +#include #include #include @@ -121,7 +122,6 @@ void test2(){ typedef typename K1::Oriented_side_d OS; typedef typename K1::Orthogonal_vector_d OV; typedef typename K1::Point_dimension_d PD; - typedef typename K1::Point_of_sphere_d PS; typedef typename K1::Point_to_vector_d PV; typedef typename K1::Vector_to_point_d VP; typedef typename K1::Barycentric_coordinates_d BC; @@ -190,7 +190,6 @@ void test2(){ OS os Kinit(oriented_side_d_object); OV ov Kinit(orthogonal_vector_d_object); PD pd Kinit(point_dimension_d_object); - PS ps Kinit(point_of_sphere_d_object); PV pv Kinit(point_to_vector_d_object); VP vp Kinit(vector_to_point_d_object); BC bc Kinit(barycentric_coordinates_d_object); @@ -356,6 +355,8 @@ void test2(){ #endif P z0=cp( 0+2,5-3); P z1=cp(-5+2,0-3); + assert(abs(sd(z0,z1)-50)<.0001); + assert(ed(z0,z0) && !ed(z0,z1)); P z2=cp( 3+2,4-3); P tabz[]={z0,z1,z2}; Sp sp = csp(tabz+0,tabz+3); @@ -366,18 +367,6 @@ void test2(){ assert(abs(cent1[0]-2)<.0001); assert(abs(cent1[1]+3)<.0001); assert(abs(sp.squared_radius()-25)<.0001); -#if 1 - // Fails for an exact kernel - P psp0=ps(sp,0); - P psp1=ps(sp,1); - P psp2=ps(sp,2); - assert(!ed(psp0,psp1)); - assert(!ed(psp0,psp2)); - assert(!ed(psp2,psp1)); - assert(abs(sd(cent0,psp0)-25)<.0001); - assert(abs(sd(cent0,psp1)-25)<.0001); - assert(abs(sd(cent0,psp2)-25)<.0001); -#endif P x2py1 = tp(x2,y1); assert(x2py1[1]==-2); WP tw[]={cwp(cp(5,0),1.5),cwp(cp(2,std::sqrt(3)),1),cwp(cp(2,-std::sqrt(3)),1)}; @@ -413,6 +402,47 @@ void test2(){ D un10; CGAL_USE(un10); } +// Fails for an exact kernel, so I split it here +template +void test2i(){ + typedef Ker K1; + typedef typename K1::Point_d P; + typedef typename K1::Sphere_d Sp; + typedef typename K1::Point_of_sphere_d PS; + typedef typename K1::Construct_point_d CP; + typedef typename K1::Construct_sphere_d CSp; + typedef typename K1::Equal_d E; + typedef typename K1::Squared_distance_d SD; + typedef typename K1::Center_of_sphere_d COS; + Ker k +#if 0 + (2) +#endif + ; + CP cp Kinit(construct_point_d_object); + PS ps Kinit(point_of_sphere_d_object); + CSp csp Kinit(construct_sphere_d_object); + E ed Kinit(equal_d_object); + SD sd Kinit(squared_distance_d_object); + COS cos Kinit(center_of_sphere_d_object); + P z0=cp( 0+2,5-3); + P z1=cp(-5+2,0-3); + P z2=cp( 3+2,4-3); + P tabz[]={z0,z1,z2}; + Sp sp = csp(tabz+0,tabz+3); + P cent0=cos(sp); + P psp0=ps(sp,0); + P psp1=ps(sp,1); + P psp2=ps(sp,2); + assert(!ed(psp0,psp1)); + assert(!ed(psp0,psp2)); + assert(!ed(psp2,psp1)); + using std::abs; + assert(abs(sd(cent0,psp0)-25)<.0001); + assert(abs(sd(cent0,psp1)-25)<.0001); + assert(abs(sd(cent0,psp2)-25)<.0001); +} + #if defined(BOOST_MSVC) # pragma warning(push) # pragma warning(disable: 4512) @@ -531,7 +561,7 @@ void test3(){ assert(abs(sd(e,a)-32)<.0001); P tab[]={a,b,c,d,e}; std::cout << po (&tab[0],tab+4) << ' '; - std::cout << sos(&tab[0],tab+5) << ' '; + std::cout << sos(&tab[1],tab+5,tab[0]) << ' '; std::cout << sbs(tab+1,tab+5,tab[0]) << std::endl; FO fo=cfo(&tab[0],tab+3); std::cout << fo; @@ -564,13 +594,13 @@ void test3(){ std::cout << ifsos(fo3,yy+0,yy+3,yy[3]) << ' '; std::cout << ifsos(fo3,yy+1,yy+4,yy[0]) << '\n'; P buf[]={cp(100,900,0),y[0],y[1],y[2],y[3]}; - std::cout << sos(buf+0,buf+5) << ' '; + std::cout << sos(buf+1,buf+5,buf[0]) << ' '; buf[1]=y[1];buf[2]=y[2];buf[3]=y[3];buf[4]=y[0]; - std::cout << sos(buf+0,buf+5) << ' '; + std::cout << sos(buf+1,buf+5,buf[0]) << ' '; buf[1]=yy[0];buf[2]=yy[1];buf[3]=yy[2];buf[4]=yy[3]; - std::cout << sos(buf+0,buf+5) << ' '; + std::cout << sos(buf+1,buf+5,buf[0]) << ' '; buf[1]=yy[1];buf[2]=yy[2];buf[3]=yy[3];buf[4]=yy[0]; - std::cout << sos(buf+0,buf+5) << '\n'; + std::cout << sos(buf+1,buf+5,buf[0]) << '\n'; assert(cah(y+0,y+3,y[3])); assert(!cah(y+0,y+3,buf[0])); assert(cl(a,a)==CGAL::EQUAL); @@ -687,9 +717,14 @@ CGAL_static_assertion((boost::is_same,CGAL::Ambient_dimen int main(){ //Broken with Linear_base_d (output iterator) //test2 >(); - test2(); + test2(); test2i(); test3(); test3(); +#if !defined _MSC_VER || _MSC_VER >= 1910 + test2>>(); + test3>>(); + test3>(); +#endif } #endif diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 2444d8e12a1..909de52a70a 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -163,6 +163,11 @@ struct Lazy_exact_Ex_Cst : public Lazy_exact_nt_rep { this->et = new ET(e); } + Lazy_exact_Ex_Cst (ET&& e) + : Lazy_exact_nt_rep(CGAL_NTS to_interval(e)) + { + this->et = new ET(std::move(e)); + } void update_exact() const { CGAL_error(); } }; @@ -342,14 +347,14 @@ struct Lazy_exact_Max : public Lazy_exact_binary // The real number type, handle class template class Lazy_exact_nt - : public Lazy, ET_, Lazy_exact_nt, To_interval > + : public Lazy, ET_, To_interval > , boost::ordered_euclidian_ring_operators2< Lazy_exact_nt, int > , boost::ordered_euclidian_ring_operators2< Lazy_exact_nt, double > { public: typedef Lazy_exact_nt Self; - typedef Lazy, ET_, Self, To_interval > Base; + typedef Lazy, ET_, To_interval > Base; typedef typename Base::Self_rep Self_rep; typedef typename Base::ET ET; // undocumented @@ -374,6 +379,8 @@ public : Lazy_exact_nt (const ET & e) : Base(new Lazy_exact_Ex_Cst(e)){} + Lazy_exact_nt (ET&& e) + : Base(new Lazy_exact_Ex_Cst(std::move(e))){} template Lazy_exact_nt (const Lazy_exact_nt &x, diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index fc85257730e..6a74945aea9 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -3,9 +3,9 @@ # that dependency so as to test all the number types not depending on CORE # when it is not installed +cmake_minimum_required(VERSION 3.1...3.15) project( Number_types_Tests ) -cmake_minimum_required(VERSION 3.1) find_package( CGAL QUIET COMPONENTS Core ) 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 86f1b6be942..df6b3c38c1b 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,8 +1,8 @@ # This is the CMake script for compiling the Optimal_transportation_reconstruction_2 demo. +cmake_minimum_required(VERSION 3.1...3.15) project(Optimal_transportation_reconstruction_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt index a36c1b65b10..7ed964cdd54 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,14 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Optimal_transportation_reconstruction_2_Examples ) -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - find_package(CGAL QUIET) if ( CGAL_FOUND ) 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 fb284c89da7..09505a34174 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,14 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Optimal_transportation_reconstruction_2_Tests ) -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - find_package(CGAL QUIET) if ( CGAL_FOUND ) diff --git a/Partition_2/examples/Partition_2/CMakeLists.txt b/Partition_2/examples/Partition_2/CMakeLists.txt index aafa87d0e5b..bd03b5b2bd5 100644 --- a/Partition_2/examples/Partition_2/CMakeLists.txt +++ b/Partition_2/examples/Partition_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Partition_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Partition_2/test/Partition_2/CMakeLists.txt b/Partition_2/test/Partition_2/CMakeLists.txt index 915bee9792f..8c5243d1204 100644 --- a/Partition_2/test/Partition_2/CMakeLists.txt +++ b/Partition_2/test/Partition_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Partition_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 2f9d63ad422..71e272f464c 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_2_triangulation_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 3c8e59f8f34..6a285a1b067 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_2_triangulation_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 4c3efde1ded..b18274683b9 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,9 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_3_mesh_3_Examples ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) 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 68ab382ea9f..dddf3a8f260 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,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_3_mesh_3_Tests ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) 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 43189c01d4a..eb9fc4be537 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 @@ -2,9 +2,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_3_triangulation_3_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt index 151d1e3afc1..769c1dd3f1c 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Periodic_Lloyd_3_Demo) -cmake_minimum_required(VERSION 3.1) 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/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt index 2a5ab412405..0698a06d176 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_3_triangulation_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 8c11ea11b00..44e7beae244 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_3_triangulation_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 5f03ee9e575..c33f5aa4303 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_4_hyperbolic_triangulation_2_Benchmarks ) -cmake_minimum_required(VERSION 2.8.10) find_package(CGAL QUIET 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 ee07f1a1066..663515d9ce9 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,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1...3.13) +cmake_minimum_required(VERSION 3.1...3.15) 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 62dc88202d6..0632fe87dfb 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,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1...3.13) +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_4_hyperbolic_triangulation_2_Examples ) find_package(CGAL REQUIRED QUIET 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 4a8d692d39a..d758a43f33d 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,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1...3.13) +cmake_minimum_required(VERSION 3.1...3.15) project( Periodic_4_hyperbolic_triangulation_2_Tests ) find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core ) diff --git a/Point_set_2/examples/Point_set_2/CMakeLists.txt b/Point_set_2/examples/Point_set_2/CMakeLists.txt index 5c0becc7051..f477eb4d8bf 100644 --- a/Point_set_2/examples/Point_set_2/CMakeLists.txt +++ b/Point_set_2/examples/Point_set_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Point_set_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Point_set_2/test/Point_set_2/CMakeLists.txt b/Point_set_2/test/Point_set_2/CMakeLists.txt index 603c5f5a225..814bb1127a2 100644 --- a/Point_set_2/test/Point_set_2/CMakeLists.txt +++ b/Point_set_2/test/Point_set_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Point_set_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Point_set_3/examples/Point_set_3/CMakeLists.txt b/Point_set_3/examples/Point_set_3/CMakeLists.txt index 3820a32ef72..100e1919211 100644 --- a/Point_set_3/examples/Point_set_3/CMakeLists.txt +++ b/Point_set_3/examples/Point_set_3/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Point_set_3_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Point_set_3/test/Point_set_3/CMakeLists.txt b/Point_set_3/test/Point_set_3/CMakeLists.txt index 31df0bdf038..53f69efc6c3 100644 --- a/Point_set_3/test/Point_set_3/CMakeLists.txt +++ b/Point_set_3/test/Point_set_3/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Point_set_3_Tests ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) 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 cf741624daa..c2da826d49b 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,8 +1,8 @@ # This is the CMake script for compiling this folder. +cmake_minimum_required(VERSION 3.1...3.15) project( Point_set_processing_3_Examples ) -cmake_minimum_required(VERSION 3.1) # Find CGAL 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 e168fc5f532..264c713ef55 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,8 +1,8 @@ # This is the CMake script for compiling this folder. +cmake_minimum_required(VERSION 3.1...3.15) project( Point_set_processing_3_Tests ) -cmake_minimum_required(VERSION 3.1) # 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 b3bba3377a4..ae0215158da 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,8 +1,8 @@ # This is the CMake script for compiling this folder. +cmake_minimum_required(VERSION 3.1...3.15) project( Poisson_surface_reconstruction_3_Examples ) -cmake_minimum_required(VERSION 3.1) # Find CGAL find_package(CGAL QUIET) 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 877911b52d0..e1d9326840b 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,8 +1,8 @@ # This is the CMake script for compiling this folder. +cmake_minimum_required(VERSION 3.1...3.15) project( Poisson_surface_reconstruction_3_Tests ) -cmake_minimum_required(VERSION 3.1) # Find CGAL find_package(CGAL QUIET) diff --git a/Polygon/examples/Polygon/CMakeLists.txt b/Polygon/examples/Polygon/CMakeLists.txt index af10e6bde24..fbd4cbe65e2 100644 --- a/Polygon/examples/Polygon/CMakeLists.txt +++ b/Polygon/examples/Polygon/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polygon_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h b/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h index 630b61c8f8f..bb6813062df 100644 --- a/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h +++ b/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h @@ -95,16 +95,19 @@ operator>>(std::istream &is, Polygon_2& p) int n = 0; // number of vertices is >> n; typename Traits_P::Point_2 point; - + if (is) { - p.erase(p.vertices_begin(),p.vertices_end()); - for (int i=0; i> point){ - p.push_back(point); - } + p.erase(p.vertices_begin(),p.vertices_end()); + for (int i=0; i> point){ + p.push_back(point); } + else + { + return is; + } + } } - return is; } diff --git a/Polygon/test/Polygon/CMakeLists.txt b/Polygon/test/Polygon/CMakeLists.txt index bff643827c4..8174c9a6be7 100644 --- a/Polygon/test/Polygon/CMakeLists.txt +++ b/Polygon/test/Polygon/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polygon_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt index b5c986dcaf0..45799830a42 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt @@ -1,19 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Polygon_mesh_processing ) - -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - - # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 2f853f6cbe6..23fad404af5 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -1,19 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Polygon_mesh_processing_Examples ) - -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - - # CGAL and its components find_package( CGAL QUIET COMPONENTS ) 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 ed08eaef152..0dd34e1753b 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 @@ -579,12 +579,12 @@ public: if ( opposite(next(h1, tm1), tm1) == prev(opposite(h1, tm1), tm1) ) { inter_edges_to_remove1.insert(edge(next(h1, tm1),tm1)); - inter_edges_to_remove1.insert(edge(next(h2, tm2),tm2)); + inter_edges_to_remove2.insert(edge(next(h2, tm2),tm2)); } if ( opposite(prev(h1, tm1), tm1) == next(opposite(h1, tm1), tm1) ) { inter_edges_to_remove1.insert(edge(prev(h1, tm1), tm1)); - inter_edges_to_remove1.insert(edge(prev(h2, tm2), tm2)); + inter_edges_to_remove2.insert(edge(prev(h2, tm2), tm2)); } } // same but for h2 @@ -598,12 +598,12 @@ public: if ( opposite(next(h2, tm2), tm2) == prev(opposite(h2, tm2), tm2) ) { inter_edges_to_remove1.insert(edge(next(h1, tm1),tm1)); - inter_edges_to_remove1.insert(edge(next(h2, tm2),tm2)); + inter_edges_to_remove2.insert(edge(next(h2, tm2),tm2)); } if ( opposite(prev(h2, tm2), tm2) == next(opposite(h2, tm2), tm2) ) { inter_edges_to_remove1.insert(edge(prev(h1, tm1), tm1)); - inter_edges_to_remove1.insert(edge(prev(h2, tm2), tm2)); + inter_edges_to_remove2.insert(edge(prev(h2, tm2), tm2)); } } } @@ -611,9 +611,15 @@ public: ++epp_it; } for(edge_descriptor ed : inter_edges_to_remove1) + { + put(marks_on_input_edges.ecm1, ed, false); intersection_edges1.erase(ed); + } for(edge_descriptor ed : inter_edges_to_remove2) + { + put(marks_on_input_edges.ecm2, ed, false); intersection_edges2.erase(ed); + } // (1) Assign a patch id to each facet indicating in which connected // component limited by intersection edges of the surface they are. diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index 686447f26d4..6242058639f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -1,19 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Polygon_mesh_processing_Tests ) - -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - - # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 7b4a38c2349..d1c810bba9c 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -1,8 +1,8 @@ # This is the CMake script for compiling the CGAL Polyhedron demo. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyhedron_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt index 6d3fcbd6a36..119f805359f 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt @@ -1,10 +1,10 @@ # This is the CMake script for compiling the CGAL Mesh_3 demo implicit functions. +cmake_minimum_required(VERSION 3.1...3.15) project( Mesh_3_implicit_functions ) include( polyhedron_demo_macros ) -cmake_minimum_required(VERSION 3.1) 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/Polyhedron/examples/Polyhedron/CMakeLists.txt b/Polyhedron/examples/Polyhedron/CMakeLists.txt index e5574f90c81..a4860a0c20e 100644 --- a/Polyhedron/examples/Polyhedron/CMakeLists.txt +++ b/Polyhedron/examples/Polyhedron/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyhedron_Examples ) -cmake_minimum_required(VERSION 3.1) if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. diff --git a/Polyhedron/test/Polyhedron/CMakeLists.txt b/Polyhedron/test/Polyhedron/CMakeLists.txt index 31d0d094a97..6a35171a29c 100644 --- a/Polyhedron/test/Polyhedron/CMakeLists.txt +++ b/Polyhedron/test/Polyhedron/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyhedron_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polyhedron_IO/demo/Polyhedron_IO/CMakeLists.txt b/Polyhedron_IO/demo/Polyhedron_IO/CMakeLists.txt index c87775195e5..642f5f5b4b1 100644 --- a/Polyhedron_IO/demo/Polyhedron_IO/CMakeLists.txt +++ b/Polyhedron_IO/demo/Polyhedron_IO/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyhedron_IO_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Polyhedron_IO/examples/Polyhedron_IO/CMakeLists.txt b/Polyhedron_IO/examples/Polyhedron_IO/CMakeLists.txt index d2f8d510146..1de0b8a91f5 100644 --- a/Polyhedron_IO/examples/Polyhedron_IO/CMakeLists.txt +++ b/Polyhedron_IO/examples/Polyhedron_IO/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyhedron_IO_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polyhedron_IO/test/Polyhedron_IO/CMakeLists.txt b/Polyhedron_IO/test/Polyhedron_IO/CMakeLists.txt index 91a97ec855f..ac42c32b8d0 100644 --- a/Polyhedron_IO/test/Polyhedron_IO/CMakeLists.txt +++ b/Polyhedron_IO/test/Polyhedron_IO/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyhedron_IO_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt index 5ef3513ac7a..609cbec4045 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Polyline_simplification_2_Demo) -cmake_minimum_required(VERSION 3.1) 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/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt index db749400699..f0fb3f70fd4 100644 --- a/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyline_simplification_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt index 3430ed90e69..5f17ccc05da 100644 --- a/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Polyline_simplification_2_Tests ) -cmake_minimum_required(VERSION 3.1) diff --git a/Polynomial/examples/Polynomial/CMakeLists.txt b/Polynomial/examples/Polynomial/CMakeLists.txt index b71a6c04a11..c48b015fbd2 100644 --- a/Polynomial/examples/Polynomial/CMakeLists.txt +++ b/Polynomial/examples/Polynomial/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polynomial_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polynomial/test/Polynomial/CMakeLists.txt b/Polynomial/test/Polynomial/CMakeLists.txt index e274a106b8d..5df0e9350a0 100644 --- a/Polynomial/test/Polynomial/CMakeLists.txt +++ b/Polynomial/test/Polynomial/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polynomial_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt b/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt index 1b63b201100..0aa288958b5 100644 --- a/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt +++ b/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polytope_distance_d_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt b/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt index 4e015e31e20..d9e10bd47c3 100644 --- a/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt +++ b/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Polytope_distance_d_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index 4c13d2781f5..128b250b8f1 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -1,8 +1,8 @@ # This is the CMake script for compiling the PCA demo. +cmake_minimum_required(VERSION 3.1...3.15) project( Principal_component_analysis_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt index 832207a6daa..0518b6ea3cd 100644 --- a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Principal_component_analysis_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt index b7695c9965b..93abc4b5e32 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Principal_component_analysis_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Profiling_tools/examples/Profiling_tools/CMakeLists.txt b/Profiling_tools/examples/Profiling_tools/CMakeLists.txt index f314d77d073..a6ceff687f1 100644 --- a/Profiling_tools/examples/Profiling_tools/CMakeLists.txt +++ b/Profiling_tools/examples/Profiling_tools/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Profiling_tools_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Profiling_tools/test/Profiling_tools/CMakeLists.txt b/Profiling_tools/test/Profiling_tools/CMakeLists.txt index b087980e759..516ea7993a5 100644 --- a/Profiling_tools/test/Profiling_tools/CMakeLists.txt +++ b/Profiling_tools/test/Profiling_tools/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Profiling_tools_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Property_map/examples/Property_map/CMakeLists.txt b/Property_map/examples/Property_map/CMakeLists.txt index 82384c7e7fb..19f1e6fa5ed 100644 --- a/Property_map/examples/Property_map/CMakeLists.txt +++ b/Property_map/examples/Property_map/CMakeLists.txt @@ -1,7 +1,7 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Property_map_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Property_map/test/Property_map/CMakeLists.txt b/Property_map/test/Property_map/CMakeLists.txt index 5208cf86184..610689246fa 100644 --- a/Property_map/test/Property_map/CMakeLists.txt +++ b/Property_map/test/Property_map/CMakeLists.txt @@ -1,8 +1,8 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Property_map_Tests ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/QP_solver/examples/QP_solver/CMakeLists.txt b/QP_solver/examples/QP_solver/CMakeLists.txt index 208ed0358ac..46c011aeed9 100644 --- a/QP_solver/examples/QP_solver/CMakeLists.txt +++ b/QP_solver/examples/QP_solver/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( QP_solver_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/QP_solver/test/QP_solver/CMakeLists.txt b/QP_solver/test/QP_solver/CMakeLists.txt index ec9ad49e801..b82ad8b0985 100644 --- a/QP_solver/test/QP_solver/CMakeLists.txt +++ b/QP_solver/test/QP_solver/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( QP_solver_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Random_numbers/test/Random_numbers/CMakeLists.txt b/Random_numbers/test/Random_numbers/CMakeLists.txt index 927421b6a3f..7f575e303ab 100644 --- a/Random_numbers/test/Random_numbers/CMakeLists.txt +++ b/Random_numbers/test/Random_numbers/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Random_numbers_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Ridges_3/examples/Ridges_3/CMakeLists.txt b/Ridges_3/examples/Ridges_3/CMakeLists.txt index b682835c270..c6409270728 100644 --- a/Ridges_3/examples/Ridges_3/CMakeLists.txt +++ b/Ridges_3/examples/Ridges_3/CMakeLists.txt @@ -1,7 +1,7 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Ridges_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET ) diff --git a/Ridges_3/test/Ridges_3/CMakeLists.txt b/Ridges_3/test/Ridges_3/CMakeLists.txt index 99a76fe4426..8ed993f8e6b 100644 --- a/Ridges_3/test/Ridges_3/CMakeLists.txt +++ b/Ridges_3/test/Ridges_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Ridges_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt index bb3785edbd3..4bfa4327eb0 100644 --- a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Compact_container_benchmark ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt index 51f7a18b9eb..bd9affca7ab 100644 --- a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( copy_n_benchmark_example ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/STL_Extension/examples/STL_Extension/CMakeLists.txt b/STL_Extension/examples/STL_Extension/CMakeLists.txt index 40753532e8a..8ec5a7c080e 100644 --- a/STL_Extension/examples/STL_Extension/CMakeLists.txt +++ b/STL_Extension/examples/STL_Extension/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( STL_Extension_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/NewKernel_d/include/CGAL/transforming_iterator.h b/STL_Extension/include/CGAL/transforming_iterator.h similarity index 96% rename from NewKernel_d/include/CGAL/transforming_iterator.h rename to STL_Extension/include/CGAL/transforming_iterator.h index 5140df7a3e6..107a42e8e87 100644 --- a/NewKernel_d/include/CGAL/transforming_iterator.h +++ b/STL_Extension/include/CGAL/transforming_iterator.h @@ -62,12 +62,7 @@ class transforming_iterator_helper typedef std::iterator_traits Iter_traits; typedef typename Iter_traits::reference Iter_ref; typedef typename Default::Get()(std::declval())) -#else - typename boost::result_of::type - // should be reference instead of value_type -#endif >::type reference_; typedef typename Default::Get::type>::type>::type value_type; diff --git a/NewKernel_d/include/CGAL/transforming_pair_iterator.h b/STL_Extension/include/CGAL/transforming_pair_iterator.h similarity index 95% rename from NewKernel_d/include/CGAL/transforming_pair_iterator.h rename to STL_Extension/include/CGAL/transforming_pair_iterator.h index 1f2b3033642..8bc7d824d1f 100644 --- a/NewKernel_d/include/CGAL/transforming_pair_iterator.h +++ b/STL_Extension/include/CGAL/transforming_pair_iterator.h @@ -53,12 +53,7 @@ class transforming_pair_iterator_helper ::type iterator_category; typedef typename Default::Get()(std::declval::reference>(),std::declval::reference>())) -#else - typename boost::result_of::value_type,typename std::iterator_traits::value_type)>::type - // should be reference instead of value_type -#endif >::type reference; typedef typename Default::Get::type>::type>::type value_type; diff --git a/STL_Extension/test/STL_Extension/CMakeLists.txt b/STL_Extension/test/STL_Extension/CMakeLists.txt index b7fb77d3d9d..419220ed841 100644 --- a/STL_Extension/test/STL_Extension/CMakeLists.txt +++ b/STL_Extension/test/STL_Extension/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( STL_Extension_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 bfa682995fa..bab0af3c5b1 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,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Scale_space_reconstruction_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package( CGAL QUIET) diff --git a/Scripts/developer_scripts/cgal_check_dependencies.sh b/Scripts/developer_scripts/cgal_check_dependencies.sh index 0a8d7b34e14..f270b719745 100644 --- a/Scripts/developer_scripts/cgal_check_dependencies.sh +++ b/Scripts/developer_scripts/cgal_check_dependencies.sh @@ -30,7 +30,7 @@ do fi done -cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++14" .. +cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++1y" .. if [ -n "$DO_CHECK_HEADERS" ]; then make -j$(nproc --all) -k check_headers fi diff --git a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake index 6d05b7f0e94..ab39ee63adc 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.1) +cmake_minimum_required(VERSION 3.1...3.15) function(process_package pkg) if(VERBOSE) diff --git a/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt b/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt index 8f06d64b9d5..090d14f7e7a 100644 --- a/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt +++ b/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( RangeSegmentTrees_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt b/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt index 6b83c29ab11..f3530741ce2 100644 --- a/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt +++ b/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( RangeSegmentTrees_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 2ab90937fb8..38035c853e7 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Segment_Delaunay_graph_2_example ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) 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 23695a3e08f..ef8e579b411 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Segment_Delaunay_graph_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h index fab693cce20..6eb2fd2e803 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h @@ -143,8 +143,11 @@ public: static FT to_ft(const Sqrt_3& x) { - FT sqrt_e = compute_sqrt( to_ft(x.e()), FT_Has_sqrt() ); - FT sqrt_f = compute_sqrt( to_ft(x.f()), FT_Has_sqrt() ); + // If the number type does not offer a square root, x.e() and x.f() (which are of type sqrt_1) + // might be negative after (approximately) evaluating them. Taking the max sanitize these values + // to ensure that we do not take the square root of a negative number. + FT sqrt_e = compute_sqrt( (std::max)(FT(0), to_ft(x.e())), FT_Has_sqrt() ); + FT sqrt_f = compute_sqrt( (std::max)(FT(0), to_ft(x.f())), FT_Has_sqrt() ); FT sqrt_ef = sqrt_e * sqrt_f; return to_ft(x.a()) + to_ft(x.b()) * sqrt_e + to_ft(x.c()) * sqrt_f + to_ft(x.d()) * sqrt_ef; 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 fd781f8a8cf..0b91ac968f3 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Segment_Delaunay_graph_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) 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 71ed0203b7f..60bea9ef71c 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Segment_Delaunay_graph_2_example ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) 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 553dba5a125..c6034d62225 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Segment_Delaunay_graph_Linf_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 29802b5b30c..16164766a1b 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 @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Segment_Delaunay_graph_Linf_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) 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 c37b85c338c..dd91ba64e0f 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,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Set_movable_separability_2_Examples ) -cmake_minimum_required(VERSION 3.1) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_generalized_initializers has_cpp11) if (has_cpp11 LESS 0) 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 a2a4916572d..37fb88505b2 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,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Set_movable_separability_2_Tests ) -cmake_minimum_required(VERSION 3.1) if (RUNNING_CGAL_AUTO_TEST) # Just to avoid a warning from CMake when that variable is set on the command line... diff --git a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt index f314a33fe05..f2c7bf19d77 100644 --- a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt +++ b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project(Shape_detection_Benchmarks) -cmake_minimum_required(VERSION 2.8.10) set(CMAKE_CXX_STANDARD 11) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Shape_detection/examples/Shape_detection/CMakeLists.txt b/Shape_detection/examples/Shape_detection/CMakeLists.txt index edc7922cf5d..d1c49d4986e 100644 --- a/Shape_detection/examples/Shape_detection/CMakeLists.txt +++ b/Shape_detection/examples/Shape_detection/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project(Shape_detection_Examples) -cmake_minimum_required(VERSION 2.8.10) set(CMAKE_CXX_STANDARD 11) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Shape_detection/test/Shape_detection/CMakeLists.txt b/Shape_detection/test/Shape_detection/CMakeLists.txt index a2489d3ac27..67551a95348 100644 --- a/Shape_detection/test/Shape_detection/CMakeLists.txt +++ b/Shape_detection/test/Shape_detection/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project(Shape_detection_Tests) -cmake_minimum_required(VERSION 2.8.10) set(CMAKE_CXX_STANDARD 11) find_package(CGAL QUIET COMPONENTS Core) diff --git a/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt b/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt index eb188b326f1..b5f2f268ff6 100644 --- a/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt +++ b/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Skin_surface_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL) diff --git a/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt b/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt index 36a09ddce8b..d3a5d2acf28 100644 --- a/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt +++ b/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Skin_surface_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt index 224ff142065..af3e2569ac0 100644 --- a/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Snap_rounding_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt index 13598b9fe4c..909b2060625 100644 --- a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Snap_rounding_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index 50e201cd7e4..302e1e878b3 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Solver_interface_Examples ) -cmake_minimum_required(VERSION 3.1...3.15) find_package(CGAL QUIET) diff --git a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt index 51ab416ab53..ca8157f8a8e 100644 --- a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Spatial_searching_ ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt index a332558dc48..285b4853c31 100644 --- a/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( tools_ ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Spatial_searching/doc/Spatial_searching/Concepts/RangeSearchTraits.h b/Spatial_searching/doc/Spatial_searching/Concepts/RangeSearchTraits.h index 56281b811fc..e0af4b8a2a7 100644 --- a/Spatial_searching/doc/Spatial_searching/Concepts/RangeSearchTraits.h +++ b/Spatial_searching/doc/Spatial_searching/Concepts/RangeSearchTraits.h @@ -11,6 +11,7 @@ range search queries in a model of `SpatialTree`. \cgalHasModel `CGAL::Cartesian_d` \cgalHasModel `CGAL::Homogeneous_d` \cgalHasModel `CGAL::Epick_d` +\cgalHasModel `CGAL::Epeck_d` \cgalHasModel `CGAL::Search_traits_2` \cgalHasModel `CGAL::Search_traits_3` diff --git a/Spatial_searching/doc/Spatial_searching/Concepts/SearchTraits.h b/Spatial_searching/doc/Spatial_searching/Concepts/SearchTraits.h index 2abebf75c0b..ae9f9d0363f 100644 --- a/Spatial_searching/doc/Spatial_searching/Concepts/SearchTraits.h +++ b/Spatial_searching/doc/Spatial_searching/Concepts/SearchTraits.h @@ -8,6 +8,7 @@ parameter of the search classes. \cgalHasModel `CGAL::Cartesian_d` \cgalHasModel `CGAL::Homogeneous_d` \cgalHasModel `CGAL::Epick_d` +\cgalHasModel `CGAL::Epeck_d` \cgalHasModel `CGAL::Search_traits_2` \cgalHasModel `CGAL::Search_traits_3` \cgalHasModel `CGAL::Search_traits_d` diff --git a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt index 5c66f23a3ee..c4a335960b5 100644 --- a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Spatial_searching_Examples ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components diff --git a/Spatial_searching/test/Spatial_searching/CMakeLists.txt b/Spatial_searching/test/Spatial_searching/CMakeLists.txt index 90cc940fc5b..736d25c1155 100644 --- a/Spatial_searching/test/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/test/Spatial_searching/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Spatial_searching_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt index 5bf9e578e10..18e9aa776db 100644 --- a/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Spatial_sorting_ ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt index 77db71cd55d..df5f623e1ba 100644 --- a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Spatial_sorting_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt index 98ded58f5b4..c8901de1414 100644 --- a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Spatial_sorting_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt index 732fb4b90bc..b873129ef94 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Straight_skeleton_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt index 2272303a11b..070f91fbd69 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Straight_skeleton_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt b/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt index c12378e2b4b..df241d013bb 100644 --- a/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt +++ b/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Stream_lines_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt b/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt index 3349e59b68a..a4be4c9d3c9 100644 --- a/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt +++ b/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Stream_lines_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Stream_support/benchmark/Stream_support/CMakeLists.txt b/Stream_support/benchmark/Stream_support/CMakeLists.txt index 3e1065efa78..f72b2f0f48b 100644 --- a/Stream_support/benchmark/Stream_support/CMakeLists.txt +++ b/Stream_support/benchmark/Stream_support/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Stream_support ) -cmake_minimum_required(VERSION 3.1) # CGAL and its components diff --git a/Stream_support/examples/Stream_support/CMakeLists.txt b/Stream_support/examples/Stream_support/CMakeLists.txt index 69d953e830e..bb12e6cd1e4 100644 --- a/Stream_support/examples/Stream_support/CMakeLists.txt +++ b/Stream_support/examples/Stream_support/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Stream_support_Examples) -cmake_minimum_required(VERSION 2.8.11) # CGAL and its components find_package( CGAL QUIET) diff --git a/Stream_support/test/Stream_support/CMakeLists.txt b/Stream_support/test/Stream_support/CMakeLists.txt index 147767cad3f..d97144f1b86 100644 --- a/Stream_support/test/Stream_support/CMakeLists.txt +++ b/Stream_support/test/Stream_support/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Stream_support_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) if ( CGAL_FOUND ) diff --git a/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt b/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt index eb57c8246dc..b8fa8e47c50 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt +++ b/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Subdivision_method_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt b/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt index 87cf9f130ba..74338524d72 100644 --- a/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt +++ b/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Subdivision_method_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesh/benchmark/CMakeLists.txt b/Surface_mesh/benchmark/CMakeLists.txt index 8d376836e91..09791bbb8a8 100644 --- a/Surface_mesh/benchmark/CMakeLists.txt +++ b/Surface_mesh/benchmark/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project(Surface_mesh_performance) -cmake_minimum_required(VERSION 3.1) find_package(CGAL REQUIRED) @@ -10,7 +10,7 @@ include_directories(BEFORE "../include") #add_definitions("-pg") #SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") # add_definitions("-g") -add_definitions("-std=c++11") +add_definitions("-std=c++1y") # Polyhedron add_executable(polyhedron_performance performance_2.h polyhedron_performance.h polyhedron_performance.cpp) diff --git a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt index 6ad86b00d0d..6f5b413973d 100644 --- a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_Examples ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. diff --git a/Surface_mesh/test/Surface_mesh/CMakeLists.txt b/Surface_mesh/test/Surface_mesh/CMakeLists.txt index 07743df73f9..8371685d73b 100644 --- a/Surface_mesh/test/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/test/Surface_mesh/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt index 586e65d7774..728c672fded 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_approximation_Benchmarks ) -cmake_minimum_required(VERSION 2.8.11) # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt index d4efe96cf06..e3b19a50cad 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_approximation_Examples ) -cmake_minimum_required(VERSION 2.8.11) # CGAL and its components find_package( CGAL QUIET) diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt index 96ce72ae1cd..caac2a6f132 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_approximation_Tests ) -cmake_minimum_required(VERSION 2.8.11) # CGAL and its components find_package( CGAL QUIET) 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 cd75dcec4e3..67a2731cdc5 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,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( benchmark_for_closest_rotation ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET 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 17b6de5841c..b90af134997 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_deformation_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt index ceac6ce44de..aa90c5d271d 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_deformation_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt index a857d6c00e8..54163d64df1 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_deformation_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index c6d2227aec4..62640e3b6a9 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -1,9 +1,9 @@ # This is the CMake script for compiling this folder. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_parameterization_Examples ) -cmake_minimum_required(VERSION 3.1) # Find CGAL diff --git a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt index 2375ad56670..4021770c494 100644 --- a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt @@ -1,9 +1,9 @@ # This is the CMake script for compiling this folder. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_parameterization_Tests ) -cmake_minimum_required(VERSION 3.1) # 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 be1faa2c864..79bb821c35e 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt @@ -1,10 +1,10 @@ # 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.1...3.15) project( Surface_mesh_segmentation_Examples ) -cmake_minimum_required(VERSION 3.1) diff --git a/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt b/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt index 677d2711e22..49ee7055e9e 100644 --- a/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_segmentation_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 edd21e2855a..6b757a109e9 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 @@ -3,9 +3,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_shortest_path_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 8b70d2db06f..f018de6f17b 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,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1...3.13) +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_shortest_path_Tests ) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt index 1090de74ac5..779611b831a 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt @@ -1,10 +1,10 @@ # 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.1...3.15) project( Surface_mesh_simplification_Examples ) -cmake_minimum_required(VERSION 3.1) diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt index b7b1999faa4..245bbdb83e5 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_simplification_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt index a5b04d07df7..d73305b0549 100644 --- a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,13 +1,13 @@ # 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.1...3.15) project( Mean_curvature_skeleton ) #SET(CMAKE_BUILD_TYPE "Debug") #SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage") #SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" ) -cmake_minimum_required(VERSION 3.1) # 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 9f711c7c4f6..7327aafc329 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_skeletonization_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt index 8aed6ec2d5a..fdab781a1ca 100644 --- a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesh_skeletonization_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt index b702b4bb27f..c1e5b5a4a5f 100644 --- a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt @@ -1,8 +1,8 @@ set ( prj Surface_mesher ) +cmake_minimum_required(VERSION 3.1...3.15) project ( Surface_mesher_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Surface_mesher/examples/Surface_mesher/CMakeLists.txt b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt index 3446a487e88..645859a9fa1 100644 --- a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt @@ -1,9 +1,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesher_Examples ) -cmake_minimum_required(VERSION 3.1) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) diff --git a/Surface_mesher/test/Surface_mesher/CMakeLists.txt b/Surface_mesher/test/Surface_mesher/CMakeLists.txt index dcc5829c499..48b2e73a09c 100644 --- a/Surface_mesher/test/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/test/Surface_mesher/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_mesher_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt index 06dad81f73f..290fd852dc6 100644 --- a/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt @@ -1,19 +1,9 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_sweep_2_Examples ) - -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - - # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 7165020fb83..788981308c7 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Surface_sweep_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/TDS_2/include/CGAL/Triangulation_data_structure_2.h b/TDS_2/include/CGAL/Triangulation_data_structure_2.h index 746f88dee5c..06aaf45b9e5 100644 --- a/TDS_2/include/CGAL/Triangulation_data_structure_2.h +++ b/TDS_2/include/CGAL/Triangulation_data_structure_2.h @@ -98,6 +98,10 @@ public: typedef Triangulation_ds_vertex_circulator_2 Vertex_circulator; typedef Triangulation_ds_edge_circulator_2 Edge_circulator; + typedef Iterator_range > Vertex_handles; + typedef Iterator_range > Face_handles; + typedef Iterator_range Edges; + typedef Vertex_iterator Vertex_handle; typedef Face_iterator Face_handle; @@ -172,6 +176,10 @@ public: return faces().end(); } + Face_handles face_handles() const { + return make_prevent_deref_range(faces_begin(),faces_end()); + } + Vertex_iterator vertices_begin() const { return vertices().begin(); } @@ -179,6 +187,10 @@ public: Vertex_iterator vertices_end() const { return vertices().end(); } + + Vertex_handles vertex_handles() const { + return make_prevent_deref_range(vertices_begin(),vertices_end()); + } Edge_iterator edges_begin() const { return Edge_iterator(this); @@ -187,6 +199,10 @@ public: Edge_iterator edges_end() const { return Edge_iterator(this,1); } + + Edges edges() const { + return Edges(edges_begin(),edges_end()); + } Halfedge_iterator halfedges_begin() const { return Halfedge_iterator(this); diff --git a/TDS_2/test/TDS_2/CMakeLists.txt b/TDS_2/test/TDS_2/CMakeLists.txt index 93b60a87707..2df25a93b59 100644 --- a/TDS_2/test/TDS_2/CMakeLists.txt +++ b/TDS_2/test/TDS_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( TDS_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/TDS_3/examples/TDS_3/CMakeLists.txt b/TDS_3/examples/TDS_3/CMakeLists.txt index c3be4897d87..d0e2a5f766c 100644 --- a/TDS_3/examples/TDS_3/CMakeLists.txt +++ b/TDS_3/examples/TDS_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( TDS_3_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 260eb3b8a5f..63b7d5f704c 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -166,6 +166,12 @@ public: typedef internal::Triangulation_ds_cell_circulator_3 Cell_circulator; typedef internal::Triangulation_ds_facet_circulator_3 Facet_circulator; + typedef Iterator_range > Cell_handles; + typedef Iterator_range > Vertex_handles; + + typedef Iterator_range Facets; + typedef Iterator_range Edges; + //private: // In 2D only : typedef internal::Triangulation_ds_face_circulator_3 Face_circulator; @@ -564,6 +570,11 @@ public: return cells().end(); } + Cell_handles cell_handles() const + { + return make_prevent_deref_range(cells_begin(), cells_end()); + } + Cell_iterator raw_cells_begin() const { return cells().begin(); @@ -586,6 +597,11 @@ public: return Facet_iterator(this, 1); } + Facets facets() const + { + return Facets(facets_begin(), facets_end()); + } + Edge_iterator edges_begin() const { if ( dimension() < 1 ) @@ -598,6 +614,11 @@ public: return Edge_iterator(this,1); } + Edges edges() const + { + return Edges(edges_begin(), edges_end()); + } + Vertex_iterator vertices_begin() const { return vertices().begin(); @@ -608,6 +629,11 @@ public: return vertices().end(); } + Vertex_handles vertex_handles() const + { + return make_prevent_deref_range(vertices_begin(), vertices_end()); + } + // CIRCULATOR METHODS // cells around an edge diff --git a/TDS_3/test/TDS_3/CMakeLists.txt b/TDS_3/test/TDS_3/CMakeLists.txt index 4d8b2ce5862..0253c40548c 100644 --- a/TDS_3/test/TDS_3/CMakeLists.txt +++ b/TDS_3/test/TDS_3/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( TDS_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Three/demo/Three/CMakeLists.txt b/Three/demo/Three/CMakeLists.txt index b8a2631a535..65e6ee0b3ad 100644 --- a/Three/demo/Three/CMakeLists.txt +++ b/Three/demo/Three/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Three_Demo ) -cmake_minimum_required(VERSION 3.1) set(CMAKE_CXX_STANDARD 14) diff --git a/Three/demo/Three/Example_plugin/CMakeLists.txt b/Three/demo/Three/Example_plugin/CMakeLists.txt index 15d708e4137..421687cbfaa 100644 --- a/Three/demo/Three/Example_plugin/CMakeLists.txt +++ b/Three/demo/Three/Example_plugin/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Example_plugin ) -cmake_minimum_required(VERSION 3.1) 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/Triangulation/applications/Triangulation/CMakeLists.txt b/Triangulation/applications/Triangulation/CMakeLists.txt index 4955332d74e..f95f8c19f46 100644 --- a/Triangulation/applications/Triangulation/CMakeLists.txt +++ b/Triangulation/applications/Triangulation/CMakeLists.txt @@ -1,21 +1,9 @@ # 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.1...3.15) project( Triangulation_apps ) - -cmake_minimum_required(VERSION 3.1) -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) - if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) - cmake_policy(VERSION 2.8.4) - else() - cmake_policy(VERSION 2.6) - endif() -endif() - -set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true ) - - # CGAL and its components find_package( CGAL QUIET COMPONENTS ) diff --git a/Triangulation/benchmark/Triangulation/CMakeLists.txt b/Triangulation/benchmark/Triangulation/CMakeLists.txt index 8daf709e47b..f82e906db3d 100644 --- a/Triangulation/benchmark/Triangulation/CMakeLists.txt +++ b/Triangulation/benchmark/Triangulation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_benchmark ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET COMPONENTS Core ) diff --git a/Triangulation/doc/Triangulation/Concepts/DelaunayTriangulationTraits.h b/Triangulation/doc/Triangulation/Concepts/DelaunayTriangulationTraits.h index f5d6345384c..65aa17e3478 100644 --- a/Triangulation/doc/Triangulation/Concepts/DelaunayTriangulationTraits.h +++ b/Triangulation/doc/Triangulation/Concepts/DelaunayTriangulationTraits.h @@ -10,6 +10,7 @@ a Delaunay triangulation. It corresponds to the first template parameter of the \cgalRefines `TriangulationTraits` \cgalHasModel `CGAL::Epick_d` +\cgalHasModel `CGAL::Epeck_d` \sa `TriangulationTraits` */ diff --git a/Triangulation/doc/Triangulation/Concepts/RegularTriangulationTraits.h b/Triangulation/doc/Triangulation/Concepts/RegularTriangulationTraits.h index ca0e3a0d9cd..265c25171ba 100644 --- a/Triangulation/doc/Triangulation/Concepts/RegularTriangulationTraits.h +++ b/Triangulation/doc/Triangulation/Concepts/RegularTriangulationTraits.h @@ -10,6 +10,7 @@ a regular triangulation. It corresponds to the first template parameter of the c \cgalRefines `TriangulationTraits` \cgalHasModel `CGAL::Epick_d` +\cgalHasModel `CGAL::Epeck_d` \sa `TriangulationTraits` */ diff --git a/Triangulation/doc/Triangulation/Concepts/TriangulationTraits.h b/Triangulation/doc/Triangulation/Concepts/TriangulationTraits.h index 9791e86d42f..bba42a5dcff 100644 --- a/Triangulation/doc/Triangulation/Concepts/TriangulationTraits.h +++ b/Triangulation/doc/Triangulation/Concepts/TriangulationTraits.h @@ -15,6 +15,7 @@ then optimized using spatial sorting. This is not required if the points are inserted one by one. \cgalHasModel `CGAL::Epick_d` +\cgalHasModel `CGAL::Epeck_d` \sa `DelaunayTriangulationTraits` */ diff --git a/Triangulation/examples/Triangulation/CMakeLists.txt b/Triangulation/examples/Triangulation/CMakeLists.txt index 741f732649b..69eacb3a05b 100644 --- a/Triangulation/examples/Triangulation/CMakeLists.txt +++ b/Triangulation/examples/Triangulation/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_Examples ) -cmake_minimum_required(VERSION 3.1) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) message(STATUS "NOTICE: this directory requires a version of gcc >= 4.4, and will not be compiled.") diff --git a/Triangulation/test/Triangulation/CMakeLists.txt b/Triangulation/test/Triangulation/CMakeLists.txt index 67ea3dc2a8b..49054feffce 100644 --- a/Triangulation/test/Triangulation/CMakeLists.txt +++ b/Triangulation/test/Triangulation/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_Tests ) -cmake_minimum_required(VERSION 3.1) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) message(STATUS "NOTICE: this directory requires a version of gcc >= 4.4, and will not be compiled.") diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h index 9722d8b0fa7..181dc976ff6 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h @@ -165,6 +165,10 @@ The value type of this iterator is `Edge`. */ typedef unspecified_type Constrained_edges_iterator; +/*! +A range type to iterate over the constrained edges. +*/ +typedef Iterator_range Constrained_edges; /*! The intersection tag which decides how @@ -197,18 +201,18 @@ Constrained_triangulation_2& ct1); /// @{ /*! -Returns `true` if edge `e` is a constrained edge. +returns `true` if edge `e` is a constrained edge. */ bool is_constrained(Edge e) const; /*! -Returns `true` if at least one of the edges incident to vertex `v` +returns `true` if at least one of the edges incident to vertex `v` is constrained. */ bool are_there_incident_constraints(Vertex_handle v) const; /*! -Outputs the constrained edges incident to `v` +outputs the constrained edges incident to `v` into the output iterator `out` and returns the resulting output iterator. \tparam OutputItEdges is an `OutputIterator` with `Edge` as value @@ -229,6 +233,11 @@ returns the past-the-end iterator. */ Constrained_edges_iterator constrained_edges_end() const; +/*! +returns a range of constrained edges. +*/ +Constrained_edges constrained_edges() const; + /// @} /// \name Insertion and Removal @@ -236,14 +245,14 @@ Constrained_edges_iterator constrained_edges_end() const; /// @{ /*! -Inserts point `p` and restores the status (constrained or not) of all +inserts point `p` and restores the status (constrained or not) of all the touched edges. If present, `f` is used as an hint for the location of `p`. */ Vertex_handle insert(Point p, Face_handle f = Face_handle() ); /*! -Inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. +inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. \sa `Triangulation_2::locate()` */ Vertex_handle @@ -258,7 +267,7 @@ Vertex_handle push_back(const Point& p); /*! -Inserts points `a` and `b` in this order, and inserts the line segment `ab` as a +inserts points `a` and `b` in this order, and inserts the line segment `ab` as a constraint. Removes the faces crossed by segment `ab` and creates new faces instead. If a vertex `c` lies on segment `ab`, constraint `ab` is replaced by the two constraints `ac` and `cb`. Apart from the insertion of @@ -273,7 +282,7 @@ Equivalent to `insert(c.first, c.second)`. void push_back(const std::pair& c); /*! -Inserts the line segment `s` whose endpoints are the vertices +inserts the line segment `s` whose endpoints are the vertices `va` and `vb` as a constraint. The triangles intersected by `s` are removed and new ones are created. @@ -281,7 +290,7 @@ are removed and new ones are created. void insert_constraint(const Vertex_handle & va, const Vertex_handle & vb); /*! -Inserts a polyline defined by the points in the range `[first,last)`. +inserts a polyline defined by the points in the range `[first,last)`. The polyline is considered as a polygon if the first and last point are equal or if `close = true`. This enables for example passing the vertex range of a `Polygon_2`. \tparam PointIterator must be an `InputIterator` with the value type `Point`. */ @@ -291,23 +300,23 @@ void insert_constraint(PointIterator first, PointIterator last, bool close=false /*! -Removes a vertex `v`. +removes a vertex `v`. \pre Vertex `v` is not incident to a constrained edge. */ void remove(Vertex_handle v); /*! -Make the edges incident to vertex `v` unconstrained edges. +makes the edges incident to vertex `v` unconstrained edges. */ void remove_incident_constraints(Vertex_handle v); /*! -Make edge `(f,i)` unconstrained. +makes edge `(f,i)` unconstrained. */ void remove_constrained_edge(Face_handle f, int i); /*! -Checks the validity of the triangulation and the consistency +checks the validity of the triangulation and the consistency of the constrained marks in edges. */ bool @@ -318,7 +327,7 @@ is_valid(bool verbose = false, int level = 0) const; }; /* end Constrained_triangulation_2 */ /*! -Writes the triangulation as for `Triangulation_2` and, for each face `f`, and integers `i=0,1,2`, +writes the triangulation as for `Triangulation_2` and, for each face `f`, and integers `i=0,1,2`, writes "C" or "N" depending whether edge `(f,i)` is constrained or not. \relates Constrained_triangulation_2 @@ -327,7 +336,7 @@ template std::ostream & operator<<(std::ostream& os, const Constrained_triangulation_2 &ct); /*! -Reads a triangulation from stream `is` and assigns it to c`t`. Data in the stream must have the same format `operator<<` uses. +reads a triangulation from stream `is` and assigns it to c`t`. Data in the stream must have the same format `operator<<` uses. Note that `ct` is first cleared. \relates Constrained_triangulation_2 */ 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 42cb053bf86..1a6f843b53b 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 @@ -76,9 +76,14 @@ The value type of this iterator is `Constraint_id`. */ typedef unspecified_type Constraint_iterator; +/*! +A range type for iterating over all constraints. +*/ +typedef Iterator_range Constraints; + + /*! A subconstraint is a pair of vertices that correspond to an `Edge`. -\todo The documentation does not match the code */ typedef std::pair Subconstraint; @@ -92,6 +97,11 @@ subconstraint. */ typedef unspecified_type Subconstraint_iterator; +/*! +A range type for iterating over all subconstraints. +*/ +typedef Iterator_range Subconstraints; + /*! An iterator on the vertices of the chain of subconstraints representing a @@ -137,6 +147,10 @@ is `Context`. */ typedef unspecified_type Context_iterator; +/*! +range type for iterating over contexts. +*/ +typedef Iterator_range Contexts; /// @} /// \name Creation @@ -193,13 +207,13 @@ void swap(Constrained_triangulation_plus_2 tr); /// @{ /*! -Inserts point `p` as a vertex of the triangulation. +inserts point `p` as a vertex of the triangulation. */ Vertex_handle insert(const Point& p, Face_handle start = Face_handle() ); /*! -Inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. +inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. \sa `Triangulation_2::locate()` */ Vertex_handle insert(const Point& p, @@ -212,7 +226,7 @@ Equivalent to `insert(p)`. Vertex_handle push_back(const Point& p); /*! -Inserts the points in the range `[first,last)`. +inserts the points in the range `[first,last)`. Returns the number of inserted points. \tparam PointIterator must be an `InputIterator` with the value type `Point`. */ @@ -221,19 +235,19 @@ size_type insert(PointIterator first, PointIterator last); /*! -Inserts the constraint segment `ab` in the triangulation. +inserts the constraint segment `ab` in the triangulation. If the two points are equal the point is inserted but no constraint, and the default constructed `Constraint_id` is returned. */ Constraint_id insert_constraint(Point a, Point b); /*! -Inserts the constraint `c`. +inserts the constraint `c`. */ void push_back(const std::pair& c); /*! -Inserts a constraint whose endpoints are the vertices +inserts a constraint whose endpoints are the vertices pointed by `va` and `vb` in the triangulation. If the two vertex handles are equal no constraint is inserted, and the default constructed `Constraint_id` is returned. @@ -241,7 +255,7 @@ and the default constructed `Constraint_id` is returned. Constraint_id insert_constraint(Vertex_handle va, Vertex_handle vb); /*! -Inserts a polyline defined by the points in the range `[first,last)` +inserts a polyline defined by the points in the range `[first,last)` and returns the constraint id. The polyline is considered as a closed curve if the first and last point are equal or if `close == true`. This enables for example passing the vertex range of a `Polygon_2`. When traversing the vertices of a closed polyline constraint with a `Vertices_in_constraint_iterator` the first and last vertex are the same. @@ -280,7 +294,7 @@ std::size_t insert_constraints(PointIterator points_first, PointIterator points_ /*! -Removes the constraint `cid`, without removing the points from the triangulation. +removes the constraint `cid`, without removing the points from the triangulation. */ void remove_constraint(Constraint_id cid); @@ -290,29 +304,39 @@ void remove_constraint(Constraint_id cid); /// @{ /*! -Returns a `Constraint_iterator` that points at the first +returns a `Constraint_iterator` that points at the first constraint of the triangulation. */ Constraint_iterator constraints_begin() const; /*! -Returns the past-the-end iterator of the constraints of the triangulation. +returns the past-the-end iterator of the constraints of the triangulation. */ Constraint_iterator constraints_end() const; +/*! +returns a range of constraints. +*/ +Subconstraints constraints() const; + /*! -Returns a `Subconstraint_iterator` pointing at the first +returns a `Subconstraint_iterator` pointing at the first subconstraint of the triangulation. */ Subconstraint_iterator subconstraints_begin() const; /*! -Returns the past-the-end iterator of the subconstraints of the triangulation. +returns the past-the-end iterator of the subconstraints of the triangulation. */ Subconstraint_iterator subconstraints_end() const; +/*! +returns a range of subconstraints. +*/ +Subconstraints subconstraints() const; + /*! -Returns the number of constraints enclosing the subconstraint +returns the number of constraints enclosing the subconstraint `(va,vb)`. \pre `va` and `vb` refer to the vertices of a constrained edge of the triangulation. */ @@ -320,42 +344,54 @@ int number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const; /*! -Returns the `Context` relative to one of the constraints +returns the `Context` relative to one of the constraints enclosing the subconstraint `(va,vb)`. \pre `va` and `vb` refer to the vertices of a constrained edge of the triangulation. */ Context context(Vertex_handle va, Vertex_handle vb) const; /*! -Returns an iterator pointing at the first `Context` +returns an iterator pointing at the first `Context` of the sequence of contexts corresponding to the constraints enclosing the subconstraint `(va,vb)`. \pre `va` and `vb` refer to the vertices of a constrained edge of the triangulation. */ Context_iterator contexts_begin(Vertex_handle va, -Vertex_handle vb) const; + Vertex_handle vb) const; /*! -Returns an iterator past the end `Context` +returns an iterator past the end `Context` of the sequence of contexts corresponding to the constraints enclosing the subconstraint `(va,vb)`. \pre `va` and `vb` refer to the vertices of a constrained edge of the triangulation. */ Context_iterator contexts_end(Vertex_handle va, -Vertex_handle vb) const; + Vertex_handle vb) const; /*! -Returns an iterator on the first vertex on the constraint `cid`. +returns a range of contexts. +*/ +Contexts contexts(Vertex_handle va, + Vertex_handle vb) const; + +/*! +returns an iterator on the first vertex on the constraint `cid`. */ Vertices_in_constraint_iterator vertices_in_constraint_begin(Constraint_id cid) const; /*! -Returns an iterator past the last vertex on the constraint `cid`. +returns an iterator past the last vertex on the constraint `cid`. */ Vertices_in_constraint_iterator vertices_in_constraint_end(Constraint_id cid) const; +/*! +returns a range of the vertices on the constraint `cid`. +*/ +Vertices_in_constraint +vertices_in_constraint(Constraint_id cid) const; + /// @} diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h index b03d077e11a..fb9aa4ab31e 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h @@ -252,6 +252,8 @@ typedef Tds::difference_type difference_type; /// finite ones. The triangulation class also defines the following /// enum type to specify which case occurs when locating a point in /// the triangulation. +/// +/// In order to write \cpp 11 `for`-loops we provide range types. /*! handle to a vertex. @@ -300,6 +302,50 @@ finite vertices of the triangulation. */ typedef unspecified_type Point_iterator; + +/*! +range type for iterating over all faces (including infinite faces), with a nested +type `iterator` that has as value type `Face_handle` +*/ +typedef Iterator_range All_face_handles; + + +/*! +range type for iterating over all edges (including infinite ones). +*/ +typedef Iterator_range All_edges; + +/*! +range type for iterating over all vertices (including the infinite vertex), with a nested +type `iterator` that has as value type `Vertex_handle` +*/ +typedef Iterator_range All_vertex_handles; + + +/*! +range type for iterating over finite faces, with a nested +type `iterator` that has as value type `Face_handle` +*/ +typedef Iterator_range Finite_face_handles; + + +/*! +range type for iterating over finite edges. +*/ +typedef Iterator_range Finite_edges; + +/*! +range type for iterating over finite vertices, with a nested +type `iterator` that has as value type `Vertex_handle` +*/ +typedef Iterator_range Finite_vertex_handles; + +/*! +range type for iterating over the points of the finite vertices. +*/ +typedef Iterator_range Points; + + /*! circulator over all faces intersected by a line. */ @@ -882,6 +928,30 @@ Past-the-end iterator */ Point_iterator points_end() const; +/*! +returns a range of iterators over finite vertices. +\note While the value type of `Finite_vertices_iterator` is `Vertex`, the value type of + `Finite_vertex_handles::iterator` is `Vertex_handle` +*/ +Finite_vertex_handles finite_vertex_handles() const; + +/*! +returns a range of iterators over finite edges. +*/ +Finite_edges finite_edges() const; + +/*! +returns a range of iterators over finite faces. +\note While the value type of `Finite_faces_iterator` is `Face`, the value type of + `Finite_face_handles::iterator` is `Face_handle` +*/ +Finite_face_handles finite_face_handles() const; + +/*! +returns a range of iterators over the points of finite vertices. +*/ +Points points() const; + /// @} /// \name All Face, Edge and Vertex Iterators @@ -923,6 +993,26 @@ Past-the-end iterator */ All_faces_iterator all_faces_end() const; + +/*! +returns a range of iterators over all vertices. +\note While the value type of `All_vertices_iterator` is `Vertex`, the value type of + `All_vertex_handles::iterator` is `Vertex_handle` +*/ +All_vertex_handles all_vertex_handles() const; + +/*! +returns a range of iterators over all edges. +*/ +All_edges all_edges() const; + +/*! +returns a range of iterators over all faces. +\note While the value type of `All_faces_iterator` is `Face`, the value type of + `All_face_handles::iterator` is `Face_handle` +*/ +All_face_handles all_face_handles() const; + /// @} /*! diff --git a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt index b6c1dfa5eea..6bee3b8a77f 100644 --- a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt +++ b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt @@ -377,6 +377,24 @@ forms a convex quadrilateral (see \cgalFigureRef{Triangulation_2D_fig_flip_bis}) Flip. \cgalFigureEnd +The triangulation defines iterator types such as `Triangulation_3::All_vertices_iterator`. They behave like +a handle, in the sense that there is no need to dereference the iterator to obtain a handle. +Wherever the API expects a handle the iterator can be passed as well. + +In order to write a \cpp 11 `for`-loop the triangulation calls also offers the range type +`Triangulation_2::All_vertex_handles`, which has a nested type `Triangulation_2::All_vertex_handles::iterator`. +The value type of this iterator is `Triangulation_2::Vertex_handle`. +It is similar for the various iterators for vertices and cells. + +For the range `Triangulation_2::All_edges` it holds that `Triangulation_2::All_edges::iterator` `==` +`Triangulation_2::All_edges_iterator`. It is similar for the various iterators for edges and points. + +Note that you only need the iterator type if you wish to combine pre \cpp 11 `for`-loops with the range class. + + +\cgalExample{Triangulation_2/for_loop_2.cpp} + + \subsection Triangulation_2Implementation Implementation Locate is implemented by a stochastic walk \cgalCite{cgal:dpt-wt-02}. @@ -1040,7 +1058,7 @@ The class `Constrained_triangulation_plus_2` additionally provides the means to - traverse all the constraints of the triangulation using an iterator of type `Constraint_iterator` the value type of which is `Constraint_id`, - obtain all constraints that induce a constrained edge or a subconstraint, - traverse the sequence of vertices of a constraint using an iterator of type `Vertices_in_constraint_iterator`, the value type of which is `Vertex_handle` -- traverse the subconstraints in the triangulation using an iterator of type `Subconstraint_iterator`,the value type of which is `Subconstraint`. +- traverse the subconstraints in the triangulation using an iterator of type `Subconstraint_iterator`, the value type of which is `Subconstraint`. Note that the `Constrained_edges_iterator` and the `Subconstraint_iterator` are quite similar. The `Constrained_edges_iterator` traverses all edges and skips those that are \em not constrained, diff --git a/Triangulation_2/doc/Triangulation_2/examples.txt b/Triangulation_2/doc/Triangulation_2/examples.txt index 9bff70297db..45128d71309 100644 --- a/Triangulation_2/doc/Triangulation_2/examples.txt +++ b/Triangulation_2/doc/Triangulation_2/examples.txt @@ -1,4 +1,5 @@ /*! +\example Triangulation_2/for_loop_2.cpp \example Triangulation_2/adding_handles.cpp \example Triangulation_2/colored_face.cpp \example Triangulation_2/constrained.cpp diff --git a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt index 20ef6aa9331..4911f1d9872 100644 --- a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_2_Examples ) -cmake_minimum_required(VERSION 3.1) if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. diff --git a/Triangulation_2/examples/Triangulation_2/colored_face.cpp b/Triangulation_2/examples/Triangulation_2/colored_face.cpp index 84392cd820b..820daa4cfe5 100644 --- a/Triangulation_2/examples/Triangulation_2/colored_face.cpp +++ b/Triangulation_2/examples/Triangulation_2/colored_face.cpp @@ -11,7 +11,6 @@ typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Triangulation_2 Triangulation; typedef Triangulation::Face_handle Face_handle; -typedef Triangulation::Finite_faces_iterator Finite_faces_iterator; typedef Triangulation::Point Point; int main() { @@ -21,8 +20,8 @@ int main() { t.insert(Point(2,0)); t.insert(Point(2,2)); - Finite_faces_iterator fc = t.finite_faces_begin(); - for( ; fc != t.finite_faces_end(); ++fc) fc->info() = CGAL::blue(); + for(Face_handle f : t.finite_face_handles()) + f->info() = CGAL::blue(); Point p(0.5,0.5); Face_handle fh = t.locate(p); diff --git a/Triangulation_2/examples/Triangulation_2/constrained.cpp b/Triangulation_2/examples/Triangulation_2/constrained.cpp index a4cc7925a3f..9901ec05fd3 100644 --- a/Triangulation_2/examples/Triangulation_2/constrained.cpp +++ b/Triangulation_2/examples/Triangulation_2/constrained.cpp @@ -8,8 +8,8 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_tag Itag; typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; -typedef CDT::Point Point; - +typedef CDT::Point Point; +typedef CDT::Edge Edge; int main( ) { @@ -22,10 +22,9 @@ main( ) assert(cdt.is_valid()); int count = 0; - for (CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(); - eit != cdt.finite_edges_end(); - ++eit) - if (cdt.is_constrained(*eit)) ++count; + for (const Edge& e : cdt.finite_edges()) + if (cdt.is_constrained(e)) + ++count; std::cout << "The number of resulting constrained edges is "; std::cout << count << std::endl; return 0; diff --git a/Triangulation_2/examples/Triangulation_2/for_loop_2.cpp b/Triangulation_2/examples/Triangulation_2/for_loop_2.cpp new file mode 100644 index 00000000000..4c884845667 --- /dev/null +++ b/Triangulation_2/examples/Triangulation_2/for_loop_2.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_2 Triangulation; +typedef Triangulation::Vertex_handle Vertex_handle; +typedef Triangulation::Point Point; +typedef Triangulation::Finite_vertex_handles Finite_vertex_handles; + +// The following types are different +// Its value type is Triangulation_2::Vertex +typedef Triangulation::Finite_vertices_iterator Finite_vertices_iterator; +// Its value type is Triangulation_2::Vertex_handle +typedef Finite_vertex_handles::iterator Finite_vertex_handles_iterator; + +int main() +{ + std::vector points = { Point(0,0), Point(1,0), Point(0,1) }; + + Triangulation T; + + T.insert(points.begin(), points.end()); + + std::cout << "Triangulation_2::Finite_vertices_iterator is like a Triangulation_2::Vertex_handle\n"; + for(Finite_vertices_iterator it = T.finite_vertices_begin(); + it != T.finite_vertices_end(); + ++it){ + std::cout << it->point() << std::endl; + } + + std::cout << "Triangulation_2::Finite_vertex_handles::iterator dereferences to Triangulation_2::Vertex_handle\n"; + Finite_vertex_handles::iterator b, e; + std::tie(b,e) = T.finite_vertex_handles(); + for(; b!=e; ++b){ + Vertex_handle vh = *b; // you must dereference the iterator to get a handle + std::cout << vh->point() << std::endl; + } + + std::cout << "and you can use a C++11 for loop\n"; + for(Vertex_handle vh : T.finite_vertex_handles()){ + std::cout << vh->point() << std::endl; + } + + return 0; +} diff --git a/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp b/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp index b420ef58868..7cf822fe1f4 100644 --- a/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp +++ b/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp @@ -8,6 +8,7 @@ typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Delaunay_triangulation_2 Delaunay; typedef Delaunay::Point Point; +typedef Delaunay::Vertex_handle Vertex_handle; int main() { @@ -27,8 +28,8 @@ int main() // check that the info was correctly set. Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if( points[ vit->info() ].first != vit->point() ){ + for (Vertex_handle v : T.finite_vertex_handles()) + if( points[ v->info() ].first != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp b/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp index fd334e50071..27b51dba0db 100644 --- a/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp +++ b/Triangulation_2/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp @@ -13,6 +13,7 @@ typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Regular_triangulation_2 Regular; typedef K::Point_2 Point; typedef K::Weighted_point_2 Wpoint; +typedef Regular::Vertex_handle Vertex_handle; int main() { @@ -30,9 +31,8 @@ int main() CGAL_assertion( rt.number_of_vertices() == 6 ); // check that the info was correctly set. - Regular::Finite_vertices_iterator vit; - for (vit = rt.finite_vertices_begin(); vit != rt.finite_vertices_end(); ++vit) - if( points[ vit->info() ].first != vit->point() ){ + for (Vertex_handle v : rt.finite_vertex_handles()) + if( points[ v->info() ].first != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_2/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp b/Triangulation_2/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp index 54c73013d0b..ebc9a8418e0 100644 --- a/Triangulation_2/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp +++ b/Triangulation_2/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp @@ -9,6 +9,7 @@ typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Delaunay_triangulation_2 Delaunay; typedef Delaunay::Point Point; +typedef Delaunay::Vertex_handle Vertex_handle; //a functor that returns a std::pair. //the unsigned integer is incremented at each call to @@ -40,8 +41,8 @@ int main() // check that the info was correctly set. Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if( points[ vit->info() ] != vit->point() ){ + for (Vertex_handle v : T.finite_vertex_handles()) + if( points[ v->info() ] != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_2/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp b/Triangulation_2/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp index de92cb6478e..884f4d9d23c 100644 --- a/Triangulation_2/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp +++ b/Triangulation_2/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp @@ -9,6 +9,7 @@ typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Delaunay_triangulation_2 Delaunay; typedef Delaunay::Point Point; +typedef Delaunay::Vertex_handle Vertex_handle; int main() { @@ -39,9 +40,9 @@ int main() // check that the info was correctly set. - Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if( points[ vit->info() ] != vit->point() ){ + + for (Vertex_handle v : T.finite_vertex_handles()) + if( points[ v->info() ] != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp b/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp index cb0beece9fe..a876c7a6747 100644 --- a/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp +++ b/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp @@ -24,27 +24,28 @@ typedef CGAL::Exact_predicates_tag Itag; typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typedef CDT::Point Point; typedef CGAL::Polygon_2 Polygon_2; +typedef CDT::Face_handle Face_handle; void mark_domains(CDT& ct, - CDT::Face_handle start, + Face_handle start, int index, std::list& border ) { if(start->info().nesting_level != -1){ return; } - std::list queue; + std::list queue; queue.push_back(start); while(! queue.empty()){ - CDT::Face_handle fh = queue.front(); + Face_handle fh = queue.front(); queue.pop_front(); if(fh->info().nesting_level == -1){ fh->info().nesting_level = index; for(int i = 0; i < 3; i++){ CDT::Edge e(fh,i); - CDT::Face_handle n = fh->neighbor(i); + Face_handle n = fh->neighbor(i); if(n->info().nesting_level == -1){ if(ct.is_constrained(e)) border.push_back(e); else queue.push_back(n); @@ -63,8 +64,8 @@ mark_domains(CDT& ct, void mark_domains(CDT& cdt) { - for(CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){ - it->info().nesting_level = -1; + for(CDT::Face_handle f : cdt.all_face_handles()){ + f->info().nesting_level = -1; } std::list border; @@ -72,7 +73,7 @@ mark_domains(CDT& cdt) while(! border.empty()){ CDT::Edge e = border.front(); border.pop_front(); - CDT::Face_handle n = e.first->neighbor(e.second); + Face_handle n = e.first->neighbor(e.second); if(n->info().nesting_level == -1){ mark_domains(cdt, n, e.first->info().nesting_level+1, border); } @@ -104,10 +105,9 @@ int main( ) mark_domains(cdt); int count=0; - for (CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(); - fit!=cdt.finite_faces_end();++fit) + for (Face_handle f : cdt.finite_face_handles()) { - if ( fit->info().in_domain() ) ++count; + if ( f->info().in_domain() ) ++count; } std::cout << "There are " << count << " facets in the domain." << std::endl; diff --git a/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp b/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp index 46d2d638db9..60ab20dd663 100644 --- a/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp +++ b/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp @@ -18,13 +18,8 @@ typedef CDTP::Vertex_handle Vertex void print(const CDTP& cdtp, Cid cid) { - typedef CDTP::Vertices_in_constraint Vertices_in_constraint; - std::cout << "Polyline constraint:" << std::endl; - for(Vertices_in_constraint it = cdtp.vertices_in_constraint_begin(cid); - it !=cdtp.vertices_in_constraint_end(cid); - it++){ - Vertex_handle vh = *it; + for(Vertex_handle vh : cdtp.vertices_in_constraint(cid)){ std::cout << vh->point() << std::endl; } } @@ -33,20 +28,13 @@ print(const CDTP& cdtp, Cid cid) void contexts(const CDTP& cdtp) { - CDTP::Subconstraint_iterator - beg = cdtp.subconstraints_begin(), - end = cdtp.subconstraints_end(); - - for(; beg!=end; ++beg){ - Vertex_handle vp = beg->first.first, vq = beg->first.second; + for(auto sc : cdtp.subconstraints()){ + Vertex_handle vp = sc.first.first, vq = sc.first.second; if(cdtp.number_of_enclosing_constraints(vp, vq) == 2){ - CDTP::Context_iterator cbeg = cdtp.contexts_begin(vp,vq), - cend = cdtp.contexts_end(vp,vq); std::cout << "subconstraint " << vp->point() << " " << vq->point() << " is on constraints starting at:\n"; - for(; cbeg != cend; ++cbeg){ - CDTP::Context c = *cbeg; + for(const CDTP::Context& c : cdtp.contexts(vp,vq)){ std::cout << (*(c.vertices_begin()))->point() << std::endl; } } diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index e3b80ccc4ee..1b200e8d8d9 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -120,6 +120,7 @@ public: typename Triangulation::All_edges_iterator> Constrained_edges_iterator; + typedef Iterator_range Constrained_edges; #ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 using Triangulation::number_of_vertices; @@ -218,6 +219,11 @@ public: all_edges_end()); } + Constrained_edges constrained_edges() const + { + return Constrained_edges(constrained_edges_begin(),constrained_edges_end()); + } + // INSERTION Vertex_handle insert(const Point& p, Face_handle start = Face_handle() ); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index 72740d52736..76dfccc8ee3 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -179,21 +179,27 @@ public: // for user interface with the constraint hierarchy typedef typename Constraint_hierarchy::Vertex_it Vertices_in_constraint_iterator; + + typedef Iterator_range Vertices_in_constraint; typedef typename Constraint_hierarchy::Point_it Points_in_constraint_iterator; - - typedef typename Constraint_hierarchy::Context Context; - typedef typename Constraint_hierarchy::Context_iterator Context_iterator; + typedef Iterator_range Points_in_constraint; + + 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; - //for backward compatibility - typedef Vertices_in_constraint_iterator Vertices_in_constraint; - using Triangulation::geom_traits; using Triangulation::cw; using Triangulation::ccw; @@ -623,10 +629,7 @@ public: for(Constraint_iterator cit = constraints_begin(); cit != constraints_end(); ++cit){ os << (*cit).second->all_size(); - for(Vertices_in_constraint it = vertices_in_constraint_begin(*cit); - it != vertices_in_constraint_end(*cit); - it++){ - Vertex_handle vh = *it; + for(Vertex_handle vh : vertices_in_constraint(*cit)){ os << " " << V[vh]; } os << std::endl; @@ -767,8 +770,19 @@ public: // 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, @@ -780,11 +794,26 @@ public: 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_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 ; + 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());} diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index 49dcde0219e..2a401eb7e57 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -175,6 +175,8 @@ public: operator Vertex_handle() const { return Base::base(); } }; + typedef Iterator_range > All_vertex_handles; + class Finite_vertices_iterator : public Filter_iterator { @@ -190,6 +192,8 @@ public: operator Vertex_handle() const { return Base::base(); } }; + typedef Iterator_range > Finite_vertex_handles; + class Hidden_vertices_iterator : public Filter_iterator { @@ -205,6 +209,8 @@ public: operator Vertex_handle() const { return Base::base(); } }; + typedef Iterator_range > Hidden_vertex_handles; + //for backward compatibility typedef Finite_faces_iterator Face_iterator; typedef Finite_edges_iterator Edge_iterator; @@ -341,14 +347,18 @@ public: All_vertices_iterator all_vertices_begin() const; All_vertices_iterator all_vertices_end() const; - + All_vertex_handles all_vertex_handles() const; + Finite_vertices_iterator finite_vertices_begin() const; Finite_vertices_iterator finite_vertices_end() const; + Finite_vertex_handles finite_vertex_handles() const; + Vertex_handle finite_vertex() const; Hidden_vertices_iterator hidden_vertices_begin() const; Hidden_vertices_iterator hidden_vertices_end() const; - + Hidden_vertex_handles hidden_vertex_handles() const; + // Vertex_handle file_input(std::istream& is); // void file_output(std::ostream& os) const; @@ -2191,7 +2201,15 @@ all_vertices_end() const return CGAL::filter_iterator(Base::all_vertices_end(), Hidden_tester()); } - + +template < class Gt, class Tds > +typename Regular_triangulation_2::All_vertex_handles +Regular_triangulation_2:: +all_vertex_handles() const +{ + return make_prevent_deref_range(all_vertices_begin(),all_vertices_end()); +} + template < class Gt, class Tds > typename Regular_triangulation_2::Finite_vertices_iterator Regular_triangulation_2:: @@ -2202,6 +2220,7 @@ finite_vertices_begin() const Base::finite_vertices_begin()); } + template < class Gt, class Tds > typename Regular_triangulation_2::Vertex_handle Regular_triangulation_2:: @@ -2221,6 +2240,14 @@ finite_vertices_end() const Hidden_tester()); } +template < class Gt, class Tds > +typename Regular_triangulation_2::Finite_vertex_handles +Regular_triangulation_2:: +finite_vertex_handles() const +{ + return make_prevent_deref_range(finite_vertices_begin(),finite_vertices_end()); +} + template < class Gt, class Tds > typename Regular_triangulation_2::Hidden_vertices_iterator Regular_triangulation_2:: @@ -2239,7 +2266,15 @@ hidden_vertices_end() const return CGAL::filter_iterator(Base::finite_vertices_end(), Unhidden_tester()); } - + +template < class Gt, class Tds > +typename Regular_triangulation_2::Hidden_vertex_handles +Regular_triangulation_2:: +hidden_vertex_handles() const +{ + return make_prevent_deref_range(hidden_vertices_begin(),hidden_vertices_end()); +} + template < class Gt, class Tds > typename Regular_triangulation_2::Vertex_handle Regular_triangulation_2:: diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index fc751ab2e52..c8822421986 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -212,6 +212,20 @@ public: typedef Project_point Proj_point; typedef boost::transform_iterator Point_iterator; + + + // Range types + + + typedef typename Tds::Face_handles All_face_handles; + typedef typename Tds::Vertex_handles All_vertex_handles; + typedef typename Tds::Edges All_edges; + + typedef Iterator_range > Finite_face_handles; + typedef Iterator_range > Finite_vertex_handles; + typedef Iterator_range Finite_edges; + typedef Iterator_range Points; + typedef Point value_type; // to have a back_inserter typedef const value_type& const_reference; typedef value_type& reference; @@ -451,19 +465,32 @@ public: //TRAVERSING : ITERATORS AND CIRCULATORS Finite_faces_iterator finite_faces_begin() const; Finite_faces_iterator finite_faces_end() const; + Finite_face_handles finite_face_handles() const; + Finite_vertices_iterator finite_vertices_begin() const; Finite_vertices_iterator finite_vertices_end() const; + Finite_vertex_handles finite_vertex_handles() const; + Finite_edges_iterator finite_edges_begin() const; Finite_edges_iterator finite_edges_end() const; + Finite_edges finite_edges() const; + Point_iterator points_begin() const; Point_iterator points_end() const; + Points points() const; All_faces_iterator all_faces_begin() const; All_faces_iterator all_faces_end() const; + All_face_handles all_face_handles() const; + All_vertices_iterator all_vertices_begin() const; All_vertices_iterator all_vertices_end() const; + All_vertex_handles all_vertex_handles() const; + All_edges_iterator all_edges_begin() const; All_edges_iterator all_edges_end() const; + All_edges all_edges() const; + All_halfedges_iterator all_halfedges_begin() const; All_halfedges_iterator all_halfedges_end() const; @@ -3159,6 +3186,14 @@ finite_faces_end() const Infinite_tester(this) ); } +template +typename Triangulation_2::Finite_face_handles +Triangulation_2:: +finite_face_handles() const +{ + return make_prevent_deref_range(finite_faces_begin(),finite_faces_end()); +} + template typename Triangulation_2::Finite_vertices_iterator Triangulation_2:: @@ -3180,6 +3215,14 @@ finite_vertices_end() const Infinite_tester(this)); } +template +typename Triangulation_2::Finite_vertex_handles +Triangulation_2:: +finite_vertex_handles() const +{ + return make_prevent_deref_range(finite_vertices_begin(),finite_vertices_end()); +} + template typename Triangulation_2::Finite_edges_iterator Triangulation_2:: @@ -3201,6 +3244,15 @@ finite_edges_end() const infinite_tester() ); } + +template +typename Triangulation_2::Finite_edges +Triangulation_2:: +finite_edges() const +{ + return Finite_edges(finite_edges_begin(), finite_edges_end()); +} + template typename Triangulation_2::Point_iterator Triangulation_2:: @@ -3217,6 +3269,14 @@ points_end() const return Point_iterator(finite_vertices_end()); } +template +typename Triangulation_2::Points +Triangulation_2:: +points() const +{ + return Points(points_begin(), points_end()); +} + template typename Triangulation_2::All_faces_iterator Triangulation_2:: @@ -3224,13 +3284,20 @@ all_faces_begin() const { return _tds.faces_begin(); } - template typename Triangulation_2::All_faces_iterator Triangulation_2:: all_faces_end() const { - return _tds.faces_end();; + return _tds.faces_end(); +} + +template +typename Triangulation_2::All_face_handles +Triangulation_2:: +all_face_handles() const +{ + return _tds.face_handles(); } template @@ -3248,6 +3315,14 @@ all_vertices_end() const { return _tds.vertices_end(); } + +template +typename Triangulation_2::All_vertex_handles +Triangulation_2:: +all_vertex_handles() const +{ + return _tds.vertex_handles(); +} template typename Triangulation_2::All_edges_iterator @@ -3265,6 +3340,14 @@ all_edges_end() const return _tds.edges_end(); } +template +typename Triangulation_2::All_edges +Triangulation_2:: +all_edges() const +{ + return _tds.edges(); +} + template typename Triangulation_2::All_halfedges_iterator Triangulation_2:: 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 d2c65cff37f..8d7cf7e38d3 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 @@ -170,9 +170,9 @@ public: : enclosing(hc.enclosing), pos(hc.pos) {} - Vertex_it vertices_begin() { return enclosing->skip_begin();} - Vertex_it current() {return pos;} - Vertex_it vertices_end() {return enclosing->skip_end();} + Vertex_it vertices_begin()const { return enclosing->skip_begin();} + Vertex_it current()const {return pos;} + Vertex_it vertices_end()const {return enclosing->skip_end();} Constraint_id id() { return enclosing; } std::size_t number_of_vertices() const {return enclosing->skip_size(); } }; diff --git a/Triangulation_2/test/Triangulation_2/CMakeLists.txt b/Triangulation_2/test/Triangulation_2/CMakeLists.txt index 1441e226126..6599888b5aa 100644 --- a/Triangulation_2/test/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/test/Triangulation_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) 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 72b84a1916b..bc93551235c 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 @@ -5,17 +5,17 @@ void _test_cls_const_triang_plus_2( const TrP & ) { //typedef TriangPlus TrP; - typedef typename TrP::Geom_traits Gt; - typedef typename Gt::Point_2 Point; + typedef typename TrP::Geom_traits Gt; + typedef typename Gt::Point_2 Point; - typedef typename TrP::Vertex_handle Vertex_handle; - typedef typename TrP::Constraint Constraint; - typedef typename TrP::Constraint_iterator Constraint_iterator; - typedef typename TrP::Constraint_hierarchy Hierarchy; - typedef typename TrP::Context Context; - typedef typename TrP::Context_iterator Context_iterator; - typedef typename TrP::Vertices_in_constraint Vertices_in_constraint; - typedef typename TrP::Constraint_id Constraint_id; + typedef typename TrP::Vertex_handle Vertex_handle; + typedef typename TrP::Constraint Constraint; + typedef typename TrP::Constraint_iterator Constraint_iterator; + typedef typename TrP::Constraint_hierarchy Hierarchy; + typedef typename TrP::Context Context; + typedef typename TrP::Context_iterator Context_iterator; + typedef typename TrP::Vertices_in_constraint_iterator Vertices_in_constraint_iterator; + typedef typename TrP::Constraint_id Constraint_id; CGAL_USE_TYPE(Hierarchy); CGAL_USE_TYPE(Context); @@ -47,7 +47,7 @@ _test_cls_const_triang_plus_2( const TrP & ) // test access to the hierarchy std::cout << " test acces to the constraint hierarchy" << std::endl; - Vertices_in_constraint vit = trp.vertices_in_constraint_begin(cid); + Vertices_in_constraint_iterator vit = trp.vertices_in_constraint_begin(cid); assert (*vit == vh[10] || *vit == vh[11] ); Vertex_handle va = *++vit; Vertex_handle vb = *++vit; @@ -58,12 +58,12 @@ _test_cls_const_triang_plus_2( const TrP & ) Context_iterator cit2 = cit1++; //trp.print_hierarchy(); assert( cit1->number_of_vertices() == 4 || cit1->number_of_vertices() == 7); - Vertices_in_constraint firstin1 = cit1->vertices_begin(); - Vertices_in_constraint lastin1 = --(cit1->vertices_end()); - Vertices_in_constraint currentin1 = cit1->current(); - Vertices_in_constraint firstin2 = cit2->vertices_begin(); - Vertices_in_constraint lastin2 = --(cit2->vertices_end()); - Vertices_in_constraint currentin2 = cit2->current(); + Vertices_in_constraint_iterator firstin1 = cit1->vertices_begin(); + Vertices_in_constraint_iterator lastin1 = --(cit1->vertices_end()); + Vertices_in_constraint_iterator currentin1 = cit1->current(); + Vertices_in_constraint_iterator firstin2 = cit2->vertices_begin(); + Vertices_in_constraint_iterator lastin2 = --(cit2->vertices_end()); + Vertices_in_constraint_iterator currentin2 = cit2->current(); if ( cit1->number_of_vertices() == 4) { assert( (*firstin1 == vh[10] && *lastin1 == vh[11]) || (*firstin1 == vh[11] && *lastin1 == vh[10])); diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_iterators.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_iterators.h index 265f6139bf3..e5a1201b5c8 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_iterators.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_iterators.h @@ -80,6 +80,8 @@ _test_cls_face_iterator( const Triangulation &T ) typedef typename Triangulation::Face_handle Face_handle; typedef typename Triangulation::size_type size_type; + typedef typename Triangulation::Finite_face_handles Finite_face_handles; + Face f; Face_handle fh; Vertex_handle vh; @@ -104,6 +106,9 @@ _test_cls_face_iterator( const Triangulation &T ) n--; assert(n==0); + Finite_face_handles range = T.finite_face_handles(); + fh = *(range.first); + return n_finite; } @@ -119,6 +124,8 @@ _test_cls_vertex_iterator( const Triangulation &T ) typedef typename Triangulation::Face_handle Face_handle; typedef typename Triangulation::size_type size_type; + typedef typename Triangulation::Finite_vertex_handles Finite_vertex_handles; + Vertex v; Face_handle fh; Vertex_handle vh; @@ -143,6 +150,8 @@ _test_cls_vertex_iterator( const Triangulation &T ) n--; assert( n == 0 ); + Finite_vertex_handles range = T.finite_vertex_handles(); + vh = *(range.first); return nv; } @@ -153,7 +162,7 @@ _test_cls_point_iterator( Triangulation &T ) typedef typename Triangulation::Point_iterator Point_iterator; typedef typename Triangulation::Point Point; typedef typename Triangulation::size_type size_type; - + typedef typename Triangulation::Points Points; size_type np = 0; Point_iterator pit; Point p; @@ -172,6 +181,10 @@ _test_cls_point_iterator( Triangulation &T ) n--; assert( n == 0 ); + Points range = T.points(); + if(! range.empty()){ + p = *(range.first); + } return np; } @@ -185,6 +198,9 @@ _test_cls_edge_iterator( const Triangulation &T ) typedef typename Triangulation::Face_handle Face_handle; typedef typename Triangulation::size_type size_type; + typedef typename Triangulation::Finite_edges Finite_edges; + typedef typename Triangulation::All_edges All_edges; + Edge e; Face_handle fh; @@ -205,6 +221,15 @@ _test_cls_edge_iterator( const Triangulation &T ) n--; assert( n == 0 ); + Finite_edges range = T.finite_edges(); + if(! range.empty()){ + e = *(range.first); + } + + All_edges aerange = T.all_edges(); + if(! aerange.empty()){ + e = *(aerange.first); + } return ne; } diff --git a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt index e3d3fe6d5ba..aca144a19b3 100644 --- a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt @@ -1,9 +1,9 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project (Triangulation_3_Demo) -cmake_minimum_required(VERSION 3.1) 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/Triangulation_3/demo/Triangulation_3_Geomview_demos/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3_Geomview_demos/CMakeLists.txt index 20e8bf1d3b2..2e06bf1dc9c 100644 --- a/Triangulation_3/demo/Triangulation_3_Geomview_demos/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3_Geomview_demos/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_3_Geomview_demos_Demo ) -cmake_minimum_required(VERSION 3.1) 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/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h index 23fefcdf2ec..6de07317bde 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h @@ -115,6 +115,10 @@ typedef Triangulation_data_structure::Facet Facet; */ typedef Triangulation_data_structure::Edge Edge; +/*! +Concurrency tag (from the TDS). +*/ +typedef Triangulation_data_structure::Concurrency_tag Concurrency_tag; /// @} @@ -216,12 +220,66 @@ circulator over all facets incident to a given edge */ typedef Triangulation_data_structure::Facet_circulator Facet_circulator; -/*! -Concurrency tag (from the TDS). -*/ -typedef Triangulation_data_structure::Concurrency_tag Concurrency_tag; +/// @} -/// @} +/*! \name + +In order to write \cpp 11 `for`-loops we provide the following range types. + +*/ +/// @{ + +/*! +range type for iterating over all cell handles (including infinite cells), with a nested type `iterator` +that has as value type `Cell_handle`. +*/ + typedef Iterator_range All_cell_handles; + + +/*! +range type for iterating over facets. +*/ + typedef Iterator_range All_facets; + +/*! +range type for iterating over edges. +*/ + typedef Iterator_range All_edges; + +/*! +range type for iterating over all vertex handles, with a nested type `iterator` +that has as value type `Vertex_handle`. +*/ + typedef Iterator_range All_vertex_handles; + + /*! +range type for iterating over finite cell handles, with a nested type `iterator` +that has as value type `Cell_handle`. +*/ + typedef Iterator_range Finite_cell_handles; + + +/*! +range type for iterating over finite facets. +*/ + typedef Iterator_range Finite_facets; + +/*! +range type for iterating over finite edges. +*/ + typedef Iterator_range Finite_edges; + +/*! +range type for iterating over finite vertex handles, with a nested type `iterator` +that has as value type `Vertex_handle`. +*/ + typedef Iterator_range Finite_vertex_handles; + +/*! + range type for iterating over the points of the finite vertices. + */ + typedef Iterator_range Points; +/// @} /// \name Creation /// @{ @@ -1046,8 +1104,7 @@ The following iterators allow the user to visit cells, facets, edges and vertice /*! Starts at an arbitrary finite vertex. Then `++` and `--` will -iterate over finite vertices. Returns `finite_vertices_end()` when -`t.number_of_vertices() == 0`. +iterate over finite vertices. */ Finite_vertices_iterator finite_vertices_begin() const; @@ -1058,8 +1115,7 @@ Finite_vertices_iterator finite_vertices_end() const; /*! Starts at an arbitrary finite edge. Then `++` and `--` will -iterate over finite edges. Returns `finite_edges_end()` when -`t.dimension() < 1`. +iterate over finite edges. */ Finite_edges_iterator finite_edges_begin() const; @@ -1093,9 +1149,7 @@ Past-the-end iterator Finite_cells_iterator finite_cells_end() const; /*! -Starts at an arbitrary vertex. Iterates over all vertices (even the infinite -one). Returns `vertices_end()` when -`t.number_of_vertices() == 0`. +Starts at an arbitrary vertex. Iterates over all vertices (even the infinite one). */ All_vertices_iterator all_vertices_begin() const; @@ -1151,6 +1205,82 @@ Point_iterator points_end() const; /// @} +/*! \name Ranges + +In order to write \cpp 11 `for`-loops we provide a range type and member functions to generate ranges. +Note that vertex and cell ranges are special. See Section \ref Triangulation3secRanges in the User Manual. + +*/ + +/// @{ + +/*! + returns a range of iterators over all cells (even the infinite cells). + Returns an empty range when `t.number_of_cells() == 0`. + \note While the value type of `All_cells_iterator` is `Cell`, the value type of + `All_cell_handles::iterator` is `Cell_handle`. +*/ +All_cell_handles all_cell_handles() const; + + + +/*! + returns a range of iterators starting at an arbitrary facet. + Returns an empty range when `t.dimension() < 2`. +*/ +All_facets all_facets() const; + +/*! + returns a range of iterators starting at an arbitrary edge. + Returns an empty range when `t.dimension() < 2`. +*/ +All_edges all_edges() const; + +/*! + returns a range of iterators over all vertices (even the infinite one). + \note While the value type of `All_vertices_iterator` is `Vertex`, the value type of + `All_vertex_handles::iterator` is `Vertex_handle`. +*/ +All_vertex_handles all_vertex_handles() const; + + +/*! + returns a range of iterators over finite cells. + Returns an empty range when `t.number_of_cells() == 0`. + \note While the value type of `Finite_cells_iterator` is `Cell`, the value type of + `Finite_cell_handles::iterator` is `Cell_handle`. +*/ +Finite_cell_handles finite_cell_handles() const; + + + +/*! + returns a range of iterators starting at an arbitrary facet. + Returns an empty range when `t.dimension() < 2`. +*/ +Finite_facets finite_facets() const; + +/*! + returns a range of iterators starting at an arbitrary edge. + Returns an empty range when `t.dimension() < 2`. +*/ +Finite_edges finite_edges() const; + +/*! + returns a range of iterators over finite vertices. + \note While the value type of `Finite_vertices_iterator` is `Vertex`, the value type of + `Finite_vertex_handles::iterator` is `Vertex_handle`. +*/ +Finite_vertex_handles finite_vertex_handles() const; + +/*! + returns a range of iterators over the points of finite vertices. +*/ +Points points() const; + + +/// @} + /*!\name Cell and Facet Circulators The following circulators respectively visit all cells or all facets incident to a given edge. They are non-mutable and bidirectional. They are invalidated by any modification of one of the cells traversed. */ diff --git a/Triangulation_3/doc/Triangulation_3/Triangulation_3.txt b/Triangulation_3/doc/Triangulation_3/Triangulation_3.txt index 51a12ffb135..4284b30705b 100644 --- a/Triangulation_3/doc/Triangulation_3/Triangulation_3.txt +++ b/Triangulation_3/doc/Triangulation_3/Triangulation_3.txt @@ -486,6 +486,25 @@ in the range. Note that this is correct because the iterator is dereferenced only once per point during the insertion. \cgalExample{Triangulation_3/info_insert_with_transform_iterator.cpp} +\subsection Triangulation3secRanges Iterators and Ranges + +The triangulation defines iterator types such as `Triangulation_3::All_vertices_iterator`. They behave like +a `Triangulation_3::Vertex_handle`, in the sense that there is no need to dereference the iterator to obtain a handle. +Wherever the API expects a handle the iterator can be passed as well. + +In order to write a \cpp 11 `for`-loop the triangulation calls also offers the range type +`Triangulation_3::All_vertex_handles`, which has a nested type `Triangulation_3::All_vertex_handles::iterator`. +The value type of this iterator is `Triangulation_3::Vertex_handle`. +It is similar for the various iterators for vertices and cells. + +For the range `Triangulation_3::All_facets` it holds that `Triangulation_3::All_facets::iterator` `==` +`Triangulation_3::All_facets_iterator`. It is similar for the iterators for facets, edges and points. + + +Note that you only need the iterator type if you combine the pre \cpp 11 `for`-loop with the range class. + +\cgalExample{Triangulation_3/for_loop.cpp} + \subsection Triangulation3secsimplex The Simplex Class The triangulation defines a `Triangulation_3::Simplex` class that represents a diff --git a/Triangulation_3/doc/Triangulation_3/examples.txt b/Triangulation_3/doc/Triangulation_3/examples.txt index 1a34261199c..0d9881f767d 100644 --- a/Triangulation_3/doc/Triangulation_3/examples.txt +++ b/Triangulation_3/doc/Triangulation_3/examples.txt @@ -1,5 +1,6 @@ /*! \example Triangulation_3/simple_triangulation_3.cpp +\example Triangulation_3/for_loop.cpp \example Triangulation_3/color.cpp \example Triangulation_3/adding_handles_3.cpp \example Triangulation_3/info_insert_with_pair_iterator.cpp diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index 121d27795ca..2fad2159687 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -1,6 +1,6 @@ +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_3_Examples ) -cmake_minimum_required(VERSION 3.1) if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. @@ -18,6 +18,7 @@ if(CGAL_Qt5_FOUND) endif() if ( CGAL_FOUND ) + create_single_source_cgal_program( "for_loop.cpp" ) create_single_source_cgal_program( "adding_handles_3.cpp" ) create_single_source_cgal_program( "color.cpp" ) create_single_source_cgal_program( "copy_triangulation_3.cpp" ) diff --git a/Triangulation_3/examples/Triangulation_3/color.cpp b/Triangulation_3/examples/Triangulation_3/color.cpp index 1dbd7bdeb75..c61bf335689 100644 --- a/Triangulation_3/examples/Triangulation_3/color.cpp +++ b/Triangulation_3/examples/Triangulation_3/color.cpp @@ -28,9 +28,9 @@ int main() // Set the color of finite vertices of degree 6 to red. Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if (T.degree(vit) == 6) - vit->info() = CGAL::red(); + for (Delaunay::Vertex_handle v : T.finite_vertex_handles()) + if (T.degree(v) == 6) + v->info() = CGAL::red(); return 0; } diff --git a/Triangulation_3/examples/Triangulation_3/for_loop.cpp b/Triangulation_3/examples/Triangulation_3/for_loop.cpp new file mode 100644 index 00000000000..94b3ab992f1 --- /dev/null +++ b/Triangulation_3/examples/Triangulation_3/for_loop.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_3 Triangulation; +typedef Triangulation::Vertex_handle Vertex_handle; +typedef Triangulation::Point Point; +typedef Triangulation::Finite_vertex_handles Finite_vertex_handles; + +// The following types are different +// Its value type is Triangulation_3::Vertex +typedef Triangulation::Finite_vertices_iterator Finite_vertices_iterator; +// Its value type is Triangulation_3::Vertex_handle +typedef Finite_vertex_handles::iterator Finite_vertex_handles_iterator; + +int main() +{ + std::vector points = { Point(0,0,0), Point(1,0,0), Point(0,1,0), Point(0,1,1) }; + + Triangulation T(points.begin(), points.end()); + + std::cout << "Triangulation_3::Finite_vertices_iterator is like a Triangulation_3::Vertex_handle\n"; + for(Finite_vertices_iterator it = T.finite_vertices_begin(); + it != T.finite_vertices_end(); + ++it){ + std::cout << it->point() << std::endl; + } + + std::cout << "Triangulation_3::Finite_vertex_handles::iterator dereferences to Triangulation_3::Vertex_handle\n"; + Finite_vertex_handles::iterator b, e; + std::tie(b,e) = T.finite_vertex_handles(); + for(; b!=e; ++b){ + Vertex_handle vh = *b; // you must dereference the iterator to get a handle + std::cout << vh->point() << std::endl; + } + + std::cout << "and you can use a C++11 for loop\n"; + for(Vertex_handle vh : T.finite_vertex_handles()){ + std::cout << vh->point() << std::endl; + } + + return 0; +} diff --git a/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator.cpp b/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator.cpp index f132ea91ccd..c99e7c24f78 100644 --- a/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator.cpp +++ b/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator.cpp @@ -29,9 +29,8 @@ int main() CGAL_assertion( T.number_of_vertices() == 6 ); // check that the info was correctly set. - Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if( points[ vit->info() ].first != vit->point() ){ + for (Delaunay::Vertex_handle v : T.finite_vertex_handles()) + if( points[ v->info() ].first != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp b/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp index 09e223579ae..dd2d15dda99 100644 --- a/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp +++ b/Triangulation_3/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp @@ -29,9 +29,8 @@ int main() CGAL_assertion( rt.number_of_vertices() == 6 ); // check that the info was correctly set. - Regular::Finite_vertices_iterator vit; - for (vit = rt.finite_vertices_begin(); vit != rt.finite_vertices_end(); ++vit) - if( points[ vit->info() ].first != vit->point() ){ + for (Regular::Vertex_handle v : rt.finite_vertex_handles()) + if( points[ v->info() ].first != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_3/examples/Triangulation_3/info_insert_with_transform_iterator.cpp b/Triangulation_3/examples/Triangulation_3/info_insert_with_transform_iterator.cpp index 88fc59bcbb7..00bee0da44b 100644 --- a/Triangulation_3/examples/Triangulation_3/info_insert_with_transform_iterator.cpp +++ b/Triangulation_3/examples/Triangulation_3/info_insert_with_transform_iterator.cpp @@ -41,9 +41,8 @@ int main() CGAL_assertion( T.number_of_vertices() == 6 ); // check that the info was correctly set. - Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if( points[ vit->info() ] != vit->point() ){ + for (Delaunay::Vertex_handle v : T.finite_vertex_handles()) + if( points[ v->info() ] != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_3/examples/Triangulation_3/info_insert_with_zip_iterator.cpp b/Triangulation_3/examples/Triangulation_3/info_insert_with_zip_iterator.cpp index 6282291f91a..bf3a5988f30 100644 --- a/Triangulation_3/examples/Triangulation_3/info_insert_with_zip_iterator.cpp +++ b/Triangulation_3/examples/Triangulation_3/info_insert_with_zip_iterator.cpp @@ -40,9 +40,8 @@ int main() CGAL_assertion( T.number_of_vertices() == 6 ); // check that the info was correctly set. - Delaunay::Finite_vertices_iterator vit; - for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) - if( points[ vit->info() ] != vit->point() ){ + for (Delaunay::Vertex_handle v : T.finite_vertex_handles() ) + if( points[ v->info() ] != v->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 02796b07b26..dcb3e2012a3 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -436,6 +436,11 @@ public: typedef Edge_iterator All_edges_iterator; typedef Vertex_iterator All_vertices_iterator; + typedef typename Tds::Cell_handles All_cell_handles; + typedef typename Tds::Vertex_handles All_vertex_handles; + typedef typename Tds::Facets All_facets; + typedef typename Tds::Edges All_edges; + typedef typename Tds::Simplex Simplex; private: @@ -515,9 +520,15 @@ public: operator Vertex_handle() const { return Base::base(); } }; + typedef Iterator_range > Finite_cell_handles; + typedef Iterator_range > Finite_vertex_handles; + typedef Filter_iterator Finite_edges_iterator; typedef Filter_iterator Finite_facets_iterator; + typedef Iterator_range Finite_edges; + typedef Iterator_range Finite_facets; + private: // Auxiliary iterators for convenience // do not use default template argument to please VC++ @@ -531,6 +542,9 @@ public: std::ptrdiff_t, std::bidirectional_iterator_tag> Point_iterator; + + typedef Iterator_range Points; + // To have a back_inserter typedef Point value_type; typedef const value_type& const_reference; @@ -1746,12 +1760,24 @@ public: return CGAL::filter_iterator(cells_end(), Infinite_tester(this)); } + + Finite_cell_handles finite_cell_handles() const + { + return make_prevent_deref_range(finite_cells_begin(), finite_cells_end()); + } + + Cell_iterator cells_begin() const { return _tds.cells_begin(); } Cell_iterator cells_end() const { return _tds.cells_end(); } All_cells_iterator all_cells_begin() const { return _tds.cells_begin(); } All_cells_iterator all_cells_end() const { return _tds.cells_end(); } + All_cell_handles all_cell_handles() const + { + return _tds.cell_handles(); + } + Finite_vertices_iterator finite_vertices_begin() const { if(number_of_vertices() <= 0) @@ -1765,12 +1791,22 @@ public: return CGAL::filter_iterator(vertices_end(), Infinite_tester(this)); } + Finite_vertex_handles finite_vertex_handles() const + { + return make_prevent_deref_range(finite_vertices_begin(), finite_vertices_end()); + } + Vertex_iterator vertices_begin() const { return _tds.vertices_begin(); } Vertex_iterator vertices_end() const { return _tds.vertices_end(); } All_vertices_iterator all_vertices_begin() const { return _tds.vertices_begin(); } All_vertices_iterator all_vertices_end() const { return _tds.vertices_end(); } + All_vertex_handles all_vertex_handles() const + { + return _tds.vertex_handles(); + } + Finite_edges_iterator finite_edges_begin() const { if(dimension() < 1) @@ -1783,12 +1819,23 @@ public: return CGAL::filter_iterator(edges_end(), Infinite_tester(this)); } + Finite_edges finite_edges() const + { + return Finite_edges(finite_edges_begin(),finite_edges_end()); + } + Edge_iterator edges_begin() const { return _tds.edges_begin(); } Edge_iterator edges_end() const { return _tds.edges_end(); } + All_edges_iterator all_edges_begin() const { return _tds.edges_begin(); } All_edges_iterator all_edges_end() const { return _tds.edges_end(); } + All_edges all_edges() const + { + return _tds.edges(); + } + Finite_facets_iterator finite_facets_begin() const { if(dimension() < 2) @@ -1801,19 +1848,37 @@ public: return CGAL::filter_iterator(facets_end(), Infinite_tester(this)); } + Finite_facets finite_facets() const + { + return Finite_facets(finite_facets_begin(),finite_facets_end()); + } + Facet_iterator facets_begin() const { return _tds.facets_begin(); } Facet_iterator facets_end() const { return _tds.facets_end(); } + All_facets_iterator all_facets_begin() const { return _tds.facets_begin(); } All_facets_iterator all_facets_end() const { return _tds.facets_end(); } - Point_iterator points_begin() const { + All_facets all_facets() const + { + return _tds.facets(); + } + + Point_iterator points_begin() const + { return Point_iterator(finite_vertices_begin()); } - Point_iterator points_end() const { + Point_iterator points_end() const + { return Point_iterator(finite_vertices_end()); } + Points points() const + { + return Points(points_begin(),points_end()); + } + // cells around an edge Cell_circulator incident_cells(const Edge& e) const { diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index 53e46c63ba4..0fdbcfc1d4e 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Triangulation_3_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_iterator.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_iterator.h index 85d8cf29b6c..d252dfff8ec 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_iterator.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_iterator.h @@ -96,6 +96,18 @@ _test_triangulation_iterator( const Triangulation &T ) typedef typename Triangulation::Edge_iterator Edge_iterator; typedef typename Triangulation::Vertex_iterator Vertex_iterator; + typedef typename Triangulation::Vertex_handle Vertex_handle; + + typedef typename Triangulation::All_vertex_handles All_vertex_handles; + typedef typename Triangulation::All_cell_handles All_cell_handles; + typedef typename Triangulation::All_edges All_edges; + typedef typename Triangulation::All_facets All_facets; + typedef typename Triangulation::Finite_vertex_handles Finite_vertex_handles; + typedef typename Triangulation::Finite_cell_handles Finite_cell_handles; + typedef typename Triangulation::Finite_edges Finite_edges; + typedef typename Triangulation::Finite_facets Finite_facets; + typedef typename Triangulation::Points Points; + typedef typename Triangulation::Cell Cell; typedef typename Triangulation::Facet Facet; typedef typename Triangulation::Edge Edge; @@ -116,6 +128,62 @@ _test_triangulation_iterator( const Triangulation &T ) (void) ch; } if (T.dimension()==3) { + { + All_vertex_handles range = T.all_vertex_handles(); + Vertex_handle vh = *(range.first); + assert(vh == T.all_vertices_begin()); + vh = *(range.second); + assert(vh == T.all_vertices_end()); + } + { + All_cell_handles range = T.all_cell_handles(); + Cell_handle vh = *(range.first); + assert(vh == T.all_cells_begin()); + vh = *(range.second); + assert(vh == T.all_cells_end()); + } + { + All_edges range = T.all_edges(); + assert(range.first == T.all_edges_begin()); + assert(range.second == T.all_edges_end()); + } + { + All_facets range = T.all_facets(); + assert(range.first == T.all_facets_begin()); + assert(range.second == T.all_facets_end()); + } + { + Finite_vertex_handles range = T.finite_vertex_handles(); + Vertex_handle vh = *(range.first); + assert(vh == Vertex_handle(T.finite_vertices_begin())); + vh = *(range.second); + + assert(vh == Vertex_handle(T.finite_vertices_end())); + } + { + Finite_cell_handles range = T.finite_cell_handles(); + Cell_handle ch = *(range.first); + assert(ch == Cell_handle(T.finite_cells_begin())); + ch = *(range.second); + assert(ch == Cell_handle(T.finite_cells_end())); + } + { + Finite_edges range = T.finite_edges(); + assert(range.first == T.finite_edges_begin()); + assert(range.second == T.finite_edges_end()); + } + { + Finite_facets range = T.finite_facets(); + assert(range.first == T.finite_facets_begin()); + assert(range.second == T.finite_facets_end()); + } + { + Points range = T.points(); + assert(range.first == T.points_begin()); + assert(range.second == T.points_end()); + } + + for (FCit = T.finite_cells_begin(); FCit != T.finite_cells_end(); ++FCit) { Cell_handle ch = FCit; // Test the conversion. diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h index 66b9b86e787..d533bcfe945 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h @@ -116,7 +116,6 @@ _test_cls_triangulation_3(const Triangulation &) typedef typename Cls::Finite_edges_iterator Finite_edges_iterator; typedef typename Cls::Finite_facets_iterator Finite_facets_iterator; typedef typename Cls::Finite_cells_iterator Finite_cells_iterator; - CGAL_USE_TYPE(Vertex); CGAL_USE_TYPE(Cell); CGAL_USE_TYPE(difference_type); diff --git a/Union_find/test/Union_find/CMakeLists.txt b/Union_find/test/Union_find/CMakeLists.txt index 3894840ebee..fc2ae2c9189 100644 --- a/Union_find/test/Union_find/CMakeLists.txt +++ b/Union_find/test/Union_find/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Union_find_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Visibility_2/examples/Visibility_2/CMakeLists.txt b/Visibility_2/examples/Visibility_2/CMakeLists.txt index 68efc6b823d..0510897b193 100644 --- a/Visibility_2/examples/Visibility_2/CMakeLists.txt +++ b/Visibility_2/examples/Visibility_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Visibility_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Visibility_2/test/Visibility_2/CMakeLists.txt b/Visibility_2/test/Visibility_2/CMakeLists.txt index 211276c3e2a..eafdc9bced7 100644 --- a/Visibility_2/test/Visibility_2/CMakeLists.txt +++ b/Visibility_2/test/Visibility_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Visibility_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt index 92893d16599..2741d391aec 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Voronoi_diagram_2_Examples ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET) diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt index 6f57717084a..e0fc05a700f 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt @@ -2,9 +2,9 @@ # This is the CMake script for compiling a CGAL application. +cmake_minimum_required(VERSION 3.1...3.15) project( Voronoi_diagram_2_Tests ) -cmake_minimum_required(VERSION 3.1) find_package(CGAL QUIET)