diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..369aadbb15f --- /dev/null +++ b/.clang-format @@ -0,0 +1,35 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +AccessModifierOffset: -2 +AllowShortFunctionsOnASingleLine: true +BinPackParameters: false +BreakConstructorInitializers: BeforeComma +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: MultiLine + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +ColumnLimit: 120 +# Force pointers to the type for C++. +DerivePointerAlignment: false +PointerAlignment: Left +# Control the spaces around conditionals +SpacesInConditionalStatement: false +SpaceBeforeParens: false +... diff --git a/.devcontainer/doxygen-cgal/Dockerfile b/.devcontainer/doxygen-cgal/Dockerfile new file mode 100644 index 00000000000..81cb1f954ce --- /dev/null +++ b/.devcontainer/doxygen-cgal/Dockerfile @@ -0,0 +1,55 @@ +# Use an official Fedora as a parent image for the build stage +FROM fedora:latest AS sources_deps + +# Set environment variables to non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Install dependencies +RUN dnf update -y && dnf install -y \ + wget \ + make \ + gcc \ + gcc-c++ \ + patch \ + cmake \ + bison \ + flex \ + unzip \ + python3 \ + && dnf clean all + +# Copy the patch file to the build context +COPY cgal-NO_ADDITIONAL_DETAILS.patch . + +FROM sources_deps AS build + +# Build and install Doxygen from sources +ARG DOXYGEN_VERSION=1.9.6 +ARG MAKEFLAGS=-j$(nproc) +RUN if [ -n "$DEBUG"];then set -x && make --version && ls -lZ /tmp && id; fi \ + && DOXYGEN_VERSION_UNDERSCORE=$(echo ${DOXYGEN_VERSION} | sed 's/\./_/g') \ + && wget https://github.com/doxygen/doxygen/archive/refs/tags/Release_${DOXYGEN_VERSION_UNDERSCORE}.zip \ + && unzip Release_${DOXYGEN_VERSION_UNDERSCORE}.zip \ + && cd doxygen-Release_${DOXYGEN_VERSION_UNDERSCORE} \ + && patch -p1 < ../cgal-NO_ADDITIONAL_DETAILS.patch \ + && mkdir build \ + && cd build \ + && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. \ + && cmake --build . \ + && cmake --install . \ + && mkdir -p /usr/local/share/doc/doxygen && cp ../LICENSE /usr/local/share/doc/doxygen/LICENSE.TXT \ + && cd ../.. \ + && rm -rf doxygen-Release_${DOXYGEN_VERSION_UNDERSCORE} Release_${DOXYGEN_VERSION_UNDERSCORE}.zip + +# Use a smaller base image for the final stage +FROM fedora:latest + +# Install necessary runtime dependencies +RUN set -x \ + && dnf update -y && dnf install -y graphviz 'perl(Getopt::Std)' tex-bibtex cmake python3-lxml python3-pyquery \ + && dnf clean all + +# Copy Doxygen from the build stage +COPY --from=build /usr/local/bin/doxygen /usr/local/bin +COPY --from=build /usr/local/share/doc/doxygen/LICENSE.TXT /usr/local/share/doc/doxygen/LICENSE.TXT +RUN doxygen --version diff --git a/.devcontainer/doxygen-cgal/Makefile b/.devcontainer/doxygen-cgal/Makefile new file mode 100644 index 00000000000..9413173b5a7 --- /dev/null +++ b/.devcontainer/doxygen-cgal/Makefile @@ -0,0 +1,23 @@ +SHELL := /bin/bash +DOXYGEN_VERSIONS := 1.12.0 1.11.0 1.10.0 1.9.8 1.9.7 1.9.6 + +.PHONY: all build-% push-% build push + +all: build + @echo "Use `$(MAKE) push` to push the images to the registry." + +build-%: + @echo "MAKEFLAGS: $(MAKEFLAGS)" + @echo "Building Doxygen version $*..." + if [ "$$(getenforce || true)" == "Enforcing" ]; then Z=:z; else Z=; fi; \ + F="$(MAKEFLAGS)"; F=$${F##*fifo:}; F=$${F%% *}; \ + if [ -p "$$F" ]; then echo "The GNU make FIFO file exists:"; ls -l $$F; VOLUME_ARGS="-v $$F:$$F$$Z"; echo -- $$VOLUME_ARGS; fi; \ + podman build --build-arg DOXYGEN_VERSION=$* --build-arg "MAKEFLAGS=$(MAKEFLAGS)" $$VOLUME_ARGS -t cgal/doxygen:$* . + +push-%: build-% + @echo "Pushing cgal/doxygen:$*..." + podman push cgal/doxygen:$* + +build: $(foreach version,$(DOXYGEN_VERSIONS),build-$(version)) + +push: $(foreach version,$(DOXYGEN_VERSIONS),push-$(version)) diff --git a/.devcontainer/doxygen-cgal/cgal-NO_ADDITIONAL_DETAILS.patch b/.devcontainer/doxygen-cgal/cgal-NO_ADDITIONAL_DETAILS.patch new file mode 100644 index 00000000000..bb6e63b274d --- /dev/null +++ b/.devcontainer/doxygen-cgal/cgal-NO_ADDITIONAL_DETAILS.patch @@ -0,0 +1,44 @@ +diff --git a/src/config.xml b/src/config.xml +index 13910958a6..31f1354e44 100644 +--- a/src/config.xml ++++ b/src/config.xml +@@ -893,6 +893,18 @@ Go to the next section or return to the + \note This will also disable the warnings about undocumented members + that are normally produced when \ref cfg_warnings "WARNINGS" is + set to \c YES. ++]]> ++ ++ ++ ++ ++ +diff --git a/src/memberdef.cpp b/src/memberdef.cpp +index 08d9bf24c5..ab04e994c5 100644 +--- a/src/memberdef.cpp ++++ b/src/memberdef.cpp +@@ -2501,6 +2501,7 @@ bool MemberDefImpl::hasDetailedDescription() const + if (!m_hasDetailedDescriptionCached) + { + bool extractAll = Config_getBool(EXTRACT_ALL); ++ bool xAllNoDetailedSec = Config_getBool(NO_ADDITIONAL_DETAILS); + bool alwaysDetailedSec = Config_getBool(ALWAYS_DETAILED_SEC); + bool repeatBrief = Config_getBool(REPEAT_BRIEF); + bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC); +@@ -2512,7 +2513,7 @@ bool MemberDefImpl::hasDetailedDescription() const + // the member has detailed documentation because the user added some comments + bool docFilter = + // extract all is enabled +- extractAll || ++ (extractAll && !xAllNoDetailedSec) || + // has detailed docs + !documentation().isEmpty() || + // has inbody docs diff --git a/.devcontainer/doxygen-cgal/devcontainer.json b/.devcontainer/doxygen-cgal/devcontainer.json new file mode 100644 index 00000000000..f1c9f05badb --- /dev/null +++ b/.devcontainer/doxygen-cgal/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "CGAL Doxygen Dev Container, version 1.12.0, with CGAL patch", + "image": "docker.io/cgal/doxygen:1.12.0", + "features": { + "ghcr.io/devcontainers/features/git:1.3.2": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cmake-tools", + "bbenoist.Doxygen", + "ms-vscode.cpptools" + ] + } + }, +} \ No newline at end of file diff --git a/.devcontainer/doxygen-cgal/distrobox.ini b/.devcontainer/doxygen-cgal/distrobox.ini new file mode 100644 index 00000000000..55c7c546481 --- /dev/null +++ b/.devcontainer/doxygen-cgal/distrobox.ini @@ -0,0 +1,29 @@ +[distrobox-doxygen-1.12.0] +image=cgal/doxygen:1.12.0 +exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3" +exported_bins_path=$HOME/.local/bin-doxygen-1.12.0 + +[distrobox-doxygen-1.11.0] +image=cgal/doxygen:1.11.0 +exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3" +exported_bins_path=$HOME/.local/bin-doxygen-1.11.0 + +[distrobox-doxygen-1.10.0] +image=cgal/doxygen:1.10.0 +exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3" +exported_bins_path=$HOME/.local/bin-doxygen-1.10.0 + +[distrobox-doxygen-1.9.8] +image=cgal/doxygen:1.9.8 +exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3" +exported_bins_path=$HOME/.local/bin-doxygen-1.9.8 + +[distrobox-doxygen-1.9.7] +image=cgal/doxygen:1.9.7 +exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3" +exported_bins_path=$HOME/.local/bin-doxygen-1.9.7 + +[distrobox-doxygen-1.9.6] +image=cgal/doxygen:1.9.6 +exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3" +exported_bins_path=$HOME/.local/bin-doxygen-1.9.6 diff --git a/.gitattributes b/.gitattributes index 4211b302eb1..0c2e3c3b778 100644 --- a/.gitattributes +++ b/.gitattributes @@ -44,11 +44,9 @@ Documentation/Doxyfile text eol=lf Documentation/pkglist_filter text eol=lf Installation/update_CHANGES text eol=lf Scripts/developer_scripts/autotest_cgal text eol=lf -Scripts/developer_scripts/autotest_cgal_with_cmake text eol=lf Scripts/developer_scripts/cgal_build text eol=lf Scripts/developer_scripts/cgal_depend text eol=lf Scripts/developer_scripts/cgal_git_update_hooks_for_client text eol=lf -Scripts/developer_scripts/cgal_test_with_cmake text eol=lf Scripts/developer_scripts/cgal2gml text eol=lf Scripts/developer_scripts/check_library_uses_no_gpl_files text eol=lf Scripts/developer_scripts/check_licenses text eol=lf @@ -56,7 +54,6 @@ Scripts/developer_scripts/check_macro_names text eol=lf Scripts/developer_scripts/check_no_CGAL_USE_without_includes_before text eol=lf Scripts/developer_scripts/check_svn_keywords text eol=lf Scripts/developer_scripts/create_cgal_test text eol=lf -Scripts/developer_scripts/create_cgal_test_with_cmake text eol=lf Scripts/developer_scripts/create_internal_release text eol=lf Scripts/developer_scripts/create_new_release text eol=lf Scripts/developer_scripts/detect_files_with_mixed_eol_styles text eol=lf diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 78d96aa94db..d93b3226731 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -7,9 +7,8 @@ permissions: jobs: build: - + if: github.repository == 'CGAL/cgal' || github.event_name != 'push' runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - name: install dependencies @@ -17,7 +16,7 @@ jobs: .github/install.sh set -x sudo apt-get update && sudo apt-get install -y graphviz ssh bibtex2html - sudo pip install lxml + sudo pip install lxml sudo pip install 'pyquery==1.4.1' # it seems to be the last py2 compatible version wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_8_13_patched/doxygen sudo mv doxygen_exe /usr/bin/doxygen diff --git a/.github/workflows/cmake-all.yml b/.github/workflows/cmake-all.yml index 94c7dd8851e..f20755248c4 100644 --- a/.github/workflows/cmake-all.yml +++ b/.github/workflows/cmake-all.yml @@ -7,9 +7,8 @@ permissions: jobs: cmake-testsuite: - + if: github.repository == 'CGAL/cgal' || github.event_name != 'push' runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - name: install dependencies @@ -21,9 +20,8 @@ jobs: ctest -L Installation -j $(getconf _NPROCESSORS_ONLN) cmake-testsuite-with-qt: - + if: github.repository == 'CGAL/cgal' || github.event_name != 'push' runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - name: install dependencies diff --git a/.gitignore b/.gitignore index 1b5a5b462c6..58cd6649792 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ AABB_tree/demo/AABB_tree/Makefile AABB_tree/examples/AABB_tree/*.kdev* AABB_tree/examples/AABB_tree/*_example AABB_tree/examples/AABB_tree/Makefile -AABB_tree/examples/AABB_tree/cgal_test_with_cmake AABB_tree/test/AABB_tree/*.kdev* AABB_tree/test/AABB_tree/Makefile AABB_tree/test/AABB_tree/aabb_correctness_triangle_test @@ -19,17 +18,14 @@ AABB_tree/test/AABB_tree/aabb_distance_triangle_test AABB_tree/test/AABB_tree/aabb_intersection_triangle_test AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_segment_test AABB_tree/test/AABB_tree/aabb_projection_triangle_test -AABB_tree/test/AABB_tree/cgal_test_with_cmake Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits Algebraic_foundations/test/Algebraic_foundations/Coercion_traits Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits -Algebraic_foundations/test/Algebraic_foundations/cgal_test_with_cmake Algebraic_foundations/test/Algebraic_foundations/extended_euclidean_algorithm Algebraic_foundations/test/Algebraic_foundations/ipower -Algebraic_kernel_d/test/Algebraic_kernel_d/cgal_test_with_cmake Algebraic_kernel_d/test/Algebraic_kernel_d/rs_isolator Alpha_shapes_2/demo/Alpha_shapes_2/Makefile Alpha_shapes_2/demo/Alpha_shapes_2/alpha_shapes_2 @@ -38,7 +34,6 @@ Alpha_shapes_2/examples/Alpha_shapes_2/alpha_shapes_2 Alpha_shapes_3/demo/Alpha_shapes_3/Makefile Alpha_shapes_3/demo/Alpha_shapes_3/alpha_shapes_3 Alpha_shapes_3/demo/Alpha_shapes_3/weighted_alpha_shapes_3 -Alpha_shapes_3/test/Alpha_shapes_3/cgal_test_with_cmake Alpha_shapes_3/test/Alpha_shapes_3/test_alpha_shape_3 Alpha_shapes_3/test/Alpha_shapes_3/test_fixed_alpha_shape_3 Alpha_shapes_3/test/Alpha_shapes_3/test_weighted_alpha_shape_3 @@ -61,7 +56,6 @@ Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_locatio Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_primal_adapter Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition -Arrangement_on_surface_2/examples/Arrangement_on_surface_2/cgal_test_with_cmake Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circles Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_line_arcs @@ -104,30 +98,24 @@ Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unbounded_rational_fu Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.cpp BGL/examples/BGL_arrangement_2/Makefile -BGL/examples/BGL_arrangement_2/cgal_test_with_cmake BGL/examples/BGL_arrangement_2/dual BGL/examples/BGL_arrangement_2/primal -BGL/test/BGL/cgal_test_with_cmake Boolean_set_operations_2/demo/Boolean_set_operations_2/Makefile Boolean_set_operations_2/demo/Boolean_set_operations_2/boolean_operations_2 Box_intersection_d/test/Box_intersection_d/automated_test Box_intersection_d/test/Box_intersection_d/benchmark.data Box_intersection_d/test/Box_intersection_d/benchmark_box_intersection Box_intersection_d/test/Box_intersection_d/box_grid -Box_intersection_d/test/Box_intersection_d/cgal_test_with_cmake Box_intersection_d/test/Box_intersection_d/random_set_test CGAL_ImageIO/demo/CGALimageIO/Makefile -CGAL_ImageIO/demo/CGALimageIO/cgal_test_with_cmake CGAL_ImageIO/demo/CGALimageIO/image_to_vtk_viewer CGAL_ImageIO/examples/CGALimageIO/Makefile -CGAL_ImageIO/examples/CGALimageIO/cgal_test_with_cmake CGAL_ImageIO/examples/CGALimageIO/convert_raw_image_to_inr CGAL_ImageIO/examples/CGALimageIO/makefile CGAL_ImageIO/examples/CGALimageIO/test_imageio CGAL_ImageIO/src/CGAL_ImageIO/Makefile Circular_kernel_3/demo/Circular_kernel_3/Circular_kernel_3_demo Circular_kernel_3/demo/Circular_kernel_3/Makefile -Circular_kernel_3/test/Circular_kernel_3/cgal_test_with_cmake Circular_kernel_3/test/Circular_kernel_3/test_Exact_spherical_kernel Circular_kernel_3/test/Circular_kernel_3/test_Lazy_Spherical_kernel Circular_kernel_3/test/Circular_kernel_3/test_Lazy_spherical_kernel_basics @@ -138,7 +126,6 @@ Documentation/log/*.* Documentation/output Documentation/tags/*.* Generator/examples/Generator/ball_d -Generator/examples/Generator/cgal_test_with_cmake Generator/examples/Generator/cube_d Generator/examples/Generator/grid_d Generator/examples/Generator/random_convex_set @@ -150,7 +137,6 @@ Generator/examples/Generator/random_segments1 Generator/examples/Generator/random_segments2 Generator/examples/Generator/sphere_d Generator/test/Generator/bug -Generator/test/Generator/cgal_test_with_cmake Generator/test/Generator/random_poly_test Generator/test/Generator/rcs_test Generator/test/Generator/test_combination_enumerator @@ -179,7 +165,6 @@ GraphicsView/demo/Triangulation_2/Makefile GraphicsView/demo/Triangulation_2/Regular_triangulation_2 GraphicsView/demo/Triangulation_2/qrc_*.cxx GraphicsView/demo/Triangulation_2/ui_*.h -HalfedgeDS/test/HalfedgeDS/cgal_test_with_cmake HalfedgeDS/test/HalfedgeDS/test_hds HalfedgeDS/test/HalfedgeDS/test_hds_decorator Inscribed_areas/test/Inscribed_areas/Makefile @@ -189,11 +174,8 @@ Installation/auxiliary/gdb/python/CGAL/printers.pyc Installation/auxiliary/gdb/test Installation/cmake/modules/*.tmp Installation/test/Installation/cgal_test -/Installation/test/Installation/cgal_test_with_cmake Installation/test/Installation/deprecation_warning -Interpolation/demo/Interpolation/cgal_test_with_cmake Intersections_3/test/Intersections_3/bbox_other_do_intersect_test -Intersections_3/test/Intersections_3/cgal_test_with_cmake Intersections_3/test/Intersections_3/circle_other Intersections_3/test/Intersections_3/line_line Intersections_3/test/Intersections_3/segment_segment @@ -207,7 +189,6 @@ Jet_fitting_3/examples/Jet_fitting_3/Single_estimation Jet_fitting_3/examples/Jet_fitting_3/VC Jet_fitting_3/test/Jet_fitting_3/Makefile Jet_fitting_3/test/Jet_fitting_3/blind_1pt -/Jet_fitting_3/examples/Jet_fitting_3/cgal_test_with_cmake /Jet_fitting_3/examples/Jet_fitting_3/data_ellipe0.003.off.4ogl.txt Kernel_23/test/Kernel_23/Cartesian Kernel_23/test/Kernel_23/Dimension @@ -221,7 +202,6 @@ Kernel_23/test/Kernel_23/Simple_cartesian Kernel_23/test/Kernel_23/Simple_homogeneous Kernel_23/test/Kernel_23/Test_IO.out /Kernel_23/test/Kernel_23/Test-*IO.out -Kernel_23/test/Kernel_23/cgal_test_with_cmake Kernel_23/test/Kernel_23/test_kernel__ Kinetic_data_structures/demo/Kinetic_data_structures/Delaunay_triangulation_2 Kinetic_data_structures/demo/Kinetic_data_structures/Delaunay_triangulation_stable_subset_2 @@ -230,13 +210,11 @@ Kinetic_data_structures/demo/Kinetic_data_structures/KDS_Delaunay_triangulation_ Kinetic_data_structures/demo/Kinetic_data_structures/KDS_generate_data Kinetic_data_structures/demo/Kinetic_data_structures/KDS_gui_2 Kinetic_data_structures/demo/Kinetic_data_structures/Makefile -Kinetic_data_structures/demo/Kinetic_data_structures/cgal_test_with_cmake Kinetic_data_structures/demo/Kinetic_data_structures/generate_data Kinetic_data_structures/demo/Kinetic_data_structures/gui_2 Kinetic_data_structures/test/Kinetic_data_structures/Delaunay_triangulation_2 Kinetic_data_structures/test/Kinetic_data_structures/Delaunay_triangulation_3 Kinetic_data_structures/test/Kinetic_data_structures/active_objects_tables -Kinetic_data_structures/test/Kinetic_data_structures/cgal_test_with_cmake Kinetic_data_structures/test/Kinetic_data_structures/exact_kds Kinetic_data_structures/test/Kinetic_data_structures/instantaneous_kernel Kinetic_data_structures/test/Kinetic_data_structures/numbers @@ -249,8 +227,6 @@ Kinetic_data_structures/test/Kinetic_data_structures/test_KDS_Delaunay_triangula Kinetic_data_structures/test/Kinetic_data_structures/timings Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3.qrc.depends Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo -Linear_cell_complex/demo/Linear_cell_complex/cgal_test_with_cmake -Linear_cell_complex/examples/Linear_cell_complex/cgal_test_with_cmake Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3 Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_triangulation Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices @@ -298,7 +274,6 @@ Mesh_2/demo/Mesh_2/*.core Mesh_2/demo/Mesh_2/*.moc Mesh_2/demo/Mesh_2/.*.deps Mesh_2/demo/Mesh_2/Makefile -Mesh_2/demo/Mesh_2/cgal_test_with_cmake Mesh_2/demo/Mesh_2/conform Mesh_2/demo/Mesh_2/depends Mesh_2/demo/Mesh_2/filename.edg @@ -310,7 +285,6 @@ Mesh_2/demo/Mesh_2/semantic.cache Mesh_2/doxygen Mesh_2/examples/Mesh_2/*.core Mesh_2/examples/Mesh_2/.*.deps -Mesh_2/examples/Mesh_2/cgal_test_with_cmake Mesh_2/examples/Mesh_2/conform Mesh_2/examples/Mesh_2/conforming Mesh_2/examples/Mesh_2/depends @@ -325,7 +299,6 @@ Mesh_2/test/Mesh_2/*.core Mesh_2/test/Mesh_2/.*.deps Mesh_2/test/Mesh_2/Makefile Mesh_2/test/Mesh_2/bench_double_map -Mesh_2/test/Mesh_2/cgal_test_with_cmake Mesh_2/test/Mesh_2/conform_plus Mesh_2/test/Mesh_2/depends Mesh_2/test/Mesh_2/my_makefile @@ -374,7 +347,6 @@ Mesh_3/examples/Mesh_3/.*.deps Mesh_3/examples/Mesh_3/random-image.inr Mesh_3/examples/Mesh_3/Makefile Mesh_3/examples/Mesh_3/applications -Mesh_3/examples/Mesh_3/cgal_test_with_cmake Mesh_3/examples/Mesh_3/cgal_to_medit Mesh_3/examples/Mesh_3/chair-after.mesh Mesh_3/examples/Mesh_3/chair-after.png @@ -412,7 +384,6 @@ Mesh_3/examples/Mesh_3/test_off /Mesh_3/test/Mesh_3/a.lua /Mesh_3/test/Mesh_3/applications /Mesh_3/test/Mesh_3/*.cgal -/Mesh_3/test/Mesh_3/cgal_test_with_cmake /Mesh_3/test/Mesh_3/cgal_to_medit /Mesh_3/test/Mesh_3/combined_spheres /Mesh_3/test/Mesh_3/combined_spheres-with-sphere-oracle @@ -514,11 +485,9 @@ Min_ellipse_2/.tmp Min_ellipse_2/Makefile Min_ellipse_2/bin Min_ellipse_2/doc_ps -Minkowski_sum_3/test/Minkowski_sum_3/cgal_test_with_cmake Nef_2/test/Nef_2/EPoint-test Nef_2/test/Nef_2/Nef_polyhedron_2-test Nef_2/test/Nef_2/Polynomial-test -Nef_2/test/Nef_2/cgal_test_with_cmake Nef_2/test/Nef_2/nef_2_point_location Nef_3/demo/Nef_3/Makefile Nef_3/examples/Nef_3/Makefile @@ -576,7 +545,6 @@ Number_types/test/Number_types/_test_valid_finite_double Number_types/test/Number_types/_test_valid_finite_float Number_types/test/Number_types/bench_interval Number_types/test/Number_types/cgal_test -Number_types/test/Number_types/cgal_test_with_cmake Number_types/test/Number_types/constant Number_types/test/Number_types/double Number_types/test/Number_types/doubletst @@ -627,7 +595,6 @@ Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/moc_*.cpp Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/ui_*.h Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qch Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/Test_tds_IO_3 -Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/cgal_test_with_cmake Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_alpha_shape_3 Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3 Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_hierarchy_3 @@ -638,7 +605,6 @@ Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_trian Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_H_3 Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SC_3 Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SH_3 -Point_set_2/test/Point_set_2/cgal_test_with_cmake Point_set_2/test/Point_set_2/nearest_nb1 Point_set_2/test/Point_set_2/nearest_nb_fcn Point_set_2/test/Point_set_2/range_search_fcn @@ -684,7 +650,6 @@ Point_set_processing_3/test/Point_set_processing_3/smoothing_test /Polygon_mesh_processing/test/Polygon_mesh_processing/elephant-oriented.off /Polygon_mesh_processing/test/Polygon_mesh_processing/elephant-shuffled.off /Polygon_mesh_processing/test/Polygon_mesh_processing/blobby_2cc_no_id.off -/Polygon_mesh_processing/test/Polygon_mesh_processing/cgal_test_with_cmake /Polygon_mesh_processing/test/Polygon_mesh_processing/data/U.polylines.txt.off /Polygon_mesh_processing/test/Polygon_mesh_processing/data/hole1.txt.off /Polygon_mesh_processing/test/Polygon_mesh_processing/data/hole2.txt.off @@ -708,7 +673,6 @@ Polyhedron/demo/Polyhedron/snapshot.* Polyhedron/demo/Polyhedron/ui_*.h Polyhedron/test/Polyhedron/*.kdev* Polyhedron/test/Polyhedron/Makefile -Polyhedron/test/Polyhedron/cgal_test_with_cmake Polyhedron/test/Polyhedron/test_polyhedron Polynomial/test/Polynomial/Exponent_vector Polynomial/test/Polynomial/Interpolator @@ -716,7 +680,6 @@ Polynomial/test/Polynomial/Polynomial_traits_d Polynomial/test/Polynomial/Polynomial_type_generator Polynomial/test/Polynomial/Polynomial_using_core Polynomial/test/Polynomial/Polynomial_using_leda -Polynomial/test/Polynomial/cgal_test_with_cmake Polynomial/test/Polynomial/modular_gcd_utcf_algorithm_M Polynomial/test/Polynomial/modular_gcd_utcf_dfai Polynomial/test/Polynomial/modular_gcd_utcf_pure_wang @@ -746,10 +709,8 @@ Polytope_distance_d/.obj Polytope_distance_d/.tmp Polytope_distance_d/Makefile Polytope_distance_d/bin -Polytope_distance_d/test/Polytope_distance_d/cgal_test_with_cmake Polytope_distance_d/test/Polytope_distance_d/test_Polytope_distance_d_d Principal_component_analysis/test/Principal_component_analysis/bounding_box -Principal_component_analysis/test/Principal_component_analysis/cgal_test_with_cmake Principal_component_analysis/test/Principal_component_analysis/linear_least_squares_fitting_circles_2 Principal_component_analysis/test/Principal_component_analysis/linear_least_squares_fitting_cuboids_3 Principal_component_analysis/test/Principal_component_analysis/linear_least_squares_fitting_points_2 @@ -774,7 +735,6 @@ Principal_component_analysis/test/Principal_component_analysis/test_linear_least Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_tetrahedra_3 Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_triangles_2 Principal_component_analysis/test/Principal_component_analysis/test_linear_least_squares_fitting_triangles_3 -/Profiling_tools/test/Profiling_tools/cgal_test_with_cmake /Profiling_tools/test/Profiling_tools/test_memory_sizer /Profiling_tools/test/Profiling_tools/test_timer QP_solver/documentation/Degeneracies.aux @@ -806,7 +766,6 @@ Ridges_3/examples/Ridges_3/Compute_Ridges_Umbilics Ridges_3/examples/Ridges_3/Makefile Ridges_3/test/Ridges_3/Makefile Ridges_3/test/Ridges_3/ridge_test -STL_Extension/test/STL_Extension/cgal_test_with_cmake STL_Extension/test/STL_Extension/test_Cache STL_Extension/test/STL_Extension/test_Compact_container STL_Extension/test/STL_Extension/test_Concatenate_iterator @@ -828,7 +787,6 @@ STL_Extension/test/STL_Extension/test_nth_element STL_Extension/test/STL_Extension/test_stl_extension STL_Extension/test/STL_Extension/test_type_traits STL_Extension/test/STL_Extension/test_vector -SearchStructures/test/RangeSegmentTrees/cgal_test_with_cmake SearchStructures/test/RangeSegmentTrees/test_segment_tree_set_2 Skin_surface_3/.cdtproject Skin_surface_3/.project @@ -839,7 +797,6 @@ Skin_surface_3/test/Skin_surface_3/err.txt Skin_surface_3/test/Skin_surface_3/makefile Skin_surface_3/test/Skin_surface_3/msgs.txt Skin_surface_3/test/Skin_surface_3/subdivision_test -Spatial_sorting/test/Spatial_sorting/cgal_test_with_cmake Stream_lines_2/demo/Stream_lines_2/Makefile Stream_lines_2/demo/Stream_lines_2/streamlines Surface_mesh_parameterization/examples/Surface_mesh_parameterization/*.eps @@ -967,20 +924,15 @@ Triangulation/test/Triangulation/output-pcds* Triangulation/test/Triangulation/pc Triangulation/test/Triangulation/pcds Triangulation/test/Triangulation/torture -/Triangulation/examples/Triangulation/cgal_test_with_cmake -/Triangulation/test/Triangulation/cgal_test_with_cmake /Triangulation/test/Triangulation/output-tds-* -Triangulation_2/cgal_test_with_cmake Triangulation_2/demo/Triangulation_2/Makefile Triangulation_2/demo/Triangulation_2/constrained Triangulation_2/demo/Triangulation_2/constrained_delaunay_triangulation_2 Triangulation_2/demo/Triangulation_2/delaunay_triangulation_2 Triangulation_2/demo/Triangulation_2/regular_triangulation_2 -Triangulation_2/examples/Triangulation_2/cgal_test_with_cmake Triangulation_2/examples/Triangulation_2/regular Triangulation_2/test/Triangulation_2/Makefile Triangulation_2/test/Triangulation_2/T??.triangulation -Triangulation_2/test/Triangulation_2/cgal_test_with_cmake Triangulation_2/test/Triangulation_2/file_tds* Triangulation_2/test/Triangulation_2/makefile Triangulation_2/test/Triangulation_2/test_cdt_degenerate_case @@ -998,10 +950,8 @@ Triangulation_2/test/Triangulation_2/test_triangulation_2_bis Triangulation_2/test/Triangulation_2/test_triangulation_geom_traits Triangulation_2/test/Triangulation_2/test_triangulation_tds Triangulation_2/test/Triangulation_2/vrml_tds* -Triangulation_3/benchmark/Triangulation_3/cgal_test_with_cmake Triangulation_3/benchmark/Triangulation_3/simple Triangulation_3/examples/Triangulation_3/adding_handles_3 -Triangulation_3/examples/Triangulation_3/cgal_test_with_cmake Triangulation_3/examples/Triangulation_3/color Triangulation_3/examples/Triangulation_3/fast_location_3 Triangulation_3/examples/Triangulation_3/find_conflicts_3 @@ -1027,7 +977,6 @@ Triangulation_3/test/Triangulation_3/Test8_triangulation_IO_3_binary Triangulation_3/test/Triangulation_3/Test??_triangulation_IO_3 Triangulation_3/test/Triangulation_3/Test?_triangulation_IO_3 Triangulation_3/test/Triangulation_3/Test_tds_IO_3 -Triangulation_3/test/Triangulation_3/cgal_test_with_cmake Triangulation_3/test/Triangulation_3/makefile Triangulation_3/test/Triangulation_3/test_delaunay_3 Triangulation_3/test/Triangulation_3/test_delaunay_hierarchy_3 @@ -1084,7 +1033,6 @@ ProgramOutput* ErrorOutput* CompilerOutput* error.txt -cgal_test_with_cmake.log # File created by the Semantic Bovinator (an Emacs package) semantic.cache @@ -1141,9 +1089,7 @@ Doxyfile gmon.* # Unsorted file names: -/Point_set_processing_3/test/Point_set_processing_3/cgal_test_with_cmake /Point_set_processing_3/test/Point_set_processing_3/read_test -/Nef_S2/test/Nef_S2/cgal_test_with_cmake /Arrangement_on_surface_2/test/Arrangement_on_surface_2/construction_test_suite_generator /Arrangement_on_surface_2/test/Arrangement_on_surface_2/ex_kernel_point /Arrangement_on_surface_2/test/Arrangement_on_surface_2/ex_kernel_segment @@ -1191,15 +1137,11 @@ gmon.* /Principal_component_analysis/examples/Principal_component_analysis/barycenter /Principal_component_analysis/examples/Principal_component_analysis/bounding_box /Principal_component_analysis/examples/Principal_component_analysis/centroid -/Principal_component_analysis/examples/Principal_component_analysis/cgal_test_with_cmake /Principal_component_analysis/examples/Principal_component_analysis/linear_least_squares_fitting_points_2 /Principal_component_analysis/examples/Principal_component_analysis/linear_least_squares_fitting_triangles_3 -/Polygon/examples/Polygon/cgal_test_with_cmake -/Polygon/test/Polygon/cgal_test_with_cmake /Polygon/test/Polygon/polytest.ascii /Polygon/test/Polygon/polytest.binary /Polygon/test/Polygon/polytest.pretty -/Stream_support/test/Stream_support/cgal_test_with_cmake /*.html /Snap_rounding_2/test/Snap_rounding_2/data/out Polygonal_surface_reconstruction/examples/build* diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 00000000000..70106c515ce --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,7 @@ +{ + "default": true, + "line-length": false, + "no-duplicate-heading": { + "siblings_only": true + } +} diff --git a/AABB_tree/benchmark/AABB_tree/CMakeLists.txt b/AABB_tree/benchmark/AABB_tree/CMakeLists.txt index 63ac01c5851..bfcbb5454fa 100644 --- a/AABB_tree/benchmark/AABB_tree/CMakeLists.txt +++ b/AABB_tree/benchmark/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_traits_benchmark) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) @@ -13,7 +13,7 @@ create_single_source_cgal_program("tree_construction.cpp") find_package(benchmark QUIET) if(benchmark_FOUND) create_single_source_cgal_program("tree_creation.cpp") - target_link_libraries(tree_creation benchmark::benchmark) + target_link_libraries(tree_creation PRIVATE benchmark::benchmark) else() message(STATUS "NOTICE: The benchmark 'tree_creation.cpp' requires the Google benchmark library, and will not be compiled.") endif() diff --git a/AABB_tree/demo/AABB_tree/CMakeLists.txt b/AABB_tree/demo/AABB_tree/CMakeLists.txt index eabac21335c..3af9388139f 100644 --- a/AABB_tree/demo/AABB_tree/CMakeLists.txt +++ b/AABB_tree/demo/AABB_tree/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the AABB tree demo. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_tree_Demo) # Find includes in corresponding build directories diff --git a/AABB_tree/examples/AABB_tree/CMakeLists.txt b/AABB_tree/examples/AABB_tree/CMakeLists.txt index 620a79dccdb..ba856721722 100644 --- a/AABB_tree/examples/AABB_tree/CMakeLists.txt +++ b/AABB_tree/examples/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_tree_Examples) find_package(CGAL REQUIRED) diff --git a/AABB_tree/test/AABB_tree/CMakeLists.txt b/AABB_tree/test/AABB_tree/CMakeLists.txt index 72cd7d066a2..1e13ff0ba26 100644 --- a/AABB_tree/test/AABB_tree/CMakeLists.txt +++ b/AABB_tree/test/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(AABB_tree_Tests) find_package(CGAL REQUIRED) diff --git a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt index 3378a510767..255045d782d 100644 --- a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt +++ b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Advancing_front_surface_reconstruction_Examples) find_package(CGAL REQUIRED) diff --git a/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt b/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt index 27973a058d8..23e1dd2529b 100644 --- a/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt +++ b/Advancing_front_surface_reconstruction/test/Advancing_front_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Advancing_front_surface_reconstruction_Tests) find_package(CGAL REQUIRED) diff --git a/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt b/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt index caa1060d544..9e12449ab5b 100644 --- a/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt +++ b/Algebraic_foundations/doc/Algebraic_foundations/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgAlgebraicFoundationsRef -\todo check generated documentation \cgalPkgDescriptionBegin{Algebraic Foundations,PkgAlgebraicFoundations} \cgalPkgPicture{Algebraic_foundations2.png} diff --git a/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt b/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt index 186e8a01b2e..7150fdadd62 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt +++ b/Algebraic_foundations/examples/Algebraic_foundations/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_foundations_Examples) find_package(CGAL REQUIRED) diff --git a/Algebraic_foundations/include/CGAL/number_utils.h b/Algebraic_foundations/include/CGAL/number_utils.h index 5a5bc2d242d..48d8fc48725 100644 --- a/Algebraic_foundations/include/CGAL/number_utils.h +++ b/Algebraic_foundations/include/CGAL/number_utils.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace CGAL { CGAL_NTS_BEGIN_NAMESPACE diff --git a/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt b/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt index 467fdca406f..170d443ae71 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt +++ b/Algebraic_foundations/test/Algebraic_foundations/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_foundations_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt b/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt index 4907d2a4192..b8107073f4a 100644 --- a/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt +++ b/Algebraic_kernel_d/doc/Algebraic_kernel_d/PackageDescription.txt @@ -16,7 +16,6 @@ /*! \addtogroup PkgAlgebraicKernelDRef -\todo check generated documentation \cgalPkgDescriptionBegin{Algebraic Kernel,PkgAlgebraicKernelD} \cgalPkgPicture{Algebraic_kernel_d.png} \cgalPkgSummaryBegin diff --git a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt index f93c12d0950..a06ae073399 100644 --- a/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/examples/Algebraic_kernel_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_d_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt index 1e6570dd393..0f0d16a3c9c 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_d_Tests) # CGAL and its components diff --git a/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt b/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt index 424bd86fd28..f957c0e835c 100644 --- a/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt +++ b/Algebraic_kernel_for_circles/test/Algebraic_kernel_for_circles/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_for_circles_Tests) find_package(CGAL REQUIRED) diff --git a/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt b/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt index 637387543f2..0167d0c1d98 100644 --- a/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt +++ b/Algebraic_kernel_for_spheres/test/Algebraic_kernel_for_spheres/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Algebraic_kernel_for_spheres_Tests) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt index 493cacad635..35daf075ee4 100644 --- a/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/examples/Alpha_shapes_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_2_Examples) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h index 43be2407022..6df4b45c7b9 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h @@ -1442,7 +1442,7 @@ Alpha_shape_2::find_alpha_solid() const // takes O(#alpha_shape) time Type_of_alpha alpha_solid = 0; - if (number_of_vertices()<3) return alpha_solid; + if (dimension()!=2) return alpha_solid; Finite_vertices_iterator vertex_it; // only finite vertices diff --git a/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt index a4b13149993..94a0b7a934b 100644 --- a/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/test/Alpha_shapes_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_2_Tests) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt index 1028c6f4ea4..097684b274e 100644 --- a/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_3_Demo) # Find includes in corresponding build directories diff --git a/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt index 04f6565859d..892c164faa2 100644 --- a/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/examples/Alpha_shapes_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_3_Examples) find_package(CGAL REQUIRED) diff --git a/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt b/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt index e4aca061940..fe6da11668c 100644 --- a/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt +++ b/Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_3_Tests) find_package(CGAL REQUIRED) diff --git a/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt b/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt index 23150027c4f..c118956dcbf 100644 --- a/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt +++ b/Alpha_wrap_3/benchmark/Alpha_wrap_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_wrap_3_Benchmark) find_package(CGAL REQUIRED) diff --git a/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp b/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp index f8e54c488a4..12fa0690c9d 100644 --- a/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp +++ b/Alpha_wrap_3/benchmark/Alpha_wrap_3/Quality/quality_benchmark.cpp @@ -75,7 +75,7 @@ double mean_min_angle(const Mesh& mesh) const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh); std::array angles = triangle_angles(tr); - FT min_angle = std::min({angles[0], angles[1], angles[2]}); + FT min_angle = (std::min)({angles[0], angles[1], angles[2]}); min_angle = min_angle * (180.0 / CGAL_PI); mean_min_angle += min_angle; @@ -93,7 +93,7 @@ double mean_max_angle(const Mesh& mesh) const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh); std::array angles = triangle_angles(tr); - FT max_angle = std::max({angles[0], angles[1], angles[2]}); + FT max_angle = (std::max)({angles[0], angles[1], angles[2]}); max_angle = max_angle * (180.0 / CGAL_PI); mean_max_angle += max_angle; @@ -151,8 +151,8 @@ double mean_edge_ratio(const Mesh& mesh, FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1])); FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2])); FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0])); - FT min_edge = std::min({a, b, c}); - FT max_edge = std::max({a, b, c}); + FT min_edge = (std::min)({a, b, c}); + FT max_edge = (std::max)({a, b, c}); FT edge_ratio = max_edge / min_edge; mean_edge_ratio += edge_ratio; @@ -181,7 +181,7 @@ double mean_aspect_ratio(const Mesh& mesh, FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0])); FT s = 0.5 * (a + b + c); FT inscribed_radius = std::sqrt((s * (s - a) * (s - b) * (s - c)) / s); - FT max_edge = std::max({a, b, c}); + FT max_edge = (std::max)({a, b, c}); FT aspect_ratio = max_edge / inscribed_radius; aspect_ratio /= (2. * std::sqrt(3.)); // normalized mean_aspect_ratio += aspect_ratio; diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt b/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt index 8a1c8d1b9fe..ed779a17df5 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_wrap_3_Examples) find_package(CGAL REQUIRED) diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h index efaeb82d330..bcca1bd0143 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_triangulation_cell_base_3.h @@ -97,7 +97,7 @@ template class Cell_base_with_timestamp : public Cb { - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: using Has_timestamp = CGAL::Tag_true; @@ -112,7 +112,7 @@ public: public: template Cell_base_with_timestamp(const Args&... args) - : Cb(args...), time_stamp_(-1) + : Cb(args...) { } Cell_base_with_timestamp(const Cell_base_with_timestamp& other) diff --git a/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt b/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt index d719fae8a63..4281c1efcda 100644 --- a/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt +++ b/Alpha_wrap_3/test/Alpha_wrap_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_wrap_3_Tests) find_package(CGAL REQUIRED) diff --git a/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt b/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt index f82d98db1ed..102f019f68c 100644 --- a/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt +++ b/Apollonius_graph_2/doc/Apollonius_graph_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgApolloniusGraph2Ref /*! \addtogroup PkgApolloniusGraph2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Apollonius Graphs (Delaunay Graphs of Disks),PkgApolloniusGraph2} \cgalPkgPicture{CircleVoronoi.png} \cgalPkgSummaryBegin diff --git a/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt b/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt index 8b4217331c6..758309e7dc0 100644 --- a/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/examples/Apollonius_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Apollonius_graph_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt b/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt index c9d061984c7..51ea8576fa6 100644 --- a/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/test/Apollonius_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Apollonius_graph_2_Tests) find_package(CGAL REQUIRED) diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt index 2b62b5b12c9..a2df1177140 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt +++ b/Arithmetic_kernel/test/Arithmetic_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arithmetic_kernel_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt index 990e8d5092e..5e94ede8117 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_Demo) if(NOT POLICY CMP0070 AND POLICY CMP0053) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt index fa18ff35df6..faf3db032af 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_earth_Demo) if(NOT POLICY CMP0070 AND POLICY CMP0053) @@ -16,27 +16,24 @@ find_package(Qt6 QUIET COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets Xml) find_package(CGAL COMPONENTS Qt6) find_package(nlohmann_json QUIET 3.9) -if (NOT CGAL_FOUND OR NOT CGAL_Qt6_FOUND OR NOT Qt6_FOUND OR NOT Boost_FOUND OR NOT nlohmann_json_FOUND) - if (NOT CGAL_FOUND) - set(MISSING_DEPS "the CGAL library, ${MISSING_DEPS}") - endif() - if (NOT CGAL_Qt6_FOUND) - set(MISSING_DEPS "the CGAL Qt6 component, ${MISSING_DEPS}") - endif() - if (NOT Qt6_FOUND) - set(MISSING_DEPS "the Qt6 library, ${MISSING_DEPS}") - endif() - if (NOT Boost_FOUND) - set(MISSING_DEPS "the Boost library, ${MISSING_DEPS}") - endif() - if (NOT nlohmann_json_FOUND) - set(MISSING_DEPS "JSON for Modern C++ 3.9+ (know as nlohmann_json), ${MISSING_DEPS}") - endif() - - message(STATUS "NOTICE: This project requires ${MISSING_DEPS} and will not be compiled.") - return() +set(MISSING_DEPS "") +if (NOT CGAL_FOUND) + set(MISSING_DEPS "the CGAL library, ${MISSING_DEPS}") +endif() +if (NOT CGAL_Qt6_FOUND) + set(MISSING_DEPS "the CGAL Qt6 component, ${MISSING_DEPS}") +endif() +if (NOT Qt6_FOUND) + set(MISSING_DEPS "the Qt6 library, ${MISSING_DEPS}") +endif() +if (NOT nlohmann_json_FOUND) + set(MISSING_DEPS "JSON for Modern C++ 3.9+ (know as nlohmann_json), ${MISSING_DEPS}") endif() +if (MISSING_DEPS) + message(STATUS "NOTICE: This project requires ${MISSING_DEPS}and will not be compiled.") + return() +endif() add_compile_definitions(QT_NO_VERSION_TAGGING) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp index 58bc34f3ca2..53f7aba4972 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/GUI_country_pick_handler.cpp @@ -62,7 +62,7 @@ void GUI_country_pick_handler::mouse_press_event(QMouseEvent* e) { auto sd = sqrt(d); auto t1 = (-b - sd) / (2 * a); auto t2 = (-b + sd) / (2 * a); - if (t1 > 0 && t2 > 0) ti = std::min(t1, t2); + if (t1 > 0 && t2 > 0) ti = (std::min)(t1, t2); else if (t1 > 0) ti = t1; else ti = t2; } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp index f99c6c7e55b..decff54e3d5 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Main_widget.cpp @@ -140,7 +140,7 @@ void Main_widget::initializeGL() { for (auto& [country_name, triangle_points] : country_triangles_map) { auto country_triangles = std::make_unique(triangle_points); auto color = QVector4D(rndm(), rndm(), rndm(), 1); - auto m = std::max(color.x(), std::max(color.y(), color.z())); + auto m = (std::max)(color.x(), (std::max)(color.y(), color.z())); color /= m; color *= m_dimming_factor; color.setW(1); diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index ba6f1adb152..0287ab3226c 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -285,18 +285,18 @@ classes built on top of the halfedge data structure. The \f$x\f$-monotone curves of an arrangement are embedded in a rectangular two-dimensional area called the parameter space. The -parameter space is defined as \f$ X \times Y\f$, where \f$ X\f$ and -\f$ Y\f$ are open, half-open, or closed intervals with endpoints in -the compactified real line \f$ \mathbb{R} \cup -\{-\infty,+\infty\}\f$. Let \f$x_{\rm min}\f$, \f$x_{\rm max}\f$, -\f$y_{\rm min}\f$, and \f$y_{\rm max}\f$ denote the endpoints of \f$ -X\f$ and \f$ Y\f$, respectively. We typically refer to these values as -the left, right, bottom, and top sides of the boundary of the -parameter space. If the parameter space is, for example, the entire -compactified plane, as in the case of arrangements in the plane, -\f$x_{\rm min} = y_{\rm min} = -\infty\f$ and \f$x_{\rm max} = y_{\rm -max} = +\infty\f$; see Section \ref aos_sec-curved_surfaces for more -details. +parameter space is defined as \f$X \times Y\f$, where \f$X\f$ and +\f$Y\f$ are open, half-open, or closed intervals with endpoints in the +compactified real line \f$\mathbb{R} \cup \{-\infty,+\infty\}\f$. Let +\f$x_{\rm min}\f$, \f$x_{\rm max}\f$, \f$y_{\rm min}\f$, and +\f$y_{\rm max}\f$ denote the endpoints of \f$X\f$ and \f$Y\f$, +respectively. We typically refer to these values as the left, right, +bottom, and top sides of the boundary of the parameter space. If the +parameter space is, for example, the entire compactified plane, as in +the case of arrangements in the plane, +\f$x_{\rm min} = y_{\rm min} = -\infty\f$ and +\f$x_{\rm max} = y_{\rm max} = +\infty\f$; see Section \ref +aos_sec-curved_surfaces for more details. \cgalAdvancedEnd @@ -350,20 +350,20 @@ theoretically, the former are degenerate holes. See \cgalFigureBegin{aos_fig-arr_segs,arr_segs.png} An arrangement of interior-disjoint line segments with some of the -\dcel records that represent it. The unbounded face \f$ f_0\f$ has +\dcel records that represent it. The unbounded face \f$f_0\f$ has a single connected component that forms a hole inside it, and this -hole comprises of several faces. The halfedge \f$ e\f$ is directed -from its source vertex \f$ v_1\f$ to its target vertex \f$ -v_2\f$. This edge, together with its twin \f$ e'\f$, correspond to a -line segment that connects the points associated with \f$ v_1\f$ and -\f$ v_2\f$ and separates the face \f$ f_1\f$ from \f$ f_2\f$. The -predecessor \f$ e_{\rm prev}\f$ and successor \f$ e_{\rm next}\f$ of -\f$ e\f$ are part of the chain that form the outer boundary of the -face \f$ f_2\f$. The face \f$ f_1\f$ has a more complicated structure +hole comprises of several faces. The halfedge \f$e\f$ is directed +from its source vertex \f$v_1\f$ to its target vertex \f$v_2\f$. +This edge, together with its twin \f$e'\f$, correspond to a +line segment that connects the points associated with \f$v_1\f$ and +\f$v_2\f$ and separates the face \f$f_1\f$ from \f$f_2\f$. The +predecessor \f$e_{\rm prev}\f$ and successor \f$e_{\rm next}\f$ of +\f$e\f$ are part of the chain that form the outer boundary of the +face \f$f_2\f$. The face \f$f_1\f$ has a more complicated structure as it contains two holes in its interior: One hole consists of two -adjacent faces \f$ f_3\f$ and \f$ f_4\f$, while the other hole -comprises of two edges. \f$ f_1\f$ also contains two isolated vertices -\f$ u_1\f$ and \f$ u_2\f$ in its interior. +adjacent faces \f$f_3\f$ and \f$f_4\f$, while the other hole +comprises of two edges. \f$f_1\f$ also contains two isolated vertices +\f$u_1\f$ and \f$u_2\f$ in its interior. \cgalFigureEnd @@ -392,12 +392,12 @@ the `Arrangement_2` class template; their description follows.
  • The `Traits` template-parameter should be substituted by a - model of the `ArrangementBasicTraits_2` concept and optionally + model of the `AosBasicTraits_2` concept and optionally additional geometry traits concepts. A model of the - `ArrangementBasicTraits_2` concept defines the types of + `AosBasicTraits_2` concept defines the types of \f$x\f$-monotone curves and two-dimensional points, namely - `ArrangementBasicTraits_2::X_monotone_curve_2` and - `ArrangementBasicTraits_2::Point_2`, respectively, and supports + `AosBasicTraits_2::X_monotone_curve_2` and + `AosBasicTraits_2::Point_2`, respectively, and supports basic geometric predicates on them. The instantiated traits class determines the family of planar curves that induce the arrangement. @@ -417,7 +417,7 @@ the `Arrangement_2` class template; their description follows. in Section \ref aos_sec-geom_traits.
  • The `Dcel` template-parameter should be substituted by a class - that models the `ArrangementDcel` concept, which is used to represent + that models the `AosDcel` concept, which is used to represent the topological layout of the arrangement. This parameter is substituted by `Arr_default_dcel` by default, and we use this default value in this and in the following three @@ -487,12 +487,12 @@ results. #include #include -typedef int Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_non_caching_segment_traits_2 Traits; -typedef Traits_2::Point_2 Point; -typedef Traits_2::X_monotone_curve_2 Segment; -typedef CGAL::Arrangement_2 Arrangement; +using Number_type = int; +using Kernel = CGAL::Cartesian; +using Traits = CGAL::Arr_non_caching_segment_traits_2; +using Point = Traits_2::Point_2; +using Segment = Traits_2::X_monotone_curve_2; +using Arrangement = CGAL::Arrangement_2; int main() { Arrangement arr; @@ -767,7 +767,7 @@ void print_face(typename Arrangement::Face_const_handle f) { } // Print the boundary of each of the holes. - size_t index = 1; + std::size_t index = 1; for (auto hi = f->holes_begin(); hi != f->holes_end(); ++hi) { std::cout << " Hole #" << index++ << ": "; print_ccb(*hi); @@ -1018,17 +1018,17 @@ exact manner. #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using Number_type = Kernel::FT; -typedef CGAL::Arr_non_caching_segment_traits_2 Traits; -typedef Traits::Point_2 Point; -typedef Traits::X_monotone_curve_2 Segment; +using Traits = CGAL::Arr_non_caching_segment_traits_2; +using Point = Traits::Point_2; +using Segment = Traits::X_monotone_curve_2; -typedef CGAL::Arrangement_2 Arrangement; -typedef Arrangement::Vertex_handle Vertex_handle; -typedef Arrangement::Halfedge_handle Halfedge_handle; -typedef Arrangement::Face_handle Face_handle; +using Arrangement = CGAL::Arrangement_2; +using Vertex_handle = Arrangement::Vertex_handle; +using Halfedge_handle = Arrangement::Halfedge_handle; +using Face_handle = Arrangement::Face_handle; \endcode @@ -1040,7 +1040,7 @@ the member functions that manipulate them are easier to understand. The call \link Arrangement_on_surface_2::insert_in_face_interior() `arr.insert_in_face_interior(p, f)`\endlink inserts an isolated point -\f$p\f$, located in the interior of a given face \f$ f\f$, into the +\f$p\f$, located in the interior of a given face \f$f\f$, into the arrangement and returns a handle to the arrangement vertex associated with \f$p\f$ it has created. Naturally, this function has a precondition that \f$p\f$ is really an isolated point; namely it does @@ -1305,10 +1305,10 @@ geometric algorithms that operate on it. Thus, the `Arrangement_2` class template does not support point-location queries directly. Instead, the \ref PkgArrangementOnSurface2 package provides a set of class templates that are capable of answering such queries; all are -models of the concept `ArrangementPointLocation_2`. Each model employs +models of the concept `AosPointLocation_2`. Each model employs a different algorithm or strategy for answering queries. A model of this concept must define the \link -ArrangementPointLocation_2::locate() `locate()`\endlink member +AosPointLocation_2::locate() `locate()`\endlink member function, which accepts an input query-point and returns a polymorphic object representing the arrangement cell that contains this point. The returned object is of type @@ -1325,7 +1325,7 @@ the appropriate handle can be obtained with value retrieval by `std::get` as demonstrated in the example below. Note that the handles returned by the \link -ArrangementPointLocation_2::locate() `locate()`\endlink functions are +AosPointLocation_2::locate() `locate()`\endlink functions are non-mutable (`const`). If necessary, such handles may be cast to mutable handles using the `Arrangement_on_surface_2::non_const_handle()` methods. @@ -1338,7 +1338,7 @@ when `pl` is constructed or at a later time using the The function template `locate_point()` listed below accepts a point-location object, the type of which is a model of the -`ArrangementPointLocation_2` concept, and a query point. The function +`AosPointLocation_2` concept, and a query point. The function template issues a point-location query for the given point, and prints out the result. It is defined in the header file `point_location_utils.h`. @@ -1347,10 +1347,9 @@ out the result. It is defined in the header file \code template void locate_point(const PointLocation& pl, - const typename PointLocation::Arrangement_2::Point_2& q) -{ - typedef PointLocation Point_location; - typedef typename Point_location::Arrangement_2 Arrangement_2; + const typename PointLocation::Arrangement_2::Point_2& q) { + using Point_location = PointLocation; + using Arrangement_2 = typename Point_location::Arrangement_2; typename CGAL::Arr_point_location_result::Type obj = pl.locate(q); @@ -1372,13 +1371,12 @@ to an arrangement. template void print_point_location (const typename PointLocation::Arrangement_::Point_2& q - typename CGAL::Arr_point_location_result::Type obj) -{ - typedef Arrangement_ Arrangement_2; + typename CGAL::Arr_point_location_result::Type obj) { + using Arrangement_2 = Arrangement_; - typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement_2::Face_const_handle Face_const_handle; + using Vertex_const_handle = typename Arrangement_2::Vertex_const_handle; + using Halfedge_const_handle = typename Arrangement_2::Halfedge_const_handle; + using Face_const_handle = typename Arrangement_2::Face_const_handle; const Vertex_const_handle* v; const Halfedge_const_handle* e; @@ -1438,14 +1436,15 @@ vary according to the user choice.} for answering queries: points or choosing points on a grid, are also available; see the Reference Manual for more details. - The landmark strategy requires that the type of the attached - arrangement be an instance of the `Arrangement_2` class - template, where the `Traits` parameter is substituted by a - geometry-traits class that models the `ArrangementLandmarkTraits_2` - concept, which refines the basic `ArrangementBasicTraits_2` concept; - see Section \ref aos_sssec-tr_landmarks_concept for details. Most - traits classes included in the \ref PkgArrangementOnSurface2 package - are models of this refined concept. + The arrangement attached to the landmark strategy must be either (i) + an instance of the `Arrangement_2` class template, + where the `GeomTraits` parameter is substituted by a geometry-traits + class that models the `AosLandmarkTraits_2` concept, or (ii) an + instance of the `Arrangement_on_surface_2` + class template, where the `GeomTraits` is similarly substituted; + see Section \ref aos_sssec-tr_landmarks_concept for details about + this concept. Most traits classes included in the \ref + PkgArrangementOnSurface2 package are models of this refined concept.
  • `Arr_trapezoid_ric_point_location` implements an improved variant of Mulmuley's point-location algorithm @@ -1559,7 +1558,7 @@ that it hits a vertex, or that the arrangement does not have any vertex or edge lying directly above (or below) the query point. All point-location classes listed in the previous section are also -models of the `ArrangementVerticalRayShoot_2` concept. That is, they +models of the `AosVerticalRayShoot_2` concept. That is, they all have member functions called `ray_shoot_up(q)` and `ray_shoot_down(q)` that accept a query point \f$q\f$. These functions output a polymorphic object of type @@ -1576,7 +1575,7 @@ directly above (or below) \f$q\f$. The function template `vertical_ray_shooting_query()` listed below accepts a vertical ray-shooting object, the type of which -models the `ArrangementVerticalRayShoot_2` concept. It exports +models the `AosVerticalRayShoot_2` concept. It exports the result of the upward vertical ray-shooting operation from a given query point to the standard output-stream. The ray-shooting object `vrs` is assumed to be already attached to an arrangement. @@ -1587,18 +1586,17 @@ The function template is defined in the header file template void shoot_vertical_ray(const RayShoot& vrs, const typename - VerticalRayShooting::Arrangement_2::Point_2& q) -{ - typedef VerticalRayShooting Vertical_ray_shooting; + VerticalRayShooting::Arrangement_2::Point_2& q) { + using Vertical_ray_shooting = VerticalRayShooting; // Perform the point-location query. typename Vertical_ray_shooting::result_type obj = vrs.ray_shoot_up(q); // Print the result. - typedef typename Vertical_ray_shooting::Arrangement_2 Arrangement_2; - typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement_2::Face_const_handle Face_const_handle; + using Arrangement_2 = typename Vertical_ray_shooting::Arrangement_2; + using Vertex_const_handle = typename Arrangement_2::Vertex_const_handle; + using Halfedge_const_handle = typename Arrangement_2::Halfedge_const_handle; + using Face_const_handle = typename Arrangement_2::Face_const_handle; const Vertex_const_handle* v; const Halfedge_const_handle* e; @@ -1684,7 +1682,7 @@ namely the surface sweep and the zone construction. These operations accepts \f$x\f$-monotone curves; thus, the geometry-traits class used by the arrangements passed as input to, or obtained as output from, these operations must be a model of the -`ArrangementXMonotoneTraits_2` concept; see Section \ref +`AosXMonotoneTraits_2` concept; see Section \ref aos_sec-geom_traits for the precise definition of this concept. It defines the minimal set of geometric primitives, among other things, required to perform the algorithms of the surface-sweep and @@ -1745,13 +1743,13 @@ location.\cgalFootnote{The \cgalFootnoteCode{CGAL::insert_non_intersecting_curve function template, as all other functions reviewed in this section, is parameterized by an arrangement type and a point-location type (The latter must be substituted by a model of the -`ArrangementPointLocation_2` concept).} The insertion operation thus +`AosPointLocation_2` concept).} The insertion operation thus hardly requires any geometric operations on top of the ones needed to answer the point-location queries. Moreover, it is sufficient that the traits class that substitutes the `Traits` template parameter of the `Arrangement_2` class template when the latter is -instantiated models the concept `ArrangementBasicTraits_2` concept -(and the concept `ArrangementLandmarkTraits_2` if the landmark +instantiated models the concept `AosBasicTraits_2` concept +(and the concept `AosLandmarkTraits_2` if the landmark point-location strategy is used), and does not have to support the computation of intersection points between curves. This implies that using a kernel that provides exact geometric predicates, but @@ -1779,7 +1777,7 @@ function relatively efficient; however, its preconditions on the input curves are still rather restricting. Let us assume that the traits class that substitutes the `Traits` template parameter of the `Arrangement_2` class template models the refined -`ArrangementXMonotoneTraits_2` concept and supports curve intersection +`AosXMonotoneTraits_2` concept and supports curve intersection computations; see Section \ref aos_sec-geom_traits for the exact details. Given an \f$x\f$-monotone curve, it is sufficient to locate its left endpoint in the arrangement and to trace its zone @@ -1849,10 +1847,10 @@ pl)`\endlink, where \f$c\f$ is not necessarily \f$x\f$-monotone. In this case the type of `arr` must be an instance of the `Arrangement_2` class template, where the `Traits` template parameter is substituted by a traits class that models the -concept `ArrangementTraits_2`, which refines the -`ArrangementXMonotoneTraits_2` concept. It has to define an additional -\link ArrangementTraits_2::Curve_2 `Curve_2`\endlink type, which may -differ from the \link ArrangementBasicTraits_2::X_monotone_curve_2 +concept `AosTraits_2`, which refines the +`AosXMonotoneTraits_2` concept. It has to define an additional +\link AosTraits_2::Curve_2 `Curve_2`\endlink type, which may +differ from the \link AosBasicTraits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink type. It also has to support the subdivision of curves of this new type into \f$x\f$-monotone curves and possibly singular points; see the exact details in Section \ref @@ -1893,7 +1891,7 @@ associated with \f$p\f$. The type of `arr` must be and instance of the `Arrangement_2` class template instantiated with a traits class that models the -`ArrangementXMonotoneTraits_2` concept, as the insertion operation may +`AosXMonotoneTraits_2` concept, as the insertion operation may involve the splitting of curves. @@ -1957,7 +1955,7 @@ use the zone framework. The free function template `%CGAL::do_intersect<>(arr, c, pl)` checks whether the given query curve \f$c\f$ intersects the curves and points of an existing arrangement `arr`. If \f$c\f$ is not \f$x\f$-monotone -(that is, it is of type \link ArrangementTraits_2::Curve_2 +(that is, it is of type \link AosTraits_2::Curve_2 `Curve_2`\endlink) the curve is subdivided into \f$x\f$-monotone subcurves and isolated points. Each \f$x\f$-monotone curve (or point) is checked for intersection in turn using the zone framework. For @@ -1972,9 +1970,9 @@ user-defined point-location object, it constructs a local object of the walk point-location type, namely, an instance of the `Arr_walk_along_line_point_location` class template, and uses it to locate the endpoint. If the given curve is \f$x\f$-monotone then the -traits type must model the `ArrangementXMonotoneTraits_2` concept. If +traits type must model the `AosXMonotoneTraits_2` concept. If the curve is not \f$x\f$-monotone then the traits type must model the -`ArrangementTraits_2` concept. +`AosTraits_2` concept. The `CGAL::zone<>(arr, c, oi, pl)` function template computes the zone of a given \f$x\f$-monotone curve in a given arrangement. More @@ -1987,7 +1985,7 @@ that instead of accepting a user-defined point-location object, it constructs a local object of the walk point-location type, namely, an instance of the `Arr_walk_along_line_point_location` class template, and uses it to locate the endpoint. The traits type must model the -`ArrangementXMonotoneTraits_2` concept. +`AosXMonotoneTraits_2` concept. \subsection arr_ssec_sweep The Surface-Sweep Algorithm @@ -2081,7 +2079,7 @@ arrangement of intersecting line segments, as constructed in \ref Arrangement_on_surface_2/global_insertion.cpp. The segments of \f$\mathcal{S}_1\f$ are drawn in solid lines and the segments of \f$\mathcal{S}_2\f$ are drawn in dark dashed lines. Note that the -segment \f$ s\f$ (light dashed line) overlaps one of the segments in +segment \f$s\f$ (light dashed line) overlaps one of the segments in \f$\mathcal{S}_1\f$. \cgalFigureEnd @@ -2114,9 +2112,9 @@ below. The three levels, starting from the most restrictive, are
    Type of Curves Geometry-Traits Concept Insertion Function -
    \f$x\f$-monotone and pairwise disjoint `ArrangementBasicTraits_2` or `ArrangementLandmarkTraits_2` `CGAL::insert_non_intersecting_curve<>()` -
    \f$x\f$-monotone `ArrangementXMonotoneTraits_2` `%CGAL::insert<>()` -
    general `ArrangementTraits_2` `%CGAL::insert<>()` +
    \f$x\f$-monotone and pairwise disjoint `AosBasicTraits_2` or `AosLandmarkTraits_2` `CGAL::insert_non_intersecting_curve<>()` +
    \f$x\f$-monotone `AosXMonotoneTraits_2` `%CGAL::insert<>()` +
    general `AosTraits_2` `%CGAL::insert<>()`
    The insertion function template `%insert()` is overloaded to @@ -2142,8 +2140,8 @@ form a single curve associated with a single edge. An attempt to remove a vertex or an edge from an arrangement object `arr` using the free functions above requires that the traits class used to instantiate the arrangement type of `arr` models the concept -`ArrangementXMonotoneTraits_2`, which refines the -`ArrangementBasicTraits_2` concept; see Section \ref +`AosXMonotoneTraits_2`, which refines the +`AosBasicTraits_2` concept; see Section \ref aos_sec-geom_traits. The function template `CGAL::remove_vertex<>(arr, v)` removes the @@ -2535,7 +2533,7 @@ the file `is_in_x_range.h`, checks whether a given point \f$p\f$ is in the \f$x\f$-range of the curve associated with a given halfedge \f$e\f$. The function template also exemplifies how some of the above functions can be used. The traits functor \link -ArrangementBasicTraits_2::Compare_x_2 `Compare_x_2`\endlink used in +AosBasicTraits_2::Compare_x_2 `Compare_x_2`\endlink used in the code is described in Section \ref aos_sssec-geom_traits-concepts_basic. @@ -2681,20 +2679,20 @@ next. These types are defined in the header file `arr_linear.h`. #include #include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Number_type = Kernel::FT; -typedef CGAL::Arr_linear_traits_2 Traits; -typedef Traits::Point_2 Point; -typedef Traits::Segment_2 Segment; -typedef Traits::Ray_2 Ray; -typedef Traits::Line_2 Line; -typedef Traits::X_monotone_curve_2 X_monotone_curve; +using Traits = CGAL::Arr_linear_traits_2; +using Point = Traits::Point_2; +using Segment = Traits::Segment_2; +using Ray = Traits::Ray_2; +using Line = Traits::Line_2; +using X_monotone_curve = Traits::X_monotone_curve_2; -typedef CGAL::Arrangement_2 Arrangement; -typedef Arrangement::Vertex_handle Vertex_handle; -typedef Arrangement::Halfedge_handle Halfedge_handle; -typedef Arrangement::Face_handle Face_handle; +using Arrangement = CGAL::Arrangement_2; +using Vertex_handle = Arrangement::Vertex_handle; +using Halfedge_handle = Arrangement::Halfedge_handle; +using Face_handle = Arrangement::Face_handle; \endcode @@ -2853,7 +2851,7 @@ right sides) are identified if called an identification curve. Rectangles, strips, quadrants, half-planes, and planes can be modeled -with \f$\phi_S \f$ being the identity mapping. For example, +with \f$\phi_S\f$ being the identity mapping. For example, \f$\Phi_S(x, y) = (x, y, 0)\f$ with \f$X = Y =(-\infty, +\infty)\f$ parameterizes a plane. Surfaces such as paraboloids can be modeled through continuous and bijective parameterizations, for @@ -3054,17 +3052,17 @@ respectively. If you want to determine whether the pre-image of a point \f$p\f$ lies on identified sides, you need to employ one of the two traits functors \link - ArrangementIdentifiedHorizontalTraits_2::Is_on_x_identification_2 + AosIdentifiedHorizontalTraits_2::Is_on_x_identification_2 `Is_on_x_identification_2`\endlink or \link - ArrangementIdentifiedVerticalTraits_2::Is_on_y_identification_2 + AosIdentifiedVerticalTraits_2::Is_on_y_identification_2 `Is_on_y_identification_2`\endlink; see Section \ref aos_ssec-traits-curved. If the pre-image of an \f$x\f$-monotone curve \f$c\f$ does not entirely lie on identified sides, you can determine the location of the pre-image of an endpoint of \f$c\f$ employing either the \link - ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 + AosVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink functor or the \link - ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 + AosHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink functors; see Section \ref aos_ssec-traits-curved. The operations in both functors accept an enumeration that indicates the curve end, that is, @@ -3121,20 +3119,20 @@ parameter space are identified and the bottom and top sides are contracted, which is the settings used by the traits class template `Arr_geodesic_arc_on_sphere_traits_2`; see Section \ref arr_ssectr_spherical. The traits functors \link -ArrangementBasicTraits_2::Construct_min_vertex_2 +AosBasicTraits_2::Construct_min_vertex_2 `Construct_min_vertex_2`\endlink, \link -ArrangementBasicTraits_2::Construct_max_vertex_2 +AosBasicTraits_2::Construct_max_vertex_2 `Construct_min_vertex_2`\endlink, and \link -ArrangementBasicTraits_2::Compare_x_2 `Compare_x_2`\endlink used in +AosBasicTraits_2::Compare_x_2 `Compare_x_2`\endlink used in the code are described is Section \ref aos_sssec-geom_traits-concepts_basic. The traits functors \link -ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 +AosVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink, \link -ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 +AosHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink, \link -ArrangementIdentifiedVerticalTraits_2::Is_on_y_identification_2 +AosIdentifiedVerticalTraits_2::Is_on_y_identification_2 `Is_on_y_identification_2`\endlink, and \link -ArrangementHorizontalSideTraits_2::Compare_x_on_boundary_2 +AosHorizontalSideTraits_2::Compare_x_on_boundary_2 `Compare_x_on_boundary_2`\endlink, are described is Section \ref aos_ssec-traits-curved. @@ -3254,10 +3252,10 @@ The hierarchy of the main geometry traits concepts. \subsubsection aos_sssec-geom_traits-concepts_basic The Basic Concept -A model of the basic concept `ArrangementBasicTraits_2` needs to -define the types \link ArrangementBasicTraits_2::Point_2 +A model of the basic concept `AosBasicTraits_2` needs to +define the types \link AosBasicTraits_2::Point_2 `Point_2`\endlink and \link -ArrangementBasicTraits_2::X_monotone_curve_2 +AosBasicTraits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink, where objects of the former type are the geometric mapping of arrangement vertices, and objects of the latter type are the geometric mapping of edges. In addition, it has to @@ -3268,20 +3266,20 @@ and points that do not lie in the interiors of the curves. The basic set of predicates is also sufficient for answering vertical ray-shooting queries and point-location queries with a small exception: Locating a point using the landmark strategy requires a -traits class that models the concept `ArrangementLandmarkTraits_2`; +traits class that models the concept `AosLandmarkTraits_2`; see Section \ref aos_sssec-tr_landmarks_concept.
    -
    \link ArrangementBasicTraits_2::Compare_x_2 `Compare_x_2`\endlink: +
    \link AosBasicTraits_2::Compare_x_2 `Compare_x_2`\endlink:
    Compares the \f$x\f$-coordinates of two points. -
    \link ArrangementBasicTraits_2::Compare_xy_2 `Compare_xy_2`\endlink: +
    \link AosBasicTraits_2::Compare_xy_2 `Compare_xy_2`\endlink:
    Compares two points lexicographically, first by their \f$x\f$-coordinates, and if they are equal, by their \f$y\f$-coordinates. -
    \link ArrangementBasicTraits_2::Equal_2 `Equal_2`\endlink: +
    \link AosBasicTraits_2::Equal_2 `Equal_2`\endlink:
    There are two overloaded Boolean operators that test equality. One returns true iff two given points represent the same geometric point in the two-dimensional surface, and the second returns true iff the @@ -3290,36 +3288,36 @@ see Section \ref aos_sssec-tr_landmarks_concept. of two \f$x\f$-monotone curves is used only for testing as part of the test suite.} -
    \link ArrangementBasicTraits_2::Construct_min_vertex_2 `Construct_min_vertex_2`\endlink: +
    \link AosBasicTraits_2::Construct_min_vertex_2 `Construct_min_vertex_2`\endlink:
    Returns the lexicographically smallest (or left) endpoint of an \f$x\f$-monotone curve. -
    \link ArrangementBasicTraits_2::Construct_max_vertex_2 `Construct_max_vertex_2`\endlink: +
    \link AosBasicTraits_2::Construct_max_vertex_2 `Construct_max_vertex_2`\endlink:
    Returns the lexicographically largest (or right) endpoint of an \f$x\f$-monotone curve. -
    \link ArrangementBasicTraits_2::Is_vertical_2 `Is_vertical_2`\endlink: +
    \link AosBasicTraits_2::Is_vertical_2 `Is_vertical_2`\endlink:
    Determines whether an \f$x\f$-monotone curve is vertical. -
    \link ArrangementBasicTraits_2::Compare_y_at_x_2 `Compare_y_at_x_2`\endlink: +
    \link AosBasicTraits_2::Compare_y_at_x_2 `Compare_y_at_x_2`\endlink:
    Given an \f$x\f$-monotone curve \f$c\f$ and a point \f$p\f$ that lies in the \f$x\f$-range of \f$c\f$, determines whether \f$p\f$ is below, above or lies on \f$c\f$. -
    \link ArrangementBasicTraits_2::Compare_y_at_x_right_2 `Compare_y_at_x_right_2`\endlink: +
    \link AosBasicTraits_2::Compare_y_at_x_right_2 `Compare_y_at_x_right_2`\endlink:
    Given two \f$x\f$-monotone curves \f$c_1\f$ and \f$c_2\f$ that share a common minimal (left) endpoint \f$p\f$, determines whether \f$c_1\f$ is above or below \f$c_2\f$ immediately to the right of \f$p\f$, or whether the two curves overlap there.
    -Every model of the concept `ArrangementBasicTraits_2` needs to define -a nested type named \link ArrangementBasicTraits_2::Has_left_category +Every model of the concept `AosBasicTraits_2` needs to define +a nested type named \link AosBasicTraits_2::Has_left_category `Has_left_category`\endlink. It determines whether the traits class supports the following predicate:
    -
    \link ArrangementBasicTraits_2::Compare_y_at_x_left_2 `Compare_y_at_x_left_2`\endlink: +
    \link AosBasicTraits_2::Compare_y_at_x_left_2 `Compare_y_at_x_left_2`\endlink:
    Given two \f$x\f$-monotone curves \f$c_1\f$ and \f$c_2\f$ that share a common maximal (right) endpoint \f$p\f$, determines whether \f$c_1\f$ is above or under \f$c_2\f$ immediately to the left of @@ -3327,7 +3325,7 @@ supports the following predicate:
    -If the `ArrangementBasicTraits_2::Has_left_category` type nested in a +If the `AosBasicTraits_2::Has_left_category` type nested in a model of the basic concept is defined as `Tag_true`\cgalFootnote{In principle, the category type may only be convertible to the tag type, but in practice the category is typically explicitly defined as the @@ -3346,18 +3344,18 @@ bottom, or top side of the boundary of the parameter space, must be conveyed by the traits class. This is done through the definition of four additional nested types, namely
      -
    1. \link ArrangementBasicTraits_2::Left_side_category +
    2. \link AosBasicTraits_2::Left_side_category `Left_side_category`\endlink, -
    3. \link ArrangementBasicTraits_2::Right_side_category +
    4. \link AosBasicTraits_2::Right_side_category `Right_side_category`\endlink, -
    5. \link ArrangementBasicTraits_2::Bottom_side_category +
    6. \link AosBasicTraits_2::Bottom_side_category `Bottom_side_category`\endlink, and -
    7. \link ArrangementBasicTraits_2::Top_side_category +
    8. \link AosBasicTraits_2::Top_side_category `Top_side_category`\endlink.
    Each of those types must be convertible to the type `Arr_oblivious_side_tag` for the class to be a model of -the concept `ArrangementBasicTraits_2`. +the concept `AosBasicTraits_2`. \subsubsection aos_sssec-geom_traits-concepts_intersecting Intersections @@ -3365,17 +3363,17 @@ the concept `ArrangementBasicTraits_2`. Constructing an arrangement induced by \f$x\f$-monotone curves that may intersect in their interior requires operations that are not part -of the `ArrangementBasicTraits_2` concept. The additional operations -are listed by the concept `ArrangementXMonotoneTraits_2`, which +of the `AosBasicTraits_2` concept. The additional operations +are listed by the concept `AosXMonotoneTraits_2`, which refines the basic arrangement geometry-traits concept described above. -While models of the `ArrangementXMonotoneTraits_2` concept still +While models of the `AosXMonotoneTraits_2` concept still handle only \f$x\f$-monotone curves, the curves are not restricted to be disjoint in their interiors. Such a model must be capable of computing points of intersection between \f$x\f$-monotone curves, splitting curves at these intersection points to obtain pairs of interior-disjoint subcurves, and optionally merging pairs of subcurves. A point of intersection between two curves is also -represented by the \link ArrangementBasicTraits_2::Point_2 +represented by the \link AosBasicTraits_2::Point_2 `Point_2`\endlink type. A model of the refined concept must define an additional type called `Multiplicity`. An object of this type indicates the multiplicity of the intersection point of two curves, @@ -3396,12 +3394,12 @@ operations:
    -
    \link ArrangementXMonotoneTraits_2::Split_2 `Split_2`\endlink: +
    \link AosXMonotoneTraits_2::Split_2 `Split_2`\endlink:
    Splits an \f$x\f$-monotone curve \f$c\f$ into two subcurves at a given point \f$p\f$ that lies in the interior of \f$c\f$. -
    \link ArrangementXMonotoneTraits_2::Are_mergeable_2 `Are_mergeable_2`\endlink: -
    Determines whether two \f$ x\f$-monotone curves \f$c_1\f$ and +
    \link AosXMonotoneTraits_2::Are_mergeable_2 `Are_mergeable_2`\endlink: +
    Determines whether two \f$x\f$-monotone curves \f$c_1\f$ and \f$c_2\f$ that share a common endpoint can be merged into a single continuous \f$x\f$-monotone curve representable by the traits class.\cgalFootnote{On the face of it this seems a difficult @@ -3410,10 +3408,10 @@ operations: underlying curves are identical and whether they do not bend to form a non-\f$x\f$-monotone curve.} -
    \link ArrangementXMonotoneTraits_2::Merge_2 `Merge_2`\endlink: +
    \link AosXMonotoneTraits_2::Merge_2 `Merge_2`\endlink:
    Merges two mergeable \f$x\f$-monotone curves into a single curve. -
    \link ArrangementXMonotoneTraits_2::Intersect_2 `Intersect_2`\endlink: +
    \link AosXMonotoneTraits_2::Intersect_2 `Intersect_2`\endlink:
    Computes all intersection points and overlapping sections of two given \f$x\f$-monotone curves. If possible, computes also the multiplicity of each intersection point. Providing the multiplicity @@ -3427,12 +3425,12 @@ operations:
    -Using a model of the `ArrangementXMonotoneTraits_2` it is +Using a model of the `AosXMonotoneTraits_2` it is possible to construct arrangements of sets of \f$x\f$-monotone curves (and points) that may intersect one another. The two operations listed above, regarding the merging of curves, are optional, and should be provided only if the type `Has_merge_category` nested in a model of -the `ArrangementXMonotoneTraits_2` concept is defined as `Tag_true`. +the `AosXMonotoneTraits_2` concept is defined as `Tag_true`. Otherwise, it is not possible to merge \f$x\f$-monotone curve and redundant vertices may be left in the arrangement due to the removal of edges. @@ -3441,11 +3439,11 @@ edges. \subsubsection aos_sssec-geom_traits-concepts_arbitrary Supporting Arbitrary Curves -The concept `ArrangementTraits_2` refines the -`ArrangementXMonotoneTraits_2` concept. A model of the refined concept +The concept `AosTraits_2` refines the +`AosXMonotoneTraits_2` concept. A model of the refined concept must define an additional type that is used to represent general, not necessarily \f$x\f$-monotone and not necessarily continuous, curves, -named \link ArrangementTraits_2::Curve_2 `Curve_2`\endlink. It also +named \link AosTraits_2::Curve_2 `Curve_2`\endlink. It also has to support the subdivision of a curve of that type into a set of continuous \f$x\f$-monotone curves and isolated points. For example, the curve \f$c:\ (x^2 + y^2)(x^2 + y^2 - 1) = 0\f$ comprises the unit @@ -3458,20 +3456,20 @@ operation:
    -
    \link ArrangementTraits_2::Make_x_monotone_2 `Make_x_monotone_2`\endlink: +
    \link AosTraits_2::Make_x_monotone_2 `Make_x_monotone_2`\endlink:
    Divides a given general curve of type \link - ArrangementTraits_2::Curve_2 `Curve_2`\endlink into continuous weakly + AosTraits_2::Curve_2 `Curve_2`\endlink into continuous weakly \f$x\f$-monotone curves and isolated points.
    -Note that a model of the refined concept `ArrangementTraits_2` is +Note that a model of the refined concept `AosTraits_2` is required only when using the free `insert()` function templates (see Section \ref arr_secgl_funcs) that accept an object of type \link -ArrangementTraits_2::Curve_2 `Curve_2`\endlink or a range of objects +AosTraits_2::Curve_2 `Curve_2`\endlink or a range of objects of that type. In all other cases it is sufficient to use a model of -the `ArrangementXMonotoneTraits_2` concept. +the `AosXMonotoneTraits_2` concept. \subsubsection aos_sssec-tr_landmarks_concept The Landmark Concept @@ -3488,22 +3486,22 @@ The type of an arrangement associated with the landmark point-location strategy (see Section \ref arr_ssecpl) must be an instance of the `Arrangement_on_surface_2` class template, where the `GeomTraits` parameter is substituted by a model of the -concept `ArrangementLandmarkTraits_2`. (Naturally, it can also model -either the `ArrangementXMonotoneTraits_2` concept or the -`ArrangementTraits_2` concept.) The `ArrangementLandmarkTraits_2` -concept refines the two concepts `ArrangementApproximateTraits_2` and -`ArrangementConstructXMonotoneCurveTraits_2`. Each of these two -concepts, in turn, refines the concept `ArrangementBasicTraits_2`. +concept `AosLandmarkTraits_2`. (Naturally, it can also model +either the `AosXMonotoneTraits_2` concept or the +`AosTraits_2` concept.) The `AosLandmarkTraits_2` +concept refines the two concepts `AosApproximatePointTraits_2` and +`AosConstructXMonotoneCurveTraits_2`. Each of these two +concepts, in turn, refines the concept `AosBasicTraits_2`. -A model of the `ArrangementApproximateTraits_2` concept must define a +A model of the `AosApproximatePointTraits_2` concept must define a fixed precision number type (typically the double-precision floating-point `double`) and support the operation below (in addition -to fulfilling the requirements listed by the `ArrangementBasicTraits_2` +to fulfilling the requirements listed by the `AosBasicTraits_2` concept).
    -
    \link ArrangementApproximateTraits_2::Approximate_2 `Approximate_2`\endlink: +
    \link AosApproximatePointTraits_2::Approximate_2 `Approximate_2`\endlink:
    Given a point `p`, approximate the \f$x\f$ and \f$y\f$-coordinates of `p` using a not necessarily multi-precision number type. We use this operation for approximate @@ -3514,33 +3512,32 @@ fixed-precision number type.
    -A model of the `ArrangementConstructXMonotoneCurveTraits_2` concept +A model of the `AosConstructXMonotoneCurveTraits_2` concept must support the operation below (in addition to fulfilling the -requirements listed by the `ArrangementBasicTraits_2` concept). +requirements listed by the `AosBasicTraits_2` concept).
    -
    \link ArrangementConstructXMonotoneCurveTraits_2::Construct_x_monotone_curve_2 `Construct_x_monotone_curve_2`\endlink: +
    \link AosConstructXMonotoneCurveTraits_2::Construct_x_monotone_curve_2 `Construct_x_monotone_curve_2`\endlink:
    Given two points \f$p_1\f$ and \f$p_2\f$, construct an \f$x\f$-monotone curve connecting \f$p_1\f$ and \f$p_2\f$.
    -Most traits classes model the `ArrangementTraits_2` concept, and some -also model the `ArrangementLandmarkTraits_2` concept. +Most traits classes model the `AosTraits_2` concept, and some +also model the `AosLandmarkTraits_2` concept. + +The concept `AosConstructCurveTraits_2` refines the concept +`AosBasicTraits_2`. A model of the `AosConstructCurveTraits_2` concept +must support the operation below (in addition to fulfilling the +requirements listed by the `AosBasicTraits_2` concept). \subsubsection aos_sssec-tr_additional_concepts The Construct Curve Concept -The concept `ArrangementConstructCurveTraits_2` refines the concept -`ArrangementTraits_2`. A model of the -`ArrangementConstructCurveTraits_2` concept must support the operation -below (in addition to fulfilling the requirements listed by the -`ArrangementTraits_2` concept). -
    -
    \link ArrangementConstructCurveTraits_2::Construct_curve_2 `Construct_curve_2`\endlink: +
    \link AosConstructCurveTraits_2::Construct_curve_2 `Construct_curve_2`\endlink:
    Given two points \f$p_1\f$ and \f$p_2\f$, construct a curve connecting \f$p_1\f$ and \f$p_2\f$.
    @@ -3549,9 +3546,62 @@ The `Arr_polyline_traits_2` class template handles polylines; see Section ~\ref arr_sssectr_polylines. The type that substitutes the template parameter `SubcurveTraits_2` when `Arr_polyline_traits_2` is instantiated must be -a geometry-traits class that models the concept `ArrangementConstructCurveTraits_2` +a geometry-traits class that models the concept `AosConstructCurveTraits_2` to enable the construction of polylines from a sequence of two or more points. + +\subsubsection aos_sssec-tr_approximatetion_concept Supporting Approximations of Curves + + +Operations on arrangements are guaranteed to be robust only if the +operations of the geometry traits used to carry out the high-level +operations are robust. Geometry traits constructors are guaranteed to +be robust only if the kernel in use supports exact constructions, such +as the Epec kernel. Even if you only intend to perform point-location +queries on an arrangement induced by a collection of curves, you need +an exact-construction kernel, if the curves are not pairwise disjoint +in their interiors. However, when using an exact-construction kernel +you still may desire to perform (independent) operations on +approximations of the points or the interior-disjoint \f$x\f$-monotone +curves of the arrangements in order to gain speed, for example drawing +the arrangement on a raster window. Naturally, reconstructing an +arrangement from the approximations of its points and +interior-disjoint \f$x\f$-monotone curves, may result with an arrangement +of a different topology, or even worse, intersections in the interior +of the curves. + +The concept `AosApproximateTraits_2` refines the concept +`AosApproximatePointTraits_2`. In addition to the type +`Approximate_number_type` required by the latter, a model of the +`AosApproximateTraits_2` concept must define the type +`Approximate_point_2`, which is typically defined as +`CGAL::Cartesian::%Point_2`. Also, it must +support the operations below (in addition to the operation required by +the concept `AosApproximatePointTraits_2`). + +
    +
    \link AosApproximateTraits_2::Approximate_2 `Approximate_2`\endlink: +
    This operation is overloaded with three versions. The first one + returns an approximation of the \f$x\f$- or \f$y\f$-coordinates of a given + point as required by the concept `AosApproximatePointTraits_2`; see + Section \ref aos_sssec-tr_landmarks_concept. The description of the remaining + two follow. + + (i) Given a point \f$p\f$, obtain an approximation of \f$p\f$, which is an + object of type `Approximate_point_2`. This is trivially + implemented using the first version. + + (ii) Given an \f$x\f$-monotone curve \f$c\f$, a small number \f$\epsilon\f$ of + type `Approximate_number_type` that serves as an error bound, an + output iterator associated with a container + of approximate points, and a flag that indicates whether to + approximate \f$c\f$ starting from its smallest lexicographic endpoint, + compute a polyline that approximates \f$c\f$ in the indicated + direction, such that the largest distance between \f$c\f$ and the + polyline is not larger than \f$\epsilon\f$. The polyline is + represented as a sequence of approximate points. +
    + \subsubsection aos_ssec-traits-curved Supporting Unbounded Curves or Curved Surfaces @@ -3566,13 +3616,13 @@ boundary sides) or approach them (the pre-images of their endpoints approach boundary sides). These boundary conditions typically occur with unbounded curves or with arrangements embedded in curved surfaces. The category types \link -ArrangementBasicTraits_2::Left_side_category +AosBasicTraits_2::Left_side_category `Left_side_category`\endlink, \link -ArrangementBasicTraits_2::Right_side_category +AosBasicTraits_2::Right_side_category `Right_side_category`\endlink, \link -ArrangementBasicTraits_2::Bottom_side_category +AosBasicTraits_2::Bottom_side_category `Bottom_side_category`\endlink, and \link -ArrangementBasicTraits_2::Top_side_category +AosBasicTraits_2::Top_side_category `Top_side_category`\endlink, nested in every geometry traits class indicate whether the corresponding boundary side (i.e., left, right, bottom, and top) is open, closed, contracted, or identified, and @@ -3601,9 +3651,9 @@ closed, contracted, and identified sides, respectively. (When curves are expected to neither reach nor approach a particular side, special handling is not required; thus, there is no need for a corresponding concept.) For example, it is required that the category type \link -ArrangementOpenBottomTraits_2::Bottom_side_category +AosOpenBottomTraits_2::Bottom_side_category `Bottom_side_category`\endlink, nested in models of the concept -`ArrangementOpenBottomTraits_2`, is convertible to the tag type +`AosOpenBottomTraits_2`, is convertible to the tag type `Arr_open_side_tag`. This makes for a total of 16 abstract concepts (combine one of left, right, bottom, and top with one of open, closed, contracted, identified). Any one of these individual abstract concept @@ -3617,8 +3667,8 @@ contracted side must be adjacent to two identified sides. While this narrows down the number of tangible concepts, the total number is still high; in practice we have used only two so far (not counting the "plain" concept, models of which do not handle boundary conditions at -all), namely, `ArrangementOpenBoundaryTraits_2` and -`ArrangementSphericalBoundaryTraits_2`; see below for more +all), namely, `AosOpenBoundaryTraits_2` and +`AosSphericalBoundaryTraits_2`; see below for more details. Many of the traits class-templates provided by the \ref PkgArrangementOnSurface2 package do not handle boundary conditions at all. Some of them, such as the `Arr_segment_traits_2` traits (see @@ -3640,7 +3690,7 @@ sufficient to handle not only curves embedded in an unbounded parameter space, but also curves embedded in a bounded parameter space with open boundaries. The arrangement type instantiated with a traits class that models the combined concept -`ArrangementOpenBoundaryTraits_2` shown in +`AosOpenBoundaryTraits_2` shown in \cgalFigureRef{aos_fig-open_concept_hierarchy} can handle curves that are open in any direction. Recall that an arrangement that supports unbounded \f$x\f$-monotone curves maintains an implicit bounding @@ -3650,20 +3700,21 @@ are expected to be unbounded; namely, there exists \f$d \in \{0,1\}\f$ such that \f$\lim_{t \rightarrow d}x(t) = \pm\infty\f$ or \f$\lim_{t \rightarrow d}y(t) = \pm\infty\f$ holds for at least one input curve \f$c(t) = (x(t),y(t))\f$, the arrangement template must be -instantiated with a model of the `ArrangementOpenBoundaryTraits_2` +instantiated with a model of the `AosOpenBoundaryTraits_2` concept.\cgalFootnote{A curve that reaches the boundary of the parameter space in this case is open and unbounded.} \cgalFigureBegin{aos_fig-spherical_concept_hierarchy,spherical_concept_hierarchy.png} -Bottom portion of the refinement hierarchy of the geometry-traits -concepts for curves embedded in a sphere-like parameterized surface +The entire spherical boundary cluster of the refinement hierarchy of the +geometry-traits concepts for curves embedded in a sphere-like parameterized +surface. \cgalFigureEnd A suitable geometry-traits component for arrangements embedded in surfaces homeomorphic to a sphere is a model of the combined concept -`ArrangementSphericalBoundaryTraits_2` shown in +`AosSphericalBoundaryTraits_2` shown in \cgalFigureRef{aos_fig-spherical_concept_hierarchy}. Here the two vertical sides of the parameter space are identified and the two horizontal sides are contracted. @@ -3678,9 +3729,9 @@ exists for the right, bottom, and top sides. The shared requirements for the four options of a side are collected -in abstract layers called `ArrangementLeftSideTraits_2`, -`ArrangementRightSideTraits_2`, `ArrangementBottomSideTraits_2`, and -`ArrangementTopSideTraits_2`; see, e.g., +in abstract layers called `AosLeftSideTraits_2`, +`AosRightSideTraits_2`, `AosBottomSideTraits_2`, and +`AosTopSideTraits_2`; see, e.g., \cgalFigureRef{aos_fig-left_side_cluster}. @@ -3694,8 +3745,8 @@ curves that either reach or approach horizontal sides. The shared requirements for the options of opposite sides are collected in two additional abstract layers called -`ArrangementVerticalSideTraits_2` and -`ArrangementHorizontalSideTraits_2`; see +`AosVerticalSideTraits_2` and +`AosHorizontalSideTraits_2`; see \cgalFigureRef{aos_fig-side_clusters}. @@ -3716,8 +3767,8 @@ of the parameter space and for curves that reach the identified top side of the parameter space do not exist either. Instead, the shared requirements for opposite identified sides are collected in two additional abstract concepts called -`ArrangementIdentifiedVerticalTraits_2` and -`ArrangementIdentifiedHorizontalTraits_2`; see +`AosIdentifiedVerticalTraits_2` and +`AosIdentifiedHorizontalTraits_2`; see \cgalFigureRef{aos_fig-identified_clusters}. The former lists requirements for operations that handle curves that reach identified vertical sides of the parameter space, and the latter lists @@ -3727,12 +3778,12 @@ horizontal sides of the parameter space. In the following we list the specific requirements of all the aforementioned concepts. -The abstract concept `ArrangementVerticalSideTraits_2` requires the +The abstract concept `AosVerticalSideTraits_2` requires the following predicate:
    -
    \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink: +
    \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink:
    This three-valued predicate is overloaded with two versions as follows: @@ -3762,18 +3813,18 @@ in between. Return `CGAL::ARR_LEFT_BOUNDARY`, min},x_{\rm max}\}\f$, then the boundary side containing \f$p\f$ cannot be open and must not be identified. In other words, this overloaded version is required only for the concepts -`ArrangementClosedLeftTraits_2`, `ArrangementClosedRightTraits_2`, -`ArrangementContractedLeftTraits_2` and -`ArrangementContractedRightTraits_2`. +`AosClosedLeftTraits_2`, `AosClosedRightTraits_2`, +`AosContractedLeftTraits_2` and +`AosContractedRightTraits_2`.
    -The abstract concept `ArrangementHorizontalSideTraits_2` requires the +The abstract concept `AosHorizontalSideTraits_2` requires the following predicate:
    -
    \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink: +
    \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink:
    This three-valued predicate is overloaded with two versions as follows: @@ -3803,9 +3854,9 @@ in between. Return `CGAL::ARR_BOTTOM_BOUNDARY`, min},y_{\rm max}\}\f$, then the boundary side containing \f$p\f$ cannot be open and must not be identified. In other words, this overloaded version is required only for the concepts -`ArrangementClosedBottomTraits_2`, `ArrangementClosedTopTraits_2`, -`ArrangementContractedBottomTraits_2` and -`ArrangementContractedTopTraits_2`. +`AosClosedBottomTraits_2`, `AosClosedTopTraits_2`, +`AosContractedBottomTraits_2` and +`AosContractedTopTraits_2`.
    @@ -3822,14 +3873,14 @@ asymmetry is also reflected in the predicates listed below. They help determining the order of curve-ends lying on the boundary of the parameter space with respect to regular points and among each other. -The concepts `ArrangementClosedLeftTraits_2`, -`ArrangementClosedRightTraits_2`, and -`ArrangementIdentifiedVerticalTraits_2` require the following +The concepts `AosClosedLeftTraits_2`, +`AosClosedRightTraits_2`, and +`AosIdentifiedVerticalTraits_2` require the following additional predicate:
    -
    \link ArrangementIdentifiedVerticalTraits_2::Compare_y_on_boundary_2 `Compare_y_on_boundary_2`\endlink: +
    \link AosIdentifiedVerticalTraits_2::Compare_y_on_boundary_2 `Compare_y_on_boundary_2`\endlink:
    Given two points \f$p_1=(x_{p_1},y_{p_1})\f$ and \f$p_2=(x_{p_2},y_{p_2})\f$, such that at least one of them lies on a @@ -3840,16 +3891,16 @@ min},x_{\rm max}\}\f$ (resp. \f$x_{p_2} \in \{x_{\rm min},x_{\rm max}\}\f$), then the vertical boundary side containing \f$p_1\f$ (resp. \f$p_2\f$) must be either closed or identified. In other words, this overloaded version is required only for the concepts -`ArrangementClosedLeftTraits_2`, `ArrangementClosedRightTraits_2`, and -`ArrangementIdentifiedVerticalTraits_2`. +`AosClosedLeftTraits_2`, `AosClosedRightTraits_2`, and +`AosIdentifiedVerticalTraits_2`.
    -The concept `ArrangementVerticalSideTraits_2` requires the following additional predicate: +The concept `AosVerticalSideTraits_2` requires the following additional predicate:
    -
    \link ArrangementVerticalSideTraits_2::Compare_y_near_boundary_2 `Compare_y_near_boundary_2`\endlink: +
    \link AosVerticalSideTraits_2::Compare_y_near_boundary_2 `Compare_y_near_boundary_2`\endlink:
    @@ -3881,12 +3932,12 @@ boundary-side in a similar manner. -The concept `ArrangementHorizontalSideTraits_2` requires two additional +The concept `AosHorizontalSideTraits_2` requires two additional predicates:
    -
    \link ArrangementHorizontalSideTraits_2::Compare_x_on_boundary_2 `Compare_x_on_boundary_2`\endlink: +
    \link AosHorizontalSideTraits_2::Compare_x_on_boundary_2 `Compare_x_on_boundary_2`\endlink:
    This predicate is overloaded with three versions. We distinguish between open and non-open sides as explained below. @@ -3940,10 +3991,10 @@ min},y_{\rm max}\}\f$ (resp. \f$y_{p_2} \in \{y_{\rm min},y_{\rm max}\}\f$), then the boundary side containing \f$p_1\f$ (resp. \f$p_2\f$) must be either closed or identified. In other words, this overloaded version is required only for the concepts -`ArrangementClosedBottomTraits_2`, `ArrangementClosedTopTraits_2`, -and `ArrangementIdentifiedHorizontalTraits_2`. +`AosClosedBottomTraits_2`, `AosClosedTopTraits_2`, +and `AosIdentifiedHorizontalTraits_2`. -
    \link ArrangementHorizontalSideTraits_2::Compare_x_near_boundary_2 +
    \link AosHorizontalSideTraits_2::Compare_x_near_boundary_2 `Compare_x_near_boundary_2`\endlink:
    @@ -3980,12 +4031,12 @@ boundary-side, \f$p\f$ is located far to the top in a similar manner.
    -The concept `ArrangementIdentifiedVerticalTraits_2` requires the following +The concept `AosIdentifiedVerticalTraits_2` requires the following additional predicate:
    -
    \link ArrangementIdentifiedVerticalTraits_2::Is_on_y_identification_2 `Is_on_y_identification_2`\endlink: +
    \link AosIdentifiedVerticalTraits_2::Is_on_y_identification_2 `Is_on_y_identification_2`\endlink:
    This predicate is overloaded with two versions. @@ -4000,12 +4051,12 @@ boundary.
    -Similarly, the concept `ArrangementIdentifiedHorizontalTraits_2` +Similarly, the concept `AosIdentifiedHorizontalTraits_2` requires the following additional predicate:
    -
    \link ArrangementIdentifiedHorizontalTraits_2::Is_on_x_identification_2 `Is_on_x_identification_2`\endlink: +
    \link AosIdentifiedHorizontalTraits_2::Is_on_x_identification_2 `Is_on_x_identification_2`\endlink:
    This predicate is overloaded with two versions. @@ -4142,14 +4193,14 @@ template that handles line segments, namely the `Arr_non_caching_segment_basic_traits_2` class template. This class template and the `Arr_segment_traits_2` class template are both parameterized by a geometric kernel and model the concepts -`ArrangementTraits_2` and `ArrangementLandmarkTraits_2`. +`AosTraits_2` and `AosLandmarkTraits_2`. \cgalFootnote{They also model the refined concept -\cgalFootnoteCode{ArrangementDirectionalXMonotoneTraits_2}, which enables Boolean set +\cgalFootnoteCode{AosDirectionalXMonotoneTraits_2}, which enables Boolean set operations; see Package \ref PkgBooleanSetOperations2Ref.} The class template `Arr_non_caching_segment_traits_2` derives from the instance `Arr_non_caching_segment_basic_traits_2`, which -models the `ArrangementLandmarkTraits_2` traits concept but not the -refined `ArrangementXMonotoneTraits_2` concept. Like the +models the `AosLandmarkTraits_2` traits concept but not the +refined `AosXMonotoneTraits_2` concept. Like the `Arr_segment_traits_2` class template it derives from the `Kernel` type. Unlike the `Arr_segment_traits_2` class template it defines its point and segment types as `Kernel::Point_2` and `Kernel::Segment_2`, @@ -4196,8 +4247,8 @@ The `Arr_linear_traits_2` class used in Section \ref aos_sec-unbounded for demonstrating the construction of arrangements of unbounded curves is capable of handling bounded and unbounded linear objects, namely, lines, rays, and line segments. It models the -concepts `ArrangementTraits_2`, `ArrangementLandmarkTraits_2`, and -`{ArrangementOpenBoundaryTraits_2`. It is parameterized by a geometric +concepts `AosTraits_2`, `AosLandmarkTraits_2`, and +`{AosOpenBoundaryTraits_2`. It is parameterized by a geometric kernel and its nested \link Arr_linear_traits_2::Point_2 `Point_2`\endlink type is defined to be the kernel-point type. The \link Arr_linear_traits_2::Curve_2 `Curve_2`\endlink (and \link @@ -4241,13 +4292,13 @@ arr_sssectr_polycurves. The `Arr_polyline_traits_2` class template handles polylines. It models the following four concepts: -- `ArrangementTraits_2`, +- `AosTraits_2`, -- `ArrangementDirectionalXMonotoneTraits_2` +- `AosDirectionalXMonotoneTraits_2` -- `ArrangementConstructXMonotoneCurveTraits_2`, and +- `AosConstructXMonotoneCurveTraits_2`, and -- `ArrangementConstructCurveTraits_2`. +- `AosConstructCurveTraits_2`. The type that substitutes the template parameter `SubcurveTraits_2` when `Arr_polyline_traits_2` is instantiated must be @@ -4255,16 +4306,16 @@ a geometry-traits class that models the same four concepts. We refer to the type that substitutes the template parameter `SubcurveTraits_2` as the subcurve traits hereafter. If, in addition, the subcurve traits also models the concept -`ArrangementApproximateTraits_2` then the instantiated +`AosApproximatePointTraits_2` then the instantiated `Arr_polyline_traits_2` type models the concept -`ArrangementApproximateTraits_2` as well. (By definition, modeling the -concepts `ArrangementApproximateTraits_2` and -`ArrangementConstructXMonotoneCurveTraits_2` implies modeling the -concept `ArrangementLandmarkTraits_2`.) Similarly, if the subcurve -traits also models the concept `ArrangementOpenBoundaryTraits_2` then +`AosApproximatePointTraits_2` as well. (By definition, modeling the +concepts `AosApproximatePointTraits_2` and +`AosConstructXMonotoneCurveTraits_2` implies modeling the +concept `AosLandmarkTraits_2`.) Similarly, if the subcurve +traits also models the concept `AosOpenBoundaryTraits_2` then the instantiated `Arr_polyline_traits_2` type models -the concept `ArrangementOpenBoundaryTraits_2` as well. Modeling the -`ArrangementConstructXMonotoneCurveTraits_2` concept implies that the +the concept `AosOpenBoundaryTraits_2` as well. Modeling the +`AosConstructXMonotoneCurveTraits_2` concept implies that the subcurve traits must support the construction of a unique (\f$x\f$-monotone) segment given two input points. @@ -4402,14 +4453,14 @@ template, instantiated with the predefined filtered kernel. #include #include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Number_type = Kernel::FT; -typedef CGAL::Arr_segment_traits_2 Segment_traits; -typedef CGAL::Arr_polyline_traits_2 Traits; -typedef Traits::Point_2 Point; -typedef Traits::Curve_2 Polyline; -typedef CGAL::Arrangement_2 Arrangement; +using Segment_traits = CGAL::Arr_segment_traits_2; +using Traits = CGAL::Arr_polyline_traits_2; +using Point = Traits::Point_2; +using Polyline = Traits::Curve_2; +using Arrangement = CGAL::Arrangement_2; \endcode @@ -4427,8 +4478,8 @@ is continuous. As a matter of fact, most characteristics of the also to the `Arr_polycurve_traits_2` traits class template. The only difference between the two, is that the latter is not a model of the concepts -`ArrangementConstructXMonotoneCurveTraits_2` nor -`ArrangementConstructCurveTraits_2`, and as such, it is not +`AosConstructXMonotoneCurveTraits_2` nor +`AosConstructCurveTraits_2`, and as such, it is not able to construct a subcurve from only two points. As a consequence, it does not support the operations that (i) construct a polycurve from a sequence of points, and (ii) push a point at the back or at the @@ -4537,10 +4588,10 @@ are rational). The \ref PkgArrangementOnSurface2 package offers a traits class-template called `Arr_circle_segment_traits_2` that exclusively handles line segments, circular arcs, and whole circles -and models the concepts `ArrangementTraits_2` and -`ArrangementDirectionalXMonotoneTraits_2`; see Package \ref +and models the concepts `AosTraits_2` and +`AosDirectionalXMonotoneTraits_2`; see Package \ref PkgBooleanSetOperations2Ref. Note that it is not a model of the -`ArrangementLandmarkTraits_2` concept. It exploits efficient +`AosLandmarkTraits_2` concept. It exploits efficient computations with square root numbers, which makes it attractive for arrangements induced by line segments, circular arcs, and whole circles. When the traits class-template is instantiated, the `Kernel` @@ -4591,16 +4642,16 @@ performance further. #include #include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; -typedef CGAL::Arr_circle_segment_traits_2 Traits; -typedef Traits::CoordNT CoordNT; -typedef Traits::Point_2 Point; -typedef Traits::Curve_2 Curve; -typedef Traits::Rational_point_2 Rational_point; -typedef Traits::Rational_segment_2 Segment; -typedef Traits::Rational_circle_2 Circle; -typedef CGAL::Arrangement_2 Arrangement; +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Number_type = Kernel::FT; +using Traits = CGAL::Arr_circle_segment_traits_2; +using CoordNT = Traits::CoordNT; +using Point = Traits::Point_2; +using Curve = Traits::Curve_2; +using Rational_point = Traits::Rational_point_2; +using Segment = Traits::Rational_segment_2; +using Circle = Traits::Rational_circle_2; +using Arrangement = CGAL::Arrangement_2; \endcode The \link Arr_circle_segment_traits_2::Curve_2 `Curve_2`\endlink type @@ -4762,8 +4813,8 @@ type traits-class, then use them to define the conic traits class-template. Also note the types defined by the rational kernels, which we need for conveniently constructing conic arcs. -The `Arr_conic_traits_2` models the `ArrangementTraits_2` and -`ArrangementLandmarkTraits_2` concepts. Its \link +The `Arr_conic_traits_2` models the `AosTraits_2` and +`AosLandmarkTraits_2` concepts. Its \link Arr_conic_traits_2::Point_2 `Point_2`\endlink type is derived from `AlgKernel::Point_2`, while the \link Arr_conic_traits_2::Curve_2 `Curve_2`\endlink type represents a bounded, not necessarily @@ -4866,7 +4917,7 @@ they have another intersection point at A rational function is given by the equation \f$y = \frac{P(x)}{Q(x)}\f$, where \f$P\f$ and \f$Q\f$ are polynomials of -arbitrary degrees. In particular, if \f$ Q(x) = 1\f$, then the +arbitrary degrees. In particular, if \f$Q(x) = 1\f$, then the function is simply a polynomial function. A bounded rational arc is defined by the graph of a rational function over some interval \f$[x_{\rm min}, x_{\rm max}]\f$, where \f$Q\f$ does not have @@ -4882,12 +4933,12 @@ more complicated curves and for interpolation; see, e.g., Using the `Arr_rational_function_traits_2` class template it is possible to construct and maintain arrangements induced by rational arcs. Every instance of the `Arr_rational_function_traits_2` class -template models the concepts `ArrangementTraits_2` and -`ArrangementOpenBoundaryTraits_2`, but it does not model the -`ArrangementLandmarkTraits_2` concept. It also models the refined -concept `ArrangementDirectionalXMonotoneTraits_2`, which enables +template models the concepts `AosTraits_2` and +`AosOpenBoundaryTraits_2`, but it does not model the +`AosLandmarkTraits_2` concept. It also models the refined +concept `AosDirectionalXMonotoneTraits_2`, which enables Boolean set operations; see Package \ref PkgBooleanSetOperations2Ref. -Note that it is not a model of `ArrangementLandmarkTraits_2` concept, +Note that it is not a model of `AosLandmarkTraits_2` concept, so it is impossible to use the landmark point-location strategy with this traits class. @@ -4908,7 +4959,7 @@ depicted in \cgalFigureRef{aos_fig-rat_func_singular}. This arc has two singularities, at \f$x = 1\f$ and at \f$x = 2\f$. It is split into three continuous portions defined over the intervals \f$[0,1)\f$, \f$(1,2)\f$, and \f$(2,3]\f$ by the traits operation \link -ArrangementTraits_2::Make_x_monotone_2 +AosTraits_2::Make_x_monotone_2 `Make_x_monotone_2`\endlink. Arbitrary rational functions are represented by the nested type \link Arr_rational_function_traits_2::Curve_2 `Curve_2`\endlink and @@ -4967,15 +5018,15 @@ are defined in the header file `arr_rat_functions.h`. #include #include -typedef CORE::BigInt Number_type; -typedef CGAL::Algebraic_kernel_d_1 AK1; -typedef CGAL::Arr_rational_function_traits_2 Traits; +using Number_type = CORE::BigInt; +using AK1 = CGAL::Algebraic_kernel_d_1; +using Traits = CGAL::Arr_rational_function_traits_2; -typedef Traits::Polynomial_1 Polynomial; -typedef Traits::Algebraic_real_1 Alg_real; -typedef Traits::Bound Bound; +using Polynomial = Traits::Polynomial_1; +using Alg_real = Traits::Algebraic_real_1; +using Bound = Traits::Bound; -typedef CGAL::Arrangement_2 Arrangement; +using Arrangement = CGAL::Arrangement_2; \endcode The constructed rational functions are cached by the traits class. The @@ -5081,17 +5132,17 @@ header file `arr_Bezier.h`. #include #include -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational NT; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef CGAL::Cartesian Alg_kernel; -typedef Rat_kernel::Point_2 Rat_point; -typedef CGAL::Arr_Bezier_curve_traits_2 - Traits; -typedef Traits::Curve_2 Bezier_curve; -typedef CGAL::Arrangement_2 Arrangement; +using Nt_traits = CGAL::CORE_algebraic_number_traits; +using NT = Nt_traits::Rational; +using Rational = Nt_traits::Rational; +using Algebraic = Nt_traits::Algebraic; +using Rat_kernel = CGAL::Cartesian; +using Alg_kernel = CGAL::Cartesian; +using Rat_point = Rat_kernel::Point_2; +using Traits = + CGAL::Arr_Bezier_curve_traits_2; +using Bezier_curve = Traits::Curve_2; +using Arrangement = CGAL::Arrangement_2; \endcode As mentioned above, we assume that the coordinates of all control @@ -5113,9 +5164,9 @@ Arr_Bezier_curve_traits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink types defined by the traits class. Every instance of the `Arr_Bezier_curve_traits_2` class templates -models the concept `ArrangementTraits_2` (but it does not model the -`ArrangementLandmarkTraits_2` concept). It also models the refined -concept `ArrangementDirectionalXMonotoneTraits_2`, which enables +models the concept `AosTraits_2` (but it does not model the +`AosLandmarkTraits_2` concept). It also models the refined +concept `AosDirectionalXMonotoneTraits_2`, which enables Boolean set operations; see Package \ref PkgBooleanSetOperations2Ref. @@ -5170,9 +5221,9 @@ either vertical or a closed connected point set, with all interior points parameterizable in \f$x\f$. Every instance of the `Arr_algebraic_segment_traits_2` -class template models the `ArrangementTraits_2` and -`ArrangementOpenBoundaryTraits_2` concepts (but it does not model the -`ArrangementLandmarkTraits_2` concept). The template argument +class template models the `AosTraits_2` and +`AosOpenBoundaryTraits_2` concepts (but it does not model the +`AosLandmarkTraits_2` concept). The template argument `Coefficient` determines the type of the scalar coefficients of the polynomial. Currently supported integral number types are `Gmpz`, `leda_integer`, and `CORE::BigInt`. This is reflected in the @@ -5240,12 +5291,12 @@ A weakly \f$x\f$-monotone segment of an algebraic curve is represented by the \link Arr_algebraic_segment_traits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink type nested in the traits class-template. You can construct such segments in two ways as -follows: (i) using the \link ArrangementTraits_2::Make_x_monotone_2 +follows: (i) using the \link AosTraits_2::Make_x_monotone_2 `Make_x_monotone_2`\endlink functor or (ii) using the \link Arr_algebraic_segment_traits_2::Construct_x_monotone_segment_2 `Construct_x_monotone_segment_2`\endlink functor. Both functors are nested in the traits class-template. The former is required by the -concept `ArrangementTraits_2` our traits class models; see Section +concept `AosTraits_2` our traits class models; see Section \ref aos_sssec-geom_traits-concepts_arbitrary. The latter enables the construction of individual segments. The \link Arr_algebraic_segment_traits_2::X_monotone_curve_2 @@ -5379,7 +5430,7 @@ segments in Euclidean geometry. The `Arr_geodesic_arc_on_sphere_traits_2` class template handles arcs of great circles (also known as geodesic arcs) of a unit sphere (centered at the origin in \f$\mathbb{R}^3\f$). It is a model of the -concept `ArrangementSphericalBoundaryTraits_2`; see Section \ref +concept `AosSphericalBoundaryTraits_2`; see Section \ref aos_ssec-traits-curved. An arrangement type (an instance of the template `Arrangement_on_surface_2`) that uses an instance of this traits class as the geometry traits must use @@ -5520,8 +5571,8 @@ nested types are defined as follows: CopyConstructible, EqualityComparable, and DefaultConstructible. The latter ensures that every instance of the class template `Arr_curve_data_traits_2` obtained by substituting the `BaseTraits` - template parameter with a model of the `ArrangementLandmarkTraits_2` - concept models the `ArrangementLandmarkTraits_2` concept as well + template parameter with a model of the `AosLandmarkTraits_2` + concept models the `AosLandmarkTraits_2` concept as well @@ -5669,7 +5720,7 @@ program. The tracing traits supports filtering of traced functors. The calls `traits.enable_trace(id)` and `traits.disable_trace(id)` enables and disables the tracing of a functor identified by `id`, respectively. A functor is identified by an enumeration. For example, -the functor \link ArrangementTraits_2::Make_x_monotone_2 +the functor \link AosTraits_2::Make_x_monotone_2 `Make_x_monotone_2`\endlink is identified by the enumeration `Arr_tracing_traits_2::MAKE_X_MONOTONE_OP`. The calls `traits.enable_all_traces()` and `traits.disable_all_traces()` enables @@ -5687,7 +5738,7 @@ topological entities and the implementation of the functions that handle these topological entities, used by the `Arrangement_on_surface_2` class template and by the peripheral modules. Every topology traits class -must model the basic concept `ArrangementBasicTopologyTraits`. A model +must model the basic concept `AosBasicTopologyTraits`. A model of this basic concept holds the (\dcel) data structure used to represent the arrangement cells (i.e., vertices, edges, and facets) and the incidence relations between them. At this point we do not @@ -6031,8 +6082,8 @@ In such cases you may explicitly extend the base \dcel class-template, as described in the next paragraph, or implement your own \dcel class from scratch and use the resulting \dcel to instantiate the `Arrangement_2` class template. In any case such a -class must model the concept `ArrangementDcel` or its refinement -`ArrangementDcelWithRebind`. The latter requires a `rebind` struct +class must model the concept `AosDcel` or its refinement +`AosDcelWithRebind`. The latter requires a `rebind` struct template, which implements a policy-clone idiom. Here, the \dcel class is the policy class and the `rebind` member template struct is used to pass a different traits type parameter to the policy class @@ -6347,17 +6398,16 @@ header file `Overlay_color_traits.h`. \code{.cpp} template struct Overlay_color_traits { - typedef unsigned int Color; - typedef typename Arrangement::Vertex_const_handle V_const_handle; - typedef typename Arrangement::Halfedge_const_handle H_const_handle; - typedef typename Arrangement::Face_const_handle F_const_handle; - typedef typename Arrangement::Vertex_handle V_handle; - typedef typename Arrangement::Halfedge_handle H_handle; - typedef typename Arrangement::Face_handle F_handle; + using Color = unsigned int; + using V_const_handle = typename Arrangement::Vertex_const_handle; + using H_const_handle = typename Arrangement::Halfedge_const_handle; + using F_const_handle = typename Arrangement::Face_const_handle; + using V_handle = typename Arrangement::Vertex_handle; + using H_handle = typename Arrangement::Halfedge_handle; + using F_handle = typename Arrangement::Face_handle; // Compute the average of the red, green, and blue components separately. - Color blend(Color color1, Color color2) const - { + Color blend(Color color1, Color color2) const { return ((((color1 & 0x000000ff) + (color2 & 0x000000ff)) / 2) & 0x000000ff) | ((((color1 & 0x0000ff00) + (color2 & 0x0000ff00)) / 2) & 0x0000ff00) | @@ -6446,12 +6496,12 @@ between these curves and the arrangement edges they induce. Similarly, the `Arrangement_with_history_2` class-template extends the `Arrangement_2` class template. The `GeometryTraits` template parameter, of either class templates, must -be substituted by a model of the `ArrangementTraits_2` concept; see +be substituted by a model of the `AosTraits_2` concept; see Section \ref aos_ssec-insert_gen. It should define the \link -ArrangementTraits_2::Curve_2 `Curve_2`\endlink type and support its -subdivision into \link ArrangementBasicTraits_2::X_monotone_curve_2 +AosTraits_2::Curve_2 `Curve_2`\endlink type and support its +subdivision into \link AosBasicTraits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink objects, among the others. The `Dcel` -parameter must be substituted by a model of the `ArrangementDcel` +parameter must be substituted by a model of the `AosDcel` concept. You can use either the default \dcel class or an extended \dcel class (see Section \ref arr_ssecex_dcel) based on your needs. An arrangement that support the cross-mapping mentioned above is referred @@ -6686,8 +6736,8 @@ predefined \ascii format that encodes the arrangement topology, as well as all geometric entities associated with vertices and edges. The ability to use the input/output operators, requires that the \link -ArrangementBasicTraits_2::Point_2 `Point_2`\endlink type and the \link -ArrangementBasicTraits_2::X_monotone_curve_2 +AosBasicTraits_2::Point_2 `Point_2`\endlink type and the \link +AosBasicTraits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink type defined by the traits class both support the `<<` and `>>` operators. The `Arr_conic_traits_2` class (see Section \ref arr_sssectr_conic), the @@ -6754,7 +6804,7 @@ from a file: \cgalExample{Arrangement_on_surface_2/dcel_extension_io.cpp} You may develop your own formatter classes - models of the -`ArrangementInputFormatter` and `ArrangementOutputFormatter` +`AosInputFormatter` and `AosOutputFormatter` concepts, as defined in the Reference Manual. Doing so, you can define other I/O formats, such as an XML-based format or a binary format. @@ -6931,15 +6981,15 @@ and returns it. The functor template is defined in the header file #include #include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Number_type = Kernel::FT; template struct Edge_length { // Boost property-type definitions. - typedef boost::readable_property_map_tag category; - typedef Number_type value_type; - typedef value_type reference; - typedef typename Arrangement::Halfedge_handle key_type; + using category = boost::readable_property_map_tag; + using value_type = Number_type; + using reference = value_type; + using key_type = typename Arrangement::Halfedge_handle; value_type operator()(typename Arrangement::Halfedge_handle e) const { const auto diff_x = e->target()->point().x() - e->source()->point().x(); @@ -7022,13 +7072,13 @@ header file `Extended_face_property_map.h` listed below. // A property map that reads/writes the information to/from the extended face. template class Extended_face_property_map { public: - typedef typename Arrangement::Face_handle Face_handle; + using Face_handle = typename Arrangement::Face_handle; // Boost property type definitions. - typedef boost::read_write_property_map_tag category; - typedef Type value_type; - typedef value_type& reference; - typedef Face_handle key_type; + using category = boost::read_write_property_map_tag; + using value_type = Type; + using reference = value_type&; + using key_type = Face_handle; // The get function is required by the property map concept. friend reference get(const Extended_face_property_map& map, key_type key) diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Aos_observer.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Aos_observer.h index 2f21f4a886c..95839a6c344 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Aos_observer.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Aos_observer.h @@ -23,26 +23,25 @@ namespace CGAL { template class Aos_observer { public: - /// \name Types /// @{ - //! the type of the associated arrangement. + /// the type of the associated arrangement. typedef unspecified_type Arrangement_2; - //! the point type. + /// the point type. typedef typename Arrangement_2::Point_2 Point_2; - //! the \f$x\f$-monotone curve type. + /// the \f$x\f$-monotone curve type. typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; - //! the type of a handle to an arrangement vertex. + /// the type of a handle to an arrangement vertex. typedef typename Arrangement_2::Vertex_handle Vertex_handle; - //! the type of a handle to an arrangement halfedge. + /// the type of a handle to an arrangement halfedge. typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; - //! the type of a handle to an arrangement face. + /// the type of a handle to an arrangement face. typedef typename Arrangement_2::Face_handle Face_handle; /*! represents a connected component of the boundary (CCB), either an outer @@ -77,11 +76,11 @@ public: /// \name Notifications on Global Arrangement Operations /// @{ - /*! issued just before the attached arrangement is assigned with the contents of another - * arrangement. - * \param arr The other arrangement. Notice that the arrangement type is the type used to - * instantiate the observer, which is conveniently defined as - * `Arrangement_2::Base_aos`. + /*! issued just before the attached arrangement is assigned with the contents + * of another arrangement. + * \param arr The other arrangement. Notice that the arrangement type is the + * type used to instantiate the observer, which is conveniently + * defined as `Arrangement_2::Base_aos`. */ virtual void before_assign(const typename Arrangement_2::Base_aos& arr); @@ -419,6 +418,6 @@ public: virtual void after_remove_inner_ccb(Face_handle f); /// @} - }; /* end Aos_observer */ + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_Bezier_curve_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_Bezier_curve_traits_2.h index 7976f939c74..671cb517e79 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_Bezier_curve_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_Bezier_curve_traits_2.h @@ -1,303 +1,265 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * The traits class `Arr_Bezier_curve_traits_2` is a model of the `AosTraits_2` + * concept that handles planar Bézier curves. A planar Bézier + * curve \f$B\f$ is a parametric curve defined by a sequence of control + * points \f$p_0, \ldots, p_n\f$ as follows: -The traits class `Arr_Bezier_curve_traits_2` is a model of the `ArrangementTraits_2` -concept that handles planar Bézier curves. A planar Bézier curve -\f$ B\f$ is a parametric curve defined by a sequence of control points -\f$ p_0, \ldots, p_n\f$ as follows: - - -\f{eqnarray*}{ -B(t) = \left(X(t), Y(t)\right) -= \ccSum{k=0}{n}{p_k \cdot \frac{n!}{k! (n-k)!} \cdot -t^k (1-t)^{n-k}}\ . + * \f{eqnarray*}{ + * B(t) = \left(X(t), Y(t)\right) = \ccSum{k=0}{n}{p_k \cdot \frac{n!}{k! (n-k)!} \cdot t^k (1-t)^{n-k}}\ , \f} -where \f$ t \in [0, 1]\f$. The degree of the curve is therefore \f$ n\f$ - -namely, \f$ X(t)\f$ and \f$ Y(t)\f$ are polynomials of degree \f$ n\f$. Bézier curves -have numerous applications in computer graphics and solid modelling. They -are used, for example, in free-form sketches and for defining the true-type -fonts. + * where \f$t \in [0, 1]\f$. The degree of the curve is therefore \f$n\f$, + * namely, \f$X(t)\f$ and \f$Y(t)\f$ are polynomials of degree \f$n\f$. + * Bézier curves have numerous applications in computer graphics and + * solid modelling. They are used, for example, in free-form sketches and for + * defining the true-type fonts. -In our representation, we assume that the coordinates of all control -points are rational numbers (namely they are given as objects of the -`RatKernel::Point_2` type), so both \f$ X(t)\f$ and \f$ Y(t)\f$ are polynomials -with rational coefficients. The intersection points between curves are -however algebraic numbers, and their exact computation is time-consuming. -The traits class therefore contains a layer of geometric filtering that -performs all computation in an approximate manner whenever possible, and -it resorts to exact computations only when the approximate computation -fails to produce an unambiguous result. + * In our representation, we assume that the coordinates of all control points + * are rational numbers (namely they are given as objects of the + * `RatKernel::Point_2` type), so both \f$X(t)\f$ and \f$Y(t)\f$ are + * polynomials with rational coefficients. The intersection points between + * curves are however algebraic numbers, and their exact computation is + * time-consuming. The traits class therefore contains a layer of geometric + * filtering that performs all computation in an approximate manner whenever + * possible, and it resorts to exact computations only when the approximate + * computation fails to produce an unambiguous result. -We therefore require separate representations of the control points and -the intersection points. The `NtTraits` should be instantiated with a class -that defines nested `Integer`, `Rational` and `Algebraic` number -types and supports various operations on them, yielding certified computation -results (for example, in can convert rational numbers to algebraic numbers -and can compute roots of polynomials with integer coefficients). -The other template parameters, `RatKernel` and `AlgKernel` should be -geometric kernels templated with the `NtTraits::Rational` and -`NtTraits::Algebraic` number types, respectively. It is recommended to -instantiate the `CORE_algebraic_number_traits` class as the `NtTraits` -parameter, with `Cartesian` and -`Cartesian` instantiating the two kernel types, -respectively. The number types in this case are provided by the \core -library, with its ability to exactly represent simple algebraic numbers. + * We therefore require separate representations of the control points and the + * intersection points. The `NtTraits` should be instantiated with a class that + * defines nested `Integer`, `Rational` and `Algebraic` number types and + * supports various operations on them, yielding certified computation results + * (for example, in can convert rational numbers to algebraic numbers and can + * compute roots of polynomials with integer coefficients). The other template + * parameters, `RatKernel` and `AlgKernel` should be geometric kernels templated + * with the `NtTraits::Rational` and `NtTraits::Algebraic` number types, + * respectively. It is recommended to instantiate the + * `CORE_algebraic_number_traits` class as the `NtTraits` parameter, with + * `Cartesian` and `Cartesian` + * instantiating the two kernel types, respectively. The number types in this + * case are provided by the \core library, with its ability to exactly represent + * simple algebraic numbers. -While `Arr_Bezier_curve_traits_2` models the concept -`ArrangementDirectionalXMonotoneTraits_2`, the implementation of -the `Are_mergeable_2` operation does not enforce the input curves -to have the same direction as a precondition. Moreover, `Arr_Bezier_curve_traits_2` -supports the merging of curves of opposite directions. - -\cgalModels{ArrangementTraits_2,ArrangementDirectionalXMonotoneTraits_2} - - -*/ -template< typename RatKernel, typename AlgKernel, typename NtTraits > + * While `Arr_Bezier_curve_traits_2` models the concept + * `AosDirectionalXMonotoneTraits_2`, the implementation of the + * `Are_mergeable_2` operation does not enforce the input curves to have the + * same direction as a precondition. Moreover, `Arr_Bezier_curve_traits_2` + * supports the merging of curves of opposite directions. + * + * \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2} + */ +template class Arr_Bezier_curve_traits_2 { public: -/// \name Types -/// @{ + /// \name Types + /// @{ -/*! -the `NtTraits::Rational` type -(and also the `RatKernel::FT` type). -*/ -typedef unspecified_type Rational; + /*! the `NtTraits::Rational` type (and also the `RatKernel::FT` type). + */ + typedef unspecified_type Rational; -/*! -the `NtTraits::Algebraic` type -(and also the `AlgKernel::FT` type). -*/ -typedef unspecified_type Algebraic; + /*! the `NtTraits::Algebraic` type (and also the `AlgKernel::FT` type). + */ + typedef unspecified_type Algebraic; -/// @} + /// @} + /*! The `Curve_2` class nested within the Bézier traits class is used + * to represent a Bézier curve of arbitrary degree, which is defined by + * a sequence of rational control points. In addition to the methods listed + * below, the I/O operators \link PkgArrangementOnSurface2op_left_shift + * `operator<<` \endlink and \link PkgArrangementOnSurface2op_right_shift + * `operator>>` \endlink for standard output-streams are also supported. The + * copy constructor and assignment operator are supported as well. + */ + class Curve_2 { + public: -/*! + /// \name Creation + /// @{ + /*! default constructor. + */ + Curve_2(); -The `Curve_2` class nested within the Bézier traits class is used -to represent a Bézier curve of arbitrary degree, which is defined by a -sequence of rational control points. In addition to the methods listed -below, the I/O operators \link PkgArrangementOnSurface2op_left_shift `operator<<` \endlink and \link PkgArrangementOnSurface2op_right_shift `operator>>` \endlink for -standard output-streams are also supported. The copy constructor and -assignment operator are supported as well. + /*! constructs a Bézier curve as defined by the given range of + * control points. The value-type of `InputIterator` is + * `RatKernel::Point_2`. + * + * \pre The input range must contain at least two control points. + */ + template + Curve_2(InputIterator pts_begin, InputIterator pts_end); -*/ -class Curve_2 { -public: + /// @} -/// \name Creation -/// @{ + /// \name Access Functions + /// @{ -/*! -default constructor. -*/ -Curve_2 (); + /*! returns the number of control points that define `B`. + */ + std::size_t number_of_control_points() const; -/*! -constructs a Bézier curve as defined by the given range of control -points. The value-type of `InputIterator` is `RatKernel::Point_2`. -\pre The input range must contain at least two control points. + /*! returns the \f$k\f$th control point. Note that the first control point + * equals the curve source, while the last control point equals its + * target. The rest of the control points do not lie on the curve. + * + * \pre \f$k\f$ is smaller than the number of control points. + */ + typename RatKernel::Point_2 control_point(std::size_t k) const; -*/ -template -Curve_2 (InputIterator pts_begin, InputIterator pts_end); + /*! returns the point \f$B(t)\f$ on the curve that corresponds to the given + * rational parameter value. + */ + typename RatKernel::Point_2 operator()(const Rational& t) const; -/// @} + /*! returns the point \f$B(t)\f$ on the curve that corresponds to the given + * algebraic parameter value. + */ + typename AlgKernel::Point_2 operator()(const Algebraic& t) const; -/// \name Access Functions -/// @{ + /// @} -/*! -returns the number of control points that define `B`. -*/ -size_t number_of_control_points () const; + }; /* end Arr_Bezier_curve_traits_2::Curve_2 */ -/*! -returns the \f$ k\f$th control point. Note that the first control point equals -the curve source, while the last control point equals its target. The rest -of the control points do not lie on the curve. -\pre \f$ k\f$ is smaller than the number of control points. -*/ -typename RatKernel::Point_2 control_point (size_t k) const; + /*! The `Point_2` class nested within the Bézier traits class is used + * to represent: (i) an endpoint of a Bézier curve, (ii) a vertical + * tangency point of a curve, used to subdivide it into \f$x\f$-monotone + * subcurve, and (iii) an intersection point between two curves. While, points + * of type (i) have rational coordinates and are given as part of the input, + * points of the two latter types have algebraic coordinates. However, to + * speed up the arrangement construction, such point are not computed in an + * exact manner, and instead are given in an approximate representation. Note + * that the exact coordinates of a point may only be accessed if it is exactly + * computed. -/*! -returns the point \f$ B(t)\f$ on the curve that corresponds to the given -rational parameter value. -*/ -typename RatKernel::Point_2 operator() (const Rational& t) const; + * In addition to the methods listed below, the copy constructor and assignment + * operator for `Point_2` objects are also supported. + */ + class Point_2 { + public: -/*! -returns the point \f$ B(t)\f$ on the curve that corresponds to the given -algebraic parameter value. -*/ -typename AlgKernel::Point_2 operator() (const Algebraic& t) const; + /// \name Creation + /// @{ -/// @} + /*! + default constructor. + */ + Point_2(); -}; /* end Arr_Bezier_curve_traits_2::Curve_2 */ + /*! + constructs the point \f$B(t_0)\f$ on the given curve. As \f$t_0\f$ is an + algebraic number, the point has algebraic coordinates. + */ + Point_2(const Curve_2& B, const Algebraic& t_0); + /*! + constructs the point \f$B(t_0)\f$ on the given curve. As \f$t_0\f$ is a + rational number, the point has rational coordinates. + */ + Point_2(const Curve_2& B, const Rational& t_0); -/*! + /// @} -The `Point_2` class nested within the Bézier traits class is used -to represent: (i) an endpoint of a Bézier curve, (ii) a vertical tangency -point of a curve, used to subdivide it into \f$ x\f$-monotone subcurve, and -(iii) an intersection point between two curves. While, points of type (i) have -rational coordinates and are given as part of the input, points of the two -latter types have algebraic coordinates. However, to speed up the arrangement -construction, such point are not computed in an exact manner, and instead -are given in an approximate representation. Note that the exact coordinates -of a point may only be accessed if it is exactly computed. + /// \name Access Functions + /// @{ -In addition to the methods listed below, the copy constructor and assignment -operator for `Point_2` objects are also supported. + /*! returns the approximated coordinates of `p`. + */ + std::pair approximate() const; -*/ -class Point_2 { -public: + /*! returns whether the coordinates of `p` are computed in an exact manner. + */ + bool is_exact() const; -/// \name Creation -/// @{ + /*! returns the \f$x\f$-coordinate of `p`. + * + * \pre `p` is exactly computed. + */ + Algebraic x() const; -/*! -default constructor. -*/ -Point_2 (); + /*! returns the \f$y\f$-coordinate of `p`. + * + * \pre `p` is exactly computed. + */ + Algebraic y() const; -/*! -constructs the point \f$ B(t_0)\f$ on the given curve. As \f$ t_0\f$ is an -algebraic number, the point has algebraic coordinates. -*/ -Point_2 (const Curve_2& B, const Algebraic& t_0); + /*! returns whether the coordinates of `p` are rational numbers. + */ + bool is_rational() const; -/*! -constructs the point \f$ B(t_0)\f$ on the given curve. As \f$ t_0\f$ is a -rational number, the point has rational coordinates. -*/ -Point_2 (const Curve_2& B, const Rational& t_0); + /*! casts `p` to a point with rational coordinates. + * \pre `p` has rational coordinates. + */ + operator typename RatKernel::Point_2() const; -/// @} + /// @} -/// \name Access Functions -/// @{ + }; /* end Arr_Bezier_curve_traits_2::Point_2 */ -/*! -returns the approximated coordinates of `p`. -*/ -std::pair approximate () const; + /*! The `X_monotone_curve_2` class nested within the Bézier traits is + * used to represent \f$x\f$-monotone subcurves of Bézier curves. The + * subcurve is defined by a supporting Bézier curve \f$B(t)\f$ and a + * range of definition in the parameter space \f$[t_1, t_2] \subseteq [0,1]\f$, + * where \f$B(t_1)\f$ is the subcurve source and \f$B(t_2)\f$ is its target. + * Note that as the point endpoints may only be approximated, the parameter + * range defining the subcurve may only be approximately known. + * + * It is not possible to construct \f$x\f$-monotone subcurves directly. + * Instead, use the `Make_x_monotone_2` functor supplied by the traits class to + * subdivide a `Curve_2` object into \f$x\f$-monotone subcurves. + */ + class X_monotone_curve_2 { + public: -/*! -returns whether the coordinates of `p` are computed in an exact manner. -*/ -bool is_exact () const; + /// \name Access Functions + /// @{ -/*! -returns the \f$ x\f$-coordinate of `p`. -\pre `p` is exactly computed. -*/ -Algebraic x () const; + /*! returns the supporting Bézier curve of `b`. + */ + Curve_2 supporting_curve() const; -/*! -returns the \f$ y\f$-coordinate of `p`. -\pre `p` is exactly computed. -*/ -Algebraic y () const; + /*! returns the source point of `b`. + */ + Point_2 source() const; -/*! -returns whether the coordinates of `p` are rational numbers. -*/ -bool is_rational () const; + /*! returns the target point of `b`. + */ + Point_2 target() const; -/*! -casts `p` to a point with rational coordinates. -\pre `p` has rational coordinates. -*/ -operator typename RatKernel::Point_2 () const; + /*! returns the left (\f$xy\f$-lexicographically smaller) endpoint of `b`. + */ + Point_2 left() const; -/// @} + /*! returns the right (\f$xy\f$-lexicographically smaller) endpoint of `b`. + */ + Point_2 right() const; -}; /* end Arr_Bezier_curve_traits_2::Point_2 */ + /*! return the approximate parameter range defining the subcurve `b`. + */ + std::pair parameter_range() const; -/*! + /// @} + }; /* end Arr_Bezier_curve_traits_2::X_monotone_curve_2 */ -The `X_monotone_curve_2` class nested within the Bézier traits is -used to represent \f$ x\f$-monotone subcurves of Bézier curves. The subcurve is -defined by a supporting Bézier curve \f$ B(t)\f$ and a range of definition in -the parameter space \f$ [t_1, t_2] \subseteq [0, 1]\f$, where \f$ B(t_1)\f$ is the -subcurve source and \f$ B(t_2)\f$ is its target. Note that as the point endpoints -may only be approximated, the parameter range defining the subcurve may -only be approximately known. + class Trim_2 { + public: + /// \name Creation + /// @{ -It is not possible to construct \f$ x\f$-monotone subcurves directly. Instead, -use the `Make_x_monotone_2` functor supplied by the traits class to -subdivide a `Curve_2` object into \f$ x\f$-monotone subcurves. + /*! Trims the given \f$x\f$-monotone curve to an from `src` to `tgt`. + * + * \ pre `src` and `tgt` lies on the curve + */ + X_monotone_curve_2(const X_monotone_curve_2& xcv, + const Point_2& src, const Point_2& tgt) const -*/ -class X_monotone_curve_2 { -public: + /// @} -/// \name Access Functions -/// @{ - -/*! -returns the supporting Bézier curve of `b`. -*/ -Curve_2 supporting_curve () const; - -/*! -returns the source point of `b`. -*/ -Point_2 source () const; - -/*! -returns the target point of `b`. -*/ -Point_2 target () const; - -/*! -returns the left (\f$ xy\f$-lexicographically smaller) endpoint of `b`. -*/ -Point_2 left () const; - -/*! -returns the right (\f$ xy\f$-lexicographically smaller) endpoint of `b`. -*/ -Point_2 right () const; - -/*! -return the approximate parameter range defining the subcurve `b`. -*/ -std::pair parameter_range () const; - -/// @} - -}; /* end Arr_Bezier_curve_traits_2::X_monotone_curve_2 */ - -class Trim_2{ -public: -/// \name Creation -/// @{ - -/*! -Trims the given x-monotone curve to an from src to tgt. -\ pre `src` and `tgt` lies on the curve -*/ - -X_monotone_curve_2(const X_monotone_curve_2& xcv, - const Point_2& src, - const Point_2& tgt)const - -/// @} - -}/* end Arr_Bezier_curve_traits_2::Trim_2 */ + } /* end Arr_Bezier_curve_traits_2::Trim_2 */ }; /* end Arr_Bezier_curve_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_accessor.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_accessor.h index 786eacc5092..922ebd42db8 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_accessor.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_accessor.h @@ -18,122 +18,123 @@ namespace CGAL { template class Arr_accessor { public: + /// \name Types + /// @{ -/// \name Types -/// @{ + /*! the type of the associated arrangement. */ + typedef unspecified_type Arrangement_2; -/*! the type of the associated arrangement. */ -typedef unspecified_type Arrangement_2; + /*! the point type. */ + typedef typename Arrangement_2::Point_2 Point_2; -/*! the point type. */ -typedef typename Arrangement_2::Point_2 Point_2; + /*! the \f$x\f$-monotone curve type. */ + typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; -/*! the \f$ x\f$-monotone curve type. */ + /*! */ + typedef typename Arrangement_2::Vertex_handle Vertex_handle; -typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; + /*! */ + typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; -/*! */ -typedef typename Arrangement_2::Vertex_handle Vertex_handle; + /*! */ + typedef typename Arrangement_2::Face_handle Face_handle; -/*! */ -typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; + /*! represents the boundary of a connected component (CCB). */ + typedef typename Arrangement_2::Ccb_halfedge_circulator Ccb_halfedge_circulator; -/*! */ -typedef typename Arrangement_2::Face_handle Face_handle; + /// @} -/*! represents the boundary of a connected component (CCB). */ -typedef typename Arrangement_2::Ccb_halfedge_circulator Ccb_halfedge_circulator; + /// \name Creation + /// @{ -/// @} + /*! constructs an accessor attached to the given arrangement `arr`. */ + Arr_accessor(Arrangement_2& arr); -/// \name Creation -/// @{ + /// @} -/*! constructs an accessor attached to the given arrangement `arr`. */ -Arr_accessor(Arrangement_2& arr); + /// \name Accessing the Notification Functions -/// @} + /// @{ -/// \name Accessing the Notification Functions + /*! notifies the arrangement observer that a global change is going to take + * place (for the usage of the global functions that operate on arrangements). + */ + void notify_before_global_change(); -/// @{ + /*! notifies the arrangement observer that a global change has taken place + * (for the usage of the global functions that operate on arrangements). + */ + void notify_after_global_change(); -/*! notifies the arrangement observer that a global change is going to take - * place (for the usage of the global functions that operate on arrangements). - */ -void notify_before_global_change(); + /// @} -/*! notifies the arrangement observer that a global change has taken place (for - * the usage of the global functions that operate on arrangements). - */ -void notify_after_global_change(); + /// \name Arrangement Predicates + /// @{ -/// @} + /*! locates a place for the curve `c` around the vertex `v` and returns a + * halfedge whose target is `v`, where c should be inserted between this + * halfedge and the next halfedge around `v` in a clockwise order. + */ + Halfedge_handle + locate_around_vertex(Vertex_handle v, const X_monotone_curve_2& c) const; -/// \name Arrangement Predicates -/// @{ + /*! counts the number of edges along the path from `e1` to `e2`. In case the + * two halfedges do not belong to the same connected component, the function + * returns (-1). + */ + int halfedge_distance(Halfedge_const_handle e1, + Halfedge_const_handle e2) const; -/*! locates a place for the curve `c` around the vertex `v` and returns a - * halfedge whose target is `v`, where c should be inserted between this - * halfedge and the next halfedge around `v` in a clockwise order. - */ -Halfedge_handle -locate_around_vertex(Vertex_handle v, const X_monotone_curve_2& c) const; + /*! determines whether a new halfedge we are about to create, which is to be + * associated with the curve `c` and directed from `pred1->target()` to + * `pred2->target()`, lies on the inner CCB of the new face that will be + * created, introducing this new edge. + * + * \pre `pred1->target()` and `pred2->target()` are associated with `c`'s + * endpoints. + * + * \pre `pred1` and `pred2` belong to the same connected component, such that + * a new face is created by connecting `pred1->target()` and + * `pred2->target()`. + */ + bool is_inside_new_face(Halfedge_handle pred1, + Halfedge_handle pred2, + const X_monotone_curve_2& c) const; -/*! counts the number of edges along the path from `e1` to `e2`. In case the - * two halfedges do not belong to the same connected component, the function - * returns (-1). -*/ -int halfedge_distance(Halfedge_const_handle e1, Halfedge_const_handle e2) const; + /*! determines whether a given point lies within the region bounded by a + * boundary of the connected component that `he` belongs to. Note that if the + * function returns `true`, then `p` is contained within `he->face()` (but not + * on its boundary), or inside one of the inner CCBs of this face, or it may + * coincide with an isolated vertex in this face. + */ + bool point_is_in(const Point_2& p, Halfedge_const_handle he) const; -/*! determines whether a new halfedge we are about to create, which is to be - * associated with the curve `c` and directed from `pred1->target()` to - * `pred2->target()`, lies on the inner CCB of the new face that will be - * created, introducing this new edge. - * - * \pre `pred1->target()` and `pred2->target()` are associated with `c`'s - * endpoints. - * - * \pre `pred1` and `pred2` belong to the same connected component, such that a - * new face is created by connecting `pred1->target()` and `pred2->target()`. -*/ -bool is_inside_new_face(Halfedge_handle pred1, -Halfedge_handle pred2, -const X_monotone_curve_2& c) const; + /*! determines whether `he` lies on the outer boundary of its incident face. + */ + bool is_on_outer_boundary(Halfedge_const_handle he) const; -/*! determines whether a given point lies within the region bounded by a - * boundary of the connected component that `he` belongs to. Note that if the - * function returns `true`, then `p` is contained within `he->face()` (but not - * on its boundary), or inside one of the inner CCBs of this face, or it may - * coincide with an isolated vertex in this face. - */ -bool point_is_in(const Point_2& p, Halfedge_const_handle he) const; + /*! determines whether `he` lies on the inner boundary of its incident face + * (that is, whether it lies on the boundary of one of the inner CCBs of this + * face). + */ + bool is_on_inner_boundary(Halfedge_const_handle he) const; -/*! determines whether `he` lies on the outer boundary of its incident face. */ -bool is_on_outer_boundary(Halfedge_const_handle he) const; + /// @} -/*! determines whether `he` lies on the inner boundary of its incident face - * (that is, whether it lies on the boundary of one of the inner CCBs of this - * face). - */ -bool is_on_inner_boundary(Halfedge_const_handle he) const; + /// \name Arrangement Modifiers + /// @{ -/// @} - -/// \name Arrangement Modifiers -/// @{ - -/*! creates a new vertex an associates it with the point `p`. - * - * \pre There is no existing vertex already associated with `p`. - */ -Vertex_handle create_vertex(const Point_2& p); + /*! creates a new vertex an associates it with the point `p`. + * + * \pre There is no existing vertex already associated with `p`. + */ + Vertex_handle create_vertex(const Point_2& p); /*! inserts the curve `c` as a new inner CCBs (hole) of the face `f`, * connecting the two isolated vertices `v1` and `v2`. `res` is the comparison * result between these two end-vertices. The function returns a handle for one - * of the new halfedges corresponding to the inserted curve, directed from `v1` - * to `v2`. + * one of the new halfedges corresponding to the inserted curve, directed from + * `v1` to `v2`. * * \pre `v1` and `v2` are associated with `c`'s endpoints, that they lie of * `f`'s interior and that and that they have no incident edges. @@ -160,121 +161,122 @@ Halfedge_handle insert_from_vertex_ex(const X_monotone_curve_2& c, Vertex_handle v, Comparison_result res); -/*! inserts the curve `c` into the arrangement, such that both `c`'s endpoints - * correspond to existing arrangement vertices, given by `pred1->target()` and - * `pred2->target()`. `res` is the comparison result between these two - * end-vertices. The function creates a new halfedge pair that connects the two - * vertices (with `pred1` and `pred2` indicate the exact place for these - * halfedges around the two target vertices) and returns a handle for the - * halfedge directed from `pred1->target()` to `pred2->target()`. The output - * flag `new_face` indicates whether a new face has been created following the - * insertion of the new curve. - * - * \pre `pred1->target()` and `pred2->target()` are associated with `c`'s - * endpoints and that if a new face is created, then `is_inside_new_face (pred1, - * pred2, c)` is `true`. - */ -Halfedge_handle insert_at_vertices_ex(const X_monotone_curve_2& c, - Halfedge_handle pred1, - Halfedge_handle pred2, - Comparison_result res, bool& new_face); + /*! inserts the curve `c` into the arrangement, such that both `c`'s endpoints + * correspond to existing arrangement vertices, given by `pred1->target()` and + * `pred2->target()`. `res` is the comparison result between these two + * end-vertices. The function creates a new halfedge pair that connects the + * two vertices (with `pred1` and `pred2` indicate the exact place for these + * halfedges around the two target vertices) and returns a handle for the + * halfedge directed from `pred1->target()` to `pred2->target()`. The output + * flag `new_face` indicates whether a new face has been created following the + * insertion of the new curve. + * + * \pre `pred1->target()` and `pred2->target()` are associated with `c`'s + * endpoints and that if a new face is created, then + * `is_inside_new_face(pred1, pred2, c)` is `true`. + */ + Halfedge_handle insert_at_vertices_ex(const X_monotone_curve_2& c, + Halfedge_handle pred1, + Halfedge_handle pred2, + Comparison_result res, bool& new_face); -/*! inserts `v` as an isolated vertex inside `f`. - * - * \pre `v->point()` is contained in the interior of the given face. - */ -void insert_isolated_vertex(Face_handle f, Vertex_handle v); + /*! inserts `v` as an isolated vertex inside `f`. + * + * \pre `v->point()` is contained in the interior of the given face. + */ + void insert_isolated_vertex(Face_handle f, Vertex_handle v); -/*! moves the given hole (inner CCB) from the interior of the face `f1` to the - * face `f2`. - * - * \pre `hole` is currently contained in `f1` and should be moved to `f2`. - */ -void move_hole(Face_handle f1, Face_handle f2, Ccb_halfedge_circulator hole); + /*! moves the given hole (inner CCB) from the interior of the face `f1` to the + * face `f2`. + * + * \pre `hole` is currently contained in `f1` and should be moved to `f2`. + */ + void move_hole(Face_handle f1, Face_handle f2, Ccb_halfedge_circulator hole); -/*! moves the given isolated vertex from the interior of the face `f1` - * inside the face `f2`. - * - * \pre `v` is indeed an isolated vertex currently contained in `f1` and should - * be moved to `f2`. - */ -bool move_isolated_vertex(Face_handle f1, Face_handle f2, Vertex_handle v); + /*! moves the given isolated vertex from the interior of the face `f1` + * inside the face `f2`. + * + * \pre `v` is indeed an isolated vertex currently contained in `f1` and + * should be moved to `f2`. + */ + bool move_isolated_vertex(Face_handle f1, Face_handle f2, Vertex_handle v); -/*! relocates all inner ccbs and isolated vertices to their proper position - * immediately after a face has split due to the insertion of a new halfedge, - * namely after `insert_at_vertices_ex()` was invoked and indicated that a new - * face has been created. `he` is the halfedge returned by - * `insert_at_vertices_ex()`, such that `he->twin()->face` is the face that has - * just been split and `he->face()` is the newly created face. - */ -void relocate_in_new_face(Halfedge_handle he); + /*! relocates all inner ccbs and isolated vertices to their proper position + * immediately after a face has split due to the insertion of a new halfedge, + * namely after `insert_at_vertices_ex()` was invoked and indicated that a new + * face has been created. `he` is the halfedge returned by + * `insert_at_vertices_ex()`, such that `he->twin()->face` is the face that + * has just been split and `he->face()` is the newly created face. + */ + void relocate_in_new_face(Halfedge_handle he); -/*! relocates all inner ccbs in a new face, as detailed above. */ -void relocate_holes_in_new_face(Halfedge_handle he); + /*! relocates all inner ccbs in a new face, as detailed above. */ + void relocate_holes_in_new_face(Halfedge_handle he); -/*! relocates all isolated vertices in a new face, as detailed above. */ -void relocate_isolated_vertices_in_new_face(Halfedge_handle he); + /*! relocates all isolated vertices in a new face, as detailed above. */ + void relocate_isolated_vertices_in_new_face(Halfedge_handle he); -/*! modifies the point associated with the vertex `v` (the point may be - * geometrically different than the one currently associated with `v`). The - * function returns a handle to the modified vertex (same as `v`). - * - * \pre No other arrangement vertex is already associated with `p`. - * - * \pre The topology of the arrangement does not change after the vertex point - * is modified. - */ -Vertex_handle modify_vertex_ex(Vertex_handle v, const Point_2& p); + /*! modifies the point associated with the vertex `v` (the point may be + * geometrically different than the one currently associated with `v`). The + * function returns a handle to the modified vertex (same as `v`). + * + * \pre No other arrangement vertex is already associated with `p`. + * + * \pre The topology of the arrangement does not change after the vertex point + * is modified. + */ + Vertex_handle modify_vertex_ex(Vertex_handle v, const Point_2& p); -/*! modifies the \f$ x\f$-monotone curve associated with the edge `e` (the curve - * `c` may be geometrically different than the one currently associated with - * `e`). The function returns a handle to the modified edge (same as `e`). - * - * \pre The interior of `c` is disjoint from all existing arrangement vertices - * and edges. - */ -Halfedge_handle modify_edge_ex(Halfedge_handle e, const X_monotone_curve_2& c); + /*! modifies the \f$x\f$-monotone curve associated with the edge `e` (the + * curve `c` may be geometrically different than the one currently associated + * with `e`). The function returns a handle to the modified edge (same as + * `e`). + * + * \pre The interior of `c` is disjoint from all existing arrangement vertices + * and edges. + */ + Halfedge_handle modify_edge_ex(Halfedge_handle e, const X_monotone_curve_2& c); -/*! splits a given edge into two at the split point `p`, and associate the - * x-monotone curves `c1` and `c2` with the resulting edges, such that `c1` - * connects `he->source()` with `p` and `c2` connects `p` with - * `he->target()`. The function return a handle to the split halfedge directed - * from `he->source()` to the split point `p`. - * - * \pre The endpoints of `c1` and `c2` correspond to `p` and to `he`'s - * end-vertices, as indicated above. - */ -Halfedge_handle split_edge_ex(Halfedge_handle he, const Point_2& p, - const X_monotone_curve_2& c1, - const X_monotone_curve_2& c2); + /*! splits a given edge into two at the split point `p`, and associate the + * \f$x\f$-monotone curves `c1` and `c2` with the resulting edges, such that + * `c1` connects `he->source()` with `p` and `c2` connects `p` with + * `he->target()`. The function return a handle to the split halfedge directed + * from `he->source()` to the split point `p`. + * + * \pre The endpoints of `c1` and `c2` correspond to `p` and to `he`'s + * end-vertices, as indicated above. + */ + Halfedge_handle split_edge_ex(Halfedge_handle he, const Point_2& p, + const X_monotone_curve_2& c1, + const X_monotone_curve_2& c2); -/*! splits a given edge into two at by the vertex `v`, and associate the - * x-monotone curves `c1` and `c2` with the resulting edges, such that `c1` - * connects `he->source()` with `v` and `c2` connects `v` with - * `he->target()`. The function return a handle to the split halfedge directed - * from `he->source()` to `v`. - * - * \pre The endpoints of `c1` and `c2` correspond to `v` and to `he`'s - * end-vertices, as indicated above. It is also assumed that `v` has no incident - * edges. - */ -Halfedge_handle split_edge_ex(Halfedge_handle he, Vertex_handle v, - const X_monotone_curve_2& c1, - const X_monotone_curve_2& c2); + /*! splits a given edge into two at by the vertex `v`, and associate the + * \f$x\f$-monotone curves `c1` and `c2` with the resulting edges, such that + * `c1` connects `he->source()` with `v` and `c2` connects `v` with + * `he->target()`. The function return a handle to the split halfedge directed + * from `he->source()` to `v`. + * + * \pre The endpoints of `c1` and `c2` correspond to `v` and to `he`'s + * end-vertices, as indicated above. It is also assumed that `v` has no + * incident edges. + */ + Halfedge_handle split_edge_ex(Halfedge_handle he, Vertex_handle v, + const X_monotone_curve_2& c1, + const X_monotone_curve_2& c2); -/*! removes the edge `he` from the arrangement, such that if the edge removal - * causes the creation of a new hole (inner CCB), `he->target()` lies on the - * boundary of this hole. The flags `remove_source` and `remove_target` - * indicate whether the end-vertices of `he` should be removed as well, in case - * they have no other incident edges. If the operation causes two faces to - * merge, the merged face is returned. Otherwise, the face to which the edge - * was incident is returned. - */ -Face_handle remove_edge_ex(Halfedge_handle he, - bool remove_source = true, - bool remove_target = true); - -/// @} + /*! removes the edge `he` from the arrangement, such that if the edge removal + * causes the creation of a new hole (inner CCB), `he->target()` lies on the + * boundary of this hole. The flags `remove_source` and `remove_target` + * indicate whether the end-vertices of `he` should be removed as well, in + * case they have no other incident edges. If the operation causes two faces + * to merge, the merged face is returned. Otherwise, the face to which the + * edge was incident is returned. + */ + Face_handle remove_edge_ex(Halfedge_handle he, + bool remove_source = true, + bool remove_target = true); + /// @} }; /* end Arr_accessor */ + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_algebraic_segment_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_algebraic_segment_traits_2.h index 27fcce4bb1e..c57c2661e1e 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_algebraic_segment_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_algebraic_segment_traits_2.h @@ -3,22 +3,22 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * * The traits class `Arr_algebraic_segment_traits_2` is a model of the - * `ArrangementTraits_2` concept that handles planar algebraic curves of - * arbitrary degree, and \f$ x\f$-monotone of such curves. A planar (real) - * algebraic curve is the vanishing set of a polynomial in two variables, - * that is, the curve is defined by the defining equation \f[ - * f(x):=\sum_{i+j\leq n} a_{ij} x^i y^j =0, \f] where \f$ n\f$ is the degree of - * the curve. + * `AosTraits_2` concept that handles planar algebraic curves of arbitrary + * degree, and \f$x\f$-monotone of such curves. A planar (real) algebraic + * curve is the vanishing set of a polynomial in two variables, that is, + * the curve is defined by the defining equation + * \f[f(x):=\sum_{i+j\leq n} a_{ij} x^i y^j =0, \f] where \f$n\f$ is the + * degree of the curve. * * The traits class allows the construction of algebraic curves, by specifying - * their implicit equation. \f$ x\f$-monotone and vertical segments of a curve + * their implicit equation. \f$x\f$-monotone and vertical segments of a curve * can also be defined; unbounded curves and segments are supported. The * template parameter `Coefficient` defines the innermost coefficient type of * the polynomials. Currently, the types `leda::integer` and `CORE::BigInt` are * supported as well as any instance of `CGAL::Sqrt_extension` that is * instantiated with one of the integral types above. * - * \cgalModels{ArrangementTraits_2} + * \cgalModels{AosTraits_2} */ template @@ -50,8 +50,7 @@ public: */ typedef unspecified_type Algebraic_real_1; - /*! Typedef from `Algebraic_kernel_1::Bound` - */ + /// Typedef from `Algebraic_kernel_1::Bound` typedef unspecified_type Bound; /// @} @@ -77,7 +76,6 @@ public: */ class Construct_curve_2 { public: - /// \name Object Creation Functors /// @{ @@ -102,40 +100,41 @@ public: */ class Construct_point_2 { public: - /// \name Object Creation Functors /// @{ /*! returns a `Point_2` object that represents the `arcno`-th - * point in the fiber of `cv` at \f$ x\f$-coordinate `x`, + * point in the fiber of `cv` at \f$x\f$-coordinate `x`, * counted from the bottom, starting with zero. + * * \pre (`cv` must not have a vertical line at `x`, - * and \f$ 0\leq arcno < c\f$, where \f$ c\f$ is the number of points + * and \f$0\leq arcno < c\f$, where \f$c\f$ is the number of points * in the fiber of `cv` at `x`.) */ - Point_2 operator() (Algebraic_real_1 x, Curve_2 cv, int arcno); + Point_2 operator()(Algebraic_real_1 x, Curve_2 cv, int arcno); /*! returns a `Point_2` object that represents the - * point on `xcv` at \f$ x\f$-coordinate `x` - * \pre (`x` is in the \f$ x\f$-range of `xcv`.) + * point on `xcv` at \f$x\f$-coordinate `x` + * + * \pre (`x` is in the \f$x\f$-range of `xcv`.) */ - Point_2 operator() (Algebraic_real_1 x, X_monotone_curve_2 xcv); + Point_2 operator()(Algebraic_real_1 x, X_monotone_curve_2 xcv); /*! returns a `Point_2` object that represents (x,y) */ - Point_2 operator() (Algebraic_real_1 x, Algebraic_real_1 y); + Point_2 operator()(Algebraic_real_1 x, Algebraic_real_1 y); /*! returns a `Point_2` object that represents (x,y) */ - Point_2 operator() (Coefficient x, Coefficient y); + Point_2 operator()(Coefficient x, Coefficient y); /*! returns a `Point_2` object that represents (x,y) */ - Point_2 operator() (Bound x, Bound y); + Point_2 operator()(Bound x, Bound y); /*! returns a `Point_2` object that represents (x,y) */ - Point_2 operator() (int x, int y); + Point_2 operator()(int x, int y); /// @} @@ -145,7 +144,6 @@ public: */ class Construct_x_monotone_segment_2 { public: - /// \name Object Creation Functors /// @{ @@ -162,54 +160,56 @@ public: * * \pre `end_min` must have a unique \f$x\f$-monotone segment to its right, or * `end_max` must have a unique \f$x\f$-monotone segment to its left. - * Furthermore, `end_min` and `end_max` must be connected by an - * \f$x\f$-monotone segment of `cv`) + * Furthermore, `end_min` and `end_max` must be connected by an + * \f$x\f$-monotone segment of `cv`) */ template - OutputIterator operator() (Curve_2 cv, Point_2 end_min, Point_2 end_max, - OutputIterator oi); + OutputIterator operator()(Curve_2 cv, Point_2 end_min, Point_2 end_max, + OutputIterator oi); /*! inserts a sequence of `X_monotone_curve_2` objects into an output container * given through an output iterator. These segments form an \f$x\f$-monotone * (or vertical) segment of the curve `cv`. * - * If `site_of_p==POINT_IN_INTERIOR`, the maximal segment is - * returned that contains `p` in its interior. + * If `site_of_p` == `POINT_IN_INTERIOR`, the maximal segment that contains + * `p` in its interior is returned . * - * returned that contains `p` as its left endpoint. + * If `site_of_p` == `MIN_ENDPOINT`, the segment that contains + * `p` as its left endpoint returned . * - * returned that contains `p` as its left endpoint. + * If `site_of_p` == `MAX_ENDPOINT`, the segment that contains + * `p` as its right endpoint returned . * - * \pre (If `site_of_p==POINT_IN_INTERIOR`, `p` - * must be an interior point of an \f$x\f$-monotone or a vertical - * segment. - * must either have a unique \f$x\f$-monotone segment to the right, - * or a vertical segment from `p` upwards. - * must either have a unique \f$x\f$-monotone segment to the left, - * or a vertical segment from `p` downwards.) + * \pre If `site_of_p` == `POINT_IN_INTERIOR`, `p` must be an interior point + * of an \f$x\f$-monotone or a vertical segment. + * + * \pre If `site_of_p` == `MIN_ENDPOINT`, `p` must either have a unique + * \f$x\f$-monotone segment to the right, or a vertical segment from `p` upwards. + * + * \pre If `site_of_p` == `MAX_ENDPOINT`, `p` must either have a unique + * \f$x\f$-monotone segment to the left, or a vertical segment from `p` downwards. */ template - OutputIterator operator() (Curve_2 cv, Point_2 p, Site_of_point site_of_p, - OutputIterator out); + OutputIterator operator()(Curve_2 cv, Point_2 p, Site_of_point site_of_p, + OutputIterator out); - /*! inserts a sequence of `X_monotone_curve_2` objects into an output container - * given through an output iterator. These segments form a straight-line - * segment connecting the points `p` and `q`. If `p` and `q` share the same - * \f$x\f$-coordinate, the constructed vertical segment consists of only one - * `X_monotone_curve_2` object and can be computed efficiently. In the - * non-vertical case, the construction is only possible if `p` and `q` have both - * rational x- and y-coordinates. + /*! inserts a sequence of `X_monotone_curve_2` objects into an output + * container given through an output iterator. These segments form a + * straight-line segment connecting the points `p` and `q`. If `p` and `q` + * share the same \f$x\f$-coordinate, the constructed vertical segment + * consists of only one `X_monotone_curve_2` object and can be computed + * efficiently. In the non-vertical case, the construction is only possible + * if `p` and `q` have both rational \f$x\f$- and \f$y\f$-coordinates. * - * \pre (`p` must not be equal to `q`.) + * \pre `p` must not be equal to `q`. */ template - OutputIterator operator() (Point_2 p, Point_2 q, OutputIterator out); + OutputIterator operator()(Point_2 p, Point_2 q, OutputIterator out); /// @} - }; /* end Arr_algebraic_segment_traits_2::Construct_x_monotone_segment_2 */ - /*! A model of the the `ArrangementTraits_2::Curve_2` concept. + /*! A model of the the `AosTraits_2::Curve_2` concept. * Represents algebraic curves. Internally, the type stores * topological-geometric information about the particular curve. * In order to use internal caching, instances should only be created @@ -223,25 +223,25 @@ public: /*! returns the defining polynomial of the curve. */ - Polynomial_2 polynomial () const; + Polynomial_2 polynomial() const; /// @} }; /* end Arr_algebraic_segment_traits_2::Curve_2 */ - /*! A model of the `ArrangementBasicTraits_2::Point_2` concept. - * Represents points in \f$ \mathbb{R}^2\f$. Intersection points of algebraic + /*! A model of the `AosBasicTraits_2::Point_2` concept. + * Represents points in \f$\mathbb{R}^2\f$. Intersection points of algebraic * curves are in general non-rational, so we need a data structure that is * capable of representing arbitrary points with algebraic coordinates. * * The traits class represents algebraic coordinates by the type - * `Algebraic_real_1`, which is a model of the `AlgebraicReal_1` concept. - * A point \f$ p\f$ is stored by a triple \f$ (x,cv,arcno)\f$, - * where \f$ x\f$ is the \f$ x\f$-coordinate of a point, \f$ cv\f$ is an instance - * of `Curve_2` that contains the point, (and has no vertical line at \f$ x\f$), - * and \f$ arcno\f$ is an `int`, denoting that \f$ p\f$ is met as the - * \f$arcno\f$-th point when shooting a vertical ray at \f$ x\f$, starting from - * \f$-\infty\f$ (where counting starts with \f$ 0\f$). + * `Algebraic_real_1`, which is a model of the `AlgebraicReal_1` concept. A + * point \f$p\f$ is stored by a triple \f$(x,cv,arcno)\f$, where \f$x\f$ is + * the \f$x\f$-coordinate of a point, \f$cv\f$ is an instance of `Curve_2` + * that contains the point, (and has no vertical line at \f$x\f$), and + * \f$arcno\f$ is an `int`, denoting that \f$p\f$ is met as the \f$arcno\f$-th + * point when shooting a vertical ray at \f$x\f$, starting from \f$-\infty\f$ + * (where counting starts with \f$0\f$). * * In addition to the methods listed below, the copy constructor and assignment * operator for `Point_2` objects are also supported. @@ -251,53 +251,52 @@ public: class Point_2 { public: - /// \name Modifiers /// @{ - /*! returns the \f$ x\f$-coordinate of `p`. + /*! returns the \f$x\f$-coordinate of `p`. */ - Algebraic_real_1 x () const; + Algebraic_real_1 x() const; - /*! returns the \f$ y\f$-coordinates of `p`. + /*! returns the \f$y\f$-coordinates of `p`. * - * Attention: As described above, points are not stored - * by their \f$ y\f$-coordinate in `Algebraic_real_1` representation. In fact, + * Attention: As described above, points are not stored by their + * \f$y\f$-coordinate in `Algebraic_real_1` representation. In fact, * this representation must be computed on demand, and might become quite * costly for points defined by high-degree polynomials. Therefore, it is * recommended to avoid to call this function as much as possible. */ - Algebraic_real_1 y () const; + Algebraic_real_1 y() const; /*! returns a `Curve_2` instance that `p`is part of. */ - Curve_2 curve () const; + Curve_2 curve() const; /*! returns the arc number of `p`. */ - int arcno () const; + int arcno() const; - /*! returns double-approximations of the \f$ x\f$- and \f$ y\f$-coordinates. + /*! returns double-approximations of the \f$x\f$- and \f$y\f$-coordinates. */ - std::pair to_double () const; + std::pair to_double() const; /// @} }; /* end Arr_algebraic_segment_traits_2::Point_2 */ - /*! A model of the `ArrangementBasicTraits_2::X_monotone_curve_2` concept. + /*! A model of the `AosBasicTraits_2::X_monotone_curve_2` concept. * Represents terminal segments of an algebraic curves, that means vertical - * segments or \f$ x\f$-monotone segments with no critical \f$ x\f$-coordinate - * in the interior of their \f$ x\f$-range. Terminal segments might either be + * segments or \f$x\f$-monotone segments with no critical \f$x\f$-coordinate + * in the interior of their \f$x\f$-range. Terminal segments might either be * bounded or unbounded. By definition, each interior point of a non-vertical * segment has the same arc number (see the documentation of type `Point_2` * above, which is called the arc number of the segment (note the arc * number at the endpoints might differ). Such segments are represented - * internally by a 4-tuple \f$ (p,q,cv,arcno)\f$, where \f$ p\f$ and \f$ q\f$ - * are the endpoints, \f$ cv\f$ is the supporting curve that the segment - * belongs to, and arcno is the arc number of the segment. + * internally by a 4-tuple \f$(p,q,cv,arcno)\f$, where \f$p\f$ and \f$q\f$ + * are the endpoints, \f$cv\f$ is the supporting curve that the + * segment belongs to, and arcno is the arc number of the segment. * - * Arbitrary (weakly) \f$ x\f$-monotone segments are presented by a range + * Arbitrary (weakly) \f$x\f$-monotone segments are presented by a range * of `X_monotone_curve_2` instances, whose union equals the segment. * The functor `Construct_x_monotone_segment_2` allows their construction. * To construct all (maximal) terminal segments of a curve, @@ -311,34 +310,34 @@ public: /*! returns the supporting algebraic curve of `s`. */ - Curve_2 curve () const; + Curve_2 curve() const; /*! returns whether `s` is a vertical segment. */ - bool is_vertical () const; + bool is_vertical() const; /*! returns whether `s` has a finite endpoint on the left */ - bool is_finite (CGAL::Arr_curve_end ce) const; + bool is_finite(CGAL::Arr_curve_end ce) const; /*! \pre (The corresponding curve end is finite) */ - Point_2 curve_end (CGAL::Arr_curve_end ce) const; + Point_2 curve_end(CGAL::Arr_curve_end ce) const; /*! returns the arc number of the segment. * \pre (The segment is non-vertical) */ - int arcno () const; + int arcno() const; - /*! returns the \f$ x\f$-coordinate of a vertical segment. + /*! returns the \f$x\f$-coordinate of a vertical segment. + * * \pre (The segment is vertical) */ - Algebraic_real_1 x () const; + Algebraic_real_1 x() const; /// @} }; /* end Arr_algebraic_segment_traits_2::X_monotone_curve_2 */ - }; /* end Arr_algebraic_segment_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h index d71d0f7faf9..3ced6434b63 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_batched_point_location.h @@ -30,9 +30,8 @@ namespace CGAL { */ template -OutputIterator locate (const Arrangement_2& arr, - InputIterator begin, - InputIterator end, - OutputIterator oi); +OutputIterator locate(const Arrangement_2& arr, + InputIterator begin, InputIterator end, + OutputIterator oi); } /* namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_bounded_planar_topology_traits_2.h index 862416a2fa3..6af33ddbfa4 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -10,18 +10,18 @@ namespace CGAL { * The `Arr_bounded_planar_topology_traits_2` template has two parameters: *
      *
    • The `GeometryTraits_2` template-parameter should be substituted by - * a model of the `ArrangementBasicTraits_2` concept. The traits + * a model of the `AosBasicTraits_2` concept. The traits * class defines the types of \f$x\f$-monotone curves and two-dimensional - * points, namely `ArrangementBasicTraits_2::X_monotone_curve_2` and - * `ArrangementBasicTraits_2::Point_2`, + * points, namely `AosBasicTraits_2::X_monotone_curve_2` and + * `AosBasicTraits_2::Point_2`, * respectively, and supports basic geometric predicates on them. *
    • The `Dcel` template-parameter should be substituted by - * a class that is a model of the `ArrangementDcel` concept. The + * a class that is a model of the `AosDcel` concept. The * value of this parameter is by default * `Arr_default_dcel`. *
    * - * \cgalModels{ArrangementBasicTopologyTraits} + * \cgalModels{AosBasicTopologyTraits} * * \sa `Arr_default_dcel` * \sa `CGAL::Arr_geodesic_arc_on_sphere_traits_2` @@ -62,10 +62,10 @@ public: /// \name Accessors /// @{ - /*! obtains the DCEL (const version). */ + /*! obtains the \dcel (const version). */ const Dcel& dcel() const; - /*! obtains the DCEL (non-const version). */ + /*! obtains the \dcel (non-const version). */ Dcel& dcel(); /*! obtains the unbounded face (const version). */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circle_segment_traits_2.h index b3a39fc3e07..88b0fc1dc2b 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circle_segment_traits_2.h @@ -3,7 +3,7 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * * The class `Arr_circle_segment_traits_2` is a model of the - * `ArrangementTraits_2` concept and can be used to construct and maintain + * `AosTraits_2` concept and can be used to construct and maintain * arrangements of circular arcs and line segments. * * The traits class must be instantiated with a geometric kernel, such that the @@ -11,34 +11,33 @@ namespace CGAL { * the supporting lines of the line segments are of type `Kernel::Line_2`. * Thus, the coordinates of the center of supporting circles, and its squared * radius are of type `Kernel::FT`, which should be an exact rational - * number-type; similarly, the coefficients of each supporting line \f$ ax + by - * + c = 0\f$ are also of type `Kernel::FT`. Note however that the intersection - * point between two such arcs do not have rational coordinates in general. For - * this reason, we do not require the endpoints of the input arcs and segments - * to have rational coordinates. + * number-type; similarly, the coefficients of each supporting line + * \f$ax + by + c = 0\f$ are also of type `Kernel::FT`. Note however that the + * intersection point between two such arcs do not have rational coordinates in + * general. For this reason, we do not require the endpoints of the input arcs + * and segments to have rational coordinates. * * The nested `Point_2` type defined by the traits class is therefore * different than the `Kernel::Point_2` type. Its coordinates are of type - * `CoordNT`, which an instantiation of `Sqrt_extension` where `NT = - * ROOT = Kernel::FT`. Moreover, the third and fourth (hidden) template - * parameters of `Sqrt_extension` are set to `CGAL::Tag_true`, which - * enables efficient comparison among different extensions. + * `CoordNT`, which an instantiation of `Sqrt_extension` where + * `NT` = `ROOT` = `Kernel::FT`. Moreover, the third and fourth (hidden) + * template parameters of `Sqrt_extension` are set to `CGAL::Tag_true`, + * which enables efficient comparison among different extensions. * * For more details see the documentation of `Sqrt_extension`. * * While `Arr_circle_segment_traits_2` models the concept - * `ArrangementDirectionalXMonotoneTraits_2`, the implementation of the + * `AosDirectionalXMonotoneTraits_2`, the implementation of the * `Are_mergeable_2` operation does not enforce the input curves to have the * same direction as a precondition. Moreover, `Arr_circle_segment_traits_2` * supports the merging of curves of opposite directions. * - * \cgalModels{ArrangementTraits_2,ArrangementDirectionalXMonotoneTraits_2} + * \cgalModels{AosTraits_2,AosApproximateTraits_2,AosDirectionalXMonotoneTraits_2} * */ template class Arr_circle_segment_traits_2 { public: - /*! The `Curve_2` class nested within the traits class can represent * arbitrary circular arcs, full circles and line segments and support their * construction in various ways. The copy and default constructor as well as @@ -88,7 +87,7 @@ public: * center point with rational coordinates and whose squared radius is * rational, with the given endpoints. The orientation of the arc is the * same as the orientation of `circ`. - + * * \pre Both endpoints must lie on the given supporting circle. */ Curve_2(const typename Kernel::Circle_2& circ, @@ -111,9 +110,9 @@ public: * * \pre The three points must not be collinear. */ - Curve_2 (const typename Kernel::Point_2& source, - const typename Kernel::Point_2& mid, - const typename Kernel::Point_2& target); + Curve_2(const typename Kernel::Point_2& source, + const typename Kernel::Point_2& mid, + const typename Kernel::Point_2& target); /// @} @@ -162,7 +161,6 @@ public: typename Kernel::Circle_2 supporting_circle() const; /// @} - }; /* end Arr_circle_segment_traits_2::Curve_2 */ @@ -172,16 +170,13 @@ public: */ class Point_2 { public: - /// \name Types /// @{ - /*! the `Kernel::FT` type. - */ + /// the `Kernel::FT` type. typedef unspecified_type Rational; - /*! the algebraic number-type. - */ + /// the algebraic number-type. typedef unspecified_type CoordNT; /// @} @@ -193,11 +188,11 @@ public: */ Point_2(); - /*! creates the point \f$ (x,y)\f$. + /*! creates the point \f$(x,y)\f$. */ Point_2(const Rational& x, const Rational& y); - /*! creates the point \f$ (x,y)\f$. + /*! creates the point \f$(x,y)\f$. */ Point_2(const CoordNT& x, const CoordNT& y); @@ -206,36 +201,34 @@ public: /// \name Access Functions /// @{ - /*! returns the \f$ x\f$-coordinate. + /*! returns the \f$x\f$-coordinate. */ CoordNT x() const; - /*! returns the \f$ y\f$-coordinate. + /*! returns the \f$y\f$-coordinate. */ CoordNT y() const; /// @} - }; /* end Arr_circle_segment_traits_2::Point_2 */ /*! The `X_monotone_curve_2` class nested within the traits class can - * represent \f$ x\f$-monotone and line segments (which are always weakly + * represent \f$x\f$-monotone and line segments (which are always weakly * \f$x\f$-monotone). The copy and default constructor as well as the * assignment operator are provided. In addition, an `operator<<` for the * curves is defined for standard output streams. */ class X_monotone_curve_2 { public: - /// \name Creation /// @{ /*! constructs an curve corresponding to the line segment directed * from `source` to `target`, both having rational coordinates. */ - X_monotone_curve_2 (const typename Kernel::Point_2& source, - const typename Kernel::Point_2& target); + X_monotone_curve_2(const typename Kernel::Point_2& source, + const typename Kernel::Point_2& target); /*! constructs an curve corresponding to the line segment supported by * the given line, directed from `source` to `target`. Note that the two @@ -254,7 +247,7 @@ public: * * \pre Both endpoints must lie on the given supporting circle. * - * \pre The circular arc is \f$ x\f$-monotone. + * \pre The circular arc is \f$x\f$-monotone. */ X_monotone_curve_2(const typename Kernel::Circle_2& circ, const Point_2& source, const Point_2& target, @@ -275,7 +268,7 @@ public: /*! returns true if `xcv` is directed right, false otherwise. */ - bool is_directed_right () const; + bool is_directed_right() const; /*! returns the left (lexicographically smaller) endpoint of `xcv`. */ @@ -292,11 +285,11 @@ public: /*! determines whether `xcv` is a line segment. */ - bool is_linear () const; + bool is_linear() const; /*! determines whether `xcv` is a circular arc. */ - bool is_circular () const; + bool is_circular() const; /*! returns the supporting line of `xcv`. * @@ -315,7 +308,6 @@ public: Bbox_2 bbox() const; /// @} - }; /* end Arr_circle_segment_traits_2::X_monotone_curve_2 */ class Trim_2 { @@ -323,16 +315,15 @@ public: /// \name Creation /// @{ - /*! trims the given x-monotone curve to an from src to tgt. + /*! trims the given \f$x\f$-monotone curve to an from `src` to `tgt`. * \ pre `src` and `tgt` lies on the curve */ - X_monotone_curve_2(const X_monotone_curve_2& xcv, const Point_2& src, const Point_2& tgt) const + /// @} } /* end Arr_circle_segment_traits_2::Trim_2 */ - }; /* end Arr_circle_segment_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_arc_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_arc_traits_2.h index 014e1f5ec21..922b499fff1 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_arc_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_arc_traits_2.h @@ -1,19 +1,14 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * This class is a traits class for \cgal arrangements, built on top of a model + * of concept `CircularKernel`. + * It provides curves of type `CGAL::Circular_arc_2`. + * + * \cgalModels{AosTraits_2} + */ +template +class Arr_circular_arc_traits_2 {}; -This class is a traits class for \cgal arrangements, built on top of a model of -concept `CircularKernel`. -It provides curves of type `CGAL::Circular_arc_2`. - -\cgalModels{ArrangementTraits_2} - -*/ -template< typename CircularKernel > -class Arr_circular_arc_traits_2 { -public: - -}; /* end Arr_circular_arc_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_line_arc_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_line_arc_traits_2.h index c7bc38001fc..dd280f33fbf 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_line_arc_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_circular_line_arc_traits_2.h @@ -1,23 +1,17 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * This class is a traits class for \cgal arrangements, built on top of a model + * of concept `CircularKernel`. It provides curves that can be of both types + * `CGAL::Line_arc_2` or `CGAL::Circular_arc_2`. + * + * It uses the + * std::variant. + * + * \cgalModels{AosTraits_2} + */ +template +class Arr_circular_line_arc_traits_2 {}; -This class is a traits class for \cgal arrangements, built on top of a -model of concept `CircularKernel`. It provides curves that can be -of both types -`CGAL::Line_arc_2` or -`CGAL::Circular_arc_2`. - -It uses the std::variant. - -\cgalModels{ArrangementTraits_2} - -*/ -template< typename CircularKernel > -class Arr_circular_line_arc_traits_2 { -public: - -}; /* end Arr_circular_line_arc_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_conic_traits_2.h index 8d8cc6785d4..33a5f127a31 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_conic_traits_2.h @@ -2,7 +2,7 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * - * The class `Arr_conic_traits_2` is a model of the `ArrangementTraits_2` + * The class `Arr_conic_traits_2` is a model of the `AosTraits_2` * concept and can be used to construct and maintain arrangements of bounded * segments of algebraic curves of degree \f$2\f$ at most, also known as * conic curves. @@ -13,13 +13,13 @@ namespace CGAL { * *
      - *
    • If \f$4 r s - t^2 > 0\f$, \f$ C\f$ is an ellipse. A special case occurs - * when \f$r = s\f$ and \f$ t = 0\f$, when \f$ C\f$ becomes a circle. + *
    • If \f$4 r s - t^2 > 0\f$, \f$C\f$ is an ellipse. A special case occurs + * when \f$r = s\f$ and \f$t = 0\f$, when \f$C\f$ becomes a circle. * - *
    • If \f$4 r s - t^2 < 0\f$, \f$ C\f$ is a hyperbola. + *
    • If \f$4 r s - t^2 < 0\f$, \f$C\f$ is a hyperbola. * - *
    • If \f$4 r s - t^2 = 0\f$, \f$ C\f$ is a parabola. A degenerate case - * occurs when \f$r = s = t = 0\f$, when \f$ C\f$ is a line. + *
    • If \f$4 r s - t^2 = 0\f$, \f$C\f$ is a parabola. A degenerate case + * occurs when \f$r = s = t = 0\f$, when \f$C\f$ is a line. * *
    * @@ -27,15 +27,15 @@ namespace CGAL { * *
      * - *
    • A full ellipse (or a circle) \f$ C\f$. + *
    • A full ellipse (or a circle) \f$C\f$. * - *
    • The tuple \f$ \langle C, p_s, p_t, o \rangle\f$, where \f$ C\f$ is the - * supporting conic curve, with the arc endpoints being \f$ p_s\f$ and \f$ - * p_t\f$ (the source and target points, respectively). The orientation \f$ o\f$ - * indicates whether we proceed from \f$ p_s\f$ to \f$ p_t\f$ in a clockwise or - * in a counterclockwise direction. Note that \f$ C\f$ may also correspond to a - * line or to pair of lines---in this case \f$ o\f$ may specify a `COLLINEAR` - * orientation. + *
    • The tuple \f$\langle C, p_s, p_t, o \rangle\f$, where \f$C\f$ is the + * supporting conic curve, with the arc endpoints being \f$p_s\f$ and + * \f$p_t\f$ (the source and target points, respectively). The orientation + * \f$o\f$ indicates whether we proceed from \f$p_s\f$ to \f$p_t\f$ in a + * clockwise or in a counterclockwise direction. Note that \f$C\f$ may also + * correspond to a line or to pair of lines---in this case \f$o\f$ may specify a + * `COLLINEAR` orientation. * *
    * @@ -54,7 +54,7 @@ namespace CGAL { * must be rational numbers. This guarantees that the coordinates of all * arrangement vertices (in particular, those representing intersection points) * are algebraic numbers of degree \f$4\f$ (a real number \f$\alpha\f$ is an - * algebraic number of degree \f$d\f$ if there exist a polynomial \f$ p\f$ with + * algebraic number of degree \f$d\f$ if there exist a polynomial \f$p\f$ with * integer coefficient of degree \f$d\f$ such that \f$p(\alpha) = 0\f$). * We therefore require separate representations of the curve * coefficients and the point coordinates. The `NtTraits` should be substituted @@ -75,34 +75,31 @@ namespace CGAL { * and defines a curve and \f$x\f$-monotone curve types, as detailed below. * * While the `Arr_conic_traits_2` models the concept - * `ArrangementDirectionalXMonotoneTraits_2`, the implementation of + * `AosDirectionalXMonotoneTraits_2`, the implementation of * the `Are_mergeable_2` operation does not enforce the input curves * to have the same direction as a precondition. Moreover, `Arr_conic_traits_2` * supports the merging of curves of opposite directions. * - * \cgalModels{ArrangementTraits_2,ArrangementLandmarkTraits_2,ArrangementDirectionalXMonotoneTraits_2} + * \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosApproximateTraits_2,AosDirectionalXMonotoneTraits_2} * * \cgalHeading{Types} */ template class Arr_conic_traits_2 { public: - /// \name Types /// @{ - /*! the `NtTraits::Rational` type (and also the `RatKernel::FT` type). - */ + /// the `NtTraits::Rational` type (and also the `RatKernel::FT` type). typedef unspecified_type Rational; - /*! the `NtTraits::Algebraic` type (and also the `AlgKernel::FT` type). - */ + /// the `NtTraits::Algebraic` type (and also the `AlgKernel::FT` type). typedef unspecified_type Algebraic; /// @} /*! The `Curve_2` class nested within the conic-arc traits can represent - * arbitrary conic arcs and support their construction in various ways. The + * arbitrary conic arcs and support their construction in various ways. The * copy and default constructor as well as the assignment operator are * provided for conic arcs. In addition, an `operator<<` for the curves is * defined for standard output streams. @@ -211,7 +208,6 @@ public: void set_target(const Point_2 & pt); /// @} - }; /* end Arr_conic_traits_2::Curve_2 */ /*! \class X_monotone_curve_2 @@ -227,7 +223,6 @@ public: */ class X_monotone_curve_2 { public: - /// \name Creation /// @{ @@ -249,7 +244,6 @@ public: const Point_2& right() const; /// @} - }; /* end Arr_conic_traits_2::X_monotone_curve_2 */ /*! The `Point_2` class nested within the conic-arc traits is @@ -366,7 +360,8 @@ public: * respectively) is available, and their exact locations are given * implicitly, specified by the intersections of the supporting conic curve * with \f$r_1 x^2 + s_1 y^2 + t_1 x y + u_1 x + v_1 y + w_1 = 0\f$ and - * \f$r_2 x^2 + s_2 y^2 + t_2 x y + u_2 x + v_2 y + w_2 = 0\f$, respectively. + * \f$r_2 x^2 + s_2 y^2 + t_2 x y + u_2 x + v_2 y + w_2 = 0\f$, + * respectively. * * \pre The two auxiliary curves specifying the endpoints really intersect * with the supporting conic curve, such that the arc endpoints define a @@ -407,11 +402,13 @@ public: * \pre `source` and `target` must not be the same. * \return A segment connecting `source` and `target`. */ - X_monotone_curve_2 operator()(const Point_2& source, const Point_2& target) const; + X_monotone_curve_2 operator()(const Point_2& source, + const Point_2& target) const; /*! constructs a special segment of a given line connecting to given * endpoints. - * \param a, b, c The coefficients of the supporting line (\f$ax + by + c = 0\f$). + * \param a, b, c The coefficients of the supporting line + * (\f$ax + by + c = 0\f$). * \param source The source point. * \param target The target point. * \pre `source` and `target` must not be the same. @@ -419,7 +416,8 @@ public: */ X_monotone_curve_2 operator()(const Algebraic& a, const Algebraic& b, const Algebraic& c, - const Point_2& source, const Point_2& target) const; + const Point_2& source, + const Point_2& target) const; }; /*! \class Construct_bbox_2 @@ -440,56 +438,14 @@ public: Bbox_2 operator()(const X_monotone_curve_2& xcv) const { return bbox(xcv); } }; - /*! \name Auxiliary Functor definitions, used gor, e.g., the landmarks + /*! \name Auxiliary Functor definitions, used for, e.g., the landmarks \ * point-location strategy and the drawing function. */ - //@{ + /// @{ typedef double Approximate_number_type; typedef CGAL::Cartesian Approximate_kernel; typedef Approximate_kernel::Point_2 Approximate_point_2; - - /*! \class Approximate_2 - * A functor that approximates a point and an \f$x\f$-monotone curve. - */ - class Approximate_2 { - public: - /*! obtains an approximation of a point coordinate. - * \param p The exact point. - * \param i The coordinate index (either 0 or 1). - * \pre `i` is either 0 or 1. - * \return An approximation of p's \f$x\f$-coordinate (if `i` == 0), or an - * approximation of p's \f$y\f$-coordinate (if `i` == 1). - */ - Approximate_number_type operator()(const Point_2& p, int i) const; - - /*! obtains an approximation of a point. - * \param p The exact point. - */ - Approximate_point_2 operator()(const Point_2& p) const; - - /*! approximates a given \f$x\f$-monotone curve. It computes a sequence of - * approximate points that represent an approximate polyline, and inserts - * them into an output container given through an output iterator. The - * first and last points in the sequence are always approximations of the - * endpoints of the given arc. - * - * \param oi An output iterator for the output container. - * \param error The error bound of the polyline approximation. This is the - * Hausdorff distance between the arc and the polyline that - * approximates the arc. - * \param xcv The exact \f$x\f$-monotone arc. - * \param l2r A Boolean flag that indicates whether the arc direction is - * left to right. - * \return The past-the-end iterator of the output container. - * - * \pre Dereferencing `oi` must yield an object of type - * `Arr_conic_traits_2::Approximate_point_2`. - */ - template - OutputIterator operator()(OutputIterator oi, double error, - const X_monotone_curve_2& xcv, - bool l2r = true) const; - }; + /// @} /*! \class Trim_2 * A functor that trims a conic arc. @@ -522,11 +478,7 @@ public: /*! obtains a `Trim_2` functor. */ Trim_2 trim_2_object() const; - /*! obtains an `Approximate_2` functor. */ - Approximate_2 approximate_2_object() const; - /// @} - }; /* end Arr_conic_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_consolidated_curve_data_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_consolidated_curve_data_traits_2.h index c554bc499c2..88e2579512b 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_consolidated_curve_data_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_consolidated_curve_data_traits_2.h @@ -1,10 +1,9 @@ - namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * * The class `Arr_consolidated_curve_data_traits_2` is a model of the concept - * `ArrangementTraits_2`, and serves as a decorator class that enables the + * `AosTraits_2`, and serves as a decorator class that enables the * extension of the curve type defined by the `Traits` parameter. The traits * class inherits its point type from `Traits::Point_2`, and defines the types * `Curve_2` and `X_monotone_curve_2` extended with extraneous data fields of @@ -12,24 +11,21 @@ namespace CGAL { * * Each `Curve_2` object is associated with a single data field of type `Data`, * and each `X_monotone_curve_2` object is associated with a set of unique data - * objects. When a curve is subdivided into \f$ x\f$-monotone subcurves, all + * objects. When a curve is subdivided into \f$x\f$-monotone subcurves, all * resulting subcurves are associated with a list containing a single data - * object, copied from the inducing curve. When an \f$ x\f$-monotone curve is + * object, copied from the inducing curve. When an \f$x\f$-monotone curve is * split, its data set is duplicated, and inserted into the sets of both - * resulting subcurves. In case two (or more) \f$ x\f$-monotone curves overlap, - * their data sets are consolidated, and are inserted into the set of the \f$ - * x\f$-monotone curve that represents the overlap. + * resulting subcurves. In case two (or more) \f$x\f$-monotone curves overlap, + * their data sets are consolidated, and are inserted into the set of the + * \f$x\f$-monotone curve that represents the overlap. * - * \cgalModels{ArrangementTraits_2} + * \cgalModels{AosTraits_2} */ template -class Arr_consolidated_curve_data_traits_2 - : public Arr_curve_data_traits_2, - _Consolidate_unique_lists, - Data> -{ +class Arr_consolidated_curve_data_traits_2 : + public Arr_curve_data_traits_2, + _Consolidate_unique_lists, Data> { public: - /// \name Types /// @{ @@ -39,10 +35,10 @@ public: //! the base curve. typedef typename Base_traits_2::Curve_2 Base_curve_2; - //! the base \f$ x\f$-monotone curve curve. + //! the base \f$x\f$-monotone curve curve. typedef typename Base_traits_2::X_monotone_curve_2 Base_x_monotone_curve_2; - //! a set of data objects that is associated with an \f$ x\f$-monotone curve. + //! a set of data objects that is associated with an \f$x\f$-monotone curve. typedef unspecified_type typedef Data_container; //! a non-mutable iterator for the data objects in the data container. @@ -59,14 +55,15 @@ public: */ class Data_container { public: - /// \name Creation /// @{ - /*! constructs default */ + /*! constructs default. + */ Data_container(); - /*! constructs set containing a single `data` object. */ + /*! constructs set containing a single `data` object. + */ Data_container(const Data& data); /// @} @@ -74,22 +71,27 @@ public: /// \name Access Functions /// @{ - /*! returns the number of data objects in the set. */ + /*! returns the number of data objects in the set. + */ std::size_t size() const; - /*! returns an iterator pointing to the first data object. */ + /*! returns an iterator pointing to the first data object. + */ Data_iterator begin() const; - /*! returns a past-the-end iterator for the data objects. */ + /*! returns a past-the-end iterator for the data objects. + */ Data_iterator end() const; /*! returns the first data object inserted into the set. - * \pre The number of data objects is not \f$ 0\f$. + * + * \pre The number of data objects is not \f$0\f$. */ const Data& front() const; /*! returns the last data object inserted into the set. - * \pre The number of data objects is not \f$ 0\f$. + * + * \pre The number of data objects is not \f$0\f$. */ const Data& back() const; @@ -123,13 +125,12 @@ public: */ bool erase(const Data& data); - /*! clears the set. */ + /*! clears the set. + */ void clear(); /// @} - }; /* end Arr_consolidated_curve_data_traits_2::Data_container */ - }; /* end Arr_consolidated_curve_data_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_curve_data_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_curve_data_traits_2.h index c185f3f12fd..2fc70e20c6f 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_curve_data_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_curve_data_traits_2.h @@ -2,10 +2,10 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * - * The class `Arr_curve_data_traits_2` is a model of the `ArrangementTraits_2` + * The class `Arr_curve_data_traits_2` is a model of the `AosTraits_2` * concept and serves as a decorator class that allows the extension of the - * curves defined by the base traits-class (the `Tr` parameter), which serves as - * a geometric traits-class (a model of the `ArrangementTraits_2` concept), with + * curves defined by the base traits-class (the `Tr` parameter), which serves + * as a geometric traits-class (a model of the `AosTraits_2` concept), with * extraneous (non-geometric) data fields. * * The traits class inherits its point type from `Traits::Point_2`, and defines @@ -13,7 +13,7 @@ namespace CGAL { * * Each `Curve_2` object is associated with a single data field of type `CData`, * and each `X_monotone_curve_2` object is associated with a single data field - * of type `XData`. When a curve is subdivided into \f$ x\f$-monotone subcurves, + * of type `XData`. When a curve is subdivided into \f$x\f$-monotone subcurves, * its data field is converted using the conversion functor, which is specified * by the `Cnv` template-parameter, and the resulting objects is copied to all * `X_monotone_curve_2` objects induced by this curve. The conversion functor @@ -24,21 +24,18 @@ namespace CGAL { * By default, the two data types are the same, so the conversion operator * is trivial: * - *
    - * - * - * + *
    - * `CData` = - * - * `XData` - *
    - * `Cnv` = - * - * `_Default_convert_functor` - *
    + * + * + * + * + * + * + * + * *
    `CData` = `XData`
    `Cnv` =`_Default_convert_functor`
    * - * In case two (or more) \f$ x\f$-monotone curves overlap, their data fields are + * In case two (or more) \f$x\f$-monotone curves overlap, their data fields are * merged to a single field, using the merge functor functor, which is specified * by the `Mrg` template-parameter. This functor should provide an operator with * the following prototype: @@ -46,48 +43,39 @@ namespace CGAL { * `XData operator() (const XData& d1, const XData& d2) const;` * * which returns a single data object that represents the merged data field of - * `d1` and `d2`. The \f$ x\f$-monotone curve that represents the overlap is + * `d1` and `d2`. The \f$x\f$-monotone curve that represents the overlap is * associated with the output of this functor. * - * \cgalModels{ArrangementTraits_2} + * \cgalModels{AosTraits_2} */ template class Arr_curve_data_traits_2 : public Tr { public: - /// \name Types /// @{ - /*! the base traits-class. - */ + /// the base traits-class. typedef Tr Base_traits_2; - /*! the base curve. - */ + /// the base curve. typedef typename Base_traits_2::Curve_2 Base_curve_2; - /*! the base \f$ x\f$-monotone curve curve. - */ + /// the base \f$x\f$-monotone curve curve. typedef typename Base_traits_2::X_monotone_curve_2 Base_x_monotone_curve_2; - /*! the point type. - */ + /// the point type. typedef typename Base_traits_2::Point_2 Point_2; - /*! the merge functor. - */ + /// the merge functor. typedef Mrg Merge; - /*! the conversion functor. - */ + /// the conversion functor. typedef Cnv Convert; - /*! the type of data associated with curves. - */ + /// the type of data associated with curves. typedef CData Curve_data; - /*! the type of data associated with \f$ x\f$-monotone curves. - */ + /// the type of data associated with \f$x\f$-monotone curves. typedef XData X_monotone_curve_data; /// @} @@ -97,7 +85,6 @@ public: */ class Curve_2 : public Base_curve_2 { public: - /// \name Creation /// @{ @@ -129,7 +116,6 @@ public: void set_data(const Curve_data& data); /// @} - }; /* end Arr_curve_data_traits_2::Curve_2 */ /*! The `X_monotone_curve_2` class nested within the curve-data traits extends @@ -137,20 +123,19 @@ public: */ class X_monotone_curve_2 : public Base_x_monotone_curve_2 { public: - /// \name Creation /// @{ /*! constructs default */ X_monotone_curve_2(); - /*! constructs an \f$ x\f$-monotone curve from the given `base` curve with + /*! constructs an \f$x\f$-monotone curve from the given `base` curve with * uninitialized data field. */ X_monotone_curve_2(const Base_x_monotone_curve_2& base); - /*! constructs an \f$ x\f$-monotone curve from the given `base` \f$ - * x\f$-monotone curve with an attached `data` field. + /*! constructs an \f$x\f$-monotone curve from the given `base` + * \f$x\f$-monotone curve with an attached `data` field. */ X_monotone_curve_2(const Base_x_monotone_curve_2& base, const X_monotone_curve_data& data); @@ -170,9 +155,7 @@ public: void set_data(const X_monotone_curve_data& data); /// @} - }; /* end Arr_curve_data_traits_2::X_monotone_curve_2 */ - }; /* end Arr_curve_data_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel.h index b65f8bf4799..56e4e3c3101 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel.h @@ -7,8 +7,8 @@ namespace CGAL { * class templates and other templates. It is parameterized by a geometry * traits type and optionally by a vertex, halfedge, or face types. By default, * the `Arr_dcel` class template uses the \link - * ArrangementBasicTraits_2::Point_2 `Point_2`\endlink and \link - * ArrangementBasicTraits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink + * AosBasicTraits_2::Point_2 `Point_2`\endlink and \link + * AosBasicTraits_2::X_monotone_curve_2 `X_monotone_curve_2`\endlink * types nested in the traits type to instantiate the vertex and base halfedge * types, respectively. Thus, by default the \dcel only stores the topological * incidence relations and the geometric data attached to vertices and @@ -16,15 +16,15 @@ namespace CGAL { * overridden. Notice that if the vertex and halfedge types are overridden, the * traits type is ignored. * - * \cgalModels{ArrangementDcelWithRebind} + * \cgalModels{AosDcelWithRebind} * * \tparam Traits a geometry traits type, which is a model of the - * `ArrangementBasicTraits_2` concept. - * \tparam V the vertex type, which is a model of the `ArrangementDcelVertex` + * `AosBasicTraits_2` concept. + * \tparam V the vertex type, which is a model of the `AosDcelVertex` * concept. * \tparam H the halfedge type, which is a model of the - * `ArrangementDcelHalfedge` concept. - * \tparam F the face type, which is a model of the `ArrangementDcelFace` + * `AosDcelHalfedge` concept. + * \tparam F the face type, which is a model of the `AosDcelFace` * concept. * * \sa `Arr_dcel_base` @@ -33,7 +33,6 @@ template , typename H = Arr_halfedge_base, typename F = Arr_face_base> -class Arr_dcel : public Arr_dcel_base { -}; +class Arr_dcel : public Arr_dcel_base {}; } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel_base.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel_base.h index 9fa8f5f4d96..1de87dba728 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_dcel_base.h @@ -1,71 +1,46 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2DCEL - -\anchor arr_refarr_dcel_base - -The `Arr_dcel_base` class is an important ingredient in the -definition of \dcel data structures. It serves as a basis class for -any instance of the `Dcel` template parameter of the -`Arrangement_2` template. In particular it is the basis class of -the default `Dcel` template parameter, and the basis class of any -extended \dcel. The template parameters `V`, `H`, and `F` -must be instantiated with models of the concepts -`ArrangementDcelVertex`, `ArrangementDcelHalfedge`, -and `ArrangementDcelFace` respectively. - -\cgalModels{ArrangementDcel} - -*/ -template< typename V, typename H, typename F > +/*! \ingroup PkgArrangementOnSurface2DCEL + * + * \anchor arr_refarr_dcel_base + * + * The `Arr_dcel_base` class is an important ingredient in the definition of + * \dcel data structures. It serves as a basis class for any instance of the + * `Dcel` template parameter of the `Arrangement_2` template. In particular it + * is the basis class of the default `Dcel` template parameter, and the basis + * class of any extended \dcel. The template parameters `V`, `H`, and `F` must + * be instantiated with models of the concepts `AosVertex`, `AosHalfedge`, and + * `AosFace` respectively. + * + * \cgalModels{Aos} + */ +template class Arr_dcel_base { public: + /*! The basic \dcel face type. Serves as a basis class for an extended + * face record with auxiliary data fields. + * + * \cgalModels{AosFace} + */ + class Arr_face_base {}; + /*! The basic \dcel halfedge type. Serves as a basis class for an extended + * halfedge record with auxiliary data fields. The `Curve` parameter is the + * type of \f$x\f$-monotone curves associated with the vertices. + * + * \cgalModels{AosHalfedge} + */ + template + class Arr_halfedge_base {}; -/*! - -The basic \dcel face type. Serves as a basis class for an extended -face record with auxiliary data fields. - -\cgalModels{ArrangementDcelFace} - -*/ -class Arr_face_base { - -}; /* end Arr_dcel_base::Arr_face_base */ - -/*! - - -The basic \dcel halfedge type. Serves as a basis class for an -extended halfedge record with auxiliary data fields. The `Curve` -parameter is the type of \f$ x\f$-monotone curves associated with the vertices. - -\cgalModels{ArrangementDcelHalfedge} - -*/ -template< typename Curve > -class Arr_halfedge_base { - -}; /* end Arr_dcel_base::Arr_halfedge_base */ - -/*! - - -The basic \dcel vertex type. Serves as a basis class for an extended -vertex record with auxiliary data fields. The `Point` parameter is -the type of points associated with the vertices. - -\cgalModels{ArrangementDcelVertex} - -*/ -template< typename Point > -class Arr_vertex_base { - -}; /* end Arr_dcel_base::Arr_vertex_base */ - - + /*! The basic \dcel vertex type. Serves as a basis class for an extended + * vertex record with auxiliary data fields. The `Point` parameter is the + * type of points associated with the vertices. + * + * \cgalModels{AosVertex} + */ + template + class Arr_vertex_base {}; }; /* end Arr_dcel_base */ + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_dcel.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_dcel.h index b2dba1ca39e..e0674c72567 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_dcel.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_dcel.h @@ -5,17 +5,17 @@ namespace CGAL { * The default \dcel class used by the `Arrangement_2`, * `Arr_bounded_planar_topology_traits_2`, `Arr_unb_planar_topology_traits_2` * class templates and other templates. It is parameterized by a geometry - * traits type. It uses the \link ArrangementBasicTraits_2::Point_2 - * `Point_2`\endlink and \link ArrangementBasicTraits_2::X_monotone_curve_2 + * traits type. It uses the \link AosBasicTraits_2::Point_2 + * `Point_2`\endlink and \link AosBasicTraits_2::X_monotone_curve_2 * `X_monotone_curve_2`\endlink types nested in the traits type to instantiate * the vertex and base halfedge types, respectively. Thus, by default the \dcel * only stores the topological incidence relations and the geometric data * attached to vertices and edges. * - * \cgalModels{ArrangementDcelWithRebind} + * \cgalModels{AosDcelWithRebind} * * \tparam Traits a geometry traits type, which is a model of the - * `ArrangementBasicTraits_2` concept. + * `AosBasicTraits_2` concept. * * \sa `Arr_dcel` * \sa `Arr_dcel_base` diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_overlay_traits.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_overlay_traits.h index 5b5677b7458..7b4f4fe7f6a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_overlay_traits.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_default_overlay_traits.h @@ -1,57 +1,45 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses -\ingroup PkgArrangementOnSurface2Overlay +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * \ingroup PkgArrangementOnSurface2Overlay + * + * An instance of `Arr_default_overlay_traits` should be used for overlaying two + * arrangements of type `Arrangement` that store no auxiliary data with their + * \dcel records, where the resulting overlaid arrangement stores no auxiliary + * \dcel data as well. This class simply gives empty implementation for all + * traits-class functions. + * + * \cgalModels{OverlayTraits} + * + * \sa `overlay` + */ +template +class Arr_default_overlay_traits {}; -An instance of `Arr_default_overlay_traits` should be used for overlaying two arrangements -of type `Arrangement` that store no auxiliary data with their \dcel records, where the resulting overlaid arrangement stores no auxiliary -\dcel data as well. This class simply gives empty implementation for all -traits-class functions. +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * \ingroup PkgArrangementOnSurface2Overlay + * + * An instance of `Arr_face_overlay_traits` should be used for overlaying two + * arrangements of types `Arr_A` and `Arr_B`, which are instantiated using the + * same geometric traits-class and with the \dcel classes `Dcel_A` and `Dcel_B` + * respectively, in order to store their overlay in an arrangement of type + * `Arr_R`, which is instantiated using a third \dcel class `Dcel_R`. All three + * \dcel classes are assumed to be instantiations of the + * `Arr_face_extended_dcel` template with types `FaceData_A`, `FaceData_B` and + * `FaceData_R`, respectively. + * + * This class gives empty implementation for all overlay traits-class functions, + * except the function that computes the overlay of two faces. In this case, it + * uses the functor `OvlFaceData`, which accepts a `FaceData_A` object and a + * `FaceData_B` object and computes a corresponding `FaceData_R` object, in + * order to set the auxiliary data of the overlay face. + * + * \cgalModels{OverlayTraits} + * + * \sa `overlay` + * \sa `CGAL::Arr_face_extended_dcel` + */ +template +class Arr_face_overlay_traits {}; -\cgalModels{OverlayTraits} - -\sa `overlay` - -*/ -template< typename Arrangement > -class Arr_default_overlay_traits { -public: - -}; /* end Arr_default_overlay_traits */ -} /* end namespace CGAL */ - -namespace CGAL { - -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses -\ingroup PkgArrangementOnSurface2Overlay - -An instance of `Arr_face_overlay_traits` should be used for overlaying two arrangements -of types `Arr_A` and `Arr_B`, which are instantiated using the same -geometric traits-class and with the \dcel classes `Dcel_A` and -`Dcel_B` respectively, in order to store their overlay in an arrangement -of type `Arr_R`, which is instantiated using a third \dcel class -`Dcel_R`. All three \dcel classes are assumed to be instantiations of the -`Arr_face_extended_dcel` template with types `FaceData_A`, -`FaceData_B` and `FaceData_R`, respectively. - -This class gives empty implementation for all overlay traits-class functions, -except the function that computes the overlay of two faces. In this case, -it uses the functor `OvlFaceData`, which accepts a `FaceData_A` object -and a `FaceData_B` object and computes a corresponding `FaceData_R` -object, in order to set the auxiliary data of the overlay face. - -\cgalModels{OverlayTraits} - -\sa `overlay` -\sa `CGAL::Arr_face_extended_dcel` - -*/ -template< typename Arr_A, typename Arr_B, typename Arr_R, typename OvlFaceData > -class Arr_face_overlay_traits { -public: - -}; /* end Arr_face_overlay_traits */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_enums.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_enums.h index 9a599f50c75..122054cbcb9 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_enums.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_enums.h @@ -6,7 +6,7 @@ namespace CGAL { * \f$x\f$-monotone curve. It is used by models geometry traits concept that * handle boundary conditions. * - * \sa `ArrangementOpenBoundaryTraits_2` + * \sa `AosOpenBoundaryTraits_2` */ enum Arr_curve_end { ARR_MIN_END, ARR_MAX_END }; diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_extended_dcel.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_extended_dcel.h index b36aa2a7eb7..4fb8c85916e 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_extended_dcel.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_extended_dcel.h @@ -1,246 +1,208 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2DCEL +/*! \ingroup PkgArrangementOnSurface2DCEL + * + * The `Arr_extended_dcel` class-template extends the topological-features of + * the \dcel namely the vertex, halfedge, and face types. While it is possible + * to maintain extra (non-geometric) data with the curves or points of the + * arrangement by extending their types respectively, it is also possible to + * extend the vertex, halfedge, or face types of the \dcel through + * inheritance. As the technique to extend these types is somewhat cumbersome + * and difficult for inexperienced users, the `Arr_extended_dcel` class-template + * provides a convenient way to do that. Each one of the three features is + * extended with a corresponding data type provided as parameters. This class + * template is also parameterized with a traits class used to extract default + * values for the vertex, halfedge, and face base classes, which are the + * remaining three template parameters respectively. The default values follow: + * + *
    + * + * `V` = + * + * `Arr_vertex_base` + *
    + * `H` = + * + * `Arr_halfedge_base` + *
    + * `F` = + * + * `Arr_face_base` + * + *
    + * + * \cgalModels{AosDcelWithRebind} + * + * \sa `Arr_dcel_base` + */ +template +class Arr_extended_dcel : public Arr_dcel_base, + Arr_extended_halfedge, + Arr_extended_face> +{}; -The `Arr_extended_dcel` class-template extends the topological-features of the \dcel -namely the vertex, halfedge, and face types. While it is possible to maintain -extra (non-geometric) data with the curves or points of the arrangement by -extending their types respectively, it is also possible to extend the vertex, -halfedge, or face types of the \dcel through inheritance. As the technique to -extend these types is somewhat cumbersome and difficult for inexperienced -users, the `Arr_extended_dcel` class-template provides a convenient way to do that. -Each one of the three features is extended with a corresponding data type -provided as parameters. This class template is also parameterized with a -traits class used to extract default values for the vertex, halfedge, and face -base classes, which are the remaining three template parameters respectively. -The default values follow: - -
    - -`V` = - -`Arr_vertex_base` -
    -`H` = - -`Arr_halfedge_base` -
    -`F` = - -`Arr_face_base` - -
    - -\cgalModels{ArrangementDcelWithRebind} - -\sa `Arr_dcel_base` - -*/ -template< typename Traits, typename VData, typename HData, typename FData, typename V, typename H, typename F > -class Arr_extended_dcel - : public Arr_dcel_base, - Arr_extended_halfedge, - Arr_extended_face > -{ - -}; /* end Arr_extended_dcel */ -} /* end namespace CGAL */ - -namespace CGAL { - -/*! -\ingroup PkgArrangementOnSurface2DCEL - -The `Arr_extended_face` class-template extends the face topological-features of the -\dcel. It is parameterized by a face base-type `FaceBase` and a data type -`FData` used to extend the face base-type. - -\cgalModels{ArrangementDcelFace} - -\sa `Arr_dcel_base` - -*/ -template< typename FaceBase, typename FData > +/*! \ingroup PkgArrangementOnSurface2DCEL + * + * The `Arr_extended_face` class-template extends the face topological-features + * of the \dcel. It is parameterized by a face base-type `FaceBase` and a data + * type `FData` used to extend the face base-type. + * + * \cgalModels{AosDcelFace} + * + * \sa `Arr_dcel_base` + */ +template class Arr_extended_face : FaceBase { public: + /// \name Creation + /// @{ -/// \name Creation -/// @{ + /*! assigns `f` with the contents of the `other` vertex. + */ + void assign(const Self & other); -/*! -assigns `f` with the contents of the `other` vertex. -*/ -void assign (const Self & other); + /// @} -/// @} + /// \name Access Functions + /// @{ -/// \name Access Functions -/// @{ + /*! obtains the auxiliary data (a non-const version, returning a reference + * to a mutable data object is also available). + */ + const FData & data() const; -/*! -obtains the auxiliary data (a non-const version, returning a reference -to a mutable data object is also available). -*/ -const FData & data () const; + /// @} -/// @} + /// \name Modifiers + /// @{ -/// \name Modifiers -/// @{ - -/*! -sets the auxiliary data. -*/ -void set_data (const FData & data); - -/// @} + /*! sets the auxiliary data. + */ + void set_data(const FData & data); + /// @} }; /* end Arr_extended_face */ -} /* end namespace CGAL */ -namespace CGAL { - -/*! -\ingroup PkgArrangementOnSurface2DCEL - -The `Arr_extended_halfedge` class-template extends the halfedge topological-features of -the \dcel. It is parameterized by a halfedge base-type `HalfedgeBase` -and a data type `HData` used to extend the halfedge base-type. - -\cgalModels{ArrangementDcelHalfedge} - -\sa `Arr_dcel_base` - -*/ -template< typename HalfedgeBase, typename HData > +/*! \ingroup PkgArrangementOnSurface2DCEL + * + * The `Arr_extended_halfedge` class-template extends the halfedge + * topological-features of the \dcel. It is parameterized by a halfedge + * base-type `HalfedgeBase` and a data type `HData` used to extend the halfedge + * base-type. + * + * \cgalModels{AosDcelHalfedge} + * + * \sa `Arr_dcel_base` + */ +template class Arr_extended_halfedge : public HalfedgeBase { public: + /// \name Creation + /// @{ -/// \name Creation -/// @{ + /*! assigns `he` with the contents of the `other` vertex. + */ + void assign(const Self & other); -/*! -assigns `he` with the contents of the `other` vertex. -*/ -void assign (const Self & other); + /// @} -/// @} + /// \name Access Functions + /// @{ -/// \name Access Functions -/// @{ + /*! obtains the auxiliary data (a non-const version, returning a reference + * to a mutable data object is also available). + */ + const HData & data() const; -/*! -obtains the auxiliary data (a non-const version, returning a reference -to a mutable data object is also available). -*/ -const HData & data () const; + /// @} -/// @} + /// \name Modifiers + /// @{ -/// \name Modifiers -/// @{ - -/*! -sets the auxiliary data. -*/ -void set_data (const HData & data); - -/// @} + /*! sets the auxiliary data. + */ + void set_data(const HData & data); + /// @} }; /* end Arr_extended_halfedge */ -} /* end namespace CGAL */ -namespace CGAL { - -/*! -\ingroup PkgArrangementOnSurface2DCEL - -The `Arr_extended_vertex` class-template extends the vertex -topological-features of the \dcel. It is parameterized by a -vertex base-type `VertexBase` and a data type `VData` used to extend -the vertex base-type. - -\cgalModels{ArrangementDcelVertex} - -\sa `Arr_dcel_base` - -*/ -template< typename VertexBase, typename VData > +/*! \ingroup PkgArrangementOnSurface2DCEL + * + * The `Arr_extended_vertex` class-template extends the vertex + * topological-features of the \dcel. It is parameterized by a + * vertex base-type `VertexBase` and a data type `VData` used to extend + * the vertex base-type. + * + * \cgalModels{AosDcelVertex} + * + * \sa `Arr_dcel_base` + */ +template class Arr_extended_vertex : public VertexBase { public: + /// \name Creation + /// @{ -/// \name Creation -/// @{ + /*! assigns `v` with the contents of the `other` vertex. + */ + void assign(const Self & other); -/*! -assigns `v` with the contents of the `other` vertex. -*/ -void assign (const Self & other); + /// @} -/// @} + /// \name Access Functions + /// @{ -/// \name Access Functions -/// @{ + /*! obtains the auxiliary data (a non-const version, returning a reference + * to a mutable data object is also available). + */ + const VData & data() const; -/*! -obtains the auxiliary data (a non-const version, returning a reference -to a mutable data object is also available). -*/ -const VData & data () const; + /// @} -/// @} + /// \name Modifiers + /// @{ -/// \name Modifiers -/// @{ - -/*! -sets the auxiliary data. -*/ -void set_data (const VData & data); - -/// @} + /*! sets the auxiliary data. + */ + void set_data(const VData & data); + /// @} }; /* end Arr_extended_vertex */ -} /* end namespace CGAL */ - -namespace CGAL { - -/*! -\ingroup PkgArrangementOnSurface2DCEL - -The `Arr_face_extended_dcel` class-template extends the \dcel face-records, making it -possible to store extra (non-geometric) data with the arrangement faces. -The class should be instantiated by an `FData` type which represents the -extra data stored with each face. - -Note that all types of \dcel features (namely vertex, halfedge and face) -are provided as template parameters. However, by default they are defined -as follows: - -
    - -`V` = - -`Arr_vertex_base` -
    -`H` = - -`Arr_halfedge_base` -
    -`F` = - -`Arr_face_base` - -
    - -\cgalModels{ArrangementDcelWithRebind} - -\sa `Arr_dcel_base` - -*/ -template< typename Traits, typename FData, typename V, typename H, typename F > -class Arr_face_extended_dcel : public Arr_dcel_base > { -}; /* end Arr_face_extended_dcel */ + +/*! \ingroup PkgArrangementOnSurface2DCEL + * + * The `Arr_face_extended_dcel` class-template extends the \dcel face-records, + * making it possible to store extra (non-geometric) data with the arrangement + * faces. The class should be instantiated by an `FData` type which represents + * the extra data stored with each face. + * + * Note that all types of \dcel features (namely vertex, halfedge and face) + * are provided as template parameters. However, by default they are defined + * as follows: + * + *
    + * + * `V` = + * + * `Arr_vertex_base` + *
    + * `H` = + * + * `Arr_halfedge_base` + *
    + * `F` = + * + * `Arr_face_base` + * + *
    + * + * \cgalModels{AosDcelWithRebind} + * + * \sa `Arr_dcel_base` + */ +template +class Arr_face_extended_dcel : + public Arr_dcel_base> {}; + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_face_index_map.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_face_index_map.h index 21f071f4596..7830f8f5a18 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_face_index_map.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_face_index_map.h @@ -1,69 +1,64 @@ namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2Ref - * - * `Arr_face_index_map` maintains a mapping of face handles of an attached - * arrangement object to indices (of type `unsigned int`). This class template - * is a model of the concept `ReadablePropertyMap`. A mapping between face - * handles and indices enables convenient usage of property-map classes supplied - * by `boost`. For example, the property-map class templates - * `boost::vector_property_map`, which is based on `std::vector`, and - * `boost::iterator_property_map`, which can be used to implement a property map - * based on a native \CC array, require the user to supply a mapping such as - * `Arr_face_index_map`. - * - * As new faces might be inserted into the attached arrangement, and - * existing faces might be removed, the notification mechanism is used - * to dynamically maintain the mapping of face handles to indices. - * - * \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap} - * - * \sa `Arr_vertex_index_map` +/*! \ingroup PkgArrangementOnSurface2Ref + * + * `Arr_face_index_map` maintains a mapping of face handles of an attached + * arrangement object to indices (of type `unsigned int`). This class template + * is a model of the concept `ReadablePropertyMap`. A mapping between face + * handles and indices enables convenient usage of property-map classes supplied + * by `boost`. For example, the property-map class templates + * `boost::vector_property_map`, which is based on `std::vector`, and + * `boost::iterator_property_map`, which can be used to implement a property map + * based on a native \CC array, require the user to supply a mapping such as + * `Arr_face_index_map`. + * + * As new faces might be inserted into the attached arrangement, and + * existing faces might be removed, the notification mechanism is used + * to dynamically maintain the mapping of face handles to indices. + * + * \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap} + * + * \sa `Arr_vertex_index_map` + */ +template +class Arr_face_index_map: public Arrangement_::Observer { +public: + /// \name Types + /// @{ + + /// the type of the attached arrangement. + typedef Arrangement_ Arrangement_2; + + typedef typename Arrangement_2::Base_aos Base_aos; + + typedef boost::readable_property_map_tag category; + + typedef unsigned int value_type; + + typedef unsigned int reference; + + typedef Face_handle key_type; + + /// The face handle type. + typedef typename Base_aos::Face_handle Face_handle; + + /// The type of mapping of faces to indices. + typedef Unique_hash_map Index_map; + + /// @} + + /// \name Creation + /// @{ + + /*! constructs a map that is unattached to any arrangement instance. */ + Arr_face_index_map(); - template - class Arr_face_index_map: public Arrangement_::Observer { - public: + /*! constructs a map and attaches it to the given arrangement `arr`. + */ + Arr_face_index_map(Base_aos& arr); - /// \name Types - /// @{ - - /*! the type of the attached arrangement. - */ - typedef Arrangement_ Arrangement_2; - typedef typename Arrangement_2::Base_aos Base_aos; - - typedef boost::readable_property_map_tag category; - - typedef unsigned int value_type; - - typedef unsigned int reference; - - typedef Face_handle key_type; - - /*! The face handle type. - */ - typedef typename Base_aos::Face_handle Face_handle; - - /*! The type of mapping of faces to indices. - */ - typedef Unique_hash_map Index_map; - - /// @} - - /// \name Creation - /// @{ - - /*! constructs a map that is unattached to any arrangement instance. - */ - Arr_face_index_map(); - - /*! constructs a map and attaches it to the given arrangement `arr`. - */ - Arr_face_index_map(Base_aos& arr); - - /// @} - - }; /* end Arr_accessor */ + /// @} +}; /* end Arr_accessor */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h index 8c766b7783e..5b1f1c73abf 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -1,451 +1,452 @@ namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2TraitsClasses - * - * The traits class `Arr_geodesic_arc_on_sphere_traits_2` is a model of the - * `ArrangementTraits_2` concept. It enables the construction and - * maintenance of arrangements of arcs of great circles (also known as - * geodesic arcs) that lie on the sphere (centered at the origin). Almost - * all operations on arrangements require a kernel that supports exact - * predicates. Most operations also require a kernel that supports exact - * constructions. However, all operations on such arrangements can be - * computed efficiently, since all calculations are performed with - * rational arithmetic. - * - * There is an analogy between this class of arrangements and the class of - * planar arrangements induced by linear curves (i.e., segments, rays, and - * lines), as properties of linear curves in the plane often, but not always, - * hold for geodesic arcs on the sphere. For example, given any two - * non-antipodal points on the sphere there exists a unique great circle - * connecting the two points. - * - * We use the following parameterization of the unit sphere \f$S = - * \phi_S(\Phi)\f$: \f$\Phi = [\alpha, 2\pi + \alpha] \times [-\frac{\pi}{2}, - * \frac{\pi}{2}]\f$, \f$\phi_S(x, y) = (\cos y \cos x, \sin y \cos x, \sin - * x)\f$, where \f$\alpha = \arctan(X, Y)\f$. By default, \f$X = -1, Y = 0\f$, - * which implies \f$\alpha = \pi\f$, and a default parameterization \f$\Phi = - * [-\pi, \pi] \times [-\frac{\pi}{2}, \frac{\pi}{2}]\f$. The equator curve, - * for example, is given by \f$\gamma(t) = (\pi(2t - 1) + \alpha, 0)\f$, for - * \f$t \in [0,1]\f$. This parameterization induces two contraction points - * \f$p_s = (0, 0, -1) = \phi_S(y,-\frac{\pi}{2})\f$ and \f$p_n = (0, 0, 1) = - * \phi_S(y,\frac{\pi}{2})\f$, referred to as the south and north poles, - * respectively, and an identification curve \f$\{\phi_S(\pi + - * \alpha,x)\,|\,-\frac{\pi}{2} \leq v \leq \frac{\pi}{2}\}\f$, as - * \f$\phi_S(-\pi + \alpha,v) = \phi_S(+\pi + \alpha,v)\f$ for all \f$x\f$ - * (which coincides with the opposite Prime (Greenwich) Meridian when - * \f$\alpha = \pi\f$). The elements that substitutes the template parameters - * `X` and `Y` when `Arr_geodesic_arc_on_sphere_traits_2` is - * instantiated must be integral values that define a not necessarily - * normalized vector \f$(x,y)\f$ in the \f$xy\f$-plane that bisects the - * identification curve. +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * The traits class `Arr_geodesic_arc_on_sphere_traits_2` is a model of the + * `AosTraits_2` concept. It enables the construction and + * maintenance of arrangements of arcs of great circles (also known as + * geodesic arcs) that lie on the sphere (centered at the origin). Almost + * all operations on arrangements require a kernel that supports exact + * predicates. Most operations also require a kernel that supports exact + * constructions. However, all operations on such arrangements can be + * computed efficiently, since all calculations are performed with + * rational arithmetic. + * + * There is an analogy between this class of arrangements and the class of + * planar arrangements induced by linear curves (i.e., segments, rays, and + * lines), as properties of linear curves in the plane often, but not always, + * hold for geodesic arcs on the sphere. For example, given any two + * non-antipodal points on the sphere there exists a unique great circle + * connecting the two points. + * + * We use the following parameterization of the unit sphere \f$S = + * \phi_S(\Phi)\f$: \f$\Phi = [\alpha, 2\pi + \alpha] \times [-\frac{\pi}{2}, + * \frac{\pi}{2}]\f$, \f$\phi_S(x, y) = (\cos y \cos x, \sin y \cos x, \sin + * x)\f$, where \f$\alpha = \arctan(X, Y)\f$. By default, \f$X = -1, Y = 0\f$, + * which implies \f$\alpha = \pi\f$, and a default parameterization \f$\Phi = + * [-\pi, \pi] \times [-\frac{\pi}{2}, \frac{\pi}{2}]\f$. The equator curve, + * for example, is given by \f$\gamma(t) = (\pi(2t - 1) + \alpha, 0)\f$, for + * \f$t \in [0,1]\f$. This parameterization induces two contraction points + * \f$p_s = (0, 0, -1) = \phi_S(y,-\frac{\pi}{2})\f$ and \f$p_n = (0, 0, 1) = + * \phi_S(y,\frac{\pi}{2})\f$, referred to as the south and north poles, + * respectively, and an identification curve \f$\{\phi_S(\pi + + * \alpha,x)\,|\,-\frac{\pi}{2} \leq v \leq \frac{\pi}{2}\}\f$, as + * \f$\phi_S(-\pi + \alpha,v) = \phi_S(+\pi + \alpha,v)\f$ for all \f$x\f$ + * (which coincides with the opposite Prime (Greenwich) Meridian when + * \f$\alpha = \pi\f$). The elements that substitutes the template parameters + * `X` and `Y` when `Arr_geodesic_arc_on_sphere_traits_2` is + * instantiated must be integral values that define a not necessarily + * normalized vector \f$(x,y)\f$ in the \f$xy\f$-plane that bisects the + * identification curve. - * \cgalModels{ArrangementTraits_2,ArrangementLandmarkTraits_2,ArrangementSphericalBoundaryTraits_2} + * \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosApproximateTraits_2,AosSphericalBoundaryTraits_2} + */ +template +class Arr_geodesic_arc_on_sphere_traits_2 { +public: + /*! The `Point_2` class nested within the traits is used to represent a + * point on a sphere centered at the origin. The point is in fact a + * not-necessarily normalized 3D direction extended with information that + * specifies the location of the point pre-image in the parameter space. + * + * \cgalModels{Assignable,DefaultConstructible,CopyConstructible} */ - - template - class Arr_geodesic_arc_on_sphere_traits_2 { + class Point_2 { public: - /*! The `Point_2` class nested within the traits is used to represent a - * point on a sphere centered at the origin. The point is in fact a - * not-necessarily normalized 3D direction extended with information that - * specifies the location of the point pre-image in the parameter space. - * - * \cgalModels{Assignable,DefaultConstructible,CopyConstructible} + /// \name Enumeration types + /// @{ + + /*! The location type indicates a location in the parameter space. */ - class Point_2 { - public: - /// \name Enumeration types - /// @{ + enum Location_type { + /// Internal to the parameter space. + NO_BOUNDARY_LOC = 0, - /*! The location type indicates a location in the parameter space. - */ - enum Location_type { - /// Internal to the parameter space. - NO_BOUNDARY_LOC = 0, + /// The bottom side boundary of the parameter space (the south pole). + MIN_BOUNDARY_LOC, - /// The bottom side boundary of the parameter space (the south pole). - MIN_BOUNDARY_LOC, + /// The identified left and right side boundaries of the parameter space. + MID_BOUNDARY_LOC, - /// The identified left and right side boundaries of the parameter space. - MID_BOUNDARY_LOC, - - /// The top side boundary of the parameter space (the north pole). - MAX_BOUNDARY_LOC - }; - /// @} - - /// \name Types - /// @{ - typedef Kernel::Direction_3 Direction_3; - /// @} - - /// \name Creation - /// @{ - - /*! constructs a point from a direction and a location. - * \param[in] dir the direction. - * \param[in] location indicates the location of the point pre-image - * in the parameter space. - */ - Point_2(const Direction_3& dir, Location_type location); - - /// @} - - /// \name Operations - /// @{ - - /*! sets the location of the point pre-image in the parameter space. - * \param[in] location the updated location of the point pre-image in - * the parameter space. - */ - void set_location(Location_type location); - - /*! obtains the location of the point. - * \return the location of the point pre-image in the parameter space. - */ - Location_type location() const; - - /// @} + /// The top side boundary of the parameter space (the north pole). + MAX_BOUNDARY_LOC }; + /// @} - /*! The `X_monotone_curve_2` class nested within the traits is used to - * represent an \f$x\f$-monotone geodesic arc on the a sphere centered at - * the origin. The pre-image of an \f$x\f$-monotone geodesic arc does not - * intersect the identified left and right sides of the boundary of the - * parameter space. - * - * \cgalModels{Assignable,DefaultConstructible,CopyConstructible} + /// \name Types + /// @{ + typedef Kernel::Direction_3 Direction_3; + /// @} + + /// \name Creation + /// @{ + + /*! constructs a point from a direction and a location. + * \param[in] dir the direction. + * \param[in] location indicates the location of the point pre-image + * in the parameter space. */ - class X_monotone_curve_2 { - public: - /// \name Types - /// @{ - typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; - /// @} + Point_2(const Direction_3& dir, Location_type location); - /// \name Creation - /// @{ + /// @} - /*! constructs an \f$x\f$-monotone geodesic arc. - * \param[in] source the source point of the arc. - * \param[in] target the target point of the arc. - * \param[in] normal the normal of the plane that contains the arc. - * \param[in] is_vertical is the arc vertical ? - * \param[in] is_directed_right is the arc directed from left to right? - * \param[in] is_full is the arc a full great circle? - * \param[in] is_degenerate is the arc degenerate (single point)? - * \param[in] is_empty is the arc empty? - * \pre Both endpoints lie on the given plane. - */ - X_monotone_curve_2(const Point_2& source, - const Point_2& target, - const Direction_3& normal, - bool is_vertical, - bool is_directed_right, - bool is_full = false, - bool is_degenerate = false, - bool is_empty = false); + /// \name Operations + /// @{ - /*! construct an \f$x\f$-monotone geodesic arc. - * \param[in] normal the normal of the plane containing the arc. - * \param[in] source the source-point direction. - * \param[in] target the target-point direction. - * \pre Both endpoints lie on the given plane. - */ - X_monotone_curve_2(const Point_2& source, - const Point_2& target, - const Direction_3& normal); - - /*! construct a full great-circle. - * \param[in] point the endpoint of the full great-circle. - * \param[in] normal the normal of the plane containing the arc. - * \pre the point lies on the given plane. - * \pre the point pre-image lies on the identified left and right sides - * of the boundary of the parameter space. - */ - X_monotone_curve_2(const Point_2& point, - const Direction_3& normal); - - /// @} - - /// \name Operations - /// @{ - - /*! sets the source endpoint. - * \param[in] source the updated source endpoint. - */ - void set_source(const Point_2& source); - - /*! sets the target endpoint. - * \param[in] target the updated target endpoint. - */ - void set_target(const Point_2& target); - - /*! sets the normal of the underlying plane. - * \param[in] normal the updated normal of the underlying plane. - */ - void set_normal(const Direction_3& normal); - - /*! sets the flag that indicates whether the arc is vertical. - * \param[in] flag indicates whether the arc pre-image in the parameter - * space is vertical. - */ - void set_is_vertical(bool flag); - - /*! sets the flag that indicates whether the direction of the arc - * pre-image in the parameter space is from left to right. - * \param flag indicates whether the arc pre-image in the parameter - * space is from left to right. - */ - void set_is_directed_right(bool flag); - - /*! sets the flag that indicates whether the arc is a full great circle. - * \param[in] flag indicates whether the arc is a full great circle. - */ - void set_is_full(bool flag); - - /*! sets the flag that indicates whether the arc degenerates to a point. - * \param[in] flag indicates whether the arc degenerates to a point. - */ - void set_is_degenerate(bool flag); - - /*! sets the flag that indicates whether the arc is empty. - * \param[in] flag indicates whether the arc is empty. - */ - void set_is_empty(bool flag); - - /*! obtains the source point. - */ - const Point_2& source() const; - - /*! obtains the target point. - */ - const Point_2& target() const; - - /*! obtains the normal to the containing plane. - */ - const Direction_3& normal() const; - - /*! obtains the (lexicographically) left endpoint direction. - */ - const Point_2& left() const; - - /*! obtains the (lexicographically) right endpoint. - */ - const Point_2& right() const; - - /*! determines whether the arc is vertical. - */ - bool is_vertical() const; - - /*! determines whether the arc is directed lexicographically from left to - * right. - */ - bool is_directed_right() const; - - /*! determines whether the arc is a great circle. - */ - bool is_full() const; - - /*! determines whether the arc is degenerate. - */ - bool is_degenerate() const; - - /*! determines whether the arc is empty. */ - bool is_empty() const; - - /*! determines whether the arc is a meridian. - */ - bool is_meridian() const; - - /// @} - }; - - /*! + /*! sets the location of the point pre-image in the parameter space. + * \param[in] location the updated location of the point pre-image in + * the parameter space. */ - class Curve_2 { - public: - /// \name Types - /// @{ - typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; - /// @} + void set_location(Location_type location); - /// \name Creation - /// @{ - /// @} - - /// \name Operations - /// @{ - /// @} - }; - - /*! Construction functor of a point. - * - * \cgalModels{Assignable,CopyConstructible,AdaptableUnaryFunction,AdaptableTernaryFunction} + /*! obtains the location of the point. + * \return the location of the point pre-image in the parameter space. */ + Location_type location() const; - /*! - */ - class Construct_point_2 { - public: - /// \name Types - /// @{ - typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 result_type; - typedef typename Kernel::FT FT; - typedef typename Kernel::Direction_3 Direction_3; - /// @} - - /// \name Operations - /// @{ - - /*! constructs a point on the sphere from three coordinates, which define - * a (not necessarily normalized) direction. - * \param[in] x the x coordinate - * \param[in] y the y coordinate - * \param[in] z the z coordinate - */ - Point_2 operator()(const FT& x, const FT& y, const FT& z); - - /*! constructs a point on the sphere from a (not necessarily normalized) - * direction. - * \param other the other direction - */ - Point_2 operator()(const Direction_3& other); - - /// @} - }; - - /*! Construction functor of \f$x\f$-monotone geodesic arcs. - * - * \cgalModels{Assignable,CopyConstructible,AdaptableUnaryFunction,AdaptableBinaryFunction,AdaptableTernaryFunction} - */ - class Construct_x_monotone_curve_2 { - public: - /// \name Types - /// @{ - typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; - typedef Arr_geodesic_arc_on_sphere_traits_2::X_monotone_curve_2 result_type; - typedef Kernel::Direction_3 Direction_3; - typedef Direction_3 argument_type; - /// @} - - /// \name Operations - /// @{ - - /*! constructs the minor geodesic arc from two endpoints. The minor arc - * is the one with the smaller angle among the two geodesic arcs with - * the given endpoints. - * 1. Find out whether the arc is x-monotone. - * 2. If it is x-monotone, - * 2.1 Find out whether it is vertical, and - * 2.2 whether the target is larger than the source (directed right). - * - * An arc is vertical, iff - * 1. one of its endpoint direction pierces a pole, or - * 2. the projections of the endpoint directions onto the xy-plane coincide. - * \param[in] p the first endpoint. - * \param[in] q the second endpoint. - * \pre p and q must not coincide. - * \pre p and q cannot be antipodal. - * \pre The constructed minor arc does not intersect the identification - * curve in its interior. - */ - X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q); - - /*! constructs a full great circle from a normal to a plane. - * Observe that the constructed arc has one endpoint that lies on - * the identification curve. This point is considered both the source and - * target (and also the left and right) point of the arc. - * \param normal the normal to the plane containing the great circle. - * \pre the plane is not vertical. - */ - X_monotone_curve_2 operator()(const Direction_3& normal); - - /*! constructs a geodesic arc from two endpoints and a normal to the plane - * containing the arc. The two endpoints determine the plane. The normal - * determines the orientation of the plane and the final arc (whether its - * the minor arc or the major arc). The right-hand rule can be used - * to select the appropriate normal. - * \param[in] p the first endpoint. - * \param[in] q the second endpoint. - * \param[in] normal the normal to the oriented plane containing the arc. - * \pre Both endpoints lie on the given oriented plane. - * \pre The constructed arc does not intersect the identification curve - * in its interior. - */ - X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q, - const Direction_3& normal); - - /// @} /* end of operations */ - }; - - /*! Construction functor of geodesic arcs. - * - * \cgalModels{Assignable,CopyConstructible,AdaptableUnaryFunction,AdaptableBinaryFunction,AdaptableTernaryFunction} - */ - class Construct_curve_2 { - public: - /// \name Types - /// @{ - typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; - typedef Arr_geodesic_arc_on_sphere_traits_2::Curve_2 result_type; - typedef Kernel::Direction_3 Direction_3; - typedef Direction_3 argument_type; - /// @} - - /// \name Operations - /// @{ - - /*! constructs a full great circle from a normal to a plane. - * \param normal the normal to the plane containing the great circle. - */ - X_monotone_curve_2 operator()(const Direction_3& normal); - - /*! constructs the minor geodesic arc from two endpoints. The minor arc - * is the one with the smaller angle among the two geodesic arcs with - * the given endpoints. - * 1. Find out whether the arc is x-monotone. - * 2. If it is x-monotone, - * 1. Find out whether it is vertical, and - * 2. whether the target is larger than the source (directed right). - * - * An arc is vertical, iff - * 1. one of its endpoint direction pierces a pole, or - * 2. the projections of the endpoint directions onto the xy-plane coincide. - * - * \param[in] p the first endpoint. - * \param[in] q the second endpoint. - * \pre p and q must not coincide. - * \pre p and q cannot be antipodal. - */ - Curve_2 operator()(const Point_2& p, const Point_2& q); - - /*! constructs a geodesic arc from two endpoints and a normal to the plane - * containing the arc. The two endpoints determine the plane. The normal - * determines the orientation of the plane and the final arc (whether its - * the minor arc or the major arc). The right-hand rule can be used - * to select the appropriate normal. - * \param[in] p the first endpoint. - * \param[in] q the second endpoint. - * \param[in] normal the normal to the oriented plane containing the arc. - * \pre Both endpoints lie on the given oriented plane. - */ - Curve_2 operator()(const Point_2& p, const Point_2& q, - const Direction_3& normal); - /// @} - }; - - /*! returns an instance of `Construct_point_2`. - */ - Construct_point_2 construct_point_2_object() const; - - /*! returns an instance of `Construct_x_monotone_curve_2`. - */ - Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const; - - /*! returns an instance of `Construct_curve_2`. - */ - Construct_curve_2 construct_curve_2_object() const; + /// @} }; + /*! The `X_monotone_curve_2` class nested within the traits is used to + * represent an \f$x\f$-monotone geodesic arc on the a sphere centered at + * the origin. The pre-image of an \f$x\f$-monotone geodesic arc does not + * intersect the identified left and right sides of the boundary of the + * parameter space. + * + * \cgalModels{Assignable,DefaultConstructible,CopyConstructible} + */ + class X_monotone_curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + /// @} + + /// \name Creation + /// @{ + + /*! constructs an \f$x\f$-monotone geodesic arc. + * \param[in] source the source point of the arc. + * \param[in] target the target point of the arc. + * \param[in] normal the normal of the plane that contains the arc. + * \param[in] is_vertical is the arc vertical ? + * \param[in] is_directed_right is the arc directed from left to right? + * \param[in] is_full is the arc a full great circle? + * \param[in] is_degenerate is the arc degenerate (single point)? + * \param[in] is_empty is the arc empty? + * + * \pre Both endpoints lie on the given plane. + */ + X_monotone_curve_2(const Point_2& source, + const Point_2& target, + const Direction_3& normal, + bool is_vertical, + bool is_directed_right, + bool is_full = false, + bool is_degenerate = false, + bool is_empty = false); + + /*! constructs an \f$x\f$-monotone geodesic arc. + * \param[in] normal the normal of the plane containing the arc. + * \param[in] source the source-point direction. + * \param[in] target the target-point direction. + * + * \pre Both endpoints lie on the given plane. + */ + X_monotone_curve_2(const Point_2& source, + const Point_2& target, + const Direction_3& normal); + + /*! constructs a full great-circle. + * \param[in] point the endpoint of the full great-circle. + * \param[in] normal the normal of the plane containing the arc. + * + * \pre the point lies on the given plane. + * \pre the point pre-image lies on the identified left and right sides + * of the boundary of the parameter space. + */ + X_monotone_curve_2(const Point_2& point, + const Direction_3& normal); + + /// @} + + /// \name Operations + /// @{ + + /*! sets the source endpoint. + * \param[in] source the updated source endpoint. + */ + void set_source(const Point_2& source); + + /*! sets the target endpoint. + * \param[in] target the updated target endpoint. + */ + void set_target(const Point_2& target); + + /*! sets the normal of the underlying plane. + * \param[in] normal the updated normal of the underlying plane. + */ + void set_normal(const Direction_3& normal); + + /*! sets the flag that indicates whether the arc is vertical. + * \param[in] flag indicates whether the arc pre-image in the parameter + * space is vertical. + */ + void set_is_vertical(bool flag); + + /*! sets the flag that indicates whether the direction of the arc + * pre-image in the parameter space is from left to right. + * \param flag indicates whether the arc pre-image in the parameter + * space is from left to right. + */ + void set_is_directed_right(bool flag); + + /*! sets the flag that indicates whether the arc is a full great circle. + * \param[in] flag indicates whether the arc is a full great circle. + */ + void set_is_full(bool flag); + + /*! sets the flag that indicates whether the arc degenerates to a point. + * \param[in] flag indicates whether the arc degenerates to a point. + */ + void set_is_degenerate(bool flag); + + /*! sets the flag that indicates whether the arc is empty. + * \param[in] flag indicates whether the arc is empty. + */ + void set_is_empty(bool flag); + + /*! obtains the source point. + */ + const Point_2& source() const; + + /*! obtains the target point. + */ + const Point_2& target() const; + + /*! obtains the normal to the containing plane. + */ + const Direction_3& normal() const; + + /*! obtains the (lexicographically) left endpoint direction. + */ + const Point_2& left() const; + + /*! obtains the (lexicographically) right endpoint. + */ + const Point_2& right() const; + + /*! Determines whether the arc is vertical. + */ + bool is_vertical() const; + + /*! determines whether the arc is directed lexicographically from left to right. + */ + bool is_directed_right() const; + + /*! determines whether the arc is a great circle. + */ + bool is_full() const; + + /*! determines whether the arc is degenerate. + */ + bool is_degenerate() const; + + /*! determines whether the arc is empty. */ + bool is_empty() const; + + /*! determines whether the arc is a meridian. + */ + bool is_meridian() const; + + /// @} + }; + + /*! + */ + class Curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + /// @} + + /// \name Creation + /// @{ + /// @} + + /// \name Operations + /// @{ + /// @} + }; + + /*! Construction functor of a point. + * + * \cgalModels{Assignable,CopyConstructible,AdaptableUnaryFunction,AdaptableTernaryFunction} + */ + /*! + */ + class Construct_point_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 result_type; + typedef typename Kernel::FT FT; + typedef typename Kernel::Direction_3 Direction_3; + /// @} + + /// \name Operations + /// @{ + + /*! constructs a point on the sphere from three coordinates, which define + * a (not necessarily normalized) direction. + * \param[in] x the x coordinate + * \param[in] y the y coordinate + * \param[in] z the z coordinate + */ + Point_2 operator()(const FT& x, const FT& y, const FT& z); + + /*! constructs a point on the sphere from a (not necessarily normalized) + * direction. + * \param other the other direction + */ + Point_2 operator()(const Direction_3& other); + + /// @} + }; + + /*! Construction functor of \f$x\f$-monotone geodesic arcs. + * + * \cgalModels{Assignable,CopyConstructible,AdaptableUnaryFunction,AdaptableBinaryFunction,AdaptableTernaryFunction} + */ + class Construct_x_monotone_curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + typedef Arr_geodesic_arc_on_sphere_traits_2::X_monotone_curve_2 result_type; + typedef Kernel::Direction_3 Direction_3; + typedef Direction_3 argument_type; + /// @} + + /// \name Operations + /// @{ + + /*! constructs the minor geodesic arc from two endpoints. The minor arc + * is the one with the smaller angle among the two geodesic arcs with + * the given endpoints. + * 1. Find out whether the arc is \f$x\f$-monotone. + * 2. If it is \f$x\f$-monotone, + * 2.1 Find out whether it is vertical, and + * 2.2 whether the target is larger than the source (directed right). + * + * An arc is vertical, iff + * 1. one of its endpoint direction pierces a pole, or + * 2. the projections of the endpoint directions onto the \f$xy\f$-plane coincide. + * \param[in] p the first endpoint. + * \param[in] q the second endpoint. + * \pre p and q must not coincide. + * \pre p and q cannot be antipodal. + * \pre The constructed minor arc does not intersect the identification + * curve in its interior. + */ + X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q); + + /*! constructs a full great circle from a normal to a plane. + * Observe that the constructed arc has one endpoint that lies on + * the identification curve. This point is considered both the source and + * target (and also the left and right) point of the arc. + * \param normal the normal to the plane containing the great circle. + * \pre the plane is not vertical. + */ + X_monotone_curve_2 operator()(const Direction_3& normal); + + /*! constructs a geodesic arc from two endpoints and a normal to the plane + * containing the arc. The two endpoints determine the plane. The normal + * determines the orientation of the plane and the final arc (whether its + * the minor arc or the major arc). The right-hand rule can be used + * to select the appropriate normal. + * \param[in] p the first endpoint. + * \param[in] q the second endpoint. + * \param[in] normal the normal to the oriented plane containing the arc. + * \pre Both endpoints lie on the given oriented plane. + * \pre The constructed arc does not intersect the identification curve + * in its interior. + */ + X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q, + const Direction_3& normal); + + /// @} /* end of operations */ + }; + + /*! Construction functor of geodesic arcs. + * + * \cgalModels{Assignable,CopyConstructible,AdaptableUnaryFunction,AdaptableBinaryFunction,AdaptableTernaryFunction} + */ + class Construct_curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + typedef Arr_geodesic_arc_on_sphere_traits_2::Curve_2 result_type; + typedef Kernel::Direction_3 Direction_3; + typedef Direction_3 argument_type; + /// @} + + /// \name Operations + /// @{ + + /*! constructs a full great circle from a normal to a plane. + * \param normal the normal to the plane containing the great circle. + */ + X_monotone_curve_2 operator()(const Direction_3& normal); + + /*! constructs the minor geodesic arc from two endpoints. The minor arc + * is the one with the smaller angle among the two geodesic arcs with + * the given endpoints. + * 1. Find out whether the arc is \f$x\f$-monotone. + * 2. If it is \f$x\f$-monotone, + * 1. Find out whether it is vertical, and + * 2. whether the target is larger than the source (directed right). + * + * An arc is vertical, iff + * 1. one of its endpoint direction pierces a pole, or + * 2. the projections of the endpoint directions onto the \f$xy\f$-plane coincide. + * + * \param[in] p the first endpoint. + * \param[in] q the second endpoint. + * \pre p and q must not coincide. + * \pre p and q cannot be antipodal. + */ + Curve_2 operator()(const Point_2& p, const Point_2& q); + + /*! constructs a geodesic arc from two endpoints and a normal to the plane + * containing the arc. The two endpoints determine the plane. The normal + * determines the orientation of the plane and the final arc (whether its + * the minor arc or the major arc). The right-hand rule can be used + * to select the appropriate normal. + * \param[in] p the first endpoint. + * \param[in] q the second endpoint. + * \param[in] normal the normal to the oriented plane containing the arc. + * + * \pre Both endpoints lie on the given oriented plane. + */ + Curve_2 operator()(const Point_2& p, const Point_2& q, + const Direction_3& normal); + /// @} + }; + + /*! returns an instance of `Construct_point_2`. + */ + Construct_point_2 construct_point_2_object() const; + + /*! returns an instance of `Construct_x_monotone_curve_2`. + */ + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const; + + /*! returns an instance of `Construct_curve_2`. + */ + Construct_curve_2 construct_curve_2_object() const; +}; + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h index 2567ed62d7c..447b225ab08 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_landmarks_point_location.h @@ -1,62 +1,58 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2PointLocation +/*! \ingroup PkgArrangementOnSurface2PointLocation + * + * \anchor arr_reflm_pl + * + * The `Arr_landmarks_point_location` class implements a Jump & Walk algorithm, + * where special points, referred to as "landmarks", are chosen in a + * preprocessing stage, their place in the arrangement is found, and they are + * inserted into a data-structure that enables efficient nearest-neighbor search + * (a Kd-tree). Given a query point, the nearest + * landmark is located and a "walk" strategy is applied from the landmark to the + * query point. + * + * There are various strategies to select the landmark set in the + * arrangement, where the strategy is determined by the + * `Generator` template parameter. The following landmark-generator + * classes are available: + *
    + *
    `Arr_landmarks_vertices_generator`
    + * The arrangement vertices are used as the landmarks set. + * + *
    `Arr_random_landmarks_generator`
    + * \f$n\f$ random points in the bounding box of the arrangement are chosen + * as the landmarks set. + * + *
    `Arr_halton_landmarks_generator`
    + * \f$n\f$ Halton points in the bounding box of the arrangement are chosen + * as the landmarks set. + * + *
    `Arr_middle_edges_landmarks_generator`
    + * The midpoint of each arrangement edge is computed, and the resulting + * set of points is used as the landmarks set. This generator can be applied + * only for arrangements of line segments. + * + *
    `Arr_grid_landmarks_generator`
    + * A set of \f$n\f$ landmarks are chosen on a + * \f$\lceil \sqrt{n} \rceil \times \lceil \sqrt{n} \rceil\f$ + * grid that covers the bounding box of the arrangement. + *
    + * The `Arr_landmarks_vertices_generator` class is the default generator + * and used if no `Generator` parameter is specified. + * + * It is recommended to use the landmarks point-location strategy + * when the application frequently issues point-location queries on a + * rather static arrangement that the changes applied to it are mainly + * insertions of curves and not deletions of them. + * + * \cgalModels{AosPointLocation_2,AosVerticalRayShoot_2} + * + * \sa `AosPointLocation_2` + * \sa `AosVerticalRayShoot_2` + * \sa `CGAL::Arr_point_location_result` + */ +template +class Arr_landmarks_point_location {}; -\anchor arr_reflm_pl - -The `Arr_landmarks_point_location` class implements a Jump & Walk algorithm, where special -points, referred to as "landmarks", are chosen in a preprocessing stage, -their place in the arrangement is found, and they are inserted into a -data-structure that enables efficient nearest-neighbor search (a -Kd-tree). Given a query point, the nearest landmark is located and a -"walk" strategy is applied from the landmark to the query point. - -There are various strategies to select the landmark set in the -arrangement, where the strategy is determined by the -`Generator` template parameter. The following landmark-generator -classes are available: -
    -
    `Arr_landmarks_vertices_generator` -
    -The arrangement vertices are used as the landmarks set. - -
    `Arr_random_landmarks_generator` -
    -\f$ n\f$ random points in the bounding box of the arrangement are chosen -as the landmarks set. - -
    `Arr_halton_landmarks_generator` -
    -\f$ n\f$ Halton points in the bounding box of the arrangement are chosen -as the landmarks set. - -
    `Arr_middle_edges_landmarks_generator` -
    -The midpoint of each arrangement edge is computed, and the resulting -set of points is used as the landmarks set. This generator can be applied -only for arrangements of line segments. - -
    `Arr_grid_landmarks_generator` -
    -A set of \f$ n\f$ landmarks are chosen on a -\f$ \lceil \sqrt{n} \rceil \times \lceil \sqrt{n} \rceil\f$ -grid that covers the bounding box of the arrangement. -
    -The `Arr_landmarks_vertices_generator` class is the default generator -and used if no `Generator` parameter is specified. - -It is recommended to use the landmarks point-location strategy -when the application frequently issues point-location queries on a -rather static arrangement that the changes applied to it are mainly -insertions of curves and not deletions of them. - -\cgalModels{ArrangementPointLocation_2,ArrangementVerticalRayShoot_2} - -\sa `ArrangementPointLocation_2` -\sa `ArrangementVerticalRayShoot_2` -\sa `CGAL::Arr_point_location_result` - -*/ -template< typename Arrangement, typename Generator > -class Arr_landmarks_point_location { -public: - -}; /* end Arr_landmarks_point_location */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_line_arc_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_line_arc_traits_2.h index 909792816a7..78101a83ad7 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_line_arc_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_line_arc_traits_2.h @@ -1,19 +1,14 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * This class is a traits class for \cgal arrangements, built on top of a + * model of concept `CircularKernel`. It provides curves of type + * `CGAL::Line_arc_2`. + * + * \cgalModels{AosTraits_2} + */ +template +class Arr_line_arc_traits_2 {}; -This class is a traits class for \cgal arrangements, built on top of a -model of concept `CircularKernel`. It provides curves of type -`CGAL::Line_arc_2`. - -\cgalModels{ArrangementTraits_2} - -*/ -template< typename CircularKernel > -class Arr_line_arc_traits_2 { -public: - -}; /* end Arr_line_arc_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h index 9a842135e7c..8a26dc62256 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h @@ -3,10 +3,10 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * * The traits class `Arr_linear_traits_2` is a model of the - * `ArrangementTraits_2` concept, which enables the construction and maintenance + * `AosTraits_2` concept, which enables the construction and maintenance * of arrangements of linear objects. The linear objects may be bounded (line * segments) or unbounded (rays and lines). Thus, it is also a model of the - * concept `ArrangementOpenBoundaryTraits_2`. The traits class is parameterized + * concept `AosOpenBoundaryTraits_2`. The traits class is parameterized * parameterized with a \cgal-kernel model; see the reference page of * `Arr_segment_traits_2` for further explanations and recommendations * on choosing a kernel. @@ -14,35 +14,34 @@ namespace CGAL { * `Arr_linear_traits_2` defines `Kernel::Point_2` as its point type. The nested * `X_monotone_curve_2` and `Curve_2` types defined by the traits class (as is * the case with the various segment-traits classes, both types refer to the - * same class, as every linear object is (weakly) \f$ x\f$-monotone), are + * same class, as every linear object is (weakly) \f$x\f$-monotone), are * constructible from a point, a line segment, a ray and from a line (objects of * types `Kernel::Point_2`, `Kernel::Segment_2`, `Kernel::Ray_2` and * `Kernel::Line_2`, respectively). On the other hand, when we are given a curve * we can find out its actual type and convert it to the respective kernel * object (say, to a `Kernel::Ray_2`). * - * \cgalModels{ArrangementTraits_2,ArrangementLandmarkTraits_2,ArrangementOpenBoundaryTraits_2} + * \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosOpenBoundaryTraits_2} */ template class Arr_linear_traits_2 { public: - /// \name Types /// @{ - //! + /// typedef typename Kernel::Segment_2 Segment_2; - //! + /// typedef typename Kernel::Ray_2 Ray_2; - //! + /// typedef typename Kernel::Line_2 Line_2; - //! + /// typedef typename Kernel::Point_2 Point_2; - //! + /// typedef typename X_monotone_curve_2 Curve_2; /// @} @@ -57,20 +56,19 @@ public: */ class X_monotone_curve_2 { public: - /// \name Types /// @{ - //! + /// typedef typename Kernel::Point_2 Point_2; - //! + /// typedef typename Kernel::Segment_2 Segment_2; - //! + /// typedef typename Kernel::Ray_2 Ray_2; - //! + /// typedef typename Kernel::Line_2 Line_2; /// @} @@ -139,7 +137,6 @@ public: Point_2 target() const; /// @} - }; /* end Arr_linear_traits_2::X_monotone_curve_2 */ class Trim_2 { @@ -147,7 +144,7 @@ public: /// \name Creation /// @{ - /*! trims the given x-monotone curve to an from src to tgt. + /*! trims the given \f$x\f$-monotone curve to an from `src` to `tgt`. * \ pre `src` and `tgt` lies on the curve */ X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, @@ -157,7 +154,6 @@ public: } /* end Arr_linear_traits_2::Trim_2 */ Trim_2 trim_2_object() const; - }; /* end Arr_linear_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h index 8c08d593518..c6f633c7640 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_naive_point_location.h @@ -1,28 +1,22 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2PointLocation +/*! \ingroup PkgArrangementOnSurface2PointLocation + * + * \anchor arr_refnaive_pl + * + * The `Arr_naive_point_location` class implements a naive algorithm that + * traverses all the vertices and halfedges in the arrangement in search for an + * answer to a point-location query. The query time is therefore linear in the + * complexity of the arrangement. Naturally, this point-location strategy could + * turn into a heavy time-consuming process when applied to dense arrangements. + * + * \cgalModels{AosPointLocation_2,AosVerticalRayShoot_2} + * + * \sa `AosPointLocation_2` + * \sa `AosVerticalRayShoot_2` + * \sa `CGAL::Arr_point_location_result` + */ +template +class Arr_naive_point_location {}; -\anchor arr_refnaive_pl - -The `Arr_naive_point_location` class implements a naive algorithm that traverses -all the vertices and halfedges in the arrangement in search for an -answer to a point-location query. -The query time is therefore linear in the complexity of the arrangement. -Naturally, this point-location strategy could turn into a heavy -time-consuming process when applied to dense arrangements. - -\cgalModels{ArrangementPointLocation_2,ArrangementVerticalRayShoot_2} - -\sa `ArrangementPointLocation_2` -\sa `ArrangementVerticalRayShoot_2` -\sa `CGAL::Arr_point_location_result` - -*/ -template< typename Arrangement > -class Arr_naive_point_location { -public: - -}; /* end Arr_naive_point_location */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_basic_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_basic_traits_2.h index ab5cf747b7a..9fceee59c5e 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_basic_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_basic_traits_2.h @@ -1,32 +1,26 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * The traits class `Arr_non_caching_segment_basic_traits_2` is a model of the + * `AosTraits_2` concept that allow the construction and maintenance of + * arrangements of sets of pairwise interior-disjoint line segments. It is + * templated with a \cgal-Kernel model, and it is derived from it. This traits + * class is a thin layer above the parameterized kernel. It inherits the + * `Point_2` from the kernel and its `X_monotone_curve_2` type is defined as + * `Kernel::Segment_2`. Most traits-class functor are inherited from the kernel + * functor, and the traits class only supplies the necessary functors that are + * not provided by the kernel. The kernel is parameterized with a number type, + * which should support the arithmetic operations \f$+\f$, \f$-\f$ and + * \f$\times\f$ in an exact manner in order to avoid robustness problems. Using + * `Cartesian` or `Cartesian` are possible substitutions for the + * kernel. Using other (inexact) number types (for example, instantiating the + * template with `Simple_cartesian`) is also possible, at the user's own + * risk. + * + * \cgalModels{AosLandmarkTraits_2} + */ +template +class Arr_non_caching_segment_basic_traits_2 {}; -The traits class `Arr_non_caching_segment_basic_traits_2` is a model of the `ArrangementTraits_2` -concept that allow the construction and maintenance of arrangements of -sets of pairwise interior-disjoint line segments. It is templated with a -\cgal-Kernel model, and it is derived from it. This traits class is a -thin layer above the parameterized kernel. It inherits the `Point_2` -from the kernel and its `X_monotone_curve_2` type is defined as -`Kernel::Segment_2`. Most traits-class functor are inherited from the -kernel functor, and the traits class only supplies the necessary functors -that are not provided by the kernel. The kernel is parameterized with a -number type, which should support the arithmetic operations \f$ +\f$, \f$ -\f$ and -\f$ \times\f$ in an exact manner in order to avoid robustness problems. -Using `Cartesian` or `Cartesian` are possible -substitutions for the kernel. Using other (inexact) number types -(for example, instantiating the template with -`Simple_cartesian`) is also possible, at the user's own -risk. - -\cgalModels{ArrangementLandmarkTraits_2} - -*/ -template< typename Kernel > -class Arr_non_caching_segment_basic_traits_2 { -public: - -}; /* end Arr_non_caching_segment_basic_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_traits_2.h index 32a67f5162d..bc5731dfedb 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_non_caching_segment_traits_2.h @@ -1,47 +1,41 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2TraitsClasses +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * The traits class `Arr_non_caching_segment_traits_2` is a model of the + * `AosTraits_2` concept that allows the construction and maintenance of + * arrangements of line segments. It is parameterized with a \cgal-Kernel type, + * and it is derived from it. This traits class is a thin layer above the + * parameterized kernel. It inherits the `Point_2` from the kernel and its + * `X_monotone_curve_2` and `Curve_2` types are both defined as + * `Kernel::Segment_2`. Most traits-class functor are inherited from the kernel + * functor, and the traits class only supplies the necessary functors that are + * not provided by the kernel. The kernel is parameterized with a number type, + * which should support exact rational arithmetic in order to avoid robustness + * problems, although other number types could be used at the user's own risk. + * + * The traits-class implementation is very simple, yet may lead to a cascaded + * representation of intersection points with exponentially long bit-lengths, + * especially if the kernel is parameterized with a number type that does not + * perform normalization (e.g. `Quotient`). The + * `Arr_segment_traits_2` traits class avoids this cascading problem, and should + * be the default choice for implementing arrangements of line segments. It is + * recommended to use `Arr_non_caching_segment_traits_2` only for very sparse + * arrangements of huge sets of input segments. + * + * While `Arr_non_caching_segment_traits_2` models the concept + * `AosDirectionalXMonotoneTraits_2`, the implementation of the + * `Are_mergeable_2` operation does not enforce the input curves to have the + * same direction as a precondition. Moreover, + * `Arr_non_caching_segment_traits_2` supports the merging of curves of opposite + * directions. + * + * \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosDirectionalXMonotoneTraits_2} + * + * \sa `Arr_segment_traits_2` + */ +template +class Arr_non_caching_segment_traits_2 : + public Arr_non_caching_segment_basic_traits_2 {}; -The traits class `Arr_non_caching_segment_traits_2` is a model of the `ArrangementTraits_2` -concept that allows the construction and maintenance of arrangements of -line segments. It is parameterized with a \cgal-Kernel type, and it -is derived from it. This traits class is a thin layer above the -parameterized kernel. It inherits the `Point_2` from the kernel and its -`X_monotone_curve_2` and `Curve_2` types are both defined as -`Kernel::Segment_2`. Most traits-class functor are inherited from the -kernel functor, and the traits class only supplies the necessary functors -that are not provided by the kernel. The kernel is parameterized with a -number type, which should support exact rational arithmetic in order to -avoid robustness problems, although other number types could be used at the -user's own risk. - -The traits-class implementation is very simple, yet may lead to -a cascaded representation of intersection points with exponentially long -bit-lengths, especially if the kernel is parameterized with a number type -that does not perform normalization (e.g. `Quotient`). -The `Arr_segment_traits_2` traits class avoids this cascading -problem, and should be the default choice for implementing arrangements of -line segments. It is recommended to use `Arr_non_caching_segment_traits_2` only for very sparse -arrangements of huge sets of input segments. - -While `Arr_non_caching_segment_traits_2` models the concept -`ArrangementDirectionalXMonotoneTraits_2`, the implementation of -the `Are_mergeable_2` operation does not enforce the input curves -to have the same direction as a precondition. Moreover, `Arr_non_caching_segment_traits_2` -supports the merging of curves of opposite directions. - -\cgalModels{ArrangementTraits_2,ArrangementLandmarkTraits_2,ArrangementDirectionalXMonotoneTraits_2} - -\sa `Arr_segment_traits_2` - -*/ -template< typename Kernel > -class Arr_non_caching_segment_traits_2 - : public Arr_non_caching_segment_basic_traits_2 - { -public: - -}; /* end Arr_non_caching_segment_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_overlay_2.h index 731c735675a..0efe5184b87 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_overlay_2.h @@ -1,75 +1,72 @@ namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2Funcs -\brief Computes the overlay of two arrangements `arr1` and `arr2`, and sets -the output arrangement `res` to represent the overlaid arrangement. +/*! \ingroup PkgArrangementOnSurface2Funcs + * \brief Computes the overlay of two arrangements `arr1` and `arr2`, and sets + * the output arrangement `res` to represent the overlaid arrangement. + * + * \details + * Computes the overlay of two input arrangement + * objects, and returns the overlaid arrangement. All three arrangements + * can be instantiated with different geometric traits classes and different + * \dcel classes (encapsulated in the various topology-traits classes). + * The geometry traits of the resulting arrangement is used to construct the + * resulting arrangement. This means that all the types (e.g., + * `Traits::Point_2`, `Traits::Curve_2`, and `Traits::Point_2`) + * of both input arrangements have to be convertible to the types in the + * resulting arrangement. A given overlay-traits object is used to properly + * construct the overlaid \dcel that represents the resulting arrangement. + * + * \pre `res` does not refer to either `arr1` or `arr2` (that is, + * "self overlay" is not supported). + * + * \pre The overlay-traits object `ovl_tr` must model the `OverlayTraits` + * concept, which is able to construct records of the `ResDcel` class on + * the basis of the `Dcel1` and `Dcel2` records that induce them. + * + * \sa `OverlayTraits` + */ +template +void overlay(const Arrangement_2& arr1, + const Arrangement_2& arr2, + Arrangement_2& arr_res, + OverlayTraits& ovl_tr); -\details -Computes the overlay of two input arrangement -objects, and returns the overlaid arrangement. All three arrangements -can be instantiated with different geometric traits classes and different -\dcel classes (encapsulated in the various topology-traits classes). -The geometry traits of the resulting arrangement is used to construct the -resulting arrangement. This means that all the types (e.g., -`Traits::Point_2`, `Traits::Curve_2`, and `Traits::Point_2`) -of both input arrangements have to be convertible to the types in the -resulting arrangement. A given overlay-traits object is used to properly -construct the overlaid \dcel that represents the resulting arrangement. - -\pre `res` does not refer to either `arr1` or `arr2` (that is, "self overlay" is not supported). - -\pre The overlay-traits object `ovl_tr` must model the `OverlayTraits` - concept, which is able to construct records of the `ResDcel` class on - the basis of the `Dcel1` and `Dcel2` records that induce them. - -\sa `OverlayTraits` -*/ -template -void overlay (const Arrangement_2& arr1, - const Arrangement_2& arr2, - Arrangement_2& arr_res, - OverlayTraits& ovl_tr); - -/*! -\ingroup PkgArrangementOnSurface2Funcs -\brief Computes the overlay of two arrangements with history `arr1` and -`arr2`, and sets the output arrangement with history `res` to -represent the overlaid arrangement. The function also constructs a -consolidated set of curves that induce `res`. - -\details -Computes the overlay of two input arrangement -objects, and returns the overlaid arrangement. All three arrangements -can be instantiated with different geometric traits classes and different -\dcel classes (encapsulated in the various topology-traits classes). -The geometry traits of the resulting arrangement is used to construct the -resulting arrangement. This means that all the types (e.g., -`Traits::Point_2`, `Traits::Curve_2`, and `Traits::Point_2`) -of both input arrangements have to be convertible to the types in the -resulting arrangement. A given overlay-traits object is used to properly -construct the overlaid \dcel that represents the resulting arrangement. - -\pre `res` does not refer to either `arr1` or `arr2` (that is, "self overlay" is not supported). - -\pre The overlay-traits object `ovl_tr` must model the `OverlayTraits` - concept, which is able to construct records of the `ResDcel` class on - the basis of the `Dcel1` and `Dcel2` records that induce them. - -\sa `OverlayTraits` - -*/ -template -void overlay (const Arrangement_with_history_2& arr1, - const Arrangement_with_history_2& arr2, - Arrangement_with_history_2& res, - OverlayTraits& ovl_tr); - - - +void overlay(const Arrangement_with_history_2& arr1, + const Arrangement_with_history_2& arr2, + Arrangement_with_history_2& res, + OverlayTraits& ovl_tr); } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h index 0456c4e06f8..d426218d2fe 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_point_location_result.h @@ -8,16 +8,15 @@ namespace CGAL { * \tparam Arrangement must be an instance of the * `CGAL::Arrangement_on_surface_2` class template. * - * \sa `ArrangementPointLocation_2` - * \sa `ArrangementVerticalRayShoot_2` + * \sa `AosPointLocation_2` + * \sa `AosVerticalRayShoot_2` * \sa `CGAL::Arr_naive_point_location` * \sa `CGAL::Arr_walk_along_line_point_location` * \sa `CGAL::Arr_landmarks_point_location` * \sa `CGAL::Arr_trapezoid_ric_point_location` */ template -struct Arr_point_location_result -{ +struct Arr_point_location_result { /*! The type of the arrangement feature that is the result of a * point-location query or a vertical ray-shoot query, namely, * `std::variant` diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h index cedf54756da..96f5a2c6c03 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polycurve_traits_2.h @@ -1,523 +1,518 @@ namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2TraitsClasses + +/*! \ingroup PkgArrangementOnSurface2TraitsClasses + * + * Note: The `SubcurveTraits_2` can comprise of Line_segments, Conic_arcs, + * Circular_arc, Bezier_curves, or Linear_curves. A portion or a part + * of any of the above mentioned geometric traits is called a subcurve. + * + * The traits class `Arr_polycurve_traits_2` handles piecewise curves that are + * not necessarily linear, such as conic arcs, circular arcs, Bezier curves, + * or line segments. We call such a compound curve a polycurve. A polycurve + * is a chain of subcurves, where each two neighboring subcurves in the chain + * share a common endpoint; that is, the polycurve is continuous. Furthermore, + * the target of the \f$i\f$-th segment of a polycurve has to coincide with + * the source of the \f$i+1\f$-st segment; that is, the polycurve has to be + * \a well-oriented. Note that it is possible to construct general polycurves + * that are neither continuous nor well-oriented, as it is impossible to + * enforce this precondition (using the set of predicates required by the + * relevant concepts, see below). However, such polycurves cannot be used for + * the actual computation of arrangements. The traits class template exploits + * the functionality of the `SubcurveTraits_2` template-parameter to handle + * the subcurves that compose the polycurve. + * + * The type substituting the template parameter `SubcurveTraits_2` when + * the template Arr_polycurve_traits_2 is instantiated must be a model + * of the concepts + * - `AosTraits_2` and + * - `AosDirectionalXMonotoneTraits_2`. + * + * If, in addition, the SubcurveTraits_2 models the concept + * `AosApproximatePointTraits_2` then `Arr_polycurve_traits_2` models this + * concept as well. The same holds for the concept + * `AosOpenBoundaryTraits_2`. If no type is provided, then + * `Arr_segment_traits_2` (instantiated with + * `Exact_predicates_exact_constructions_kernel` as the kernel) is used. + * Otherwise, + * `Arr_algebraic_segment_traits_2`, + * `Arr_Bezier_curve_traits_2`, + * `Arr_circle_segment_traits_2`, + * `Arr_conic_traits_2`, + * `Arr_linear_traits_2`, + * `Arr_non_caching_segment_traits_2`, + * `Arr_segment_traits_2`, + * `Arr_rational_function_traits_2`, + * or any other model of the concepts above can be used. + * + * The number type used by the injected subcurve traits should support exact + * rational arithmetic (that is, the number type should support the arithmetic + * operations \f$+\f$, \f$-\f$, \f$\times\f$ and \f$\div\f$ carried out + * without loss of precision), in order to avoid robustness problems, although + * other inexact number types could be used at the user's own risk. + * + * A polycurve that comprises \f$n > 0\f$ subcurves has \f$n+1\f$ subcurve + * end-points, and they are represented as objects of type + * `SubcurveTraits_2::Point_2`. Since the notion of a \a vertex is reserved to + * 0-dimensional elements of an arrangement, we use, in this context, the + * notion of \a points in order to refer to the vertices of a polycurve. For + * example, an arrangement induced by a single non-self intersecting polycurve + * has exactly two vertices regardless of the number of subcurve + * end-points. Finally, the types `Subcurve_2` and `X_monotone_subcurve_2` + * nested in `Arr_polycurve_traits_2` are nothing but + * `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::X_monotone_curve_2`, + * respectively. + * + * \cgalHeading{A note on Backwards compatibility} In \cgal version 4.2 (and + * earlier) any object of the `X_monotone_curve_2` type nested in + * `Arr_polycurve_traits_2` which in that version was called + * `Arr_polyline_tratis_2` maintained a direction invariant; namely, its + * vertices were ordered in an \a ascending lexicographical \f$xy\f$-order. + * This restriction is no longer imposed and `X_monotone_curve_2` can be now + * directed either from right-to-left \a or left-to-right. If you wish to + * maintain a left-to-right orientations of the \f$x\f$-monotone polycurve, + * set the macro `CGAL_ALWAYS_LEFT_TO_RIGHT` to 1 before any \cgal header is + * included. + * + * \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2,AosApproximatePointTraits_2 (if the type that substitutes the template parameter `SubcurveTraits_2` models the concept as well)} + * + * \sa `Arr_algebraic_segment_traits_2` + * \sa `Arr_Bezier_curve_traits_2` + * \sa `Arr_circle_segment_traits_2` + * \sa `Arr_conic_traits_2` + * \sa `Arr_linear_traits_2` + * \sa `Arr_non_caching_segment_traits_2` + * \sa `Arr_segment_traits_2` + * \sa `Arr_rational_function_traits_2` + * \sa `CGAL_ALWAYS_LEFT_TO_RIGHT` + */ +template +class Arr_polycurve_traits_2 { +public: + /// \name Types + /// @{ + + /// + typedef SubcurveTraits_2::Point_2 Point_2; + + /// + typedef SubcurveTraits_2::Curve_2 Subcurve_2; + + /// + typedef SubcurveTraits_2::X_monotone_curve_2 X_monotone_subcurve_2; + + /// @} + + /*! Construction functor of a general (not necessarily \f$x\f$-monotone) + * polycurve. * - * Note: The `SubcurveTraits_2` can comprise of Line_segments, Conic_arcs, - * Circular_arc, Bezier_curves, or Linear_curves. A portion or a part - * of any of the above mentioned geometric traits is called a subcurve. + * This functor constructs general polycurve. Its `operator()` is + * overloaded to support various input types. * - * The traits class `Arr_polycurve_traits_2` handles piecewise curves that are - * not necessarily linear, such as conic arcs, circular arcs, Bezier curves, - * or line segments. We call such a compound curve a polycurve. A polycurve - * is a chain of subcurves, where each two neighboring subcurves in the chain - * share a common endpoint; that is, the polycurve is continuous. Furthermore, - * the target of the \f$i\f$th segment of a polycurve has to coincide with - * the source of the \f$i+1\f$st segment; that is, the polycurve has to be - * \a well-oriented. Note that it is possible to construct general polycurves - * that are neither continuous nor well-oriented, as it is impossible to - * enforce this precondition (using the set of predicates required by the - * relevant concepts, see below). However, such polycurves cannot be used for - * the actual computation of arrangements. The traits class template exploits - * the functionality of the `SubcurveTraits_2` template-parameter to handle - * the subcurves that compose the polycurve. - * - * The type substituting the template parameter `SubcurveTraits_2` when - * the template Arr_polycurve_traits_2 is instantiated must be a model - * of the concepts - * - `ArrangementTraits_2` and - * - `ArrangementDirectionalXMonotoneTraits_2`. - * - * If, in addition, the SubcurveTraits_2 models the concept - * `ArrangementApproximateTraits_2` then `Arr_polycurve_traits_2` models this - * concept as well. The same holds for the concept - * `ArrangementOpenBoundaryTraits_2`. If no type is provided, then - * `Arr_segment_traits_2` (instantiated with - * `Exact_predicates_exact_constructions_kernel` as the kernel) is used. - * Otherwise, - * `Arr_algebraic_segment_traits_2`, - * `Arr_Bezier_curve_traits_2`, - * `Arr_circle_segment_traits_2`, - * `Arr_conic_traits_2`, - * `Arr_linear_traits_2`, - * `Arr_non_caching_segment_traits_2`, - * `Arr_segment_traits_2`, - * `Arr_rational_function_traits_2`, - * or any other model of the concepts above can be used. - * - * The number type used by the injected subcurve traits should support exact - * rational arithmetic (that is, the number type should support the arithmetic - * operations \f$ +\f$, \f$ -\f$, \f$ \times\f$ and \f$ \div\f$ carried out - * without loss of precision), in order to avoid robustness problems, although - * other inexact number types could be used at the user's own risk. - * - * A polycurve that comprises \f$n > 0\f$ subcurves has \f$ n+1 \f$ subcurve - * end-points, and they are represented as objects of type - * `SubcurveTraits_2::Point_2`. Since the notion of a \a vertex is reserved to - * 0-dimensional elements of an arrangement, we use, in this context, the - * notion of \a points in order to refer to the vertices of a polycurve. For - * example, an arrangement induced by a single non-self intersecting polycurve - * has exactly two vertices regardless of the number of subcurve - * end-points. Finally, the types `Subcurve_2` and `X_monotone_subcurve_2` - * nested in `Arr_polycurve_traits_2` are nothing but - * `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::X_monotone_curve_2`, - * respectively. - * - * \cgalHeading{A note on Backwards compatibility} In \cgal version 4.2 (and - * earlier) any object of the `X_monotone_curve_2` type nested in - * `Arr_polycurve_traits_2` which in that version was called - * `Arr_polyline_tratis_2` maintained a direction invariant; namely, its - * vertices were ordered in an \a ascending lexicographical \f$(xy)\f$-order. - * This restriction is no longer imposed and `X_monotone_curve_2` can be now - * directed either from right-to-left \a or left-to-right. If you wish to - * maintain a left-to-right orientations of the \f$x\f$-monotone polycurve, - * set the macro `CGAL_ALWAYS_LEFT_TO_RIGHT` to 1 before any \cgal header is - * included. - * - * \cgalModels{ArrangementTraits_2,ArrangementDirectionalXMonotoneTraits_2, - * ArrangementApproximateTraits_2 (if the type that substitutes - * the template parameter `SubcurveTraits_2` models the concept as well)} - * - * \sa `Arr_algebraic_segment_traits_2` - * \sa `Arr_Bezier_curve_traits_2` - * \sa `Arr_circle_segment_traits_2` - * \sa `Arr_conic_traits_2` - * \sa `Arr_linear_traits_2` - * \sa `Arr_non_caching_segment_traits_2` - * \sa `Arr_segment_traits_2` - * \sa `Arr_rational_function_traits_2` - * \sa `CGAL_ALWAYS_LEFT_TO_RIGHT` + * Note that the composing subcurves, depending on the `SubcurveTraits_2`, + * might not be \f$x\f$-monotone. */ - - template - class Arr_polycurve_traits_2 { + class Construct_curve_2 { public: + /// \name Operations + /// @{ + /*! obtains a polycurve that comprises of one given subcurve. + * \param subcurve input subcurve. + * + * \pre `subcurve` is not degenerated (not tested). + * \return A polycurve with one subcurve, namely `subcurve`. + */ + Curve_2 operator()(const Subcurve_2& subcurve) const; + + /*! constructs a well-oriented polycurve from a range of either + * `SubcurveTraits_2::Point_2` or `SubcurveTraits_2::Curve_2`. + * + * \param begin iterator pointing to the first element in the range. + * \param end iterator pointing to the past-the-end element in the range. + * + * \pre The given range form a continuous and well-oriented polycurve (not tested). + * \pre Contains no degenerated subcurves (not tested) + * \return A polycurve using the corresponding construction implementation. + */ + template + Curve_2 operator()(ForwardIterator begin, ForwardIterator end) const; + + /// @} /* end of operations */ + }; /* end of Arr_polycurve_traits_2::Construct_curve_2 */ + + /*! Construction functor of \f$x\f$-monotone polycurve. + * + * Similar to `Construct_curve_2`, only returns \f$x\f$-monotone + * polycurve. Thus, have the same overloads of the + * `operator()`. Note that when constructing `X_monotone_curve_2` + * all preconditions are tested. + * + * If `CGAL_ALWAYS_LEFT_TO_RIGHT` is defined, then the resulting + * \f$x\f$-monotone polycurve will be oriented from left-to-right. + */ + class Construct_x_monotone_curve_2 {}; + + /*! Function object which returns the number of subcurve end-points of a + * polycurve. + */ + class Number_of_points_2 {}; + + /*! Functor to augment a polycurve by either adding a vertex or a subcurve + * at the back. + */ + class Push_back_2 { + public: + /// \name Operations + /// @{ + + /*! appends a subcurve `subcurve` to an existing polycurve `cv` at the back. + * If `cv` is empty, `subcurve` will be its first subcurve. + * \param cv a polycurve. Note, `cv` is (not necessarily) \f$x\f$-monotone. + * \param subcurve a subcurve (not necessarily \f$x\f$-monotone) to be + * appended to `cv` + */ + void operator()(Curve_2& cv, const Subcurve_2& subcurve) const; + + /*! appends a subcurve `subcurve` to an existing \f$x\f$-monotone polycurve + * `xcv` at the back. If `xcv` is empty, `subcurve` will be its first + * subcurve. + * \param xcv existing \f$x\f$-monotone polycurve + * \param subcurve the subcurve to be added + * \pre If `xcv` is not empty then `subcurve` extends `xcv` to the right + * if `xcv` is oriented right-to-left. Otherwise, `subcurve` extends + * `xcv` to the left. + * + * \pre `subcurve` is not degenerated. + * \pre `xcv` and `subcurve` should have the same orientation + */ + void operator()(X_monotone_curve_2& xcv, + const X_monotone_subcurve_2& subcurve) const; + /// @} /* end of operations */ + }; /* end of Arr_polycurve_traits_2::Push_back_2 */ + + /*! Functor to augment a polycurve by either adding a vertex or a subcurve + * at the front. + */ + class Push_front_2 { + public: + /// \name Operations + /// @{ + + /*! appends a subcurve `subcurve` to an existing polycurve `cv` at the + * front. If `cv` is empty, `subcurve` will be its first subcurve. + * \param cv a polycurve. Note, `cv` is (not necessarily) \f$x\f$-monotone. + * \param subcurve a subcurve (not necessarily \f$x\f$-monotone) to be + * appended to `cv` + */ + void operator()(Curve_2& cv, const Subcurve_2& subcurve) const; + + /*! appends a subcurve `subcurve` to an existing \f$x\f$-monotone polycurve + * `xcv` at the front. If `xcv` is empty, `subcurve` will be its first + * subcurve. + * \param xcv existing \f$x\f$-monotone polycurve + * \param subcurve the subcurve to be added + * + * \pre If `xcv` is not empty then `subcurve` extends `xcv` to the left if + * `xcv` is oriented right-to-left. Otherwise, `subcurve` extends + * `xcv` to the right. + * \pre `subcurve` is not degenerated. + * \pre `xcv` and `subcurve` should have the same orientation + */ + void operator()(X_monotone_curve_2& xcv, + const X_monotone_subcurve_2& subcurve) const; + + /// @} /* end of operations */ + }; /* end of Arr_polycurve_traits_2::Push_front_2 */ + + class Trim_2 { + public: + /*! obtains a trimmed version of the polycurve with src and tgt as end + * vertices. + * `src` and `tgt` will be swapped if they do not conform to the direction of + * the polycurve. + */ + X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, + const Point_2& src, + const Point_2& tgt) const; + }; + + /*! subdivides a given subcurve into \f$x\f$-monotone subcurves and + * isolated points, and insert them into an output container. An object in + * the output container is represented by a discriminated union container + * that holds either a point or an \f$x\f$-monotone curve. + */ + class Make_x_monotone_2 { + public: + /*! performs the subdivision. + * + * \param cv the subcurve. + * \param oi The output iterator that points at the output container. + * \return the past-the-end iterator of the output container. + * + * \pre if `cv` is not empty, then it must be continuous and well-oriented. + * \pre Dereferencing `oi` must yield a polymorphic object of type + * `std::variant<`\link Arr_polycurve_traits_2::Point_2 `Point_2` \endlink, + * `X_monotone_curve_2>`. + */ + template + OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const; + }; + + /*! The `Curve_2` type nested in the `Arr_polycurve_traits_2` represents + * general continuous piecewise-linear subcurves (a polycurve can be + * self-intersecting) and support their construction from range of + * subcurves. Construction of polycurves in various ways is supported using + * the construction functors. It is strongly recommended to avoid + * construction of `Curve_2` objects directly and prefer the usage of the + * construction functors. The type `Curve_2` has two template + * parameters, namely `SubcurveType_2` and `PointType_2`, which are + * `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::Point_2` types. Thus, + * in general, the subcurves that a `Curve_2` instance comprises could be + * either \f$x\f$-monotone or not! + * + * The copy and default constructor as well as the assignment operator are + * provided for polycurve subcurves. In addition, an \link + * PkgArrangementOnSurface2op_left_shift `operator<<` \endlink for the + * subcurves is defined for standard output streams, and an \link + * PkgArrangementOnSurface2op_right_shift `operator>>` \endlink for the + * subcurves is defined for standard input streams. + */ + template + class Curve_2 { + protected: /// \name Types /// @{ - /*! + /*! The container of the subcurves that comprises the polycurve. */ - // TODO: Have to turn these into links, so whenever I mention Point_2 it - // will point here and *not* to Kernel::Point_2 for instance. - typedef SubcurveTraits_2::Point_2 Point_2; + typedef typename std::vector Subcurves_container; - /*! + public: + /*! The size of the container that comprises the polycurve. */ - typedef SubcurveTraits_2::Curve_2 Subcurve_2; - typedef SubcurveTraits_2::X_monotone_curve_2 X_monotone_subcurve_2; - /// @} + typedef typename Subcurves_container::size_type Size; + typedef typename Subcurves_container::size_type size_type; - /*! Construction functor of a general (not necessarily \f$x\f$-monotone) - * polycurve. - * - * This functor constructs general polycurve. Its `operator()` is - * overloaded to support various input types. - * - * Note that the composing subcurves, depending on the `SubcurveTraits_2`, - * might not be \f$x\f$-monotone. + /*! \deprecated + * A bidirectional iterator that allows traversing the points + * that comprise a polycurve's subcurves. */ - class Construct_curve_2 { - public: - /// \name Operations - /// @{ + typedef unspecified_type const_iterator; - /*! obtains a polycurve that comprises of one given subcurve. - * \param subcurve input subcurve. - * \pre `subcurve` is not degenerated (not tested). - * \return A polycurve with one subcurve, namely `subcurve`. - */ - Curve_2 operator()(const Subcurve_2& subcurve) const; - - /*! constructs a well-oriented polycurve from a range of either - * `SubcurveTraits_2::Point_2` or `SubcurveTraits_2::Curve_2`. - * - * \param begin iterator pointing to the first element in the - * range. - * \param end iterator pointing to the past-the-end - * element in the range. - * \pre The given range form a continuous and well-oriented polycurve - * (not tested). - * \pre Contains no degenerated subcurves (not tested) - * \return A polycurve using the corresponding construction implementation. - */ - template - Curve_2 operator()(ForwardIterator begin, ForwardIterator end) const; - - /// @} /* end of operations */ - }; /* end of Arr_polycurve_traits_2::Construct_curve_2 */ - - /*! Construction functor of \f$x\f$-monotone polycurve. - * - * Similar to `Construct_curve_2`, only returns \f$x\f$-monotone - * polycurve. Thus, have the same overloads of the - * `operator()`. Note that when constructing `X_monotone_curve_2` - * all preconditions are tested. - * - * If `CGAL_ALWAYS_LEFT_TO_RIGHT` is defined, then the resulting - * \f$x\f$-monotone polycurve will be oriented from left-to-right. + /*! \deprecated + * A bidirectional iterator that allows traversing the points + * that comprise a polycurve's subcurves. */ - class Construct_x_monotone_curve_2 {}; + typedef unspecified_type const_reverse_iterator; - /*! Function object which returns the number of subcurve end-points of a - * polycurve. + /*! A bidirectional constant iterator that allows traversing + * the subcurves that comprise the polycurve. */ - class Number_of_points_2 {}; + typedef unspecified_type Subcurve_const_iterator; - /*! Functor to augment a polycurve by either adding a vertex or a subcurve - * at the back. + /*! A bidirectional constant iterator that allows traversing + * the subcurves that comprise the polycurve. */ - class Push_back_2 { - public: - /// \name Operations - /// @{ + typedef unspecified_type Subcurve_const_reverse_iterator; - /*! appends a subcurve `subcurve` to an existing polycurve `cv` at the - * back. If `cv` is empty, `subcurve` will be its first subcurve. - * \param cv a polycurve. Note, `cv` is (not necessarily) \f$x\f$-monotone. - * \param subcurve a subcurve (not necessarily \f$x\f$-monotone) to be - * appended to `cv` - */ - void operator()(Curve_2& cv, const Subcurve_2& subcurve) const; + /// @} /* End of Types */ - /*! appends a subcurve `subcurve` to an existing \f$x\f$-monotone - * polycurve `xcv` at the back. If `xcv` is empty, `subcurve` will be its - * first subcurve. - * \param xcv existing \f$x\f$-monotone polycurve - * \param subcurve the subcurve to be added - * \pre If `xcv` is not empty then `subcurve` extends `xcv` to the right - * if `xcv` is oriented right-to-left. Otherwise, `subcurve` extends - * `xcv` to the left. - * \pre `subcurve` is not degenerated. - * \pre `xcv` and `subcurve` should have the same orientation - */ - void operator()(X_monotone_curve_2& xcv, - const X_monotone_subcurve_2& subcurve) const; - /// @} /* end of operations */ - }; /* end of Arr_polycurve_traits_2::Push_back_2 */ - - /*! Functor to augment a polycurve by either adding a vertex or a subcurve - * at the front. - */ - class Push_front_2 { - public: - /// \name Operations - /// @{ - - /*! appends a subcurve `subcurve` to an existing polycurve `cv` at the - * front. If `cv` is empty, `subcurve` will be its first subcurve. - * \param cv a polycurve. Note, `cv` is (not necessarily) \f$x\f$-monotone. - * \param subcurve a subcurve (not necessarily \f$x\f$-monotone) to be - * appended to `cv` - */ - void operator()(Curve_2& cv, const Subcurve_2& subcurve) const; - - /*! appends a subcurve `subcurve` to an existing \f$x\f$-monotone - * polycurve `xcv` at the front. If `xcv` is empty, `subcurve` will be its - * first subcurve. - * \param xcv existing \f$x\f$-monotone polycurve - * \param subcurve the subcurve to be added - * \pre If `xcv` is not empty then `subcurve` extends `xcv` to the left if - * `xcv` is oriented right-to-left. Otherwise, `subcurve` extends - * `xcv` to the right. - * \pre `subcurve` is not degenerated. - * \pre `xcv` and `subcurve` should have the same orientation - */ - void operator()(X_monotone_curve_2& xcv, - const X_monotone_subcurve_2& subcurve) const; - - /// @} /* end of operations */ - }; /* end of Arr_polycurve_traits_2::Push_front_2 */ - - class Trim_2 { - public: - /*! obtains a trimmed version of the polycurve with src and tgt as end - * vertices. - * Src and tgt will be swapped if they do not conform to the direction of - * the polycurve. - */ - X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, - const Point_2& src, - const Point_2& tgt) const; - }; - - /*! subdivides a given subcurve into \f$x\f$-monotone subcurves and - * isolated points, and insert them into an output container. An object in - * the output container is represented by a discriminated union container - * that holds either a point or an \f$x\f$-monotone curve. - */ - class Make_x_monotone_2 { - public: - /*! performs the subdivision. - * - * \param cv the subcurve. - * \param oi The output iterator that points at the output container. - * \return the past-the-end iterator of the output container. - * - * \pre if `cv` is not empty, then it must be continuous and well-oriented. - * \pre Dereferencing `oi` must yield a polymorphic object of type - * `std::variant<`\link Arr_polycurve_traits_2::Point_2 `Point_2` \endlink, `X_monotone_curve_2>`. - */ - template - OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const; - }; - - /*! The `Curve_2` type nested in the `Arr_polycurve_traits_2` represents - * general continuous piecewise-linear subcurves (a polycurve can be - * self-intersecting) and support their construction from range of - * subcurves. Construction of polycurves in various ways is supported using - * the construction functors. It is strongly recommended to avoid - * construction of `Curve_2` objects directly and prefer the usage of the - * construction functors. The type `Curve_2` has two template - * parameters, namely `SubcurveType_2` and `PointType_2`, which are - * `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::Point_2` types. Thus, - * in general, the subcurves that a `Curve_2` instance comprises could be - * either \f$x\f$-monotone or not! - * - * The copy and default constructor as well as the assignment operator are - * provided for polycurve subcurves. In addition, an \link - * PkgArrangementOnSurface2op_left_shift `operator<<` \endlink for the - * subcurves is defined for standard output streams, and an \link - * PkgArrangementOnSurface2op_right_shift `operator>>` \endlink for the - * subcurves is defined for standard input streams. - */ - template - class Curve_2 { - public: - - protected: - /// \name Types - /// @{ - - /*! The container of the subcurves that comprises the polycurve. - */ - typedef typename std::vector Subcurves_container; - - public: - /*! The size of the container that comprises the polycurve. - */ - typedef typename Subcurves_container::size_type Size; - typedef typename Subcurves_container::size_type size_type; - - /*! \deprecated - * A bidirectional iterator that allows traversing the points - * that comprise a polycurve's subcurves. - */ - typedef unspecified_type const_iterator; - - /*! \deprecated - * A bidirectional iterator that allows traversing the points - * that comprise a polycurve's subcurves. - */ - typedef unspecified_type const_reverse_iterator; - - /*! A bidirectional constant iterator that allows traversing - * the subcurves that comprise the polycurve. - */ - typedef unspecified_type Subcurve_const_iterator; - - /*! A bidirectional constant iterator that allows traversing - * the subcurves that comprise the polycurve. - */ - typedef unspecified_type Subcurve_const_reverse_iterator; - - /// @} /* End of Types */ - - /// \name Creation - /// @{ - - /*! constructs Default; constructs an empty polycurve. - */ - Curve_2(); - - /*! constructs a polycurve from one subcurve. - */ - Curve_2(const Subcurve_2 subcurve); - - /*! constructs a polycurve defined by the given range of subcurves - * `[first, last)` (the value-type of `InputIterator` must be - * `SubcurveTraits_2::Curve_2`. In general, the subcurves might not - * be \f$x\f$-monotone, furthermore, they might not form a - * continuous polycurve. - * - * \pre The subcurves in the range should form a continuous and - * well-oriented polycurve. - * - * \deprecated For backwards compatibility, it is - * possible to call this constructor with a range whose - * value-type is `SubcurveTraits_2::Point_2`. In this case, the - * constructed polycurve will concatenate the \f$n\f$th point - * with the \f$(n+1)\f$-st point in the range (using a - * `SubcurveTraits_2::Subcurve_2`'s). This functionality is \a deprecated. - * Instead use the `Construct_curve_2` functors. - */ - template - Curve_2(Iterator first, Iterator last); - - /// @} /* End of Creation */ - - /// \name Access Functions - /// @{ - - /*! \deprecated - * obtains the number of subcurve end-points that comprise the polycurve. - * Note that for a bounded polycurve, if there are \f$ n\f$ points in the - * polycurve, it comprises \f$ (n - 1)\f$ subcurves. - * Currently, only bounded polycurves are supported. - */ - unsigned_int points() const; - - /*! \deprecated - * obtains an iterator pointing at the source point of the polycurve. - */ - const_iterator begin() const; - - /*! obtains an iterator pointing at the first subcurve of the polycurve. - */ - Subcurve_const_iterator begin_subcurves() const; - - /*! \deprecated - * obtains an iterator pointing after the end of the polycurve. - */ - const_iterator end() const; - - /*! obtains an iterator pointing at the past-the-end subcurve of the - * polycurve. - */ - Subcurve_const_iterator end_subcurves() const; - - /*! \deprecated - * Obtain an iterator pointing at the target point of the polycurve. - */ - const_iterator rbegin() const; - - /*! obtains an iterator pointing at the last subcurve of the polycurve. - */ - Subcurve_const_reverse_iterator rbegin_subcurves() const; - - /*! \deprecated - * obtains an iterator pointing before the beginning of the polycurve. - */ - const_iterator rend() const; - - /*! obtains an iterator pointing at the past-the-end subcurve of - * the polycurve in reverse order. - */ - Subcurve_const_reverse_iterator rend_subcurves() const; - - /*! \deprecated - * obtains the number of subcurves composing the polycurve - * (equivalent to `pi.points() - 1`). Was replaced by number_of_subcurves() - */ - size_type size() const; - - /*! obtains the number of subcurves that comprise the polycurve. - */ - size_type number_of_subcurves() const; - - /*! obtains the \f$ k\f$th subcurve of the polycurve. - * \pre \f$k\f$ is not greater than or equal to \f$n-1\f$, where - * \f$n\f$ is the number of subcurves. - */ - typename SubcurveTraits_2::X_monotone_curve_2 - operator[](size_t k) const; - - /*! obtains the bounding box of the polycurve. - */ - Bbox_2 bbox() const; - - /// @} /* End of Access functions */ - - /// \name Operations - /// @{ - - /*! appends a subcurve to the polycurve at the back. - * \a Warning: This function does not perform the precondition test - * that the `Push_back_2` functor does. Thus, it is - * recommended to use the latter. - * \param subcurve The new subcurve to be appended to the polycurve. - * \pre If the polycurve is not empty, the source of `subcurve` must - * coincide with the target point of the last subcurve in the - * polycurve. - */ - inline void push_back(const Subcurve_2& subcurve); - - /*! appends a subcurve to the polycurve at the front. - * \a Warning: This is a risky function! Don't use it! Prefer the - * corresponding functor which is provided in the traits - * class. - * \param subcurve The new subcurve to be appended to the polycurve. - * \pre If the polycurve is not empty, the target of `subcurve` must - * coincide with the source point of the first subcurve in the - * polycurve. - */ - inline void push_front(const Subcurve_2& subcurve); - - /*! \deprecated - * adds a new point to the polycurvs, which becomes the new target point - * of `pi`. - */ - void push_back(const Point_2 & p); - - /*! resets the polycurve. - */ - void clear(); - - /// @} /* End of Operations */ - - }; /* end Arr_polycurve_traits_2::Curve_2 */ - - /*! The `X_monotone_curve_2` class nested within the polycurve - * traits is used to represent \f$ x\f$-monotone piecewise linear subcurves. - * - * It inherits from the `Curve_2` type. `X_monotone_curve_2` can be - * constructed just like `Curve_2`. However, there is precondition - * (which is not tested) that the input defines an \f$ - * x\f$-monotone polycurve. Furthermore, in contrast to the general - * `Curve_2` type, in this case, the subcurves that an - * `X_monotone_curve_2` comprises have to be instances of the type - * `SubcurveTraits_2::X_monotone_curve_2`. Note that the \f$ - * x\f$-monotonicity ensures that an \f$ x\f$-monotone polycurve - * is not self-intersecting. (A self-intersecting polycurve is - * subdivided into several interior-disjoint \f$x\f$-monotone subcurves). - * - * The defined \f$ x\f$-monotone polycurve can be directed either from - * right-to-left (and in turn its vertices are stored in an ascending - * lexicographical \f$ xy\f$-order) or left-to-right (and in this case the - * vertices are stored in a descending lexicographical \f$ xy\f$-order). - */ - template - class X_monotone_curve_2 { - - }; /* end Arr_polycurve_traits_2::X_monotone_curve_2 */ - - /// \name Accessing Functor Objects + /// \name Creation /// @{ - /*! + /*! constructs default; constructs an empty polycurve. */ - Construct_curve_2 construct_curve_2_object() const; + Curve_2(); - /*! + /*! constructs a polycurve from one subcurve. */ - Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const; + Curve_2(const Subcurve_2 subcurve); - /*! + /*! constructs a polycurve defined by the given range of subcurves + * `[first, last)` (the value-type of `InputIterator` must be + * `SubcurveTraits_2::Curve_2`. In general, the subcurves might not + * be \f$x\f$-monotone, furthermore, they might not form a + * continuous polycurve. + * + * \pre The subcurves in the range should form a continuous and + * well-oriented polycurve. + * + * \deprecated For backwards compatibility, it is + * possible to call this constructor with a range whose + * value-type is `SubcurveTraits_2::Point_2`. In this case, the + * constructed polycurve will concatenate the \f$n\f$th point + * with the \f$(n+1)\f$-st point in the range (using a + * `SubcurveTraits_2::Subcurve_2`'s). This functionality is \a deprecated. + * Instead use the `Construct_curve_2` functors. */ - Number_of_points_2 number_of_points_2_object() const; + template + Curve_2(Iterator first, Iterator last); - /*! + /// @} /* End of Creation */ + + /// \name Access Functions + /// @{ + + /*! \deprecated + * obtains the number of subcurve end-points that comprise the polycurve. + * Note that for a bounded polycurve, if there are \f$n\f$ points in the + * polycurve, it comprises \f$(n - 1)\f$ subcurves. + * Currently, only bounded polycurves are supported. */ - Push_back_2 push_back_2_object() const; + unsigned_int points() const; - /*! + /*! \deprecated + * obtains an iterator pointing at the source point of the polycurve. */ - Push_front_2 push_front_2_object() const; + const_iterator begin() const; - /*! + /*! obtains an iterator pointing at the first subcurve of the polycurve. */ - Make_x_monotone_2 make_x_monotone_2_object() const; + Subcurve_const_iterator begin_subcurves() const; - /// @} /* End Accessing Functor Objects */ + /*! \deprecated + * obtains an iterator pointing after the end of the polycurve. + */ + const_iterator end() const; - }; /* end Arr_polycurve_traits_2 */ + /*! obtains an iterator pointing at the past-the-end subcurve of the + * polycurve. + */ + Subcurve_const_iterator end_subcurves() const; + + /*! \deprecated + * obtains an iterator pointing at the target point of the polycurve. + */ + const_iterator rbegin() const; + + /*! obtains an iterator pointing at the last subcurve of the polycurve. + */ + Subcurve_const_reverse_iterator rbegin_subcurves() const; + + /*! \deprecated + * obtains an iterator pointing before the beginning of the polycurve. + */ + const_iterator rend() const; + + /*! obtains an iterator pointing at the past-the-end subcurve of + * the polycurve in reverse order. + */ + Subcurve_const_reverse_iterator rend_subcurves() const; + + /*! \deprecated + * obtains the number of subcurves composing the polycurve + * (equivalent to `pi.points() - 1`). Was replaced by number_of_subcurves() + */ + size_type size() const; + + /*! obtains the number of subcurves that comprise the polycurve. + */ + size_type number_of_subcurves() const; + + /*! obtains the \f$k\f$-th subcurve of the polycurve. + * + * \pre \f$k\f$ is not greater than or equal to \f$n-1\f$, where + * \f$n\f$ is the number of subcurves. + */ + typename SubcurveTraits_2::X_monotone_curve_2 + operator[](size_t k) const; + + /*! obtains the bounding box of the polycurve. + */ + Bbox_2 bbox() const; + + /// @} /* End of Access functions */ + + /// \name Operations + /// @{ + + /*! appends a subcurve to the polycurve at the back. + * \a Warning: This function does not perform the precondition test + * that the `Push_back_2` functor does. Thus, it is + * recommended to use the latter. + * \param subcurve The new subcurve to be appended to the polycurve. + * + * \pre If the polycurve is not empty, the source of `subcurve` must + * coincide with the target point of the last subcurve in the + * polycurve. + */ + inline void push_back(const Subcurve_2& subcurve); + + /*! appends a subcurve to the polycurve at the front. + * \a Warning: This is a risky function! Don't use it! Prefer the + * corresponding functor which is provided in the traits + * class. + * \param subcurve The new subcurve to be appended to the polycurve. + * + * \pre If the polycurve is not empty, the target of `subcurve` must + * coincide with the source point of the first subcurve in the + * polycurve. + */ + inline void push_front(const Subcurve_2& subcurve); + + /*! \deprecated + * adds a new point to the polycurvs, which becomes the new target point + * of `pi`. + */ + void push_back(const Point_2 & p); + + /*! resets the polycurve. + */ + void clear(); + + /// @} /* End of Operations */ + + }; /* end Arr_polycurve_traits_2::Curve_2 */ + + /*! The `X_monotone_curve_2` class nested within the polycurve traits is + * used to represent \f$x\f$-monotone piecewise linear subcurves. + * + * It inherits from the `Curve_2` type. `X_monotone_curve_2` can be + * constructed just like `Curve_2`. However, there is precondition (which is + * not tested) that the input defines an \f$x\f$-monotone + * polycurve. Furthermore, in contrast to the general `Curve_2` type, in this + * case, the subcurves that an `X_monotone_curve_2` comprises have to be + * instances of the type `SubcurveTraits_2::X_monotone_curve_2`. Note that the + * \f$x\f$-monotonicity ensures that an \f$x\f$-monotone polycurve is not + * self-intersecting. (A self-intersecting polycurve is subdivided into + * several interior-disjoint \f$x\f$-monotone subcurves). + * + * The defined \f$x\f$-monotone polycurve can be directed either from + * right-to-left (and in turn its vertices are stored in an ascending + * lexicographical \f$xy\f$-order) or left-to-right (and in this case the + * vertices are stored in a descending lexicographical \f$xy\f$-order). + */ + template + class X_monotone_curve_2 {}; + + /// \name Accessing Functor Objects + /// @{ + + /*! + */ + Construct_curve_2 construct_curve_2_object() const; + + /*! + */ + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const; + + /*! + */ + Number_of_points_2 number_of_points_2_object() const; + + /*! + */ + Push_back_2 push_back_2_object() const; + + /*! + */ + Push_front_2 push_front_2_object() const; + + /*! + */ + Make_x_monotone_2 make_x_monotone_2_object() const; + + /// @} /* End Accessing Functor Objects */ +}; /* end Arr_polycurve_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polyline_traits_2.h index 5f6614a6ada..68956734bc3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polyline_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_polyline_traits_2.h @@ -30,15 +30,15 @@ namespace CGAL { * The type substituting the template parameter `SegmentTraits_2` when * the template Arr_polyline_traits_2 is instantiated must be a model * of the concepts - * - `ArrangementTraits_2`, - * - `ArrangementDirectionalXMonotoneTraits_2`, - * - `ArrangementConstructXMonotoneCurveTraits_2`, - * - `ArrangementConstructCurveTraits_2`. + * - `AosTraits_2`, + * - `AosDirectionalXMonotoneTraits_2`, + * - `AosConstructXMonotoneCurveTraits_2`, + * - `AosConstructCurveTraits_2`. * * If, in addition, the GeometryTraits_2 models the concept - * `ArrangementApproximateTraits_2` then `Arr_polycurve_traits_2` models - * this concept as well. The same holds for the concept - * `ArrangementOpenBoundaryTraits_2`. If no type is provided, then + * `AosApproximateTraits_2` (or `AosApproximatePointTraits_2`) then + * `Arr_polycurve_traits_2` models this concept as well. The same holds for the + * concept `AosOpenBoundaryTraits_2`. If no type is provided, then * `Arr_segment_traits_2` (instantiated with * `Exact_predicates_exact_constructions_kernel` as the kernel) is used. * Otherwise, @@ -52,17 +52,17 @@ namespace CGAL { * * The number type used by the injected segment traits should support exact * rational arithmetic (that is, the number type should support the arithmetic - * operations \f$ +\f$, \f$ -\f$, \f$ \times\f$ and \f$ \div\f$ carried out + * operations \f$+\f$, \f$-\f$, \f$\times\f$ and \f$\div\f$ carried out * without loss of precision), in order to avoid robustness problems, although * other inexact number types could be used at the user's own risk. * - * A polyline that comprises \f$n > 0\f$ segments has \f$ n+1 \f$ points, and - * they are represented as objects of type `SegmentTraits_2::Point_2`. Since the - * notion of a \a vertex is reserved to 0-dimensional elements of an + * A polyline that comprises \f$n > 0\f$ segments has \f$n+1\f$ points, and + * they are represented as objects of type `SegmentTraits_2::Point_2`. Since + * the notion of a \a vertex is reserved to 0-dimensional elements of an * arrangement, we use, in this context, the notion of \a points in order to - * refer to the vertices of a polyline. For example, an arrangement induced by a - * single non-self intersecting polyline has exactly two vertices regardless of - * the number of points. Finally, the types `Segment_2` and + * refer to the vertices of a polyline. For example, an arrangement induced by + * a single non-self intersecting polyline has exactly two vertices regardless + * of the number of points. Finally, the types `Segment_2` and * `X_monotone_segment_2` nested in `Arr_polyline_traits_2` are nothing but * `SegmentTraits_2::Curve_2` and `SegmentTraits_2::X_monotone_curve_2`, * respectively. @@ -77,9 +77,9 @@ namespace CGAL { * the macro `CGAL_ALWAYS_LEFT_TO_RIGHT` to 1 before any \cgal header is * included. * - * \cgalModels{ArrangementTraits_2,ArrangementDirectionalXMonotoneTraits_2,`ArrangementConstructXMonotoneCurveTraits_2` - * ArrangementConstructCurveTraits_2,ArrangementApproximateTraits_2 (if the type that substitutes - * the template parameter `SegmentTraits_2` models the concept as well)} + * \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2,AosConstructXMonotoneCurveTraits_2,AosConstructCurveTraits_2,AosApproximateTraits_2 + * (if the type that substitutes the template parameter `SegmentTraits_2` + * models the concept as well)} * * \sa `Arr_polycurve_traits_2` * \sa `Arr_Bezier_curve_traits_2` @@ -91,22 +91,23 @@ namespace CGAL { * \sa `CGAL_ALWAYS_LEFT_TO_RIGHT` */ template -class Arr_polyline_traits_2 : public Arr_polycurve_traits_2{ +class Arr_polyline_traits_2 : public Arr_polycurve_traits_2 { public: - /// \name Types /// @{ - /*! - */ + + /// typedef SegmentTraits_2 Segment_traits_2; - // TODO: Have to turn these into links, so whenever I mention Point_2 it - // will point here and *not* to Kernel::Point_2 for instance. + + /// typedef SegmentTraits_2::Point_2 Point_2; - /*! - */ + /// typedef SegmentTraits_2::Curve_2 Segment_2; + + /// typedef SegmentTraits_2::X_monotone_curve_2 X_monotone_segment_2; + /// @} /*! The `Curve_2` type nested within the traits class respresnts @@ -114,18 +115,18 @@ public: */ class Curve_2 { public: - //! Const iterator of subcurves. + /// Const iterator of subcurves. typedef std::vector::const_iterator Segment_const_iterator; - //! Reverse const iterator of subcurves. + /// Reverse const iterator of subcurves. typedef std::reverse_iterator Segment_const_reverse_iterator; - //! constructs default. + /// constructs default. Curve_2(); - //! constructs from a subcurve. + /// constructs from a subcurve. Curve_2(const Segment_2& seg); /*! constructs a polyline from a range of subcurves. @@ -137,16 +138,16 @@ public: template void Curve_2(InputIterator begin, InputIterator end); - //! obtains an iterator for the polycurve subcurves. + /// obtains an iterator for the polycurve subcurves. Segment_const_iterator begin_segments() const; - //! obtains a past-the-end iterator for the polycurve subcurves. + /// obtains a past-the-end iterator for the polycurve subcurves. Segment_const_iterator end_segments() const; - //! obtains the first reverse iterator of the polyline subcurves. + /// obtains the first reverse iterator of the polyline subcurves. Segment_const_reverse_iterator rbegin_segments() const; - //! obtains the past-the-end reverse iterator for the polyline points. + /// obtains the past-the-end reverse iterator for the polyline points. Segment_const_reverse_iterator rend_segments() const; /*! obtains the number of subcurves that comprise the poyline. @@ -161,11 +162,11 @@ public: class X_monotone_curve_2 { public: - //! Const iterator of subcurves. + /// Const iterator of subcurves. typedef std::vector::const_iterator Segment_const_iterator; - //! Reverse const iterator of subcurves. + /// Reverse const iterator of subcurves. typedef std::reverse_iterator Segment_const_reverse_iterator; @@ -177,8 +178,8 @@ public: /*! constructs from a range. Similar to the constructor of a general * polycurve. Like in the case of general polycurve, for the sake of - * backwards compatibility we have to keep an implementation of construction - * from a range of points. DO NOT USE THIS CONSTRUCTION. + * backwards compatibility we have to keep an implementation of + * construction from a range of points. DO NOT USE THIS CONSTRUCTION. */ template X_monotone_curve_2(InputIterator begin, InputIterator end); @@ -222,15 +223,15 @@ public: /*! obtains a polyline connecting the two given endpoints. * \param p The first point. * \param q The second point. - * \pre `p` and `q` are distinct. * \return A segment connecting `p` and `q`. + * \pre `p` and `q` are distinct. */ Curve_2 operator()(const Point_2& p, const Point_2& q) const; /*! obtains a polyline that comprises of one given segment. * \param seg input segment - * \pre `seg` is not degenerated (not tested) * \return A polyline with one segment, namely `seg`. + * \pre `seg` is not degenerated (not tested) */ Curve_2 operator()(const Segment_2& seg) const; @@ -239,10 +240,10 @@ public: * * \param begin iterator pointing to the first element in the range. * \param end iterator pointing to the past-the-end element in the range. + * \return A polyline using the corresponding construction implementation. * \pre The given range form a continuous and well-oriented polyline * (not tested). * \pre Contains no degenerated segments (not tested) - * \return A polyline using the corresponding construction implementation. */ template Curve_2 operator()(ForwardIterator begin, ForwardIterator end) const; @@ -272,7 +273,7 @@ public: /*! appends a point `p` to an existing polyline `cv` at the back. * \param cv a polyline. Note, `cv` is not (necessarily) - * \f$ x\f$-monotone. + * \f$x\f$-monotone. * \param p a point to be appended to `cv` at the back. * \pre `cv` contains at least one segment. */ @@ -322,7 +323,7 @@ public: /*! appends a point `p` to an existing polyline `cv` at the front. * \param cv a polyline. Note, `cv` is not (necessarily) - * \f$ x\f$-monotone. + * \f$x\f$-monotone. * \param p a point to be appended to `cv` at the back. * \pre `cv` contains at least one segment. */ @@ -382,7 +383,6 @@ public: Push_front_2 push_front_2_object() const; /// @} /* End Accessing Functor Objects */ - }; /* end Arr_polyline_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_rational_function_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_rational_function_traits_2.h index 21f976db116..42ca89c6d4a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_rational_function_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_rational_function_traits_2.h @@ -1,30 +1,28 @@ - namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * * The traits class `Arr_rational_function_traits_2` is a model of the - * `ArrangementTraits_2` concept. It handles bounded and unbounded arcs of + * `AosTraits_2` concept. It handles bounded and unbounded arcs of * rational functions, referred to as rational arcs (in particular, such * an arc may correspond to the entire graph of a rational function). It * supports bounded and unbounded arcs. Thus, it is also a model of the concept - * `ArrangementOpenBoundaryTraits_2`. The traits class enables the construction + * `AosOpenBoundaryTraits_2`. The traits class enables the construction * and maintenance of arrangements of such arcs. * * A rational function \f$y = \frac{P(x)}{Q(x)}\f$ is defined by two polynomials * \f$P\f$ and \f$Q\f$ of arbitrary degrees. If \f$Q(x) = 1\f$ then the * function is a simple polynomial function. Usually the domain is * \f$\mathbb{R}\f$ but the function may also be restricted to a bounded - * interval \f$[x_{\rm min}, x_{\rm max}]\f$ or defined over a ray \f$(-\infty, - * x_{\rm max}]\f$ or over \f$[x_{\rm min}, \infty)\f$. Rational functions are - * represented by the nested type `Curve_2`. Note that a rational function may - * be not continuous since roots of \f$Q\f$ induce vertical asymptotes, which - * would contradict the notion of an \f$x\f$-monotone curve as it is introduced - * by the `ArrangementTraits_2` concept. Thus, continuous portions of rational - * functions are represented by the nested type `X_monotone_curve_2`, which is - * different from `Curve_2`. Constructors for both classes are provided by the - * traits. A `Curve_2` may be split up into several `X_monotone_curve_2` using - * `Make_x_monotone_2`. + * interval \f$[x_{\rm min}, x_{\rm max}]\f$ or defined over a ray + * \f$(-\infty,x_{\rm max}]\f$ or over \f$[x_{\rm min}, \infty)\f$. Rational + * functions are represented by the nested type `Curve_2`. Note that a rational + * function may be not continuous since roots of \f$Q\f$ induce vertical asymptotes, + * which would contradict the notion of an \f$x\f$-monotone curve as it is introduced + * by the `AosTraits_2` concept. Thus, continuous portions of rational functions are + * represented by the nested type `X_monotone_curve_2`, which is different from + * `Curve_2`. Constructors for both classes are provided by the traits. A `Curve_2` + * may be split up into several `X_monotone_curve_2` using `Make_x_monotone_2`. * * The template parameter of the traits must be a model of the concept * `AlgebraicKernel_d_1`. A rational function is then represented by two @@ -44,12 +42,12 @@ namespace CGAL { * cleans up the cache on demand. * * While `Arr_rational_function_traits_2` models the concept - * `ArrangementDirectionalXMonotoneTraits_2`, the implementation of the + * `AosDirectionalXMonotoneTraits_2`, the implementation of the * `Are_mergeable_2` operation does not enforce the input curves to have the * same direction as a precondition. Moreover, `Arr_rational_function_traits_2` * supports the merging of curves of opposite directions. * - * \cgalModels{ArrangementTraits_2,ArrangementDirectionalXMonotoneTraits_2,ArrangementOpenBoundaryTraits_2} + * \cgalModels{AosTraits_2,AosDirectionalXMonotoneTraits_2,AosOpenBoundaryTraits_2} */ template class Arr_rational_function_traits_2 { @@ -57,24 +55,19 @@ public: /// \name Types /// @{ - /*! - */ + /// typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Coefficient Coefficient; - /*! - */ + /// typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Bound Bound; /// @} @@ -83,7 +76,7 @@ public: /// @{ /*! constructs an empty traits that uses the kernel pointed by `kernel` - * for performing algebraic operations. + * for performing algebraic operations. */ Arr_rational_function_traits_2(const Algebraic_kernel_d_1* kernel); @@ -116,34 +109,27 @@ public: * * \cgalModels{Assignable,CopyConstructible,AdaptableBinaryFunction,AdaptableUnaryFunction} */ - class Construct_curve_2 { public: /// \name Types /// @{ - /*! - */ + /// typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1; - /*! - */ + /// typedef Arr_rational_function_traits_2::Curve_2 result_type; - /*! - */ + /// typedef Polynomial_1 argument_type; - /*! - */ + /// typedef Polynomial_1 first_argument_type; - /*! - */ + /// typedef Polynomial_1 second_argument_type; /// @} @@ -156,7 +142,7 @@ public: Curve_2 operator()(Polynomial_1 P) const; /*! constructs a curve representing the polynomial function \f$y = P(x)\f$. - * The function is defined over the interval \f$[x,+\infty)\f$ if \f$ right\f$ + * The function is defined over the interval \f$[x,+\infty)\f$ if \f$right\f$ * is true and \f$(-\infty,x]\f$ otherwise. */ Curve_2 operator()(Polynomial_1 P, const Algebraic_real_1& x, @@ -174,8 +160,8 @@ public: /*! constructs a curve representing the rational function \f$y = P(x)/Q(x)\f$. * The function is defined over the interval - * \f$ I=[x,+\infty)\f$ if \f$ right\f$ is true and - * \f$ I=(-\infty,x]\f$ otherwise. + * \f$I=[x,+\infty)\f$ if \f$right\f$ is true and + * \f$I=(-\infty,x]\f$ otherwise. */ Curve_2 operator()(Polynomial_1 P, Polynomial_1 Q, const Algebraic_real_1& x, bool right) const; @@ -196,8 +182,7 @@ public: /*! constructs a curve representing the polynomial function \f$y = P(x)\f$, * where the coefficients of \f$P\f$ are given in the range `[begin,end)`. * The function is defined over the interval - * \f$[x,+\infty)\f$ if \f$ right\f$ is true and \f$(-\infty,x]\f$ - * otherwise. + * \f$[x,+\infty)\f$ if \f$right\f$ is true and \f$(-\infty,x]\f$ otherwise. */ template Curve_2 operator()(InputIterator begin, InputIterator end, @@ -221,7 +206,7 @@ public: InputIterator begin_denom, InputIterator end_denom) const; /*! constructs a curve representing the rational function \f$y = P(x)/Q(x)\f$, - * where the coefficients of \f$P\f$ and \f$ Q\f$ are given in the ranges + * where the coefficients of \f$P\f$ and \f$Q\f$ are given in the ranges * `[begin_numer,end_numer)` and `[begin_denom,end_denom)`, respectively. * The function is defined over the interval \f$I=[x,+\infty)\f$ * if \f$right\f$ is true and \f$I=(-\infty,x]\f$ otherwise. @@ -243,7 +228,6 @@ public: const Algebraic_real_1& upper) const; /// @} - }; /* end Arr_rational_function_traits_2::Construct_curve_2 */ /*! Functor to construct a `X_monotone_curve_2`. To enable caching the class is @@ -254,32 +238,25 @@ public: */ class Construct_x_monotone_curve_2 { public: - /// \name Types /// @{ - /*! - */ + /// typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1; - /*! - */ + /// typedef Arr_rational_function_traits_2::X_monotone_curve_2 result_type; - /*! - */ + /// typedef Polynomial_1 argument_type; - /*! - */ + /// typedef Polynomial_1 first_argument_type; - /*! - */ + /// typedef Polynomial_1 second_argument_type; /// @} @@ -287,14 +264,14 @@ public: /// \name Operations /// @{ - /*! constructs an \f$ x\f$-monotone curve supported by the polynomial function - * \f$ y = P(x)\f$. + /*! constructs an \f$x\f$-monotone curve supported by the polynomial function + * \f$y = P(x)\f$. */ X_monotone_curve_2 operator()(Polynomial_1 P) const; /*! constructs an \f$x\f$-monotone curve supported by the polynomial function * \f$y = P(x)\f$. The function is defined over the interval - * \f$[x,+\infty)\f$ if \f$ right\f$ is true and \f$(-\infty,x]\f$ + * \f$[x,+\infty)\f$ if \f$right\f$ is true and \f$(-\infty,x]\f$ * otherwise. */ X_monotone_curve_2 operator()(Polynomial_1 P, @@ -311,14 +288,16 @@ public: /*! constructs an \f$x\f$-monotone curve supported by the rational function * \f$y = P(x)/Q(x)\f$. + * * \pre \f$Q\f$ has no real roots. */ X_monotone_curve_2 operator()(Polynomial_1 P, Polynomial_1 Q) const; /*! constructs an \f$x\f$-monotone curve supported by the rational function * \f$y = P(x)/Q(x)\f$. The function is defined over the interval - * \f$I=[x,+\infty)\f$ if \f$ right\f$ is true and \f$I=(-\infty,x]\f$ + * \f$I=[x,+\infty)\f$ if \f$right\f$ is true and \f$I=(-\infty,x]\f$ * otherwise. + * * \pre \f$Q\f$ has no real roots in the interior of \f$I\f$. */ X_monotone_curve_2 operator()(Polynomial_1 P, Polynomial_1 Q, @@ -334,8 +313,8 @@ public: const Algebraic_real_1& lower, const Algebraic_real_1& upper) const; - /*! constructs an \f$ x\f$-monotone curve supported by the polynomial function - * \f$ y = P(x)\f$, where the coefficients of \f$P\f$ are given in the range + /*! constructs an \f$x\f$-monotone curve supported by the polynomial function + * \f$y = P(x)\f$, where the coefficients of \f$P\f$ are given in the range * `[begin,end)`. */ template @@ -376,9 +355,10 @@ public: * \f$y = P(x)/Q(x)\f$, where the coefficients of \f$P\f$ and \f$Q\f$ are * given in the ranges `[begin_numer,end_numer)` and * `[begin_denom,end_denom)`, respectively. The function is defined over the - * interval \f$ I=[x,+\infty)\f$ if \f$ right\f$ is true and - * \f$ I=(-\infty,x]\f$ otherwise. - * \pre \f$ Q\f$ has no real roots in the interior of \f$ I\f$. + * interval \f$I=[x,+\infty)\f$ if \f$right\f$ is true and + * \f$I=(-\infty,x]\f$ otherwise. + * + * \pre \f$Q\f$ has no real roots in the interior of \f$I\f$. */ template X_monotone_curve_2 operator()(InputIterator begin_numer, @@ -388,7 +368,7 @@ public: const Algebraic_real_1& x, bool right) const; /*! constructs an \f$x\f$-monotone curve supported by the rational function - * \f$y = P(x)/Q(x)\f$, where the coefficients of \f$ P\f$ and \f$Q\f$ are + * \f$y = P(x)/Q(x)\f$, where the coefficients of \f$P\f$ and \f$Q\f$ are * given in the ranges `[begin_numer,end_numer)` and * `[begin_denom,end_denom)`, respectively. The function is defined over the * interval \f$I=[lower,upper]\f$. @@ -403,7 +383,6 @@ public: const Algebraic_real_1& upper) const; /// @} - }; /* end Arr_rational_function_traits_2::Construct_x_monotone_curve_2 */ /*! The `Curve_2` class nested within the traits is used to represent rational @@ -413,16 +392,13 @@ public: */ class Curve_2 { public: - /// \name Types /// @{ - /*! - */ + /// typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1; /// @} @@ -432,11 +408,11 @@ public: /*! returns the numerator of the supporting rational function. */ - const Polynomial_1& numerator () const; + const Polynomial_1& numerator() const; /*! returns the denominator of the supporting rational function. */ - const Polynomial_1& denominator () const; + const Polynomial_1& denominator() const; /*! returns whether çurve is continuous, namely whether it does not * contains any vertical asymptotes in its interior. @@ -446,19 +422,21 @@ public: /*! returns whether the \f$x\f$-coordinate of çurve's left end is * finite or whether it is \f$\pm\infty\f$. */ - Arr_parameter_space left_parameter_space_in_x () const; + Arr_parameter_space left_parameter_space_in_x() const; /*! returns whether the \f$x\f$-coordinate of çurve's right end is * finite or whether it is \f$\pm\infty\f$. */ - Arr_parameter_space right_parameter_space_in_x () const; + Arr_parameter_space right_parameter_space_in_x() const; /*! returns the \f$x\f$-coordinate of the left end. + * * \pre `left_boundary_in_x()` == `ARR_INTERIOR` */ Algebraic_real_1 left_x() const; /*! returns the \f$x\f$-coordinate of the right end. + * * \pre `right_boundary_in_x()` == `ARR_INTERIOR` */ Algebraic_real_1 right_x() const; @@ -475,16 +453,13 @@ public: /// \name Types /// @{ - /*! - */ + /// typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Bound Bound; /// @} @@ -494,22 +469,22 @@ public: /*! returns the numerator of the supporting rational function. */ - Polynomial_1 numerator () const; + Polynomial_1 numerator() const; /*! returns the denominator of the supporting rational function. */ - Polynomial_1 denominator () const; + Polynomial_1 denominator() const; /*! returns double-approximations of the x- and y-coordinates. */ std::pair to_double() const; - /*! returns the \f$ x\f$-coordinate of the point. + /*! returns the \f$x\f$-coordinate of the point. */ Algebraic_real_1 x() const; /*! obtains the \f$y\f$-coordinates of the point. Attention: As - * described above, points are not stored by their y-coordinate in + * described above, points are not stored by their \f$y\f$-coordinate in * `Algebraic_real_1` representation. In fact, this representation must be * computed on demand, and might become quite costly for points defined by * high-degree polynomials. Therefore, it is recommended to avoid calls to @@ -519,27 +494,31 @@ public: /*! Computes a pair \f$p\f$ approximating the \f$x\f$-coordinate with * respect to the given absolute precision \f$a\f$. + * * \post \f$p.first \leq x \leq p.second\f$ - * \post \f$p.second - p.first \leq2^{-a}\f$ + * \post \f$p.second - p.first \leq 2^{-a}\f$ */ std::pair approximate_absolute_x(int a) const; /*! Computes a pair \f$p\f$ approximating the \f$y\f$-coordinate with * respect to the given absolute precision \f$a\f$. + * * \post \f$p.first \leq y \leq p.second\f$ - * \post \f$p.second - p.first \leq2^{-a}\f$ + * \post \f$p.second - p.first \leq 2^{-a}\f$ */ std::pair approximate_absolute_y(int a) const; /*! Computes a pair \f$p\f$ approximating the \f$x\f$-coordinate with * respect to the given relative precision \f$r\f$. + * * \post \f$p.first \leq x \leq p.second\f$ * \post \f$p.second - p.first \leq2^{-r}|x|\f$ */ std::pair approximate_relative_x(int r) const; - /*! Computes a pair \f$p\f$ approximating the \f$ y\f$-coordinate with + /*! computes a pair \f$p\f$ approximating the \f$y\f$-coordinate with * respect to the given relative precision \f$r\f$. + * * \post \f$p.first \leq y \leq p.second\f$ * \post \f$p.second - p.first \leq2^{-r}|y|\f$ */ @@ -550,7 +529,7 @@ public: }; /* end Arr_rational_function_traits_2::Point_2 */ /*! The `X_monotone_curve_2` class nested within the traits is used to represent - * \f$ x\f$-monotone parts of rational functions. In particular, such an + * \f$x\f$-monotone parts of rational functions. In particular, such as * \f$x\f$-monotone curve may not contain a vertical asymptote in its interior * \f$x\f$-range. * @@ -558,20 +537,16 @@ public: */ class X_monotone_curve_2 { public: - /// \name Types /// @{ - /*! - */ + /// typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1; - /*! - */ + /// typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1; - /*! - */ + /// typedef Arr_rational_function_traits_2::Point_2 Point_2; /// @} @@ -581,21 +556,21 @@ public: /*! returns the numerator of the supporting rational function. */ - const Polynomial_1& numerator () const; + const Polynomial_1& numerator() const; /*! returns the denominator of the supporting rational function. */ - const Polynomial_1& denominator () const; + const Polynomial_1& denominator() const; /*! returns whether the \f$x\f$-coordinate of the source is finite or * whether it is \f$\pm\infty\f$. */ - Arr_parameter_space source_parameter_space_in_x () const; + Arr_parameter_space source_parameter_space_in_x() const; /*! returns whether the \f$y\f$-coordinate of the source is finite or * whether it is \f$\pm\infty\f$. */ - Arr_parameter_space source_parameter_space_in_y () const; + Arr_parameter_space source_parameter_space_in_y() const; /*! returns the source point of the arc. * \pre Both the \f$x\f$- and \f$y\f$-coordinates of the source point is @@ -604,6 +579,7 @@ public: const Point_2& source() const; /*! returns the \f$x\f$-coordinate of the source point. + * * \pre The \f$x\f$-coordinate of the source point is finite. */ Algebraic_real_1 source_x() const; @@ -611,12 +587,12 @@ public: /*! returns whether the \f$x\f$-coordinate of the target is finite or * whether it is \f$\pm\infty\f$. */ - Arr_parameter_space target_parameter_space_in_x () const; + Arr_parameter_space target_parameter_space_in_x() const; /*! returns whether the \f$y\f$-coordinate of the target is finite or * whether it is \f$\pm\infty\f$. */ - Arr_parameter_space target_parameter_space_in_y () const; + Arr_parameter_space target_parameter_space_in_y() const; /*! returns the target point of the arc. * \pre Both the \f$x\f$- and \f$y\f$-coordinates of the target point is @@ -625,6 +601,7 @@ public: const Point_2& target() const; /*! returns the \f$x\f$-coordinate of the target point. + * * \pre The \f$x\f$-coordinate of the target point is finite. */ Algebraic_real_1 target_x() const; @@ -632,19 +609,21 @@ public: /*! returns whether the \f$x\f$-coordinate of the left curve end is finite or * whether it is \f$\pm\infty\f$. */ - Arr_parameter_space left_parameter_space_in_x () const; + Arr_parameter_space left_parameter_space_in_x() const; /*! returns whether the \f$y\f$-coordinate of the left curve end is finite or * whether it is \f$\pm\infty\f$. */ - Arr_parameter_space left_parameter_space_in_y () const; + Arr_parameter_space left_parameter_space_in_y() const; /*! returns the left point of the arc. + * * \pre Both the \f$x\f$- and \f$y\f$-coordinates of the left point is finite. */ const Point_2& left() const; /*! returns the \f$x\f$-coordinate of the left point. + * * \pre The \f$x\f$-coordinate of the left point is finite. */ Algebraic_real_1 left_x() const; @@ -666,18 +645,18 @@ public: const Point_2& right() const; /*! returns the \f$x\f$-coordinate of the right point. + * * \pre The \f$x\f$-coordinate of the right point is finite. */ Algebraic_real_1 right_x() const; /*! returns whether the curve is oriented from left to right. */ - bool is_left_to_right () const; + bool is_left_to_right() const; /// @} }; /* end Arr_rational_function_traits_2::X_monotone_curve_2 */ - }; /* end Arr_rational_function_traits_2 */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_segment_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_segment_traits_2.h index 37a7a6c29bd..3d2826da6f5 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_segment_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_segment_traits_2.h @@ -3,12 +3,12 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2TraitsClasses * * The traits class `Arr_segment_traits_2` is a model of the - * `ArrangementTraits_2` concept, which allows the construction and maintenance + * `AosTraits_2` concept, which allows the construction and maintenance * of arrangements of line segments. It is parameterized with a * \cgal-kernel model that is templated in turn with a number type. To avoid * numerical errors and robustness problems, the number type should support * exact rational arithmetic; that is, the number type should support the - * arithmetic operations \f$ +\f$, \f$ -\f$, \f$ \times\f$ and \f$ \div\f$ + * arithmetic operations \f$+\f$, \f$-\f$, \f$\times\f$ and \f$\div\f$ * carried out without loss of precision. * * For example, instantiating the traits template with kernels that support @@ -30,7 +30,7 @@ namespace CGAL { * endpoints only, while the traits class needs to store extra data with its * segments, in order to efficiently operate on them. Nevertheless, the nested * `X_monotone_curve_2` and `Curve_2` types (in this case both types refer to - * the same class, as every line segment is (weakly) \f$ x\f$-monotone) + * the same class, as every line segment is (weakly) \f$x\f$-monotone) * can however be converted to the type `Kernel::Segment_2`. * * `Arr_segment_traits_2` achieves faster running times than the @@ -47,81 +47,82 @@ namespace CGAL { * `Arr_non_caching_segment_traits_2` traits-class. * * While `Arr_segment_traits_2` models the concept - * `ArrangementDirectionalXMonotoneTraits_2`, the implementation of the + * `AosDirectionalXMonotoneTraits_2`, the implementation of the * `Are_mergeable_2` operation does not enforce the input curves to have the * same direction as a precondition. Moreover, `Arr_segment_traits_2` supports * the merging of curves of opposite directions. * - * \cgalModels{ArrangementTraits_2,ArrangementLandmarkTraits_2,ArrangementDirectionalXMonotoneTraits_2} + * \cgalModels{AosTraits_2,AosLandmarkTraits_2,AosApproximateTraits_2,AosDirectionalXMonotoneTraits_2} */ template class Arr_segment_traits_2 : public Kernel { public: + /// \name Types + /// @{ - //! \name Types - //! @{ - - //! the segment type. + /// the segment type. typedef typename Kernel::Segment_2 Segment_2; - //! the line type. + /// the line type. typedef typename Kernel::Line_2 Line_2; - //! the point type. + /// the point type. typedef typename Kernel::Point_2 Point_2; - //! @} + /// @} /*! The `X_monotone_curve_2` class nested within the traits class is * used to represent segments. */ class X_monotone_curve_2 { public: - //! \name Creation - //! @{ + /// \name Creation + /// @{ /*! constructs default. */ X_monotone_curve_2(); - //! @} + /// @} - //! \name Access Functions - //! @{ + /// \name Access Functions + /// @{ - //! obtains the (lexicographically) left endpoint. + /// obtains the (lexicographically) left endpoint. const Point_2& left() const; - //! obtains the (lexicographically) right endpoint. + /// obtains the (lexicographically) right endpoint. const Point_2& right() const; - //! obtains the supporting line. + /// obtains the supporting line. const Line_2& line() const; - //! determines whether the curve is vertical. + /// determines whether the curve is vertical. bool is_vertical() const; - //! determines whether the curve is directed lexicographic from left to right + /// determines whether the curve is directed lexicographic from left to right bool is_directed_right() const; - //! @} + /// @} }; - //! The curve type. + /// The curve type. typedef X_monotone_curve_2 Curve_2; - //! A functor that trims curves. + /// A functor that trims curves. class Trim_2 { public: - //! \name Creation - //! @{ + /// \name Creation + /// @{ - /*! trims the given x-monotone curve to an from src to tgt. + /*! trims the given \f$x\f$-monotone curve to an from `src` to `tgt`. + * * \ pre `src` and `tgt` lies on the curve */ X_monotone_curve_2(const X_monotone_curve_2& xcv, const Point_2& src, const Point_2& tgt) const; + //! @} } /* end Arr_segment_traits_2::Trim_2 */ - }; /* end Arr_segment_traits_2 */ + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_spherical_topology_traits_2.h index a1badbde914..76c06bc7df9 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_spherical_topology_traits_2.h @@ -10,18 +10,18 @@ namespace CGAL { * The `Arr_spherical_topology_traits_2` template has two parameters: *
      *
    • The `GeometryTraits_2` template-parameter should be substituted by - * a model of the `ArrangementBasicTraits_2` concept. The traits + * a model of the `AosBasicTraits_2` concept. The traits * class defines the types of \f$x\f$-monotone curves and two-dimensional - * points, namely `ArrangementBasicTraits_2::X_monotone_curve_2` and - * `ArrangementBasicTraits_2::Point_2`, + * points, namely `AosBasicTraits_2::X_monotone_curve_2` and + * `AosBasicTraits_2::Point_2`, * respectively, and supports basic geometric predicates on them. *
    • The `Dcel` template-parameter should be substituted by - * a class that is a model of the `ArrangementDcel` concept. The + * a class that is a model of the `AosDcel` concept. The * value of this parameter is by default * `Arr_default_dcel`. *
    * - * \cgalModels{ArrangementBasicTopologyTraits} + * \cgalModels{AosBasicTopologyTraits} * * \sa `Arr_default_dcel` * \sa `CGAL::Arr_geodesic_arc_on_sphere_traits_2` @@ -62,10 +62,10 @@ public: /// \name Accessors /// @{ - /*! obtains the DCEL (const version). */ + /*! obtains the \dcel (const version). */ const Dcel& dcel() const; - /*! obtains the DCEL (non-const version). */ + /*! obtains the \dcel (non-const version). */ Dcel& dcel(); /*! obtains the spherical face (const version). */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_tags.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_tags.h index 407544cbc0d..db8a50a9a68 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_tags.h @@ -17,14 +17,10 @@ namespace CGAL { * \sa `Arr_closed_side_tag` * \sa `Arr_contracted_side_tag` * \sa `Arr_identified_side_tag` - * \sa `ArrangementBasicTraits_2` + * \sa `AosBasicTraits_2` */ struct Arr_oblivious_side_tag {}; -} - -namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2Tags * * This type tag is used to indicate that a side of the parameter space, either @@ -35,7 +31,7 @@ namespace CGAL { * `Bottom_side_category`, and `Top_side_category`, nested in every geometry * traits class, must be convertible to the type `Arr_open_side_tag`. For * example, all categories above, nested in every model of the - * `ArrangementOpenBoundaryTraits_2` concept, must be convertible to + * `AosOpenBoundaryTraits_2` concept, must be convertible to * `Arr_open_side_tag`, as curves are expected to approach all the four boundary * sides of the parameter space (i.e., left, right, bottom, and top). * @@ -46,14 +42,10 @@ namespace CGAL { * \sa `Arr_closed_side_tag` * \sa `Arr_contracted_side_tag` * \sa `Arr_identified_side_tag` - * \sa `ArrangementOpenBoundaryTraits_2` + * \sa `AosOpenBoundaryTraits_2` */ struct Arr_open_side_tag : {}; -} - -namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2Tags * * This type tag is used to indicate that a side of the parameter space, either @@ -73,14 +65,10 @@ namespace CGAL { * \sa `Arr_open_side_tag` * \sa `Arr_contracted_side_tag` * \sa `Arr_identified_side_tag` - * \sa `ArrangementOpenBoundaryTraits_2` + * \sa `AosOpenBoundaryTraits_2` */ struct Arr_closed_side_tag {}; -} - -namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2Tags * * This type tag is used to indicate that a side of the parameter space, either @@ -92,7 +80,7 @@ namespace CGAL { * nested in every geometry traits class, must be convertible to the type * `Arr_contracted_side_tag`. For example, the `Bottom_side_category` and * `Top_side_category` category types, nested in every model of the - * `ArrangementSphericalBoundaryTraits_2 concept` (such as any instance of the + * `AosSphericalBoundaryTraits_2 concept` (such as any instance of the * `Arr_geodesic_arc_on_sphere_traits_2` class template) must be convertible to * `Arr_contracted_side_tag` * @@ -103,14 +91,10 @@ namespace CGAL { * \sa `Arr_open_side_tag` * \sa `Arr_closed_side_tag` * \sa `Arr_identified_side_tag` - * \sa `ArrangementOpenBoundaryTraits_2` + * \sa `AosOpenBoundaryTraits_2` */ struct Arr_contracted_side_tag {}; -} - -namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2Tags * * This type tag is used to indicate that a side of the parameter space, either @@ -122,7 +106,7 @@ namespace CGAL { * nested in every geometry traits class, must be convertible to the type * `Arr_identified_side_tag`. For example, the `Left_side_category` and * `Right_side_category` category types, nested in every model of the - * `ArrangementSphericalBoundaryTraits_2 concept` (such as any instance of the + * `AosSphericalBoundaryTraits_2 concept` (such as any instance of the * `Arr_geodesic_arc_on_sphere_traits_2` class template) must be convertible to * `Arr_identified_side_tag` * @@ -133,7 +117,7 @@ namespace CGAL { * \sa `Arr_open_side_tag` * \sa `Arr_closed_side_tag` * \sa `Arr_contracted_side_tag` - * \sa `ArrangementOpenBoundaryTraits_2` + * \sa `AosOpenBoundaryTraits_2` */ struct Arr_identified_side_tag {}; diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h index d51ad4cbced..a3aa5e30fed 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_trapezoid_ric_point_location.h @@ -1,66 +1,69 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2PointLocation - -\anchor arr_reftrap_pl - -The `Arr_trapezoid_ric_point_location` class implements the incremental randomized algorithm -introduced by Mulmuley \cgalCite{m-fppa-90} as presented by -Seidel \cgalCite{s-sfira-91} (see also [\cgalCite{bkos-cgaa-00} Chapter 6). -It subdivides each arrangement face to pseudo-trapezoidal cells, each -of constant complexity, and constructs and maintains a linear-size search -structure on top of these cells, such that each query can be answered -in \cgalBigO{\log n} time, where \f$ n\f$ is the complexity of the arrangement. - -Constructing the search structures takes \cgalBigO{n \log n} expected time -and may require a small number of rebuilds \cgalCite{hkh-iiplgtds-12}. Therefore -attaching a trapezoidal point-location object to an existing arrangement -may incur some overhead in running times. In addition, the point-location -object needs to keep its auxiliary data structures up-to-date as the -arrangement goes through structural changes. It is therefore recommended -to use this point-location strategy for static arrangements (or arrangement -that do not alter frequently), and when the number of issued queries -is relatively large. - -This strategy supports arbitrary subdivisions, including unbounded ones. - -\cgalModels{ArrangementPointLocation_2,ArrangementVerticalRayShoot_2} - -\sa `ArrangementPointLocation_2` -\sa `ArrangementVerticalRayShoot_2` -\sa `CGAL::Arr_point_location_result` - +/*! \ingroup PkgArrangementOnSurface2PointLocation + * + * \anchor arr_reftrap_pl + * + * The `Arr_trapezoid_ric_point_location` class implements the incremental + * randomized algorithm introduced by Mulmuley \cgalCite{m-fppa-90} as presented + * by Seidel \cgalCite{s-sfira-91} (see also [\cgalCite{bkos-cgaa-00} Chapter + * 6). It subdivides each arrangement face to pseudo-trapezoidal cells, each of + * constant complexity, and constructs and maintains a linear-size search + * structure on top of these cells, such that each query can be answered in + * \cgalBigO{\log n} time, where \f$n\f$ is the complexity of the arrangement. + * + * Constructing the search structures takes \cgalBigO{n \log n} expected time + * and may require a small number of rebuilds + * \cgalCite{hkh-iiplgtds-12}. Therefore attaching a trapezoidal point-location + * object to an existing arrangement may incur some overhead in running + * times. In addition, the point-location object needs to keep its auxiliary + * data structures up-to-date as the arrangement goes through structural + * changes. It is therefore recommended to use this point-location strategy for + * static arrangements (or arrangement that do not alter frequently), and when + * the number of issued queries is relatively large. + * + * This strategy supports arbitrary subdivisions, including unbounded ones. + * + * \cgalModels{AosPointLocation_2,AosVerticalRayShoot_2} + * + * \sa `AosPointLocation_2` + * \sa `AosVerticalRayShoot_2` + * \sa `CGAL::Arr_point_location_result` */ -template< typename Arrangement > +template class Arr_trapezoid_ric_point_location { public: + /// \name Creation + /// @{ -/// \name Creation -/// @{ + /*! If `with_guarantees` is set to true, the construction performs rebuilds in + * order to guarantee a resulting structure with linear size and logarithmic + * query time. Otherwise the structure has expected linear size and expected + * logarithmic query time. + */ + Arr_trapezoid_ric_point_location(bool with_guarantees = true); -/*! -If with_guarantees is set to true, the construction performs rebuilds in order to guarantee a resulting structure with linear size and logarithmic query time. Otherwise the structure has expected linear size and expected logarithmic query time. -*/ -Arr_trapezoid_ric_point_location (bool with_guarantees = true); + /*! constructs a point location search structure for the given arrangement. + * If with_guarantees is set to true, the construction performs rebuilds in + * order to guarantee a resulting structure with linear size and logarithmic + * query time. Otherwise the structure has expected linear size and expected + * logarithmic query time. + */ + Arr_trapezoid_ric_point_location(const Arrangement& arr, + bool with_guarantees = true); -/*! -Constructs a point location search structure for the given arrangement. If with_guarantees is set to true, the construction performs rebuilds in order to guarantee a resulting structure with linear size and logarithmic query time. Otherwise the structure has expected linear size and expected logarithmic query time. -*/ -Arr_trapezoid_ric_point_location (const Arrangement& arr, bool with_guarantees = true); + /// @} -/// @} + /// \name Modifiers + /// @{ -/// \name Modifiers -/// @{ - -/*! -If with_guarantees is set to true, the structure will guarantee linear size and logarithmic query time, that is, this function may cause a reconstruction of the data structure. -*/ -void with_guarantees (bool with_guarantees); - -/// @} + /*! If with_guarantees is set to true, the structure will guarantee linear + * size and logarithmic query time, that is, this function may cause a + * reconstruction of the data structure. + */ + void with_guarantees(bool with_guarantees); + /// @} }; /* end Arr_trapezoid_ric_point_location */ + } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h index f0799d553be..4e86b2606f6 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_triangulation_point_location.h @@ -14,13 +14,12 @@ namespace CGAL { * (especially when the number of modifications applied to the arrangement is * high) and provided only for educational purposes. * - * \cgalModels{ArrangementPointLocation_2,ArrangementVerticalRayShoot_2} + * \cgalModels{AosPointLocation_2,AosVerticalRayShoot_2} * - * \sa `ArrangementPointLocation_2` - * \sa `ArrangementVerticalRayShoot_2` + * \sa `AosPointLocation_2` + * \sa `AosVerticalRayShoot_2` * \sa `CGAL::Arr_point_location_result` */ - template class Arr_triangulation_point_location : public Arrangement_::Observer {} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_unb_planar_topology_traits_2.h index 46eb2fbfc96..48aa9d7ce6d 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_unb_planar_topology_traits_2.h @@ -10,24 +10,24 @@ namespace CGAL { * The `Arr_unb_planar_topology_traits_2` template has two parameters: *
      *
    • The `GeometryTraits_2` template-parameter should be substituted by - * a model of the `ArrangementBasicTraits_2` concept. The traits + * a model of the `AosBasicTraits_2` concept. The traits * class defines the types of \f$x\f$-monotone curves and two-dimensional - * points, namely `ArrangementBasicTraits_2::X_monotone_curve_2` and - * `ArrangementBasicTraits_2::Point_2`, + * points, namely `AosBasicTraits_2::X_monotone_curve_2` and + * `AosBasicTraits_2::Point_2`, * respectively, and supports basic geometric predicates on them. *
    • The `Dcel` template-parameter should be substituted by - * a class that is a model of the `ArrangementDcel` concept. The + * a class that is a model of the `AosDcel` concept. The * value of this parameter is by default * `Arr_default_dcel`. *
    * - * \cgalModels{ArrangementBasicTopologyTraits} + * \cgalModels{AosBasicTopologyTraits} * * \sa `Arr_default_dcel` * \sa `CGAL::Arr_geodesic_arc_on_sphere_traits_2` */ template > + typename Dcel = Arr_default_dcel> class Arr_unb_planar_topology_traits_2 { public: /// \name Types @@ -62,10 +62,10 @@ public: /// \name Accessors /// @{ - /*! obtains the DCEL (const version). */ + /*! obtains the \dcel (const version). */ const Dcel& dcel() const; - /*! obtains the DCEL (non-const version). */ + /*! obtains the \dcel (non-const version). */ Dcel& dcel(); /*! obtains the unbounded face (const version). */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertex_index_map.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertex_index_map.h index e5bb1449dbf..f081630e811 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertex_index_map.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_vertex_index_map.h @@ -1,69 +1,64 @@ namespace CGAL { - /*! \ingroup PkgArrangementOnSurface2Ref - * - * `Arr_vertex_index_map` maintains a mapping of vertex handles of an attached - * arrangement object to indices (of type `unsigned int`). This class template - * is a model of the concept `ReadablePropertyMap`. A mapping between vertex - * handles and indices enables convenient usage of property-map classes supplied - * by `boost`. For example, the property-map class templates - * `boost::vector_property_map`, which is based on `std::vector`, and - * `boost::iterator_property_map`, which can be used to implement a property map - * based on a native \CC array, require the user to supply a mapping such as - * `Arr_vertex_index_map`. - * - * As new vertices might be inserted into the attached arrangement, and - * existing vertices might be removed, the notification mechanism is used - * to dynamically maintain the mapping of vertex handles to indices. - * - * \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap} - * - * \sa `Arr_face_index_map` +/*! \ingroup PkgArrangementOnSurface2Ref + * + * `Arr_vertex_index_map` maintains a mapping of vertex handles of an attached + * arrangement object to indices (of type `unsigned int`). This class template + * is a model of the concept `ReadablePropertyMap`. A mapping between vertex + * handles and indices enables convenient usage of property-map classes supplied + * by `boost`. For example, the property-map class templates + * `boost::vector_property_map`, which is based on `std::vector`, and + * `boost::iterator_property_map`, which can be used to implement a property map + * based on a native \CC array, require the user to supply a mapping such as + * `Arr_vertex_index_map`. + * + * As new vertices might be inserted into the attached arrangement, and + * existing vertices might be removed, the notification mechanism is used + * to dynamically maintain the mapping of vertex handles to indices. + * + * \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap} + * + * \sa `Arr_face_index_map` + */ +template +class Arr_vertex_index_map: public Arrangement_::Observer { +public: + /// \name Types + /// @{ + + /// the type of the attached arrangement. + typedef Arrangement_ Arrangement_2; + + typedef typename Arrangement_2::Base_aos Base_aos; + + typedef boost::readable_property_map_tag category; + + typedef unsigned int value_type; + + typedef unsigned int reference; + + typedef Vertex_handle key_type; + + /// The vertex handle type. + typedef typename Base_aos::Vertex_handle Vertex_handle; + + /// The type of mapping of vertices to indices. + typedef Unique_hash_map Index_map; + + /// @} + + /// \name Creation + /// @{ + + /*! constructs a map that is unattached to any arrangement instance. */ + Arr_vertex_index_map(); - template< typename Arrangement_> - class Arr_vertex_index_map: public Arrangement_::Observer { - public: + /*! constructs a map and attaches it to the given arrangement `arr`. + */ + Arr_vertex_index_map(Base_aos& arr); - /// \name Types - /// @{ - - /*! the type of the attached arrangement. - */ - typedef Arrangement_ Arrangement_2; - typedef typename Arrangement_2::Base_aos Base_aos; - - typedef boost::readable_property_map_tag category; - - typedef unsigned int value_type; - - typedef unsigned int reference; - - typedef Vertex_handle key_type; - - /*! The vertex handle type. - */ - typedef typename Base_aos::Vertex_handle Vertex_handle; - - /*! The type of mapping of vertices to indices. - */ - typedef Unique_hash_map Index_map; - - /// @} - - /// \name Creation - /// @{ - - /*! constructs a map that is unattached to any arrangement instance. - */ - Arr_vertex_index_map(); - - /*! constructs a map and attaches it to the given arrangement `arr`. - */ - Arr_vertex_index_map(Base_aos& arr); - - /// @} - - }; /* end Arr_accessor */ + /// @} +}; /* end Arr_accessor */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h index 60ec6272ffd..802694a772d 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_walk_along_line_point_location.h @@ -1,38 +1,31 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2PointLocation +/*! \ingroup PkgArrangementOnSurface2PointLocation + * + * \anchor arr_refwalk_pl + * + * The `Arr_walk_along_line_point_location` class implements a very simple + * point-location (and vertical ray-shooting) strategy that improves the naive + * one. The algorithm considers an imaginary vertical ray emanating from the + * query point, and simulates a walk along the zone of this ray, starting from + * the unbounded face until reaching the query point. In dense arrangements + * this walk can considerably reduce the number of traversed arrangement edges, + * with respect to the naïve algorithm. + * + * The walk-along-a-line point-location object (just like the naïve one) + * does not use any auxiliary data structures. Thus, attaching it to an existing + * arrangement takes constant time, and any ongoing updates to this arrangement + * do not affect the point-location object. It is therefore recommended to use + * the "walk" point-location strategy for arrangements that are constantly + * changing, especially if the number of issued queries is not large. + * + * \cgalModels{AosPointLocation_2,AosVerticalRayShoot_2} + * + * \sa `AosPointLocation_2` + * \sa `AosVerticalRayShoot_2` + * \sa `CGAL::Arr_point_location_result` + */ +template +class Arr_walk_along_line_point_location {}; -\anchor arr_refwalk_pl - -The `Arr_walk_along_line_point_location` class implements a very simple point-location (and -vertical ray-shooting) strategy that improves the naive one. -The algorithm considers an imaginary vertical ray emanating from the -query point, and simulates a walk along the zone of this ray, starting -from the unbounded face until reaching the query point. -In dense arrangements this walk can considerably reduce the number -of traversed arrangement edges, with respect to the naïve -algorithm. - -The walk-along-a-line point-location object (just like the naïve one) -does not use any auxiliary data structures. Thus, attaching it to an -existing arrangement takes constant time, and any ongoing updates to -this arrangement do not affect the point-location object. -It is therefore recommended to use the "walk" point-location strategy -for arrangements that are constantly changing, especially if the number -of issued queries is not large. - -\cgalModels{ArrangementPointLocation_2,ArrangementVerticalRayShoot_2} - -\sa `ArrangementPointLocation_2` -\sa `ArrangementVerticalRayShoot_2` -\sa `CGAL::Arr_point_location_result` - -*/ -template< typename Arrangement > -class Arr_walk_along_line_point_location { -public: - -}; /* end Arr_walk_along_line_point_location */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_2.h index 465f1f3a9b2..70b3f35aafa 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_2.h @@ -5,7 +5,7 @@ namespace CGAL { * \anchor arr_refarr * * An object `arr` of the class `Arrangement_2` represents the planar - * subdivision induced by a set of \f$ x\f$-monotone curves and isolated points + * subdivision induced by a set of \f$x\f$-monotone curves and isolated points * into maximally connected cells. The arrangement is represented as a * doubly-connected edge-list (\dcel) such that each \dcel vertex is associated * with a point of the plane and each edge is associated with an \f$ @@ -16,13 +16,13 @@ namespace CGAL { * The `Arrangement_2` template has two parameters: *
      *
    • The `Traits` template-parameter should be instantiated with - * a model of the `ArrangementBasicTraits_2` concept. The traits - * class defines the types of \f$ x\f$-monotone curves and two-dimensional - * points, namely `ArrangementBasicTraits_2::X_monotone_curve_2` and - * `ArrangementBasicTraits_2::Point_2`, + * a model of the `AosBasicTraits_2` concept. The traits + * class defines the types of \f$x\f$-monotone curves and two-dimensional + * points, namely `AosBasicTraits_2::X_monotone_curve_2` and + * `AosBasicTraits_2::Point_2`, * respectively, and supports basic geometric predicates on them. *
    • The `Dcel` template-parameter should be instantiated with - * a class that is a model of the `ArrangementDcel` concept. The + * a class that is a model of the `AosDcel` concept. The * value of this parameter is by default * `Arr_default_dcel`. *
    @@ -30,9 +30,9 @@ namespace CGAL { * The available traits classes and \dcel classes are * described below. * - * \sa `ArrangementDcel` + * \sa `AosDcel` * \sa `Arr_default_dcel` - * \sa `ArrangementBasicTraits_2` + * \sa `AosBasicTraits_2` * \sa `CGAL::overlay()` * \sa `CGAL::is_valid()` * @@ -156,41 +156,42 @@ public: /// @} }; /* end Arrangement_2 */ + } /* end namespace CGAL */ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2Insert - * The function `%insert` inserts one or more curves or \f$ x\f$-monotone curves + * The function `%insert` inserts one or more curves or \f$x\f$-monotone curves * into a given arrangement, where no restrictions are imposed on the inserted - * curves. If an inserted curve is not \f$ x\f$-monotone curve, it is subdivided - * into \f$ x\f$-monotone subcurves (and perhaps isolated points), which are + * curves. If an inserted curve is not \f$x\f$-monotone curve, it is subdivided + * into \f$x\f$-monotone subcurves (and perhaps isolated points), which are * inserted into the arrangement. * * \cgalHeading{Requirements} * *
      - *
    • If the curve is \f$ x\f$-monotone curve then The instantiated - * `Traits` class must model the `ArrangementXMonotoneTraits_2` - * concept. In case that the curve is not \f$ x\f$-monotone then the + *
    • If the curve is \f$x\f$-monotone curve then The instantiated + * `Traits` class must model the `AosXMonotoneTraits_2` + * concept. In case that the curve is not \f$x\f$-monotone then the * instantiated `Traits` class must model the - * `ArrangementTraits_2` concept. That is, it should define the - * `Curve_2` type, and support its subdivision into \f$ x\f$-monotone + * `ArrtTraits_2` concept. That is, it should define the + * `Curve_2` type, and support its subdivision into \f$x\f$-monotone * subcurves (and perhaps isolated points). *
    • The point-location object `pl`, must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
    */ /// @{ /*! Inserts the given curve `c` into the arrangement `arr`. - * `c` is subdivided into \f$ x\f$-monotone subcurves (and perhaps isolated + * `c` is subdivided into \f$x\f$-monotone subcurves (and perhaps isolated * points). Each subcurve is in turn inserted into the arrangement by locating * its left endpoint and computing its zone until reaching the right endpoint. * * The given point-location object `pl` is used to locate the left - * endpoints of the \f$ x\f$-monotone curves. By default, the function uses the + * endpoints of the \f$x\f$-monotone curves. By default, the function uses the * "walk along line" point-location strategy - namely an instance of * the class `Arr_walk_along_line_point_location >`. * @@ -200,7 +201,7 @@ template & arr, const Curve& c, const PointLocation& pl = walk_pl); -/*! Inserts the\f$ x\f$-monotone (only) curve `xc` into the arrangement +/*! Inserts the\f$x\f$-monotone (only) curve `xc` into the arrangement * `arr`. The object `obj`, which wraps a `Vertex_const_handle`, a * `Halfedge_const_handle`, or a `Face_const_handle`, represents the location of * `xc`'s left endpoint in the arrangement. The zone of `xc` is computed @@ -213,7 +214,7 @@ void insert(Arrangement_2& arr, const typename Traits::X_monotone_curve_2& xc, typename Arr_point_location_result >::type obj); -/*! Aggregately inserts the curves or \f$ x\f$-monotone curves in the range +/*! Aggregately inserts the curves or \f$x\f$-monotone curves in the range * `[first,last)` into the arrangement `arr` using the sweep-line framework. * \param arr the target arrangement. * \param first the iterator to the first element in the range of curves. @@ -227,7 +228,7 @@ void insert(Arrangement_2& arr, /*! \ingroup PkgArrangementOnSurface2Funcs * - * Inserts a given \f$ x\f$-monotone curve into a given arrangement, where the + * Inserts a given \f$x\f$-monotone curve into a given arrangement, where the * interior of the given curve is disjoint from all existing arrangement * vertices and edges. Under this assumption, it is possible to locate the * endpoints of the given curve in the arrangement, and use one of the @@ -247,9 +248,9 @@ void insert(Arrangement_2& arr, * *
      *
    • The instantiated `Traits` class must model the restricted - * `ArrangementBasicTraits_2` concept, as no intersections are computed. + * `AosBasicTraits_2` concept, as no intersections are computed. *
    • The point-location object `pl` must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
    */ template @@ -260,7 +261,7 @@ insert_non_intersecting_curve(Arrangement_2& arr, /*! \ingroup PkgArrangementOnSurface2Funcs * - * Inserts a set of \f$ x\f$-monotone curves in a given range into a given + * Inserts a set of \f$x\f$-monotone curves in a given range into a given * arrangement. The insertion is performed in an aggregated manner, using the * sweep-line algorithm. The input curves should be pairwise disjoint in their * interior and pairwise interior-disjoint from all existing arrangement @@ -270,7 +271,7 @@ insert_non_intersecting_curve(Arrangement_2& arr, * *
      *
    • The instantiated `Traits` class must model the - * `ArrangementBasicTraits_2` concept, as no intersections are computed. + * `AosBasicTraits_2` concept, as no intersections are computed. *
    • `InputIterator::value_type` must be `Traits::X_monotone_curve_2` *
    */ @@ -296,14 +297,14 @@ void insert_non_intersecting_curves(Arrangement_2& arr, * *
      *
    • The instantiated `Traits` class must model the - * `ArrangementXMonotoneTraits_2` concept. Not all expressions listed + * `AosXMonotoneTraits_2` concept. Not all expressions listed * by this concept are required. In fact the traits class must model the - * `ArrangementBasicTraits_2` concept, and support the splitting functionality. + * `AosBasicTraits_2` concept, and support the splitting functionality. *
    • The point-location object `pl`, must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
    */ -template +template typename Arrangement_2::Vertex_handle insert_point(Arrangement_2& arr, const typename Traits::Point_2& p, @@ -315,7 +316,7 @@ insert_point(Arrangement_2& arr, * * Invokes the member function `arr.is_valid()` to verify the topological * correctness of the arrangement. Then it performs additional validity - * tests. It checks that all \f$ x\f$-monotone curves associated with + * tests. It checks that all \f$x\f$-monotone curves associated with * arrangement edges are pairwise disjoint in their interior. Then it makes sure * that all holes and all isolated vertices are located within the proper * arrangement faces. Note that the test carried out by this function may take a @@ -327,7 +328,7 @@ insert_point(Arrangement_2& arr, * The instantiated traits class must model the concept * `ArranagmentXMonotoneTraits_2`. */ -template +template bool is_valid(const Arrangement_2& arr); /*! \ingroup PkgArrangementOnSurface2Funcs @@ -337,8 +338,8 @@ bool is_valid(const Arrangement_2& arr); * its endpoints become isolated, they are removed as well. The call * `remove_edge(arr, e)` is equivalent to the call `arr.remove_edge (e, true, * true)`. However, this free function requires that `Traits` be a model of the - * refined concept `ArrangementXMonotoneTraits_2`, which requires merge - * operations on \f$ x\f$-monotone curves. If one of the end-vertices of the + * refined concept `AosXMonotoneTraits_2`, which requires merge + * operations on \f$x\f$-monotone curves. If one of the end-vertices of the * given edge becomes redundant after the edge is removed (see `remove_vertex()` * for the definition of a redundant vertex), it is removed, and its incident * edges are merged. If the edge-removal operation causes two faces to merge, @@ -349,7 +350,7 @@ bool is_valid(const Arrangement_2& arr); * *
      *
    • The instantiated traits class must model the concept - * `ArrangementXMonotoneTraits_2`. + * `AosXMonotoneTraits_2`. *
    */ template @@ -362,17 +363,17 @@ remove_edge(Arrangement_2& arr, * Attempts to removed a given vertex from a given arrangement. The vertex can * be removed if it is either an isolated vertex, (and has no incident edge,) or * if it is a redundant vertex. That is, it has exactly two incident - * edges, whose associated curves can be merged to form a single \f$ - * x\f$-monotone curve. The function returns a boolean value that indicates + * edges, whose associated curves can be merged to form a single \f$x\f$-monotone + * curve. The function returns a boolean value that indicates * whether it succeeded removing the vertex from the arrangement. * * \cgalHeading{Requirements} * *
      *
    • The instantiated `Traits` class must model the - * `ArrangementXMonotoneTraits_2` concept. Not all expressions listed + * `AosXMonotoneTraits_2` concept. Not all expressions listed * by this concept are required. In fact the traits class must model the - * `ArrangementBasicTraits_2` concept and support the merging functionality. + * `AosBasicTraits_2` concept and support the merging functionality. *
    */ template diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h index d4c30698e16..2b73d95d7bc 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h @@ -5,11 +5,11 @@ namespace CGAL { * \anchor arr_refaos * * An object `aos` of the class `Arrangement_on_surface_2` represents the - * subdivision induced by a set of \f$ x\f$-monotone curves and isolated points + * subdivision induced by a set of \f$x\f$-monotone curves and isolated points * into maximally connected cells. The arrangement is represented as a * doubly-connected edge-list (Dcel) such that each * Dcel vertex is associated with a point of the - * plane and each edge is associated with an \f$ x\f$-monotone curve whose + * plane and each edge is associated with an \f$x\f$-monotone curve whose * interior is disjoint from all other edges and vertices. Recall that an * arrangement edge is always comprised of a pair of twin Dcel halfedges. @@ -18,21 +18,21 @@ namespace CGAL { *
      *
    • The `GeometryTraits` template-parameter should be substituted by * a model of a geometry traits. The minimal requirements are defined by the - * `ArrangementBasicTraits_2` concept. A model of this concept defines - * the types of \f$ x\f$-monotone curves and two-dimensional points, namely - * `ArrangementBasicTraits_2::X_monotone_curve_2` and - * `ArrangementBasicTraits_2::Point_2`, respectively, and supports basic + * `AosBasicTraits_2` concept. A model of this concept defines + * the types of \f$x\f$-monotone curves and two-dimensional points, namely + * `AosBasicTraits_2::X_monotone_curve_2` and + * `AosBasicTraits_2::Point_2`, respectively, and supports basic * geometric predicates on them. *
    • The `TopologyTraits` template-parameter should be substituted by a - * class that is a model of the `ArrangementTopologyTraits` concept. + * class that is a model of the `AosTopologyTraits` concept. *
    * * The available traits classes and Dcel classes are * described below. - * \sa `ArrangementDcel` + * \sa `AosDcel` * \sa `Arr_default_dcel` - * \sa `ArrangementBasicTraits_2` + * \sa `AosBasicTraits_2` * \sa `CGAL::overlay()` * Insertion Functions @@ -62,10 +62,10 @@ public: /// \name Types /// @{ - /*! the geometry traits class in use. */ + /// the geometry traits class in use. typedef GeometryTraits Geometry_traits_2; - /*! the topology traits class in use. */ + /// the topology traits class in use. typedef TopologyTraits Topology_traits; /*! a private type used as an abbreviation of the @@ -78,18 +78,18 @@ public: */ typedef typename Topology_traits::Dcel Dcel; - /*! the point type, as defined by the traits class. */ + /// the point type, as defined by the traits class. typedef typename Geometry_traits_2::Point_2 Point_2; - /*! the \f$ x\f$-monotone curve type, as defined by the traits class. */ + /// the \f$x\f$-monotone curve type, as defined by the traits class. typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; - /*! the size type (equivalent to `size_t`). */ + /// the size type (equivalent to `std::size_t`). typedef typename Dcel::Size Size; /*! \ingroup PkgArrangementOnSurface2DCEL - * An object \f$ v\f$ of the class `Vertex` represents an arrangement vertex, - * that is a \f$ 0\f$-dimensional cell, associated with a point on the + * An object \f$v\f$ of the class `Vertex` represents an arrangement vertex, + * that is a \f$0\f$-dimensional cell, associated with a point on the * ambient surface. */ class Vertex : public typename Dcel::Vertex { @@ -137,14 +137,14 @@ public: */ const typename Traits::Point_2& point() const; - /*! obtains the placement of the \f$ x\f$-coordinate in the parameter space, + /*! obtains the placement of the \f$x\f$-coordinate in the parameter space, * that is, either the left boundary-side, the interior, or the right * boundary-side. If the vertex lies on an identified vertical side, the * return value is non-deterministic. */ Arr_parameter_space parameter_space_in_x() const; - /*! obtains the placement of the \f$ y\f$-coordinate in the parameter space, + /*! obtains the placement of the \f$y\f$-coordinate in the parameter space, * that is, either the bottom boundary-side, the interior, or the top * boundary-side. If the vertex lies on an identified horizontal side, the * return value is non-deterministic. @@ -152,17 +152,16 @@ public: Arr_parameter_space parameter_space_in_y() const; /// @} - }; /* end Vertex */ /*! \ingroup PkgArrangementOnSurface2DCEL - * An object \f$ e\f$ of the class `Halfedge` represents a halfedge in the + * An object \f$e\f$ of the class `Halfedge` represents a halfedge in the * arrangement. A halfedge is directed from its source vertex * to its target vertex, and has an incident face lying to * its left. Each halfedge has a twin halfedge directed in the * opposite direction, where the pair of twin halfedges form together - * an arrangement edge, that is, a \f$ 1\f$-dimensional cell, associated - * with planar \f$ x\f$-monotone curve. + * an arrangement edge, that is, a \f$1\f$-dimensional cell, associated + * with planar \f$x\f$-monotone curve. * * Halfedges are stored in doubly-connected lists and form chains. These * chains define the inner and outer boundaries of connected components. @@ -221,7 +220,7 @@ public: */ Ccb_halfedge_circulator ccb(); - /*! obtains the \f$ x\f$-monotone curve associated with `e`. + /*! obtains the \f$x\f$-monotone curve associated with `e`. * \pre `e` is not a fictitious halfedge. */ const typename Traits::X_monotone_curve_2& curve() const; @@ -372,7 +371,7 @@ public: /// Mutable /// @{ - /*! a handle to an arrangement vertex. */ + /// a handle to an arrangement vertex. typedef unspecified_type Vertex_handle; /*! a handle to a halfedge. @@ -380,7 +379,7 @@ public: */ typedef unspecified_type Halfedge_handle; - /*! a handle to an arrangement face. */ + /// a handle to an arrangement face. typedef unspecified_type Face_handle; /*! a bidirectional iterator over the @@ -458,7 +457,7 @@ public: */ typedef unspecified_type Halfedge_const_handle; - /*! a handle to an arrangement face. */ + /// a handle to an arrangement face. typedef unspecified_type Face_const_handle; /*! a bidirectional iterator over the @@ -791,7 +790,7 @@ public: * \pre `c` must not be an unbounded curve. * \pre `v1` and `v2` are associated with `c`'s endpoints. * \pre If `v1` and `v2` are already connected by an edge, this edge - * represents an \f$ x\f$-monotone curve that is interior-disjoint from `c`). + * represents an \f$x\f$-monotone curve that is interior-disjoint from `c`). */ Halfedge_handle insert_at_vertices(const X_monotone_curve_2& c, Vertex_handle v1, @@ -878,12 +877,17 @@ public: * fictitious halfedge that should contain the vertex at infinity that * corresponds to the unbounded left end of `c`. The function returns a * handle for one of the new halfedges directed (lexicographically) from right - * to left. \pre The interior of `c` is disjoint from all existing - * arrangement vertices and edges. `c` must have a bounded right endpoint and - * an unbounded left end. \pre `pred->target()` is associated with the right - * endpoint of `c`, and `c` should be inserted after `pred` in a clockwise - * order around this vertex. \pre `fict_pred` is a fictitious halfedge that - * contains the unbounded left end of `c`. + * to left. + * + * \pre The interior of `c` is disjoint from all existing arrangement vertices + * and edges. `c` must have a bounded right endpoint and an unbounded left + * end. + * + * \pre `pred->target()` is associated with the right endpoint of `c`, and `c` + * should be inserted after `pred` in a clockwise order around this vertex. + * + * \pre `fict_pred` is a fictitious halfedge that contains the unbounded left + * end of `c`. */ Halfedge_handle insert_from_right_vertex(const X_monotone_curve_2& c, Halfedge_handle pred, @@ -899,7 +903,7 @@ public: * vertices and edges. * \pre `pred1->target()` and `v2` are associated with `c`'s endpoints. * \pre If `pred1->target` and `v2` are already connected by an edge, this - * edge represents an \f$ x\f$-monotone curve that is interior-disjoint from + * edge represents an \f$x\f$-monotone curve that is interior-disjoint from * `c`). */ Halfedge_handle insert_at_vertices(const X_monotone_curve_2& c, @@ -918,7 +922,7 @@ public: * \pre `pred1->target()` and `pred2->target()` are associated with `c`'s * endpoints. * \pre If `pred1->target` and `pred2->target()` are already connected by an - * edge, this edge represents an \f$ x\f$-monotone curve that is + * edge, this edge represents an \f$x\f$-monotone curve that is * interior-disjoint from `c`). */ Halfedge_handle insert_at_vertices(const X_monotone_curve_2& c, @@ -943,7 +947,7 @@ public: */ Face_handle remove_isolated_vertex(Vertex_handle v); - /*! sets `c` to be the \f$ x\f$-monotone curve associated with the edge `e`. + /*! sets `c` to be the \f$x\f$-monotone curve associated with the edge `e`. * The function obtains a handle for the modified edge (same as `e`). * \pre `c` is geometrically equivalent to the curve currently associated * with `e`. @@ -967,12 +971,14 @@ public: /*! merges the edges represented by `e1` and `e2` into * a single edge, associated with the given merged curve `c`. Denote `e1`'s - * end-vertices as \f$ u_1\f$ and \f$ v\f$, while `e2`'s end-vertices are - * denoted \f$ u_2\f$ and \f$ v\f$. The function removes the common vertex \f$ - * v\f$ returns a handle for one of the merged halfedges, directed from \f$ - * u_1\f$ to \f$ u_2\f$. + * end-vertices as \f$u_1\f$ and \f$v\f$, while `e2`'s end-vertices are + * denoted \f$u_2\f$ and \f$v\f$. The function removes the common vertex + * \f$v\f$ returns a handle for one of the merged halfedges, directed from + * \f$u_1\f$ to \f$u_2\f$. + * * \pre `e1` and `e2` share a common end-vertex, such that the two other * end-vertices of the two edges are associated with `c`'s endpoints. + * \pre `e1` and `e2` have the same direction. */ Halfedge_handle merge_edge(Halfedge_handle e1, Halfedge_handle e2, @@ -985,7 +991,7 @@ public: * whether they should be left as isolated vertices in the arrangement. * If the operation causes two faces to merge, the merged face is returned. * Otherwise, the face to which the edge was incident is returned. - */ + */ Face_handle remove_edge(Halfedge_handle e, bool remove_source = true, bool remove_target = true); @@ -1007,43 +1013,43 @@ public: bool is_valid() const; /// @} - }; /* end Arrangement_on_surface_2 */ + } /* end namespace CGAL */ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2Insert - * The function `%insert` inserts one or more curves or \f$ x\f$-monotone + * The function `%insert` inserts one or more curves or \f$x\f$-monotone * curves into a given arrangement, where no restrictions are imposed on the - * inserted curves. If an inserted curve is not \f$ x\f$-monotone curve, it is - * subdivided into \f$ x\f$-monotone subcurves (and perhaps isolated points), + * inserted curves. If an inserted curve is not \f$x\f$-monotone curve, it is + * subdivided into \f$x\f$-monotone subcurves (and perhaps isolated points), * which are inserted into the arrangement. * * \cgalHeading{Requirements} * *
      - *
    • If the curve is \f$ x\f$-monotone curve then The instantiated - * `Traits` class must model the `ArrangementXMonotoneTraits_2` - * concept. In case that the curve is not \f$ x\f$-monotone then the + *
    • If the curve is \f$x\f$-monotone curve then The instantiated + * `Traits` class must model the `AosXMonotoneTraits_2` + * concept. In case that the curve is not \f$x\f$-monotone then the * instantiated `Traits` class must model the - * `ArrangementTraits_2` concept. That is, it should define the - * `Curve_2` type, and support its subdivision into \f$ x\f$-monotone + * `AosTraits_2` concept. That is, it should define the + * `Curve_2` type, and support its subdivision into \f$x\f$-monotone * subcurves (and perhaps isolated points). *
    • The point-location object `pl`, must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
    */ /// @{ /*! Inserts the given curve `c` into the arrangement `arr`. `c` is subdivided - * into \f$ x\f$-monotone subcurves (and perhaps isolated points). Each subcurve + * into \f$x\f$-monotone subcurves (and perhaps isolated points). Each subcurve * is in turn inserted into the arrangement by locating its left endpoint and * computing its zone until reaching the right endpoint. * * The given point-location object `pl` is used to locate the left endpoints of - * the \f$ x\f$-monotone curves. By default, the function uses the "walk along + * the \f$x\f$-monotone curves. By default, the function uses the "walk along * line" point-location strategy - namely an instance of the class * `Arr_walk_along_line_point_location >`. * @@ -1069,7 +1075,7 @@ void insert(Arrangement_on_surface_2& arr, typename Arr_point_location_result >::type obj); -/*! Aggregately inserts the curves or \f$ x\f$-monotone curves in the range +/*! Aggregately inserts the curves or \f$x\f$-monotone curves in the range * `[first,last)` into the arrangement `arr` using the sweep-line framework. * \param arr the target arrangement. * \param first the iterator to the first element in the range of curves. @@ -1089,7 +1095,7 @@ void insert(Arrangement_on_surface_2& arr, * arrangement's edges or vertices. * * If the give curve is not an \f$x\f$-monotone curve then the function - * subdivides the given curve into \f$ x\f$-monotone subcurves and isolated + * subdivides the given curve into \f$x\f$-monotone subcurves and isolated * vertices . Each subcurve is in turn checked for intersection. The function * uses the zone algorithm to check if the curve intersects the * arrangement. First, the curve's left endpoint is located. Then, its zone is @@ -1103,7 +1109,7 @@ void insert(Arrangement_on_surface_2& arr, * `Arr_walk_along_line_point_location >`. * - * Checks if the given curve or \f$ x\f$-monotone curve `c` intersects + * Checks if the given curve or \f$x\f$-monotone curve `c` intersects * edges or vertices of the existing arrangement `arr`. * * \pre If provided, `pl` must be attached to the given arrangement `arr`. @@ -1111,14 +1117,14 @@ void insert(Arrangement_on_surface_2& arr, * \cgalHeading{Requirements} * *
      - *
    • If `c` is \f$ x\f$-monotone then the instantiated `GeometryTraits` - * class must model the `ArrangementXMonotoneTraits_2` concept. If + *
    • If `c` is \f$x\f$-monotone then the instantiated `GeometryTraits` + * class must model the `AosXMonotoneTraits_2` concept. If * `c` is a curve then the instantiated `GeometryTraits` class must - * model the `ArrangementTraits_2` concept. That is, it should + * model the `AosTraits_2` concept. That is, it should * define the `Curve_2` type, and support its subdivision into - * \f$ x\f$-monotone subcurves (and perhaps isolated points). + * \f$x\f$-monotone subcurves (and perhaps isolated points). *
    • The point-location object `pl`, must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
    */ template & arr, /*! \ingroup PkgArrangementOnSurface2Funcs * - * Inserts a given \f$ x\f$-monotone curve into a given arrangement, where the + * Inserts a given \f$x\f$-monotone curve into a given arrangement, where the * given curve and the existing arrangement edges (more precisely, the curves * geometric mappings of the edges) must be pairwise disjoint in their * interiors, and the interior of the input curve must not contain existing @@ -1152,9 +1158,9 @@ bool do_intersect(Arrangement_on_surface_2& arr, * *
      *
    • The instantiated `Traits` class must model the restricted - * `ArrangementBasicTraits_2` concept, as no intersections are computed. + * `AosBasicTraits_2` concept, as no intersections are computed. *
    • The point-location object `pl` must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
    */ template *
  • The instantiated `Traits` class must model the - * `ArrangementBasicTraits_2` concept, as no intersections are computed. + * `AosBasicTraits_2` concept, as no intersections are computed. *
  • `InputIterator::value_type` must be `Traits::X_monotone_curve_2` *
*/ @@ -1209,12 +1215,12 @@ void insert_non_intersecting_curves * *
    *
  • The instantiated `Traits` class must model the - * `ArrangementXMonotoneTraits_2` concept. Not all expressions listed + * `AosXMonotoneTraits_2` concept. Not all expressions listed * by this concept are required. In fact the traits class must model the - * `ArrangementBasicTraits_2` concept, and support the splitting + * `AosBasicTraits_2` concept, and support the splitting * functionality. *
  • The point-location object `pl`, must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. *
*/ template & arr, * * Invokes the member function `arr.is_valid()` to verify the topological * correctness of the arrangement. Then it performs additional validity - * tests. It checks that all \f$ x\f$-monotone curves associated with + * tests. It checks that all \f$x\f$-monotone curves associated with * arrangement edges are pairwise disjoint in their interior. Then it makes sure * that all holes and all isolated vertices are located within the proper * arrangement faces. Note that the test carried out by this function may take a @@ -1253,8 +1259,8 @@ bool is_valid * its endpoints become isolated, they are removed as well. The call * `remove_edge(arr, e)` is equivalent to the call `arr.remove_edge (e, true, * true)`. However, this free function requires that `Traits` be a model of the - * refined concept `ArrangementXMonotoneTraits_2`, which requires merge - * operations on \f$ x\f$-monotone curves. If one of the end-vertices of the + * refined concept `AosXMonotoneTraits_2`, which requires merge + * operations on \f$x\f$-monotone curves. If one of the end-vertices of the * given edge becomes redundant after the edge is removed (see `remove_vertex()` * for the definition of a redundant vertex), it is removed, and its incident * edges are merged. If the edge-removal operation causes two faces to merge, @@ -1265,10 +1271,10 @@ bool is_valid * *
    *
  • The instantiated traits class must model the concept - * `ArrangementXMonotoneTraits_2`. + * `AosXMonotoneTraits_2`. *
*/ -template +template typename Arrangement_on_surface_2::Face_handle remove_edge (Arrangement_on_surface_2& arr, @@ -1287,9 +1293,9 @@ remove_edge * *
    *
  • The instantiated `Traits` class must model the - * `ArrangementXMonotoneTraits_2` concept. Not all expressions listed + * `AosXMonotoneTraits_2` concept. Not all expressions listed * by this concept are required. In fact the traits class must model the - * `ArrangementBasicTraits_2` concept and support the merging + * `AosBasicTraits_2` concept and support the merging * functionality. *
*/ @@ -1323,9 +1329,9 @@ bool remove_vertex * * \pre If provided, `pl` must be attached to the given arrangement `arr`. * \pre The instantiated `GeometryTraits` class must model the - * `ArrangementXMonotoneTraits_2` concept. + * `AosXMonotoneTraits_2` concept. * \pre The point-location object `pl`, must model the - * `ArrangementPointLocation_2` concept. + * `AosPointLocation_2` concept. * \pre Dereferencing `oi` must yield a polymorphic object of type * `std::variant`. * diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h index ac6fac59496..140be3ded46 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h @@ -5,18 +5,18 @@ namespace CGAL { * \anchor arr_refaos_with_hist * * An object `arr` of the class `Arrangement_on_surface_with_history_2` - * represents the planar subdivision induced by a set of input curves \f$ \cal - * C\f$. The arrangement is represented as a doubly-connected edge-list (Dcel). As is the case for the + * represents the planar subdivision induced by a set of input curves + * \f$\cal C\f$. The arrangement is represented as a doubly-connected edge-list + * (Dcel). As is the case for the * `Arrangement_2`, each Dcel vertex is - * associated with a point and each edge is associated with an \f$ x\f$-monotone + * associated with a point and each edge is associated with an \f$x\f$-monotone * curve whose interior is disjoint from all other edges and vertices. Each such - * \f$ x\f$-monotone curve is a subcurve of some \f$ C \in \cal C\f$ - or may - * represent an overlap among several curves in \f$ \cal C\f$. + * \f$x\f$-monotone curve is a subcurve of some \f$C \in \cal C\f$ - or may + * represent an overlap among several curves in \f$\cal C\f$. * * The `Arrangement_on_surface_with_history_2` class-template extends the * `Arrangement_2` class-template by keeping an additional container of input - * curves representing \f$ \cal C\f$, and by maintaining a cross-mapping between + * curves representing \f$\cal C\f$, and by maintaining a cross-mapping between * these curves and the arrangement edges they induce. This way it is possible * to determine the inducing curve(s) of each arrangement edge. This mapping * also allows the traversal of input curves, and the traversal of edges induced @@ -26,33 +26,32 @@ namespace CGAL { * *
    *
  • The `GeometryTraits` template-parameter should be substituted by a - * model of the `ArrangementTraits_2` concept. The traits class defines the + * model of the `AosTraits_2` concept. The traits class defines the * `Curve_2` type, which represents an input curve. It also defines the types - * of \f$ x\f$-monotone curves and two-dimensional points, namely - * `ArrangementTraits_2::X_monotone_curve_2` and - * `ArrangementTraits_2::Point_2`, respectively, and supports basic + * of \f$x\f$-monotone curves and two-dimensional points, namely + * `AosTraits_2::X_monotone_curve_2` and + * `AosTraits_2::Point_2`, respectively, and supports basic * geometric predicates on them. *
  • The `TopologyTraits` template-parameter should be substituted by a - * class that is a model of the `ArrangementTopologyTraits` concept. + * class that is a model of the `AosTopologyTraits` concept. *
* * \sa `Arrangement_with_history_2` * \sa `Arrangement_on_surface_2` - * \sa `ArrangementTraits_2` - * \sa `ArrangementTopologyTraits` + * \sa `AosTraits_2` + * \sa `AosTopologyTraits` */ template class Arrangement_on_surface_with_history_2 : - public Arrangement_on_surface_2 -{ + public Arrangement_on_surface_2 { public: /// \name Types /// @{ - //! the geometry traits class in use. + /// the geometry traits class in use. typedef GeometryTraits Geometry_traits_2; - //! the topology traits class in use. + /// the topology traits class in use. typedef TopologyTraits Topology_traits; /*! a private type used as an abbreviation of the @@ -61,16 +60,16 @@ public: typedef Arrangement_on_surface_with_history_2 Self; - //! the Dcel representation of the arrangement. + /// the Dcel representation of the arrangement. typedef typename Topology_traits::Dcel Dcel; - //! the point type, as defined by the traits class. + /// the point type, as defined by the traits class. typedef typename Geometry_traits_2::Point_2 Point_2; - //! the \f$ x\f$-monotone curve type, as defined by the traits class. + /// the \f$x\f$-monotone curve type, as defined by the traits class. typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; - //! the curve type, as defined by the traits class. + /// the curve type, as defined by the traits class. typedef typename Geometry_traits_2::Curve_2 Curve_2; /// @} @@ -82,7 +81,7 @@ public: */ /// @{ - //! a handle for an input curve. + /// a handle for an input curve. typedef unspecified_type Curve_handle; /*! a bidirectional iterator over the curves that induce the arrangement. @@ -123,13 +122,13 @@ public: /// \name Assignment Methods /// @{ - //! assignment operator. + /// assignment operator. Self& operator=(other); - //! assigns the contents of another arrangement. + /// assigns the contents of another arrangement. void assign(const Self& other); - //! clears the arrangement. + /// clears the arrangement. void clear (); /// @} @@ -140,31 +139,31 @@ public: /// @{ - //! returns the number of input curves that induce the arrangement. + /// returns the number of input curves that induce the arrangement. Size number_of_curves() const; - //! returns the begin-iterator of the curves inducing the arrangement. + /// returns the begin-iterator of the curves inducing the arrangement. Curve_iterator curves_begin(); //! returns the past-the-end iterator of the curves inducing the arrangement. Curve_iterator curves_end(); - //! returns the number of arrangement edges induced by the curve `ch`. + /// returns the number of arrangement edges induced by the curve `ch`. Size number_of_induced_edges(Curve_handle ch) const; - //! returns the begin-iterator of the edges induced by the curve `ch`. + /// returns the begin-iterator of the edges induced by the curve `ch`. Induced_edge_iterator induced_edges_begin(Curve_handle ch) const; - //! returns the past-the-end iterator of the edges induced by the curve `ch`. + /// returns the past-the-end iterator of the edges induced by the curve `ch`. Induced_edge_iterator induced_edges_end(Curve_handle ch) const; - //! returns the number of input curves that originate the edge `e`. + /// returns the number of input curves that originate the edge `e`. Size number_of_originating_curves(Halfedge_handle e) const; - //! returns the begin-iterator of the curves originating the edge `e`. + /// returns the begin-iterator of the curves originating the edge `e`. Originating_curve_iterator originating_curves_begin(Halfedge_handle e) const; - //! returns the past-the-end iterator of the curves originating the edge `e`. + /// returns the past-the-end iterator of the curves originating the edge `e`. Originating_curve_iterator originating_curves_end(Halfedge_handle e) const; /// @} @@ -192,9 +191,9 @@ public: /*! merges the edges represented by `e1` and `e2` into a single edge. The * function returns a handle for one of the merged halfedges. * - * \pre `e1` and `e2` share a common end-vertex, of degree \f$ 2\f$, and the - * \f$ x\f$-monotone curves associated with `e1` and `e2` are mergeable - * into a single \f$ x\f$-monotone curves. + * \pre `e1` and `e2` share a common end-vertex, of degree \f$2\f$, and the + * \f$x\f$-monotone curves associated with `e1` and `e2` are mergeable + * into a single \f$x\f$-monotone curves. */ Halfedge_handle merge_edge(Halfedge_handle e1, Halfedge_handle e2); @@ -210,7 +209,6 @@ public: bool remove_target = true); /// @} - }; /* end Arrangement_on_surface_with_history_2 */ /*! \ingroup PkgArrangementOnSurface2Insert @@ -222,14 +220,14 @@ public: * computing its zone until reaching the right endpoint. * * The given point-location object `pl` is used to locate the left endpoints of - * the \f$ x\f$-monotone curves. By default, the function uses the "walk along + * the \f$x\f$-monotone curves. By default, the function uses the "walk along * line" point-location strategy - namely an instance of the class * `Arr_walk_along_line_point_location >`. * * \pre If provided, `pl` is attached to the given arrangement `arr`. */ -template +template typename Arrangement_on_surface_with_history_2::Curve_handle insert (Arrangement_on_surface_with_history_2& arr, @@ -261,7 +259,6 @@ Size remove_curve (Arrangement_on_surface_with_history_2& arr, typename Arrangement_on_surface_with_history_2::Curve_handle ch); - /*! \addtogroup PkgArrangementOnSurface2Overlay * * Computes the overlay of two arrangements with history `arr1` and `arr2`, and @@ -281,17 +278,16 @@ void overlay Arrangement_on_surface_with_history_2& res, OverlayTraits& ovl_tr); - /*! \addtogroup PkgArrangementOnSurface2Overlay * * Computes the (simple) overlay of two arrangements with history `arr1` and - *`arr2`, and sets the output arrangement with history `res` to represent the - *overlaid arrangement. The function also constructs a consolidated set of - *curves that induce `res`. It employs the default overlay-traits, which - *practically does nothing. + * `arr2`, and sets the output arrangement with history `res` to represent the + * overlaid arrangement. The function also constructs a consolidated set of + * curves that induce `res`. It employs the default overlay-traits, which + * practically does nothing. * * \pre `res` does not refer to either `arr1` or `arr2` (that is, "self overlay" - *is not supported). + * is not supported). */ template diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h index a4f001847c3..3c81415dc98 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h @@ -5,17 +5,17 @@ namespace CGAL { * \anchor arr_refarr_with_hist * * An object `arr` of the class `Arrangement_with_history_2` represents the - * planar subdivision induced by a set of input curves \f$ \cal C\f$. The + * planar subdivision induced by a set of input curves \f$\cal C\f$. The * arrangement is represented as a doubly-connected edge-list (\dcel). As is * the case for the `Arrangement_2`, each \dcel vertex is - * associated with a point and each edge is associated with an \f$ x\f$-monotone + * associated with a point and each edge is associated with an \f$x\f$-monotone * curve whose interior is disjoint from all other curves and points. Each such - * \f$ x\f$-monotone curve is a subcurve of some \f$ C \in \cal C\f$, or may - * represent an overlap among several curves in \f$ \cal C\f$. + * \f$x\f$-monotone curve is a subcurve of some \f$C \in \cal C\f$, or may + * represent an overlap among several curves in \f$\cal C\f$. * * The `Arrangement_with_history_2` class-template extends the `Arrangement_2` * class-template by keeping an additional container of input curves - * representing \f$ \cal C\f$, and by maintaining a cross-mapping between these + * representing \f$\cal C\f$, and by maintaining a cross-mapping between these * curves and the arrangement edges they induce. This way it is possible to * determine the inducing curve(s) of each arrangement edge. This mapping also * allows the traversal of input curves, and the traversal of edges induced by @@ -24,39 +24,39 @@ namespace CGAL { * The `Arrangement_with_history_2` template has two parameters: *
    *
  • The `Traits` template-parameter should be substituted by a model of - * the `ArrangementTraits_2` concept. The traits class defines the `Curve_2` + * the `AosTraits_2` concept. The traits class defines the `Curve_2` * type, which represents an input curve. It also defines the types of \f$ * x\f$-monotone curves and two-dimensional points, namely - * `ArrangementTraits_2::X_monotone_curve_2` and `ArrangementTraits_2::Point_2`, + * `AosTraits_2::X_monotone_curve_2` and `AosTraits_2::Point_2`, * respectively, and supports basic geometric predicates on them. *
  • The `Dcel` template-parameter should be substituted by a class that is - * a model of the `ArrangementDcelWithRebind` concept. The value of this + * a model of the `AosDcelWithRebind` concept. The value of this * parameter is by default `Arr_default_dcel`. *
* - * \sa `ArrangementDcel` + * \sa `AosDcel` * \sa `Arr_default_dcel` - * \sa `ArrangementTraits_2` + * \sa `AosTraits_2` * \sa `Arrangement_2` * \sa `insertion functions` * \sa `removal functions` * \sa `overlaying arrangements` */ template -class Arrangement_with_history_2 : public Arrangement_on_surface_with_history_2::Traits> { +class Arrangement_with_history_2 : + public Arrangement_on_surface_with_history_2::Traits> { public: - /// \name Types /// @{ - //! the geometry traits class. + /// the geometry traits class. typedef Traits Geometry_traits; - //! The topology traits. + /// The topology traits. typedef typename Default_planar_topology::Traits Topology_traits; - //! The base arrangement on surface type. + /// The base arrangement on surface type. typedef Arrangement_on_surface_with_history_2 Base; @@ -129,13 +129,13 @@ public: * computing its zone until reaching the right endpoint. * * The given point-location object `pl` is used to locate the left endpoints of - * the \f$ x\f$-monotone curves. By default, the function uses the "walk along + * the \f$x\f$-monotone curves. By default, the function uses the "walk along * line" point-location strategy - namely an instance of the class * `Arr_walk_along_line_point_location >`. * * \pre If provided, `pl` is attached to the given arrangement `arr`. */ -template +template typename Arrangement_with_history_2::Curve_handle insert(Arrangement_with_history_2& arr, const typename Traits::Curve_2& c, @@ -161,7 +161,6 @@ template Size remove_curve(Arrangement_with_history_2& arr, typename Arrangement_with_history_2::Curve_handle ch); - /*! \addtogroup PkgArrangementOnSurface2Overlay * Computes the overlay of two arrangements with history `arr1` and `arr2`, and * sets the output arrangement with history `res` to represent the overlaid @@ -170,14 +169,13 @@ Size remove_curve(Arrangement_with_history_2& arr, * * \pre `res` does not refer to either `arr1` or `arr2`. */ -template +template void overlay(const Arrangement_with_history_2& arr1, const Arrangement_with_history_2& arr2, Arrangement_with_history_2& res, OverlayTraits& ovl_tr); - /*! \addtogroup PkgArrangementOnSurface2Overlay * * Computes the (simple) overlay of two arrangements with history `arr1` and @@ -189,8 +187,7 @@ void overlay(const Arrangement_with_history_2& arr1, * \pre `res` does not refer to either `arr1` or `arr2` (that is, "self overlay" * is not supported). */ -template +template void overlay(const Arrangement_with_history_2& arr1, const Arrangement_with_history_2& arr2, Arrangement_with_history_2& res); diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/CORE_algebraic_number_traits.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/CORE_algebraic_number_traits.h index b48ef555575..f3b6cdfb9f0 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/CORE_algebraic_number_traits.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/CORE_algebraic_number_traits.h @@ -12,16 +12,16 @@ public: /// \name Types /// @{ - //! The integer number type. + /// The integer number type. typedef CORE::BigInt Integer; - //! The rational number type. + /// The rational number type. typedef CORE::BigRat Rational; - //! The polynomial type. + /// The polynomial type. typedef CORE::Polynomial Polynomial; - //! The algebraic number type. + /// The algebraic number type. typedef CORE::Expr Algebraic; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_iostream.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_iostream.h index 7aa284b171a..824e3f73bd7 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_iostream.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_iostream.h @@ -2,100 +2,89 @@ namespace CGAL { namespace IO { -/*! - \defgroup PkgArrangementOnSurface2Read CGAL::IO::read() - \ingroup PkgArrangementOnSurface2IO +/*! \defgroup PkgArrangementOnSurface2Read CGAL::IO::read() + * \ingroup PkgArrangementOnSurface2IO + * + * Reads a given arrangement from a given input stream + * using a specific input format. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `Formatter` class must model the + * `AosInputFormatter` concept. + *
  • The instantiated `WithHistoryFormatter` class must model the + * `AosWithHistoryInputFormatter` concept. + *
+ * + * \sa `PkgArrangementOnSurface2Write` + * \sa `PkgArrangementOnSurface2op_left_shift` + * \sa `PkgArrangementOnSurface2op_right_shift` + */ -Reads a given arrangement from a given input stream -using a specific input format. - -\cgalHeading{Requirements} - -
    -
  • The instantiated `Formatter` class must model the - `ArrangementInputFormatter` concept. -
  • The instantiated `WithHistoryFormatter` class must model the - `ArrangementWithHistoryInputFormatter` concept. -
- - -\sa `PkgArrangementOnSurface2Write` - - -\sa `PkgArrangementOnSurface2op_left_shift` -\sa `PkgArrangementOnSurface2op_right_shift` -*/ /// @{ -/*! -Reads the arrangement object `arr` from the given input stream `is` -using a specific input format defined by \"formatter\". -*/ -template -std::istream& read (Arrangement_2& arr, - std::istream& is, - Formatter& formatter); - +/*! Reads the arrangement object `arr` from the given input stream `is` + * using a specific input format defined by \"formatter\". + */ +template +std::istream& read(Arrangement_2& arr, + std::istream& is, Formatter& formatter); /// @} -/*! - \defgroup PkgArrangementOnSurface2Write CGAL::IO::write() - \ingroup PkgArrangementOnSurface2IO +/*! \defgroup PkgArrangementOnSurface2Write CGAL::IO::write() + * \ingroup PkgArrangementOnSurface2IO + * + * Writes a given arrangement into a given output stream + * using a specific output format. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `Formatter` class must model the + * `AosOutputFormatter` concept. + *
  • The instantiated `WithHistoryFormatter` class must model the + * `AosWithHistoryOutputFormatter` concept. + *
+ * + * \sa `PkgArrangementOnSurface2Read` + * \sa `PkgArrangementOnSurface2op_left_shift` + * \sa `PkgArrangementOnSurface2op_right_shift` + */ -Writes a given arrangement into a given output stream -using a specific output format. - -\cgalHeading{Requirements} - -
    -
  • The instantiated `Formatter` class must model the - `ArrangementOutputFormatter` concept. -
  • The instantiated `WithHistoryFormatter` class must model the - `ArrangementWithHistoryOutputFormatter` concept. -
- -\sa `PkgArrangementOnSurface2Read` -\sa `PkgArrangementOnSurface2op_left_shift` -\sa `PkgArrangementOnSurface2op_right_shift` -*/ /// @{ -/*! -Writes the arrangement object `arr` into the given output stream -`os` using a specific output format defined by `formatter`. -*/ -template -std::ostream& write (const Arrangement_2& arr, - std::ostream& os, - Formatter& formatter); +/*! Writes the arrangement object `arr` into the given output stream + * `os` using a specific output format defined by `formatter`. + */ +template +std::ostream& write(const Arrangement_2& arr, + std::ostream& os, Formatter& formatter); /// @} } // namespace IO -/*! -\ingroup PkgArrangementOnSurface2op_left_shift -Inserts the arrangement object `arr` into the output stream -`os` using the output format defined by the -`Arr_text_formatter` class. Only the basic geometric and -topological features of the arrangement are inserted. Auxiliary data -that may be attached to the \dcel features is ignored. -*/ -template -std::ostream& operator<< (std::ostream& os, - const Arrangement_2& arr); +/*! \ingroup PkgArrangementOnSurface2op_left_shift + * Inserts the arrangement object `arr` into the output stream + * `os` using the output format defined by the + * `Arr_text_formatter` class. Only the basic geometric and + * topological features of the arrangement are inserted. Auxiliary data + * that may be attached to the \dcel features is ignored. + */ +template +std::ostream& operator<<(std::ostream& os, + const Arrangement_2& arr); -/*! -\ingroup PkgArrangementOnSurface2op_right_shift -Extracts an arrangement from a given input stream using the input -format defined by the `Arr_text_formatter` class - that is, only the -basic geometric and topological features of the arrangement are read -and no auxiliary data is attached to the Dcel features. -*/ -template -std::istream& operator>>(std::istream& is, Arrangement_2& arr); - +/*! \ingroup PkgArrangementOnSurface2op_right_shift + * Extracts an arrangement from a given input stream using the input + * format defined by the `Arr_text_formatter` class - that is, only the + * basic geometric and topological features of the arrangement are read + * and no auxiliary data is attached to the Dcel features. + */ +template +std::istream& operator>>(std::istream& is, Arrangement_2& arr); } /* end namespace CGAL::IO*/ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_text_formatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_text_formatter.h index 4695aa5cfb5..8ec0f2f07ee 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_text_formatter.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_text_formatter.h @@ -1,93 +1,83 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2IO +/*! \ingroup PkgArrangementOnSurface2IO + * + * `Arr_extended_dcel_text_formatter` defines the format of an arrangement in an + * input or output stream (typically a file stream), thus enabling reading and + * writing an `Arrangement` instance using a simple text format. The + * `Arrangement` class should be instantiated with a \dcel class which in turn + * instantiates the `Arr_extended_dcel` template with the `VertexData`, + * `HalfedgeData` and `FaceData` types. The formatter supports reading and + * writing the data objects attached to the arrangement vertices, halfedges and + * faces. + * + * The `Arr_extended_dcel_text_formatter` class assumes that the nested + * `Point_2` and the `Curve_2` types defined by the `Arrangement` + * template-parameter, as well as the `VertexData`, `HalfedgeData` and + * `FaceData` types, can all be written to an input stream using the `<<` + * operator and read from an input stream using the `>>` operator. + * + * \cgalModels{AosInputFormatter,AosOutputFormatter} + * + * \sa `PkgArrangementOnSurface2Read` + * \sa `PkgArrangementOnSurface2Write` + * \sa `Arr_extended_dcel` + */ +template +class Arr_extended_dcel_text_formatter {}; -`Arr_extended_dcel_text_formatter` defines the format of an arrangement in an input or output stream -(typically a file stream), thus enabling reading and writing an `Arrangement` -instance using a simple text format. The `Arrangement` class should be -instantiated with a \dcel class which in turn instantiates the -`Arr_extended_dcel` template with the `VertexData`, `HalfedgeData` and -`FaceData` types. -The formatter supports reading and writing the data objects attached to the -arrangement vertices, halfedges and faces. - -The `Arr_extended_dcel_text_formatter` class assumes that the nested `Point_2` and the `Curve_2` types -defined by the `Arrangement` template-parameter, as well as the `VertexData`, -`HalfedgeData` and `FaceData` types, can all be written to an input stream using -the `<<` operator and read from an input stream using the `>>` operator. - -\cgalModels{ArrangementInputFormatter,ArrangementOutputFormatter} - -\sa `PkgArrangementOnSurface2Read` -\sa `PkgArrangementOnSurface2Write` -\sa `Arr_extended_dcel` - -*/ -template< typename Arrangement > -class Arr_extended_dcel_text_formatter { -public: - -}; /* end Arr_extended_dcel_text_formatter */ } /* end namespace CGAL */ namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2IO +/*! \ingroup PkgArrangementOnSurface2IO + * + * `Arr_face_extended_text_formatter` defines the format of an arrangement in an + * input or output stream (typically a file stream), thus enabling reading and + * writing an `Arrangement` instance using a simple text format. The + * `Arrangement` class should be instantiated with a \dcel class which in turn + * instantiates the `Arr_face_extended_dcel` template with a `FaceData` type. + * The formatter supports reading and writing the data objects attached to the + * arrangement faces as well. + * + * The `Arr_face_extended_text_formatter` class assumes that the nested + * `Point_2` and the `Curve_2` types defined by the `Arrangement` + * template-parameter and that the `FaceData` type can all be written to an + * input stream using the `<<` operator and read from an input stream using the + * `>>` operator. + * + * \cgalModels{AosInputFormatter,AosOutputFormatter} + * + * \sa `PkgArrangementOnSurface2Read` + * \sa `PkgArrangementOnSurface2Write` + * \sa `Arr_face_extended_dcel` + */ +template +class Arr_face_extended_text_formatter {}; -`Arr_face_extended_text_formatter` defines the format of an arrangement in an input or output stream -(typically a file stream), thus enabling reading and writing an `Arrangement` -instance using a simple text format. The `Arrangement` class should be -instantiated with a \dcel class which in turn instantiates the -`Arr_face_extended_dcel` template with a `FaceData` type. -The formatter supports reading and writing the data objects attached to the -arrangement faces as well. - -The `Arr_face_extended_text_formatter` class assumes that the nested `Point_2` and the `Curve_2` types -defined by the `Arrangement` template-parameter and that the `FaceData` type -can all be written to an input stream using the `<<` operator and read from an input stream using the `>>` operator. - -\cgalModels{ArrangementInputFormatter,ArrangementOutputFormatter} - -\sa `PkgArrangementOnSurface2Read` -\sa `PkgArrangementOnSurface2Write` -\sa `Arr_face_extended_dcel` - -*/ -template< typename Arrangement > -class Arr_face_extended_text_formatter { -public: - -}; /* end Arr_face_extended_text_formatter */ } /* end namespace CGAL */ namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2IO +/*! \ingroup PkgArrangementOnSurface2IO + * + * `Arr_text_formatter` defines the format of an arrangement in an input or + * output stream (typically a file stream), thus enabling reading and writing an + * `Arrangement` instance using a simple text format. The arrangement is assumed + * to store no auxiliary data with its \dcel records (and if there are such + * records they will not be written or read by the formatter). + * + * The `Arr_text_formatter` class assumes that the nested `Point_2` and the + * `Curve_2` types defined by the `Arrangement` template-parameter can both be + * written to an input stream using the `<<` operator and read from an input + * stream using the `>>` operator. + * + * \cgalModels{AosInputFormatter,AosOutputFormatter} + * + * \sa `PkgArrangementOnSurface2Read` + * \sa `PkgArrangementOnSurface2Write` + */ +template +class Arr_text_formatter {}; -`Arr_text_formatter` defines the format of an arrangement in an input or output stream -(typically a file stream), thus enabling reading and writing an `Arrangement` -instance using a simple text format. The arrangement is assumed to store no auxiliary -data with its \dcel records (and if there are such records they will not be written -or read by the formatter). - -The `Arr_text_formatter` class assumes that the nested `Point_2` and the `Curve_2` types -defined by the `Arrangement` template-parameter can both be written to an input -stream using the `<<` operator and read from an input stream using the `>>` -operator. - -\cgalModels{ArrangementInputFormatter,ArrangementOutputFormatter} - -\sa `PkgArrangementOnSurface2Read` -\sa `PkgArrangementOnSurface2Write` - -*/ -template< typename Arrangement > -class Arr_text_formatter { -public: - -}; /* end Arr_text_formatter */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_iostream.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_iostream.h index 968bda50939..c38812953c8 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_iostream.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_iostream.h @@ -2,51 +2,46 @@ namespace CGAL { namespace IO { -/*! -\ingroup PkgArrangementOnSurface2Read - -Reads the arrangement-with-history object `arr` from the given -input stream `is` using a specific input format defined by -\"formatter\". - -*/ -template -std::istream& read (Arrangement_with_history_2& arr, - std::istream& is, - WithHistoryFormatter& formatter); +std::istream& read(Arrangement_with_history_2& arr, + std::istream& is, WithHistoryFormatter& formatter); -/*! -\ingroup PkgArrangementOnSurface2Write -Writes the arrangement-with-history object `arr` into the given -output stream `os` using a specific output format defined by -`formatter`. -*/ -template -std::ostream& write (const Arrangement_with_history_2& arr, - std::ostream& os, - WithHistoryFormatter& formatter); +std::ostream& write(const Arrangement_with_history_2& arr, + std::ostream& os, WithHistoryFormatter& formatter); } // namespace IO -/*! -\ingroup PkgArrangementOnSurface2op_left_shift -Inserts the arrangement-with-history object `arr` into the output -stream `os` using the output format defined by the -`Arr_with_history_text_formatter` class. Only the basic geometric -and topological features of the arrangement are inserted. Auxiliary -data that may be attached to the \dcel features is ignored. -*/ -template -std::ostream& operator<< (std::ostream& os, - const Arrangement_with_history_2& arr); +/*! \ingroup PkgArrangementOnSurface2op_left_shift + * inserts the arrangement-with-history object `arr` into the output + * stream `os` using the output format defined by the + * `Arr_with_history_text_formatter` class. Only the basic geometric + * and topological features of the arrangement are inserted. Auxiliary + * data that may be attached to the \dcel features is ignored. + */ +template +std::ostream& operator<<(std::ostream& os, + const Arrangement_with_history_2& arr); + +/*! \ingroup PkgArrangementOnSurface2op_right_shift + * extracts an arrangement-with-history from a given input stream using + * the default input format. + */ +template +std::istream& operator>>(std::istream& is, + Arrangement_with_history_2& arr); -/*! -\ingroup PkgArrangementOnSurface2op_right_shift -Extracts an arrangement-with-history from a given input stream using -the default input format. -*/ -template -std::istream& operator>>(std::istream& is, Arrangement_with_history_2& arr); } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_text_formatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_text_formatter.h index 564b6534b34..305a5f5a753 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_text_formatter.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/IO/Arr_with_history_text_formatter.h @@ -1,29 +1,24 @@ - namespace CGAL { -/*! -\ingroup PkgArrangementOnSurface2IO +/*! \ingroup PkgArrangementOnSurface2IO + * + * `Arr_with_history_text_formatter` defines the format of an arrangement in an + * input or output stream (typically a file stream), thus enabling reading and + * writing an arrangement-with-history instance using a simple text format. + * + * The `ArrFormatter` parameter servers as a base class for + * `Arr_with_history_text_formatter` and must be a model of the + * `AosInputFormatter` and the `AosOutputFormatter` concepts. It is used to read + * or write the base arrangement, while the derived class is responsible for + * reading and writing the set of curves inducing the arrangement and + * maintaining the relations between these curves and the edges they induce. + * + * \cgalModels{AosWithHistoryInputFormatter,AosWithHistoryOutputFormatter} + * + * \sa `PkgArrangementOnSurface2Read` + * \sa `PkgArrangementOnSurface2Write` + */ +template +class Arr_with_history_text_formatter {}; -`Arr_with_history_text_formatter` defines the format of an arrangement in an input or output stream -(typically a file stream), thus enabling reading and writing an -arrangement-with-history instance using a simple text format. - -The `ArrFormatter` parameter servers as a base class for -`Arr_with_history_text_formatter` and must be a model of the `ArrangementInputFormatter` -and the `ArrangementOutputFormatter` concepts. It is used to read or write -the base arrangement, while the derived class is responsible for reading and -writing the set of curves inducing the arrangement and maintaining the -relations between these curves and the edges they induce. - -\cgalModels{ArrangementWithHistoryInputFormatter,ArrangementWithHistoryOutputFormatter} - -\sa `PkgArrangementOnSurface2Read` -\sa `PkgArrangementOnSurface2Write` - -*/ -template< typename ArrFormatter > -class Arr_with_history_text_formatter { -public: - -}; /* end Arr_with_history_text_formatter */ } /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h index cf7782447aa..39d637cde4a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h @@ -25,51 +25,63 @@ namespace CGAL { /*! \ingroup PkgArrangementOnSurface2Draw - opens a new window and draws `arr`, an instance of the `CGAL::Arrangement_2` class template. Parameters of the drawing are taken from the optional graphics scene options parameter. - -A call to this function blocks the execution of the program until the drawing window is closed. This function requires `CGAL_Qt6`, and is only available if the macro `CGAL_USE_BASIC_VIEWER` is defined. -Linking with the cmake target `CGAL::CGAL_Basic_viewer` will link with `CGAL_Qt6` and add the definition `CGAL_USE_BASIC_VIEWER`. - - -\tparam GeometryTraits_2 a geometry traits type, a model of a 2D arrangement traits concept. At this point it must be an instance of either `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. -\tparam Dcel the \dcel type, a model of the `ArrangementDcel` concept. -\tparam GSOptions a model of `GraphicsSceneOptions` concept. - -\param arr the 2D arrangement to draw. -\param gso the graphics scene options parameter. - -\sa `ArrangementDcel` -\sa `ArrangementTraits_2` -*/ + * The function opens a new window and draws `arr`, an instance of the + * `CGAL::Arrangement_2` class template. Parameters of the drawing are taken + * from the optional graphics scene options parameter. + * + * A call to this function blocks the execution of the program until the drawing + * window is closed. This function requires `CGAL_Qt6`, and is only available if + * the macro `CGAL_USE_BASIC_VIEWER` is defined. Linking with the cmake target + * `CGAL::CGAL_Basic_viewer` will link with `CGAL_Qt6` and add the definition + * `CGAL_USE_BASIC_VIEWER`. + * + * \tparam GeometryTraits_2 a geometry traits type, a model of a 2D arrangement + * traits concept. At this point it must be an instance of either + * `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. + * \tparam Dcel the \dcel type, a model of the `AosDcel` concept. + * \tparam GSOptions a model of `GraphicsSceneOptions` concept. + * + * \param arr the 2D arrangement to draw. + * \param gso the graphics scene options parameter. + * + * \sa `AosDcel` + * \sa `AosTraits_2` + */ template -void draw(const Arrangement_2& arr, const GSOptions& gso); +void draw(const Arrangement_2& arr, + const GSOptions& gso); /*! \ingroup PkgArrangementOnSurface2Draw - - A shortcut to `CGAL::draw(arr, Graphics_scene_options{})`. -*/ + * + * A shortcut to `CGAL::draw(arr, Graphics_scene_options{})`. + */ template void draw(const Arrangement_2& arr); /*! \ingroup PkgArrangementOnSurface2Draw - -adds the vertices, edges and faces of `arr` into the given graphic scene `gs`. Parameters of the cells are taken from the optional graphics scene options parameter `gso`. Note that `gs` is not cleared before being filled (to enable to draw several data structures in the same basic viewer). - -\tparam GeometryTraits_2 a geometry traits type, a model of a 2D arrangement traits concept. At this point it must be an instance of either `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. -\tparam Dcel the \dcel type, a model of the `ArrangementDcel` concept. -\tparam GSOptions a model of `GraphicsSceneOptions` concept. - -\param arr the 2D arrangement to draw. -\param gs the graphic scene to fill. -\param gso the graphics scene options parameter. + * + * adds the vertices, edges and faces of `arr` into the given graphic scene + * `gs`. Parameters of the cells are taken from the optional graphics scene + * options parameter `gso`. Note that `gs` is not cleared before being filled + * (to enable to draw several data structures in the same basic viewer). + * + * \tparam GeometryTraits_2 a geometry traits type, a model of a 2D arrangement + * traits concept. At this point it must be an instance of either + * `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. + * \tparam Dcel the \dcel type, a model of the `AosDcel` concept. + * \tparam GSOptions a model of `GraphicsSceneOptions` concept. + * + * \param arr the 2D arrangement to draw. + * \param gs the graphic scene to fill. + * \param gso the graphics scene options parameter. */ template void add_to_graphics_scene(const Arrangement_2& arr, CGAL::Graphics_scene& gs, const GSOptions& gso); /*! \ingroup PkgArrangementOnSurface2Draw - - A shortcut to `CGAL::add_to_graphics_scene(arr, gs, Graphics_scene_options{})`. + * A shortcut to `CGAL::add_to_graphics_scene(arr, gs, + * Graphics_scene_options{})`. */ template void add_to_graphics_scene(const Arrangement_2& arr, diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h new file mode 100644 index 00000000000..90b53ff56e5 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximatePointTraits_2.h @@ -0,0 +1,50 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits + * \cgalConcept + * + * The concept `AosApproximatePointTraits_2` refines the basic traits concept + * `AosBasicTraits_2`. A model of this concept is able to approximate a point. + * + * \cgalRefines{AosBasicTraits_2} + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_circle_segment_traits_2} + * \cgalHasModels{CGAL::Arr_conic_traits_2} + * \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2} + * \cgalHasModels{CGAL::Arr_linear_traits_2} + * \cgalHasModels{CGAL::Arr_non_caching_segment_traits_2} + * \cgalHasModels{CGAL::Arr_segment_traits_2} + * \cgalHasModels{CGAL::Arr_polycurve_traits_2} + * \cgalHasModels{CGAL::Arr_polyline_traits_2} + * \cgalHasModels{CGAL::Arr_rational_function_traits_2} + * \cgalHasModelsEnd + * + * \sa `AosConstructXMonotoneCurveTraits_2` + * \sa `AosXMonotoneTraits_2` + * \sa `AosTraits_2` + */ +class AosApproximatePointTraits_2 { +public: + /// \name Types + /// @{ + + //! the number type used to approximate point coordinates, e.g., double. + typedef unspecified_type Approximate_number_type; + + /// @} + + /// \name Functor Types + /// @{ + + /// models the concept `AosTraits::Approximate_2`. + typedef unspecified_type Approximate_2; + + /// @} + + /// \name Accessing Functor Objects + /// @{ + + /// + Approximate_2 approximate_2_object() const; + + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h new file mode 100644 index 00000000000..2020e723039 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosApproximateTraits_2.h @@ -0,0 +1,47 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits + * \cgalConcept + * + * The concept `AosApproximateTraits_2` refines the concept + * `AosApproximatePointTraits_2`. A model of this concept is able to + * approximate a point and a curve (in addition to the ability to approximate the + * coordinates of a point). + * + * \cgalRefines{AosApproximatePointTraits_2} + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_circle_segment_traits_2} + * \cgalHasModels{CGAL::Arr_conic_traits_2} + * \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2} + * \cgalHasModels{CGAL::Arr_polyline_traits_2} + * \cgalHasModels{CGAL::Arr_segment_traits_2} + * \cgalHasModelsEnd + * + * \sa `AosApproximatePointTraits_2` + * \sa `draw()` + */ +class AosApproximateTraits_2 { +public: + /// \name Types + /// @{ + + //! the approximate point. + typedef unspecified_type Approximate_point_2; + + /// @} + + /// \name Functor Types + /// @{ + + /// models the concept `AosTraits::Approximate_2`. + typedef unspecified_type Approximate_2; + + /// @} + + /// \name Accessing Functor Objects + /// @{ + + /// + Approximate_2 approximate_2_object() const; + + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBasicTopologyTraits.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBasicTopologyTraits.h similarity index 75% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBasicTopologyTraits.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBasicTopologyTraits.h index 76c42cc2114..36810c0be8a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBasicTopologyTraits.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBasicTopologyTraits.h @@ -1,7 +1,7 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTopologyTraits * \cgalConcept * - * The concept `ArrangementBasicTopologyTraits` defines the minimal + * The concept `AosBasicTopologyTraits` defines the minimal * functionality needed for a model of a topology traits, which can substitutes * the `TopolTraits` template parameters when the class template * `Arrangement_on_surface_2` is instantiated. In @@ -13,19 +13,18 @@ * \cgalHasModels{CGAL::Arr_spherical_topology_traits_2} * \cgalHasModelsEnd */ - -class ArrangementBasicTopologyTraits { +class AosBasicTopologyTraits { public: /// \name Types /// @{ - //! models the concept `ArrTraits::Point_2`. + /// models the concept `AosTraits::Point_2`. typedef unspecified_type Point_2; - //! models the concept `ArrTraits::XMonotoneCurve_2`. + /// models the concept `AosTraits::XMonotoneCurve_2`. typedef unspecified_type X_monotone_curve_2; - //! models the concept `ArrangementDcel`. + /// models the concept `AosDcel`. typedef unspecified_type Dcel; /// @} @@ -38,10 +37,10 @@ public: /// \name Access Functions /// @{ - /*! obtains the DCEL (const version). */ + /*! obtains the \dcel (const version). */ const Dcel& dcel() const; - /*! obtains the DCEL (non-const version). */ + /*! obtains the \dcel (non-const version). */ Dcel& dcel(); /// @} @@ -49,5 +48,4 @@ public: /// \name Modifiers /// @{ /// @} - }; diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBasicTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBasicTraits_2.h similarity index 71% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBasicTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBasicTraits_2.h index 3771c0af1e0..3a974fc6086 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBasicTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBasicTraits_2.h @@ -1,23 +1,23 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * The concept `ArrangementBasicTraits_2` defines the minimal set of geometric + * The concept `AosBasicTraits_2` defines the minimal set of geometric * predicates needed for the construction and maintenance of objects of the * class `Arrangement_2`, as well as performing simple queries (such as * point-location queries) on such arrangements. * * A model of this concept must define nested `Point_2` and `X_monotone_curve_2` - * types, which represent planar points and continuous \f$ x\f$-monotone curves + * types, which represent planar points and continuous \f$x\f$-monotone curves * (a vertical segment is also considered to be weakly \f$ - * x\f$-monotone), respectively. The \f$ x\f$-monotone curves are assumed to be + * x\f$-monotone), respectively. The \f$x\f$-monotone curves are assumed to be * pairwise disjoint in their interiors, so they do not intersect except at * their endpoints. * * The `X_monotone_curve_2` curves of an arrangement are confined to an * iso-rectangular area called the parameter space. The iso-rectangule can be * unbounded, open, or closed. The set of predicates provided by a model the - * concept `ArrangementBasicTraits_2` is sufficient for constructing - * arrangements of \f$ x\f$-monotone curves that do not reach or approach the + * concept `AosBasicTraits_2` is sufficient for constructing + * arrangements of \f$x\f$-monotone curves that do not reach or approach the * boundary of the parameter space. The nature of the input curves, whether they * are expected to reach or approach the left, right, bottom, or top side of the * boundary of the parameter space, are conveyed through the definition of four @@ -45,19 +45,15 @@ * \cgalHasModels{CGAL::Arr_consolidated_curve_data_traits_2} * \cgalHasModelsEnd */ - -class ArrangementBasicTraits_2 { +class AosBasicTraits_2 { public: - /// \name Types /// @{ - /*! models the concept `ArrTraits::Point_2`. - */ + /// models the concept `AosTraits::Point_2`. typedef unspecified_type Point_2; - /*! models the concept `ArrTraits::XMonotoneCurve_2`. - */ + /// models the concept `AosTraits::XMonotoneCurve_2`. typedef unspecified_type X_monotone_curve_2; /// @} @@ -65,24 +61,19 @@ public: /// \name Categories /// @{ - /*! indicates whether the nested functor `Compare_at_x_left_2` is provided. - */ + /// indicates whether the nested functor `Compare_at_x_left_2` is provided. typedef unspecified_type Has_left_category; - /*! Must be convertible to `CGAL::Arr_oblivious_side_tag`. - */ + /// Must be convertible to `CGAL::Arr_oblivious_side_tag`. typedef unspecified_type Left_side_category; - /*! Must be convertible to `CGAL::Arr_oblivious_side_tag`. - */ + /// Must be convertible to `CGAL::Arr_oblivious_side_tag`. typedef unspecified_type Bottom_side_category; - /*! Must be convertible to `CGAL::Arr_oblivious_side_tag`. - */ + /// Must be convertible to `CGAL::Arr_oblivious_side_tag`. typedef unspecified_type Top_side_category; - /*!Must be convertible to `CGAL::Arr_oblivious_side_tag`. - */ + /// Must be convertible to `CGAL::Arr_oblivious_side_tag`. typedef unspecified_type Right_side_category; /// @} @@ -90,40 +81,35 @@ public: /// \name Functor Types /// @{ - /*! models the concept `ArrTraits::CompareX_2`. - */ + /// models the concept `AosTraits::CompareX_2`. typedef unspecified_type Compare_x_2; - /*! models the concept `ArrTraits::CompareXy_2`. - */ + /// models the concept `AosTraits::CompareXy_2`. typedef unspecified_type Compare_xy_2; - /*! models the concept `ArrTraits::ConstructMinVertex_2`. - */typedef unspecified_type Construct_min_vertex_2; + /// models the concept `AosTraits::ConstructMinVertex_2`. + typedef unspecified_type Construct_min_vertex_2; - /*! models the concept `ArrTraits::ConstructMaxVertex_2`. - */ + /// models the concept `AosTraits::ConstructMaxVertex_2`. typedef unspecified_type Construct_max_vertex_2; - /*! models the concept `ArrTraits::IsVertical_2`. + /*! models the concept `AosTraits::IsVertical_2`. */ typedef unspecified_type Is_vertical_2; - /*! models the concept `ArrTraits::CompareYAtX_2`. + /*! models the concept `AosTraits::CompareYAtX_2`. */ typedef unspecified_type Compare_y_at_x_2; - /*! models the concept `ArrTraits::CompareYAtXLeft_2`. Required only if the + /*! models the concept `AosTraits::CompareYAtXLeft_2`. Required only if the * `Has_left_category` category is convertible to `Tag_true`. */ typedef unspecified_type Compare_y_at_x_left_2; - /*! models the concept `ArrTraits::CompareYAtXRight_2`. - */ + /// models the concept `AosTraits::CompareYAtXRight_2`. typedef unspecified_type Compare_y_at_x_right_2; - /*! models the concept `ArrTraits::Equal_2`. - */ + /// models the concept `AosTraits::Equal_2`. typedef unspecified_type Equal_2; /// @} @@ -131,33 +117,32 @@ public: /// \name Accessing Functor Objects /// @{ - //! + /// Compare_x_2 compare_x_2_object() const; - //! + /// Compare_xy_2 compare_xy_2_object() const; - //! + /// Construct_min_vertex_2 construct_min_vertex_2_object() const; - //! + /// Construct_max_vertex_2 construct_max_vertex_2_object() const; - //! + /// Is_vertical_2 is_vertical_2_object() const; - //! + /// Compare_y_at_x_2 compare_y_at_x_2_object() const; - //! + /// Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const; - //! + /// Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const; - //! + /// Equal_2 equal_2_object() const; /// @} - -}; /* end ArrangementBasicTraits_2 */ +}; /* end AosBasicTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBottomSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBottomSideTraits_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBottomSideTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBottomSideTraits_2.h index a29b1d33531..611b72751a6 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBottomSideTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosBottomSideTraits_2.h @@ -1,8 +1,7 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * `ArrangementBottomSideTraits_2` is an abstract concept. It generalizes all + * `AosBottomSideTraits_2` is an abstract concept. It generalizes all * concepts that handle curves that either reach or approach the bottom boundary * side of the parameter space. (An "abstract" concept is a concept that is * useless on its own.) Only a combination of this concept and additional @@ -10,14 +9,13 @@ * boundary sides (that is, left, right, and top) are purposeful, and can have * models. * - * \cgalRefines{ArrangementHorizontalSideTraits_2} + * \cgalRefines{AosHorizontalSideTraits_2} * - * \sa `ArrangementLeftSideTraits_2`, - * `ArrangementRightSideTraits_2`, and - * `ArrangementTopSideTraits_2` + * \sa `AosLeftSideTraits_2` + * \sa `AosRightSideTraits_2` + * \sa `AosTopSideTraits_2` */ - -class ArrangementBottomSideTraits_2 { +class AosBottomSideTraits_2 { public: /// \name Categories /// @{ @@ -29,6 +27,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedBottomTraits_2.h similarity index 57% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedBottomTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedBottomTraits_2.h index 37a519a7eca..2c5ba88de4a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedBottomTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedBottomTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementClosedBottomTraits_2` must be used when + * A model of the concept `AosClosedBottomTraits_2` must be used when * the parameter space of the surface, the arrangement is embedded on, is closed * on the left side and curves inserted into the arrangement are expected to * reach this boundary side. A model of this concept can handle curves that * reach the left boundary side when it is closed. * - * \cgalRefines{ArrangementBottomSideTraits_2} + * \cgalRefines{AosBottomSideTraits_2} * - * \sa `ArrangementClosedLeftTraits_2`, - * `ArrangementClosedRightTraits_2`, - * `ArrangementClosedTopTraits_2`, - * `ArrangementOpenBottomTraits_2`, - * `ArrangementContractedBottomTraits_2`, and - * `ArrangementIdentifiedHorizontalTraits_2` + * \sa `AosClosedLeftTraits_2` + * \sa `AosClosedRightTraits_2` + * \sa `AosClosedTopTraits_2` + * \sa `AosOpenBottomTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosIdentifiedHorizontalTraits_2` */ - -class ArrangementClosedBottomTraits_2 { +class AosClosedBottomTraits_2 { public: /// \name Categories /// @{ @@ -34,7 +32,7 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::CompareXOnBoundary_2`. + /// models the concept `AosTraits::CompareXOnBoundary_2`. typedef unspecified_type Compare_x_on_boundary_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedLeftTraits_2.h similarity index 57% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedLeftTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedLeftTraits_2.h index ec84ff22035..5cb13cd8ccb 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedLeftTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedLeftTraits_2.h @@ -1,30 +1,28 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementClosedLeftTraits_2` must be used when the + * A model of the concept `AosClosedLeftTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is closed on * the left side and curves inserted into the arrangement are expected to reach * this boundary side. A model of this concept can handle curves that reach the * left boundary side when it is closed. - - * \cgalRefines{ArrangementLeftSideTraits_2} - -\sa `ArrangementClosedRightTraits_2`, - `ArrangementClosedBottomTraits_2`, - `ArrangementClosedTopTraits_2`, - `ArrangementOpenLeftTraits_2`, - `ArrangementContractedLeftTraits_2`, and - `ArrangementIdentifiedVerticalTraits_2`, -*/ - -class ArrangementClosedLeftTraits_2 { + * + * \cgalRefines{AosLeftSideTraits_2} + * + * \sa `AosClosedRightTraits_2` + * \sa `AosClosedBottomTraits_2` + * \sa `AosClosedTopTraits_2` + * \sa `AosOpenLeftTraits_2` + * \sa `AosContractedLeftTraits_2` + * \sa `AosIdentifiedVerticalTraits_2` + */ +class AosClosedLeftTraits_2 { public: /// \name Categories /// @{ /*! Must be convertible to `CGAL::Arr_closed_side_tag`. - */ + */ typedef unspecified_type Left_side_category; /// @} @@ -35,7 +33,7 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::CompareYOnBoundary_2`. + /// models the concept `AosTraits::CompareYOnBoundary_2`. typedef unspecified_type Compare_y_on_boundary_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedRightTraits_2.h similarity index 57% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedRightTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedRightTraits_2.h index 4b4dc18d53d..b5f22fda9d3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedRightTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedRightTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementClosedRightTraits_2` must be used when the + * A model of the concept `AosClosedRightTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is closed on * the right side and curves inserted into the arrangement are expected to reach * this boundary side. A model of this concept can handle curves that reach the * right boundary side when it is closed. * - * \cgalRefines{ArrangementRightSideTraits_2} + * \cgalRefines{AosRightSideTraits_2} * - * \sa `ArrangementClosedLeftTraits_2`, - * `ArrangementClosedBottomTraits_2`, - * `ArrangementClosedTopTraits_2`, - * `ArrangementOpenRightTraits_2`, - * `ArrangementContractedRightTraits_2`, and - * `ArrangementIdentifiedVerticalTraits_2`, + * \sa `AosClosedLeftTraits_2` + * \sa `AosClosedBottomTraits_2` + * \sa `AosClosedTopTraits_2` + * \sa `AosOpenRightTraits_2` + * \sa `AosContractedRightTraits_2` + * \sa `AosIdentifiedVerticalTraits_2` */ - -class ArrangementClosedRightTraits_2 { +class AosClosedRightTraits_2 { public: /// \name Categories /// @{ @@ -34,7 +32,7 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::CompareYOnBoundary_2`. + /// models the concept `AosTraits::CompareYOnBoundary_2`. typedef unspecified_type Compare_y_on_boundary_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedTopTraits_2.h similarity index 57% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedTopTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedTopTraits_2.h index e03e3bfa938..7d8867770bf 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedTopTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosClosedTopTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementClosedTopTraits_2` must be used when the + * A model of the concept `AosClosedTopTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is closed on * the top side and curves inserted into the arrangement are expected to reach * this boundary side. A model of this concept can handle curves that reach the * top boundary side when it is closed. * - * \cgalRefines{ArrangementTopSideTraits_2} + * \cgalRefines{AosTopSideTraits_2} * - * \sa `ArrangementClosedLeftTraits_2`, - * `ArrangementClosedRightTraits_2`, - * `ArrangementClosedBottomTraits_2`, - * `ArrangementOpenTopTraits_2`, - * `ArrangementContractedTopTraits_2`, and - * `ArrangementIdentifiedHorizontalTraits_2` + * \sa `AosClosedLeftTraits_2` + * \sa `AosClosedRightTraits_2` + * \sa `AosClosedBottomTraits_2` + * \sa `AosOpenTopTraits_2` + * \sa `AosContractedTopTraits_2` + * \sa `AosIdentifiedHorizontalTraits_2` */ - -class ArrangementClosedTopTraits_2 { +class AosClosedTopTraits_2 { public: /// \name Categories /// @{ @@ -34,7 +32,7 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::CompareXOnBoundary_2`. + /// models the concept `AosTraits::CompareXOnBoundary_2`. typedef unspecified_type Compare_x_on_boundary_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementConstructCurveTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosConstructCurveTraits_2.h similarity index 69% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementConstructCurveTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosConstructCurveTraits_2.h index 570967c2932..cab23b645c3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementConstructCurveTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosConstructCurveTraits_2.h @@ -1,11 +1,11 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * The concept `ArrangementConstructCurveTraits_2` refines the basic - * traits concept `ArrangementBasicTraits_2`. A model of this concept is able + * The concept `AosConstructCurveTraits_2` refines the basic + * traits concept `AosBasicTraits_2`. A model of this concept is able * to construct a curve from two points. * - * \cgalRefines{ArrangementTraits_2} + * \cgalRefines{AosTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_conic_traits_2} @@ -17,15 +17,15 @@ * \cgalHasModels{CGAL::Arr_rational_function_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementConstructXMonotoneCurveTraits_2`, and - * `ArrangementTraits_2` + * \sa `AosConstructXMonotoneCurveTraits_2` + * \sa `AosTraits_2` */ -class ArrangementConstructCurveTraits_2 { +class AosConstructCurveTraits_2 { public: /// \name Functor Types /// @{ - /*! models the concept `ArrTraits::ConstructCurve_2`. + /*! models the concept `AosTraits::ConstructCurve_2`. */ typedef unspecified_type Construct_curve_2; diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementConstructXMonotoneCurveTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosConstructXMonotoneCurveTraits_2.h similarity index 60% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementConstructXMonotoneCurveTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosConstructXMonotoneCurveTraits_2.h index 6d0a822280e..66261e41f76 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementConstructXMonotoneCurveTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosConstructXMonotoneCurveTraits_2.h @@ -1,11 +1,11 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * The concept `ArrangementConstructXMonotoneCurveTraits_2` refines the basic - * traits concept `ArrangementBasicTraits_2`. A model of this concept is able to - * construct an \f$ x\f$-monotone curve from two points. + * The concept `AosConstructXMonotoneCurveTraits_2` refines the basic + * traits concept `AosBasicTraits_2`. A model of this concept is able to + * construct an \f$x\f$-monotone curve from two points. * - * \cgalRefines{ArrangementBasicTraits_2} + * \cgalRefines{AosBasicTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_conic_traits_2} @@ -17,17 +17,17 @@ * \cgalHasModels{CGAL::Arr_rational_function_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementApproximateTraits_2`, - * `ArrangementXMonotoneTraits_2` - * `ArrangementTraits_2`, and - * `ArrangementConstructCurveTraits_2`. + * \sa `AosApproximatePointTraits_2` + * \sa `AosXMonotoneTraits_2` + * \sa `AosTraits_2` + * \sa `AosConstructCurveTraits_2` */ -class ArrangementConstructXMonotoneCurveTraits_2 { +class AosConstructXMonotoneCurveTraits_2 { public: /// \name Functor Types /// @{ - /*! models the concept `ArrTraits::ConstructXMonotoneCurve_2`. + /*! models the concept `AosTraits::ConstructXMonotoneCurve_2`. */ typedef unspecified_type Construct_x_monotone_curve_2; @@ -36,8 +36,7 @@ public: /// \name Accessing Functor Objects /// @{ - /*! - */ + /// Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedBottomTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedBottomTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedBottomTraits_2.h index 09de38a67c5..858ff1b2173 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedBottomTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedBottomTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementContractedBottomTraits_2` must be used + * A model of the concept `AosContractedBottomTraits_2` must be used * when the parameter space of the surface, the arrangement is embedded on, is * contracted on the bottom side and curves inserted into the arrangement are * expected to reach this boundary side. A model of this concept can handle * curves that reach the bottom boundary side when it is contracted. * - * \cgalRefines{ArrangementBottomSideTraits_2} + * \cgalRefines{AosBottomSideTraits_2} * - * \sa `ArrangementContractedLeftTraits_2`, - * `ArrangementContractedRightTraits_2`, - * `ArrangementContractedTopTraits_2`, - * `ArrangementClosedBottomTraits_2`, - * `ArrangementContractedBottomTraits_2`, and - * `ArrangementIdentifiedHorizontalTraits_2` + * \sa `AosContractedLeftTraits_2` + * \sa `AosContractedRightTraits_2` + * \sa `AosContractedTopTraits_2` + * \sa `AosClosedBottomTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosIdentifiedHorizontalTraits_2` */ - -class ArrangementContractedBottomTraits_2 { +class AosContractedBottomTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +31,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedLeftTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedLeftTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedLeftTraits_2.h index 9a06f1e409c..d4bb30cf67b 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedLeftTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedLeftTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementContractedLeftTraits_2` must be used when + * A model of the concept `AosContractedLeftTraits_2` must be used when * the parameter space of the surface, the arrangement is embedded on, is * contracted on the left side and curves inserted into the arrangement are * expected to reach this boundary side. A model of this concept can handle * curves that reach the left boundary side when it is contracted. * - * \cgalRefines{ArrangementLeftSideTraits_2} + * \cgalRefines{AosLeftSideTraits_2} * - * \sa `ArrangementContractedRightTraits_2`, - * `ArrangementContractedBottomTraits_2`, - * `ArrangementContractedTopTraits_2`, - * `ArrangementOpenLeftTraits_2`, - * `ArrangementClosedLeftTraits_2`, and - * `ArrangementIdentifiedVerticalTraits_2` + * \sa `AosContractedRightTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosContractedTopTraits_2` + * \sa `AosOpenLeftTraits_2` + * \sa `AosClosedLeftTraits_2` + * \sa `AosIdentifiedVerticalTraits_2` */ - -class ArrangementContractedLeftTraits_2 { +class AosContractedLeftTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +31,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedRightTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedRightTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedRightTraits_2.h index 3f93d80deb2..6b6bfc1c141 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedRightTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedRightTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementContractedRightTraits_2` must be used when + * A model of the concept `AosContractedRightTraits_2` must be used when * the parameter space of the surface, the arrangement is embedded on, is * contracted on the right side and curves inserted into the arrangement are * expected to reach this boundary side. A model of this concept can handle * curves that reach the right boundary side when it is contracted. * - * \cgalRefines{ArrangementRightSideTraits_2} + * \cgalRefines{AosRightSideTraits_2} * - * \sa `ArrangementContractedLeftTraits_2`, - * `ArrangementContractedBottomTraits_2`, - * `ArrangementContractedTopTraits_2`, - * `ArrangementOpenRightTraits_2`, - * `ArrangementClosedRightTraits_2`, and - * `ArrangementIdentifiedVerticalTraits_2` + * \sa `AosContractedLeftTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosContractedTopTraits_2` + * \sa `AosOpenRightTraits_2` + * \sa `AosClosedRightTraits_2` + * \sa `AosIdentifiedVerticalTraits_2` */ - -class ArrangementContractedRightTraits_2 { +class AosContractedRightTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +31,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedTopTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedTopTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedTopTraits_2.h index be39ea2b6b1..8ee739fc15c 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedTopTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosContractedTopTraits_2.h @@ -1,24 +1,22 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementContractedTopTraits_2` must be used when + * A model of the concept `AosContractedTopTraits_2` must be used when * the parameter space of the surface, the arrangement is embedded on, is * contracted on the top side and curves inserted into the arrangement are * expected to reach this boundary side. A model of this concept can handle * curves that reach the top boundary side when it is contracted. * - * \cgalRefines{ArrangementTopSideTraits_2} + * \cgalRefines{AosTopSideTraits_2} * - * \sa `ArrangementContractedLeftTraits_2`, - * `ArrangementContractedRightTraits_2`, - * `ArrangementContractedBottomTraits_2`, - * `ArrangementOpenTopTraits_2`, - * `ArrangementSlosedTopTraits_2`, and - * `ArrangementIdentifiedHorizontalTraits_2` + * \sa `AosContractedLeftTraits_2` + * \sa `AosContractedRightTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosOpenTopTraits_2` + * \sa `AosSlosedTopTraits_2` + * \sa `AosIdentifiedHorizontalTraits_2` */ - -class ArrangementContractedTopTraits_2 { +class AosContractedTopTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +31,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcel.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcel.h new file mode 100644 index 00000000000..ccbca2074c2 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcel.h @@ -0,0 +1,232 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * A doubly-connected edge-list (\dcel for short) data-structure. It consists of + * three containers of records: vertices \f$V\f$, halfedges \f$E\f$, and faces + * \f$F\f$. It maintains the incidence relation among them. The halfedges are + * ordered in pairs sometimes referred to as twins, such that each halfedge pair + * represent an edge. + * + * A model of the `AosDcel` concept must provide the following types and + * operations. (In addition to the requirements here, the local types + * `Vertex`,`Halfedge`, `Face`, `Outer_ccb`, `Inner_ccb`, and `Isolated_vertex` + * must be models of the concepts `AosDcelVertex`, + * `AosDcelHalfedge`, `AosDcelFace`, `AosDcelOuterCcb`, + * `AosDcelInnerCcb`, and `AosDcelIsolatedVertex` respectively.) + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_dcel_base} + * \cgalHasModels{CGAL::Arr_default_dcel} + * \cgalHasModels{CGAL::Arr_face_extended_dcel} + * \cgalHasModels{CGAL::Arr_extended_dcel} + * \cgalHasModelsEnd + * + * \sa `AosDcelVertex` + * \sa `AosDcelHalfedge` + * \sa `AosDcelFace` + * \sa `AosDcelOuterCcb` + * \sa `AosDcelInnerCcb` + * \sa `AosDcelIsolatedVertex` + */ + +class AosDcel { +public: + /// \name Types + /// @{ + + /// the vertex type. + typedef unspecified_type Vertex; + + /// the halfedge type. + typedef unspecified_type Halfedge; + + /// the face type. + typedef unspecified_type Face; + + /// the Outer CCB type. + typedef unspecified_type Outer_ccb; + + /// the Inner CCB type. + typedef unspecified_type Inner_ccb; + + /// the hole (i.e., Inner_ccb) type. + typedef unspecified_type Hole; + + /// the isolated vertex type. + typedef unspecified_type Isolated_vertex; + + /// used to represent size values (e.g., `std::size_t`). + typedef unspecified_type Size; + + /// a bidirectional iterator over the vertices. Its value-type is `Vertex`. + typedef unspecified_type Vertex_iterator; + + /// a bidirectional iterator over the vertices. Its value-type is `Vertex`. + typedef unspecified_type Vertex_const_iterator; + + /// a bidirectional iterator over the halfedges. Its value-type is `Halfedge`. + typedef unspecified_type Halfedge_iterator; + + /// a bidirectional iterator over the halfedges. Its value-type is `Halfedge`. + typedef unspecified_type Halfedge_const_iterator; + + /// a bidirectional iterator over the faces. Its value-type is `Face`. + typedef unspecified_type Face_iterator; + + /// a bidirectional iterator over the faces. Its value-type is `Face`. + typedef unspecified_type Face_const_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! constructs an empty \dcel with one unbounded face. + */ + Arr_dcel(); + + /*! assigns the contents of the `other` \dcel whose unbounded face is given by + * `uf`, to `dcel`. The function returns a pointer to the unbounded face of + * `dcel` after the assignment. + */ + Face* assign(const Self& other, const Face *uf); + + /// @} + + /// \name Access Functions + /// @{ + + /*! obtains the number of vertices. */ + Size size_of_vertices() const; + + /*! obtains the number of halfedges (always even). */ + Size size_of_halfedges() const; + + /*! obtains the number of faces. */ + Size size_of_faces() const; + + /*! obtains the number of outer CCBs. */ + Size size_of_outer_ccbs() const; + + /*! obtains the number of inner CCBs. */ + Size size_of_inner_ccbs() const; + + /*! obtains the number of holes (i.e., inner CCBs). */ + Size size_of_holes() const; + + /*! obtains the number of isolated vertices. */ + Size size_of_isolated_vertices() const; + + /*! obtains a begin-iterator of the vertices in `dcel`. */ + Vertex_iterator vertices_begin(); + + /*! obtains a past-the-end iterator of the vertices in `dcel`. */ + Vertex_iterator vertices_end(); + + /*! obtains a range over handles of the vertices in `dcel`. */ + unspecified_type vertex_handles(); + + /*! obtains a begin-iterator of the vertices in `dcel`. */ + Vertex_const_iterator vertices_begin() const; + + /*! obtains a past-the-end iterator of the vertices in `dcel`. */ + Vertex_const_iterator vertices_end() const; + + /*! obtains a const range (model of `ConstRange`) over handles of the vertices + * in `dcel`. + */ + unspecified_type vertex_handles() const; + + /*! obtains a begin-iterator of the halfedges in `dcel`. */ + Halfedge_iterator halfedges_begin(); + + /*! obtains a past-the-end iterator of the halfedges in `dcel`. */ + Halfedge_iterator halfedges_end(); + + /*! obtains a range over handles of the halfedges in `dcel`. */ + unspecified_type halfedge_handles(); + + /*! obtains a begin-iterator of the halfedges in `dcel`. */ + Halfedge_const_iterator halfedges_begin() const; + + /*! obtains a past-the-end iterator of the halfedges in `dcel`. */ + Halfedge_const_iterator halfedges_end() const; + + /*! obtains a const range (model of `ConstRange`) over handles of the halfedges + * in `dcel`. + */ + unspecified_type halfedge_handles() const; + + /*! obtains a begin-iterator of the faces in `dcel`. */ + Face_iterator faces_begin(); + + /*! obtains a past-the-end iterator of the faces in `dcel`. */ + Face_iterator faces_end(); + + /*! obtains a range over handles of the faces in `dcel`. */ + unspecified_type face_handles(); + + /*! obtains a begin-iterator of the faces in `dcel`. */ + Face_const_iterator faces_begin() const; + + /*! obtains a past-the-end iterator of the faces in `dcel`. */ + Face_const_iterator faces_end() const; + + /*! obtains a const range (model of `ConstRange`) over handles of the faces in + * `dcel`. + */ + unspecified_type face_handles() const; + + /// @} + + /// \name Modifiers + /// The following operations allocate a new element of the respective + /// type. Halfedges are always allocated in pairs of opposite + /// halfedges. The halfedges and their opposite pointers are + /// automatically set. + /// @{ + + /*! creates a new vertex. */ + Vertex* new_vertex(); + + /*! creates a new pair of twin halfedges. */ + Halfedge* new_edge(); + + /*! creates a new face. */ + Face* new_face(); + + /*! creates a new outer CCB record. */ + Hole* new_outer_ccb(); + + /*! creates a new inner CCB record. */ + Hole* new_inner_ccb(); + + /*! creates a new hole (i.e., inner CCB) record. */ + Hole* new_hole(); + + /*! creates a new isolated vertex record. */ + Isolated_vertex* new_isolated_vertex(); + + /*! deletes a given vertex `v`. */ + void delete_vertex(Vertex* v); + + /*! deletes a given halfedge `e` as well as its twin. */ + void delete_edge(Halfedge* e); + + /*! deletes a given face `f`. */ + void delete_face(Face* f); + + /*! deletes a given outer CCB `oc`. */ + void delete_outer_ccb(Outer_ccb* oc); + + /*! deletes a given inner CCB `ic`. */ + void delete_inner_ccb(Inner_ccb* oc); + + /*! deletes a given hole (i.e., inner CCB) `ho`. */ + void delete_hole(Hole* ho); + + /*! deletes a given isolated vertex `iv`. */ + void delete_isolated_vertex(Isolated_vertex* iv); + + /// @} +}; /* end AosDcel */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelFace.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelFace.h new file mode 100644 index 00000000000..595f69cf54d --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelFace.h @@ -0,0 +1,152 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * A face record in a \dcel data structure. A face represents a region, which + * may have outer and inner boundaries. A boundary conists of a chain of + * incident halfedges, referred to as a Connected Component of the Boundary + * (CCB). A face may be unbounded. Otherwise, it has one or more outer CCBs. A + * face may also be bounded by inner CCBs, and it may contain isolated vertices + * in its interior. A planar face may have only one outer CCBs and its inner + * CCBs are referred to as holes. + * + * \sa `AosDcel` + * \sa `AosDcelVertex` + * \sa `AosDcelHalfedge` + */ +class AosDcelFace { +public: + /// \name Types + /// The non-mutable iterators `Outer_ccb_const_iterator`, + /// `Inner_ccb_const_iterator`, `Hole_const_iterator`, and + /// `Isolated_vertex_const_iterator` are also defined. + /// @{ + + //! the corresponding \dcel vertex type. + typedef unspecified_type Vertex; + + //! the corresponding \dcel halfedge type. + typedef unspecified_type Halfedge; + + /*! a bidirectional iterator over the outer CCBs of the face. Its value-type + * is `Halfedge*`. + */ + typedef unspecified_type Outer_ccb_iterator; + + /*! a bidirectional iterator over the inner CCBs of the face. Its value-type + * is `Halfedge*`. + */ + typedef unspecified_type Inner_ccb_iterator; + + /*! a bidirectional iterator over the holes (i.e., inner CCBs) of the face. Its + * value-type is `Halfedge*`. + */ + typedef unspecified_type Hole_iterator; + + /*! a bidirectional iterator over the isolated vertices in inside the face. + * Its value-type is `Vertex*`. + */ + typedef unspecified_type Isolated_vertex_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. */ + Arr_dcel_face(); + + /*! assigns `f` with the contents of the `other` face. */ + void assign(const Self& other); + + /// @} + + /// \name Access Functions + /// All functions below also have `const` counterparts, returning + /// non-mutable pointers or iterators: + /// @{ + + /*! determines whether the face is unbounded. */ + bool is_unbounded() const; + + /*! obtains an incident halfedge along the outer boundaries of the face. If + * `f` has no outer boundary, the function returns `nullptr`. + */ + Halfedge* halfedge(); + + /*! obtains the number of outer CCBs of `f`. In case of planar arrangement + * this is either 0 or 1. + */ + std::size_t number_of_outer_ccbs() const; + + /*! obtains a begin iterator for the outer CCBs of `f`. */ + Outer_ccb_iterator outer_ccbs_begin(); + + /*! obtains a past-the-end iterator for the outer CCBs of `f`. */ + Outer_ccb_iterator outer_ccbs_end(); + + /*! obtains the number of inner CCBs of `f`. */ + std::size_t number_of_inner_ccbs() const; + + /*! obtains a begin iterator for the inner CCBs of `f`. */ + Inner_ccb_iterator inner_ccbs_begin(); + + /*! obtains a past-the-end iterator for the inner CCBs of `f`. */ + Inner_ccb_iterator inner_ccbs_end(); + + /*! obtains the number of holes (i.e., inner CCBs) inside `f`. */ + std::size_t number_of_holes() const; + + /*! obtains a begin-iterator for the holes (i.e., inner CCBs) of `f`. */ + Hole_iterator holes_begin(); + + /*! obtains a past-the-end iterator for the holes (i.e., inner CCBs) of `f`. */ + Hole_iterator holes_end(); + + /*! obtains the number of isolated vertices inside `f`. */ + std::size_t number_of_isolated_vertices() const; + + /*! obtains a begin-iterator for the isolated vertices inside `f`. */ + Isolated_vertex_iterator isolated_vertices_begin(); + + /*! obtains a past-the-end iterator for the isolated vertices inside `f`. */ + Isolated_vertex_iterator isolated_vertices_end(); + + /// @} + + /// \name Modifiers + /// @{ + + /*! sets the face as unbounded (if `flag` is `true`), or as a bounded face + * (if it is `false`). + */ + void set_unbounded(bool flag); + + /*! sets the incident halfedge. */ + void set_halfedge(Halfedge* e); + + /*! adds `e` as an outer CCB of `f`. */ + void add_outer_ccb(Halfedge* e); + + /*! removes the outer CCB that `it` points to from `f`. */ + void erase_outer_ccb(Outer_ccb_iterator it); + + /*! adds `e` as an inner CCB of `f`. */ + void add_inner_ccb(Halfedge* e); + + /*! removes the inner CCB that `it` points to from `f`. */ + void erase_inner_ccb(Inner_ccb_iterator it); + + /*! adds `e` as a hole (i.e., inner CCB) of `f`. */ + void add_hole(Halfedge* e); + + /*! removes the hole (i.e., inner CCB) that `it` points to from `f`. */ + void erase_hole(Hole_iterator it); + + /*! adds `v` as an isolated vertex inside `f`. */ + void add_isolated_vertex(Vertex* v); + + /*! removes the isolated vertex that `it` points to from inside `f`. */ + void erase_isolated_vertex(Isolated_vertex_iterator it); + + /// @} +}; /* end AosDcelFace */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelHalfedge.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelHalfedge.h new file mode 100644 index 00000000000..bd1cadb977a --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelHalfedge.h @@ -0,0 +1,157 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * A halfedge record in a \dcel data structure. Two halfedges with opposite + * directions always form an edge (a halfedge pair). The halfedges form together + * chains, defining the boundaries of connected components, such that all + * halfedges along a chain have the same incident face. Note that the chain the + * halfedge belongs to may form the outer boundary of a bounded face (an outer + * CCB) or the boundary of a hole inside a face (an inner CCB). + * + * An edge is always associated with a curve, but the halfedge records only + * store a pointer to the associated curve, and the actual curve objects are + * stored elsewhere. Two opposite halfedges are always associated with the same + * curve. + * + * \sa `AosDcel` + * \sa `AosDcelVertex` + * \sa `AosDcelFace` + * \sa `AosDcelOuterCcb` + * \sa `AosDcelInnerCcb` + */ + +class AosDcelHalfedge { +public: + /// \name Types + /// @{ + + //! the corresponding \dcel vertex type. + typedef unspecified_type Vertex; + + //! the corresponding \dcel face type. + typedef unspecified_type Face; + + //! the corresponding \dcel hole type. + typedef unspecified_type Hole; + + //! the curve type associated with the edge. + typedef unspecified_type X_monotone_curve; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + Arr_dcel_halfedge(); + + /*! assigns `e` with the contents of the `other` halfedge. + */ + void assign(const Self& other); + + /// @} + + /// \name Access Functions + /// @{ + + /*! returns `ARR_LEFT_TO_RIGHT` if `e`'s source vertex is + * lexicographically smaller than it target, and + * `ARR_RIGHT_TO_LEFT` if it is lexicographically larger than the target. + */ + Arr_halfedge_direction direction() const; + + /*! determines whether the `e` lies on an outer CCB of a bounded face, + * or on an inner CCB (a hole inside a face). The function returns `true` + * if `e` lies on a hole. + */ + bool is_on_hole() const; + + /// @} + + /// \name + /// All functions below also have `const` counterparts, returning non-mutable + /// pointers or references: + /// @{ + + /*! returns the twin halfedge. + */ + Halfedge* opposite(); + + /*! returns the previous halfedge along the chain. + */ + Halfedge* prev(); + + /*! returns the next halfedge along the chain. + */ + Halfedge* next(); + + /*! returns the target vertex. + */ + Vertex* vertex(); + + /*! returns the incident face. + * + * \pre `e` lies on the outer boundary of this face. + */ + Face* face(); + + /*! returns the hole (inner CCB) `e` belongs to. + * + * \pre `e` lies on a hole inside its incident face. + */ + Hole* hole(); + + /*! returns whether the vertex is not associated with a valid curve. + */ + bool has_null_curve() const; + + /*! returns the associated curve. + * \pre `e` is associated with a valid curve. + */ + X_monotone_curve& curve(); + + /// @} + + /// \name Modifiers + /// @{ + + /*! sets the opposite halfedge. + */ + void set_opposite(Halfedge* opp); + + /*! sets the lexicographical order between `e`'s source and target + * vertices to be `dir`. The direction of the opposite halfedge is also set + * to the opposite direction. + */ + void set_direction(Arr_halfedge_direction dir); + + /*! sets the previous halfedge of `e` along the chain, + * and updates the cross-pointer `prev->next()`. + */ + void set_prev(Halfedge* prev); + + /*! sets the next halfedge of `e` along the chain, + * and updates the cross-pointer `next->prev()`. + */ + void set_next(Halfedge* next); + + /*! sets the target vertex. + */ + void set_vertex(Vertex* v); + + /*! sets the incident face, marking that `e` lies on the outer CCB + * of the face `f`. + */ + void set_face(Face* f); + + /*! sets the incident hole, marking that `e` lies on an inner CCB. + */ + void set_hole(Hole* ho); + + /*! sets the associated curve of `e` and its opposite halfedge. + */ + void set_curve(X_monotone_curve* c); + + /// @} +}; /* end AosDcelHalfedge */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelInnerCcb.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelInnerCcb.h new file mode 100644 index 00000000000..3c436b30ac3 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelInnerCcb.h @@ -0,0 +1,56 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * A hole record in a Dcel data structure, which + * stores the face that contains the hole in its interior, along with an + * iterator for the hole in the holes' container of this face. + * + * \sa `AosDcel` + * \sa `AosDcelFace` + */ + +class AosDcelInnerCcb { +public: + /// \name Types + /// @{ + + /*! the corresponding Dcel face type. */ + typedef unspecified_type Face; + + /*! + */ + typedef Face::InnerCcb_iterator InnerCcb_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. */ + Arr_dcel_hole(); + + /// @} + + /// \name Access Functions + /// All functions below also have `const` counterparts, returning non-mutable pointers or iterators: + /// @{ + + /*! returns the incident face, which contains `ho` in its interior. */ + Face* face(); + + /*! returns an iterator for the hole. */ + InnerCcb_iterator iterator(); + + /// @} + + /// \name Modifiers + /// @{ + + /*! sets the incident face. */ + void set_face(Face* f); + + /*! sets the hole iterator. */ + void set_iterator(InnerCcb_iterator it); + + /// @} +}; /* end AosDcelInnerCcb */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelIsolatedVertex.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelIsolatedVertex.h new file mode 100644 index 00000000000..495e2e89076 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelIsolatedVertex.h @@ -0,0 +1,62 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * An isolated vertex-information record in a \dcel data structure, which stores + * the face that contains the isolated vertex in its interior, along with an + * iterator for the isolated vertex in the isolated vertices' container of this + * face. + * + * \sa `AosDcel` + * \sa `AosDcelFace` + */ + +class AosDcelIsolatedVertex { +public: + /// \name Types + /// @{ + + /// the corresponding \dcel face type. + typedef unspecified_type Face; + + /// + typedef Face::Isolated_vertex_iterator Isolated_vertex_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + Arr_dcel_isolated_vertex(); + + /// @} + + /// \name Access Functions + /// All functions below also have `const` counterparts, returning + /// non-mutable pointers or iterators: + /// @{ + + /*! returns the incident face, which contains `iv` in its interior. + */ + Face* face(); + + /*! returns an iterator for the isolated vertex. + */ + Isolated_vertex_iterator iterator(); + + /// @} + + /// \name Modifiers + /// @{ + + /*! sets the incident face. + */ + void set_face(Face* f); + + /*! sets the isolated vertex iterator. + */ + void set_iterator(Isolated_vertex_iterator it); + + /// @} +}; /* end AosDcelIsolatedVertex */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelOuterCcb.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelOuterCcb.h new file mode 100644 index 00000000000..7d87b8431ee --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelOuterCcb.h @@ -0,0 +1,59 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * A hole record in a \dcel data structure, which stores the face that contains + * the hole in its interior, along with an iterator for the hole in the holes' + * container of this face. + * + * \sa `AosDcel` + * \sa `AosDcelFace` + */ +class AosDcelOuterCcb { +public: + /// \name Types + /// @{ + + /// the corresponding \dcel face type. + typedef unspecified_type Face; + + /// + typedef Face::OuterCcb_iterator OuterCcb_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + Arr_dcel_hole(); + + /// @} + + /// \name Access Functions + /// All functions below also have `const` counterparts, returning non-mutable pointers or iterators: + /// @{ + + /*! returns the incident face, which contains `ho` in its interior. + */ + Face* face(); + + /*! returns an iterator for the hole. + */ + OuterCcb_iterator iterator(); + + /// @} + + /// \name Modifiers + /// @{ + + /*! sets the incident face. + */ + void set_face(Face* f); + + /*! sets the hole iterator. + */ + void set_iterator(OuterCcb_iterator it); + + /// @} +}; /* end AosDcelOuterCcb */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelVertex.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelVertex.h new file mode 100644 index 00000000000..be6f92b4b70 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelVertex.h @@ -0,0 +1,117 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * A vertex record in a \dcel data structure. A vertex is always associated + * with a point. However, the vertex record only stores a pointer to the + * associated point, and the actual `Point` object is stored elsewhere. + * + * A vertex usually has several halfedges incident to it, such that it is + * possible to access one of these halfedges directly and to traverse all + * incident halfedges around the vertex. However, the \dcel may also contain + * isolated vertices that have no incident halfedges. In this case, the vertex + * stores an isolated vertex-information record, indicating the face that + * contains this vertex in its interior. + * + * \sa `AosDcel` + * \sa `AosDcelHalfedge` + * \sa `AosDcelIsolatedVertex` + */ +class AosDcelVertex { +public: + /// \name Types + /// @{ + + /// the corresponding \dcel halfedge type. + typedef unspecified_type Halfedge; + + /// the corresponding \dcel isolated vertex-information type. + typedef unspecified_type Isolated_vertex; + + /// the point type associated with the vertex. + typedef unspecified_type Point; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + Arr_dcel_vertex(); + + /*! assigns `v` with the contents of the `other` vertex. + */ + void assign(const Self& other); + + /// @} + + /// \name Access Functions + /// All functions below also have `const` counterparts, returning + /// non-mutable pointers or references: + /// @{ + + /*! returns whether the vertex is isolated (has no incident halfedges). + */ + bool is_isolated() const; + + /*! returns an incident halfedge that has `v` as its target. + * + * \pre `v` is not an isolated vertex. + */ + Halfedge* halfedge(); + + /*! returns the isolated vertex-information record. + * + * \pre `v` is an isolated vertex. + */ + Isolated_vertex* isolated_vertex(); + + /*! returns whether the vertex is not associated with a valid point + * (i.e.\ it lies at infinity). + */ + bool has_null_point() const; + + /*! returns the associated point. + * + * \pre `v`() is associated with a valid point. + */ + Point& point(); + + /*! returns the placement of the \f$x\f$-coordinate in the parameter space, + * that is, either the left boundary-side, the interior, or the right + * boundary-side. + */ + Arr_parameter_space parameter_space_in_x() const; + + /*! returns the placement of the \f$y\f$-coordinate in the parameter space, + * that is, either the bottom boundary-side, the interior, or the top + * boundary-side. + */ + Arr_parameter_space parameter_space_in_y() const; + + /// @} + + /// \name Modifiers + /// @{ + + /*! sets the incident halfedge, marking `v` as a regular vertex. + */ + void set_halfedge(Halfedge* e); + + /*! sets the isolated vertex-information record, marking `v` + * as an isolated vertex. + */ + void set_isolated_vertex(Isolated_vertex* iv); + + /*! sets the associated point. + */ + void set_point(Point* p); + + /*! sets `v` as a vertex on a boundary side. + * + * \pre Either `inf_x` or `inf_y` is not `ARR_INTERIOR`. + */ + void set_boundary(Arr_parameter_space inf_x, Arr_parameter_space inf_y); + + /// @} +}; /* end AosDcelVertex */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelWithRebind.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelWithRebind.h new file mode 100644 index 00000000000..4aa18530dee --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosDcelWithRebind.h @@ -0,0 +1,44 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL + * \cgalConcept + * + * The concept `AosDcelWithRebind` refines the `AosDcel` concept by adding + * a policy clone idiom in form of a rebind struct-template. + * + * Instantiate a \dcel class with many different possible types without ad-hoc + * limitations on type of the \dcel classes. + * + * \cgalRefines{AosDcel} + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_default_dcel} + * \cgalHasModels{CGAL::Arr_dcel} + * \cgalHasModels{CGAL::Arr_face_extended_dcel} + * \cgalHasModels{CGAL::Arr_extended_dcel} + * \cgalHasModelsEnd + */ +class AosDcelWithRebind { +public: + /// \name Types + /// @{ + + /*! allows the instantiation of a model of the base concept + * `AosDcel` with a different possible geometry-traits + class without ad-hoc limitations on it. + * + * Following the standard clone policy, the rebind struct-template must + * have a nested type named `other` that defines the type of the + * model replica. + */ + typedef unspecified_type template rebind; + + /// @} + + /// \name Creation + /// @{ + + /*! constructs an empty \dcel with one unbounded face. + */ + Arr_dcel(); + + /// @} +}; /* end AosDcelWithRebind */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementHorizontalSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosHorizontalSideTraits_2.h similarity index 75% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementHorizontalSideTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosHorizontalSideTraits_2.h index e28c300acea..baa038464c5 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementHorizontalSideTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosHorizontalSideTraits_2.h @@ -1,7 +1,7 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * `ArrangementHorizontalSideTraits_2` is an abstract concept. It generalizes + * `AosHorizontalSideTraits_2` is an abstract concept. It generalizes * all concepts that handle curves that either reach or approach either the * bottom or top sizeds of the boundary of the parameter space. (An "abstract" * concept is a concept that is useless on its own.) Only a combination of this @@ -9,7 +9,7 @@ * approach the remaining boundary sides (that is, left and right) are * purposeful, and can have models. * - * \cgalRefines{ArrangementBasicTraits_2} + * \cgalRefines{AosBasicTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_linear_traits_2} @@ -18,12 +18,10 @@ * \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementVerticalSideTraits_2` + * \sa `AosVerticalSideTraits_2` */ - -class ArrangementHorizontalSideTraits_2 { +class AosHorizontalSideTraits_2 { public: - /// \name Categories /// @{ /// @} @@ -35,13 +33,13 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::ParameterSpaceInY_2`. + /// models the concept `AosTraits::ParameterSpaceInY_2`. typedef unspecified_type Parameter_space_in_y_2; - /// models the concept `ArrTraits::CompareXOnBoundaryOfCurveEnd_2`. + /// models the concept `AosTraits::CompareXOnBoundaryOfCurveEnd_2`. typedef unspecified_type Compare_x_on_boundary_2; - /// models the concept `ArrTraits::CompareXNearBoundary_2`. + /// models the concept `AosTraits::CompareXNearBoundary_2`. typedef unspecified_type Compare_x_near_boundary_2; /// @} @@ -53,4 +51,4 @@ public: Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const; /// @} -}; /* end ArrangementHorizontalSideTraits_2 */ +}; /* end AosHorizontalSideTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedHorizontalTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosIdentifiedHorizontalTraits_2.h similarity index 59% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedHorizontalTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosIdentifiedHorizontalTraits_2.h index 1e8603639d0..c95b6ee47d9 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedHorizontalTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosIdentifiedHorizontalTraits_2.h @@ -1,23 +1,22 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementIdentifiedHorizontalTraits_2` must be used + * A model of the concept `AosIdentifiedHorizontalTraits_2` must be used * when the parameter space of the surface, the arrangement is embedded on, is * identified on the bottom and top sides and curves inserted into the * arrangement are expected to reach these boundary sides. * - * \cgalRefines{ArrangementBasicTraits_2} + * \cgalRefines{AosBasicTraits_2} * - * \sa `ArrangementIdentifiedVerticalTraits_2`, - * `ArrangementOpenBottomTraits_2`, - * `ArrangementClosedBottomTraits_2`, and - * `ArrangementContractedBottomTraits_2` - * `ArrangementOpenTopTraits_2`, - * `ArrangementClosedTopTraits_2`, and - * `ArrangementContractedTopTraits_2` + * \sa `AosIdentifiedVerticalTraits_2` + * \sa `AosOpenBottomTraits_2` + * \sa `AosClosedBottomTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosOpenTopTraits_2` + * \sa `AosClosedTopTraits_2` + * \sa `AosContractedTopTraits_2` */ - -class ArrangementIdentifiedHorizontalTraits_2 { +class AosIdentifiedHorizontalTraits_2 { public: /// \name Categories /// @{ @@ -34,10 +33,10 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::CompareXOnBoundary_2`. + /// models the concept `AosTraits::CompareXOnBoundary_2`. typedef unspecified_type Compare_x_on_boundary_2; - /// models the concept `ArrTraits::IsOnXIdentification_2`. + /// models the concept `AosTraits::IsOnXIdentification_2`. typedef unspecified_type Is_on_x_identification_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedVerticalTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosIdentifiedVerticalTraits_2.h similarity index 53% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedVerticalTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosIdentifiedVerticalTraits_2.h index f42663dd8da..493596fbf18 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedVerticalTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosIdentifiedVerticalTraits_2.h @@ -1,23 +1,22 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementIdentifiedVerticalTraits_2` must be used - * when the parameter space of the surface, the arrangement is embedded on, is - * identified on the left and right sides and curves inserted into the + * A model of the concept `AosIdentifiedVerticalTraits_2` must be used + * when the parameter space of the surface, the arrangement is embedded on, + * is identified on the left and right sides and curves inserted into the * arrangement are expected to reach these boundary sides. * - * \cgalRefines{ArrangementBasicTraits_2} + * \cgalRefines{AosBasicTraits_2} * - * \sa `ArrangementIdentifiedHorizontalTraits_2`, - * `ArrangementOpenLeftTraits_2`, - * `ArrangementClosedLeftTraits_2`, and - * `ArrangementContractedLeftTraits_2` - * `ArrangementOpenRightTraits_2`, - * `ArrangementClosedRightTraits_2`, and - * `ArrangementContractedRightTraits_2` + * \sa `AosIdentifiedHorizontalTraits_2` + * \sa `AosOpenLeftTraits_2` + * \sa `AosClosedLeftTraits_2` + * \sa `AosContractedLeftTraits_2` + * \sa `AosOpenRightTraits_2` + * \sa `AosClosedRightTraits_2` + * \sa `AosContractedRightTraits_2` */ - -class ArrangementIdentifiedVerticalTraits_2 { +class AosIdentifiedVerticalTraits_2 { public: /// \name Categories /// @{ @@ -34,10 +33,10 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::CompareYOnBoundary_2`. + /// models the concept `AosTraits::CompareYOnBoundary_2`. typedef unspecified_type Compare_y_on_boundary_2; - /// models the concept `ArrTraits::IsOnYIdentification_2`. + /// models the concept `AosTraits::IsOnYIdentification_2`. typedef unspecified_type Is_on_y_identification_2; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosInputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosInputFormatter.h new file mode 100644 index 00000000000..daf23668c41 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosInputFormatter.h @@ -0,0 +1,202 @@ +/*! \ingroup PkgArrangementOnSurface2Concepts + * \cgalConcept + * + * A model for the `AosInputFormatter` concept supports a set of + * functions that enable reading an arrangement from an input stream using a + * specific format. + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_text_formatter} + * \cgalHasModels{CGAL::Arr_face_extended_text_formatter} + * \cgalHasModels{CGAL::Arr_extended_dcel_text_formatter} + * \cgalHasModelsEnd + */ +class AosInputFormatter { +public: + /// \name Types + /// @{ + + /// the type of arrangement to input. + typedef unspecified_type Arrangement_2; + + /// the point type. + typedef typename Arrangement_2::Point_2 Point_2; + + /// the \f$x\f$-monotone curve type. + typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; + + /// + typedef typename Arrangement_2::Size Size; + + /// + typedef typename Arrangement_2::Vertex_handle Vertex_handle; + + /// + typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; + + /// + typedef typename Arrangement_2::Face_handle Face_handle; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + Arr_in_formatter(); + + /*! constructs a formatter that reads from `is`. + */ + Arr_in_formatter(std::istream& is); + + /*! directs `inf` to read from `is`. + */ + void set_in(std::istream& is); + + /// @} + + /// \name Access Functions + /// @{ + + /*! returns the stream that `inf` reads from. + * \pre `inf` is directed to a valid output stream. + */ + std::istream& in(); + + /// @} + + /// \name Formatted Input Functions + /// @{ + + /*! reads a message indicating the beginning of the arrangement. */ + void read_arrangement_begin(); + + /*! reads a message indicating the end of the arrangement. */ + void read_arrangement_end(); + + /*! reads a size value, which is supposed to be preceded by the given label. + */ + Size read_size(const char *label = nullptr); + + /*! reads a message indicating the beginning of the vertex records. */ + void read_vertices_begin(); + + /*! reads a message indicating the end of the vertex records. */ + void read_vertices_end(); + + /*! reads a message indicating the beginning of the edge records. */ + void read_edges_begin(); + + /*! reads a message indicating the end of the edge records. */ + void read_edges_end(); + + /*! reads a message indicating the beginning of the face records. */ + void read_faces_begin(); + + /*! reads a message indicating the end of the face records. */ + void read_faces_end(); + + /*! reads a message indicating the beginning of a single vertex record. */ + void read_vertex_begin(); + + /*! reads a message indicating the end of a single vertex record. */ + void read_vertex_end(); + + /*! reads and returns a vertex index. */ + std::size_t read_vertex_index(); + + /*! reads a point. */ + void read_point(Point_2& p); + + /*! reads an auxiliary vertex-data object and associates it with the vertex + * `v`. + */ + void read_vertex_data(Vertex_handle v); + + /*! reads a message indicating the beginning of a single edge record. */ + void read_edge_begin(); + + /*! reads a message indicating the end of a single edge record. */ + void read_edge_end(); + + /*! reads and returns halfedge index. */ + std::size_t read_halfedge_index(); + + /*! reads an \f$x\f$-monotone curve. */ + void read_x_monotone_curve(X_monotone_curve_2& c); + + /*! reads an auxiliary halfedge-data object and associates it with the + * halfedge `he`. + */ + void read_halfedge_data(Halfedge_handle he); + + /*! reads a message indicating the beginning of a single face record. */ + void read_face_begin(); + + /*! reads a message indicating the end of a single face record. */ + void read_face_end(); + + /*! reads a message indicating the beginning of the container of outer CCBs of + * the current face. + */ + void read_outer_ccbs_begin(); + + /*! reads a message indicating the end of of the container of outer CCBs of + * the current face. + */ + void read_outer_ccbs_end(); + + /*! reads a message indicating the beginning of the container of inner CCBs of + * the current face. + */ + void read_inner_ccbs_begin(); + + /*! reads a message indicating the end of of the container of inner CCBs of the + * current face. + */ + void read_inner_ccbs_end(); + + /*! reads a message indicating the beginning of the container of outer CCBs of + * the current face. + */ + void read_outer_ccb_begin(); + + /*! reads a message indicating the end of the outer CCB of the current face. + */ + void read_outer_ccb_end(); + + /*! reads a message indicating the beginning of the container of holes inside + * the current face. + */ + void read_holes_begin(); + + /*! reads a message indicating the end of the container of holes inside the + * current face. + */ + void read_holes_end(); + + /*! reads a message indicating the beginning a connected component boundary. + */ + void read_ccb_halfedges_begin(); + + /*! reads a message indicating the end of a connected component boundary. + */ + void read_ccb_halfedges_end(); + + /*! reads a message indicating the beginning of the container of isolated + * vertices inside the current face. + */ + void read_isolated_vertices_begin(); + + /*! reads a message indicating the end of the container of isolated vertices + * inside the current face. + */ + void read_isolated_vertices_end(); + + /*! reads an auxiliary face-data object and associates it with the face `f`. + */ + void read_face_data(Face_handle f); + + /// @} +}; /* end AosInputFormatter */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLandmarkTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosLandmarkTraits_2.h similarity index 71% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLandmarkTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosLandmarkTraits_2.h index 673d553e69d..a397e520631 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLandmarkTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosLandmarkTraits_2.h @@ -1,15 +1,15 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * The concept `ArrangementLandmarkTraits_2` refines the traits concepts - * `ArrangementApproximateTraits_2` and - * `ArrangementConstructXMonotoneCurveTraits_2`. The type of an arrangement + * The concept `AosLandmarkTraits_2` refines the traits concepts + * `AosApproximatePointTraits_2` and + * `AosConstructXMonotoneCurveTraits_2`. The type of an arrangement * associated with the landmark point-location strategy (see * `CGAL::Arr_landmarks_point_location`) must be an instance of the * `CGAL::Arrangement_2` class template, where the Traits parameter * is substituted by a model of this concept. * - * \cgalRefines{ArrangementApproximateTraits_2,ArrangementConstructXMonotoneCurveTraits_2} + * \cgalRefines{AosApproximatePointTraits_2,AosConstructXMonotoneCurveTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_conic_traits_2} @@ -22,12 +22,11 @@ * \cgalHasModels{CGAL::Arr_rational_function_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementXMonotoneTraits_2` and - * `ArrangementTraits_2` + * \sa `AosXMonotoneTraits_2` + * \sa `AosTraits_2` */ -class ArrangementLandmarkTraits_2 { +class AosLandmarkTraits_2 { public: - /// \name Types /// @{ /// @} @@ -39,5 +38,4 @@ public: /// \name Accessing Functor Objects /// @{ /// @} - }; diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLeftSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosLeftSideTraits_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLeftSideTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosLeftSideTraits_2.h index 3b01d80db4f..3e51ae5a480 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLeftSideTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosLeftSideTraits_2.h @@ -1,8 +1,7 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * `ArrangementLeftSideTraits_2` is an abstract concept. It generalizes all + * `AosLeftSideTraits_2` is an abstract concept. It generalizes all * concepts that handle curves that either reach or approach the left boundary * side of the parameter space. (An "abstract" concept is a concept that is * useless on its own.) Only a combination of this concept and additional @@ -10,14 +9,14 @@ * boundary sides (that is, right, bottom, and top) are purposeful, and can have * models. * - * \cgalRefines{ArrangementVerticalSideTraits_2} + * \cgalRefines{AosVerticalSideTraits_2} * - * \sa `ArrangementRightSideTraits_2`, - * `ArrangementBottomSideTraits_2`, and - * `ArrangementTopSideTraits_2` + * \sa `AosRightSideTraits_2`, + * `AosBottomSideTraits_2`, and + * `AosTopSideTraits_2` */ -class ArrangementLeftSideTraits_2 { +class AosLeftSideTraits_2 { public: /// \name Categories /// @{ @@ -29,6 +28,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenBottomTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBottomTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenBottomTraits_2.h index c53f51ef056..7ff47562d16 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBottomTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenBottomTraits_2.h @@ -1,24 +1,23 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementOpenBottomTraits_2` must be used when the + * A model of the concept `AosOpenBottomTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is open on * the bottom side and curves inserted into the arrangement are expected to * reach this boundary side. A model of this concept can handle curves that * reach the bottom boundary side when it is open. * - * \cgalRefines{ArrangementBottomSideTraits_2} + * \cgalRefines{AosBottomSideTraits_2} * - * \sa `ArrangementOpenLeftTraits_2`, - * `ArrangementOpenRightTraits_2`, - * `ArrangementOpenTopTraits_2`, - * `ArrangementClosedBottomTraits_2`, - * `ArrangementContractedBottomTraits_2`, and - * `ArrangementIdentifiedHorizontalTraits_2` + * \sa `AosOpenLeftTraits_2`, + * `AosOpenRightTraits_2`, + * `AosOpenTopTraits_2`, + * `AosClosedBottomTraits_2`, + * `AosContractedBottomTraits_2`, and + * `AosIdentifiedHorizontalTraits_2` */ -class ArrangementOpenBottomTraits_2 { +class AosOpenBottomTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +32,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenBoundaryTraits_2.h similarity index 65% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenBoundaryTraits_2.h index 7cce69c075d..246df377069 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenBoundaryTraits_2.h @@ -1,43 +1,41 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * Several predicates are required to handle \f$ x\f$-monotone curves that + * Several predicates are required to handle \f$x\f$-monotone curves that * approach infinity and thus approach the boundary of the parameter * space. These predicates are sufficient to handle not only curves embedded in * an unbounded parameter space, but also curves embedded in a bounded parameter - * space with open boundaries. Models of the concept - * `ArrangementOpenBoundaryTraits_2` handle curves that approach the boundary of - * a parameter space. This concept refines the concept - * `ArrangementBasicTraits_2`. The arrangement template instantiated with a - * traits class that models this concept can handle \f$ x\f$-monotone curves - * that are unbounded in any direction. The concept - * `ArrangementOpenBoundaryTraits_2`, nonetheless, also supports planar \f$ - * x\f$-monotone curves that reach the boundary of an open yet bounded parameter - * space. + * space with open boundaries. Models of the concept `AosOpenBoundaryTraits_2` + * handle curves that approach the boundary of a parameter space. This concept + * refines the concept `AosBasicTraits_2`. The arrangement template instantiated + * with a traits class that models this concept can handle \f$x\f$-monotone + * curves that are unbounded in any direction. The concept + * `AosOpenBoundaryTraits_2`, nonetheless, also supports planar \f$x\f$-monotone + * curves that reach the boundary of an open yet bounded parameter space. * - * An \f$ x\f$-monotone curve may be closed, in which case its endpoints + * An \f$x\f$-monotone curve may be closed, in which case its endpoints * are representable as `Point_2` objects, or open at the boundary of the * parameter space. It can have one open end and one closed end (e.g., a - * ray). The nature of the \f$ x\f$-monotone curves, whether they are expected + * ray). The nature of the \f$x\f$-monotone curves, whether they are expected * to be closed or not at any one of the four boundary-sides, is conveyed * through the definition of the four nested types `Left_side_category`, * `Right_side_category`, `Bottom_side_category`, and `Top_side_category`. If * some curves handled by a model of the concept - * `ArrangementOpenBoundaryTraits_2` are expected to be open on the left, the + * `AosOpenBoundaryTraits_2` are expected to be open on the left, the * nested type `Left_side_category` must be convertible to * `CGAL::Arr_open_side_tag`. Similarly, if some curves handled by the concept * are expected to be open on the right, open at the bottom, or open at the top, * the corresponding nested type must be convertible to * `CGAL::Arr_open_side_tag`. A model of the concept - * `ArrangementOpenBoundaryTraits_2` must have all the four categories + * `AosOpenBoundaryTraits_2` must have all the four categories * convertible to `CGAL::Arr_open_side_tag`.\cgalFootnote{We intend to introduce * more concepts that require only a subset of the categories to be convertible - * to \cgalFootnoteCode{CGAL::Arr_open_side_tag}.} In this case the \dcel of the arrangement - * instantiated with the model is initialized with an implicit bounding - * rectangle. When the parameter space is bounded, it is the exact geometric - * embedding of the implicit bounding rectangle. + * to \cgalFootnoteCode{CGAL::Arr_open_side_tag}.} In this case the \dcel of the + * arrangement instantiated with the model is initialized with an implicit + * bounding rectangle. When the parameter space is bounded, it is the exact + * geometric embedding of the implicit bounding rectangle. * - * \cgalRefines{ArrangementBasicTraits_2} + * \cgalRefines{AosBasicTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_linear_traits_2} @@ -47,27 +45,26 @@ * \cgalHasModels{CGAL::Arr_consolidated_curve_data_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementBasicTraits_2` - * \sa `ArrangementXMonotoneTraits_2` - * \sa `ArrangementLandmarkTraits_2` - * \sa `ArrangementTraits_2` + * \sa `AosBasicTraits_2` + * \sa `AosXMonotoneTraits_2` + * \sa `AosLandmarkTraits_2` + * \sa `AosTraits_2` */ -class ArrangementOpenBoundaryTraits_2 { +class AosOpenBoundaryTraits_2 { public: - /// \name Categories /// @{ - //! Must be convertible to `CGAL::Arr_open_side_tag`. + /// Must be convertible to `CGAL::Arr_open_side_tag`. typedef unspecified_type Left_side_category; - //! Must be convertible to `CGAL::Arr_open_side_tag`. + /// Must be convertible to `CGAL::Arr_open_side_tag`. typedef unspecified_type Bottom_side_category; - //! Must be convertible to `CGAL::Arr_open_side_tag`. + /// Must be convertible to `CGAL::Arr_open_side_tag`. typedef unspecified_type Top_side_category; - //! Must be convertible to `CGAL::Arr_open_side_tag`. + /// Must be convertible to `CGAL::Arr_open_side_tag`. typedef unspecified_type Right_side_category; /// @} @@ -75,14 +72,14 @@ public: /// \name Functor Types /// @{ - /*! models the concept `ArrTraits::ParameterSpaceInX_2`. Required only if the + /*! models the concept `AosTraits::ParameterSpaceInX_2`. Required only if the * traits class supports unbounded curves that approach the left or the right * sides (the `Left_side_category` or the `Right_side_category` categories are * convertible to `CGAL::Arr_open_side_tag`). */ typedef unspecified_type Parameter_space_in_x_2; - /*! models the concept `ArrTraits::CompareYNearBoundary_2`. + /*! models the concept `AosTraits::CompareYNearBoundary_2`. * Required only if the traits class supports unbounded curves that approach * the left or the right sides (the `Left_side_category` or the * `Right_side_category` categories are convertible to @@ -90,7 +87,7 @@ public: */ typedef unspecified_type Compare_y_near_boundary_2; - /*! models the concept `ArrTraits::ParameterSpaceInY_2`. + /*! models the concept `AosTraits::ParameterSpaceInY_2`. * Required only if the traits class supports unbounded curves that approach * the bottom or the top sides (the `Bottom_side_category` or the * `Top_side_category` categories are convertible to @@ -98,14 +95,14 @@ public: */ typedef unspecified_type Parameter_space_in_y_2; - /*! models the concept `ArrTraits::CompareXOnBoundaryOfCurveEnd_2`. Required + /*! models the concept `AosTraits::CompareXOnBoundaryOfCurveEnd_2`. Required * only if the traits class supports unbounded curves that approach the bottom * or the top sides (the `Bottom_side_category` or the `Top_side_category` * categories are convertible to `CGAL::Arr_open_side_tag`). */ typedef unspecified_type Compare_x_on_boundary_2; - /*! models the concept `ArrTraits::CompareXNearBoundary_2`. Required only if + /*! models the concept `AosTraits::CompareXNearBoundary_2`. Required only if * the traits class supports unbounded curves that approach the bottom or the * top sides (the `Bottom_side_category` or the `Top_side_category` categories * are convertible to `CGAL::Arr_open_side_tag`). @@ -117,21 +114,20 @@ public: /// \name Accessing Functor Objects /// @{ - /*! */ + /// Parameter_space_in_x_2 parameter_space_in_x_2_object() const; - /*! */ + /// Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const; - /*! */ + /// Parameter_space_in_y_2 parameter_space_in_y_2_object() const; - /*! */ + /// Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const; - /*! */ + /// Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const; /// @} - -}; /* end ArrangementOpenBoundaryTraits_2 */ +}; /* end AosOpenBoundaryTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenLeftTraits_2.h similarity index 56% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenLeftTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenLeftTraits_2.h index f1b7d62ca68..0bac1f858ab 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenLeftTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenLeftTraits_2.h @@ -1,24 +1,23 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementOpenLeftTraits_2` must be used when the + * A model of the concept `AosOpenLeftTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is open on * the left side and curves inserted into the arrangement are expected to reach * this boundary side. A model of this concept can handle curves that reach the * left boundary side when it is open. * - * \cgalRefines{ArrangementLeftSideTraits_2} + * \cgalRefines{AosLeftSideTraits_2} * - * \sa `ArrangementOpenRightTraits_2`, - * `ArrangementOpenBottomTraits_2`, - * `ArrangementOpenTopTraits_2`, - * `ArrangementClosedLeftTraits_2`, - * `ArrangementContractedLeftTraits_2`, and - * `ArrangementIdentifiedVerticalTraits_2` + * \sa `AosOpenRightTraits_2`, + * `AosOpenBottomTraits_2`, + * `AosOpenTopTraits_2`, + * `AosClosedLeftTraits_2`, + * `AosContractedLeftTraits_2`, and + * `AosIdentifiedVerticalTraits_2` */ -class ArrangementOpenLeftTraits_2 { +class AosOpenLeftTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +32,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenRightTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenRightTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenRightTraits_2.h index fa8468d49dc..f74aaa81f76 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenRightTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenRightTraits_2.h @@ -1,24 +1,23 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementOpenRightTraits_2` must be used when the + * A model of the concept `AosOpenRightTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is open on * the right side and curves inserted into the arrangement are expected to reach * this boundary side. A model of this concept can handle curves that reach the * right boundary side when it is open. * - * \cgalRefines{ArrangementRightSideTraits_2} + * \cgalRefines{AosRightSideTraits_2} * - * \sa `ArrangementOpenLeftTraits_2`, - * `ArrangementOpenBottomTraits_2`, - * `ArrangementOpenTopTraits_2`, - * `ArrangementClosedRightTraits_2`, - * `ArrangementContractedRightTraits_2`, and - * `ArrangementIdentifiedVerticalTraits_2` + * \sa `AosOpenLeftTraits_2`, + * `AosOpenBottomTraits_2`, + * `AosOpenTopTraits_2`, + * `AosClosedRightTraits_2`, + * `AosContractedRightTraits_2`, and + * `AosIdentifiedVerticalTraits_2` */ -class ArrangementOpenRightTraits_2 { +class AosOpenRightTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +32,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenTopTraits_2.h similarity index 55% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenTopTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenTopTraits_2.h index 455bef4d160..0628e0894f9 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenTopTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOpenTopTraits_2.h @@ -1,24 +1,23 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * A model of the concept `ArrangementOpenTopTraits_2` must be used when the + * A model of the concept `AosOpenTopTraits_2` must be used when the * parameter space of the surface, the arrangement is embedded on, is open on * the top side and curves inserted into the arrangement are expected to reach * this boundary side. A model of this concept can handle curves that reach the * top boundary side when it is open. * - * \cgalRefines{ArrangementTopSideTraits_2} + * \cgalRefines{AosTopSideTraits_2} * - * \sa `ArrangementOpenLeftTraits_2`, - * `ArrangementOpenRightTraits_2`, - * `ArrangementOpenBottomTraits_2`, - * `ArrangementClosedTopTraits_2`, - * `ArrangementContractedTopTraits_2`, and - * `ArrangementIdentifiedHorizontalTraits_2` + * \sa `AosOpenLeftTraits_2`, + * `AosOpenRightTraits_2`, + * `AosOpenBottomTraits_2`, + * `AosClosedTopTraits_2`, + * `AosContractedTopTraits_2`, and + * `AosIdentifiedHorizontalTraits_2` */ -class ArrangementOpenTopTraits_2 { +class AosOpenTopTraits_2 { public: /// \name Categories /// @{ @@ -33,6 +32,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOutputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOutputFormatter.h new file mode 100644 index 00000000000..ea79ba8eea2 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosOutputFormatter.h @@ -0,0 +1,193 @@ +/*! \ingroup PkgArrangementOnSurface2Concepts + * \cgalConcept + * + * A model for the `AosOutputFormatter` concept supports a set of functions that + * enable writing an arrangement to an output stream using a specific format. + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_text_formatter} + * \cgalHasModels{CGAL::Arr_face_extended_text_formatter} + * \cgalHasModels{CGAL::Arr_extended_dcel_text_formatter} + * \cgalHasModelsEnd + */ +class AosOutputFormatter { +public: + /// \name Types + /// @{ + + /// the type of arrangement to output. + typedef unspecified_type Arrangement_2; + + /// the point type. + typedef typename Arrangement_2::Point_2 Point_2; + + /// the \f$x\f$-monotone curve type. + typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; + + /// + typedef typename Arrangement_2::Size Size; + + /// + typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; + + /// + typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; + + /// + typedef typename Arrangement_2::Face_const_handle Face_const_handle; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. */ + Arr_out_formatter(); + + /*! constructs a formatter that writes to `os`. */ + Arr_out_formatter(std::ostream& os); + + /*! directs `outf` to write to `os`. */ + void set_out(std::ostream& os); + + /// @} + + /// \name Access Functions + /// @{ + + /*! + returns the stream that `outf` writes to. + \pre `outf` is directed to a valid output stream. + */ + std::ostream& out(); + + /// @} + + /// \name Formatted Output Functions + /// @{ + + /*! writes a message indicating the beginning of the arrangement. */ + void write_arrangement_begin(); + + /*! writes a message indicating the end of the arrangement. */ + void write_arrangement_end(); + + /*! writes a size value, preceded by a given label. */ + void write_size(const char *label, Size size); + + /*! writes a message indicating the beginning of the vertex records. */ + void write_vertices_begin(); + + /*! writes a message indicating the end of the vertex records. */ + void write_vertices_end(); + + /*! writes a message indicating the beginning of the edge records. */ + void write_edges_begin(); + + /*! writes a message indicating the end of the edge records. */ + void write_edges_end(); + + /*! writes a message indicating the beginning of the face records. */ + void write_faces_begin(); + + /*! writes a message indicating the end of the face records. */ + void write_faces_end(); + + /*! writes a message indicating the beginning of a single vertex record. */ + void write_vertex_begin(); + + /*! writes a message indicating the end of a single vertex record. */ + void write_vertex_end(); + + /*! writes a vertex index. */ + void write_vertex_index(std::size_t idx); + + /*! writes a point. */ + void write_point(const Point_2& p); + + /*! writes the auxiliary data associated with the vertex. */ + void write_vertex_data(Vertex_const_handle v); + + /*! writes a message indicating the beginning of a single edge record. */ + void write_edge_begin(); + + /*! writes a message indicating the end of a single edge record. */ + void write_edge_end(); + + /*! writes a halfedge index. */ + void write_halfedge_index(std::size_t idx); + + /*! writes an \f$x\f$-monotone curve. */ + void write_x_monotone_curve(const X_monotone_curve_2& c); + + /*! writes the auxiliary data associated with the halfedge. */ + void write_halfedge_data(Halfedge_const_handle he); + + /*! writes a message indicating the beginning of a single face record. */ + void write_face_begin(); + + /*! writes a message indicating the end of a single face record. */ + void write_face_end(); + + /*! writes a message indicating the beginning of the container of outer CCBs + * of the current face. + */ + void write_outer_ccbs_begin(); + + /*! writes a message indicating the end of the container of outer ccbs of the + * current face. + */ + void write_outer_ccbs_end(); + + /*! writes a message indicating the beginning of the container of inner CCBs + * of the current face. + */ + void write_inner_ccbs_begin(); + + /*! writes a message indicating the end of the container of inner ccbs of the + * current face. + */ + void write_inner_ccbs_end(); + + /*! writes a message indicating the beginning of the outer CCB of the current + * face. + */ + void write_outer_ccb_begin(); + + /*! writes a message indicating the end of the outer CCB of the current face. + */ + void write_outer_ccb_end(); + + /*! writes a message indicating the beginning of the container of holes inside + * the current face. + */ + void write_holes_begin(); + + /*! writes a message indicating the end of the container of holes inside the + * current face. + */ + void write_holes_end(); + + /*! writes a message indicating the beginning a connected component's boundary. + */ + void write_ccb_halfedges_begin(); + + /*! writes a message indicating the end of a connected component's boundary. + */ + void write_ccb_halfedges_end(); + + /*! writes a message indicating the beginning of the container of isolated + * vertices inside the current face. + */ + void write_isolated_vertices_begin(); + + /*! writes a message indicating the end of the container of isolated vertices + * inside the current face. + */ + void write_isolated_vertices_end(); + + /*! writes the auxiliary data associated with the face. */ + void write_face_data(Face_const_handle f); + + /// @} +}; /* end AosOutputFormatter */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosPointLocation_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosPointLocation_2.h new file mode 100644 index 00000000000..fe02f149abb --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosPointLocation_2.h @@ -0,0 +1,84 @@ +/*! \ingroup PkgArrangementOnSurface2Concepts + * \cgalConcept + * + * A model of the `AosPointLocation_2` concept can answer point-location queries + * on an arrangement attached to it. Namely, given a `Arrangement_2::Point_2` + * object, representing a point in the plane, it returns the arrangement cell + * containing it. In the general case, the query point is contained inside an + * arrangement face, but in degenerate situations it may lie on an edge or + * coincide with an arrangement vertex. + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_naive_point_location} + * \cgalHasModels{CGAL::Arr_walk_along_line_point_location} + * \cgalHasModels{CGAL::Arr_trapezoid_ric_point_location} + * \cgalHasModels{CGAL::Arr_landmarks_point_location} + * \cgalHasModelsEnd + * + * \sa `CGAL::Arr_naive_point_location` + * \sa `CGAL::Arr_walk_along_line_point_location` + * \sa `CGAL::Arr_trapezoid_ric_point_location` + * \sa `CGAL::Arr_landmarks_point_location` + * \sa `CGAL::Arr_point_location_result` + */ +class AosPointLocation_2 { +public: + /// \name Types + /// @{ + + //! the associated arrangement type. + typedef unspecified_type Arrangement_2; + + //! equivalent to `Arrangement_2::Point_2`. + typedef unspecified_type Point_2; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + AosPointLocation_2(); + + /*! constructs a point-location object `pl` attached to the given + * arrangement `arr`. + */ + AosPointLocation_2 (const Arrangement_2& arr); + + /// @} + + /// \name Query Functions + /// @{ + + /*! locates the arrangement cell that contains the query point `q` + * and returns a discriminated union container of the following bounded + * types: + * + *
    + *
  • `Arrangement_2::Face_const_handle`, in case `q` is + * contained inside an arrangement face; + *
  • `Arrangement_2::Halfedge_const_handle`, in case `q` lies + * on an arrangement edge; + *
  • `Arrangement_2::Vertex_const_handle`, in case `q` coincides + * with an arrangement vertex. + *
+ * \pre `pl` is attached to a valid arrangement object. + */ + Arr_point_location_result::Type locate(const Point_2& q) const; + + /// @} + + /// \name Operations + /// @{ + + /*! attaches `pl` to the given arrangement `arr`. + */ + void attach (const Arrangement_2& arr); + + /*! detaches `pl` from the arrangement it is currently attached to. + */ + void detach (); + + /// @} +}; /* end AosPointLocation_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementRightSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosRightSideTraits_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementRightSideTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosRightSideTraits_2.h index 689d2b7af2d..b71b594dcf1 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementRightSideTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosRightSideTraits_2.h @@ -1,8 +1,7 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * `ArrangementRightSideTraits_2` is an abstract concept. It generalizes all + * `AosRightSideTraits_2` is an abstract concept. It generalizes all * concepts that handle curves that either reach or approach the right boundary * side of the parameter space. (An "abstract" concept is a concept that is * useless on its own.) Only a combination of this concept and additional @@ -10,14 +9,13 @@ * boundary sides (that is, left, bottom, and top) are purposeful, and can have * models. * - * \cgalRefines{ArrangementVerticalSideTraits_2} + * \cgalRefines{AosVerticalSideTraits_2} * - * \sa `ArrangementLeftSideTraits_2`, - * `ArrangementBottomSideTraits_2`, and - * `ArrangementTopSideTraits_2` + * \sa `AosLeftSideTraits_2` + * \sa `AosBottomSideTraits_2` + * \sa `AosTopSideTraits_2` */ - -class ArrangementRightSideTraits_2 { +class AosRightSideTraits_2 { public: /// \name Categories /// @{ @@ -29,6 +27,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementSphericalBoundaryTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosSphericalBoundaryTraits_2.h similarity index 53% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementSphericalBoundaryTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosSphericalBoundaryTraits_2.h index 25fde7ef42d..e5ed46d6f4d 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementSphericalBoundaryTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosSphericalBoundaryTraits_2.h @@ -1,45 +1,42 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * Models of the concept `ArrangementSphericalBoundaryTraits_2` handle curves on + * Models of the concept `AosSphericalBoundaryTraits_2` handle curves on * a sphere or a surface that is topological equivalent to a sphere. The sphere * is oriented in such a way that the boundary of the rectangular parameter * space, the sphere is the mapping of which, is identified on the left and * right sides and contracted at the top and bottom sides. * - * \cgalRefines{ArrangementBasicTraits_2,ArrangementIdentifiedVerticalTraits_2, - * ArrangementContractedBottomTraits_2,ArrangementContractedTopTraits_2} + * \cgalRefines{AosBasicTraits_2,AosIdentifiedVerticalTraits_2, + * AosContractedBottomTraits_2,AosContractedTopTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementOpenBoundaryTraits_2` - * \sa `ArrangementBasicTraits_2` - * \sa `ArrangementIdentifiedVerticalTraits_2` - * \sa `ArrangementContractedBottomTraits_2` - * \sa `ArrangementContractedTopTraits_2` - * \sa `ArrangementHorizontalSideTraits_2` - * \sa `ArrangementVerticalSideTraits_2` + * \sa `AosOpenBoundaryTraits_2` + * \sa `AosBasicTraits_2` + * \sa `AosIdentifiedVerticalTraits_2` + * \sa `AosContractedBottomTraits_2` + * \sa `AosContractedTopTraits_2` + * \sa `AosHorizontalSideTraits_2` + * \sa `AosVerticalSideTraits_2` */ - -class ArrangementSphericalBoundaryTraits_2 { +class AosSphericalBoundaryTraits_2 { public: - /// \name Categories /// @{ - //! Must be convertible to `CGAL::Arr_identified_side_tag`. + /// Must be convertible to `CGAL::Arr_identified_side_tag`. typedef unspecified_type Left_side_category; - //! Must be convertible to `CGAL::Arr_identified_side_tag`. + /// Must be convertible to `CGAL::Arr_identified_side_tag`. typedef unspecified_type Bottom_side_category; - //! Must be convertible to `CGAL::Arr_contracted_side_tag`. + /// Must be convertible to `CGAL::Arr_contracted_side_tag`. typedef unspecified_type Top_side_category; - //! Must be convertible to `CGAL::Arr_contracted_side_tag`. + /// Must be convertible to `CGAL::Arr_contracted_side_tag`. typedef unspecified_type Right_side_category; /// @} @@ -47,25 +44,25 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::ParameterSpaceInX_2`. + /// models the concept `AosTraits::ParameterSpaceInX_2`. typedef unspecified_type Parameter_space_in_x_2; - /// models the concept `ArrTraits::CompareXOnBoundaryOfCurveEnd_2`. + /// models the concept `AosTraits::CompareXOnBoundaryOfCurveEnd_2`. typedef unspecified_type Compare_x_on_boundary_2; - /// models the concept `ArrTraits::CompareXNearBoundary_2`. + /// models the concept `AosTraits::CompareXNearBoundary_2`. typedef unspecified_type Compare_x_near_boundary_2; - /// models the concept `ArrTraits::ParameterSpaceInY_2`. + /// models the concept `AosTraits::ParameterSpaceInY_2`. typedef unspecified_type Parameter_space_in_y_2; - /// models the concept `ArrTraits::CompareYOnBoundary_2`. + /// models the concept `AosTraits::CompareYOnBoundary_2`. typedef unspecified_type Compare_y_on_boundary_2; - /// models the concept `ArrTraits::CompareYNearBoundary_2`. + /// models the concept `AosTraits::CompareYNearBoundary_2`. typedef unspecified_type Compare_y_near_boundary_2; - /// models the concept `ArrTraits::IsOnYIdentification_2`. + /// models the concept `AosTraits::IsOnYIdentification_2`. typedef unspecified_type Is_on_y_identification_2; /// @} @@ -73,26 +70,26 @@ public: /// \name Accessing Functor Objects /// @{ - /*! */ + /// Parameter_space_in_x_2 parameter_space_in_x_2_object() const; - /*! */ + /// Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const; - /*! */ + /// Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const; - /*! */ + /// Parameter_space_in_y_2 parameter_space_in_y_2_object() const; - /*! */ + /// Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const; - /*! */ + /// Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const; - /*! */ + /// Is_on_y_identification_2 is_on_y_identification_2_object() const; - /// @} -}; /* end ArrangementSphericalBoundaryTraits_2 */ + /// @} +}; /* end AosSphericalBoundaryTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTopSideTraits_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopSideTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTopSideTraits_2.h index 94614dfc81a..f3cc3e3b806 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopSideTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTopSideTraits_2.h @@ -1,8 +1,7 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsTraits +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * `ArrangementTopSideTraits_2` is an abstract concept. It generalizes all + * `AosTopSideTraits_2` is an abstract concept. It generalizes all * concepts that handle curves that either reach or approach the top boundary * side of the parameter space. (An "abstract" concept is a concept that is * useless on its own.) Only a combination of this concept and additional @@ -10,14 +9,13 @@ * boundary sides (that is, left, right, and bottom) are purposeful, and can * have models. * - * \cgalRefines{ArrangementHorizontalSideTraits_2} + * \cgalRefines{AosHorizontalSideTraits_2} * - * \sa `ArrangementLeftSideTraits_2`, - * `ArrangementRightSideTraits_2`, and - * `ArrangementBottomSideTraits_2` + * \sa `AosLeftSideTraits_2` + * \sa `AosRightSideTraits_2` + * \sa `AosBottomSideTraits_2` */ - -class ArrangementTopSideTraits_2 { +class AosTopSideTraits_2 { public: /// \name Categories /// @{ @@ -29,6 +27,7 @@ public: /// \name Functor Types /// @{ + /// @} /// \name Accessing Functor Objects /// @{ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopologyTraits.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTopologyTraits.h similarity index 97% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopologyTraits.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTopologyTraits.h index bf0c5121709..1dd1caf27b3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopologyTraits.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTopologyTraits.h @@ -29,16 +29,15 @@ * \sa `Arrangement_on_surface_2` */ -class ArrangementTopologyTraits { +class AosTopologyTraits { public: - /// \name Types /// @{ - /*! */ + /// typedef unspecified_type Geometry_traits_2; - /*! */ + /// typedef unspecified_type Dcel; /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h new file mode 100644 index 00000000000..a9712000aa9 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Approximate_2.h @@ -0,0 +1,54 @@ +namespace AosTraits { + +/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects + * \cgalConcept + * + * \cgalRefines{Functor} + * + * \cgalHasModelsBegin + * \cgalHasModels{AosApproximatePointTraits_2::Approximate_2} + * \cgalHasModels{AosApproximateTraits_2::Approximate_2} + * \cgalHasModelsEnd + */ +class Approximate_2 { +public: + /// \name Operations + /// A model of this concept must provide: + /// @{ + + /*! obtains an approximation of `p`'s \f$x\f$-coordinate (if `i == 0`), or of + * `p`'s \f$y\f$-coordinate (if `i == 1`). + * \pre `i` is either 0 or 1. + */ + CGAL::Approximate_number_type operator()(AosTraits::Point_2 p, int i); + + /*! obtains an approximation of `p`. + */ + CGAL::Approximate_point_2 operator()(AosTraits::Point_2 p); + + /*! approximates a given \f$x\f$-monotone curve. It computes a sequence of + * approximate points that represent an approximate polyline, and inserts + * them into an output container given through an output iterator. The + * first and last points in the sequence are always approximations of the + * endpoints of the given curve. + * + * \param xcv The exact \f$x\f$-monotone curve. + * \param error The error bound of the polyline approximation. This is the + * Hausdorff distance between the curve and the polyline that + * approximates the curve. + * \param oi An output iterator for the output container. + * \param l2r A Boolean flag that indicates whether the curve direction is + * left to right. + * \return The past-the-end iterator of the output container. + * + * \pre Dereferencing `oi` must yield an object of type + * `Arr_conic_traits_2::Approximate_point_2`. + */ + template + OutputIterator operator()(const X_monotone_curve_2& xcv, double error, + OutputIterator oi, bool l2r = true) const; + + /// @} +}; /* end AosTraits::Approximate_2 */ + +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--AreMergeable_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--AreMergeable_2.h similarity index 72% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--AreMergeable_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--AreMergeable_2.h index 8c9f51309ab..5969ea3ccee 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--AreMergeable_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--AreMergeable_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{Functor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementXMonotoneTraits_2::Are_mergeable_2} + * \cgalHasModels{AosXMonotoneTraits_2::Are_mergeable_2} * \cgalHasModelsEnd */ class AreMergeable_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -22,11 +21,10 @@ public: * share a common endpoint, and they do not bend to form a * non-\f$x\f$-monotone curve. */ - bool operator()(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2); + bool operator()(AosTraits::X_monotone_curve_2 xc1, + AosTraits::X_monotone_curve_2 xc2); /// @} - -}; /* end ArrTraits::AreMergeable_2 */ +}; /* end AosTraits::AreMergeable_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearBoundary_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXNearBoundary_2.h similarity index 54% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearBoundary_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXNearBoundary_2.h index ad6f44f179a..c24b8d93242 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearBoundary_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXNearBoundary_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{AdaptableTernaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementOpenBoundaryTraits_2::Compare_x_near_boundary_} + * \cgalHasModels{AosOpenBoundaryTraits_2::Compare_x_near_boundary_} * \cgalHasModelsEnd */ class CompareXNearBoundary_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -24,26 +23,29 @@ public: * precisely, compares the \f$x\f$-coordinates of the horizontal projection * of a point \f$p\f$ onto `xcv1` and `xcv2`. If `xcv1` and `xcv2` approach * the bottom boundary-side, \f$p\f$ is located far to the bottom, such that - * the result is invariant under a translation of \f$ p\f$ farther to the + * the result is invariant under a translation of \f$p\f$ farther to the * bottom. If `xcv1` and `xcv2` approach the top boundary-side, \f$p\f$ is * located far to the top in a similar manner. * - * \pre The \f$x\f$-coordinates of the limits of the curves at their - * respective ends are equal. That is, `compare_x_on_boundary_2`(`xcv1`, - * `xcv2`, `ce`) = `CGAL::EQUAL`. + * \pre The \f$x\f$-coordinates of the boundary of the curves at their + * respective ends are equal. That is, + * \link AosHorizontalSideTraits_2::Compare_x_on_boundary_2 + * `compare_x_on_boundary_2`\endlink(`xcv1`, `xcv2`, `ce`) = `CGAL::EQUAL`. * - * \pre \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `parameter_space_in_y_2`\endlink(`xcv1`, `ce`) = - * \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `parameter_space_in_y_2`\endlink(`xcv2`, `ce`). + * \pre \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 + * `parameter_space_in_y_2`\endlink(`xcv1`, `ce`) = + * \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 + * `parameter_space_in_y_2`\endlink(`xcv2`, `ce`). * - * \pre \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `parameter_space_in_y_2`\endlink(`xcv1`, `ce`) \f$ \neq\f$ + * \pre \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 + * `parameter_space_in_y_2`\endlink(`xcv1`, `ce`) \f$\neq\f$ * `CGAL::ARR_INTERIOR`. */ - Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, - const ArrTraits::X_monotone_curve_2& xcv2, + Comparison_result operator()(const AosTraits::X_monotone_curve_2& xcv1, + const AosTraits::X_monotone_curve_2& xcv2, CGAL::Arr_curve_end ce); /// @} - -}; /* end ArrTraits::CompareXNearBoundary_2 */ +}; /* end AosTraits::CompareXNearBoundary_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXOnBoundaryOfCurveEnd_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXOnBoundaryOfCurveEnd_2.h new file mode 100644 index 00000000000..e24c6e03622 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXOnBoundaryOfCurveEnd_2.h @@ -0,0 +1,74 @@ +namespace AosTraits { + +/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects + * \cgalConcept + * + * \cgalRefines{AdaptableFunctor} + * + * \cgalHasModelsBegin + * \cgalHasModels{AosHorizontalSideTraits_2::Compare_x_on_boundary_2} + * \cgalHasModels{AosOpenBoundaryTraits_2::Compare_x_on_boundary_2} + * \cgalHasModels{AosSphericalBoundaryTraits_2::Compare_x_on_boundary_2} + * \cgalHasModelsEnd + */ +class CompareXOnBoundaryOfCurveEnd_2 { +public: + /// \name Operations + /// A model of this concept must provide: + /// @{ + + /*! Given a point `p`, an \f$x\f$-monotone curve `xcv`, and an + * enumeration `ce` that specifies either the minimum or the maximum end of + * the curve where the curve has a vertical asymptote, compares the + * \f$x\f$-coordinate of `p` and the \f$x\f$-coordinate of the limit of the + * curve at its specified end. The variable `xcv` identifies the parametric + * curve \f$c(t) = (x(t), y(t))\f$ defined over an open or half-open interval + * with endpoints \f$0\f$ and \f$1\f$. The enumeration `ce` identifies an + * open end \f$d \in\{0,1\}\f$ of \f$c\f$. Formally, compares the + * \f$x\f$-coordinate of `p` and \f$\lim_{t \rightarrow d} x(t)\f$. Returns + * `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. + * + * \pre \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink(`xcv`, `ce`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. + * + * \pre If the parameter space is unbounded, \f$c\f$ has a vertical asymptote + * at its \f$d\f$-end; that is, + * \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink(`xcv`, `ce`) = `CGAL::ARR_INTERIOR`. + */ + Comparison_result operator()(const AosTraits::Point_2& p, + const AosTraits::X_monotone_curve_2& xcv, + CGAL::Arr_curve_end ce); + + /*! Given two \f$x\f$-monotone curves `xcv1` and `xcv2` and two indices `ce1` + * and `ce2` that specify either the minimum or the maximum ends of `xcv1` and + * `xcv2`, respectively, where the curves have vertical asymptotes, compares + * the \f$x\f$-coordinates of the limits of the curves at their specified + * ends. The variables `xcv1` and `xcv2` identify the parametric curves + * \f$c_1(t) = (x_1(t),y_1(t))\f$ and \f$c_2(t) = (x_2(t),y_2(t))\f$, + * respectively, defined over open or half-open intervals with endpoints + * \f$0\f$ and \f$1\f$. The indices `ce1` and `ce2` identify open ends + * \f$d_1\in\{0,1\}\f$ and \f$d_2 \in\{0,1\}\f$ of \f$c_1\f$ and \f$c_2\f$, + * respectively. Formally, compares \f$\lim_{t \rightarrow d_1} x_1(t)\f$ and + * \f$\lim_{t \rightarrow d_2} x_2(t)\f$. Returns `CGAL::SMALLER`, + * `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. + * + * \pre \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink(`xcv1`, `ce1`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. + * + * \pre \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink(`xcv2`, `ce2`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. + * + * \pre If the parameter space is unbounded, \f$c_1\f$ has a vertical + * asymptote at its respective end; that is, + * \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink(`xcv1`, `ce1`) = `CGAL::ARR_INTERIOR`. + * + * \pre If the parameter space is unbounded, \f$c_2\f$ has a vertical asymptote + * at its respective end; that is, + * \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink(`xcv2`, `ce2`) = `CGAL::ARR_INTERIOR`. + */ + Comparison_result operator()(const AosTraits::X_monotone_curve_2& xcv1, + CGAL::Arr_curve_end ce1, + const AosTraits::X_monotone_curve_2& xcv2, + CGAL::Arr_curve_end ce2); + + /// @} +}; /* end AosTraits::CompareXOnBoundaryOfCurveEnd_2 */ + +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundary_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXOnBoundary_2.h similarity index 57% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundary_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXOnBoundary_2.h index af30ebbfb93..4fbaa082f64 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundary_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXOnBoundary_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,9 +6,9 @@ namespace ArrTraits { * \cgalRefines{AdaptableFunctor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementClosedBottomTraits_2::Compare_x_on_boundary_2} - * \cgalHasModels{ArrangementClosedTopTraits_2::Compare_x_on_boundary_2} - * \cgalHasModels{ArrangementIdentifiedHorizontalTraits_2::Compare_x_on_boundary_2} + * \cgalHasModels{AosClosedBottomTraits_2::Compare_x_on_boundary_2} + * \cgalHasModels{AosClosedTopTraits_2::Compare_x_on_boundary_2} + * \cgalHasModels{AosIdentifiedHorizontalTraits_2::Compare_x_on_boundary_2} * \cgalHasModelsEnd */ class CompareXOnBoundary_2 { @@ -23,16 +23,16 @@ public: * x\f$-coordinate of `p1` and the \f$x\f$-coordinate of `p2`. Returns * `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. * - * \pre \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 + * \pre \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 * `Parameter_space_in_y_2`\endlink (`p1`) \f$\neq\f$ `CGAL::ARR_INTERIOR` or - * \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 + * \link AosHorizontalSideTraits_2::Parameter_space_in_y_2 * `Parameter_space_in_y_2`\endlink (`p2`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. */ - Comparison_result operator()(const ArrTraits::Point_2& p1, - const ArrTraits::Point_2& p2); + Comparison_result operator()(const AosTraits::Point_2& p1, + const AosTraits::Point_2& p2); /// @} -}; /* end ArrTraits::CompareXOnBoundaryOfCurveEnd_2 */ +}; /* end AosTraits::CompareXOnBoundaryOfCurveEnd_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareX_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareX_2.h similarity index 70% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareX_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareX_2.h index 466869d5a01..117a467f0c9 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareX_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareX_2.h @@ -1,16 +1,16 @@ -namespace ArrTraits { +namespace AosTraits { + /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept * * \cgalRefines{AdaptableBinaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Compare_x_2} + * \cgalHasModels{AosBasicTraits_2::Compare_x_2} * \cgalHasModelsEnd */ class CompareX_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -18,10 +18,9 @@ public: /*! returns `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` according to the * \f$x\f$-ordering of points `p1` and `p2`. */ - Comparison_result operator()(ArrTraits::Point_2 p1, ArrTraits::Point_2 p2); + Comparison_result operator()(AosTraits::Point_2 p1, AosTraits::Point_2 p2); /// @} - -}; /* end ArrTraits::CompareX_2 */ +}; /* end AosTraits::CompareX_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXy_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXy_2.h similarity index 71% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXy_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXy_2.h index db282c6d238..10f3ce75cda 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXy_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareXy_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{AdaptableBinaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Compare_xy_2} + * \cgalHasModels{AosBasicTraits_2::Compare_xy_2} * \cgalHasModelsEnd */ class CompareXy_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -19,10 +18,9 @@ public: /*! returns `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` according * to the lexicographic \f$xy\f$-order of the points `p1` and `p2`. */ - Comparison_result operator()(ArrTraits::Point_2 p1, ArrTraits::Point_2 p2); + Comparison_result operator()(AosTraits::Point_2 p1, AosTraits::Point_2 p2); /// @} - -}; /* end ArrTraits::CompareXy_2 */ +}; /* end AosTraits::CompareXy_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtXLeft_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtXLeft_2.h similarity index 63% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtXLeft_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtXLeft_2.h index f49c04d0ec1..428de11c5cc 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtXLeft_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtXLeft_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,29 +6,27 @@ namespace ArrTraits { * \cgalRefines{AdaptableTernaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Compare_y_at_x_left_2} + * \cgalHasModels{AosBasicTraits_2::Compare_y_at_x_left_2} * \cgalHasModelsEnd */ class CompareYAtXLeft_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ /*! accepts two \f$x\f$-monotone curves `xc1` and `xc2` that have a common - * right endpoint `p`, and returns `CGAL::SMALLER, CGAL::EQUAL` or + * right endpoint `p`, and returns `CGAL::SMALLER`, `CGAL::EQUAL` or * `CGAL::LARGER` according to the relative position of the two curves * immediately to the left of \f$p\f$. Note that in case one of the * \f$x\f$-monotone curves is a vertical segment (emanating downward from * `p`), it is always considered to be below the other curve. */ - Comparison_result operator()(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, - ArrTraits::Point_2 p); + Comparison_result operator()(AosTraits::X_monotone_curve_2 xc1, + AosTraits::X_monotone_curve_2 xc2, + AosTraits::Point_2 p); /// @} - -}; /* end ArrTraits::CompareYAtXLeft_2 */ +}; /* end AosTraits::CompareYAtXLeft_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtXRight_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtXRight_2.h similarity index 62% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtXRight_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtXRight_2.h index 62fe93cdc3a..5f95bd0c84a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtXRight_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtXRight_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,29 +6,27 @@ namespace ArrTraits { * \cgalRefines{AdaptableTernaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Compare_y_at_x_right_2} + * \cgalHasModels{AosBasicTraits_2::Compare_y_at_x_right_2} * \cgalHasModelsEnd */ class CompareYAtXRight_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ /*! accepts two \f$x\f$-monotone curves `xc1` and `xc2` - * that have a common left endpoint `p`, and returns `CGAL::SMALLER, - * CGAL::EQUAL` or `CGAL::LARGER` according to the relative position of the + * that have a common left endpoint `p`, and returns `CGAL::SMALLER`, + * `CGAL::EQUAL` or `CGAL::LARGER` according to the relative position of the * two curves immediately to the right of \f$p\f$. Note that in case one of * the \f$x\f$-monotone curves is a vertical segment emanating upward from * `p`, it is always considered to be above the other curve. */ - Comparison_result operator()(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, - ArrTraits::Point_2 p); + Comparison_result operator()(AosTraits::X_monotone_curve_2 xc1, + AosTraits::X_monotone_curve_2 xc2, + AosTraits::Point_2 p); /// @} - -}; /* end ArrTraits::CompareYAtXRight_2 */ +}; /* end AosTraits::CompareYAtXRight_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtX_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtX_2.h similarity index 66% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtX_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtX_2.h index bc8d1d81573..e884e8e2cca 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYAtX_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYAtX_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{AdaptableBinaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Compare_y_at_x_2} + * \cgalHasModels{AosBasicTraits_2::Compare_y_at_x_2} * \cgalHasModelsEnd */ class CompareYAtX_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -20,11 +19,10 @@ public: * of `p` on `xc`, and returns `CGAL::SMALLER`, `CGAL::EQUAL`, or * `CGAL::LARGER` according to the result. */ - Comparison_result operator()(ArrTraits::Point_2 p, - ArrTraits::X_monotone_curve_2 xc); + Comparison_result operator()(AosTraits::Point_2 p, + AosTraits::X_monotone_curve_2 xc); /// @} - -}; /* end ArrTraits::CompareYAtX_2 */ +}; /* end AosTraits::CompareYAtX_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYNearBoundary_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYNearBoundary_2.h similarity index 67% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYNearBoundary_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYNearBoundary_2.h index cb11491e316..06b77ba1568 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYNearBoundary_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYNearBoundary_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{AdaptableTernaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementOpenBoundaryTraits_2::Compare_y_near_boundary_2} + * \cgalHasModels{AosOpenBoundaryTraits_2::Compare_y_near_boundary_2} * \cgalHasModelsEnd */ class CompareYNearBoundary_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -30,18 +29,17 @@ public: * to `xcv2` and `ce`. In that case \f$p\f$ is located far to the right in a * similar manner. * - * \pre \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `parameter_space_in_x_2`\endlink(`xcv2`, `ce`) = - * \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `parameter_space_in_x_2`\endlink(`xcv1`, `ce`). + * \pre \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `parameter_space_in_x_2`\endlink(`xcv2`, `ce`) = + * \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `parameter_space_in_x_2`\endlink(`xcv1`, `ce`). * - * \pre \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `parameter_space_in_x_2`\endlink(`xcv1`, `ce`) \f$\neq\f$ + * \pre \link AosVerticalSideTraits_2::Parameter_space_in_x_2 `parameter_space_in_x_2`\endlink(`xcv1`, `ce`) \f$\neq\f$ * `CGAL::ARR_INTERIOR`. */ - Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, - const ArrTraits::X_monotone_curve_2& xcv2, + Comparison_result operator()(const AosTraits::X_monotone_curve_2& xcv1, + const AosTraits::X_monotone_curve_2& xcv2, CGAL::Arr_curve_end ce); /// @} - -}; /* end ArrTraits::CompareYNearBoundary_2 */ +}; /* end AosTraits::CompareYNearBoundary_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYOnBoundary_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYOnBoundary_2.h new file mode 100644 index 00000000000..8ad41f9bf32 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--CompareYOnBoundary_2.h @@ -0,0 +1,39 @@ +namespace AosTraits { + +/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects + * \cgalConcept + * + * \cgalRefines{AdaptableBinaryFunction} + * + * \cgalHasModelsBegin + * \cgalHasModels{AosClosedLeftTraits_2::Compare_y_on_boundary_2} + * \cgalHasModels{AosClosedRightTraits_2::Compare_y_on_boundary_2} + * \cgalHasModels{AosIdentifiedVerticalTraits_2::Compare_y_on_boundary_2} + * \cgalHasModels{AosSphericalBoundaryTraits_2::Compare_y_on_boundary_2} + * \cgalHasModelsEnd + */ +class CompareYOnBoundary_2 { +public: + /// \name Operations + /// A model of this concept must provide: + /// @{ + + /*! Given two points `p1` and `p2`, such that either `p1` or `p2` (or both) + * lie on the bottom or top boundary of the parameter space, compares the + * \f$y\f$-coordinate of `p1` and the \f$y\f$-coordinate of `p2`. Returns + * `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. + * + * \pre \link AosVerticalSideTraits_2::Parameter_space_in_x_2 + * `Parameter_space_in_x_2`\endlink(`p1`) \f$\neq\f$ + * `CGAL::ARR_INTERIOR` or + * \link AosVerticalSideTraits_2::Parameter_space_in_x_2 + * `Parameter_space_in_x_2`\endlink(`p2`) \f$\neq\f$ + * `CGAL::ARR_INTERIOR`. + */ + Comparison_result operator()(const AosTraits::Point_2& p1, + const AosTraits::Point_2& p2); + + /// @} +}; /* end AosTraits::CompareYOnBoundary_2 */ + +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructCurve_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructCurve_2.h new file mode 100644 index 00000000000..771afd0ed93 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructCurve_2.h @@ -0,0 +1,25 @@ +namespace AosTraits { + +/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects + * \cgalConcept + * + * \cgalRefines{Functor} + * + * \cgalHasModelsBegin + * \cgalHasModels{AosConstructCurveTraits_2::Construct_curve_2} + * \cgalHasModelsEnd + */ +class ConstructCurve_2 { +public: + /// \name Operations + /// A model of this concept must provide: + /// @{ + + /*! returns a curve connecting `p1` and `p2` (i.e., the two input points + * are its endpoints). + */ + AosTraits::Curve_2 operator()(AosTraits::Point_2 p1, AosTraits::Point_2 p2); + /// @} +}; /* end AosTraits::ConstructCurve_2 */ + +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructMaxVertex_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructMaxVertex_2.h similarity index 65% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructMaxVertex_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructMaxVertex_2.h index 85d379693bf..970e0e15151 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructMaxVertex_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructMaxVertex_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,22 +6,20 @@ namespace ArrTraits { * \cgalRefines{AdaptableUnaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Construct_max_vertex_2} + * \cgalHasModels{AosBasicTraits_2::Construct_max_vertex_2} * \cgalHasModelsEnd */ class ConstructMaxVertex_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ /*! returns the lexicographically larger (right) endpoint of `xc`. */ - ArrTraits::Point_2 operator()(ArrTraits::X_monotone_curve_2 xc); + AosTraits::Point_2 operator()(AosTraits::X_monotone_curve_2 xc); /// @} - -}; /* end ArrTraits::ConstructMaxVertex_2 */ +}; /* end AosTraits::ConstructMaxVertex_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructMinVertex_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructMinVertex_2.h similarity index 65% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructMinVertex_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructMinVertex_2.h index f9f8f3b99ac..c78fdaa3cf3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructMinVertex_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructMinVertex_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,7 +6,7 @@ namespace ArrTraits { * \cgalRefines{AdaptableUnaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Construct_min_vertex_2} + * \cgalHasModels{AosBasicTraits_2::Construct_min_vertex_2} * \cgalHasModelsEnd */ class ConstructMinVertex_2 { @@ -18,10 +18,10 @@ public: /*! returns the lexicographically smaller (left) endpoint of `xc`. */ - ArrTraits::Point_2 operator()(ArrTraits::X_monotone_curve_2 xc); + AosTraits::Point_2 operator()(AosTraits::X_monotone_curve_2 xc); /// @} -}; /* end ArrTraits::ConstructMinVertex_2 */ +}; /* end AosTraits::ConstructMinVertex_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructXMonotoneCurve_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructXMonotoneCurve_2.h similarity index 58% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructXMonotoneCurve_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructXMonotoneCurve_2.h index 39c1e7b42e5..31e4428183f 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructXMonotoneCurve_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ConstructXMonotoneCurve_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{Functor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementConstructXMonotoneCurveTraits_2::Construct_x_monotone_curve_2} + * \cgalHasModels{AosConstructXMonotoneCurveTraits_2::Construct_x_monotone_curve_2} * \cgalHasModelsEnd */ class ConstructXMonotoneCurve_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -19,11 +18,10 @@ public: /*! returns an \f$x\f$-monotone curve connecting `p1` and `p2` (i.e., the * two input points are its endpoints). */ - ArrTraits::X_monotone_curve_2 operator()(ArrTraits::Point_2 p1, - ArrTraits::Point_2 p2); + AosTraits::X_monotone_curve_2 operator()(AosTraits::Point_2 p1, + AosTraits::Point_2 p2); /// @} - -}; /* end ArrTraits::ConstructXMonotoneCurve_2 */ +}; /* end AosTraits::ConstructXMonotoneCurve_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Curve_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Curve_2.h similarity index 65% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Curve_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Curve_2.h index 5268f489519..c09afb827a4 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Curve_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Curve_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsGeometricObjects * \cgalConcept @@ -7,12 +7,9 @@ namespace ArrTraits { * * \cgalRefines{CopyConstructible,Assignable,DefaultConstructible} * \cgalHasModelsBegin - * \cgalHasModels{ArrangementTraits_2::Curve_2} + * \cgalHasModels{AosTraits_2::Curve_2} * \cgalHasModelsEnd */ -class Curve_2 { -public: - -}; /* end ArrTraits::Curve_2 */ +class Curve_2 {}; } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Equal_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Equal_2.h similarity index 58% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Equal_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Equal_2.h index ed6d47ed592..027e53a786a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Equal_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Equal_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,28 +6,26 @@ namespace ArrTraits { * \cgalRefines{AdaptableBinaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Equal_2} + * \cgalHasModels{AosBasicTraits_2::Equal_2} * \cgalHasModelsEnd */ class Equal_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ /*! determines whether `p1` and `p2` are geometrically equivalent. */ - bool operator()(ArrTraits::Point_2 p1, ArrTraits::Point_2 p2); + bool operator()(AosTraits::Point_2 p1, AosTraits::Point_2 p2); - /*! determines whether `xc1` and `xc2` are geometrically equivalent (have the - * same graph). + /*! determines whether `xc1` and `xc2` are geometrically equivalent + * (have the same graph). */ - bool operator()(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2); + bool operator()(AosTraits::X_monotone_curve_2 xc1, + AosTraits::X_monotone_curve_2 xc2); /// @} - -}; /* end ArrTraits::Equal_2 */ +}; /* end AosTraits::Equal_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Intersect_2.h similarity index 78% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Intersect_2.h index f13a26422e9..4fa6e0bbb25 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Intersect_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,7 +6,7 @@ namespace ArrTraits { * \cgalRefines{Functor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementXMonotoneTraits_2::Intersect_2} + * \cgalHasModels{AosXMonotoneTraits_2::Intersect_2} * \cgalHasModelsEnd */ class Intersect_2 { @@ -40,17 +40,17 @@ public: * nondeterministic. * * \pre Dereferencing `oi` must yield an object of type - * `std::optional>`, - * where `%Point_2` is a model of `ArrTraits::Point_2` and - * `X_monotone_curve_2` is a model of `ArrTraits::XMonotoneCurve_2`. + * `std::optional>`, + * where `%Point_2` is a model of `AosTraits::Point_2` and + * `X_monotone_curve_2` is a model of `AosTraits::XMonotoneCurve_2`. */ template - OutputIterator operator()(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, + OutputIterator operator()(AosTraits::X_monotone_curve_2 xc1, + AosTraits::X_monotone_curve_2 xc2, OutputIterator& oi); -/// @} + /// @} -}; /* end ArrTraits::Intersect_2 */ +}; /* end AosTraits::Intersect_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsOnXIdentification_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsOnXIdentification_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsOnXIdentification_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsOnXIdentification_2.h index 351ae415352..026bd99d0da 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsOnXIdentification_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsOnXIdentification_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{AdaptableUnaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementIdentifiedHorizontalTraits_2::Is_on_x_identification_2} + * \cgalHasModels{AosIdentifiedHorizontalTraits_2::Is_on_x_identification_2} * \cgalHasModelsEnd */ class IsOnXIdentification_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -19,15 +18,14 @@ public: /*! determines whether the point `p` lies on the vertical identification * curve. */ - bool operator()(ArrTraits::Point& point) const; + bool operator()(AosTraits::Point& point) const; /*! determines whether the curve `cv` lies on the vertical identification * curve. */ - bool operator()(ArrTraits::const X_monotone_curve_2& cv) const; + bool operator()(AosTraits::const X_monotone_curve_2& cv) const; /// @} - -}; /* end ArrTraits::IsOnXIdentification_2 */ +}; /* end AosTraits::IsOnXIdentification_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsOnYIdentification_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsOnYIdentification_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsOnYIdentification_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsOnYIdentification_2.h index 5ca8c772233..b2360e98ab0 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsOnYIdentification_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsOnYIdentification_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,12 +6,11 @@ namespace ArrTraits { * \cgalRefines{AdaptableUnaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementIdentifiedVerticalTraits_2::Is_on_y_identification_2} + * \cgalHasModels{AosIdentifiedVerticalTraits_2::Is_on_y_identification_2} * \cgalHasModelsEnd */ class IsOnYIdentification_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -19,15 +18,14 @@ public: /*! determines whether the point `p` lies on the horizontal identification * curve. */ - bool operator()(ArrTraits::Point& point) const; + bool operator()(AosTraits::Point& point) const; /*! determines whether the curve `cv` lies on the horizontal identification * curve. */ - bool operator()(ArrTraits::const X_monotone_curve_2& cv) const; + bool operator()(AosTraits::const X_monotone_curve_2& cv) const; /// @} - -}; /* end ArrTraits::IsOnYIdentification_2 */ +}; /* end AosTraits::IsOnYIdentification_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsVertical_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsVertical_2.h similarity index 66% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsVertical_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsVertical_2.h index e6894c911cf..811f4ca5efa 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--IsVertical_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--IsVertical_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,22 +6,20 @@ namespace ArrTraits { * \cgalRefines{AdaptableUnaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Is_vertical_2} + * \cgalHasModels{AosBasicTraits_2::Is_vertical_2} * \cgalHasModelsEnd */ class IsVertical_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ /*! determines whether `xc` is a vertical segment. */ - bool operator()(ArrTraits::X_monotone_curve_2 xc); + bool operator()(AosTraits::X_monotone_curve_2 xc); /// @} - -}; /* end ArrTraits::IsVertical_2 */ +}; /* end AosTraits::IsVertical_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--MakeXMonotone_2.h similarity index 77% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--MakeXMonotone_2.h index a86290bd333..da38e1f9f84 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--MakeXMonotone_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--MakeXMonotone_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,7 +6,7 @@ namespace ArrTraits { * \cgalRefines{Functor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementTraits_2::Make_x_monotone_2} + * \cgalHasModels{AosTraits_2::Make_x_monotone_2} * \cgalHasModelsEnd */ class MakeXMonotone_2 { @@ -27,13 +27,13 @@ public: * * \pre Dereferencing `oi` must yield a polymorphic object of type * `std::variant<%Point_2, X_monotone_curve_2>`, where `%Point_2` is a model - * of `ArrTraits::Point_2` and `X_monotone_curve_2` is a model of - * `ArrTraits::XMonotoneCurve_2`. + * of `AosTraits::Point_2` and `X_monotone_curve_2` is a model of + * `AosTraits::XMonotoneCurve_2`. */ template - OutputIterator operator()(ArrTraits::Curve_2 c, OutputIterator oi); + OutputIterator operator()(AosTraits::Curve_2 c, OutputIterator oi); /// @} -}; /* end ArrTraits::MakeXMonotone_2 */ +}; /* end AosTraits::MakeXMonotone_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Merge_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Merge_2.h similarity index 53% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Merge_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Merge_2.h index 0ff9c3ff392..6c8bbdf153f 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Merge_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Merge_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,27 +6,25 @@ namespace ArrTraits { * \cgalRefines{Functor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementXMonotoneTraits_2::Merge_2} + * \cgalHasModels{AosXMonotoneTraits_2::Merge_2} * \cgalHasModelsEnd */ class Merge_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ - /*! accepts two mergeable \f$ x\f$-monotone curves `xc1` and `xc2` + /*! accepts two mergeable \f$x\f$-monotone curves `xc1` and `xc2` * and assigns `xc` with the merged curve. * * \pre `are_mergeable_2`(`xc1`, `xc2`) is true. */ - void merge(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, - ArrTraits::X_monotone_curve_2& xc); + void merge(AosTraits::X_monotone_curve_2 xc1, + AosTraits::X_monotone_curve_2 xc2, + AosTraits::X_monotone_curve_2& xc); /// @} - -}; /* end ArrTraits::Merge_2 */ +}; /* end AosTraits::Merge_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ParameterSpaceInX_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ParameterSpaceInX_2.h similarity index 70% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ParameterSpaceInX_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ParameterSpaceInX_2.h index 3f0c55da195..af9e3380718 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ParameterSpaceInX_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ParameterSpaceInX_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,21 +6,20 @@ namespace ArrTraits { * \cgalRefines{AdaptableBinaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementVerticalSideTraits_2::Parameter_space_in_x_2} - * \cgalHasModels{ArrangementOpenBoundaryTraits_2::Parameter_space_in_x_2} - * \cgalHasModels{ArrangementSphericalBoundaryTraits_2::Parameter_space_in_x_2} + * \cgalHasModels{AosVerticalSideTraits_2::Parameter_space_in_x_2} + * \cgalHasModels{AosOpenBoundaryTraits_2::Parameter_space_in_x_2} + * \cgalHasModels{AosSphericalBoundaryTraits_2::Parameter_space_in_x_2} * \cgalHasModelsEnd */ class ParameterSpaceInX_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ /*! Given an \f$x\f$-monotone curve `xcv` and an enumeration `ce` * that specifies either the minimum or the maximum end of the curve, - * determines the location of the curve end along the \f$ x\f$-dimension. The + * determines the location of the curve end along the \f$x\f$-dimension. The * variable `xcv` identifies the parametric curve \f$c(t) = (x(t), y(t))\f$ * defined over an open or half-open interval with endpoints \f$0\f$ and * \f$1\f$. The enumeration `ce` identifies an open end \f$d \in\{0,1\}\f$ of @@ -31,19 +30,18 @@ public: * `CGAL::ARR_LEFT_BOUNDARY`, `CGAL::ARR_RIGHT_BOUNDARY`, or * `CGAL::ARR_INTERIOR`, accordingly. * - * \post If `ArrTraits::Left_side_category` is convertible to + * \post If `AosTraits::Left_side_category` is convertible to * `CGAL::Arr_oblivious_side_tag` then the result is not * `CGAL::ARR_LEFT_BOUNDARY`. * - * \post If `ArrTraits::Right_side_category` is convertible to + * \post If `AosTraits::Right_side_category` is convertible to * `CGAL::Arr_oblivious_side_tag` then the result is not * `CGAL::ARR_RIGHT_BOUNDARY`. */ - CGAL::Arr_parameter_space operator()(const ArrTraits::X_monotone_curve_2& xcv, + CGAL::Arr_parameter_space operator()(const AosTraits::X_monotone_curve_2& xcv, CGAL::Arr_curve_end ce); /// @} - -}; /* end ArrTraits::ParameterSpaceInX_2 */ +}; /* end AosTraits::ParameterSpaceInX_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ParameterSpaceInY_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ParameterSpaceInY_2.h similarity index 73% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ParameterSpaceInY_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ParameterSpaceInY_2.h index c598003b214..a8354c2dd98 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ParameterSpaceInY_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--ParameterSpaceInY_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept @@ -6,14 +6,13 @@ namespace ArrTraits { * \cgalRefines{AdaptableBinaryFunction} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2} - * \cgalHasModels{ArrangementOpenBoundaryTraits_2::Parameter_space_in_y_2} - * \cgalHasModels{ArrangementSphericalBoundaryTraits_2::Parameter_space_in_y_2} + * \cgalHasModels{AosHorizontalSideTraits_2::Parameter_space_in_y_2} + * \cgalHasModels{AosOpenBoundaryTraits_2::Parameter_space_in_y_2} + * \cgalHasModels{AosSphericalBoundaryTraits_2::Parameter_space_in_y_2} * \cgalHasModelsEnd */ class ParameterSpaceInY_2 { public: - /// \name Operations /// A model of this concept must provide: /// @{ @@ -22,7 +21,7 @@ public: * that specifies either the minimum or the maximum end of the curve, * determines the location of the curve end along the \f$y\f$-dimension. The * variable `xcv` identifies the parametric curve \f$c(t) = (x(t),y(t))\f$ - * defined over an open or half-open interval with endpoints \f$ 0\f$ and + * defined over an open or half-open interval with endpoints \f$0\f$ and * \f$1\f$. The enumeration `ce` identifies an open end \f$d \in\{0,1\}\f$ of * \f$c\f$. Formally, determines whether \f$\lim_{t \rightarrow d} y(t)\f$ * evaluates to \f$b_b\f$, \f$b_t\f$, or a value in between, where \f$b_b\f$ @@ -30,19 +29,18 @@ public: * of the parameter space, respectively. Returns `CGAL::ARR_BOTTOM_BOUNDARY`, * `CGAL::ARR_TOP_BOUNDARY`, or `CGAL::ARR_INTERIOR`, accordingly. * - * \post If `ArrTraits::Bottom_side_category` is convertible to + * \post If `AosTraits::Bottom_side_category` is convertible to * `CGAL::Arr_oblivious_side_tag` then the result is not * `CGAL::ARR_BOTTOM_BOUNDARY` . * - * \post If `ArrTraits::Top_side_category` is convertible to + * \post If `AosTraits::Top_side_category` is convertible to * `CGAL::Arr_oblivious_side_tag` then the result is not * `CGAL::ARR_TOP_BOUNDARY`. */ - CGAL::Arr_parameter_space operator()(const ArrTraits::X_monotone_curve_2& xcv, + CGAL::Arr_parameter_space operator()(const AosTraits::X_monotone_curve_2& xcv, CGAL::Arr_curve_end ce); -/// @} - -}; /* end ArrTraits::ParameterSpaceInY_2 */ + /// @} +}; /* end AosTraits::ParameterSpaceInY_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Point_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Point_2.h similarity index 64% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Point_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Point_2.h index 337ccf35ae5..8854a4a2ffa 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Point_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Point_2.h @@ -1,4 +1,4 @@ -namespace ArrTraits { +namespace AosTraits { /*! \ingroup PkgArrangementOnSurface2ConceptsGeometricObjects * \cgalConcept @@ -8,12 +8,9 @@ namespace ArrTraits { * \cgalRefines{CopyConstructible,Assignable,DefaultConstructible} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::Point_2} + * \cgalHasModels{AosBasicTraits_2::Point_2} * \cgalHasModelsEnd */ -class Point_2 { -public: - -}; /* end ArrTraits::Point_2 */ +class Point_2 {}; } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Split_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Split_2.h similarity index 62% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Split_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Split_2.h index 68a833aa549..b789dcb991c 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Split_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--Split_2.h @@ -1,11 +1,12 @@ -namespace ArrTraits { +namespace AosTraits { + /*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects * \cgalConcept * * \cgalRefines{Functor} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementXMonotoneTraits_2::Split_2} + * \cgalHasModels{AosXMonotoneTraits_2::Split_2} * \cgalHasModelsEnd */ class Split_2 { @@ -18,13 +19,12 @@ public: * splits `xc` at the split point into two subcurves `xc1` and `xc2`, such * that `p` is `xc1`'s right endpoint and `xc2`'s left endpoint. */ - void operator()(ArrTraits::X_monotone_curve_2 xc, - ArrTraits::Point_2 p, - ArrTraits::X_monotone_curve_2& xc1, - ArrTraits::X_monotone_curve_2& xc2); + void operator()(AosTraits::X_monotone_curve_2 xc, + AosTraits::Point_2 p, + AosTraits::X_monotone_curve_2& xc1, + AosTraits::X_monotone_curve_2& xc2); /// @} - -}; /* end ArrTraits::Split_2 */ +}; /* end AosTraits::Split_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--XMonotoneCurve_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--XMonotoneCurve_2.h similarity index 62% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--XMonotoneCurve_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--XMonotoneCurve_2.h index 3b61bb2dca4..dc21fbee02d 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--XMonotoneCurve_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits--XMonotoneCurve_2.h @@ -1,4 +1,5 @@ -namespace ArrTraits { +namespace AosTraits { + /*! \ingroup PkgArrangementOnSurface2ConceptsGeometricObjects * \cgalConcept * @@ -7,12 +8,9 @@ namespace ArrTraits { * \cgalRefines{CopyConstructible,Assignable,DefaultConstructible} * * \cgalHasModelsBegin - * \cgalHasModels{ArrangementBasicTraits_2::X_monotone_curve_2} + * \cgalHasModels{AosBasicTraits_2::X_monotone_curve_2} * \cgalHasModelsEnd */ -class XMonotoneCurve_2 { -public: - -}; /* end ArrTraits::XMonotoneCurve_2 */ +class XMonotoneCurve_2 {}; } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits_2.h new file mode 100644 index 00000000000..c65fd9ee100 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosTraits_2.h @@ -0,0 +1,78 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits + * \cgalConcept + * + * The concept `AosTraits_2` allows the construction of arrangement of + * general planar curves. Models of this concept are used by the free + * \link PkgArrangementOnSurface2Insert `CGAL::insert()` \endlink functions of + * the arrangement package and by the `CGAL::Arrangement_with_history_2` class. + * + * A model of this concept must define the nested `Curve_2` type, which + * represents a general planar curve that is not necessarily \f$x\f$-monotone + * and is not necessarily connected. Such curves are eventually subdivided into + * \f$x\f$-monotone subcurves and isolated points (represented by the `Point_2` + * and `X_monotone_curve_2` types, defined in the basic traits concept). + * + * A model of the concept `AosTraits_2` that handles arbitrary curves, + * which are always \f$x\f$-monotone, such as a traits class that handles + * linear curves may define the nested types `Curve_2` and + * `X_monotone_curve_2` to be of equivalent types. Moreover, defining + * them as of equivalent types is advantageous, as it enables a generic + * simple implementation of the nested Functor + * `Make_x_monotone_2`. + * + * On the other hand, a model of the `AosTraits_2` concept that handles + * arbitrary curves, which may be not \f$x\f$-monotone must define the + * `Curve_2` and `X_monotone_curve_2` nested types to be of + * different types to allow proper dispatching of the free functions + * that accept such curves, such as `intsert()`. + * + * \cgalRefines{AosXMonotoneTraits_2} + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_segment_traits_2} + * \cgalHasModels{CGAL::Arr_non_caching_segment_traits_2} + * \cgalHasModels{CGAL::Arr_linear_traits_2} + * \cgalHasModels{CGAL::Arr_polyline_traits_2} + * \cgalHasModels{CGAL::Arr_circle_segment_traits_2} + * \cgalHasModels{CGAL::Arr_line_arc_traits_2} + * \cgalHasModels{CGAL::Arr_circular_arc_traits_2} + * \cgalHasModels{CGAL::Arr_circular_line_arc_traits_2} + * \cgalHasModels{CGAL::Arr_conic_traits_2} + * \cgalHasModels{CGAL::Arr_rational_function_traits_2} + * \cgalHasModels{CGAL::Arr_Bezier_curve_traits_2} + * \cgalHasModels{CGAL::Arr_algebraic_segment_traits_2} + * \cgalHasModels{CGAL::Arr_curve_data_traits_2} + * \cgalHasModels{CGAL::Arr_consolidated_curve_data_traits_2} + * \cgalHasModelsEnd + * + * \sa `AosBasicTraits_2` + * \sa `AosXMonotoneTraits_2` + * \sa `AosLandmarkTraits_2` + */ +class AosTraits_2 { +public: + /// \name Types + /// @{ + + ///! models the concept `AosTraits::Curve_2`. + typedef unspecified_type Curve_2; + + /// @} + + /// \name Functor Types + /// @{ + + /// models the concept `AosTraits::MakeXMonotone_2`. + typedef unspecified_type Make_x_monotone_2; + + /// @} + + /// \name Accessing Functor Objects + /// @{ + + /*! + */ + Make_x_monotone_2 make_x_monotone_2_object() const; + + /// @} +}; /* end AosTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosVerticalRayShoot_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosVerticalRayShoot_2.h new file mode 100644 index 00000000000..bd488ffe20a --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosVerticalRayShoot_2.h @@ -0,0 +1,111 @@ +/*! \ingroup PkgArrangementOnSurface2Concepts + * \cgalConcept + * + * A model of the `AosVerticalRayShoot_2` concept can answer vertical + * ray-shooting queries on an arrangement attached to it. Namely, given a + * `Arrangement_2::Point_2` object, representing a point in the plane, it + * returns the arrangement feature (edge or vertex) that lies strictly above it + * (or below it). By "strictly" we mean that if the query point lies on an + * arrangement edge (or on an arrangement vertex) this edge will not be + * the query result, but the feature lying above or below it. (An exception to + * this rule is the degenerate case where the query point lies in the interior + * of a vertical edge.) Note that it may happen that the query point lies above + * the upper envelope (or below the lower envelope) of the arrangement, and the + * vertical ray emanating from the query point goes to infinity without hitting + * any arrangement feature on its way. In this case the unbounded face is + * returned. + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_naive_point_location} + * \cgalHasModels{CGAL::Arr_walk_along_line_point_location} + * \cgalHasModels{CGAL::Arr_trapezoid_ric_point_location} + * \cgalHasModels{CGAL::Arr_landmarks_point_location} + * \cgalHasModelsEnd + * + * \sa `CGAL::Arr_naive_point_location` + * \sa `CGAL::Arr_walk_along_line_point_location` + * \sa `CGAL::Arr_trapezoid_ric_point_location` + * \sa `CGAL::Arr_landmarks_point_location` + * \sa `CGAL::Arr_point_location_result` + */ +class AosVerticalRayShoot_2 { +public: + /// \name Types + /// @{ + + //! the associated arrangement type. + typedef unspecified_type Arrangement_2; + + //! equivalent to `Arrangement_2::Point_2`. + typedef unspecified_type Point_2; + + /// @} + + /// \name Creation + /// @{ + + /*! default constructor. + */ + AosVerticalRayShoot_2(); + + /*! constructs a ray-shooting object `rs` attached to the given arrangement + * `arr`. + */ + AosVerticalRayShoot_2 (const Arrangement_2& arr); + + /// @} + + /// \name Query Functions + /// @{ + + /*! locates the arrangement feature that is first hit by an upward-directed + * vertical ray emanating from the query point `q`, and returns a handle for + * this feature. The function returns a + * discriminated union container of the following bounded types: + * + *
    + *
  • `Arrangement_2::Halfedge_const_handle`, in case the vertical + * ray hits an arrangement edge; + *
  • `Arrangement_2::Vertex_const_handle`, in case the vertical + * ray hits an arrangement vertex. + *
  • `Arrangement_2::Face_const_handle` for the unbounded arrangement + * face, in case `q` lies above the upper envelope of the arrangement. + *
+ * + * \pre `rs` is attached to a valid arrangement instance. + */ + Arr_point_location_result::Type ray_shoot_up(const Point_2& q) const; + + /*! locates the arrangement feature that is first hit by a downward-directed + * vertical ray emanating from the query point `q`, and returns a handle for + * this feature. The function returns a discriminated union container of the + * following bounded types: + * + *
    + *
  • `Arrangement_2::Halfedge_const_handle`, in case the vertical + * ray hits an arrangement edge; + *
  • `Arrangement_2::Vertex_const_handle`, in case the vertical + * ray hits an arrangement vertex. + *
  • `Arrangement_2::Face_const_handle` for the unbounded arrangement + * face, in case `q` lies below the lower envelope of the arrangement. + *
+ * + * \pre `rs` is attached to a valid arrangement instance. + */ + Arr_point_location_result::Type ray_shoot_down(const Point_2& q) const; + + /// @} + + /// \name Operations + /// @{ + + /*! attaches `rs` to the given arrangement `arr`. + */ + void attach (const Arrangement_2& arr); + + /*! detaches `rs` from the arrangement it is currently attached to. + */ + void detach (); + + /// @} +}; /* end AosVerticalRayShoot_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosVerticalSideTraits_2.h similarity index 76% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalSideTraits_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosVerticalSideTraits_2.h index 88802d7ad61..0f474e380b6 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalSideTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosVerticalSideTraits_2.h @@ -1,7 +1,7 @@ /*! \ingroup PkgArrangementOnSurface2ConceptsTraits * \cgalConcept * - * `ArrangementVerticalSideTraits_2` is an abstract concept. It generalizes all + * `AosVerticalSideTraits_2` is an abstract concept. It generalizes all * concepts that handle curves that either reach or approach either the left or * right sizeds of the boundary of the parameter space. (An "abstract" concept * is a concept that is useless on its own.) Only a combination of this concept @@ -9,7 +9,7 @@ * remaining boundary sides (that is, bottom and top) are purposeful, and can * have models. * - * \cgalRefines{ArrangementBasicTraits_2} + * \cgalRefines{AosBasicTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Arr_linear_traits_2} @@ -18,11 +18,10 @@ * \cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2} * \cgalHasModelsEnd * - * \sa `ArrangementVerticalSideTraits_2` + * \sa `AosVerticalSideTraits_2` */ -class ArrangementVerticalSideTraits_2 { +class AosVerticalSideTraits_2 { public: - /// \name Categories /// @{ /// @} @@ -34,10 +33,10 @@ public: /// \name Functor Types /// @{ - /// models the concept `ArrTraits::ParameterSpaceInX_2`. + /// models the concept `AosTraits::ParameterSpaceInX_2`. typedef unspecified_type Parameter_space_in_x_2; - /// models the concept `ArrTraits::CompareYNearBoundary_2`. + /// models the concept `AosTraits::CompareYNearBoundary_2`. typedef unspecified_type Compare_y_near_boundary_2; /// @} @@ -47,5 +46,4 @@ public: Parameter_space_in_x_2 parameter_space_in_x_2_object() const; Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const; /// @} - -}; /* end ArrangementHorizontalSideTraits_2 */ +}; /* end AosHorizontalSideTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosWithHistoryInputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosWithHistoryInputFormatter.h new file mode 100644 index 00000000000..31336368078 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosWithHistoryInputFormatter.h @@ -0,0 +1,62 @@ +/*! \ingroup PkgArrangementOnSurface2Concepts + * \cgalConcept + * + * A model for the `AosWithHistoryInputFormatter` concept supports a set of + * functions that enable reading an arrangement-with-history instance from an + * input stream using a specific format. + * + * \cgalRefines{AosInputFormatter} + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_with_history_text_formatter} + * \cgalHasModelsEnd + */ +class AosWithHistoryInputFormatter { +public: + /// \name Types + /// @{ + + /*! the type of arrangement to input. + */ + typedef unspecified_type Arr_with_history_2; + + /*! the inducing curve type. + */ + typedef typename Arrangement_2::Curve_2 Curve_2; + + /// @} + + /// \name Formatted Input Functions + /// @{ + + /*! reads a message indicating the beginning of the inducing curves. + */ + void read_curves_begin(); + + /*! reads a message indicating the end of the inducing curves. + */ + void read_curves_end(); + + /*! reads a message indicating the beginning of a single curve record. + */ + void read_curve_begin(); + + /*! reads a message indicating the end of a single curve record. + */ + void read_curve_end(); + + /*! reads a curve. + */ + void read_curve(Curve_2& c); + + /*! reads a message indicating the beginning of the set of edges + * induced by the current curve. + */ + void read_induced_edges_begin(); + + /*! reads a message indicating the end of the induced edges set. + */ + void read_induced_edges_end(); + + /// @} +}; /* end AosWithHistoryInputFormatter */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementWithHistoryOutputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosWithHistoryOutputFormatter.h similarity index 74% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementWithHistoryOutputFormatter.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosWithHistoryOutputFormatter.h index 2aa87cc1d95..b72d935a8a2 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementWithHistoryOutputFormatter.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosWithHistoryOutputFormatter.h @@ -1,21 +1,19 @@ +/*! \ingroup PkgArrangementOnSurface2Concepts + * \cgalConcept -/*! -\ingroup PkgArrangementOnSurface2Concepts -\cgalConcept - -A model for the `ArrangementWithHistoryOutputFormatter` concept supports a set of functions that enable +A model for the `AosWithHistoryOutputFormatter` concept supports a set of functions that enable writing an arrangement-with-history instance to an output stream using a specific format. -\cgalRefines{ArrangementOutputFormatter} +\cgalRefines{AosOutputFormatter} \cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_with_history_text_formatter} +\cgalHasModels{CGAL::Arr_with_history_text_formatter} \cgalHasModelsEnd */ -class ArrangementWithHistoryOutputFormatter { +class AosWithHistoryOutputFormatter { public: /// \name Types @@ -74,5 +72,4 @@ void write_induced_edges_end(); /// @} -}; /* end ArrangementWithHistoryOutputFormatter */ - +}; /* end AosWithHistoryOutputFormatter */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosXMonotoneTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosXMonotoneTraits_2.h new file mode 100644 index 00000000000..c03fad48b2a --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/AosXMonotoneTraits_2.h @@ -0,0 +1,113 @@ +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits + * \cgalConcept + * + * The concept `AosXMonotoneTraits_2` refines the basic arrangement-traits + * concept. A model of this concept is able to handle \f$x\f$-monotone curves + * that intersect in their interior (and points that coincide with curve + * interiors). This is necessary for constructing arrangements of sets of + * intersecting \f$x\f$-monotone curves. + * + * As the resulting structure, represented by the `Arrangement_2` class, stores + * pairwise interior-disjoint curves, the input curves are split at the + * intersection points before being inserted into the arrangement. A model of + * this refined concept therefore needs to compute the intersections (and + * possibly overlaps) between two \f$x\f$-monotone curves and to support curve + * splitting. + * + * \cgalRefines{AosBasicTraits_2} + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_segment_traits_2} + * \cgalHasModels{CGAL::Arr_non_caching_segment_traits_2} + * \cgalHasModels{CGAL::Arr_linear_traits_2} + * \cgalHasModels{CGAL::Arr_polyline_traits_2} + * \cgalHasModels{CGAL::Arr_circle_segment_traits_2} + * \cgalHasModels{CGAL::Arr_line_arc_traits_2} + * \cgalHasModels{CGAL::Arr_circular_arc_traits_2} + * \cgalHasModels{CGAL::Arr_circular_line_arc_traits_2} + * \cgalHasModels{CGAL::Arr_conic_traits_2} + * \cgalHasModels{CGAL::Arr_rational_function_traits_2} + * \cgalHasModels{CGAL::Arr_Bezier_curve_traits_2} + * \cgalHasModels{CGAL::Arr_algebraic_segment_traits_2} + * \cgalHasModels{CGAL::Arr_curve_data_traits_2} + * \cgalHasModels{CGAL::Arr_consolidated_curve_data_traits_2} + * \cgalHasModelsEnd + * + * \sa `AosBasicTraits_2` + */ +class AosXMonotoneTraits_2 { +public: + /// \name Types + /// @{ + + /// the multiplicity type. + typedef unspecified_type Multiplicity; + + /// @} + + /// \name Tags + /// @{ + + /*! indicates whether the nested functors `Are_mergeable_2` and `Merge_2` + * are provided. + */ + typedef unspecified_type Has_merge_category; + + /// @} + + /// \name Functor Types + /// @{ + + /// models the concept `AosTraits::Intersect_2`. + typedef unspecified_type Intersect_2; + + /// models the concept `AosTraits::Split_2`. + typedef unspecified_type Split_2; + + /// @} + + /// \name + /// \attention The two following function-object types are + /// optional. If they are supported, the `Has_merge_category` tag + /// should be defined as `Tag_true` and otherwise as `Tag_false`. + /// @{ + + /*! models the concept `AosTraits::AreMergeable_2`. + */ + typedef unspecified_type Are_mergeable_2; + + /*! models the concept `AosTraits::Merge_2`. + */ + typedef unspecified_type Merge_2; + + /// @} + + /// \name Accessing Functor Objects + /// @{ + + /*! + */ + Intersect_2 intersect_2_object() const; + + /*! + */ + Split_2 split_2_object() const; + + /// @} + + /// \name + /// The two following methods are optional. If they are supported, the + /// `Has_merge_category` tag should be defined as `Tag_true` and otherwise + /// as `Tag_false`. + /// @{ + + /*! + */ + Are_mergeable_2 are_mergeable_2_object() const; + + /*! + */ + Merge_2 merge_2_object() const; + + /// @} +}; /* end AosXMonotoneTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Approximate_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Approximate_2.h deleted file mode 100644 index fc450689a0d..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Approximate_2.h +++ /dev/null @@ -1,28 +0,0 @@ -namespace ArrTraits { - -/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects - * \cgalConcept - * - * \cgalRefines{Functor} - * - * \cgalHasModelsBegin - * \cgalHasModels{ArrangementApproximateTraits_2::Approximate_2} - * \cgalHasModelsEnd - */ -class Approximate_2 { -public: - - /// \name Operations - /// A model of this concept must provide: - /// @{ - - /*! obtains an approximation of `p`'s \f$x\f$-coordinate (if `i` == 0), or of - * `p`'s \f$y\f$-coordinate (if `i` == 1). - */ - CGAL::Approximate_number_type operator()(ArrTraits::Point_2 p, int i); - - /// @} - -}; /* end ArrTraits::Approximate_2 */ - -} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundaryOfCurveEnd_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundaryOfCurveEnd_2.h deleted file mode 100644 index 28208660fec..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundaryOfCurveEnd_2.h +++ /dev/null @@ -1,76 +0,0 @@ -namespace ArrTraits { - -/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects - * \cgalConcept - * - * \cgalRefines{AdaptableFunctor} - * - * \cgalHasModelsBegin - * \cgalHasModels{ArrangementHorizontalSideTraits_2::Compare_x_on_boundary_2} - * \cgalHasModels{ArrangementOpenBoundaryTraits_2::Compare_x_on_boundary_2} - * \cgalHasModels{ArrangementSphericalBoundaryTraits_2::Compare_x_on_boundary_2} - * \cgalHasModelsEnd - */ -class CompareXOnBoundaryOfCurveEnd_2 { -public: - - /// \name Operations - /// A model of this concept must provide: - /// @{ - - /*! Given a point `p`, an \f$x\f$-monotone curve `xcv`, and an - * enumeration `ce` that specifies either the minimum or the maximum end of - * the curve where the curve has a vertical asymptote, compares the \f$ - * x\f$-coordinate of `p` and the \f$x\f$-coordinate of the limit of the - * curve at its specified end. The variable `xcv` identifies the parametric - * curve \f$c(t) = (x(t), y(t))\f$ defined over an open or half-open interval - * with endpoints \f$ 0\f$ and \f$ 1\f$. The enumeration `ce` identifies an - * open end \f$d \in\{0,1\}\f$ of \f$c\f$. Formally, compares the \f$ - * x\f$-coordinate of `p` and \f$ \lim_{t \rightarrow d} x(t)\f$. Returns - * `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. - * - * \pre \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink (`xcv`, `ce`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. - * - * \pre If the parameter space is unbounded, \f$c\f$ has a vertical asymptote - * at its \f$ d\f$-end; that is, - * \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink(`xcv`, `ce`) = `CGAL::ARR_INTERIOR`. - */ - Comparison_result operator()(const ArrTraits::Point_2& p, - const ArrTraits::X_monotone_curve_2& xcv, - CGAL::Arr_curve_end ce); - -/*! Given two \f$ x\f$-monotone curves `xcv1` and `xcv2` and two indices `ce1` - * and `ce2` that specify either the minimum or the maximum ends of `xcv1` and - * `xcv2`, respectively, where the curves have vertical asymptotes, compares the - * \f$ x\f$-coordinates of the limits of the curves at their specified - * ends. The variables `xcv1` and `xcv2` identify the parametric curves \f$ - * c_1(t) = (x_1(t),y_1(t))\f$ and \f$ c_2(t) = (x_2(t),y_2(t))\f$, - * respectively, defined over open or half-open intervals with endpoints \f$ - * 0\f$ and \f$ 1\f$. The indices `ce1` and `ce2` identify open ends \f$ d_1 - * \in\{0,1\}\f$ and \f$ d_2 \in\{0,1\}\f$ of \f$ c_1\f$ and \f$ c_2\f$, - * respectively. Formally, compares \f$ \lim_{t \rightarrow d_1} x_1(t)\f$ and - * \f$\lim_{t \rightarrow d_2} x_2(t)\f$. Returns `CGAL::SMALLER`, - * `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. - * - * \pre \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink(`xcv1`, `ce1`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. - * - * \pre \link ArrangementHorizontalSideTraits_2::Parameter_space_in_y_2 `Parameter_space_in_y_2`\endlink(`xcv2`, `ce2`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. - * - * \pre If the parameter space is unbounded, \f$c_1\f$ has a vertical - * asymptote at its respective end; that is, - * \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink(`xcv1`, `ce1`) = `CGAL::ARR_INTERIOR`. - * - * \pre If the parameter space is unbounded, \f$c_2\f$ has a vertical asymptote - * at its respective end; that is, - * \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 `Parameter_space_in_x_2`\endlink(`xcv2`, `ce2`) = `CGAL::ARR_INTERIOR`. - */ -Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, - CGAL::Arr_curve_end ce1, - const ArrTraits::X_monotone_curve_2& xcv2, - CGAL::Arr_curve_end ce2); - -/// @} - -}; /* end ArrTraits::CompareXOnBoundaryOfCurveEnd_2 */ - -} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYOnBoundary_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYOnBoundary_2.h deleted file mode 100644 index 206458c178b..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareYOnBoundary_2.h +++ /dev/null @@ -1,39 +0,0 @@ -namespace ArrTraits { - -/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects - * \cgalConcept - * - * \cgalRefines{AdaptableBinaryFunction} - * - * \cgalHasModelsBegin - * \cgalHasModels{ArrangementClosedLeftTraits_2::Compare_y_on_boundary_2} - * \cgalHasModels{ArrangementClosedRightTraits_2::Compare_y_on_boundary_2} - * \cgalHasModels{ArrangementIdentifiedVerticalTraits_2::Compare_y_on_boundary_2} - * \cgalHasModels{ArrangementSphericalBoundaryTraits_2::Compare_y_on_boundary_2} - * \cgalHasModelsEnd - */ -class CompareYOnBoundary_2 { -public: - - /// \name Operations - /// A model of this concept must provide: - /// @{ - - /*! Given two points `p1` and `p2`, such that either `p1` or `p2` (or both) - * lie on the bottom or top boundary of the parameter space, compares the \f$ - * y\f$-coordinate of `p1` and the \f$y\f$-coordinate of `p2`. Returns - * `CGAL::SMALLER`, `CGAL::EQUAL`, or `CGAL::LARGER` accordingly. - * - * \pre \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 - * `Parameter_space_in_x_2`\endlink (`p1`) \f$\neq\f$ `CGAL::ARR_INTERIOR` or - * \link ArrangementVerticalSideTraits_2::Parameter_space_in_x_2 - * `Parameter_space_in_x_2`\endlink (`p2`) \f$\neq\f$ `CGAL::ARR_INTERIOR`. - */ - Comparison_result operator()(const ArrTraits::Point_2& p1, - const ArrTraits::Point_2& p2); - -/// @} - -}; /* end ArrTraits::CompareYOnBoundary_2 */ - -} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructCurve_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructCurve_2.h deleted file mode 100644 index 12a1109a33b..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--ConstructCurve_2.h +++ /dev/null @@ -1,28 +0,0 @@ -namespace ArrTraits { - -/*! \ingroup PkgArrangementOnSurface2ConceptsFunctionObjects - * \cgalConcept - * - * \cgalRefines{Functor} - * - * \cgalHasModelsBegin - * \cgalHasModels{ArrangementConstructCurveTraits_2::Construct_curve_2} - * \cgalHasModelsEnd - */ -class ConstructCurve_2 { -public: - - /// \name Operations - /// A model of this concept must provide: - /// @{ - - /*! returns a curve connecting `p1` and `p2` (i.e., the - * two input points are its endpoints). - */ - ArrTraits::Curve_2 operator()(ArrTraits::Point_2 p1, ArrTraits::Point_2 p2); - - /// @} - -}; /* end ArrTraits::ConstructCurve_2 */ - -} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h deleted file mode 100644 index 7dfd9a01f6b..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h +++ /dev/null @@ -1,55 +0,0 @@ -/*! -\ingroup PkgArrangementOnSurface2ConceptsTraits -\cgalConcept - -The concept `ArrangementApproximateTraits_2` refines the basic traits concept -`ArrangementBasicTraits_2`. A model of this concept is able to approximate a -point. - -\cgalRefines{ArrangementBasicTraits_2} - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_conic_traits_2} -\cgalHasModels{CGAL::Arr_geodesic_arc_on_sphere_traits_2} -\cgalHasModels{CGAL::Arr_linear_traits_2} -\cgalHasModels{CGAL::Arr_non_caching_segment_traits_2} -\cgalHasModels{CGAL::Arr_segment_traits_2} -\cgalHasModels{CGAL::Arr_polycurve_traits_2} -\cgalHasModels{CGAL::Arr_polyline_traits_2} -\cgalHasModels{CGAL::Arr_rational_function_traits_2} -\cgalHasModelsEnd - -\sa `ArrangementConstructXMonotoneCurveTraits_2`, - `ArrangementXMonotoneTraits_2`, and - `ArrangementTraits_2` -*/ -class ArrangementApproximateTraits_2 { -public: - /// \name Types - /// @{ - - /*! - * the number type used to approximate point coordinates, e.g., double. - */ - typedef unspecified_type Approximate_number_type; - - /// @} - - /// \name Functor Types - /// @{ - - /*! - * models the concept `ArrTraits::Approximate_2`. - */ - typedef unspecified_type Approximate_2; - /// @} - /// \name Accessing Functor Objects - /// @{ - - /*! - * - */ - Approximate_2 approximate_2_object() const; - - /// @} -} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcel.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcel.h deleted file mode 100644 index b0cb67e12e9..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcel.h +++ /dev/null @@ -1,234 +0,0 @@ -/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL - * \cgalConcept - * - * A doubly-connected edge-list (\dcel for short) data-structure. It consists of - * three containers of records: vertices \f$ V\f$, halfedges \f$ E\f$, and faces - * \f$ F\f$. It maintains the incidence relation among them. The halfedges are - * ordered in pairs sometimes referred to as twins, such that each halfedge pair - * represent an edge. - * - * A model of the `ArrangementDcel` concept must provide the following types and - * operations. (In addition to the requirements here, the local types - * `Vertex`,`Halfedge`, `Face`, `Outer_ccb`, `Inner_ccb`, and `Isolated_vertex` - * must be models of the concepts `ArrangementDcelVertex`, - * `ArrangementDcelHalfedge`, `ArrangementDcelFace`, `ArrangementDcelOuterCcb`, - * `ArrangementDcelInnerCcb`, and `ArrangementDcelIsolatedVertex` respectively.) - * - * \cgalHasModelsBegin - * \cgalHasModels{CGAL::Arr_dcel_base} - * \cgalHasModels{CGAL::Arr_default_dcel} - * \cgalHasModels{CGAL::Arr_face_extended_dcel} - * \cgalHasModels{CGAL::Arr_extended_dcel} - * \cgalHasModelsEnd - * - * \sa `ArrangementDcelVertex` - * \sa `ArrangementDcelHalfedge` - * \sa `ArrangementDcelFace` - * \sa `ArrangementDcelOuterCcb` - * \sa `ArrangementDcelInnerCcb` - * \sa `ArrangementDcelIsolatedVertex` - */ - -class ArrangementDcel { -public: - -/// \name Types -/// @{ - -/*! the vertex type. */ -typedef unspecified_type Vertex; - -/*! the halfedge type. */ -typedef unspecified_type Halfedge; - -/*! the face type. */ -typedef unspecified_type Face; - -/*! the Outer CCB type. */ -typedef unspecified_type Outer_ccb; - -/*! the Inner CCB type. */ -typedef unspecified_type Inner_ccb; - -/*! the hole (i.e., Inner_ccb) type. */ -typedef unspecified_type Hole; - -/*! the isolated vertex type. */ -typedef unspecified_type Isolated_vertex; - -/*! used to represent size values (e.g., `size_t`). */ -typedef unspecified_type Size; - -/*! a bidirectional iterator over the vertices. Its value-type is `Vertex`. */ -typedef unspecified_type Vertex_iterator; - -/*! a bidirectional iterator over the vertices. Its value-type is `Vertex`. */ -typedef unspecified_type Vertex_const_iterator; - -/*! a bidirectional iterator over the halfedges. Its value-type is `Halfedge`. */ -typedef unspecified_type Halfedge_iterator; - -/*! a bidirectional iterator over the halfedges. Its value-type is `Halfedge`. */ -typedef unspecified_type Halfedge_const_iterator; - -/*! a bidirectional iterator over the faces. Its value-type is `Face`. */ -typedef unspecified_type Face_iterator; - -/*! a bidirectional iterator over the faces. Its value-type is `Face`. */ -typedef unspecified_type Face_const_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! constructs an empty \dcel with one unbounded face. - */ -Arr_dcel(); - -/*! assigns the contents of the `other` \dcel whose unbounded face is given by - * `uf`, to `dcel`. The function returns a pointer to the unbounded face of - * `dcel` after the assignment. - */ -Face* assign(const Self& other, const Face *uf); - -/// @} - -/// \name Access Functions -/// @{ - -/*! obtains the number of vertices. */ -Size size_of_vertices() const; - -/*! obtains the number of halfedges (always even). */ -Size size_of_halfedges() const; - -/*! obtains the number of faces. */ -Size size_of_faces() const; - -/*! obtains the number of outer CCBs. */ -Size size_of_outer_ccbs() const; - -/*! obtains the number of inner CCBs. */ -Size size_of_inner_ccbs() const; - -/*! obtains the number of holes (i.e., inner CCBs). */ -Size size_of_holes() const; - -/*! obtains the number of isolated vertices. */ -Size size_of_isolated_vertices() const; - -/*! obtains a begin-iterator of the vertices in `dcel`. */ -Vertex_iterator vertices_begin(); - -/*! obtains a past-the-end iterator of the vertices in `dcel`. */ -Vertex_iterator vertices_end(); - -/*! obtains a range over handles of the vertices in `dcel`. */ -unspecified_type vertex_handles(); - -/*! obtains a begin-iterator of the vertices in `dcel`. */ -Vertex_const_iterator vertices_begin() const; - -/*! obtains a past-the-end iterator of the vertices in `dcel`. */ -Vertex_const_iterator vertices_end() const; - -/*! obtains a const range (model of `ConstRange`) over handles of the vertices - * in `dcel`. - */ -unspecified_type vertex_handles() const; - -/*! obtains a begin-iterator of the halfedges in `dcel`. */ -Halfedge_iterator halfedges_begin(); - -/*! obtains a past-the-end iterator of the halfedges in `dcel`. */ -Halfedge_iterator halfedges_end(); - -/*! obtains a range over handles of the halfedges in `dcel`. */ -unspecified_type halfedge_handles(); - -/*! obtains a begin-iterator of the halfedges in `dcel`. */ -Halfedge_const_iterator halfedges_begin() const; - -/*! obtains a past-the-end iterator of the halfedges in `dcel`. */ -Halfedge_const_iterator halfedges_end() const; - -/*! obtains a const range (model of `ConstRange`) over handles of the halfedges - * in `dcel`. - */ -unspecified_type halfedge_handles() const; - -/*! obtains a begin-iterator of the faces in `dcel`. */ -Face_iterator faces_begin(); - -/*! obtains a past-the-end iterator of the faces in `dcel`. */ -Face_iterator faces_end(); - -/*! obtains a range over handles of the faces in `dcel`. */ -unspecified_type face_handles(); - -/*! obtains a begin-iterator of the faces in `dcel`. */ -Face_const_iterator faces_begin() const; - -/*! obtains a past-the-end iterator of the faces in `dcel`. */ -Face_const_iterator faces_end() const; - -/*! obtains a const range (model of `ConstRange`) over handles of the faces in - * `dcel`. - */ -unspecified_type face_handles() const; - -/// @} - -/// \name Modifiers -/// The following operations allocate a new element of the respective -/// type. Halfedges are always allocated in pairs of opposite -/// halfedges. The halfedges and their opposite pointers are -/// automatically set. -/// @{ - -/*! creates a new vertex. */ -Vertex* new_vertex(); - -/*! creates a new pair of twin halfedges. */ -Halfedge* new_edge(); - -/*! creates a new face. */ -Face* new_face(); - -/*! creates a new outer CCB record. */ -Hole* new_outer_ccb(); - -/*! creates a new inner CCB record. */ -Hole* new_inner_ccb(); - -/*! creates a new hole (i.e., inner CCB) record. */ -Hole* new_hole(); - -/*! creates a new isolated vertex record. */ -Isolated_vertex* new_isolated_vertex(); - -/*! deletes a given vertex `v`. */ -void delete_vertex(Vertex* v); - -/*! deletes a given halfedge `e` as well as its twin. */ -void delete_edge(Halfedge* e); - -/*! deletes a given face `f`. */ -void delete_face(Face* f); - -/*! deletes a given outer CCB `oc`. */ -void delete_outer_ccb(Outer_ccb* oc); - -/*! deletes a given inner CCB `ic`. */ -void delete_inner_ccb(Inner_ccb* oc); - -/*! deletes a given hole (i.e., inner CCB) `ho`. */ -void delete_hole(Hole* ho); - -/*! deletes a given isolated vertex `iv`. */ -void delete_isolated_vertex(Isolated_vertex* iv); - -/// @} - -}; /* end ArrangementDcel */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelFace.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelFace.h deleted file mode 100644 index dc3fa8f8674..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelFace.h +++ /dev/null @@ -1,156 +0,0 @@ -/*! - * \ingroup PkgArrangementOnSurface2ConceptsDCEL - * \cgalConcept - * - * A face record in a \dcel data structure. A face represents a region, which - * may have outer and inner boundaries. A boundary conists of a chain of - * incident halfedges, referred to as a Connected Component of the Boundary - * (CCB). A face may be unbounded. Otherwise, it has one or more outer CCBs. A - * face may also be bounded by inner CCBs, and it may contain isolated vertices - * in its interior. A planar face may have only one outer CCBs and its inner - * CCBs are referred to as holes. - * - * \sa `ArrangementDcel` - * \sa `ArrangementDcelVertex` - * \sa `ArrangementDcelHalfedge` - */ - -class ArrangementDcelFace { -public: - -/// \name Types -/// The non-mutable iterators `Outer_ccb_const_iterator`, -/// `Inner_ccb_const_iterator`, `Hole_const_iterator`, and -/// `Isolated_vertex_const_iterator` are also defined. -/// @{ - -/*! the corresponding \dcel vertex type. */ -typedef unspecified_type Vertex; - -/*! the corresponding \dcel halfedge type. */ -typedef unspecified_type Halfedge; - -/*! a bidirectional iterator over the outer CCBs of the face. Its value-type - * is `Halfedge*`. - */ -typedef unspecified_type Outer_ccb_iterator; - -/*! a bidirectional iterator over the inner CCBs of the face. Its value-type - * is `Halfedge*`. - */ -typedef unspecified_type Inner_ccb_iterator; - -/*! a bidirectional iterator over the holes (i.e., inner CCBs) of the face. Its - * value-type is `Halfedge*`. - */ -typedef unspecified_type Hole_iterator; - -/*! a bidirectional iterator over the isolated vertices in inside the face. - * Its value-type is `Vertex*`. - */ -typedef unspecified_type Isolated_vertex_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! default constructor. */ -Arr_dcel_face(); - -/*! assigns `f` with the contents of the `other` face. */ -void assign(const Self& other); - -/// @} - -/// \name Access Functions -/// All functions below also have `const` counterparts, returning -/// non-mutable pointers or iterators: -/// @{ - -/*! determines whether the face is unbounded. */ -bool is_unbounded() const; - -/*! obtains an incident halfedge along the outer boundaries of the face. If `f` - * has no outer boundary, the function returns `nullptr`. - */ -Halfedge* halfedge(); - -/*! obtains the number of outer CCBs of `f`. In case of planar arrangement - * this is either 0 or 1. - */ -size_t number_of_outer_ccbs() const; - -/*! obtains a begin iterator for the outer CCBs of `f`. */ -Outer_ccb_iterator outer_ccbs_begin(); - -/*! obtains a past-the-end iterator for the outer CCBs of `f`. */ -Outer_ccb_iterator outer_ccbs_end(); - -/*! obtains the number of inner CCBs of `f`. */ -size_t number_of_inner_ccbs() const; - -/*! obtains a begin iterator for the inner CCBs of `f`. */ -Inner_ccb_iterator inner_ccbs_begin(); - -/*! obtains a past-the-end iterator for the inner CCBs of `f`. */ -Inner_ccb_iterator inner_ccbs_end(); - -/*! obtains the number of holes (i.e., inner CCBs) inside `f`. */ -size_t number_of_holes() const; - -/*! obtains a begin-iterator for the holes (i.e., inner CCBs) of `f`. */ -Hole_iterator holes_begin(); - -/*! obtains a past-the-end iterator for the holes (i.e., inner CCBs) of `f`. */ -Hole_iterator holes_end(); - -/*! obtains the number of isolated vertices inside `f`. */ -size_t number_of_isolated_vertices() const; - -/*! obtains a begin-iterator for the isolated vertices inside `f`. */ -Isolated_vertex_iterator isolated_vertices_begin(); - -/*! obtains a past-the-end iterator for the isolated vertices inside `f`. */ -Isolated_vertex_iterator isolated_vertices_end(); - -/// @} - -/// \name Modifiers -/// @{ - -/*! sets the face as unbounded (if `flag` is `true`), or as a bounded face - * (if it is `false`). - */ -void set_unbounded(bool flag); - -/*! sets the incident halfedge. */ -void set_halfedge(Halfedge* e); - -/*! adds `e` as an outer CCB of `f`. */ -void add_outer_ccb(Halfedge* e); - -/*! removes the outer CCB that `it` points to from `f`. */ -void erase_outer_ccb(Outer_ccb_iterator it); - -/*! adds `e` as an inner CCB of `f`. */ -void add_inner_ccb(Halfedge* e); - -/*! removes the inner CCB that `it` points to from `f`. */ -void erase_inner_ccb(Inner_ccb_iterator it); - -/*! adds `e` as a hole (i.e., inner CCB) of `f`. */ -void add_hole(Halfedge* e); - -/*! removes the hole (i.e., inner CCB) that `it` points to from `f`. */ -void erase_hole(Hole_iterator it); - -/*! adds `v` as an isolated vertex inside `f`. */ -void add_isolated_vertex(Vertex* v); - -/*! removes the isolated vertex that `it` points to from inside `f`. */ -void erase_isolated_vertex(Isolated_vertex_iterator it); - -/// @} - -}; /* end ArrangementDcelFace */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelHalfedge.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelHalfedge.h deleted file mode 100644 index 3444ed51779..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelHalfedge.h +++ /dev/null @@ -1,186 +0,0 @@ -/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL - * \cgalConcept - * - * A halfedge record in a \dcel data structure. Two halfedges with opposite - * directions always form an edge (a halfedge pair). The halfedges form together - * chains, defining the boundaries of connected components, such that all - * halfedges along a chain have the same incident face. Note that the chain the - * halfedge belongs to may form the outer boundary of a bounded face (an outer - * CCB) or the boundary of a hole inside a face (an inner CCB). - * - * An edge is always associated with a curve, but the halfedge records only - * store a pointer to the associated curve, and the actual curve objects are - * stored elsewhere. Two opposite halfedges are always associated with the same - * curve. - * - * \sa `ArrangementDcel` - * \sa `ArrangementDcelVertex` - * \sa `ArrangementDcelFace` - * \sa `ArrangementDcelOuterCcb` - * \sa `ArrangementDcelInnerCcb` - */ - -class ArrangementDcelHalfedge { -public: - -/// \name Types -/// @{ - -/*! -the corresponding \dcel vertex type. -*/ -typedef unspecified_type Vertex; - -/*! -the corresponding \dcel face type. -*/ -typedef unspecified_type Face; - -/*! -the corresponding \dcel hole type. -*/ -typedef unspecified_type Hole; - -/*! -the curve type associated with the edge. -*/ -typedef unspecified_type X_monotone_curve; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -Arr_dcel_halfedge(); - -/*! -assigns `e` with the contents of the `other` halfedge. -*/ -void assign (const Self& other); - -/// @} - -/// \name Access Functions -/// @{ - -/*! -returns `ARR_LEFT_TO_RIGHT` if `e`'s source vertex is -lexicographically smaller than it target, and -`ARR_RIGHT_TO_LEFT` if it is lexicographically larger than -the target. -*/ -Arr_halfedge_direction direction() const; - -/*! -determines whether the `e` lies on an outer CCB of a bounded face, -or on an inner CCB (a hole inside a face). The function returns `true` -if `e` lies on a hole. -*/ -bool is_on_hole() const; - -/// @} - -/// \name -/// All functions below also have `const` counterparts, returning non-mutable pointers or references: -/// @{ - -/*! -returns the twin halfedge. -*/ -Halfedge* opposite(); - -/*! -returns the previous halfedge along the chain. -*/ -Halfedge* prev(); - -/*! -returns the next halfedge along the chain. -*/ -Halfedge* next(); - -/*! -returns the target vertex. -*/ -Vertex* vertex(); - -/*! -returns the incident face. -\pre `e` lies on the outer boundary of this face. -*/ -Face* face(); - -/*! -returns the hole (inner CCB) `e` belongs to. -\pre `e` lies on a hole inside its incident face. -*/ -Hole* hole(); - -/*! -returns whether the vertex is not associated with a valid curve. -*/ -bool has_null_curve() const; - -/*! -returns the associated curve. -\pre `e` is associated with a valid curve. -*/ -X_monotone_curve& curve(); - -/// @} - -/// \name Modifiers -/// @{ - -/*! -sets the opposite halfedge. -*/ -void set_opposite (Halfedge* opp); - -/*! -sets the lexicographical order between `e`'s source and target -vertices to be `dir`. -The direction of the opposite halfedge is also set to the -opposite direction. -*/ -void set_direction (Arr_halfedge_direction dir); - -/*! -sets the previous halfedge of `e` along the chain, -and updates the cross-pointer `prev->next()`. -*/ -void set_prev (Halfedge* prev); - -/*! -sets the next halfedge of `e` along the chain, -and updates the cross-pointer `next->prev()`. -*/ -void set_next (Halfedge* next); - -/*! -sets the target vertex. -*/ -void set_vertex (Vertex* v); - -/*! -sets the incident face, marking that `e` lies on the outer CCB -of the face `f`. -*/ -void set_face (Face* f); - -/*! -sets the incident hole, marking that `e` lies on an inner CCB. -*/ -void set_hole (Hole* ho); - -/*! -sets the associated curve of `e` and its opposite halfedge. -*/ -void set_curve (X_monotone_curve* c); - -/// @} - -}; /* end ArrangementDcelHalfedge */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelInnerCcb.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelInnerCcb.h deleted file mode 100644 index ae984d9f836..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelInnerCcb.h +++ /dev/null @@ -1,60 +0,0 @@ -/*! \ingroup PkgArrangementOnSurface2ConceptsDCEL - * \cgalConcept - * - * A hole record in a Dcel data structure, which - * stores the face that contains the hole in its interior, along with an - * iterator for the hole in the holes' container of this face. - * - * \sa `ArrangementDcel` - * \sa `ArrangementDcelFace` - * - */ - -class ArrangementDcelInnerCcb { -public: - -/// \name Types -/// @{ - -/*! the corresponding Dcel face type. */ -typedef unspecified_type Face; - -/*! - -*/ -typedef Face::InnerCcb_iterator InnerCcb_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! default constructor. */ -Arr_dcel_hole(); - -/// @} - -/// \name Access Functions -/// All functions below also have `const` counterparts, returning non-mutable pointers or iterators: -/// @{ - -/*! returns the incident face, which contains `ho` in its interior. */ -Face* face(); - -/*! returns an iterator for the hole. */ -InnerCcb_iterator iterator(); - -/// @} - -/// \name Modifiers -/// @{ - -/*! sets the incident face. */ -void set_face(Face* f); - -/*! sets the hole iterator. */ -void set_iterator(InnerCcb_iterator it); - -/// @} - -}; /* end ArrangementDcelInnerCcb */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelIsolatedVertex.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelIsolatedVertex.h deleted file mode 100644 index 633747e65fd..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelIsolatedVertex.h +++ /dev/null @@ -1,77 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsDCEL -\cgalConcept - -An isolated vertex-information record in a \dcel data structure, which stores -the face that contains the isolated vertex in its interior, along with an -iterator for the isolated vertex in the isolated vertices' container of this -face. - -\sa `ArrangementDcel` -\sa `ArrangementDcelFace` - -*/ - -class ArrangementDcelIsolatedVertex { -public: - -/// \name Types -/// @{ - -/*! -the corresponding \dcel face type. -*/ -typedef unspecified_type Face; - -/*! - -*/ -typedef Face::Isolated_vertex_iterator Isolated_vertex_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -Arr_dcel_isolated_vertex(); - -/// @} - -/// \name Access Functions -/// All functions below also have `const` counterparts, returning -/// non-mutable pointers or iterators: -/// @{ - -/*! -returns the incident face, which contains `iv` in its interior. -*/ -Face* face (); - -/*! -returns an iterator for the isolated vertex. -*/ -Isolated_vertex_iterator iterator(); - -/// @} - -/// \name Modifiers -/// @{ - -/*! -sets the incident face. -*/ -void set_face (Face* f); - -/*! -sets the isolated vertex iterator. -*/ -void set_iterator (Isolated_vertex_iterator it); - -/// @} - -}; /* end ArrangementDcelIsolatedVertex */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelOuterCcb.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelOuterCcb.h deleted file mode 100644 index 8ad9cfa530a..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelOuterCcb.h +++ /dev/null @@ -1,74 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsDCEL -\cgalConcept - -A hole record in a \dcel data structure, which stores the face that contains -the hole in its interior, along with an iterator for the hole in the holes' -container of this face. - -\sa `ArrangementDcel` -\sa `ArrangementDcelFace` - -*/ - -class ArrangementDcelOuterCcb { -public: - -/// \name Types -/// @{ - -/*! -the corresponding \dcel face type. -*/ -typedef unspecified_type Face; - -/*! - -*/ -typedef Face::OuterCcb_iterator OuterCcb_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -Arr_dcel_hole(); - -/// @} - -/// \name Access Functions -/// All functions below also have `const` counterparts, returning non-mutable pointers or iterators: -/// @{ - -/*! -returns the incident face, which contains `ho` in its interior. -*/ -Face* face (); - -/*! -returns an iterator for the hole. -*/ -OuterCcb_iterator iterator(); - -/// @} - -/// \name Modifiers -/// @{ - -/*! -sets the incident face. -*/ -void set_face (Face* f); - -/*! -sets the hole iterator. -*/ -void set_iterator (OuterCcb_iterator it); - -/// @} - -}; /* end ArrangementDcelOuterCcb */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelVertex.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelVertex.h deleted file mode 100644 index d4eb01ee7c3..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelVertex.h +++ /dev/null @@ -1,140 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsDCEL -\cgalConcept - -A vertex record in a \dcel data structure. A vertex is always associated -with a point. However, the vertex record only stores a pointer to the -associated point, and the actual `Point` object is stored elsewhere. - -A vertex usually has several halfedges incident to it, such that it is -possible to access one of these halfedges directly and to traverse all -incident halfedges around the vertex. However, the \dcel may also contain -isolated vertices that have no incident halfedges. In this case, the vertex -stores an isolated vertex-information record, indicating the face that -contains this vertex in its interior. - -\sa `ArrangementDcel` -\sa `ArrangementDcelHalfedge` -\sa `ArrangementDcelIsolatedVertex` - -*/ - -class ArrangementDcelVertex { -public: - -/// \name Types -/// @{ - -/*! -the corresponding \dcel halfedge type. -*/ -typedef unspecified_type Halfedge; - -/*! -the corresponding \dcel isolated -vertex-information type. -*/ -typedef unspecified_type Isolated_vertex; - -/*! -the point type associated with the vertex. -*/ -typedef unspecified_type Point; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -Arr_dcel_vertex(); - -/*! -assigns `v` with the contents of the `other` vertex. -*/ -void assign (const Self& other); - -/// @} - -/// \name Access Functions -/// All functions below also have `const` counterparts, returning -/// non-mutable pointers or references: -/// @{ - -/*! -returns whether the vertex is isolated (has no incident halfedges). -*/ -bool is_isolated() const; - -/*! -returns an incident halfedge that has `v` as its target. -\pre `v` is not an isolated vertex. -*/ -Halfedge* halfedge(); - -/*! -returns the isolated vertex-information record. -\pre `v` is an isolated vertex. -*/ -Isolated_vertex* isolated_vertex(); - -/*! -returns whether the vertex is not associated with a valid point (i.e.\ it -lies at infinity). -*/ -bool has_null_point () const; - -/*! -returns the associated point. -\pre `v`() is associated with a valid point. -*/ -Point& point(); - -/*! -returns the placement of the \f$ x\f$-coordinate in the parameter space, -that is, either the left boundary-side, the interior, or the right -boundary-side. -*/ -Arr_parameter_space parameter_space_in_x () const; - -/*! -returns the placement of the \f$ y\f$-coordinate in the parameter space, -that is, either the bottom boundary-side, the interior, or the top -boundary-side. -*/ -Arr_parameter_space parameter_space_in_y () const; - -/// @} - -/// \name Modifiers -/// @{ - -/*! -sets the incident halfedge, marking `v` as a regular vertex. -*/ -void set_halfedge (Halfedge* e); - -/*! -sets the isolated vertex-information record, marking `v` -as an isolated vertex. -*/ -void set_isolated_vertex (Isolated_vertex* iv); - -/*! -sets the associated point. -*/ -void set_point (Point* p); - -/*! -sets `v` as a vertex on a boundary side. -\pre Either `inf_x` or `inf_y` is not `ARR_INTERIOR`. -*/ -void set_boundary (Arr_parameter_space inf_x, Arr_parameter_space inf_y); - -/// @} - -}; /* end ArrangementDcelVertex */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelWithRebind.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelWithRebind.h deleted file mode 100644 index 5d1c38474a6..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementDcelWithRebind.h +++ /dev/null @@ -1,51 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsDCEL -\cgalConcept - -The concept `ArrangementDcelWithRebind` refines the `ArrangementDcel` concept by adding -a policy clone idiom in form of a rebind struct-template. - -Instantiate a dcel class with many different possible types without ad-hoc limitations on type of the dcel classes. - -\cgalRefines{ArrangementDcel} - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_default_dcel} -\cgalHasModels{CGAL::Arr_dcel} -\cgalHasModels{CGAL::Arr_face_extended_dcel} -\cgalHasModels{CGAL::Arr_extended_dcel} -\cgalHasModelsEnd - -*/ - -class ArrangementDcelWithRebind { -public: - -/// \name Types -/// @{ - -/*! -allows the instantiation of a model of the base concept -`ArrangementDcel` with a different possible geometry-traits -class without ad-hoc limitations on it. - -Following the standard clone policy, the rebind struct-template must -have a nested type named `other` that defines the type of the -model replica. -*/ -typedef unspecified_type template rebind; - -/// @} - -/// \name Creation -/// @{ - -/*! -constructs an empty \dcel with one unbounded face. -*/ -Arr_dcel(); - -/// @} - -}; /* end ArrangementDcelWithRebind */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementInputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementInputFormatter.h deleted file mode 100644 index 286b02727ad..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementInputFormatter.h +++ /dev/null @@ -1,204 +0,0 @@ -/*! \ingroup PkgArrangementOnSurface2Concepts - * \cgalConcept - * - * A model for the `ArrangementInputFormatter` concept supports a set of - * functions that enable reading an arrangement from an input stream using a - * specific format. - * - * \cgalHasModelsBegin - * \cgalHasModels{CGAL::Arr_text_formatter} - * \cgalHasModels{CGAL::Arr_face_extended_text_formatter} - * \cgalHasModels{CGAL::Arr_extended_dcel_text_formatter} - * \cgalHasModelsEnd - * - */ - -class ArrangementInputFormatter { -public: - -/// \name Types -/// @{ - -/*! the type of arrangement to input. */ -typedef unspecified_type Arrangement_2; - -/*! the point type. */ -typedef typename Arrangement_2::Point_2 Point_2; - -/*! the \f$ x\f$-monotone curve type. */ -typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; - -/*! */ -typedef typename Arrangement_2::Size Size; - -/*! */ -typedef typename Arrangement_2::Vertex_handle Vertex_handle; - -/*! */ -typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; - -/*! */ -typedef typename Arrangement_2::Face_handle Face_handle; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -Arr_in_formatter(); - -/*! -constructs a formatter that reads from `is`. -*/ -Arr_in_formatter(std::istream& is); - -/*! -directs `inf` to read from `is`. -*/ -void set_in(std::istream& is); - -/// @} - -/// \name Access Functions -/// @{ - -/*! returns the stream that `inf` reads from. - * \pre `inf` is directed to a valid output stream. - */ -std::istream& in(); - -/// @} - -/// \name Formatted Input Functions -/// @{ - -/*! reads a message indicating the beginning of the arrangement. */ -void read_arrangement_begin(); - -/*! reads a message indicating the end of the arrangement. */ -void read_arrangement_end(); - -/*! reads a size value, which is supposed to be preceded by the given label. */ -Size read_size(const char *label = nullptr); - -/*! reads a message indicating the beginning of the vertex records. */ -void read_vertices_begin(); - -/*! reads a message indicating the end of the vertex records. */ -void read_vertices_end(); - -/*! reads a message indicating the beginning of the edge records. */ -void read_edges_begin(); - -/*! reads a message indicating the end of the edge records. */ -void read_edges_end(); - -/*! reads a message indicating the beginning of the face records. */ -void read_faces_begin(); - -/*! reads a message indicating the end of the face records. */ -void read_faces_end(); - -/*! reads a message indicating the beginning of a single vertex record. */ -void read_vertex_begin(); - -/*! reads a message indicating the end of a single vertex record. */ -void read_vertex_end(); - -/*! reads and returns a vertex index. */ -std::size_t read_vertex_index(); - -/*! reads a point. */ -void read_point(Point_2& p); - -/*! reads an auxiliary vertex-data object and associates it with the vertex `v`. - */ -void read_vertex_data(Vertex_handle v); - -/*! reads a message indicating the beginning of a single edge record. */ -void read_edge_begin(); - -/*! reads a message indicating the end of a single edge record. */ -void read_edge_end(); - -/*! reads and returns halfedge index. */ -std::size_t read_halfedge_index(); - -/*! reads an \f$ x\f$-monotone curve. */ -void read_x_monotone_curve(X_monotone_curve_2& c); - -/*! reads an auxiliary halfedge-data object and associates it with the halfedge - * `he`. - */ -void read_halfedge_data(Halfedge_handle he); - -/*! reads a message indicating the beginning of a single face record. */ -void read_face_begin(); - -/*! reads a message indicating the end of a single face record. */ -void read_face_end(); - -/*! reads a message indicating the beginning of the container of outer CCBs of - * the current face. - */ -void read_outer_ccbs_begin(); - -/*! reads a message indicating the end of of the container of outer CCBs of the - * current face. - */ -void read_outer_ccbs_end(); - -/*! reads a message indicating the beginning of the container of inner CCBs of - * the current face. - */ -void read_inner_ccbs_begin(); - -/*! reads a message indicating the end of of the container of inner CCBs of the - * current face. - */ -void read_inner_ccbs_end(); - -/*! reads a message indicating the beginning of the container of outer CCBs of - * the current face. - */ -void read_outer_ccb_begin(); - -/*! reads a message indicating the end of the outer CCB of the current face. */ -void read_outer_ccb_end(); - -/*! reads a message indicating the beginning of the container of holes inside - * the current face. - */ -void read_holes_begin(); - -/*! reads a message indicating the end of the container of holes inside the - * current face. - */ -void read_holes_end(); - -/*! reads a message indicating the beginning a connected component boundary. */ -void read_ccb_halfedges_begin(); - -/*! reads a message indicating the end of a connected component boundary. - */ -void read_ccb_halfedges_end(); - -/*! reads a message indicating the beginning of the container of isolated - * vertices inside the current face. - */ -void read_isolated_vertices_begin(); - -/*! reads a message indicating the end of the container of isolated vertices - * inside the current face. - */ -void read_isolated_vertices_end(); - -/*! reads an auxiliary face-data object and associates it with the face `f`. */ -void read_face_data(Face_handle f); - -/// @} - -}; /* end ArrangementInputFormatter */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOutputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOutputFormatter.h deleted file mode 100644 index bb1846ad8f5..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOutputFormatter.h +++ /dev/null @@ -1,197 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2Concepts -\cgalConcept - -A model for the `ArrangementOutputFormatter` concept supports a set of functions that enable -writing an arrangement to an output stream using a specific format. - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_text_formatter} -\cgalHasModels{CGAL::Arr_face_extended_text_formatter} -\cgalHasModels{CGAL::Arr_extended_dcel_text_formatter} -\cgalHasModelsEnd - -*/ - -class ArrangementOutputFormatter { -public: - -/// \name Types -/// @{ - -/*! the type of arrangement to output. */ -typedef unspecified_type Arrangement_2; - -/*! the point type. */ -typedef typename Arrangement_2::Point_2 Point_2; - -/*! the \f$ x\f$-monotone curve type. */ -typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; - -/*! */ -typedef typename Arrangement_2::Size Size; - -/*! */ -typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - -/*! */ -typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - -/*! */ -typedef typename Arrangement_2::Face_const_handle Face_const_handle; - -/// @} - -/// \name Creation -/// @{ - -/*! default constructor. */ -Arr_out_formatter(); - -/*! constructs a formatter that writes to `os`. */ -Arr_out_formatter (std::ostream& os); - -/*! directs `outf` to write to `os`. */ -void set_out (std::ostream& os); - -/// @} - -/// \name Access Functions -/// @{ - -/*! -returns the stream that `outf` writes to. -\pre `outf` is directed to a valid output stream. -*/ -std::ostream& out (); - -/// @} - -/// \name Formatted Output Functions -/// @{ - -/*! writes a message indicating the beginning of the arrangement. */ -void write_arrangement_begin (); - -/*! writes a message indicating the end of the arrangement. */ -void write_arrangement_end (); - -/*! writes a size value, preceded by a given label. */ -void write_size (const char *label, Size size); - -/*! writes a message indicating the beginning of the vertex records. */ -void write_vertices_begin(); - -/*! writes a message indicating the end of the vertex records. */ -void write_vertices_end(); - -/*! writes a message indicating the beginning of the edge records. */ -void write_edges_begin(); - -/*! writes a message indicating the end of the edge records. */ -void write_edges_end(); - -/*! writes a message indicating the beginning of the face records. */ -void write_faces_begin(); - -/*! writes a message indicating the end of the face records. */ -void write_faces_end(); - -/*! writes a message indicating the beginning of a single vertex record. */ -void write_vertex_begin(); - -/*! writes a message indicating the end of a single vertex record. */ -void write_vertex_end(); - -/*! writes a vertex index. */ -void write_vertex_index (std::size_t idx); - -/*! writes a point. */ -void write_point (const Point_2& p); - -/*! writes the auxiliary data associated with the vertex. */ -void write_vertex_data (Vertex_const_handle v); - -/*! writes a message indicating the beginning of a single edge record. */ -void write_edge_begin(); - -/*! writes a message indicating the end of a single edge record. */ -void write_edge_end(); - -/*! writes a halfedge index. */ -void write_halfedge_index (std::size_t idx); - -/*! writes an \f$ x\f$-monotone curve. */ -void write_x_monotone_curve (const X_monotone_curve_2& c); - -/*! writes the auxiliary data associated with the halfedge. */ -void write_halfedge_data (Halfedge_const_handle he); - -/*! writes a message indicating the beginning of a single face record. */ -void write_face_begin(); - -/*! writes a message indicating the end of a single face record. */ -void write_face_end(); - -/*! writes a message indicating the beginning of the container of outer CCBs of - * the current face. - */ -void write_outer_ccbs_begin(); - -/*! writes a message indicating the end of the container of outer ccbs of the - * current face. - */ -void write_outer_ccbs_end(); - -/*! writes a message indicating the beginning of the container of inner CCBs of - * the current face. - */ -void write_inner_ccbs_begin(); - -/*! writes a message indicating the end of the container of inner ccbs of the - * current face. - */ -void write_inner_ccbs_end(); - -/*! writes a message indicating the beginning of the outer CCB of the current - * face. - */ -void write_outer_ccb_begin(); - -/*! writes a message indicating the end of the outer CCB of the current face. */ -void write_outer_ccb_end(); - -/*! writes a message indicating the beginning of the container of holes inside - * the current face. - */ -void write_holes_begin(); - -/*! writes a message indicating the end of the container of holes inside the - * current face. - */ -void write_holes_end(); - -/*! writes a message indicating the beginning a connected component's boundary. - */ -void write_ccb_halfedges_begin(); - -/*! writes a message indicating the end of a connected component's boundary. */ -void write_ccb_halfedges_end(); - -/*! writes a message indicating the beginning of the container of isolated - * vertices inside the current face. - */ -void write_isolated_vertices_begin(); - -/*! writes a message indicating the end of the container of isolated vertices - * inside the current face. - */ -void write_isolated_vertices_end(); - -/*! writes the auxiliary data associated with the face. */ -void write_face_data (Face_const_handle f); - -/// @} - -}; /* end ArrangementOutputFormatter */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h deleted file mode 100644 index 5840d853bfe..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementPointLocation_2.h +++ /dev/null @@ -1,100 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2Concepts -\cgalConcept - -A model of the `ArrangementPointLocation_2` concept can answer point-location queries on -an arrangement attached to it. Namely, given a `Arrangement_2::Point_2` -object, representing a point in the plane, it returns the arrangement cell -containing it. In the general case, the query point is contained inside an -arrangement face, but in degenerate situations it may lie on an edge or -coincide with an arrangement vertex. - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_naive_point_location} -\cgalHasModels{CGAL::Arr_walk_along_line_point_location} -\cgalHasModels{CGAL::Arr_trapezoid_ric_point_location} -\cgalHasModels{CGAL::Arr_landmarks_point_location} -\cgalHasModelsEnd - -\sa `CGAL::Arr_naive_point_location` -\sa `CGAL::Arr_walk_along_line_point_location` -\sa `CGAL::Arr_trapezoid_ric_point_location` -\sa `CGAL::Arr_landmarks_point_location` -\sa `CGAL::Arr_point_location_result` - -*/ - -class ArrangementPointLocation_2 { -public: - -/// \name Types -/// @{ - -/*! -the associated arrangement type. -*/ -typedef unspecified_type Arrangement_2; - -/*! -equivalent to `Arrangement_2::Point_2`. -*/ -typedef unspecified_type Point_2; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -ArrangementPointLocation_2(); - -/*! -constructs a point-location object `pl` attached to the given -arrangement `arr`. -*/ -ArrangementPointLocation_2 (const Arrangement_2& arr); - -/// @} - -/// \name Query Functions -/// @{ - -/*! -locates the arrangement cell that contains the query point `q` -and returns a discriminated union container of the following bounded -types: - -
    -
  • `Arrangement_2::Face_const_handle`, in case `q` is -contained inside an arrangement face; -
  • `Arrangement_2::Halfedge_const_handle`, in case `q` lies -on an arrangement edge; -
  • `Arrangement_2::Vertex_const_handle`, in case `q` coincides -with an arrangement vertex. -
-\pre `pl` is attached to a valid arrangement object. -*/ -Arr_point_location_result::Type locate(const Point_2& q) const; - -/// @} - -/// \name Operations -/// @{ - -/*! -attaches `pl` to the given arrangement `arr`. -*/ -void attach (const Arrangement_2& arr); - -/*! -detaches `pl` from the arrangement it is currently attached to. -*/ -void detach (); - -/// @} - -}; /* end ArrangementPointLocation_2 */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTraits_2.h deleted file mode 100644 index e7f2288b560..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTraits_2.h +++ /dev/null @@ -1,90 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsTraits -\cgalConcept - -The concept `ArrangementTraits_2` allows the construction of arrangement -of general planar curves. Models of this concept are used -by the free \link PkgArrangementOnSurface2Insert `CGAL::insert()` \endlink functions of the arrangement package and -by the `CGAL::Arrangement_with_history_2` class. - -A model of this concept must define the nested `Curve_2` type, which -represents a general planar curve that is not necessarily \f$ x\f$-monotone -and is not necessarily connected. Such curves are eventually subdivided into -\f$ x\f$-monotone subcurves and isolated points (represented by the `Point_2` -and `X_monotone_curve_2` types, defined in the basic traits concept). - -A model of the concept `ArrangementTraits_2` that handles arbitrary curves, -which are always \f$ x\f$-monotone, such as a traits class that handles -linear curves may define the nested types `Curve_2` and -`X_monotone_curve_2` to be of equivalent types. Moreover, defining -them as of equivalent types is advantageous, as it enables a generic -simple implementation of the nested Functor -`Make_x_monotone_2`. - -On the other hand, a model of the `ArrangementTraits_2` concept that handles -arbitrary curves, which may be not \f$ x\f$-monotone must define the -`Curve_2` and `X_monotone_curve_2` nested types to be of -different types to allow proper dispatching of the free functions -that accept such curves, such as `intsert()`. - -\cgalRefines{ArrangementXMonotoneTraits_2} - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_segment_traits_2} -\cgalHasModels{CGAL::Arr_non_caching_segment_traits_2} -\cgalHasModels{CGAL::Arr_linear_traits_2} -\cgalHasModels{CGAL::Arr_polyline_traits_2} -\cgalHasModels{CGAL::Arr_circle_segment_traits_2} -\cgalHasModels{CGAL::Arr_line_arc_traits_2} -\cgalHasModels{CGAL::Arr_circular_arc_traits_2} -\cgalHasModels{CGAL::Arr_circular_line_arc_traits_2} -\cgalHasModels{CGAL::Arr_conic_traits_2} -\cgalHasModels{CGAL::Arr_rational_function_traits_2} -\cgalHasModels{CGAL::Arr_Bezier_curve_traits_2} -\cgalHasModels{CGAL::Arr_algebraic_segment_traits_2} -\cgalHasModels{CGAL::Arr_curve_data_traits_2} -\cgalHasModels{CGAL::Arr_consolidated_curve_data_traits_2} -\cgalHasModelsEnd - -\sa `ArrangementBasicTraits_2` -\sa `ArrangementXMonotoneTraits_2` -\sa `ArrangementLandmarkTraits_2` - -*/ - -class ArrangementTraits_2 { -public: - -/// \name Types -/// @{ - -/*! -models the concept `ArrTraits::Curve_2`. -*/ -typedef unspecified_type Curve_2; - -/// @} - -/// \name Functor Types -/// @{ - -/*! -models the concept `ArrTraits::MakeXMonotone_2`. -*/ -typedef unspecified_type Make_x_monotone_2; - -/// @} - -/// \name Accessing Functor Objects -/// @{ - -/*! - -*/ -Make_x_monotone_2 make_x_monotone_2_object() const; - -/// @} - -}; /* end ArrangementTraits_2 */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h deleted file mode 100644 index 8ee996a9b0a..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalRayShoot_2.h +++ /dev/null @@ -1,126 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2Concepts -\cgalConcept - -A model of the `ArrangementVerticalRayShoot_2` concept can answer vertical ray-shooting -queries on an arrangement attached to it. Namely, given a -`Arrangement_2::Point_2` object, representing a point in the plane, -it returns the arrangement feature (edge or vertex) that lies -strictly above it (or below it). By "strictly" we mean that if the -query point lies on an arrangement edge (or on an arrangement vertex) -this edge will not be the query result, but the feature lying -above or below it. (An exception to this rule is the degenerate case -where the query point lies in the interior of a vertical edge.) Note -that it may happen that the query point lies above the upper envelope -(or below the lower envelope) of the arrangement, and the vertical ray -emanating from the query point goes to infinity without hitting any -arrangement feature on its way. In this case the unbounded face is -returned. - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_naive_point_location} -\cgalHasModels{CGAL::Arr_walk_along_line_point_location} -\cgalHasModels{CGAL::Arr_trapezoid_ric_point_location} -\cgalHasModels{CGAL::Arr_landmarks_point_location} -\cgalHasModelsEnd - -\sa `CGAL::Arr_naive_point_location` -\sa `CGAL::Arr_walk_along_line_point_location` -\sa `CGAL::Arr_trapezoid_ric_point_location` -\sa `CGAL::Arr_landmarks_point_location` -\sa `CGAL::Arr_point_location_result` -*/ - -class ArrangementVerticalRayShoot_2 { -public: - -/// \name Types -/// @{ - -/*! -the associated arrangement type. -*/ -typedef unspecified_type Arrangement_2; - -/*! -equivalent to `Arrangement_2::Point_2`. -*/ -typedef unspecified_type Point_2; - -/// @} - -/// \name Creation -/// @{ - -/*! -default constructor. -*/ -ArrangementVerticalRayShoot_2(); - -/*! -constructs a ray-shooting object `rs` attached to the given -arrangement `arr`. -*/ -ArrangementVerticalRayShoot_2 (const Arrangement_2& arr); - -/// @} - -/// \name Query Functions -/// @{ - -/*! -locates the arrangement feature that is first hit by an upward-directed -vertical ray emanating from the query point `q`, -and returns a handle for this feature. The function returns a -discriminated union container of the following bounded types: -
    -
  • `Arrangement_2::Halfedge_const_handle`, in case the vertical -ray hits an arrangement edge; -
  • `Arrangement_2::Vertex_const_handle`, in case the vertical -ray hits an arrangement vertex. -
  • `Arrangement_2::Face_const_handle` for the unbounded arrangement -face, in case `q` lies above the upper envelope of the -arrangement. -
-\pre `rs` is attached to a valid arrangement instance. -*/ -Arr_point_location_result::Type ray_shoot_up(const Point_2& q) const; - -/*! -locates the arrangement feature that is first hit by a downward-directed -vertical ray emanating from the query point `q`, -and returns a handle for this feature. The function returns a -discriminated union container of the following bounded types: -
    -
  • `Arrangement_2::Halfedge_const_handle`, in case the vertical -ray hits an arrangement edge; -
  • `Arrangement_2::Vertex_const_handle`, in case the vertical -ray hits an arrangement vertex. -
  • `Arrangement_2::Face_const_handle` for the unbounded arrangement -face, in case `q` lies below the lower envelope of the -arrangement. -
-\pre `rs` is attached to a valid arrangement instance. -*/ -Arr_point_location_result::Type ray_shoot_down (const Point_2& q) const; - -/// @} - -/// \name Operations -/// @{ - -/*! -attaches `rs` to the given arrangement `arr`. -*/ -void attach (const Arrangement_2& arr); - -/*! -detaches `rs` from the arrangement it is currently attached to. -*/ -void detach (); - -/// @} - -}; /* end ArrangementVerticalRayShoot_2 */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementWithHistoryInputFormatter.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementWithHistoryInputFormatter.h deleted file mode 100644 index 0e6ec4d3af8..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementWithHistoryInputFormatter.h +++ /dev/null @@ -1,78 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2Concepts -\cgalConcept - -A model for the `ArrangementWithHistoryInputFormatter` concept supports a set of functions that enable -reading an arrangement-with-history instance from an input stream using a -specific format. - -\cgalRefines{ArrangementInputFormatter} - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_with_history_text_formatter} -\cgalHasModelsEnd - -*/ - -class ArrangementWithHistoryInputFormatter { -public: - -/// \name Types -/// @{ - -/*! -the type of arrangement to input. -*/ -typedef unspecified_type Arr_with_history_2; - -/*! -the inducing curve type. -*/ -typedef typename Arrangement_2::Curve_2 Curve_2; - -/// @} - -/// \name Formatted Input Functions -/// @{ - -/*! -reads a message indicating the beginning of the inducing curves. -*/ -void read_curves_begin(); - -/*! -reads a message indicating the end of the inducing curves. -*/ -void read_curves_end(); - -/*! -reads a message indicating the beginning of a single curve record. -*/ -void read_curve_begin(); - -/*! -reads a message indicating the end of a single curve record. -*/ -void read_curve_end(); - -/*! -reads a curve. -*/ -void read_curve (Curve_2& c); - -/*! -reads a message indicating the beginning of the set of edges -induced by the current curve. -*/ -void read_induced_edges_begin(); - -/*! -reads a message indicating the end of the induced edges set. -*/ -void read_induced_edges_end(); - -/// @} - -}; /* end ArrangementWithHistoryInputFormatter */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementXMonotoneTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementXMonotoneTraits_2.h deleted file mode 100644 index 88cc075b5b1..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementXMonotoneTraits_2.h +++ /dev/null @@ -1,136 +0,0 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsTraits -\cgalConcept - -The concept `ArrangementXMonotoneTraits_2` refines the basic arrangement-traits concept. -A model of this concept is able to handle \f$ x\f$-monotone curves that -intersect in their interior (and points that coincide with curve -interiors). This is necessary for constructing arrangements of sets of -intersecting \f$ x\f$-monotone curves. - -As the resulting structure, represented by the `Arrangement_2` class, -stores pairwise interior-disjoint curves, the input curves are split at -the intersection points before being inserted into the arrangement. -A model of this refined concept therefore needs to compute the intersections -(and possibly overlaps) between two \f$ x\f$-monotone curves and to support -curve splitting. - -\cgalRefines{ArrangementBasicTraits_2} - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_segment_traits_2} -\cgalHasModels{CGAL::Arr_non_caching_segment_traits_2} -\cgalHasModels{CGAL::Arr_linear_traits_2} -\cgalHasModels{CGAL::Arr_polyline_traits_2} -\cgalHasModels{CGAL::Arr_circle_segment_traits_2} -\cgalHasModels{CGAL::Arr_line_arc_traits_2} -\cgalHasModels{CGAL::Arr_circular_arc_traits_2} -\cgalHasModels{CGAL::Arr_circular_line_arc_traits_2} -\cgalHasModels{CGAL::Arr_conic_traits_2} -\cgalHasModels{CGAL::Arr_rational_function_traits_2} -\cgalHasModels{CGAL::Arr_Bezier_curve_traits_2} -\cgalHasModels{CGAL::Arr_algebraic_segment_traits_2} -\cgalHasModels{CGAL::Arr_curve_data_traits_2} -\cgalHasModels{CGAL::Arr_consolidated_curve_data_traits_2} -\cgalHasModelsEnd - -\sa `ArrangementBasicTraits_2` - -*/ - -class ArrangementXMonotoneTraits_2 { -public: - -/// \name Types -/// @{ - -/*! -the multiplicity type. -*/ -typedef unspecified_type Multiplicity; - -/// @} - -/// \name Tags -/// @{ - -/*! -indicates whether the nested functors `Are_mergeable_2` and -`Merge_2` are provided. -*/ -typedef unspecified_type Has_merge_category; - -/// @} - -/// \name Functor Types -/// @{ - -/*! -models the concept `ArrTraits::Intersect_2`. -*/ -typedef unspecified_type Intersect_2; - -/*! -models the concept `ArrTraits::Split_2`. -*/ -typedef unspecified_type Split_2; - -/// @} - -/// \name -/// \attention The two following function-object types are -/// optional. If they are supported, the `Has_merge_category` tag -/// should be defined as `Tag_true` and otherwise as `Tag_false`. -/// @{ - -/*! -models the concept `ArrTraits::AreMergeable_2`. - - - -*/ -typedef unspecified_type Are_mergeable_2; - -/*! -models the concept `ArrTraits::Merge_2`. -*/ -typedef unspecified_type Merge_2; - -/// @} - -/// \name Accessing Functor Objects -/// @{ - -/*! - -*/ -Intersect_2 intersect_2_object() const; - -/*! - -*/ -Split_2 split_2_object() const; - -/// @} - -/// \name -/// The two following methods are optional. If they are supported, the -/// `Has_merge_category` tag should be defined as `Tag_true` and otherwise -/// as `Tag_false`. -/// @{ - -/*! - -*/ -Are_mergeable_2 are_mergeable_2_object() const; - -/*! - -*/ -Merge_2 merge_2_object() const; - -/// @} - -}; /* end ArrangementXMonotoneTraits_2 */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/OverlayTraits.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/OverlayTraits.h index 137ccd40de4..ec00686e66b 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/OverlayTraits.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/OverlayTraits.h @@ -1,185 +1,151 @@ - -/*! -\ingroup PkgArrangementOnSurface2ConceptsTraits -\cgalConcept - -A model for the `OverlayTraits` should be able to operate on records (namely, -vertices, halfedges and faces) of two input \dcel classes, named -`Dcel_A` and `Dcel_B`, and construct the records of an output \dcel class, referred to as `Dcel_R`. - -Models for the concept are used by the global `overlay()` function to -maintain the auxiliary data stored with the \dcel records of the resulting -overlaid arrangement, based on the contents of the input records. - -\cgalHasModelsBegin -\cgalHasModels{CGAL::Arr_default_overlay_traits} -\cgalHasModels{CGAL::Arr_face_overlay_traits} -\cgalHasModelsEnd - -\sa `overlay` - -*/ - +/*! \ingroup PkgArrangementOnSurface2ConceptsTraits + * \cgalConcept + * + * A model for the `OverlayTraits` should be able to operate on records (namely, + * vertices, halfedges and faces) of two input \dcel classes, named `Dcel_A` and + * `Dcel_B`, and construct the records of an output \dcel class, referred to as + * `Dcel_R`. + * + * Models for the concept are used by the global `overlay()` function to + * maintain the auxiliary data stored with the \dcel records of the resulting + * overlaid arrangement, based on the contents of the input records. + * + * \cgalHasModelsBegin + * \cgalHasModels{CGAL::Arr_default_overlay_traits} + * \cgalHasModels{CGAL::Arr_face_overlay_traits} + * \cgalHasModelsEnd + * + * \sa `overlay` + */ class OverlayTraits { public: + /// \name Types + /// @{ -/// \name Types -/// @{ + //! a constant handle a vertex in `Dcel_A`. + typedef unspecified_type Vertex_handle_A; -/*! -a constant handle a vertex in `Dcel_A`. -*/ -typedef unspecified_type Vertex_handle_A; + //! a constant handle to a halfedge in `Dcel_A`. + typedef unspecified_type Halfedge_handle_A; -/*! -a constant handle to a halfedge in `Dcel_A`. -*/ -typedef unspecified_type Halfedge_handle_A; + //! a constant handle to a face `Dcel_A`. + typedef unspecified_type Face_handle_A; -/*! -a constant handle to a face `Dcel_A`. -*/ -typedef unspecified_type Face_handle_A; + //! a constant handle to a vertex in `Dcel_B`. + typedef unspecified_type Vertex_handle_B; -/*! -a constant handle to a vertex in `Dcel_B`. -*/ -typedef unspecified_type Vertex_handle_B; + //! a constant handle to a halfedge in `Dcel_B`. + typedef unspecified_type Halfedge_handle_B; -/*! -a constant handle to a halfedge in `Dcel_B`. -*/ -typedef unspecified_type Halfedge_handle_B; + //! a constant handle to a face in `Dcel_B`. + typedef unspecified_type Face_handle_B; -/*! -a constant handle to a face in `Dcel_B`. -*/ -typedef unspecified_type Face_handle_B; + //! a handle to a vertex in `Dcel_R`. + typedef unspecified_type Vertex_handle_R; -/*! -a handle to a vertex in `Dcel_R`. -*/ -typedef unspecified_type Vertex_handle_R; + //! a handle to a halfedge in `Dcel_R`. + typedef unspecified_type Halfedge_handle_R; -/*! -a handle to a halfedge in `Dcel_R`. -*/ -typedef unspecified_type Halfedge_handle_R; + //! a handle to a faces in `Dcel_R`. + typedef unspecified_type Face_handle_R; -/*! -a handle to a faces in `Dcel_R`. -*/ -typedef unspecified_type Face_handle_R; + /// @} -/// @} + /// \name Vertex Creation + /// Whenever a vertex in the overlaid arrangement is created, one of + /// the following functions is called in order to attach the + /// appropriate auxiliary data to this vertex: + /// @{ -/// \name Vertex Creation -/// Whenever a vertex in the overlaid arrangement is created, one of -/// the following functions is called in order to attach the -/// appropriate auxiliary data to this vertex: -/// @{ + /*! constructs the vertex `v` induced by the coinciding vertices + * `v1` and `v2`. + */ + void create_vertex(Vertex_handle_A v1, + Vertex_handle_B v2, + Vertex_handle_R v) const; -/*! -constructs the vertex `v` induced by the coinciding vertices -`v1` and `v2`. -*/ -void create_vertex (Vertex_handle_A v1, -Vertex_handle_B v2, -Vertex_handle_R v) const; + /*! constructs the vertex `v` induced by the vertex `v1` that lies on + * the halfedge `e2`. + */ + void create_vertex(Vertex_handle_A v1, + Halfedge_handle_B e2, + Vertex_handle_R v) const; -/*! -constructs the vertex `v` induced by the vertex `v1` that lies on -the halfedge `e2`. -*/ -void create_vertex (Vertex_handle_A v1, -Halfedge_handle_B e2, -Vertex_handle_R v) const; + /*! constructs the vertex `v` induced by the vertex `v1` that lies + * inside the face `f2`. + */ + void create_vertex(Vertex_handle_A v1, + Face_handle_B f2, + Vertex_handle_R v) const; -/*! -constructs the vertex `v` induced by the vertex `v1` that lies -inside the face `f2`. -*/ -void create_vertex (Vertex_handle_A v1, -Face_handle_B f2, -Vertex_handle_R v) const; + /*! constructs the vertex `v` induced by the vertex `v2` that lies on + * the halfedge `e1`. + */ + void create_vertex(Halfedge_handle_A e1, + Vertex_handle_B v2, + Vertex_handle_R v) const; -/*! -constructs the vertex `v` induced by the vertex `v2` that lies on -the halfedge `e1`. -*/ -void create_vertex (Halfedge_handle_A e1, -Vertex_handle_B v2, -Vertex_handle_R v) const; + /*! constructs the vertex `v` induced by the vertex `v2` that lies + * inside the face `f1`. + */ + void create_vertex(Face_handle_A f1, + Vertex_handle_B v2, + Vertex_handle_R v) const; -/*! -constructs the vertex `v` induced by the vertex `v2` that lies -inside the face `f1`. -*/ -void create_vertex (Face_handle_A f1, -Vertex_handle_B v2, -Vertex_handle_R v) const; + /*! constructs the vertex `v` induced by the intersection of the + halfedges `e1` and `e2`. + */ + void create_vertex(Halfedge_handle_A e1, + Halfedge_handle_B e2, + Vertex_handle_R v) const; + /// @} -/*! -constructs the vertex `v` induced by the intersection of the -halfedges `e1` and `e2`. -*/ -void create_vertex (Halfedge_handle_A e1, -Halfedge_handle_B e2, -Vertex_handle_R v) const; -/// @} + /// \name Edge Creation + /// Whenever an edge in the overlaid arrangement is created, one of + /// the following functions is called in order to attach the + /// appropriate auxiliary data to this vertex. Note that an edge is + /// created after both its end-vertices are created, (and the + /// corresponding `create_vertex()` methods were invoked). In all + /// cases, the edge is represented by a halfedge `e` directed in + /// lexicographic decreasing order (from right to left). The + /// `create_edge()` method should attach auxiliary data to the twin + /// halfedge (namely to `e->twin()`) as well: + /// @{ -/// \name Edge Creation -/// Whenever an edge in the overlaid arrangement is created, one of -/// the following functions is called in order to attach the -/// appropriate auxiliary data to this vertex. Note that an edge is -/// created after both its end-vertices are created, (and the -/// corresponding `create_vertex()` methods were invoked). In all -/// cases, the edge is represented by a halfedge `e` directed in -/// lexicographic decreasing order (from right to left). The -/// `create_edge()` method should attach auxiliary data to the twin -/// halfedge (namely to `e->twin()`) as well: -/// @{ + /*! constructs the halfedge `e` induced by an overlap between the + * halfedges `e1` and `e2`. + */ + void create_edge(Halfedge_handle_A e1, + Halfedge_handle_B e2, + Halfedge_handle_R e) const; -/*! -constructs the halfedge `e` induced by an overlap between the -halfedges `e1` and `e2`. -*/ -void create_edge (Halfedge_handle_A e1, -Halfedge_handle_B e2, -Halfedge_handle_R e) const; + /*! constructs the halfedge `e` induced by the halfedge `e1` that lies + * inside the face `f2`. + */ + void create_edge(Halfedge_handle_A e1, + Face_handle_B f2, + Halfedge_handle_R e) const; -/*! -constructs the halfedge `e` induced by the halfedge `e1` that lies -inside the face `f2`. -*/ -void create_edge (Halfedge_handle_A e1, -Face_handle_B f2, -Halfedge_handle_R e) const; + /*! constructs the halfedge `e` induced by the halfedge `e2` that lies + * inside the face `f1`. + */ + void create_edge(Face_handle_A f1, + Halfedge_handle_B e2, + Halfedge_handle_R e) const; + /// @} + /// \name Face Creation + /// The following function is invoked whenever a new face is + /// created. It is guaranteed that all halfedges along the face + /// boundary have already been created an have their auxiliary data + /// fields attached to them: + /// @{ -/*! -constructs the halfedge `e` induced by the halfedge `e2` that lies -inside the face `f1`. -*/ -void create_edge (Face_handle_A f1, -Halfedge_handle_B e2, -Halfedge_handle_R e) const; -/// @} -/// \name Face Creation -/// The following function is invoked whenever a new face is -/// created. It is guaranteed that all halfedges along the face -/// boundary have already been created an have their auxiliary data -/// fields attached to them: -/// @{ - -/*! -constructs the face `f` induced by the an overlap between the -faces `f1` and `f2`. -*/ -void create_face (Face_handle_A f1, -Face_handle_B f2, -Face_handle_R f) const; - -/// @} + /*! constructs the face `f` induced by the an overlap between the + * faces `f1` and `f2`. + */ + void create_face(Face_handle_A f1, + Face_handle_B f2, + Face_handle_R f) const; + /// @} }; /* end OverlayTraits */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt index 300970a336e..bae19005dc3 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt @@ -5,7 +5,7 @@ /// \cgalConceptNamespace /// The namespace containing concepts specific to Arrangements. -namespace ArrTraits {} +namespace AosTraits {} /// \defgroup PkgArrangementOnSurface2ConceptsTopologyTraits Topology Traits Concepts /// \ingroup PkgArrangementOnSurface2Concepts @@ -66,7 +66,6 @@ namespace ArrTraits {} /*! \addtogroup PkgArrangementOnSurface2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Arrangements,PkgArrangementOnSurface2} \cgalPkgPicture{Arrangement_2.png} \cgalPkgSummaryBegin @@ -82,11 +81,11 @@ namespace ArrTraits {} \cgalPkgShortInfoEnd \cgalPkgDescriptionEnd -Given a set \f$ \mathcal{C}\f$ of planar curves, the arrangement +Given a set \f$\mathcal{C}\f$ of planar curves, the arrangement \f$ {\mathcal A}({\mathcal C})\f$ is the subdivision of the plane induced -by the curves in \f$ \mathcal{C}\f$ into maximally connected cells. The cells -can be \f$ 0\f$-dimensional (vertices), \f$ 1\f$-dimensional (edges) -or \f$ 2\f$-dimensional (faces). +by the curves in \f$\mathcal{C}\f$ into maximally connected cells. The cells +can be \f$0\f$-dimensional (vertices), \f$1\f$-dimensional (edges) +or \f$2\f$-dimensional (faces). The class `Arrangement_2` encapsulates a data structure that maintains arrangements of arbitrary bounded planar curves. It comes @@ -112,85 +111,87 @@ implemented as peripheral classes or as free (global) functions. \cgalCRPSection{Concepts} -- `ArrangementDcel` -- `ArrangementDcelWithRebind` -- `ArrangementDcelVertex` -- `ArrangementDcelHalfedge` -- `ArrangementDcelFace` -- `ArrangementDcelOuterCcb` -- `ArrangementDcelInnerCcb` -- `ArrangementDcelIsolatedVertex` -- `ArrangementBasicTopologyTraits` -- `ArrangementBasicTraits_2` -- `ArrangementConstructXMonotoneCurveTraits_2` -- `ArrangementConstructCurveTraits_2` -- `ArrangementLandmarkTraits_2` -- `ArrangementXMonotoneTraits_2` -- `ArrangementTraits_2` -- `ArrangementHorizontalSideTraits_2` -- `ArrangementVerticalSideTraits_2` -- `ArrangementIdentifiedVerticalTraits_2` -- `ArrangementIdentifiedHorizontalTraits_2` -- `ArrangementOpenBoundaryTraits_2` -- `ArrangementSphericalBoundaryTraits_2` -- `ArrangementInputFormatter` -- `ArrangementOutputFormatter` -- `ArrangementWithHistoryInputFormatter` -- `ArrangementWithHistoryOutputFormatter` -- `ArrangementPointLocation_2` -- `ArrangementVerticalRayShoot_2` -- `ArrangementOpenLeftTraits_2` -- `ArrangementOpenRightTraits_2` -- `ArrangementOpenBottomTraits_2` -- `ArrangementOpenTopTraits_2` -- `ArrangementClosedLeftTraits_2` -- `ArrangementClosedRightTraits_2` -- `ArrangementClosedBottomTraits_2` -- `ArrangementClosedTopTraits_2` -- `ArrangementContractedLeftTraits_2` -- `ArrangementContractedRightTraits_2` -- `ArrangementContractedBottomTraits_2` -- `ArrangementContractedTopTraits_2` -- `ArrangementLeftSideTraits_2` -- `ArrangementRightSideTraits_2` -- `ArrangementBottomSideTraits_2` -- `ArrangementTopSideTraits_2` -- `ArrangementTopologyTraits` +- `AosApproximateTraits_2` +- `AosApproximatePointTraits_2` +- `AosBasicTopologyTraits` +- `AosBasicTraits_2` +- `AosBottomSideTraits_2` +- `AosClosedBottomTraits_2` +- `AosClosedLeftTraits_2` +- `AosClosedRightTraits_2` +- `AosClosedTopTraits_2` +- `AosConstructCurveTraits_2` +- `AosConstructXMonotoneCurveTraits_2` +- `AosContractedBottomTraits_2` +- `AosContractedLeftTraits_2` +- `AosContractedRightTraits_2` +- `AosContractedTopTraits_2` +- `AosDcel` +- `AosDcelFace` +- `AosDcelHalfedge` +- `AosDcelInnerCcb` +- `AosDcelIsolatedVertex` +- `AosDcelOuterCcb` +- `AosDcelVertex` +- `AosDcelWithRebind` +- `AosHorizontalSideTraits_2` +- `AosIdentifiedHorizontalTraits_2` +- `AosIdentifiedVerticalTraits_2` +- `AosInputFormatter` +- `AosLandmarkTraits_2` +- `AosLeftSideTraits_2` +- `AosOpenBottomTraits_2` +- `AosOpenBoundaryTraits_2` +- `AosOpenLeftTraits_2` +- `AosOpenRightTraits_2` +- `AosOpenTopTraits_2` +- `AosOutputFormatter` +- `AosPointLocation_2` +- `AosRightSideTraits_2` +- `AosSphericalBoundaryTraits_2` +- `AosTopologyTraits` +- `AosTopSideTraits_2` +- `AosTraits_2` +- `AosVerticalRayShoot_2` +- `AosVerticalSideTraits_2` +- `AosWithHistoryInputFormatter` +- `AosWithHistoryOutputFormatter` +- `AosXMonotoneTraits_2` \cgalCRPSection{Geometric Object Concepts} -- `ArrTraits::Point_2` -- `ArrTraits::XMonotoneCurve_2` -- `ArrTraits::Curve_2` +- `AosTraits::Point_2` +- `AosTraits::XMonotoneCurve_2` +- `AosTraits::Curve_2` \cgalCRPSection{Function Object Concepts} -- `ArrTraits::CompareX_2` -- `ArrTraits::CompareXy_2` -- `ArrTraits::ConstructMinVertex_2` -- `ArrTraits::ConstructMaxVertex_2` -- `ArrTraits::IsVertical_2` -- `ArrTraits::IsOnXIdentification_2` -- `ArrTraits::IsOnYIdentification_2` -- `ArrTraits::CompareYAtX_2` -- `ArrTraits::CompareYAtXLeft_2` -- `ArrTraits::CompareYAtXRight_2` -- `ArrTraits::Equal_2` -- `ArrTraits::ParameterSpaceInX_2` -- `ArrTraits::ParameterSpaceInY_2` -- `ArrTraits::CompareXOnBoundary_2` -- `ArrTraits::CompareYOnBoundary_2` -- `ArrTraits::CompareXNearBoundary_2` -- `ArrTraits::CompareYNearBoundary_2` -- `ArrTraits::CompareXOnBoundaryOfCurveEnd_2` -- `ArrTraits::Intersect_2` -- `ArrTraits::Split_2` -- `ArrTraits::AreMergeable_2` -- `ArrTraits::Merge_2` -- `ArrTraits::MakeXMonotone_2` -- `ArrTraits::Approximate_2` -- `ArrTraits::ConstructXMonotoneCurve_2` -- `ArrTraits::ConstructCurve_2` +- `AosTraits::Approximate_2` +- `AosTraits::AreMergeable_2` +- `AosTraits::CompareX_2` +- `AosTraits::CompareXy_2` +- `AosTraits::CompareYAtX_2` +- `AosTraits::CompareYAtXLeft_2` +- `AosTraits::CompareYAtXRight_2` +- `AosTraits::ConstructMinVertex_2` +- `AosTraits::ConstructMaxVertex_2` +- `AosTraits::CompareXOnBoundary_2` +- `AosTraits::CompareYOnBoundary_2` +- `AosTraits::CompareXNearBoundary_2` +- `AosTraits::CompareYNearBoundary_2` +- `AosTraits::CompareXOnBoundaryOfCurveEnd_2` +- `AosTraits::ConstructCurve_2` +- `AosTraits::ConstructXMonotoneCurve_2` +- `AosTraits::Equal_2` +- `AosTraits::Intersect_2` +- `AosTraits::IsVertical_2` +- `AosTraits::IsOnXIdentification_2` +- `AosTraits::IsOnYIdentification_2` +- `AosTraits::MakeXMonotone_2` +- `AosTraits::Merge_2` +- `AosTraits::ParameterSpaceInX_2` +- `AosTraits::ParameterSpaceInY_2` +- `AosTraits::Split_2` \cgalCRPSection{Classes} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png index 8f47fe2dde1..5cd2a04bdcf 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/identified_clusters.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/identified_clusters.png index da89fbebdd5..e109ecba1fb 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/identified_clusters.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/identified_clusters.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png index 4230f21bd2f..83bfc35d997 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png index aef6892be92..6b61310c825 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png index a3e45b74265..d206fa8ee04 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png index d82390981b5..84eeacc4b82 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png index 2f2fa8cfe7a..0bd2d7d089d 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex index 17589bef685..7c453859f46 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex @@ -8,11 +8,11 @@ fill=white,blur shadow,rounded corners,align=center}} \begin{document} \begin{forest} - [\name{ArrangementBasicTraits\_2}, + [\name{AosBasicTraits\_2}, forked edges, for tree={concept,edge={-latex}} - [\name{ArrangementXMonotoneTraits\_2} - [\name{ArrangementTraits\_2}] + [\name{AosXMonotoneTraits\_2} + [\name{AosTraits\_2}] ] ] \end{forest} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/identified_clusters.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/identified_clusters.tex index 8276d12593e..e3ae550fca0 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/identified_clusters.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/identified_clusters.tex @@ -1,22 +1,30 @@ \documentclass[12pt]{standalone} \input{header} +\usepackage[edges]{forest} +\usetikzlibrary{shadows.blur,arrows.meta} \pagestyle{empty} +\def\name#1{\textsf{\it #1}} +\tikzset{concept/.style={rectangle split,rectangle split parts=1,draw, + fill=white,blur shadow,rounded corners,align=center}} \begin{document} - \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} - \jtree[everylabel=\sl,xunit=70pt,arrows=->] - \! = {} - <4wideleft>[scaleby=2.24 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementLeftSideTraits\_2}}}@lt !lt - ^[scaleby=1.15 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenRightSideTraits\_2}}}@rt !rt - ^[scaleby=1.15 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenBottomSideTraits\_2}}}@bt !bt - ^<4wideright>[scaleby=2.26 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenTopSideTraits\_2}}}@tt !tt - . - \!lt = [scaleby=1.08 1]{\psframebox{\concept{ArrangementIdentifiedVerticalTraits\_2}}}@ivt !ivt - . - \!bt = [scaleby=1.17 1]{\psframebox{\concept{ArrangementIdentifiedHorizontalTraits\_2}}}@iht !iht - . - \ncline{rt:b}{ivt:t} - \ncline{tt:b}{iht:t} - \endjtree - \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, - etcratio=.75,triratio=.5} +\begin{forest} + [,phantom,for tree={concept,edge={-Stealth}} + [,phantom + [\name{AosLeftSideTraits\_2} + [,phantom] + [\name{AosIdentifiedVerticalTraits\_2},name=ivt] + ] + [\name{AosRightSideTraits\_2},name=rst] + ] + [,phantom + [\name{AosBottomSideTraits\_2} + [,phantom] + [\name{AosIdentifiedHorizontalTraits\_2},name=iht] + ] + [\name{AosTopSideTraits\_2},name=tst] + ] + ] + \draw[-Stealth] (rst) to (ivt); + \draw[-Stealth] (tst) to (iht); + \end{forest} \end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex index 60a04859ea5..eeb9e0e589e 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex @@ -8,14 +8,14 @@ fill=white,blur shadow,rounded corners,align=center}} \begin{document} \begin{forest} - [\name{ArrangementBasicTraits\_2},name=abt, + [\name{AosBasicTraits\_2},name=abt, % forked edges, for tree={concept,edge={-latex}} - [\name{ArrangementApproximateTraits\_2} + [\name{AosApproximatePointTraits\_2} [,phantom] - [\name{ArrangementLandmarkTraits\_2},name=alt,before drawing tree={x=0}] + [\name{AosLandmarkTraits\_2},name=alt,before drawing tree={x=0}] ] - [\name{ArrangementConstructXMonotoneCurveTraits\_2},name=acxmt] + [\name{AosConstructXMonotoneCurveTraits\_2},name=acxmt] ] \draw[-latex] (acxmt) to (alt); \end{forest} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png index 6908e84c4e9..6b61310c825 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex index 1cf36b78cec..82b6591f12f 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex @@ -1,16 +1,19 @@ \documentclass[12pt]{standalone} \input{header} +\usepackage[edges]{forest} +\usetikzlibrary{shadows.blur,arrows.meta} \pagestyle{empty} +\def\name#1{\textsf{\it #1}} +\tikzset{concept/.style={rectangle split,rectangle split parts=1,draw, + fill=white,blur shadow,rounded corners,align=center}} \begin{document} - \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} - \jtree[everylabel=\sl,xunit=70pt,arrows=->] - \! = {\psframebox{\concept{ArrangementLeftSideTraits\_2}}} - <4wideleft>[scaleby=2.44 1]{\psframebox{\concept{ArrangementOpenLeftTraits\_2}}}@ult !ult - ^[scaleby=1.37 1]{\psframebox{\concept{ArrangementClosedLeftTraits\_2}}}@urt !urt - ^[scaleby=1.12 1]{\psframebox{\concept{ArrangementContractedLeftTraits\_2}}}@ubt !ubt - ^<4wideright>[scaleby=2.56 1]{\psframebox{\concept{ArrangementIdentifiedVerticalTraits\_2}}}@utt !utt - . - \endjtree - \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, - etcratio=.75,triratio=.5} +\begin{forest} + [\name{AosLeftSideTraits\_2},before drawing tree={x=0pt}, + for tree={concept,edge={-Stealth}} + [{\name{AosOpenLeftTraits\_2}}] + [{\name{AosClosedLeftTraits\_2}}] + [{\name{AosContractedLeftTraits\_2}}] + [{\name{AosIdentifiedLeftTraits\_2}}] + ] +\end{forest} \end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex index c44d6ebe93e..4107460f723 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex @@ -1,21 +1,23 @@ \documentclass[12pt]{standalone} \input{header} +\usepackage[edges]{forest} +\usetikzlibrary{shadows.blur,arrows.meta} \pagestyle{empty} +\def\name#1{\textsf{\it #1}} +\tikzset{concept/.style={rectangle split,rectangle split parts=1,draw, + fill=white,blur shadow,rounded corners,align=center}} \begin{document} - \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} - \jtree[everylabel=\sl,xunit=70pt,arrows=->] - \! = {} - <4wideleft>[scaleby=2.35 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementOpenLeftTraits\_2}}}@ult !ult - ^[scaleby=1.21 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenOpenRightTraits\_2}}}@urt !urt - ^[scaleby=1.18 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenOpenBottomTraits\_2}}}@ubt !ubt - ^<4wideright>[scaleby=2.35 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenOpenTopTraits\_2}}}@utt !utt - . - \!ult = <4wideright>[scaleby=2.10 1]{\psframebox{\concept{ArrangementOpenBoundaryTraits\_2}}}@ut !ut - . - \ncline{urt:b}{ut:t} - \ncline{ubt:b}{ut:t} - \ncline{utt:b}{ut:t} - \endjtree - \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, - etcratio=.75,triratio=.5} +\begin{forest} + [,phantom,before drawing tree={x=0pt},for tree={concept,edge={-Stealth}} + [{\name{AosOpenLeftTraits\_2}},name=olt + [\name{AosOpenBoundaryTraits\_2},name=oyt,before drawing tree={x=0pt}] + ] + [{\name{AosOpenRightTraits\_2}},name=ort] + [{\name{AosOpenBottomTraits\_2}},name=obt] + [{\name{AosOpenTopTraits\_2}},name=ott] + ] + \draw[-Stealth] (ort) to (oyt); + \draw[-Stealth] (obt) to (oyt); + \draw[-Stealth] (ott) to (oyt); +\end{forest} \end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex index 141b2c2ed33..05ee3493476 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex @@ -1,20 +1,23 @@ \documentclass[12pt]{standalone} \input{header} +\usepackage[edges]{forest} +\usetikzlibrary{shadows.blur,arrows.meta} \pagestyle{empty} +\def\name#1{\textsf{\it #1}} +\tikzset{concept/.style={rectangle split,rectangle split parts=1,draw, + fill=white,blur shadow,rounded corners,align=center}} \begin{document} - \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} - \jtree[everylabel=\sl,xunit=70pt,arrows=->] - \! = {} - [scaleby=2.31 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementVerticalSideTraits\_2}}}@vst !vst - ^[scaleby=2.31 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenHorizontalSideTraits\_2}}}@hst !hst - . - \!hst = [scaleby=1.15 1]{\psframebox{\concept{ArrangementBottomSideTraits\_2}}}@bst !bst - ^[scaleby=1.15 1]{\psframebox{\concept{ArrangementTopSideTraits\_2}}}@tst !tst - . - \!vst = [scaleby=1.12 1]{\psframebox{\concept{ArrangementLeftSideTraits\_2}}}@lst !lst - ^[scaleby=1.12 1]{\psframebox{\concept{ArrangementRightSideTraits\_2}}}@rst !rst - . - \endjtree - \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, - etcratio=.75,triratio=.5} +\begin{forest} + [,phantom,before drawing tree={x=0pt}, + for tree={concept,edge={-Stealth}} + [\name{AosVerticalSideTraits\_2} + [\name{AosLeftSideTraits\_2}] + [\name{AosRightSideTraits\_2}] + ] + [\name{AosHorizontalSideTraits\_2} + [\name{AosBottomSideTraits\_2}] + [\name{AosTopologyTraits\_2}] + ] + ] +\end{forest} \end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex index bdb8ce0845a..aeafefc7a52 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex @@ -1,19 +1,35 @@ \documentclass[12pt]{standalone} \input{header} +\usepackage[edges]{forest} +\usetikzlibrary{shadows.blur,arrows.meta} \pagestyle{empty} +\def\name#1{\textsf{\it #1}} +\tikzset{concept/.style={rectangle split,rectangle split parts=1,draw, + fill=white,blur shadow,rounded corners,align=center}} \begin{document} - \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} - \jtree[everylabel=\sl,xunit=70pt,arrows=->] - \! = {} - [scaleby=2.81 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementIdentifiedVerticalTraits\_2}}}@uvt !uvt - ^[scaleby=1 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementContractedBottomTraits\_2}}}@ubt !ubt - ^[scaleby=2.73 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementContractedTopTraits\_2}}}@utt !utt - . - \!ubt = [scaleby=1 1]{\psframebox{\concept{ArrangementSphericalBoundaryTraits\_2}}}@ut !ut - . - \ncline{uvt:b}{ut:t} - \ncline{utt:b}{ut:t} - \endjtree - \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, - etcratio=.75,triratio=.5} + \begin{forest} + [\name{AosBasicTraits\_2},name=abt,before drawing tree={x=0pt},for tree={concept,edge={-Stealth}} + [\name{AosVerticalSideTraits\_2} + [\name{AosLeftSideTraits\_2} + [,phantom] + [\name{AosIdentifiedVerticalTraits\_2},name=ivt + [,phantom] + [\name{AosSphericalBoundaryTraits\_2},name=sbt,before drawing tree={x=0pt}] + ] + ] + [\name{AosRightSideTraits\_2},name=rst] + ] + [\name{AosHorizontalSideTraits\_2},before drawing tree={x-=1.5em} + [\name{AosBottomSideTraits\_2} + [\name{AosContractedBottomTraits\_2},name=cbt,before drawing tree={x-=3em}] + ] + [\name{AosTopSideTraits\_2},before drawing tree={x-=3em} + [\name{AosContractedTopTraits\_2},name=ctt,before drawing tree={x-=3em}] + ] + ] + ] + \draw[-Stealth] (cbt) to (sbt); + \draw[-Stealth] (ctt) to (sbt); + \draw[-Stealth] (rst) to (ivt); + \end{forest} \end{document} diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt index 2784310f4ed..bb5566835ab 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Qt6) diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp index f8bc222897b..bb113edd04d 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp @@ -14,7 +14,6 @@ int main () #else -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp index aba48b9f222..1665af18e8f 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp @@ -14,7 +14,6 @@ int main () } #else -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp index a88e118f38c..1e4ff25b9af 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include "arr_inexact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp index 77137ced487..c7b0621eace 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_vertical_decomposition.cpp @@ -3,7 +3,6 @@ #include -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp index 5eaccf5db9e..fdb8852661d 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/conic_multiplicities.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp index 55ea5aada14..86a07143360 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp @@ -2,7 +2,6 @@ // Associating a color attribute with segments using the consolidated // curve-data traits. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp index 4a7b7a57bdb..06c2b6b3f8b 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/curve_history.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/curve_history.cpp // Constructing an arrangement with curve history. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp index 88140318fd2..63fec621829 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/dcel_extension.cpp // Extending all DCEL records (vertices, edges and faces). -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp index 441e4f7b6ca..5dab64d1041 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dcel_extension_io.cpp @@ -3,7 +3,6 @@ #include -#include #include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp index 8ffb6688971..996728bd717 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/dual_with_data.cpp @@ -4,7 +4,6 @@ #include -#include #include #include "arr_linear.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp index bf1d504d4f6..92f8d96c893 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp // Removing curves and manipulating edges in an arrangement with history. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp index bc2403f2aeb..480b0eefe31 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp index d1bdaa8bb38..9850df520c4 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/face_extension.cpp // Extending the arrangement-face records. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp index 27459e6ff9e..255e4473822 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/face_extension_overlay.cpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp index 72710580dee..55ac76ffb59 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/generic_curve_data.cpp @@ -2,7 +2,6 @@ // Associating a name attribute with segments using the generic curve-data // traits. -#include #include #include "arr_polylines.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp index aa68c6c247f..8c165cac9f6 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp index 857a5ecdf01..a2d4c8e7f43 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/incremental_insertion.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/incremental_insertion.cpp // Using the global incremental insertion functions. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp index 4e38086f3ab..05f95776038 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io.cpp @@ -3,7 +3,6 @@ #include -#include #include #include "arr_inexact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp index b62c6a93ff9..6a37fd24094 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_curve_history.cpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp index 5cf95522f18..1cb4d2161a8 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/io_unbounded.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include "arr_linear.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp index b0f990e0ee9..071c118052e 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp index d4261d64dd2..88bbd31b83a 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/observer.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/observer.cpp // Using a simple arrangement observer. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp index 4f2fa8a38dd..30b0fd90a23 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/overlay.cpp // A simple overlay of two arrangements. -#include #include #include "arr_exact_construction_segments.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp index 42c7f69aaff..1009abe7d95 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_color.cpp @@ -3,7 +3,6 @@ #include -#include #include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp index 40d06f4f712..fd49d0fa95a 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/overlay_unbounded.cpp @@ -3,7 +3,6 @@ #include -#include #include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp index 2f3bf04bf61..7213b06f095 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp @@ -5,7 +5,6 @@ #ifdef CGAL_USE_CORE -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp index 8f9c0458d55..10fbb71ab83 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/point_location.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/point_location.cpp // Answering point-location queries. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp index 309a849e64b..25c74a71836 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp @@ -13,7 +13,6 @@ int main() { #else -#include #include #include "arr_Bezier.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp index 742473a79bf..46432532c00 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp @@ -15,7 +15,6 @@ int main() { #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp index bdaafb9ebb0..7910a723c46 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp @@ -15,7 +15,6 @@ int main() { #include -#include #include #include "arr_conics.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp index f0ed969d845..d238706a0df 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include "arr_exact_construction_segments.h" #include "arr_print.h" #include "read_objects.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp index 565f903cddc..8d53c465581 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp @@ -36,13 +36,6 @@ using Trap_pl = CGAL::Arr_trapezoid_ric_point_location; using Geom_traits = Gm::Geometry_traits_2; using Point_2 = Geom_traits::Point_2; -using Point_location_result = CGAL::Arr_point_location_result; -using Query_result = std::pair; - -using Vertex_const_handle = Gm::Vertex_const_handle; -using Halfedge_const_handle = Gm::Halfedge_const_handle; -using Face_const_handle = Gm::Face_const_handle; - int main() { Gm_polyhedron p; p.make_tetrahedron(Point_3(1.0, 0.0, 0.0), Point_3(0.0, 1.0, 0.0), @@ -50,7 +43,7 @@ int main() { Gm gm; Naive_pl naive_pl(gm); - // Landmarks_pl landmarks_pl(gm); + Landmarks_pl landmarks_pl(gm); Walk_pl walk_pl(gm); // Trap_pl trap_pl(gm); @@ -70,30 +63,17 @@ int main() { locate_point(naive_pl, points[1]); locate_point(naive_pl, points[2]); + // locate_point(walk_pl, points[0]); + // locate_point(walk_pl, points[1]); + // locate_point(walk_pl, points[2]); + + locate_point(landmarks_pl, points[0]); + locate_point(landmarks_pl, points[1]); + locate_point(landmarks_pl, points[2]); + // locate_point(trap_pl, points[0]); - - //////// - std::list results; - // The following cause an assertion failure. - // CGAL::locate(gm, &points[0], &points[3], std::back_inserter(results)); - - // Print the results. - for (auto it = results.begin(); it != results.end(); ++it) { - std::cout << "The point (" << it->first << ") is located "; - if (const Face_const_handle* f = - std::get_if(&(it->second))) // inside a face - std::cout << "inside " - << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") - << " face.\n"; - else if (const Halfedge_const_handle* e = - std::get_if(&(it->second))) // on an edge - std::cout << "on an edge: " << (*e)->curve() << std::endl; - else if (const Vertex_const_handle* v = - std::get_if(&(it->second))) // on a vertex - std::cout << "on " - << (((*v)->is_isolated()) ? "an isolated" : "a") - << " vertex: " << (*v)->point() << std::endl; - } + // locate_point(trap_pl, points[1]); + // locate_point(trap_pl, points[2]); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp index ba27599b22d..e43b1df9ab8 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/spherical_overlay.cpp // Overlay of two arrangements embedded on the sphere. -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp index df5715628f7..1f2a4407b16 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/tracing_counting.cpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp index e870a714ccc..50ac2b19f3e 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp @@ -3,7 +3,6 @@ #include -#include #include #include "arr_linear.h" diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp index e4e415bd825..c1e80f97c82 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp @@ -1,7 +1,6 @@ //! \file examples/Arrangement_on_surface_2/ex_vertical_ray_shooting.cpp // Answering vertical ray-shooting queries. -#include #include #include diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h index 06ec80facc7..dbe7b2b89cb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h @@ -73,7 +73,7 @@ public: typedef typename Algebraic_kernel_d_2::Polynomial_2 Polynomial_2; - /// public types for ArrangementTraits_2 + /// public types for AosTraits_2 typedef typename Algebraic_kernel_d_2::Curve_analysis_2 Curve_2; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h index 437d8ee4b86..6d810e11f3c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h @@ -1515,7 +1515,7 @@ public: //@} - /*! \name Auxiliary Functor definitions, used gor, e.g., the landmarks + /*! \name Auxiliary Functor definitions, used gor, e.g., the landmarks \ * point-location strategy and the drawing function. */ //@{ diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h index 51949d4546e..922f6c7ebed 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h @@ -316,7 +316,7 @@ public: Make_x_monotone_2(const Base& base, std::size_t& counter) : m_object(base.make_x_monotone_2_object()), m_counter(counter) {} - /*! Subdivide a given curve into \f$x\f$-monotone subcurves and insert them + /*! subdivides a given curve into \f$x\f$-monotone subcurves and insert them * into a given output iterator. * \param cv the curve. * \param oi the output iterator for the result. Its value type is a variant @@ -411,7 +411,7 @@ public: m_object(base.construct_opposite_2_object()), m_counter(counter) {} /*! operates */ - X_monotone_curve_2 operator()(const X_monotone_curve_2& xc) + X_monotone_curve_2 operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; @@ -429,7 +429,7 @@ public: m_object(base.compare_endpoints_xy_2_object()), m_counter(counter) {} /*! operates */ - Comparison_result operator()(const X_monotone_curve_2& xc) + Comparison_result operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h index f38156da2af..0e986fc78bb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h @@ -40,24 +40,24 @@ namespace CGAL { inline void* _clean_pointer(const void* p) { - static_assert(sizeof(void*) == sizeof(size_t)); - const size_t mask = ~1; - const size_t val = (reinterpret_cast(p) & mask); + static_assert(sizeof(void*) == sizeof(std::size_t)); + const std::size_t mask = ~1; + const std::size_t val = (reinterpret_cast(p) & mask); return (reinterpret_cast(val)); } inline void* _set_lsb(const void* p) { - const size_t mask = 1; - const size_t val = (reinterpret_cast(p) | mask); + const std::size_t mask = 1; + const std::size_t val = (reinterpret_cast(p) | mask); return (reinterpret_cast( val)); } inline bool _is_lsb_set(const void* p) { - const size_t mask = 1; - const size_t val = reinterpret_cast(p); + const std::size_t mask = 1; + const std::size_t val = reinterpret_cast(p); return ((val & mask) != 0); } @@ -565,7 +565,7 @@ public: Outer_ccb_const_iterator; /*! obtains the number of outer CCBs the face has. */ - size_t number_of_outer_ccbs() const { return (this->outer_ccbs.size()); } + std::size_t number_of_outer_ccbs() const { return (this->outer_ccbs.size()); } /*! obtains an iterator for the first outer CCB of the face. */ Outer_ccb_iterator outer_ccbs_begin() { return (this->outer_ccbs.begin()); } @@ -601,7 +601,7 @@ public: typedef Inner_ccb_const_iterator Hole_const_iterator; /*! obtains the number of inner CCBs the face has. */ - size_t number_of_inner_ccbs() const { return (this->inner_ccbs.size()); } + std::size_t number_of_inner_ccbs() const { return (this->inner_ccbs.size()); } /*! obtains an iterator for the first inner CCB of the face. */ Inner_ccb_iterator inner_ccbs_begin() { return (this->inner_ccbs.begin()); } @@ -646,7 +646,7 @@ public: } // Backward compatibility: - size_t number_of_holes() const { return number_of_inner_ccbs(); } + std::size_t number_of_holes() const { return number_of_inner_ccbs(); } Hole_iterator holes_begin() { return inner_ccbs_begin(); } Hole_iterator holes_end() { return inner_ccbs_end(); } Hole_const_iterator holes_begin() const { return inner_ccbs_begin(); } @@ -669,7 +669,7 @@ public: Isolated_vertex_const_iterator; /*! obtains the number of isloated vertices inside the face. */ - size_t number_of_isolated_vertices() const + std::size_t number_of_isolated_vertices() const { return (this->iso_verts.size()); } /*! obtains an iterator for the first isloated vertex inside the face. */ @@ -986,13 +986,13 @@ protected: typedef In_place_list Inner_ccb_list; typedef In_place_list Iso_vert_list; - typedef std::allocator_traits Allocator_traits; - typedef typename Allocator_traits::template rebind_alloc Vertex_allocator; - typedef typename Allocator_traits::template rebind_alloc Halfedge_allocator; - typedef typename Allocator_traits::template rebind_alloc Face_allocator; - typedef typename Allocator_traits::template rebind_alloc Outer_ccb_allocator; - typedef typename Allocator_traits::template rebind_alloc Inner_ccb_allocator; - typedef typename Allocator_traits::template rebind_alloc Iso_vert_allocator; + typedef std::allocator_traits Allocator_traits; + typedef typename Allocator_traits::template rebind_alloc Vertex_allocator; + typedef typename Allocator_traits::template rebind_alloc Halfedge_allocator; + typedef typename Allocator_traits::template rebind_alloc Face_allocator; + typedef typename Allocator_traits::template rebind_alloc Outer_ccb_allocator; + typedef typename Allocator_traits::template rebind_alloc Inner_ccb_allocator; + typedef typename Allocator_traits::template rebind_alloc Iso_vert_allocator; public: typedef typename Halfedge_list::size_type Size; @@ -1002,7 +1002,6 @@ public: typedef std::bidirectional_iterator_tag iterator_category; protected: - Vertex_list vertices; // The vertices container. Halfedge_list halfedges; // The halfedges container. Face_list faces; // The faces container. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h index 48de8ad5792..825b244e69e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h @@ -22,10 +22,10 @@ namespace CGAL { /*! \class * A model of the following concepts: - * 1. ArrangementBasicTraits_2, - * 2. ArrangementDirectionalXMonotoneTraits_2, - * 4. ArrangementConstructXMonotoneCurveTraits_2, and - * 3. ArrangementOpenBoundaryTraits_2 + * 1. AosBasicTraits_2, + * 2. AosDirectionalXMonotoneTraits_2, + * 4. AosConstructXMonotoneCurveTraits_2, and + * 3. AosOpenBoundaryTraits_2 * It handles linear curves. */ template @@ -43,7 +43,7 @@ public: Arr_directional_non_caching_segment_basic_traits_2() : Base() {} /// \name Types and functors inherited from the base, required by the - // ArrangementBasicTraits_2 concept. + // AosBasicTraits_2 concept. //@{ // Traits types: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h b/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h index da68eb331be..0f9b28f3cdd 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h @@ -61,8 +61,10 @@ public: template struct rebind { - using Point_2 = Point_; - using other = typename Vertex_base::template rebind; + using Pnt = Point_; + using Rebind_vertex_base = typename Vertex_base::template rebind; + using Other_vertex_base = typename Rebind_vertex_base::other; + using other = Arr_extended_vertex; }; }; @@ -101,8 +103,10 @@ public: template struct rebind { - using X_monotonote_curve_2 = XMonotoneCurve; - using other = typename Halfedge_base::template rebind; + using Xcv = XMonotoneCurve; + using Rebind_halfedge_base = typename Halfedge_base::template rebind; + using Other_halfedge_base = typename Rebind_halfedge_base::other; + using other = Arr_extended_halfedge; }; }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h index 9cfcd680aea..8db96653d1b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h @@ -8,8 +8,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s) : Idit Haran -// Ron Wein +// Author(s) : Idit Haran +// Ron Wein #ifndef CGAL_ARR_LANDMARKS_POINT_LOCATION_H #define CGAL_ARR_LANDMARKS_POINT_LOCATION_H @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -42,44 +43,54 @@ namespace CGAL { * Generator is a class that generates the set of landmarks. */ -template > -class Arr_landmarks_point_location -{ +template > +class Arr_landmarks_point_location { public: - typedef Arrangement_ Arrangement_2; - typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; - typedef Generator_ Generator; + using Arrangement_2 = Arrangement_; + using Generator = Generator_; + using Geometry_traits_2 = typename Arrangement_2::Geometry_traits_2; - typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement_2::Face_const_handle Face_const_handle; + using Vertex_const_handle = typename Arrangement_2::Vertex_const_handle; + using Halfedge_const_handle = typename Arrangement_2::Halfedge_const_handle; + using Face_const_handle = typename Arrangement_2::Face_const_handle; - typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; - typedef typename Arrangement_2::Halfedge_const_iterator - Halfedge_const_iterator; - typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator - Halfedge_around_vertex_const_circulator; - typedef typename Arrangement_2::Ccb_halfedge_const_circulator - Ccb_halfedge_const_circulator; - typedef typename Arrangement_2::Outer_ccb_const_iterator - Outer_ccb_const_iterator; - typedef typename Arrangement_2::Inner_ccb_const_iterator - Inner_ccb_const_iterator; - typedef typename Arrangement_2::Isolated_vertex_const_iterator - Isolated_vertex_const_iterator; + using Vertex_const_iterator = typename Arrangement_2::Vertex_const_iterator; + using Halfedge_const_iterator = + typename Arrangement_2::Halfedge_const_iterator; - typedef typename Arrangement_2::Point_2 Point_2; - typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; + using Halfedge_around_vertex_const_circulator = + typename Arrangement_2::Halfedge_around_vertex_const_circulator; + using Ccb_halfedge_const_circulator = + typename Arrangement_2::Ccb_halfedge_const_circulator; + using Outer_ccb_const_iterator = + typename Arrangement_2::Outer_ccb_const_iterator; + using Inner_ccb_const_iterator = + typename Arrangement_2::Inner_ccb_const_iterator; + using Isolated_vertex_const_iterator = + typename Arrangement_2::Isolated_vertex_const_iterator; - typedef Arr_point_location_result Result; - typedef typename Result::Type Result_type; + using Point_2 = typename Arrangement_2::Point_2; + using X_monotone_curve_2 = typename Arrangement_2::X_monotone_curve_2; + + using Result = Arr_point_location_result; + using Result_type = typename Result::Type; // Support cpp11::result_of - typedef Result_type result_type; + using result_type = Result_type; + +private: + using Gt2 = Geometry_traits_2; + using Left_side_category = + typename internal::Arr_complete_left_side_category::Category; + using Right_side_category = + typename internal::Arr_complete_right_side_category::Category; + using Left_or_right_sides_category = + typename Arr_two_sides_category::result; protected: - typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; + using Traits_adaptor_2 = Arr_traits_basic_adaptor_2; /*! \struct Less_halfedge_handle * Used to sort handles. @@ -92,10 +103,10 @@ protected: typedef std::set Halfedge_set; // Data members: - const Arrangement_2* p_arr; // The associated arrangement. + const Arrangement_2* p_arr; // The associated arrangement. const Traits_adaptor_2* m_traits; // Its associated traits object. - Generator* lm_gen; // The associated landmark generator. - bool own_gen; // Indicates whether the generator + Generator* lm_gen; // The associated landmark generator. + bool own_gen; // Indicates whether the generator // has been locally allocated. template @@ -103,7 +114,7 @@ protected: inline Result_type default_result() const { return Result::default_result(); } public: - /*! Default constructor. */ + /*! constructs default. */ Arr_landmarks_point_location() : p_arr(nullptr), m_traits(nullptr), @@ -111,34 +122,32 @@ public: own_gen(false) {} - /*! Constructor given an arrangement only. */ + /*! constructs given an arrangement only. */ Arr_landmarks_point_location(const Arrangement_2& arr) : p_arr(&arr), m_traits(static_cast(p_arr->geometry_traits())), lm_gen(new Generator(arr)), // allocate the landmarks generator. own_gen(true) - { } + {} - /*! Constructor given an arrangement, and landmarks generator. */ + /*! constructs given an arrangement, and landmarks generator. */ Arr_landmarks_point_location(const Arrangement_2& arr, Generator* gen) : p_arr(&arr), m_traits(static_cast(p_arr->geometry_traits())), lm_gen(gen), own_gen(false) - { } + {} - /*! Destructor. */ - ~Arr_landmarks_point_location() - { + /*! destructs. */ + ~Arr_landmarks_point_location() { if (own_gen) { delete lm_gen; lm_gen = nullptr; } } - /*! Attach an arrangement object (and a generator, if supplied). */ - void attach(const Arrangement_2& arr, Generator* gen = nullptr) - { + /*! attaches an arrangement object (and a generator, if supplied). */ + void attach(const Arrangement_2& arr, Generator* gen = nullptr) { // Keep a pointer to the associated arrangement. p_arr = &arr; m_traits = static_cast(p_arr->geometry_traits()); @@ -163,9 +172,8 @@ public: } } - /*! Detach the instance from the arrangement object. */ - void detach() - { + /*! detaches the instance from the arrangement object. */ + void detach() { p_arr = nullptr; m_traits = nullptr; @@ -174,8 +182,7 @@ public: lm_gen->detach(); } - /*! - * Locate the arrangement feature containing the given point. + /*! locates the arrangement feature containing the given point. * \param p The query point. * \return An object representing the arrangement feature containing the * query point. This object is either a Face_const_handle or a @@ -184,7 +191,7 @@ public: result_type locate(const Point_2& p) const; protected: - /*! Walk from the given vertex to the query point. + /*! walks from the given vertex to the query point. * \param vh The given vertex handle. * \param p The query point. * \param crossed_edges In/Out: The set of edges crossed so far. @@ -196,7 +203,7 @@ protected: const Point_2& p, Halfedge_set& crossed_edges) const; - /*! Locate an edge around a given vertex that is the predecessor of the + /*! locates an edge around a given vertex that is the predecessor of the * curve connecting the vertex to the query point in a clockwise order. * \param vh The vertex. * \param p The query point. @@ -207,7 +214,7 @@ protected: const Point_2& p, bool& new_vertex) const; - /*! Walk from a point on a given halfedge to the query point. + /*! walks from a point on a given halfedge to the query point. * \param eh The given halfedge handle. * \param np The point that the walk starts from. * \param p The query point. @@ -220,7 +227,7 @@ protected: const Point_2& np, const Point_2& p, Halfedge_set& crossed_edges) const; - /*! In case the arrangement's curve contained in the segment + /*! handles the arrangement curve contained in the segment * from the nearest landmark to the query point * \param he The given halfedge handle. * \param p_is_left Is the query point the left endpoint of seg. @@ -236,7 +243,7 @@ protected: const Point_2& p, Halfedge_set& crossed_edges) const; - /*! Walk from a point in a face to the query point. + /*! walks from a point in a face to the query point. * \param fh A halfedge handle that points to the face. * \param np The point that the walk starts from. * \param p The query point. @@ -250,7 +257,7 @@ protected: const Point_2& p, Halfedge_set& crossed_edges) const; - /*! Find a halfedge on the given CCB that intersects the given x-monotone + /*! finds a halfedge on the given CCB that intersects the given x-monotone * curve, connecting the current landmark to the query point. * \param circ The CCB circulator. * \param seg The segment connecting the landmark and the query point. @@ -275,7 +282,7 @@ protected: bool& cv_is_contained_in_seg, Vertex_const_handle& new_vertex) const; - /*! Return the halfedge that contains the query point. + /*! returns the halfedge that contains the query point. * \param he The halfedge handle. * \param crossed_edges In/Out: The set of edges crossed so far. * \param p The query point. @@ -287,7 +294,7 @@ protected: const Point_2& p, bool& is_target) const; - /*! Check whether the given curve intersects a simple segment, which connects + /*! checks whether the given curve intersects a simple segment, which connects * the current landmark to the query point, an odd number of times. * \param cv The curve. * \param seg The segment connecting the landmark and the query point. @@ -303,9 +310,62 @@ protected: bool& p_on_curve, bool& cv_and_seg_overlap, bool& cv_is_contained_in_seg) const; + + //! + template + std::pair + construct_segment(const Point_2& p, const Point_2& q, T const& traits, + ...) const { + X_monotone_curve_2 seg = traits.construct_x_monotone_curve_2_object()(p, q); + Comparison_result res = traits.compare_xy_2_object()(p, q); + return std::make_pair(seg, res); + } + + //*! + template + std::pair + construct_segment(const Point_2& p, const Point_2& q, T const& traits, + int) const { + X_monotone_curve_2 seg = traits.construct_x_monotone_curve_2_object()(p, q); + Comparison_result res = traits.compare_endpoints_xy_2_object()(seg); + return std::make_pair(seg, res); + } + + /*! Determines whether the $x$-coordinates of two points are equal. + */ + bool equal_x_2(const Point_2& p, const Point_2& q, + Arr_all_sides_oblivious_tag) const + { return (m_traits->compare_x_2_object()(p, q) == EQUAL); } + + /*! Determines whether the $x$-coordinates of two points are equal. + */ + bool equal_x_2(const Point_2& p, const Point_2& q, + Arr_has_identified_side_tag) const { + auto is_on_y_identification = m_traits->is_on_y_identification_2_object(); + if (is_on_y_identification(p)) { + return is_on_y_identification(q); + } + if (is_on_y_identification(q)) return false; + return (m_traits->compare_x_2_object()(p, q) == EQUAL); + } + + /*! Determines whether the $x$-coordinates of two points are equal. + */ + bool equal_x_2(const Point_2& p, const Point_2& q, + Arr_boundary_cond_tag) const { + auto param_space_in_x = m_traits->parameter_space_in_x_2_object(); + switch (param_space_in_x(p)) { + case ARR_LEFT_BOUNDARY: return (param_space_in_x(q) == ARR_LEFT_BOUNDARY); + case ARR_RIGHT_BOUNDARY: return (param_space_in_x(q) == ARR_LEFT_BOUNDARY); + case ARR_INTERIOR: return (m_traits->compare_x_2_object()(p, q) == EQUAL); + default: CGAL_error(); + } + CGAL_error(); + return false; + } }; -} //namespace CGAL +} // namespace CGAL // The member-function definitions can be found under: #include diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h index b15cf639204..c4a72fced45 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h @@ -25,8 +25,8 @@ /*! \file The basic non-caching segment traits-class for the arrangement * package. This traits class handles \f$x\f$-monotone non-intersecting - * segments. It is a model of the ArrangementBasicTraits_2 concept. The class - * is templated by a kernel and inherits from it all the types and many of the + * segments. It is a model of the AosBasicTraits_2 concept. The class is + * templated by a kernel and inherits from it all the types and many of the * functors required by the concept it models. */ @@ -41,7 +41,7 @@ namespace CGAL { /*! \class - * A model of the ArrangementBasicTraits_2 concept that handles \f$x\f$-monotone + * A model of the AosBasicTraits_2 concept that handles \f$x\f$-monotone * non-intersecting line segments. */ template diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h index 4029a7be681..f65c22ef052 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h @@ -20,10 +20,10 @@ /*! \file The non-caching segment traits-class for the arrangement package. * This traits class handles general segments. It is a model of the - * ArrangementTraits_2 concept, a refinement of the ArrangementBasicTraits_2 + * AosTraits_2 concept, a refinement of the AosBasicTraits_2 * concept. The class is templated by a kernel and inherits from the * Arr_non_caching_segment_basic_traits_2 class instantiated with the kernel - - * a model of the ArrangementBasicTraits_2 concept. It defined a few additional + * a model of the AosBasicTraits_2 concept. It defined a few additional * functors required by the concept it models. */ @@ -38,7 +38,7 @@ namespace CGAL { /*! \class - * A model of the ArrangementTraits_2 concept that handles general + * A model of the AosTraits_2 concept that handles general * line segments. */ template diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h index dae2f574090..74d400cfc33 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h @@ -7,16 +7,15 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Idit Haran -// Ron Wein -// Efi Fogel +// Author(s) : Idit Haran +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_LANDMARKS_PL_IMPL_H #define CGAL_ARR_LANDMARKS_PL_IMPL_H #include - /*! \file * Member-function definitions for the * Arr_landmarks_point_location class. @@ -24,60 +23,53 @@ namespace CGAL { -//----------------------------------------------------------------------------- -// Locate the arrangement feature containing the given point. -// +/*! locates the arrangement feature containing the given point. + */ template typename Arr_landmarks_point_location::result_type -Arr_landmarks_point_location::locate(const Point_2& p) const -{ +Arr_landmarks_point_location::locate(const Point_2& p) const { // If the arrangement is empty, return its initial (empty and // non-fictitious) face. if (p_arr->number_of_vertices() == 0) { CGAL_assertion(p_arr->number_of_faces() == 1); - Face_const_handle fh = p_arr->faces_begin(); + Face_const_handle fh = p_arr->faces_begin(); return make_result(fh); } + // Use the generator and to find the closest landmark to the query point. - result_type lm_location_obj; + result_type lm_location_obj; const Point_2& landmark_point = lm_gen->closest_landmark(p, lm_location_obj); // If the query point and the landmark point are equal, return the landmark. - if (m_traits->equal_2_object()(landmark_point, p)) - return lm_location_obj; + if (m_traits->equal_2_object()(landmark_point, p)) return lm_location_obj; // Walk from the nearest_vertex to the point p, using walk algorithm, // and find the location of the query point p. Note that the set of edges // we have crossed so far is initially empty. - Halfedge_set crossed_edges; - result_type out_obj; + Halfedge_set crossed_edges; + result_type out_obj; // Locate the arrangement feature that contains the landmark. - const Vertex_const_handle* vh; - const Halfedge_const_handle* hh; - const Face_const_handle* fh; - if ( ( vh = Result().template assign(&lm_location_obj) ) ) - out_obj = _walk_from_vertex(*vh, p, crossed_edges); - else if ( ( hh = Result().template assign(&lm_location_obj) ) ) - out_obj = _walk_from_edge(*hh, landmark_point, p, crossed_edges); - else if ( ( fh = Result().template assign(&lm_location_obj) ) ) - out_obj = _walk_from_face(*fh, landmark_point, p, crossed_edges); + if (const auto* v = std::get_if(&lm_location_obj)) + out_obj = _walk_from_vertex(*v, p, crossed_edges); + else if (const auto* e = std::get_if(&lm_location_obj)) + out_obj = _walk_from_edge(*e, landmark_point, p, crossed_edges); + else if (const auto* f = std::get_if(&lm_location_obj)) + out_obj = _walk_from_face(*f, landmark_point, p, crossed_edges); else CGAL_error_msg("lm_location_obj of an unknown type."); - if ( ( fh = Result().template assign(&out_obj) ) ) { + if (const auto* fp = std::get_if(&out_obj)) { + const auto& f = *fp; // If we reached here, we did not locate the query point in any of the // holes inside the current face, so we conclude it is contained in this - // face. - // However, we first have to check whether the query point coincides with - // any of the isolated vertices contained inside this face. - Isolated_vertex_const_iterator iso_verts_it; - typename Traits_adaptor_2::Equal_2 equal = m_traits->equal_2_object(); - - for (iso_verts_it = (*fh)->isolated_vertices_begin(); - iso_verts_it != (*fh)->isolated_vertices_end(); ++iso_verts_it) - { + // face. However, we first have to check whether the query point coincides + // with any of the isolated vertices contained inside this face. + auto equal = m_traits->equal_2_object(); + // Do not use 'auto' to define the iterator, as MSVC2017 complains. + for (Isolated_vertex_const_iterator iso_verts_it = f->isolated_vertices_begin(); + iso_verts_it != f->isolated_vertices_end(); ++iso_verts_it) { if (equal(p, iso_verts_it->point())) { - Vertex_const_handle ivh = iso_verts_it; + Vertex_const_handle ivh = iso_verts_it; return make_result(ivh); } } @@ -86,28 +78,24 @@ Arr_landmarks_point_location::locate(const Point_2& p) const return out_obj; } -//----------------------------------------------------------------------------- -// Walk from a given vertex to the query point. -// +/*! walks from a given vertex to the query point. + */ template typename Arr_landmarks_point_location::result_type Arr_landmarks_point_location:: -_walk_from_vertex(Vertex_const_handle nearest_vertex, - const Point_2& p, - Halfedge_set& crossed_edges) const -{ +_walk_from_vertex(Vertex_const_handle nearest_vertex, const Point_2& p, + Halfedge_set& crossed_edges) const { Vertex_const_handle vh = nearest_vertex; CGAL_assertion_msg(! vh->is_at_open_boundary(), "_walk_from_vertex() from a vertex at infinity."); // Check if the query point p coincides with the vertex. - if (m_traits->equal_2_object()(vh->point(), p)) - return make_result(vh); + if (m_traits->equal_2_object()(vh->point(), p)) return make_result(vh); // In case of an isolated vertex, walk to from the face that contains // it toward the query point. if (vh->is_isolated()) { - Face_const_handle fh = vh->face(); + Face_const_handle fh = vh->face(); return (_walk_from_face(fh, vh->point(), p, crossed_edges)); } @@ -116,16 +104,15 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex, Halfedge_around_vertex_const_circulator first = vh->incident_halfedges(); // Create an x-monotone curve connecting the point associated with the // vertex vp and the query point p. - const Point_2& vp = vh->point(); - X_monotone_curve_2 seg = - m_traits->construct_x_monotone_curve_2_object()(vp, p); - const bool seg_dir_right = - (m_traits->compare_xy_2_object()(vp, p) == SMALLER); + const Point_2& vp = vh->point(); + X_monotone_curve_2 seg; + Comparison_result res; + std::tie(seg, res) = construct_segment(vp, p, *m_traits, 0); + bool seg_dir_right = (res == SMALLER); Halfedge_around_vertex_const_circulator curr_iter = first; Halfedge_around_vertex_const_circulator next_iter = curr_iter; ++next_iter; - typename Traits_adaptor_2::Is_between_cw_2 is_between_cw = - m_traits->is_between_cw_2_object(); + auto is_between_cw = m_traits->is_between_cw_2_object(); // Traverse the halfedges around vp until we find the pair of adjacent // halfedges such as seg is located clockwise in between them. do { @@ -134,12 +121,11 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex, (curr_iter->direction() == ARR_RIGHT_TO_LEFT), next_iter->curve(), (next_iter->direction() == ARR_RIGHT_TO_LEFT), - vp, eq_curr_iter, eq_next_iter)) - { + vp, eq_curr_iter, eq_next_iter)) { // the assumption is that each edge is crossed at most twice - CGAL_assertion_msg(crossed_edges.count (curr_iter) < 2, + CGAL_assertion_msg(crossed_edges.count(curr_iter) < 2, "crossed_edges should contain each halfedge at most twice."); - CGAL_assertion_msg(crossed_edges.count (next_iter) < 2, + CGAL_assertion_msg(crossed_edges.count(next_iter) < 2, "crossed_edges should contain each halfedge at most twice."); crossed_edges.insert(curr_iter); crossed_edges.insert(curr_iter->twin()); @@ -158,8 +144,7 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex, result_type obj = _find_face_around_vertex(vh, p, new_vertex); if (new_vertex) { // We found a vertex closer to p; Continue using this vertex. - const Vertex_const_handle* p_vh = - Result().template assign(&obj); + const auto* p_vh = std::get_if(&obj); CGAL_assertion(p_vh != nullptr); vh = *p_vh; continue; @@ -167,15 +152,13 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex, // If p is located on an edge or on a vertex, return the object // that wraps this arrangement feature. - if (Result().template assign(&obj) || - Result().template assign(&obj)) + if (std::get_if(&obj) || + std::get_if(&obj)) return obj; - const Face_const_handle* p_fh = - Result().template assign(&obj); - if (p_fh) - // Walk to p from the face we have located: - return _walk_from_face(*p_fh, vh->point(), p, crossed_edges); + const auto* p_fh = std::get_if(&obj); + // Walk to p from the face we have located: + if (p_fh) return _walk_from_face(*p_fh, vh->point(), p, crossed_edges); CGAL_error_msg("_find_face_around_vertex() returned an unknown object."); } @@ -185,31 +168,27 @@ _walk_from_vertex(Vertex_const_handle nearest_vertex, return default_result(); } -//----------------------------------------------------------------------------- -// Locate an edge around a given vertex that is the predecessor of the curve -// connecting the vertex to the query point in a clockwise order. -// +/*! locates an edge around a given vertex that is the predecessor of the curve + * connecting the vertex to the query point in a clockwise order. + */ template typename Arr_landmarks_point_location::result_type Arr_landmarks_point_location:: -_find_face_around_vertex(Vertex_const_handle vh, - const Point_2& p, - bool& new_vertex) const -{ +_find_face_around_vertex(Vertex_const_handle vh, const Point_2& p, + bool& new_vertex) const { new_vertex = false; // Create an x-monotone curve connecting the point associated with the // vertex vp and the query point p. - const Point_2& vp = vh->point(); - X_monotone_curve_2 seg = - m_traits->construct_x_monotone_curve_2_object()(vp, p); - const bool seg_dir_right = - (m_traits->compare_xy_2_object()(vp, p) == SMALLER); - + const Point_2& vp = vh->point(); + X_monotone_curve_2 seg; + Comparison_result res; + std::tie(seg, res) = construct_segment(vp, p, *m_traits, 0); + bool seg_dir_right = (res == SMALLER); // Get the first incident halfedge around v and the next halfedge. - Halfedge_around_vertex_const_circulator first = vh->incident_halfedges(); - Halfedge_around_vertex_const_circulator curr, next; - bool equal_curr = false; + Halfedge_around_vertex_const_circulator first = vh->incident_halfedges(); + Halfedge_around_vertex_const_circulator curr, next; + bool equal_curr = false; next = curr = first; ++next; @@ -241,16 +220,14 @@ _find_face_around_vertex(Vertex_const_handle vh, else { // Traverse the halfedges around v until we find the pair of adjacent // halfedges such as seg is located clockwise in between them. - typename Traits_adaptor_2::Is_between_cw_2 is_between_cw = - m_traits->is_between_cw_2_object(); - bool eq_curr, eq_next; + auto is_between_cw = m_traits->is_between_cw_2_object(); + bool eq_curr, eq_next; while (! is_between_cw(seg, seg_dir_right, curr->curve(), (curr->direction() == ARR_RIGHT_TO_LEFT), next->curve(), (next->direction() == ARR_RIGHT_TO_LEFT), - vp, eq_curr, eq_next)) - { + vp, eq_curr, eq_next)) { // Break the loop if seg equals one of the halfedges next to v. if (eq_curr) { equal_curr = true; @@ -291,10 +268,9 @@ _find_face_around_vertex(Vertex_const_handle vh, // Check whether p lies on the curve associated with the edge. if (m_traits->is_in_x_range_2_object()(curr->curve(), p) && - m_traits->compare_y_at_x_2_object()(p, curr->curve()) == EQUAL) - { + m_traits->compare_y_at_x_2_object()(p, curr->curve()) == EQUAL) { // p is located on the interior of the edge. - Halfedge_const_handle he = curr; + Halfedge_const_handle he = curr; return make_result(he); } @@ -304,22 +280,18 @@ _find_face_around_vertex(Vertex_const_handle vh, return make_result(curr->source()); } -//----------------------------------------------------------------------------- -// Walk from the edge to the query point. -// +/*! walks from the edge to the query point. + */ template typename Arr_landmarks_point_location::result_type Arr_landmarks_point_location:: -_walk_from_edge(Halfedge_const_handle eh, - const Point_2& np, - const Point_2& p, - Halfedge_set& crossed_edges) const -{ +_walk_from_edge(Halfedge_const_handle eh, const Point_2& np, const Point_2& p, + Halfedge_set& crossed_edges) const { CGAL_assertion_msg(! eh->is_fictitious(), "_walk_from_edge() from a fictitious edge."); const X_monotone_curve_2& cv = eh->curve() ; - Comparison_result res; + Comparison_result res; X_monotone_curve_2 seg = m_traits->construct_x_monotone_curve_2_object()(np, p); @@ -345,8 +317,7 @@ _walk_from_edge(Halfedge_const_handle eh, if (m_traits->is_in_x_range_2_object()(seg, temp_p)) { //we must make sure that eh is not a tip on an "antena" if (m_traits->compare_y_at_x_2_object()(temp_p, seg) == EQUAL && - eh->prev() != eh->twin()) - { + eh->prev() != eh->twin()) { // the assumption is that each edge is crossed at most twice CGAL_assertion_msg(crossed_edges.count(eh->prev()) < 2, "crossed_edges should contain each halfedge at most twice."); @@ -367,8 +338,7 @@ _walk_from_edge(Halfedge_const_handle eh, if (m_traits->is_in_x_range_2_object()(seg, temp_p)) { //we must make sure that eh is not a tip on an "antena" if (m_traits->compare_y_at_x_2_object()(temp_p, seg) == EQUAL && - eh->next() != eh->twin()) - { + eh->next() != eh->twin()) { // the assumption is that each edge is crossed at most twice CGAL_assertion_msg(crossed_edges.count(eh->next()) < 2, "crossed_edges should contain each halfedge at most twice."); @@ -428,89 +398,71 @@ _walk_from_edge(Halfedge_const_handle eh, return (_walk_from_vertex(vh, p, crossed_edges)); } -//----------------------------------------------------------------------------- -// In case the arrangement's curve contained in the segment -// from the nearest landmark to the query point -// +/*! deals with an arrangement curve contained in the segment from the nearest + * landmark to the query point + */ template typename Arr_landmarks_point_location::result_type Arr_landmarks_point_location:: -_deal_with_curve_contained_in_segment(Halfedge_const_handle he, - bool p_is_left, +_deal_with_curve_contained_in_segment(Halfedge_const_handle he, bool p_is_left, const Point_2& p, - Halfedge_set& crossed_edges) const -{ + Halfedge_set& crossed_edges) const { // in this case we want to walk from to the query point from the nearest // vertex either the halfedge's source or target - Vertex_const_handle vh; - bool target_is_left; - if (m_traits->compare_xy_2_object() - (he->source()->point(),he->target()->point()) == LARGER) - target_is_left = true; - else - target_is_left = false; + auto cmp_xy = m_traits->compare_xy_2_object(); + bool target_is_left = + (cmp_xy(he->source()->point(), he->target()->point()) == LARGER); + + Vertex_const_handle vh; if (p_is_left) { - if (target_is_left) - vh = he->target(); - else - vh = he->source(); + if (target_is_left) vh = he->target(); + else vh = he->source(); } else { - if (target_is_left) - vh = he->source(); - else - vh = he->target(); + if (target_is_left) vh = he->source(); + else vh = he->target(); } // vh is the closest vertex among the halfedge's end points return (_walk_from_vertex(vh, p, crossed_edges)); } -//----------------------------------------------------------------------------- -// Walk from the given face to the query point. -// +/*! walks from the given face to the query point. + */ template typename Arr_landmarks_point_location::result_type Arr_landmarks_point_location:: -_walk_from_face(Face_const_handle face, - const Point_2& np, - const Point_2& p, - Halfedge_set& crossed_edges) const -{ +_walk_from_face(Face_const_handle face, const Point_2& np, const Point_2& p, + Halfedge_set& crossed_edges) const { // Construct an x-monotone curve connecting the nearest landmark point np // to the query point p and check which CCB intersects this segment. - X_monotone_curve_2 seg = - m_traits->construct_x_monotone_curve_2_object()(np, p); - const bool p_is_left = - (m_traits->compare_xy_2_object()(np, p) == LARGER); + X_monotone_curve_2 seg; + Comparison_result res; + std::tie(seg, res) = construct_segment(np, p, *m_traits, 0); + const bool p_is_left = (res == LARGER); - Inner_ccb_const_iterator inner_ccb_iter; - Outer_ccb_const_iterator outer_ccb_iter; - const Halfedge_const_handle invalid_he; - Halfedge_const_handle he; - Face_const_handle new_face; - bool is_on_edge; - bool is_target; - bool cv_is_contained_in_seg; - Vertex_const_handle new_vertex; - const Vertex_const_handle invalid_vertex; + const Halfedge_const_handle invalid_he; + const Vertex_const_handle invalid_vertex; + bool cv_is_contained_in_seg; do { // Check whether p lies inside the current face (including its holes): - if (p_arr->topology_traits()->is_in_face(&(*face), p, nullptr)) - { + if (p_arr->topology_traits()->is_in_face(&(*face), p, nullptr)) { // We know that p is located inside the current face, and we check // whether it lies inside one of its holes (or on the boundary of // its holes). cv_is_contained_in_seg = false; - new_face = face; - for (inner_ccb_iter = face->inner_ccbs_begin(); - inner_ccb_iter != face->inner_ccbs_end(); ++inner_ccb_iter) - { - he = _intersection_with_ccb(*inner_ccb_iter,seg, p, p_is_left, - crossed_edges,is_on_edge, is_target, - cv_is_contained_in_seg,new_vertex); - if (he == invalid_he && cv_is_contained_in_seg) - { + auto new_face = face; + // Do not use 'auto' to define the iterator, as MSVC2017 complains. + for (Inner_ccb_const_iterator inner_ccb_iter = face->inner_ccbs_begin(); + inner_ccb_iter != face->inner_ccbs_end(); ++inner_ccb_iter) { + bool is_on_edge; + bool is_target; + Vertex_const_handle new_vertex; + Halfedge_const_handle he = + _intersection_with_ccb(*inner_ccb_iter,seg, p, p_is_left, + crossed_edges, is_on_edge, is_target, + cv_is_contained_in_seg, new_vertex); + if (he == invalid_he && cv_is_contained_in_seg) { return _deal_with_curve_contained_in_segment(*inner_ccb_iter, p_is_left,p, crossed_edges); @@ -535,8 +487,7 @@ _walk_from_face(Face_const_handle face, // Check if we found a new face (hole) containing p. If not, the current // face contains p. - if (new_face == face) - return make_result(face); + if (new_face == face) return make_result(face); // Continue from the new face (hole). face = new_face; @@ -544,13 +495,17 @@ _walk_from_face(Face_const_handle face, else { // We know that p is not located inside the current face. We therefore // look for an edge on its outer boundary that intersects seg. - new_face = face; - for (outer_ccb_iter = face->outer_ccbs_begin(); - outer_ccb_iter != face->outer_ccbs_end(); ++outer_ccb_iter) - { - he = _intersection_with_ccb(*outer_ccb_iter,seg, p, p_is_left, - crossed_edges,is_on_edge, is_target, - cv_is_contained_in_seg,new_vertex); + auto new_face = face; + // Do not use 'auto' to define the iterator, as MSVC2017 complains. + for (Inner_ccb_const_iterator outer_ccb_iter = face->outer_ccbs_begin(); + outer_ccb_iter != face->outer_ccbs_end(); ++outer_ccb_iter) { + bool is_on_edge; + bool is_target; + Vertex_const_handle new_vertex; + Halfedge_const_handle he = + _intersection_with_ccb(*outer_ccb_iter,seg, p, p_is_left, + crossed_edges, is_on_edge, is_target, + cv_is_contained_in_seg, new_vertex); if (he == invalid_he && cv_is_contained_in_seg) { return _deal_with_curve_contained_in_segment(*outer_ccb_iter, p_is_left,p, @@ -585,10 +540,9 @@ _walk_from_face(Face_const_handle face, return default_result(); } -//----------------------------------------------------------------------------- -// Find a halfedge on the given CCB that intersects the given x-monotone -// curve, connecting the current landmark to the query point. -// +/*! finds a halfedge on the given CCB that intersects the given x-monotone + * curve, connecting the current landmark to the query point. + */ template typename Arr_landmarks_point_location::Halfedge_const_handle Arr_landmarks_point_location:: @@ -598,17 +552,15 @@ _intersection_with_ccb(Ccb_halfedge_const_circulator circ, Halfedge_set& crossed_edges, bool& is_on_edge, bool& is_target, bool& cv_is_contained_in_seg, - Vertex_const_handle & new_vertex) const -{ + Vertex_const_handle& new_vertex) const { is_on_edge = false; is_target = false; // Go over the CCB. - typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = - m_traits->is_in_x_range_2_object(); - Ccb_halfedge_const_circulator curr = circ , temp_circ; - const Halfedge_const_handle invalid_he; - Halfedge_const_handle he; + auto is_in_x_range = m_traits->is_in_x_range_2_object(); + Ccb_halfedge_const_circulator curr = circ , temp_circ; + const Halfedge_const_handle invalid_he; + Halfedge_const_handle he; bool cv_and_seg_overlap; do { he = curr; @@ -646,33 +598,28 @@ _intersection_with_ccb(Ccb_halfedge_const_circulator circ, // Check whether the current curve intersects seg an odd number of times. if (_have_odd_intersections(he->curve(), seg, p_is_left, is_on_edge,cv_and_seg_overlap, - cv_is_contained_in_seg) - && !(cv_and_seg_overlap || cv_is_contained_in_seg)) - { + cv_is_contained_in_seg) && + ! (cv_and_seg_overlap || cv_is_contained_in_seg)) { // Check if the query point lies on the current edge, or whether // it lies in its interior. if (is_on_edge) return _in_case_p_is_on_edge(he,crossed_edges,p,is_target); if ((!curr->target()->is_at_open_boundary()) && - is_in_x_range(seg, curr->target()->point())) - { + is_in_x_range(seg, curr->target()->point())) { // if the target point of curr is located on seg // we should walk from it to the query point if (m_traits->compare_y_at_x_2_object() - (curr->target()->point(), seg) == EQUAL) - { + (curr->target()->point(), seg) == EQUAL) { new_vertex = curr->target(); } } else if ((!curr->source()->is_at_open_boundary()) && - is_in_x_range(seg , curr->source()->point() )) - { + is_in_x_range(seg , curr->source()->point())) { // if the source point of curr is located on seg // we should walk from it to the query point if (m_traits->compare_y_at_x_2_object() - (curr->source()->point() , seg) == EQUAL) - { + (curr->source()->point(), seg) == EQUAL) { new_vertex = curr->source(); } } @@ -718,8 +665,7 @@ Arr_landmarks_point_location:: _in_case_p_is_on_edge(Halfedge_const_handle he, Halfedge_set& crossed_edges, const Point_2 & p, - bool & is_target) const -{ + bool & is_target) const { // cv and seg overlap, obviously we crossed it // the assumption is that each edge is crossed at most twice CGAL_assertion_msg(crossed_edges.count(he) < 2, @@ -728,14 +674,12 @@ _in_case_p_is_on_edge(Halfedge_const_handle he, crossed_edges.insert(he->twin()); // Check if p equals one of the edge end-vertices. if (! he->target()->is_at_open_boundary() && - m_traits->compare_xy_2_object()(he->target()->point(), p) == EQUAL) - { + m_traits->equal_2_object()(he->target()->point(), p)) { // p is the target of the current halfedge. is_target = true; } else if (! he->source()->is_at_open_boundary() && - m_traits->compare_xy_2_object()(he->source()->point(), p) == EQUAL) - { + m_traits->equal_2_object()(he->source()->point(), p)) { // Take the twin halfedge, so p equals its target. he = he->twin(); is_target = true; @@ -744,21 +688,17 @@ _in_case_p_is_on_edge(Halfedge_const_handle he, return he; } -//----------------------------------------------------------------------------- -// Check whether the given curve intersects a simple segment, which connects -// the current landmark to the query point, an odd number of times. -// +/*! checks whether the given curve intersects a simple segment, which connects + * the current landmark to the query point, an odd number of times. + */ template bool Arr_landmarks_point_location:: _have_odd_intersections(const X_monotone_curve_2& cv, const X_monotone_curve_2& seg, - bool p_is_left, - bool& p_on_curve, + bool p_is_left, bool& p_on_curve, bool& cv_and_seg_overlap, - bool& cv_is_contained_in_seg) const -{ - typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = - m_traits->is_in_x_range_2_object(); + bool& cv_is_contained_in_seg) const { + auto is_in_x_range = m_traits->is_in_x_range_2_object(); p_on_curve = false; cv_and_seg_overlap = false; cv_is_contained_in_seg = false; @@ -776,9 +716,9 @@ _have_odd_intersections(const X_monotone_curve_2& cv, cv_right = m_traits->construct_max_vertex_2_object()(cv); if (cv_left_is_closed && cv_right_is_closed) { if (is_in_x_range(seg,cv_left) && is_in_x_range(seg,cv_right)) { - if ((m_traits->compare_y_at_x_2_object()(cv_left, seg) == EQUAL) && - (m_traits->compare_y_at_x_2_object()(cv_right, seg) == EQUAL)) - { + auto cmp_y_at_x = m_traits->compare_y_at_x_2_object(); + if ((cmp_y_at_x(cv_left, seg) == EQUAL) && + (cmp_y_at_x(cv_right, seg) == EQUAL)) { // cv is contained in seg non of the answer true or false is correct // we must set a special flag to distinguish this case cv_is_contained_in_seg = true; @@ -791,22 +731,17 @@ _have_odd_intersections(const X_monotone_curve_2& cv, if (cv_left_is_closed) { // Check if the left endpoint of cv has the same x-coordinate as the // right endpoint of seg. - if (m_traits->compare_x_2_object() - (m_traits->construct_min_vertex_2_object()(cv), seg_right) == EQUAL) - { - if (! p_is_left && - m_traits->compare_xy_2_object() - (m_traits->construct_min_vertex_2_object()(cv), seg_right) == EQUAL) - { + auto min_p = m_traits->construct_min_vertex_2_object()(cv); + if (equal_x_2(min_p, seg_right, Left_or_right_sides_category())) { + if (! p_is_left && m_traits->equal_2_object()(min_p, seg_right)) { p_on_curve = true; return true; } else if (m_traits->is_vertical_2_object()(seg)) { + auto cmp_y_at_x = m_traits->compare_y_at_x_2_object(); // Special treatment for vertical segments. - Comparison_result res_l = - m_traits->compare_y_at_x_2_object()(seg_left, cv); - Comparison_result res_r = - m_traits->compare_y_at_x_2_object()(seg_right, cv); + Comparison_result res_l = cmp_y_at_x(seg_left, cv); + Comparison_result res_r = cmp_y_at_x(seg_right, cv); if ((p_is_left && res_l == EQUAL) || (! p_is_left && res_r == EQUAL)) { p_on_curve = true; return true; @@ -819,23 +754,17 @@ _have_odd_intersections(const X_monotone_curve_2& cv, if (cv_right_is_closed) { // Check if the right endpoint of cv has the same x-coordinate as the // left endpoint of seg. - if (m_traits->compare_x_2_object() - (m_traits->construct_max_vertex_2_object()(cv), seg_left) == EQUAL) - { - if (p_is_left && - m_traits->compare_xy_2_object() - (m_traits->construct_max_vertex_2_object()(cv), seg_left) == EQUAL) - { + auto max_p = m_traits->construct_max_vertex_2_object()(cv); + if (equal_x_2(max_p, seg_left, Left_or_right_sides_category())) { + if (p_is_left && m_traits->equal_2_object()(max_p, seg_left)) { p_on_curve = true; return true; } else if (m_traits->is_vertical_2_object()(seg)) { // Special treatment for vertical segments. - Comparison_result res_l = - m_traits->compare_y_at_x_2_object()(seg_left, cv); - Comparison_result res_r = - m_traits->compare_y_at_x_2_object()(seg_right, cv); - + auto cmp_y_at_x = m_traits->compare_y_at_x_2_object(); + Comparison_result res_l = cmp_y_at_x(seg_left, cv); + Comparison_result res_r = cmp_y_at_x(seg_right, cv); if ((p_is_left && res_l == EQUAL) || (! p_is_left && res_r == EQUAL)) { p_on_curve = true; return true; @@ -846,8 +775,8 @@ _have_odd_intersections(const X_monotone_curve_2& cv, } } // Compare the two left ends of cv and seg. - Comparison_result left_res; - const Arr_parameter_space bx_l = + Comparison_result left_res; + const Arr_parameter_space bx_l = m_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); if (bx_l == ARR_LEFT_BOUNDARY) { // The left end of cv lies to the left of seg_left: @@ -858,11 +787,11 @@ _have_odd_intersections(const X_monotone_curve_2& cv, // The left end of cv lies to the right of seg_left. // Compare the left endpoint of cv to seg. left_res = m_traits->compare_y_at_x_2_object() - (m_traits->construct_min_vertex_2_object()(cv), seg); + (m_traits->construct_min_vertex_2_object()(cv), seg); left_res = CGAL::opposite(left_res); } else { - const Arr_parameter_space by_l = + const Arr_parameter_space by_l = m_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); if (by_l == ARR_BOTTOM_BOUNDARY) // The left end of cv is at y = -oo, so cv obviously lies above it. @@ -876,8 +805,7 @@ _have_odd_intersections(const X_monotone_curve_2& cv, Comparison_result res = m_traits->compare_xy_2_object()(cv_left, seg_left); if (res != LARGER) { left_res = m_traits->compare_y_at_x_2_object()(seg_left, cv); - if (p_is_left && left_res == EQUAL) - { + if (p_is_left && left_res == EQUAL) { // In this case the query point p, which is the left endpoint of seg, // lies on cv. p_on_curve = true; @@ -904,8 +832,7 @@ _have_odd_intersections(const X_monotone_curve_2& cv, // we must set a special flag to distinguish this case if (is_in_x_range(cv,( p_is_left ? seg_left : seg_right))) if (m_traits->compare_y_at_x_2_object() - ((p_is_left ? seg_left : seg_right), cv) == EQUAL) - { + ((p_is_left ? seg_left : seg_right), cv) == EQUAL) { p_on_curve = true; } cv_and_seg_overlap = true; @@ -913,8 +840,8 @@ _have_odd_intersections(const X_monotone_curve_2& cv, } } // Compare the two right ends of cv and seg. - Comparison_result right_res; - const Arr_parameter_space bx_r = + Comparison_result right_res; + const Arr_parameter_space bx_r = m_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END); if (bx_r == ARR_RIGHT_BOUNDARY) { // The right end of cv lies to the right of seg_right: @@ -925,11 +852,11 @@ _have_odd_intersections(const X_monotone_curve_2& cv, // The right end of cv lies to the left of seg_right. // Compare the right endpoint of cv to seg. right_res = m_traits->compare_y_at_x_2_object() - (m_traits->construct_max_vertex_2_object()(cv), seg); + (m_traits->construct_max_vertex_2_object()(cv), seg); right_res = CGAL::opposite(right_res); } else { - const Arr_parameter_space by_r = + const Arr_parameter_space by_r = m_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END); if (by_r == ARR_BOTTOM_BOUNDARY) // The right end of cv is at y = -oo, so cv obviously lies above it. @@ -972,8 +899,7 @@ _have_odd_intersections(const X_monotone_curve_2& cv, // we must set a special flag to distinguish this case if (is_in_x_range(cv, (p_is_left ? seg_left : seg_right))) if (m_traits->compare_y_at_x_2_object() - ((p_is_left ? seg_left : seg_right), cv) == EQUAL) - { + ((p_is_left ? seg_left : seg_right), cv) == EQUAL) { p_on_curve = true; } cv_and_seg_overlap = true; @@ -986,6 +912,6 @@ _have_odd_intersections(const X_monotone_curve_2& cv, return (left_res != right_res); } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h index 8fd305f6101..94173b2e083 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h @@ -1043,7 +1043,7 @@ public: //@} /// \name Types and functors defined here, required by the - // ArrangementDirectionalXMonotoneTraits_2 concept. + // AosDirectionalXMonotoneTraits_2 concept. //@{ Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h index c3f09ef16e9..9fcf72dc557 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h @@ -76,9 +76,9 @@ public: NUMBER_OF_OPERATIONS }; -private: using Base = BaseTraits; +private: //! A set of bits that indicate whether operations should be traced. unsigned long long m_flags; @@ -212,6 +212,7 @@ public: using X_monotone_curve_2 = typename Base::X_monotone_curve_2; using Curve_2 = typename Base::Curve_2; using Multiplicity = typename Base::Multiplicity; + //@} /*! A functor that compares the \f$x\f$-coordinates of two points. */ class Compare_x_2 { @@ -832,9 +833,16 @@ public: std::cout << "approximate_2" << std::endl << " xcv: " << xcv << ", error: " << error << ", l2r: " << l2r << std::endl; - auto res = m_object(xcv, error, oi, l2r); - std::cout << " result: " << res << std::endl; - return res; + std::list container; + m_object(xcv, error, std::back_inserter(container), l2r); + if (container.empty()) return oi; + + std::size_t i = 0; + for (const auto& point : container) { + std::cout << " result[" << i++ << "]: " << point << std::endl; + *oi++ = point; + } + return oi; } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index 5ac5c4d6bd9..deef58f9d78 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -2165,7 +2165,7 @@ public: CGAL_precondition(is_in_x_range(xcv1, xcv2)); /* The traits class which the basic traits adaptor accepts as a template - * parameter is a model of the ArrangementBasicTraits_2 concept so it + * parameter is a model of the AosBasicTraits_2 concept so it * needs not to support intersections at all, therefore it is complicated * to check if the x-curves are disjoint in their interiors. Moreover, * compare_y_position functor is called only from the arrangement class diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index 5bc8054c525..1436405e4d8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -1568,7 +1568,7 @@ template bool do_intersect(Arrangement_on_surface_2& arr, - const typename GeometryTraits_2::X_monotone_curve_2& c, + const typename GeometryTraits_2::Curve_2& c, const PointLocation& pl, std::is_same::type) { typedef GeometryTraits_2 Gt2; @@ -1607,7 +1607,7 @@ do_intersect(Arrangement_on_surface_2& arr, // Check whether the isolated point lies inside a face (otherwise, // it coincides with a vertex or an edge). auto obj = pl.locate(*iso_p); - if (std::get_if(&x_obj) != nullptr) return true; + if (std::get_if(&obj) != nullptr) return true; } // If we reached here, the curve does not intersect the arrangement. diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h index cbc2a9ad81a..26117033c04 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h @@ -64,7 +64,7 @@ public: BaseCKvA::Curved_kernel_via_analysis_2> Functor_base; }; - //!\name Embedded types to fulfill \c ArrangementTraits_2 concept + //!\name Embedded types to fulfill \c AosTraits_2 concept //! type of curve that can be analyzed typedef typename Curve_kernel_2::Curve_analysis_2 Curve_2; @@ -245,14 +245,14 @@ public: }; public: - //!\name Embedded types to fulfill \c ArrangementTraits_2 concept + //!\name Embedded types to fulfill \c AosTraits_2 concept //!@{ typedef internal::Point_2< Self > Point_2; typedef internal::Arc_2< Self > Arc_2; - //! type of weakly x-monotone arc for \c ArrangementTraits_2 + //! type of weakly x-monotone arc for \c AosTraits_2 typedef Arc_2 X_monotone_curve_2; //!@} diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h index 34eb19ae4b2..6353425cd4c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h @@ -716,7 +716,7 @@ public: //! type of an arc on generic curve typedef internal::Arc_2< Self > Arc_2; - //! type of weakly x-monotone arc for \c ArrangementTraits_2 + //! type of weakly x-monotone arc for \c AosTraits_2 typedef Arc_2 X_monotone_curve_2; //!@} diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h index e1accd10731..b6090350941 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h @@ -251,7 +251,7 @@ public: // vertex to the extended point. if (! vh->is_at_open_boundary() && m_base_equal(base_p, vh->point())) return (Point_2(base_p, vh)); - else return (Point_2(base_p)); + return (Point_2(base_p)); } }; @@ -308,7 +308,7 @@ public: // vertex to the extended point. if (! vh->is_at_open_boundary() && m_base_equal(base_p, vh->point())) return (Point_2(base_p, vh)); - else return (Point_2(base_p)); + return (Point_2(base_p)); } }; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt index adb6df001b3..60add4ac51b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Arrangement_on_surface_2_Tests) enable_testing() diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake deleted file mode 100755 index d8c26c68390..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake +++ /dev/null @@ -1,1749 +0,0 @@ -#! /bin/bash - -# This is a script for the CGAL test suite. Such a script must obey -# the following rules: -# -# - the name of the script is cgal_test -# - for every target two one line messages are written to the file 'error.txt' -# the first one indicates if the compilation was successful -# the second one indicates if the execution was successful -# if one of the two was not successful, the line should start with 'ERROR:' -# - running the script should not require any user interaction -# - the script should clean up object files and executables - -# SET PARAMETERS FOR cgal_test - -set -- -cmake -ERRORFILE=error.txt -DO_RUN=y -if [ -z "${MAKE_CMD}" ]; then - MAKE_CMD=make -fi - - -FULL_ERROR_DESCRIPTION_FILE=ProgramOutput.error.txt - -#---------------------------------------------------------------------# -# compile_and_run -#---------------------------------------------------------------------# - -# note that these values shloud match to the values in test_configuration.h file - -CARTESIAN_KERNEL=0 -SIMPLE_CARTESIAN_KERNEL=1 -UNIVARIATE_ALGEBRAIC_KERNEL=2 - -SEGMENT_GEOM_TRAITS=0 -NON_CACHING_SEGMENT_GEOM_TRAITS=1 -POLYLINE_GEOM_TRAITS=2 -NON_CACHING_POLYLINE_GEOM_TRAITS=3 -POLYCURVE_CONIC_GEOM_TRAITS=14 -POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS=15 -POLYCURVE_BEZIER_GEOM_TRAITS=16 -LINEAR_GEOM_TRAITS=4 -CORE_CONIC_GEOM_TRAITS=5 -LINE_ARC_GEOM_TRAITS=6 -CIRCULAR_ARC_GEOM_TRAITS=7 -CIRCULAR_LINE_ARC_GEOM_TRAITS=8 -CIRCLE_SEGMENT_GEOM_TRAITS=9 -BEZIER_GEOM_TRAITS=10 -GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS=11 -RATIONAL_ARC_GEOM_TRAITS=12 -ALGEBRAIC_GEOM_TRAITS=13 -POLYCURVE_CONIC_GEOM_TRAITS=14 -POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS=15 -POLYCURVE_BEZIER_GEOM_TRAITS=16 -FLAT_TORUS_GEOM_TRAITS=17 - -PLANAR_BOUNDED_TOPOL_TRAITS=0 -PLANAR_UNBOUNDED_TOPOL_TRAITS=1 -SPHERICAL_TOPOL_TRAITS=2 - -DOUBLE_NT=0 -MP_FLOAT_NT=1 -GMPZ_NT=2 -LEDA_RAT_NT=3 -QUOTIENT_MP_FLOAT_NT=4 -QUOTIENT_CGAL_GMPZ_NT=5 -CGAL_GMPQ_NT=6 -LAZY_LEDA_RAT_NT=7 -LAZY_CGAL_GMPQ_NT=8 -LAZY_QUOTIENT_MP_FLOAT_NT=9 -LEDA_REAL_NT=10 -CORE_EXPR_NT=11 -LAZY_GMPZ_NT=12 -LEDA_INT_NT=13 -CGAL_GMPZ_NT=14 -CORE_INT_NT=15 -CORE_RAT_NT=16 - -if [ -n "${CGAL_DISABLE_GMP}" ]; then - if [ -n "CGAL_USE_LEDA" ]; then - echo GMP is disabled, try to use LEDA instead. - GMPZ_NT=$LEDA_INT_NT - QUOTIENT_CGAL_GMPZ_NT=$LEDA_RAT_NT - CGAL_GMPQ_NT=$LEDA_RAT_NT - LAZY_CGAL_GMPQ_NT=$LAZY_LEDA_RAT_NT - LAZY_GMPZ_NT=$LAZY_LEDA_RAT_NT - CGAL_GMPZ_NT=$LEDA_INT_NT - else - echo GMP is disabled, try to use MP float instead. - GMPZ_NT=$MP_FLOAT_NT - QUOTIENT_CGAL_GMPZ_NT=$QUOTIENT_MP_FLOAT_NT - CGAL_GMPQ_NT=$QUOTIENT_MP_FLOAT_NT - LAZY_CGAL_GMPQ_NT=$LAZY_QUOTIENT_MP_FLOAT_NT - LAZY_GMPZ_NT=$LAZY_QUOTIENT_MP_FLOAT_NT - CGAL_GMPZ_NT=$MP_FLOAT_NT - fi -fi - -COMPARE=1 -VERTEX=2 -IS_VERTICAL=3 -COMPARE_Y_AT_X=4 -COMPARE_Y_AT_X_LEFT=5 -COMPARE_Y_AT_X_RIGHT=6 -MAKE_X_MONOTONE=7 -INTERSECT=8 -SPLIT=9 -ARE_MERGEABLE=10 -MERGE=11 -ASSERTIONS=12 -CONSTRUCTOR=13 -COMPARE_X_ON_BOUNDARY=16 -COMPARE_X_NEAR_BOUNDARY=17 -COMPARE_Y_NEAR_BOUNDARY=18 -PARAMETER_SPACE_X=19 -PARAMETER_SPACE_Y=20 -X_ON_IDENTIFICATION=21 -Y_ON_IDENTIFICATION=22 -IS_BOUNDED=23 -IS_IN_X_RANGE=24 -COMPARE_Y_POSITION=25 -IS_BETWEEN_CW=26 -COMPARE_CW_AROUND_POINT=27 -PUSH_BACK=28 -PUSH_FRONT=29 -NUMBER_OF_POINTS=32 -COMPARE_ENDPOINTS_XY=33 -CONSTRUCT_OPPOSITE=34 -TRIM=35 - -#---------------------------------------------------------------------# -# configure -#---------------------------------------------------------------------# - -configure() -{ - echo "Configuring... " - rm -rf CMakeCache.txt CMakeFiles/ - if [ -f "$INIT_FILE" ] - then - if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_DIR" \ - -DCGAL_CXX_FLAGS:STRING="$CGAL_CXX_FLAGS $TESTSUITE_CXXFLAGS -I../../include" \ - -DCGAL_EXE_LINKER_FLAGS="$CGAL_EXE_LINKER_FLAGS $TESTSUITE_LDFLAGS" \ - .' ; then - - echo " successful configuration" >> $ERRORFILE - else - echo " ERROR: configuration" >> $ERRORFILE - fi - else - echo "cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR=\"$CGAL_DIR\" \ - -DCGAL_CXX_FLAGS:STRING=\"$TESTSUITE_CXXFLAGS -I../../include\" \ - -DCGAL_EXE_LINKER_FLAGS=\"$TESTSUITE_LDFLAGS\" \ - -DCMAKE_BUILD_TYPE=NOTFOUND \ - ." - if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_DIR" \ - -DCGAL_CXX_FLAGS:STRING="$TESTSUITE_CXXFLAGS -I../../include" \ - -DCGAL_EXE_LINKER_FLAGS="$TESTSUITE_LDFLAGS" \ - -DCMAKE_BUILD_TYPE=NOTFOUND \ - .' ; then - - echo " successful configuration" >> $ERRORFILE - else - echo " ERROR: configuration" >> $ERRORFILE - fi - fi -} - -compile_test_with_flags() -{ - local name=$1; - local type=$2; - local flags=$3; - - echo "Compiling $name $type ... " - if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then - export TESTSUITE_CXXFLAGS="$flags" - configure - if eval '${MAKE_CMD} VERBOSE=1 -fMakefile \ - $name' ; then - echo " successful compilation of $name $type" >> $ERRORFILE; - SUCCESS="y" - else - echo " ERROR: compilation of $name $type" >> $ERRORFILE; - SUCCESS="" - fi - else - if eval 'make CGAL_MAKEFILE=$CGAL_MAKEFILE \ - TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \ - TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" $name'; then - echo " successful compilation of $name $type" >> $ERRORFILE; - SUCCESS="y" - else - echo " ERROR: compilation of $name $type" >> $ERRORFILE; - SUCCESS="" - fi - fi -} - -run_test() -{ - # $1 - executable name - - basedata=`basename "$5"` - OUTPUTFILE="ProgramOutput.$1" - rm -f $OUTPUTFILE - COMMAND="./$1" - if [ -f $1.cmd ] ; then - COMMAND="$COMMAND `cat $1.cmd`" - fi - if [ -f $1.cin ] ; then - COMMAND="cat $1.cin | $COMMAND" - fi - OUTPUTFILE="$OUTPUTFILE.$PLATFORM" - echo "Executing $1 ($2) ... " - ulimit -t 3600 2> /dev/null - if eval $COMMAND > $OUTPUTFILE 2>&1 ; then - echo " successful execution of $1" >> $ERRORFILE - else - echo " ERROR: execution of $1" >> $ERRORFILE - cat $OUTPUTFILE >> $FULL_ERROR_DESCRIPTION_FILE - fi -} - -run_test_with_flags() -{ - # $1 - executable name - # $2 - test substring name - - basedata=`basename "$5"` - OUTPUTFILE="ProgramOutput.$1" - rm -f $OUTPUTFILE - COMMAND="./$1" - if [ -f $1.cmd ] ; then - COMMAND="$COMMAND `cat $1.cmd`" - elif [ -f $1.$2.cmd ] ; then - COMMAND="$COMMAND `cat $1.$2.cmd`" - OUTPUTFILE=$OUTPUTFILE.`echo $2 | tr '/' '.'` - fi - if [ -f $1.cin ] ; then - COMMAND="cat $1.cin | $COMMAND" - elif [ -f $1.$2.cin ] ; then - COMMAND="cat $1.$2.cin | $COMMAND" - OUTPUTFILE=$OUTPUTFILE.`echo $2 | tr '/' '.'` - fi - OUTPUTFILE="$OUTPUTFILE.$PLATFORM" - echo "Executing $1 ($2) ... " - ulimit -t 3600 2> /dev/null - if eval $COMMAND > $OUTPUTFILE 2>&1 ; then - echo " successful execution of $1 ($2)" >> $ERRORFILE - else - echo " ERROR: execution of $1 ($2)" >> $ERRORFILE - cat $OUTPUTFILE >> $FULL_ERROR_DESCRIPTION_FILE - fi -} - -run_test_alt() -{ - basedata=`basename "$5"` - OUTPUTFILE=ProgramOutput.$1.`echo $5 | tr '/' '.'`.$6 - #echo ****generating file $OUTPUTFILE - # dirdata=`dirname "$datafile"` - rm -f $OUTPUTFILE - COMMAND="./$1" - echo "Executing $1 $5 $6 ... " - if eval $COMMAND $2 $3 $4 $5 $6 > $OUTPUTFILE 2>&1 ; then - echo " successful execution of $5 $6" >> $ERRORFILE - else - echo " ERROR: execution of $5 $6" >> $ERRORFILE - cat $OUTPUTFILE >> $FULL_ERROR_DESCRIPTION_FILE - fi -} - -run_trapped_test() -{ - #local name=$1; - #local datafile=$2; - - if [ "${OSTYPE}" != "cygwin" ]; then - ulimit -t 1200 - run_test_alt $1 $2 $3 $4 $5 $6 - else - run_test_alt $1 $2 $3 $4 $5 $6 & - WPID=$! - trap "kill -9 $WPID" INT - (sleep 1200; kill -9 $WPID) > /dev/null 2>&1 & - SPID=$! - wait $WPID > /dev/null 2>&1 - # RES=$? - kill -9 $SPID > /dev/null 2>&1 - # return $RES - fi -} - -clean_tests() -{ - if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then - # - # The clean target generated by CMake under cygwin - # always fails for some reason - # - if ! ( uname | grep -q "CYGWIN" ) ; then - make -fMakefile clean - fi - fi - eval "make clean > /dev/null 2>&1" -} - -compile_and_run() -{ - local name=$1; - - echo "Compiling $name ... " - if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then - if eval '${MAKE_CMD} VERBOSE=1 -fMakefile $1' ; then - echo " successful compilation of $1" >> $ERRORFILE - SUCCESS="y" - else - echo " ERROR: compilation of $1" >> $ERRORFILE - SUCCESS="" - fi - else - SUCCESS="y" - #TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" - TESTSUITE_CXXFLAGS="" - TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" - if eval 'make CGAL_MAKEFILE=$CGAL_MAKEFILE \ - TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \ - TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" $name' ; then - echo " successful compilation of $name" >> $ERRORFILE - else - echo " ERROR: compilation of $name" >> $ERRORFILE - SUCCESS="" - fi - fi - - if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then - if [ -n "$DO_RUN" ] ; then - if [ -n "${SUCCESS}" ] ; then - run_test $1 - else - echo " ERROR: not executed $1" >> $ERRORFILE - fi - fi - else - if [ -n "${SUCCESS}" ] ; then - OUTPUTFILE=ProgramOutput.$name.$PLATFORM - rm -f $OUTPUTFILE - COMMAND="./$name" - if [ -f $name.cmd ] ; then - COMMAND="$COMMAND `cat $name.cmd`" - fi - if [ -f $name.cin ] ; then - COMMAND="cat $name.cin | $COMMAND" - fi - echo "Executing $name ... " - echo " " - if eval $COMMAND > $OUTPUTFILE 2>&1 ; then - echo " successful execution of $name" >> $ERRORFILE - else - echo " ERROR: execution of $name" >> $ERRORFILE - cat $OUTPUTFILE >> $FULL_ERROR_DESCRIPTION_FILE - fi - else - echo " ERROR: not executed $name" >> $ERRORFILE - fi - fi - clean_tests -} - -compile_and_run_trapped_test() -{ - local name=$1; - - if [ "${OSTYPE}" != "cygwin" ]; then - ulimit -t 1200 - compile_and_run $1 - else - compile_and_run $1 & - WPID=$! - trap "kill -9 $WPID" INT - (sleep 1200; kill -9 $WPID) > /dev/null 2>&1 & - SPID=$! - wait $WPID > /dev/null 2>&1 - # RES=$? - kill -9 $SPID > /dev/null 2>&1 - # return $RES - fi -} - -execute_commands_old_structure() -{ - -# at first the tests where designed in such way that all the test input was -# in one file, the points, the xcurves, the curves and the execution block -# this function is used to execute the old tests, one may use it when needed -# but you should remember that separating the input into smaller files creates -# much more modular and comfortable test suite - -# the old structure is default, so this function executes all commands -# except the commands that are given as arguments - - - commands_indicator[COMPARE]=1 - commands_indicator[VERTEX]=1 - commands_indicator[IS_VERTICAL]=1 - commands_indicator[COMPARE_Y_AT_X]=1 - commands_indicator[COMPARE_Y_AT_X_LEFT]=1 - commands_indicator[COMPARE_Y_AT_X_RIGHT]=1 - commands_indicator[MAKE_X_MONOTONE]=1 - commands_indicator[INTERSECT]=1 - commands_indicator[SPLIT]=1 - commands_indicator[ARE_MERGEABLE]=1 - commands_indicator[MERGE]=1 - commands_indicator[ASSERTIONS]=1 - commands_indicator[CONSTRUCTOR]=1 - i=1 - if [ $# -gt 2 ] ; then - for arg in $* ; do - if [ $i -gt 2 ] ; then - commands_indicator[$arg]=0 - fi - let "i+=1" - done - fi - if [ ${commands_indicator[$COMPARE]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/compare.pt data/empty.zero \ - data/empty.zero data/compare $2 - fi - if [ ${commands_indicator[$VERTEX]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/vertex.pt data/$1/vertex.xcv \ - data/empty.zero data/$1/vertex $2 - fi - if [ ${commands_indicator[$IS_VERTICAL]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/is_vertical.xcv data/empty.zero \ - data/$1/is_vertical $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/compare_y_at_x.pt data/$1/compare_y_at_x.xcv \ - data/empty.zero data/$1/compare_y_at_x $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X_LEFT]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/compare_y_at_x_left.pt data/$1/compare_y_at_x_left.xcv \ - data/empty.zero data/$1/compare_y_at_x_left $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X_RIGHT]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/compare_y_at_x_right.pt data/$1/compare_y_at_x_right.xcv \ - data/empty.zero data/$1/compare_y_at_x_right $2 - fi - if [ ${commands_indicator[$MAKE_X_MONOTONE]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/make_x_monotone.xcv \ - data/$1/make_x_monotone.cv data/$1/make_x_monotone $2 - fi - if [ ${commands_indicator[$INTERSECT]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/intersect.pt data/$1/intersect.xcv \ - data/empty.zero data/$1/intersect $2 - fi - if [ ${commands_indicator[$SPLIT]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/split.pt data/$1/split.xcv \ - data/empty.zero data/$1/split $2 - fi - if [ ${commands_indicator[$ARE_MERGEABLE]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/are_mergeable.xcv \ - data/empty.zero data/$1/are_mergeable $2 - fi - if [ ${commands_indicator[$MERGE]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/merge.xcv \ - data/empty.zero data/$1/merge $2 - fi - if [ ${commands_indicator[$ASSERTIONS]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/$1/assertions.pt data/$1/assertions.xcv \ - data/empty.zero data/$1/assertions $2 - fi - if [ ${commands_indicator[$CONSTRUCTOR]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/constructor.xcv \ - data/$1/constructor.cv data/$1/constructor $2 - fi -} - -execute_commands_new_structure() -{ - -# the new design for the tests includes separation of the test input into 4 -# parts: points file, xcurves file, curves file and execution block file. -# one may reuse the input files for the various tests - -# the new structure is not default, so this function executes only -# commands that are given as arguments - - commands_indicator[COMPARE]=0 - commands_indicator[VERTEX]=0 - commands_indicator[IS_VERTICAL]=0 - commands_indicator[COMPARE_Y_AT_X]=0 - commands_indicator[COMPARE_Y_AT_X_LEFT]=0 - commands_indicator[COMPARE_Y_AT_X_RIGHT]=0 - commands_indicator[MAKE_X_MONOTONE]=0 - commands_indicator[INTERSECT]=0 - commands_indicator[SPLIT]=0 - commands_indicator[ARE_MERGEABLE]=0 - commands_indicator[MERGE]=0 - commands_indicator[ASSERTIONS]=0 - commands_indicator[CONSTRUCTOR]=0 - commands_indicator[COMPARE_X_ON_BOUNDARY]=0 - commands_indicator[COMPARE_X_NEAR_BOUNDARY]=0 - commands_indicator[COMPARE_Y_NEAR_BOUNDARY]=0 - commands_indicator[PARAMETER_SPACE_X]=0 - commands_indicator[PARAMETER_SPACE_Y]=0 - commands_indicator[EQUAL]=0 - commands_indicator[PUSH_BACK]=0 - commands_indicator[PUSH_FRONT]=0 - commands_indicator[NUMBER_OF_POINTS]=0 - commands_indicator[COMPARE_ENDPOINTS_XY]=0 - commands_indicator[CONSTRUCT_OPPOSITE]=0 - commands_indicator[TRIM]=0 - i=1 - if [ $# -gt 2 ] ; then - for arg in $* ; do - if [ $i -gt 2 ] ; then - commands_indicator[$arg]=1 - fi - let "i+=1" - done - fi - if [ ${commands_indicator[$COMPARE]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare $2 - fi - if [ ${commands_indicator[$VERTEX]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/vertex $2 - fi - if [ ${commands_indicator[$IS_VERTICAL]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/is_vertical $2 - fi - if [ ${commands_indicator[$COMPARE_X_ON_BOUNDARY]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_x_on_boundary $2 - fi - if [ ${commands_indicator[$COMPARE_X_NEAR_BOUNDARY]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_x_near_boundary $2 - fi - if [ ${commands_indicator[$COMPARE_Y_NEAR_BOUNDARY]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_y_near_boundary $2 - fi - if [ ${commands_indicator[$PARAMETER_SPACE_X]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/parameter_space_x $2 - fi - if [ ${commands_indicator[$PARAMETER_SPACE_Y]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/parameter_space_y $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_y_at_x $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X_LEFT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_y_at_x_left $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X_RIGHT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_y_at_x_right $2 - fi - if [ ${commands_indicator[$MAKE_X_MONOTONE]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/make_x_monotone $2 - fi - if [ ${commands_indicator[$INTERSECT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/intersect $2 - fi - if [ ${commands_indicator[$SPLIT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/split $2 - fi - if [ ${commands_indicator[$ARE_MERGEABLE]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/are_mergeable $2 - fi - if [ ${commands_indicator[$MERGE]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/merge $2 - fi - if [ ${commands_indicator[$ASSERTIONS]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/assertions $2 - fi - if [ ${commands_indicator[$CONSTRUCTOR]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/constructor $2 - fi - if [ ${commands_indicator[$EQUAL]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/equal $2 - fi - if [ ${commands_indicator[$PUSH_BACK]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/push_back $2 - fi - if [ ${commands_indicator[$PUSH_FRONT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/push_front $2 - fi - if [ ${commands_indicator[$NUMBER_OF_POINTS]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/number_of_points $2 - fi - if [ ${commands_indicator[$COMPARE_ENDPOINTS_XY]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_endpoints_xy $2 - fi - if [ ${commands_indicator[$CONSTRUCT_OPPOSITE]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/construct_opposite $2 - fi - if [ ${commands_indicator[$TRIM]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/trim $2 - fi -} - -execute_commands_traits_adaptor() -{ - -# the new structure is not default, so this function executes only -# commands that are given as arguments - - commands_indicator[PARAMETER_SPACE_X]=0 - commands_indicator[PARAMETER_SPACE_Y]=0 - commands_indicator[COMPARE_X_ON_BOUNDARY]=0 - commands_indicator[COMPARE_X_NEAR_BOUNDARY]=0 - commands_indicator[COMPARE_Y_NEAR_BOUNDARY]=0 - commands_indicator[COMPARE_Y_AT_X_LEFT]=0 - commands_indicator[ARE_MERGEABLE]=0 - commands_indicator[MERGE]=0 - commands_indicator[X_ON_IDENTIFICATION]=0 - commands_indicator[Y_ON_IDENTIFICATION]=0 - commands_indicator[IS_BOUNDED]=0 - commands_indicator[IS_IN_X_RANGE]=0 - commands_indicator[COMPARE_Y_POSITION]=0 - commands_indicator[IS_BETWEEN_CW]=0 - commands_indicator[COMPARE_CW_AROUND_POINT]=0 - - i=1 - if [ $# -gt 2 ] ; then - for arg in $* ; do - if [ $i -gt 2 ] ; then - commands_indicator[$arg]=1 - fi - let "i+=1" - done - fi - - if [ ${commands_indicator[$PARAMETER_SPACE_X]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/parameter_space_x $2 - fi - if [ ${commands_indicator[$PARAMETER_SPACE_Y]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/parameter_space_y $2 - fi - if [ ${commands_indicator[$COMPARE_X_ON_BOUNDARY]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_x_on_boundary $2 - fi - if [ ${commands_indicator[$COMPARE_X_NEAR_BOUNDARY]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_x_near_boundary $2 - fi - - if [ ${commands_indicator[$COMPARE_Y_NEAR_BOUNDARY]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_y_near_boundary $2 - fi - if [ ${commands_indicator[$COMPARE_Y_AT_X_LEFT]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_y_at_x_left $2 - fi - if [ ${commands_indicator[$ARE_MERGEABLE]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/are_mergeable $2 - fi - if [ ${commands_indicator[$MERGE]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/merge $2 - fi - if [ ${commands_indicator[X_ON_IDENTIFICATION]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/x_on_idintification $2 - fi - if [ ${commands_indicator[Y_ON_IDENTIFICATION]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/x_on_idintification $2 - fi - if [ ${commands_indicator[IS_BOUNDED]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/is_bounded $2 - fi - if [ ${commands_indicator[IS_IN_X_RANGE]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/is_in_x_range $2 - fi - if [ ${commands_indicator[COMPARE_Y_POSITION]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_y_position $2 - fi - if [ ${commands_indicator[IS_BETWEEN_CW]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/is_between_cw $2 - fi - if [ ${commands_indicator[COMPARE_CW_AROUND_POINT]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_cw_around_point $2 - fi -} - -#---------------------------------------------------------------------# -# traits adaptor (segments traits) -#---------------------------------------------------------------------# -test_segment_traits_adaptor() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits_adaptor segments "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_traits_adaptor segments segments_traits_adaptor \ - COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT \ - ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW - else - echo " ERROR: not executed test_traits_adaptor segment_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# traits adaptor (linear traits) -#---------------------------------------------------------------------# -test_linear_traits_adaptor() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits_adaptor linear "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_traits_adaptor linear linear_traits_adaptor \ - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ - COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT - else - echo " ERROR: not executed test_traits_adaptor linear_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# traits adaptor (spherical arcs traits) -#---------------------------------------------------------------------# -test_spherical_arcs_traits_adaptor() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS; - local topol_traits=$SPHERICAL_TOPOL_TRAITS - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - - compile_test_with_flags test_traits_adaptor geodesic_arcs_on_sphere "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_traits_adaptor spherical_arcs spherical_arcs_traits_adaptor \ - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ - COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT - else - echo " ERROR: not executed test_traits_adaptor spherical_arcs_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# compile and run test with traits -#---------------------------------------------------------------------# -compile_and_run_with_flags() -{ - local name=$1; - local type=$2; - local flags=$3; - - compile_test_with_flags $name $type "$flags" - if [ -n "${SUCCESS}" ] ; then - if [ -n "$DO_RUN" ] ; then - run_test_with_flags $name $type - fi - else - echo " ERROR: not executed construction of segments" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# construction with segments -#---------------------------------------------------------------------# -test_construction_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_construction segments "$flags" -} - -#---------------------------------------------------------------------# -# construction with linear curves -#---------------------------------------------------------------------# -test_construction_linear_curves() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local topol_traits=$PLANAR_UNBOUNDED_TOPOL_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - compile_and_run_with_flags test_construction linear "$flags" -} - -#---------------------------------------------------------------------# -# construction with geodesic arcs on the sphere -#---------------------------------------------------------------------# -test_construction_spherical_arcs() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS; - local topol_traits=$SPHERICAL_TOPOL_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - compile_and_run_with_flags test_construction geodesic_arcs_on_sphere "$flags" -} - -#---------------------------------------------------------------------# -# construction with polylines -#---------------------------------------------------------------------# -test_construction_polylines() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$POLYLINE_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_construction polylines "$flags" -} - -#---------------------------------------------------------------------# -# overlay with segments -#---------------------------------------------------------------------# -test_overlay_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_overlay segments "$flags" -} - -#---------------------------------------------------------------------# -# overlay with geodesic arcs on the sphere -#---------------------------------------------------------------------# -test_overlay_spherical_arcs() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS; - local topol_traits=$SPHERICAL_TOPOL_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - compile_and_run_with_flags test_overlay geodesic_arcs_on_sphere "$flags" -} - -#---------------------------------------------------------------------# -# point location with segments -#---------------------------------------------------------------------# -test_point_location_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_point_location segments "$flags" -} - -# For backward compatibility -test_point_location_segments_conversion() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DCGAL_ARR_POINT_LOCATION_CONVERSION"; - compile_and_run_with_flags test_point_location segments "$flags" -} - -#---------------------------------------------------------------------# -# point location dynamic with segments -#---------------------------------------------------------------------# -test_point_location_dynamic_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_point_location_dynamic segments "$flags" -} - -#---------------------------------------------------------------------# -# point location with circle segments -#---------------------------------------------------------------------# -test_point_location_circle_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$CIRCLE_SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_point_location circle_segments "$flags" -} - -#---------------------------------------------------------------------# -# point location with linear objects -#---------------------------------------------------------------------# -test_point_location_linear() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_point_location linear "$flags" -} - -#---------------------------------------------------------------------# -# batchecd point location with segments -#---------------------------------------------------------------------# -test_batched_point_location_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_batched_point_location segments "$flags" -} - -#---------------------------------------------------------------------# -# batchecd point location with linear objects -#---------------------------------------------------------------------# -test_batched_point_location_linear() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_batched_point_location linear "$flags" -} - -#---------------------------------------------------------------------# -# batchecd point location with geodesic arcs on the sphere -#---------------------------------------------------------------------# -test_batched_point_location_spherical_arcs() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS; - local topol_traits=$SPHERICAL_TOPOL_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - compile_and_run_with_flags test_batched_point_location geodesic_arcs_on_sphere "$flags" -} - -#---------------------------------------------------------------------# -# vertical decomposition with segments -#---------------------------------------------------------------------# -test_vertical_decomposition_segments() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_vertical_decomposition segments "$flags" -} - -#---------------------------------------------------------------------# -# vertical decomposition with linear objects -#---------------------------------------------------------------------# -test_vertical_decomposition_linear() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - compile_and_run_with_flags test_vertical_decomposition linear "$flags" -} - -#---------------------------------------------------------------------# -# vertical decomposition with geodesic arcs on the sphere -#---------------------------------------------------------------------# -test_vertical_decomposition_spherical_arcs() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local topol_traits=$SPHERICAL_TOPOL_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - compile_and_run_with_flags test_vertical_decomposition geodesic_arcs_on_sphere "$flags" -} - -#---------------------------------------------------------------------# -# segment traits -#---------------------------------------------------------------------# -test_segment_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits segments "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure segments segment_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR \ - COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE - - execute_commands_new_structure segments segment_traits \ - IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT ARE_MERGEABLE - - run_trapped_test test_traits \ - data/segments/vertex.pt data/segments/xcurves \ - data/empty.zero data/segments/vertex segment_traits - else - echo " ERROR: not executed test_traits segment_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# non-caching segment traits -#---------------------------------------------------------------------# -test_non_caching_segment_traits() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$NON_CACHING_SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits non_caching_segments "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure segments non_caching_segment_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR \ - COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ASSERTIONS - - execute_commands_new_structure segments segment_traits \ - IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT - - run_trapped_test test_traits \ - data/segments/vertex.pt data/segments/xcurves \ - data/empty.zero data/segments/vertex non_caching_segment_traits - else - echo " ERROR: not executed test_traits non_caching_segment_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# polycurve conic traits -#---------------------------------------------------------------------# -test_polycurve_conic_traits() -{ - if [ -n "${CGAL_DISABLE_GMP}" ]; then - echo "CORE is not available, test_polycurve_conic_traits not ran" - return - fi - echo polycurve test starting - local nt=$CORE_EXPR_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$POLYCURVE_CONIC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits conic_polycurve "$flags" - if [ -n "${SUCCESS}" ] ; then - - # The input arguments for the execute_commands_new_structure, - # 1. polycurve_conics is the directory name in "data" - # 2. polycurve_conic_traits is a string - # Execute_command_new_structure will only run the test on functors provided as the third, fourth and so on arguments. - # To see how the input data directory should be structured for each functor, check the execute_commands_new_structure function in this file. - execute_commands_new_structure polycurves_conics polycurve_conic_traits \ - COMPARE_Y_AT_X \ - INTERSECT \ - EQUAL \ - IS_VERTICAL \ - SPLIT \ - ARE_MERGEABLE \ - COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT \ - MAKE_X_MONOTONE \ - PUSH_BACK \ - PUSH_FRONT \ - NUMBER_OF_POINTS \ - VERTEX \ - CONSTRUCT_OPPOSITE \ - MERGE \ - COMPARE_ENDPOINTS_XY \ - TRIM - - else - echo " ERROR: not executed test_traits polyline_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# polycurve arc traits -#---------------------------------------------------------------------# -test_polycurve_circular_arc_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits circular_arc_polycurve "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_new_structure polycurves_circular_arcs polycurve_circular_arc_traits \ - COMPARE_Y_AT_X \ - EQUAL \ - IS_VERTICAL \ - SPLIT \ - ARE_MERGEABLE \ - COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT \ - MAKE_X_MONOTONE \ - PUSH_BACK \ - PUSH_FRONT \ - NUMBER_OF_POINTS \ - VERTEX \ - CONSTRUCT_OPPOSITE \ - MERGE \ - COMPARE_ENDPOINTS_XY \ - INTERSECT - - else - echo " ERROR: not executed test_traits polyline_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# polycurve bezier traits -#---------------------------------------------------------------------# -test_polycurve_bezier_traits() -{ - if [ -n "${CGAL_DISABLE_GMP}" ]; then - echo "CORE is not available, test_polycurve_bezier_traits not ran" - return - fi - local nt=$CORE_EXPR_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$POLYCURVE_BEZIER_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits bezier_polycurve "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_new_structure polycurves_bezier test_polycurve_bezier_traits \ - MERGE \ - EQUAL \ - IS_VERTICAL \ - NUMBER_OF_POINTS \ - PUSH_BACK \ - PUSH_FRONT \ - VERTEX \ - ARE_MERGEABLE \ - COMPARE_ENDPOINTS_XY - # TODO (add data for these tests) - # COMPARE_Y_AT_X \ - # SPLIT \ - # COMPARE_Y_AT_X_LEFT \ - # COMPARE_Y_AT_X_RIGHT \ - # MAKE_X_MONOTONE \ - # CONSTRUCT_OPPOSITE \ - - # INTERSECT - - else - echo " ERROR: not executed test_traits polyline_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# polyline traits -#---------------------------------------------------------------------# -test_polyline_traits() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$POLYLINE_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits test_polylines "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure polylines polyline_traits \ - CONSTRUCTOR COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE - else - echo " ERROR: not executed test_traits polyline_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# non-caching polyline traits -#---------------------------------------------------------------------# -test_non_caching_polyline_traits() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$NON_CACHING_POLYLINE_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits non_caching_polylines "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure polylines non_caching_polyline_traits \ - CONSTRUCTOR COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE - else - echo " ERROR: not executed test_traits non_caching_polyline_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# linear traits -#---------------------------------------------------------------------# -test_linear_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits linear "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure linear/segments linear_traits.segments \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE - - execute_commands_new_structure linear/segments linear_traits.segments \ - IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT - - run_trapped_test test_traits \ - data/linear/segments/vertex.pt data/linear/segments/xcurves \ - data/empty.zero data/linear/segments/vertex linear_traits.segments - - execute_commands_old_structure linear/rays linear_traits.rays \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE - - execute_commands_new_structure linear/rays linear_traits.rays \ - IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT - - run_trapped_test test_traits \ - data/linear/rays/vertex.pt data/linear/rays/xcurves \ - data/empty.zero data/linear/rays/vertex linear_traits.rays - - execute_commands_new_structure linear/lines linear_traits.lines \ - IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT INTERSECT \ - SPLIT MERGE \ - PARAMETER_SPACE_X PARAMETER_SPACE_Y \ - COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY COMPARE_Y_NEAR_BOUNDARY - else - echo " ERROR: not executed test_traits linear_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# conic traits -#---------------------------------------------------------------------# -test_conic_traits() -{ - if [ -n "${CGAL_DISABLE_GMP}" ]; then - echo "CORE is not available, test_conic_traits not ran" - return - fi - local nt=$CORE_EXPR_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$CORE_CONIC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits conics "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure conics conic_traits \ - INTERSECT SPLIT MERGE COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE - - execute_commands_new_structure conics conic_traits \ - INTERSECT SPLIT MERGE - - run_trapped_test test_traits \ - data/conics/compare.pt data/empty.zero \ - data/empty.zero data/conics/compare conic_traits - else - echo " ERROR: not executed test_traits conic_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# "line arcs" (segments) only -#---------------------------------------------------------------------# -test_line_arc_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINE_ARC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits line_arcs "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure circular_lines line_arc_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE - - execute_commands_new_structure circular_lines line_arc_traits \ - IS_VERTICAL COMPARE_Y_AT_X - - run_trapped_test test_traits \ - data/circular_lines/compare.pt data/empty.zero \ - data/empty.zero data/circular_lines/compare line_arc_traits - - run_trapped_test test_traits \ - data/circular_lines/vertex.pt data/circular_lines/xcurves \ - data/empty.zero data/circular_lines/vertex line_arc_traits - else - echo " ERROR: not executed test_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# circular arcs only -#---------------------------------------------------------------------# -test_circular_arc_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$CIRCULAR_ARC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits circular_arcs "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure circular_arcs circular_arc_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE - - execute_commands_new_structure circular_arcs circular_arc_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X - else - echo " ERROR: not executed test_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# circular and line arcs -#---------------------------------------------------------------------# -test_circular_line_arc_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$CIRCULAR_LINE_ARC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits circular_line_arcs "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure circular_line_arcs circular_line_arc_traits \ - VERTEX IS_VERTICAL CONSTRUCTOR COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE - - execute_commands_new_structure circular_line_arcs circular_line_arc_traits \ - IS_VERTICAL COMPARE_Y_AT_X - - run_trapped_test test_traits \ - data/circular_line_arcs/vertex.pt data/circular_line_arcs/xcurves \ - data/empty.zero data/circular_line_arcs/vertex circular_line_arc_traits - else - echo " ERROR: not executed test_traits circular_line_arc_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# circle segment traits -#---------------------------------------------------------------------# -test_circle_segments_traits() -{ - local nt=$QUOTIENT_MP_FLOAT_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$CIRCLE_SEGMENT_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits circle_segments "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure circle_segments circle_segments_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE - - run_trapped_test test_traits \ - data/circle_segments/points data/circle_segments/xcurves.8 \ - data/empty.zero data/circle_segments/vertex circle_segments_traits - run_trapped_test test_traits \ - data/empty.zero data/circle_segments/xcurves.8 \ - data/empty.zero data/circle_segments/is_vertical circle_segments_traits - run_trapped_test test_traits \ - data/circle_segments/points data/circle_segments/xcurves.8 \ - data/empty.zero data/circle_segments/compare_y_at_x circle_segments_traits - run_trapped_test test_traits \ - data/circle_segments/points data/circle_segments/xcurves.16 \ - data/empty.zero data/circle_segments/compare_y_at_x_left circle_segments_traits - run_trapped_test test_traits \ - data/circle_segments/points data/circle_segments/xcurves.16 \ - data/empty.zero data/circle_segments/compare_y_at_x_right circle_segments_traits - run_trapped_test test_traits \ - data/empty.zero data/circle_segments/constructor.xcv \ - data/empty.zero data/circle_segments/constructor circle_segments_traits - else - echo " ERROR: not executed test_traits circle_segments_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# bezier traits -#---------------------------------------------------------------------# -test_bezier_traits() -{ - if [ -n "${CGAL_DISABLE_GMP}" ]; then - echo "CORE is not available, test_bezier_traits not ran" - return - fi - local nt=$CORE_EXPR_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$BEZIER_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits Bezier "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure bezier bezier_traits \ - COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT SPLIT \ - CONSTRUCTOR ASSERTIONS ARE_MERGEABLE - else - echo " ERROR: not executed test_traits bezier_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# spherical arc traits -#---------------------------------------------------------------------# -test_spherical_arc_traits() -{ - local nt=$CGAL_GMPQ_NT; - local kernel=$CARTESIAN_KERNEL; - local geom_traits=$GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS; - local topol_traits=$SPHERICAL_TOPOL_TRAITS - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; - - compile_test_with_flags test_traits geodesic_arcs_on_sphere "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_old_structure spherical_arcs spherical_arc_traits \ - COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT INTERSECT \ - CONSTRUCTOR \ - COMPARE MAKE_X_MONOTONE SPLIT MERGE ASSERTIONS ARE_MERGEABLE - - execute_commands_new_structure spherical_arcs spherical_arc_traits \ - INTERSECT \ - COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY \ - COMPARE_Y_NEAR_BOUNDARY - - run_trapped_test test_traits \ - data/spherical_arcs/compare.pt data/spherical_arcs/compare.xcv \ - data/empty.zero data/spherical_arcs/compare spherical_arc_traits - else - echo " ERROR: not executed test_traits spherical_arc_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# rational arc traits -#---------------------------------------------------------------------# -test_rational_arc_traits() -{ - if [ -n "${CGAL_DISABLE_GMP}" ]; then - echo "CORE is not available, test_rational_arc_traits not ran" - return - fi - local nt=$CORE_INT_NT; - local kernel=$UNIVARIATE_ALGEBRAIC_KERNEL; - local geom_traits=$RATIONAL_ARC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits rational_arcs "$flags" - if [ -n "${SUCCESS}" ] ; then - run_trapped_test test_traits \ - data/compare.pt data/empty.zero \ - data/empty.zero data/compare rational_arc_traits - - execute_commands_new_structure rational_arcs rational_arc_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE \ - COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY COMPARE_Y_NEAR_BOUNDARY - else - echo " ERROR: not executed test_traits rational_arc_traits" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# algebraic traits with GMP/MPFI -#---------------------------------------------------------------------# -test_algebraic_traits_gmp() -{ - #TODO: Adapt - - local nt=$CGAL_GMPZ_NT; - local kernel=$UNIVARIATE_ALGEBRAIC_KERNEL; - local geom_traits=$ALGEBRAIC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits algebraic "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_new_structure algebraic algebraic_traits_gmp \ - COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT \ - MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT \ - PARAMETER_SPACE_X PARAMETER_SPACE_Y - else - echo " ERROR: not executed test_traits algebraic_traits_gmp" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# algebraic traits with LEDA -#---------------------------------------------------------------------# -test_algebraic_traits_leda() -{ - #TODO: Adapt - - local nt=$LEDA_INT_NT; - local kernel=$UNIVARIATE_ALGEBRAIC_KERNEL; - local geom_traits=$ALGEBRAIC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits algebraic "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_new_structure algebraic algebraic_traits_leda \ - COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT \ - MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT \ - PARAMETER_SPACE_X PARAMETER_SPACE_Y - else - echo " ERROR: not executed test_traits algebraic_traits_leda" >> $ERRORFILE - fi - clean_tests -} - - -#---------------------------------------------------------------------# -# algebraic traits with CORE -#---------------------------------------------------------------------# -test_algebraic_traits_core() -{ - #TODO: Adapt - if [ -n "${CGAL_DISABLE_GMP}" ]; then - echo "CORE is not available, test_algebraic_traits_core not ran" - return - fi - local nt=$CORE_INT_NT; - local kernel=$UNIVARIATE_ALGEBRAIC_KERNEL; - local geom_traits=$ALGEBRAIC_GEOM_TRAITS; - local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; - - compile_test_with_flags test_traits algebraic "$flags" - if [ -n "${SUCCESS}" ] ; then - execute_commands_new_structure algebraic algebraic_traits_core \ - COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT \ - MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT \ - PARAMETER_SPACE_X PARAMETER_SPACE_Y - else - echo " ERROR: not executed test_traits algebraic_traits_core" >> $ERRORFILE - fi - clean_tests -} - -#---------------------------------------------------------------------# -# remove the previous error file -#---------------------------------------------------------------------# - -rm -f $ERRORFILE -rm -f $FULL_ERROR_DESCRIPTION_FILE -rm -f ProgramOutput.test_* -touch $ERRORFILE - -#---------------------------------------------------------------------# -# compile and run the tests -#---------------------------------------------------------------------# - - - -if [ $# -ne 0 ] ; then - case $1 in - -cmake) TEST_WITH_CMAKE="TRUE" ;; - *)TEST_WITH_CMAKE="FALSE" ;; - esac -else - TEST_WITH_CMAKE="FALSE" -fi - -echo "Run all tests." - -if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then - configure -fi - -if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then - compile_and_run construction_test_suite_generator -fi - -test_segment_traits -test_non_caching_segment_traits -test_polyline_traits -test_polycurve_conic_traits -test_polycurve_circular_arc_traits -test_polycurve_bezier_traits -test_non_caching_polyline_traits -test_linear_traits -test_conic_traits - -test_line_arc_traits # "line arcs" (segments) only -test_circular_arc_traits # circular arcs only -test_circular_line_arc_traits # for both - -test_circle_segments_traits -test_bezier_traits - -test_spherical_arc_traits - -test_rational_arc_traits - -test_algebraic_traits_core -test_algebraic_traits_gmp -test_algebraic_traits_leda - -compile_and_run test_data_traits - -compile_and_run test_insertion -compile_and_run test_unbounded_rational_insertion -compile_and_run test_unbounded_rational_direct_insertion -compile_and_run test_rational_function_traits_2 -compile_and_run test_iso_verts - -compile_and_run test_vert_ray_shoot_vert_segments - -test_construction_segments -test_construction_linear_curves -test_construction_spherical_arcs -test_construction_polylines - -test_overlay_segments -test_overlay_spherical_arcs - -test_point_location_segments -test_point_location_segments_conversion -test_point_location_circle_segments -test_point_location_linear - -test_point_location_dynamic_segments - -test_batched_point_location_segments -test_batched_point_location_linear -test_batched_point_location_spherical_arcs - -test_vertical_decomposition_segments -test_vertical_decomposition_linear -# test_vertical_decomposition_spherical_arcs - -compile_and_run test_dual -compile_and_run test_do_intersect -compile_and_run test_zone - -compile_and_run test_observer -compile_and_run test_do_equal - -test_segment_traits_adaptor -test_linear_traits_adaptor -test_spherical_arcs_traits_adaptor - -compile_and_run test_removal -compile_and_run test_unbounded_removal -compile_and_run test_spherical_removal - -compile_and_run test_io - -compile_and_run test_sgm - -compile_and_run test_polycurve_intersection - -# if any error occurred then append the full error description file to error file - -if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then - echo "******************** appending all error outputs ********************" >> $ERRORFILE - cat $FULL_ERROR_DESCRIPTION_FILE >> $ERRORFILE -fi diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_do_intersect.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_do_intersect.cpp index e1287e2761a..c5436ee7b89 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_do_intersect.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_do_intersect.cpp @@ -8,47 +8,49 @@ #include #include -typedef CGAL::Quotient Number_type; -typedef CGAL::Simple_cartesian Kernel; -typedef CGAL::Arr_segment_traits_2 Traits_2; -typedef Traits_2::Point_2 Point_2; -typedef Traits_2::X_monotone_curve_2 Segment_2; -typedef CGAL::Arrangement_2 Arrangement_2; -typedef Arrangement_2::Halfedge_handle Halfedge_handle; +using Number_type = CGAL::Quotient; +using Kernel = CGAL::Simple_cartesian; +using Traits_2 = CGAL::Arr_segment_traits_2; +using Point_2 = Traits_2::Point_2; +using Segment_2 = Traits_2::X_monotone_curve_2; +using Arrangement_2 = CGAL::Arrangement_2; +using Halfedge_handle = Arrangement_2::Halfedge_handle; -#define N_SEGMENTS 3 +int main () { + Arrangement_2 arr; + using Tt = Arrangement_2::Topology_traits; + Tt::Default_point_location_strategy def_pl(arr); -int main () -{ - Arrangement_2 arr; - Segment_2 segs[N_SEGMENTS]; - bool expected_intersect[N_SEGMENTS]; - int k; + Segment_2 segs[] = { + Segment_2(Point_2(-2, -2), Point_2(-1, -1)), + Segment_2(Point_2(-1, 1), Point_2(0, 1)), + Segment_2(Point_2(-1, 0), Point_2(0, 0)) + }; - segs[0] = Segment_2 (Point_2 (-2, -2), Point_2 (-1, -1)); - segs[1] = Segment_2 (Point_2 (-1, 1), Point_2 (0, 1)); - segs[2] = Segment_2 (Point_2 (-1, 0), Point_2 (0, 0)); - - expected_intersect[0] = false; - expected_intersect[1] = true; - expected_intersect[2] = true; + bool expected_intersect[] = {false, true, true}; insert(arr, Segment_2(Point_2(0, 0), Point_2(2, 0))); insert(arr, Segment_2(Point_2(2, 0), Point_2(2, 2))); insert(arr, Segment_2(Point_2(2, 2), Point_2(0, 2))); insert(arr, Segment_2(Point_2(0, 2), Point_2(0, 0))); - for (k = 0; k < N_SEGMENTS; k++) - { - bool do_inter = do_intersect(arr, segs[k]); + size_t k = 0; + for (const auto& seg : segs) { + bool do_inter_0 = do_intersect(arr, seg); + bool do_inter_1 = do_intersect(arr, seg, def_pl, std::true_type()); + bool do_inter_2 = do_intersect(arr, seg, def_pl, std::false_type()); - std::cout << "Segment: " << segs[k]; - std::cout << " Expected: " << expected_intersect[k]; - std::cout << " Actual: " << do_inter << std::endl; + std::cout << "Segment: " << segs[k] << std::endl; + std::cout << " Expected: " << expected_intersect[k] << std::endl; + std::cout << " Actual auto: " << do_inter_0 << std::endl; + std::cout << " Actual x-monotone curve: " << do_inter_1 << std::endl; + std::cout << " Actual curve: " << do_inter_2 << std::endl; - if (expected_intersect[k] != do_inter) - return (1); + if (expected_intersect[k] != do_inter_0) return -1; + if (expected_intersect[k] != do_inter_1) return -1; + if (expected_intersect[k] != do_inter_2) return -1; + ++k; } - return (0); + return 0; } diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt index fca4a62b523..1f1a3dd1c97 100644 --- a/BGL/doc/BGL/BGL.txt +++ b/BGL/doc/BGL/BGL.txt @@ -88,7 +88,7 @@ boost::graph_traits::edge_iterator ei; Algorithms obtain incidence information in graphs with the help of global functions such as: - `std::pair vertices(const Graph& g);` to obtain an iterator range providing access to all the vertices, or -- `int num_vertices(const Graph&);` to obtain the number of vertices of a graph, or +- `vertices_size_type num_vertices(const Graph&);` to obtain the number of vertices of a graph, or - `vertex_descriptor source(edge_descriptor, const Graph&);` to obtain the source vertex of an edge. Note, that the way we have written the types is a simplification; in reality, diff --git a/BGL/doc/BGL/Concepts/FaceListGraph.h b/BGL/doc/BGL/Concepts/FaceListGraph.h index 40339f34e8f..0010e2c78e2 100644 --- a/BGL/doc/BGL/Concepts/FaceListGraph.h +++ b/BGL/doc/BGL/Concepts/FaceListGraph.h @@ -40,6 +40,6 @@ faces(const FaceListGraph& g); This is the case for implementations only marking faces deleted in the face container. */ template -boost::graph_traits::face_size_type +boost::graph_traits::faces_size_type num_faces(const FaceListGraph& g); diff --git a/BGL/doc/BGL/Concepts/HalfedgeListGraph.h b/BGL/doc/BGL/Concepts/HalfedgeListGraph.h index a709aadaa8b..d66abfdaaed 100644 --- a/BGL/doc/BGL/Concepts/HalfedgeListGraph.h +++ b/BGL/doc/BGL/Concepts/HalfedgeListGraph.h @@ -40,6 +40,6 @@ halfedges(const HalfedgeListGraph& g); This is the case for implementations only marking halfedges deleted in the halfedge container. */ template -boost::graph_traits::halfedge_size_type +boost::graph_traits::halfedges_size_type num_halfedges(const HalfedgeListGraph& g); diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt index e058589c3bf..39d72cd330d 100644 --- a/BGL/doc/BGL/PackageDescription.txt +++ b/BGL/doc/BGL/PackageDescription.txt @@ -741,6 +741,7 @@ user might encounter. - `CGAL::Euler::join_vertex()` - `CGAL::Euler::make_hole()` - `CGAL::Euler::remove_center_vertex()` +- `CGAL::Euler::remove_degree_2_vertex()` - `CGAL::Euler::remove_face()` - `CGAL::Euler::split_edge()` - `CGAL::Euler::split_face()` diff --git a/BGL/examples/BGL_LCC/CMakeLists.txt b/BGL/examples/BGL_LCC/CMakeLists.txt index da350e1ac2d..10fb6c09dc0 100644 --- a/BGL/examples/BGL_LCC/CMakeLists.txt +++ b/BGL/examples/BGL_LCC/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_LCC_Examples) # CGAL and its components diff --git a/BGL/examples/BGL_LCC/distance_lcc.cpp b/BGL/examples/BGL_LCC/distance_lcc.cpp index b19f0ab2b38..7baf0883ff4 100644 --- a/BGL/examples/BGL_LCC/distance_lcc.cpp +++ b/BGL/examples/BGL_LCC/distance_lcc.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) // Here we start at an arbitrary vertex // Any other vertex could be the starting point vertex_iterator vb, ve; - boost::tie(vb,ve)=vertices(lcc); + std::tie(vb,ve)=vertices(lcc); vertex_descriptor vd = *vb; std::cout << "We compute distances to " << vd->point() << std::endl; @@ -45,7 +45,7 @@ int main(int argc, char** argv) boost::on_tree_edge())))); // Traverse all vertices and show at what distance they are - for(boost::tie(vb,ve)=vertices(lcc); vb!=ve; ++vb) + for(std::tie(vb,ve)=vertices(lcc); vb!=ve; ++vb) { vd = *vb; std::cout<point()<<" is "<id()]<<" hops away."<point() << "\n"; } diff --git a/BGL/examples/BGL_LCC/normals_lcc.cpp b/BGL/examples/BGL_LCC/normals_lcc.cpp index b729b0b4792..b91f302563b 100644 --- a/BGL/examples/BGL_LCC/normals_lcc.cpp +++ b/BGL/examples/BGL_LCC/normals_lcc.cpp @@ -31,7 +31,7 @@ void calculate_face_normals(const HalfedgeGraph& g, typedef typename boost::property_traits::value_type normal; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(g); fb != fe; ++fb) + for(std::tie(fb, fe) = faces(g); fb != fe; ++fb) { halfedge_descriptor edg = halfedge(*fb, g); halfedge_descriptor edgb = edg; diff --git a/BGL/examples/BGL_LCC/range_lcc.cpp b/BGL/examples/BGL_LCC/range_lcc.cpp index cdf89714c30..e6aca96a397 100644 --- a/BGL/examples/BGL_LCC/range_lcc.cpp +++ b/BGL/examples/BGL_LCC/range_lcc.cpp @@ -42,10 +42,10 @@ void fct(const LCC& lcc) std::cout << vd->point() << std::endl; } - std::cout << "boost::tie + std::for_each" << std::endl; + std::cout << "std::tie + std::for_each" << std::endl; vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices_range(lcc); + std::tie(vb,ve) = vertices_range(lcc); std::for_each(vb,ve, Fct()); } diff --git a/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp b/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp index 988c0230bae..06153ecf2ce 100644 --- a/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp +++ b/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) typedef boost::transform_iterator,halfedge_around_target_iterator> adjacent_vertex_iterator; halfedge_around_target_iterator hb,he; - boost::tie(hb,he) = halfedges_around_target(halfedge(vd,lcc),lcc); + std::tie(hb,he) = halfedges_around_target(halfedge(vd,lcc),lcc); adjacent_vertex_iterator avib, avie; avib = boost::make_transform_iterator(hb, Source(lcc)); avie = boost::make_transform_iterator(he, Source(lcc)); diff --git a/BGL/examples/BGL_OpenMesh/CMakeLists.txt b/BGL/examples/BGL_OpenMesh/CMakeLists.txt index a5091363a51..c56f97d03d7 100644 --- a/BGL/examples/BGL_OpenMesh/CMakeLists.txt +++ b/BGL/examples/BGL_OpenMesh/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_OpenMesh_Examples) # CGAL and its components diff --git a/BGL/examples/BGL_arrangement_2/CMakeLists.txt b/BGL/examples/BGL_arrangement_2/CMakeLists.txt index b803d5b9a37..d0347efa6e0 100644 --- a/BGL/examples/BGL_arrangement_2/CMakeLists.txt +++ b/BGL/examples/BGL_arrangement_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_arrangement_2_Examples) find_package(CGAL REQUIRED) diff --git a/BGL/examples/BGL_graphcut/CMakeLists.txt b/BGL/examples/BGL_graphcut/CMakeLists.txt index 0de1b979314..8acc8de042c 100644 --- a/BGL/examples/BGL_graphcut/CMakeLists.txt +++ b/BGL/examples/BGL_graphcut/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_graphcut_Examples) diff --git a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt index 8c5c669409b..1141da29b73 100644 --- a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt +++ b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_polyhedron_3_Examples) # CGAL and its components diff --git a/BGL/examples/BGL_polyhedron_3/distance.cpp b/BGL/examples/BGL_polyhedron_3/distance.cpp index 4a289af9760..9547d9b6606 100644 --- a/BGL/examples/BGL_polyhedron_3/distance.cpp +++ b/BGL/examples/BGL_polyhedron_3/distance.cpp @@ -24,9 +24,9 @@ int main(int argc, char** argv) { vertex_iterator vb, ve; int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vit and ve - for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ + for(std::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ vertex_descriptor vd = *vb; vd->id() = index++; } @@ -37,7 +37,7 @@ int main(int argc, char** argv) { // Here we start at an arbitrary vertex // Any other vertex could be the starting point - boost::tie(vb,ve)=vertices(P); + std::tie(vb,ve)=vertices(P); vertex_descriptor vd = *vb; std::cout << "We compute distances to " << vd->point() << std::endl; @@ -54,7 +54,7 @@ int main(int argc, char** argv) { // Traverse all vertices and show at what distance they are - for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ + for(std::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ vd = *vb; std::cout << vd->point() << " is " << distance[vd->id()] << " hops away" << std::endl; } diff --git a/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp b/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp index b951c472d14..464bd9ecbb5 100644 --- a/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp +++ b/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp @@ -36,7 +36,7 @@ adjacent_vertices_V2(const Polyhedron& g, { halfedge_around_target_iterator hi, he; - for(boost::tie(hi, he) = halfedges_around_target(halfedge(vd,g),g); hi != he; ++hi) + for(std::tie(hi, he) = halfedges_around_target(halfedge(vd,g),g); hi != he; ++hi) { *out++ = source(*hi,g); } diff --git a/BGL/examples/BGL_polyhedron_3/kruskal.cpp b/BGL/examples/BGL_polyhedron_3/kruskal.cpp index 64371997377..36b3c625605 100644 --- a/BGL/examples/BGL_polyhedron_3/kruskal.cpp +++ b/BGL/examples/BGL_polyhedron_3/kruskal.cpp @@ -33,9 +33,9 @@ kruskal(const Polyhedron& P) vertex_iterator vb, ve; int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vb and ve - for(boost::tie(vb, ve)=vertices(P); vb!=ve; ++vb){ + for(std::tie(vb, ve)=vertices(P); vb!=ve; ++vb){ vertex_index_pmap[*vb]= index++; } @@ -59,7 +59,7 @@ kruskal(const Polyhedron& P) " coord Coordinate {\n" " point [ \n"; - for(boost::tie(vb, ve) = vertices(P); vb!=ve; ++vb){ + for(std::tie(vb, ve) = vertices(P); vb!=ve; ++vb){ std::cout << " " << (*vb)->point() << "\n"; } diff --git a/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp b/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp index a1280a1b479..1b8d467255c 100644 --- a/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp +++ b/BGL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp @@ -41,7 +41,7 @@ kruskal( const Polyhedron& P) "point [ \n"; vertex_iterator vb, ve; - for(boost::tie(vb,ve) = vertices(P); vb!=ve; ++vb){ + for(std::tie(vb,ve) = vertices(P); vb!=ve; ++vb){ std::cout << (*vb)->point() << "\n"; } @@ -75,9 +75,9 @@ int main() { vertex_iterator vb, ve; int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vit and ve - for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ + for(std::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){ vertex_descriptor vd = *vb; vd->id() = index++; } diff --git a/BGL/examples/BGL_polyhedron_3/normals.cpp b/BGL/examples/BGL_polyhedron_3/normals.cpp index 711800cb8ab..d6ed605de84 100644 --- a/BGL/examples/BGL_polyhedron_3/normals.cpp +++ b/BGL/examples/BGL_polyhedron_3/normals.cpp @@ -26,7 +26,7 @@ void calculate_face_normals(const HalfedgeGraph& g, typedef typename boost::property_traits::value_type normal; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(g); fb != fe; ++fb) + for(std::tie(fb, fe) = faces(g); fb != fe; ++fb) { halfedge_descriptor edg = halfedge(*fb, g); halfedge_descriptor edgb = edg; diff --git a/BGL/examples/BGL_polyhedron_3/range.cpp b/BGL/examples/BGL_polyhedron_3/range.cpp index bf54640120f..fcf325cba3b 100644 --- a/BGL/examples/BGL_polyhedron_3/range.cpp +++ b/BGL/examples/BGL_polyhedron_3/range.cpp @@ -40,10 +40,10 @@ void fct(const Polyhedron& p) std::cout << vd->point() << std::endl; } - std::cout << "boost::tie + std::for_each" << std::endl; + std::cout << "std::tie + std::for_each" << std::endl; vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices_range(p); + std::tie(vb,ve) = vertices_range(p); std::for_each(vb,ve, Fct()); } diff --git a/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp b/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp index 5642ab08d6a..3ff09778fe1 100644 --- a/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp +++ b/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) typedef boost::transform_iterator,halfedge_around_target_iterator> adjacent_vertex_iterator; halfedge_around_target_iterator hb,he; - boost::tie(hb,he) = halfedges_around_target(halfedge(vd,P),P); + std::tie(hb,he) = halfedges_around_target(halfedge(vd,P),P); adjacent_vertex_iterator avib, avie; avib = boost::make_transform_iterator(hb, Source(P)); avie = boost::make_transform_iterator(he, Source(P)); diff --git a/BGL/examples/BGL_surface_mesh/CMakeLists.txt b/BGL/examples/BGL_surface_mesh/CMakeLists.txt index 921104583dc..87982059ae9 100644 --- a/BGL/examples/BGL_surface_mesh/CMakeLists.txt +++ b/BGL/examples/BGL_surface_mesh/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_surface_mesh_Examples) find_package(CGAL REQUIRED) diff --git a/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp b/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp index 1f57a67524f..58704355d62 100644 --- a/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp +++ b/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv) std::ofstream outxyz("out.xyz"); outxyz.precision(17); boost::graph_traits::vertex_iterator vit, ve; - boost::tie(vit, ve) = vertices(sm); + std::tie(vit, ve) = vertices(sm); for(; vit!=ve; ++vit) { if(get(vertex_pid_map, *vit) == 0) diff --git a/BGL/examples/BGL_triangulation_2/CMakeLists.txt b/BGL/examples/BGL_triangulation_2/CMakeLists.txt index 7d479d36c4f..d597f2217dd 100644 --- a/BGL/examples/BGL_triangulation_2/CMakeLists.txt +++ b/BGL/examples/BGL_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_triangulation_2_Examples) find_package(CGAL REQUIRED) diff --git a/BGL/include/CGAL/boost/graph/Dual.h b/BGL/include/CGAL/boost/graph/Dual.h index 4ca45b9bcec..59156f7232d 100644 --- a/BGL/include/CGAL/boost/graph/Dual.h +++ b/BGL/include/CGAL/boost/graph/Dual.h @@ -306,7 +306,7 @@ edge(typename boost::graph_traits >::vertex_descriptor u, const Dual

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

& dual) { typename boost::graph_traits >::out_edge_iterator e, e_end; - for(boost::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) { + for(std::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) { if(target(*e, dual) == v) return std::make_pair(halfedge(*e, dual), true); } diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index f8c79165bc5..ece862d5dc7 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -12,10 +12,6 @@ #ifndef CGAL_EULER_OPERATIONS_H #define CGAL_EULER_OPERATIONS_H -#include -#include -#include - #include #include @@ -27,6 +23,10 @@ #include +#include +#include +#include + namespace CGAL { /// \cond SKIP_IN_MANUAL @@ -136,7 +136,7 @@ join_vertex(typename boost::graph_traits::halfedge_descriptor h, CGAL_assertion( halfedge(v_to_remove, v, g).first == h ); halfedge_around_vertex_iterator ieb, iee; - for(boost::tie(ieb, iee) = halfedges_around_target(hop, g); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = halfedges_around_target(hop, g); ieb != iee; ++ieb) { CGAL_assertion( target(*ieb,g) == v_to_remove); set_target(*ieb ,v , g); } @@ -615,7 +615,7 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm) for(std::size_t i=0; i < N; ++i){ halfedge_descriptor hd; bool found; - boost::tie(hd,found) = halfedge(face[i],face[i+1],sm); + std::tie(hd,found) = halfedge(face[i],face[i+1],sm); if(found && (! is_border(hd,sm))){ return false; } @@ -1149,7 +1149,7 @@ void make_hole(typename boost::graph_traits::halfedge_descriptor h, face_descriptor fd = face(h, g); halfedge_around_face_iterator hafib, hafie; - for(boost::tie(hafib, hafie) = halfedges_around_face(h, g); + for(std::tie(hafib, hafie) = halfedges_around_face(h, g); hafib != hafie; ++hafib){ CGAL_assertion(! is_border(opposite(*hafib,g),g)); @@ -1361,7 +1361,7 @@ add_vertex_and_face_to_border(typename boost::graph_traits::halfedge_desc internal::set_border(he2,g); CGAL::Halfedge_around_face_iterator hafib,hafie; - for(boost::tie(hafib, hafie) = halfedges_around_face(ohe1, g); + for(std::tie(hafib, hafie) = halfedges_around_face(ohe1, g); hafib != hafie; ++hafib){ set_face(*hafib, f, g); @@ -1421,7 +1421,7 @@ add_face_to_border(typename boost::graph_traits::halfedge_descriptor h1, internal::set_border(newhop, g); CGAL::Halfedge_around_face_iterator hafib,hafie; - for(boost::tie(hafib, hafie) = halfedges_around_face(newh, g); + for(std::tie(hafib, hafie) = halfedges_around_face(newh, g); hafib != hafie; ++hafib){ set_face(*hafib, f, g); @@ -1458,7 +1458,7 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor // The following loop checks the link condition for v0_v1. // Specifically, that for every vertex 'k' adjacent to both 'p and 'q', 'pkq' is a face of the mesh. // - for ( boost::tie(eb1,ee1) = halfedges_around_source(v0,g) ; eb1 != ee1 ; ++ eb1 ) + for ( std::tie(eb1,ee1) = halfedges_around_source(v0,g) ; eb1 != ee1 ; ++ eb1 ) { halfedge_descriptor v0_k = *eb1; @@ -1466,7 +1466,7 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor { vertex_descriptor k = target(v0_k,g); - for ( boost::tie(eb2,ee2) = halfedges_around_source(k,g) ; eb2 != ee2 ; ++ eb2 ) + for ( std::tie(eb2,ee2) = halfedges_around_source(k,g) ; eb2 != ee2 ; ++ eb2 ) { halfedge_descriptor k_v1 = *eb2; @@ -1866,10 +1866,95 @@ bool satisfies_link_condition(typename boost::graph_traits::edge_descript } /// \endcond #endif + +/** + * removes the target vertex of `h`, merging its incident edges into a single edge linking + * the two vertices adjacent to the vertex being removed. + * + * \tparam Graph must be a model of `MutableFaceGraph` + * + * \param h halfedge descriptor + * \param g the graph + * + * \returns an halfedge linking the two vertices adjacent to the vertex being removed. + * + * \pre `degree(target(h, g), g) == 2`. + * + * \sa `remove_center_vertex()` + */ + +template +typename boost::graph_traits::halfedge_descriptor +remove_degree_2_vertex(const typename boost::graph_traits::halfedge_descriptor h, + Graph& g) +{ + typedef boost::graph_traits Traits; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::halfedge_descriptor halfedge_descriptor; + typedef typename Traits::face_descriptor face_descriptor; + + CGAL_precondition(degree(target(h, g), g) == 2); + + vertex_descriptor v = target(h, g); + halfedge_descriptor h1 = h; + halfedge_descriptor h2 = opposite(next(h1, g), g); + + if(is_border(h1, g)) + std::swap(h1, h2); + + vertex_descriptor v1 = source(h1, g); + vertex_descriptor v2 = source(h2, g); + + bool exists; + halfedge_descriptor huv; + std::tie(huv, exists) = halfedge(v1, v2, g); + + if(is_border(h2, g)) + { + CGAL_assertion(!is_border(h1, g)); + + if(exists) + { + Euler::remove_face(h1, g); + return huv; + } + else + { + halfedge_descriptor oh1 = opposite(h1, g); + halfedge_descriptor nnh1 = next(next(h1, g), g); + halfedge_descriptor ph2 = prev(h2, g); + face_descriptor f1 = face(h1, g); + + set_target(h1, v2, g); + set_halfedge(v2, ph2, g); + set_next(h1, nnh1, g); + set_next(ph2, oh1, g); + set_halfedge(f1, h1, g); // in case it was nh1 + + remove_edge(edge(h2, g), g); + remove_vertex(v, g); + + return h1; + } + } + else + { + CGAL_assertion(!is_border(h1, g) && !is_border(h2, g)); + + halfedge_descriptor ph1 = prev(h1, g); + halfedge_descriptor ph2 = prev(h2, g); + Euler::remove_center_vertex(h, g); + + if(exists) + return huv; + else + return Euler::split_face(ph1, ph2, g); + } +} + /// @} } // namespace Euler - } // namespace CGAL #endif /* CGAL_EULER_OPERATIONS_H */ diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index 362f6b241b1..00097ff1574 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -895,7 +895,7 @@ vertices(const Face_filtered_graph & w) typename Face_filtered_graph ::Is_simplex_valid predicate(&w); g_vertex_iterator b,e; - boost::tie(b,e) = vertices(w.graph()); + std::tie(b,e) = vertices(w.graph()); return make_range(vertex_iterator(predicate, b, e), vertex_iterator(predicate, e, e)); } @@ -912,7 +912,7 @@ edges(const Face_filtered_graph & w) typename Face_filtered_graph ::Is_simplex_valid predicate(&w); g_edge_iterator b,e; - boost::tie(b,e) = edges(w.graph()); + std::tie(b,e) = edges(w.graph()); return make_range(edge_iterator(predicate, b, e), edge_iterator(predicate, e, e)); } @@ -931,7 +931,7 @@ out_edges(typename boost::graph_traits ::Is_simplex_valid predicate(&w); g_out_edge_iterator b,e; - boost::tie(b,e) = out_edges(v, w.graph()); + std::tie(b,e) = out_edges(v, w.graph()); return make_range(out_edge_iterator(predicate, b, e), out_edge_iterator(predicate, e, e)); } @@ -950,7 +950,7 @@ in_edges(typename boost::graph_traits ::Is_simplex_valid predicate(&w); g_in_edge_iterator b,e; - boost::tie(b,e) = in_edges(v, w.graph()); + std::tie(b,e) = in_edges(v, w.graph()); return make_range(in_edge_iterator(predicate, b, e), in_edge_iterator(predicate, e, e)); } diff --git a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h index 368c5fca524..ad107978828 100644 --- a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h +++ b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h @@ -310,7 +310,7 @@ edge(typename boost::graph_traits >::ver CGAL_assertion(in_same_graph(v,w)); bool b; g_edge_descriptor ed; - boost::tie(ed,b) = edge(u.descriptor, v.descriptor, *w.graph); + std::tie(ed,b) = edge(u.descriptor, v.descriptor, *w.graph); return std::make_pair(edge_descriptor(ed,*w.graph),b); } @@ -320,7 +320,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::vertex_iterator b,e; - boost::tie(b,e) = vertices(*w.graph); + std::tie(b,e) = vertices(*w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::V2V(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::V2V(*w.graph))); } @@ -330,7 +330,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::edge_iterator b,e; - boost::tie(b,e) = edges(*w.graph); + std::tie(b,e) = edges(*w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::E2E(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::E2E(*w.graph))); } @@ -342,7 +342,7 @@ out_edges(typename boost::graph_traits > { CGAL_assertion(in_same_graph(v,w)); typename boost::graph_traits::out_edge_iterator b,e; - boost::tie(b,e) = out_edges(v.descriptor, *w.graph); + std::tie(b,e) = out_edges(v.descriptor, *w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::E2E(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::E2E(*w.graph))); } @@ -354,7 +354,7 @@ in_edges(typename boost::graph_traits >: { CGAL_assertion(in_same_graph(v,w)); typename boost::graph_traits::in_edge_iterator b,e; - boost::tie(b,e) = in_edges(v.descriptor, *w.graph); + std::tie(b,e) = in_edges(v.descriptor, *w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::E2E(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::E2E(*w.graph))); } @@ -557,7 +557,7 @@ halfedge(typename boost::graph_traits< Graph_with_descriptor_with_graph > bool b; CGAL_assertion(in_same_graph(u,w)); CGAL_assertion(in_same_graph(v,w)); - boost::tie(hd,b) = halfedge(u.descriptor, v.descriptor, *w.graph); + std::tie(hd,b) = halfedge(u.descriptor, v.descriptor, *w.graph); return std::make_pair(halfedge_descriptor(hd,*w.graph),b); } @@ -621,7 +621,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::halfedge_iterator b,e; - boost::tie(b,e) = halfedges(*w.graph); + std::tie(b,e) = halfedges(*w.graph); return std::make_pair(boost::make_transform_iterator(b, typename boost::graph_traits >::H2H(*w.graph)), boost::make_transform_iterator(e, typename boost::graph_traits >::H2H(*w.graph))); } @@ -661,7 +661,7 @@ CGAL::Iterator_range & w) { typename boost::graph_traits::face_iterator b,e; - boost::tie(b,e) = faces(*w.graph); + std::tie(b,e) = faces(*w.graph); return std::make_pair(boost::make_transform_iterator(b,typename boost::graph_traits >::F2F(*w.graph)), boost::make_transform_iterator(e,typename boost::graph_traits >::F2F(*w.graph))); } diff --git a/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h b/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h index 9a217389d82..32a2cb66294 100644 --- a/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h +++ b/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h @@ -61,7 +61,7 @@ void partition_dual_graph(const TriangleMesh& tm, // fill the adjacency info face_iterator fit, fe; - boost::tie(fit, fe) = faces(tm); + std::tie(fit, fe) = faces(tm); for(int i=0, j=0; fit!=fe; ++fit, ++i) { eptr[i] = j; diff --git a/BGL/include/CGAL/boost/graph/METIS/partition_graph.h b/BGL/include/CGAL/boost/graph/METIS/partition_graph.h index 42f8c240f01..362d8a1502b 100644 --- a/BGL/include/CGAL/boost/graph/METIS/partition_graph.h +++ b/BGL/include/CGAL/boost/graph/METIS/partition_graph.h @@ -47,7 +47,7 @@ struct Output_vertex_partition_ids VertexPartitionIDPmap vertex_partition_id_map) { typename boost::graph_traits::vertex_iterator vit, ve; - boost::tie(vit, ve) = vertices(tm); + std::tie(vit, ve) = vertices(tm); for(; vit!=ve; ++vit) put(vertex_partition_id_map, *vit, npart[get(indices, *vit)]); } @@ -64,7 +64,7 @@ struct Output_face_partition_ids FacePartitionIDPmap face_partition_id_map) { typename boost::graph_traits::face_iterator fit, fe; - boost::tie(fit, fe) = faces(tm); + std::tie(fit, fe) = faces(tm); for(int i=0; fit!=fe; ++fit, ++i) put(face_partition_id_map, *fit, epart[i]); } @@ -98,7 +98,7 @@ void partition_graph(const TriangleMesh& tm, // fill the adjacency info face_iterator fit, fe; - boost::tie(fit, fe) = faces(tm); + std::tie(fit, fe) = faces(tm); for(int i=0, j=0; fit!=fe; ++fit, ++i) { eptr[i] = j; diff --git a/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h b/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h index b2d6e1cc840..75014bd9371 100644 --- a/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h +++ b/BGL/include/CGAL/boost/graph/alpha_expansion_graphcut.h @@ -238,7 +238,7 @@ public: // initialize vertex indices, it is necessary since we are using VertexList = listS Vertex_iterator v_begin, v_end; Traits::vertices_size_type index = 0; - for(boost::tie(v_begin, v_end) = vertices(graph); v_begin != v_end; ++v_begin) { + for(std::tie(v_begin, v_end) = vertices(graph); v_begin != v_end; ++v_begin) { boost::put(boost::vertex_index, graph, *v_begin, index++); } } @@ -269,8 +269,8 @@ public: Edge_descriptor v1_v2, v2_v1; bool v1_v2_added, v2_v1_added; - boost::tie(v1_v2, v1_v2_added) = boost::add_edge(v1, v2, graph); - boost::tie(v2_v1, v2_v1_added) = boost::add_edge(v2, v1, graph); + std::tie(v1_v2, v1_v2_added) = boost::add_edge(v1, v2, graph); + std::tie(v2_v1, v2_v1_added) = boost::add_edge(v2, v1, graph); CGAL_assertion(v1_v2_added && v2_v1_added); //put edge capacities @@ -360,7 +360,7 @@ public: // however from our edge_map, we know that each (2i, 2i + 1) is reverse pairs, how to facilitate that ? // will look it back Graph::edge_iterator ei, ee; - for(boost::tie(ei, ee) = boost::edges(graph); ei != ee; ++ei) { + for(std::tie(ei, ee) = boost::edges(graph); ei != ee; ++ei) { Graph::vertex_descriptor v1 = boost::source(*ei, graph); Graph::vertex_descriptor v2 = boost::target(*ei, graph); std::pair opp_edge = boost::edge(v2, v1, graph); diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index e0d4cbd5b95..bbd7a12708b 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -178,6 +178,7 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, } // detect if there are some non-manifold umbrellas and fix missing halfedge target pointers + std::map> nm_umbrella_map; typedef typename std::vector::iterator edge_iterator; for (edge_iterator it=new_edges.begin(); it!=new_edges.end(); ++it) { @@ -199,10 +200,19 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, // we recover tm_v using the halfedge associated to the target vertex of // the halfedge in sm corresponding to nh_t. This is working because we // set the vertex halfedge pointer to the "same" halfedges. - tm_vertex_descriptor tm_v = - target( get(hs_to_ht, halfedge(target(get(ht_to_hs, nh_t), sm), sm)), tm); - for(tm_halfedge_descriptor ht : halfedges_around_target(nh_t, tm)) - set_target(ht, tm_v, tm); + + sm_vertex_descriptor vs = target(get(ht_to_hs, nh_t), sm); + sm_halfedge_descriptor hs = halfedge(vs, sm); + if (hs == boost::graph_traits::null_halfedge()) + { // special case for Face_filtered_graph with a non-manifold input with not all umbrellas selected + nm_umbrella_map[vs].push_back(nh_t); + } + else + { + tm_vertex_descriptor tm_v = target( get(hs_to_ht, hs), tm); + for(tm_halfedge_descriptor ht : halfedges_around_target(nh_t, tm)) + set_target(ht, tm_v, tm); + } } nh_t = opposite(nh_t, tm); } @@ -210,6 +220,18 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, break; } } + + for (const auto& vs_and_hts : nm_umbrella_map) + { + sm_vertex_descriptor v_sm = vs_and_hts.first; + tm_vertex_descriptor v_tm = add_vertex(tm); + *v2v++=std::make_pair(v_sm, v_tm); + set_halfedge(v_tm, vs_and_hts.second.front(), tm); + put(tm_vpm, v_tm, conv(get(sm_vpm, v_sm))); + + for (tm_halfedge_descriptor h_tm : vs_and_hts.second) + set_target(h_tm, v_tm, tm); + } } } // end of namespace internal diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 75673493e0d..26b358b3561 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -65,7 +65,7 @@ is_border(typename boost::graph_traits::vertex_descriptor vd, const FaceGraph& g) { CGAL::Halfedge_around_target_iterator havib, havie; - for(boost::tie(havib, havie) = halfedges_around_target(halfedge(vd, g), g); havib != havie; ++havib) { + for(std::tie(havib, havie) = halfedges_around_target(halfedge(vd, g), g); havib != havie; ++havib) { if(is_border(*havib,g)) { typename boost::graph_traits::halfedge_descriptor h = *havib; return h; diff --git a/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h b/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h index 679d48896f1..194bd6b95b1 100644 --- a/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h +++ b/BGL/include/CGAL/boost/graph/split_graph_into_polylines.h @@ -147,7 +147,7 @@ void duplicate_terminal_vertices(Graph& graph, typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; vertex_iterator b,e; - boost::tie(b,e) = vertices(graph); + std::tie(b,e) = vertices(graph); std::vector V(b,e); for(vertex_descriptor v : V) { @@ -156,7 +156,7 @@ void duplicate_terminal_vertices(Graph& graph, if (deg != 2 || is_terminal(orig_v, orig)) { out_edge_iterator b, e; - boost::tie(b, e) = out_edges(v, graph); + std::tie(b, e) = out_edges(v, graph); std::vector out_edges_of_v(b, e); for (unsigned int i = 1; i < out_edges_of_v.size(); ++i) { diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index 53d474d67e2..bc18562bb6e 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(BGL_Tests) # CGAL and its components diff --git a/BGL/test/BGL/data/degree_2_collection.off b/BGL/test/BGL/data/degree_2_collection.off new file mode 100644 index 00000000000..629a920c99d --- /dev/null +++ b/BGL/test/BGL/data/degree_2_collection.off @@ -0,0 +1,52 @@ +OFF +29 19 0 + +0 0 0 +0.20000000000000001 0 0 +0.40000000000000002 0 0 +0.59999999999999998 0 0 +0.80000000000000004 0 0 +1 0 0 +0 0.20000000000000001 0 +0.20000000000000001 0.20000000000000001 0 +0 1 0 +0.59999999999999998 0.20000000000000001 0 +0.80000000000000004 0.20000000000000001 0 +1 0.20000000000000001 0 +0 0.40000000000000002 0 +0.20000000000000001 1 0 +0.40000000000000002 0.40000000000000002 0 +0.59999999999999998 0.40000000000000002 0 +1 1 0 +1 0.40000000000000002 0 +0 0.59999999999999998 0 +1 0.80000000000000004 0 +0.59999999999999998 1 0 +0.59999999999999998 0.59999999999999998 0 +0.80000000000000004 1 0 +1 0.59999999999999998 0 +0 0.80000000000000004 0 +0.20000000000000001 0.80000000000000004 0 +0.40000000000000002 1 0 +0.59999999999999998 0.80000000000000004 0 +0.80000000000000004 0.80000000000000004 0 +4 1 7 6 0 +3 28 19 22 +3 6 7 12 +3 4 10 9 +3 3 4 9 +3 27 20 26 +3 9 15 14 +3 5 11 10 +3 24 25 8 +3 25 13 8 +3 1 2 7 +8 17 23 28 27 21 15 10 11 +3 9 10 15 +3 19 16 22 +12 25 24 18 12 7 2 3 9 14 15 21 27 +3 4 5 10 +3 28 22 20 +3 27 28 20 +3 23 19 28 + diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 615a4fd756d..758825d0943 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -1,12 +1,15 @@ #include "test_Prefix.h" -#include + #include #include +#include +#include +#include #include -#include -#include + +#include template void @@ -97,7 +100,7 @@ join_face_test() bool found; halfedge_descriptor e; - boost::tie(e, found) = halfedge(f.w, f.v, f.m); + std::tie(e, found) = halfedge(f.w, f.v, f.m); assert(found); // manually set the halfedge of f.f1 to the edge that is to be // removed to provoke a special case @@ -108,7 +111,7 @@ join_face_test() assert(CGAL::internal::exact_num_edges(f.m) == 6); CGAL::Halfedge_around_face_iterator begin, end; - boost::tie(begin, end) = CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m); + std::tie(begin, end) = CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m); assert(std::distance(begin, end) == 4); for(; begin != end; ++begin) { @@ -119,7 +122,7 @@ join_face_test() } face_iterator fit, fend; - for(boost::tie(fit, fend) = faces(f.m); fit != fend; ++fit) { + for(std::tie(fit, fend) = faces(f.m); fit != fend; ++fit) { assert(*fit == f.f1 || *fit == f.f3); } @@ -141,7 +144,7 @@ remove_face_test_1() // find the edge between x and y bool found; halfedge_descriptor e; - boost::tie(e, found) = halfedge(f.x, f.y, f.m); + std::tie(e, found) = halfedge(f.x, f.y, f.m); assert(found); assert(face(e, f.m) == f.f3); @@ -156,7 +159,7 @@ remove_face_test_1() assert_EQUAL(CGAL::internal::exact_num_vertices(f.m) == 4); halfedge_iterator eb, ee; int count = 0; - for(boost::tie(eb, ee) = halfedges(f.m); eb != ee; ++eb) { + for(std::tie(eb, ee) = halfedges(f.m); eb != ee; ++eb) { if(face(*eb,f.m) == boost::graph_traits::null_face()) ++count; } @@ -177,9 +180,9 @@ remove_face_test_2() bool found; halfedge_descriptor e; - boost::tie(e, found) = halfedge(f.x, f.w, f.m); + std::tie(e, found) = halfedge(f.x, f.w, f.m); assert(found); - boost::tie(e, found) = halfedge(f.x, f.v, f.m); + std::tie(e, found) = halfedge(f.x, f.v, f.m); assert(found); assert(face(e, f.m) == f.f1); CGAL::Euler::remove_face(e,f.m); @@ -189,7 +192,7 @@ remove_face_test_2() assert(CGAL::internal::exact_num_edges(f.m) == 7); assert(CGAL::internal::exact_num_vertices(f.m) == 5); - boost::tie(e, found) = halfedge(f.x, f.w, f.m); + std::tie(e, found) = halfedge(f.x, f.w, f.m); assert(found); assert(face(e,f.m) == boost::graph_traits::null_face()); @@ -266,7 +269,7 @@ join_vertex_interior_test() halfedge_descriptor e; bool found; - boost::tie(e, found) = halfedge(f.w, f.x, f.m); + std::tie(e, found) = halfedge(f.w, f.x, f.m); assert(found); CGAL::Euler::join_vertex(e,f.m); assert(CGAL::internal::exact_num_faces(f.m) == 2); @@ -289,7 +292,7 @@ join_vertex_exterior_test() Surface_fixture_3 f; halfedge_descriptor e; bool found; - boost::tie(e, found) = halfedge(f.w, f.y, f.m); + std::tie(e, found) = halfedge(f.w, f.y, f.m); assert(source(e,f.m) == f.w); assert(target(e,f.m) == f.y); assert(found); @@ -307,7 +310,7 @@ join_vertex_exterior_test() Surface_fixture_3 f; halfedge_descriptor e; bool found; - boost::tie(e, found) = halfedge(f.y, f.w, f.m); + std::tie(e, found) = halfedge(f.y, f.w, f.m); assert(source(e,f.m) == f.y); assert(target(e,f.m) == f.w); @@ -335,9 +338,9 @@ split_vertex() Surface_fixture_3 f; halfedge_descriptor h1, h2; bool found; - boost::tie(h1, found) = halfedge(f.w, f.y, f.m); + std::tie(h1, found) = halfedge(f.w, f.y, f.m); assert(found); - boost::tie(h2, found) = halfedge(f.z, f.y, f.m); + std::tie(h2, found) = halfedge(f.z, f.y, f.m); assert(found); assert(face(h2, f.m) == Traits::null_face()); @@ -358,13 +361,13 @@ split_join_vertex_inverse() Surface_fixture_3 f; halfedge_descriptor h, h1, h2; bool found; - boost::tie(h, found) = halfedge(f.w, f.x, f.m); + std::tie(h, found) = halfedge(f.w, f.x, f.m); assert(found); CGAL::Euler::join_vertex(h,f.m); assert(CGAL::is_valid_polygon_mesh(f.m)); - boost::tie(h1, found) = halfedge(f.z, f.x, f.m); + std::tie(h1, found) = halfedge(f.z, f.x, f.m); assert(found); - boost::tie(h2, found) = halfedge(f.v, f.x, f.m); + std::tie(h2, found) = halfedge(f.v, f.x, f.m); assert(found); CGAL::Euler::join_vertex(CGAL::Euler::split_vertex(h1, h2,f.m),f.m); assert(CGAL::is_valid_polygon_mesh(f.m)); @@ -448,6 +451,67 @@ remove_center_vertex_test() assert(CGAL::internal::exact_num_halfedges(f.m) == nh-(2*deg)); } +template +void +remove_degree_2_vertex_test() +{ + CGAL_GRAPH_TRAITS_MEMBERS(T); + + // vertex at .first should be removable, and after removal, + // there should .second[0] nv, .second[1] ne, and .second[2] nf + // anything not in the map should not be removable + std::map > removable; + removable[0] = CGAL::make_array(28, 92, 19); + removable[13] = CGAL::make_array(28, 90, 18); + removable[14] = CGAL::make_array(28, 90, 18); + removable[16] = CGAL::make_array(28, 90, 18); + removable[17] = CGAL::make_array(28, 92, 19); + removable[18] = CGAL::make_array(28, 92, 19); + removable[21] = CGAL::make_array(28, 92, 19); + removable[26] = CGAL::make_array(28, 90, 18); + + auto test = [&removable](const std::size_t hi) // intentional copy of 'm' + { + T m; + const bool ok = CGAL::IO::read_polygon_mesh("data/degree_2_collection.off", m); + assert(ok); + assert(CGAL::is_valid_polygon_mesh(m)); + + auto vim = CGAL::get_initialized_vertex_index_map(m); + + const halfedge_descriptor h = *(std::next(halfedges(m).begin(), hi)); + const vertex_descriptor v = target(h, m); + auto vid = get(vim, v); + if(degree(v, m) != 2) + { + assert(removable.count(vid) == 0); + return; + } + + const halfedge_descriptor res = CGAL::Euler::remove_degree_2_vertex(h, m); + assert(res != boost::graph_traits::null_halfedge()); + + const std::array& ns = removable.at(vid); + + assert(ns[0] == vertices(m).size()); + assert(ns[1] == halfedges(m).size()); + assert(ns[2] == faces(m).size()); + }; + + T m; + const bool ok = CGAL::IO::read_polygon_mesh("data/degree_2_collection.off", m); + assert(ok); + assert(CGAL::is_valid_polygon_mesh(m)); + + std::size_t nv = num_vertices(m); + std::size_t nh = num_halfedges(m); + std::size_t nf = num_faces(m); + assert(nv == 29 && nh == 94 && nf == 19); + + for(std::size_t hi=0; hi void join_split_inverse() @@ -670,6 +734,8 @@ template void test_Euler_operations() { + std::cout << "== Test with Graph: " << typeid(Graph).name() << std::endl; + test_copy_face_graph_nm_umbrella(); test_copy_face_graph_isolated_vertices(); join_face_test(); @@ -684,6 +750,7 @@ test_Euler_operations() split_face_test(); make_hole_test(); remove_center_vertex_test(); + remove_degree_2_vertex_test(); join_split_inverse(); does_satisfy_link_condition(); test_swap_edges(); diff --git a/BGL/test/BGL/test_Face_filtered_graph.cpp b/BGL/test/BGL/test_Face_filtered_graph.cpp index d83de2bbdc6..e6cfc53be6e 100644 --- a/BGL/test/BGL/test_Face_filtered_graph.cpp +++ b/BGL/test/BGL/test_Face_filtered_graph.cpp @@ -29,9 +29,9 @@ void test_halfedge_around_vertex_iterator(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); typename boost::graph_traits::vertex_iterator vit, vend; - for(boost::tie(vit, vend) = vertices(fg); vit != vend; ++vit) { + for(std::tie(vit, vend) = vertices(fg); vit != vend; ++vit) { halfedge_around_target_iterator havit, havend; - for(boost::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, fg), fg); + for(std::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, fg), fg); havit != havend; ++havit) { assert(target(*havit, fg) == *vit); @@ -56,11 +56,11 @@ void test_halfedge_around_face_iterator(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); face_iterator fit, fend; - for(boost::tie(fit, fend) = faces(fg); fit != fend; ++fit) { + for(std::tie(fit, fend) = faces(fg); fit != fend; ++fit) { halfedge_around_face_iterator hafit, hafend; - boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); + std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); assert(std::distance(hafit, hafend) != 0); - for(boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); hafit != hafend; ++hafit) { + for(std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, fg), fg); hafit != hafend; ++hafit) { assert(face(*hafit, fg) == *fit); } } @@ -78,11 +78,11 @@ void test_edge_iterators(const Graph& g) // do we iterate as many as that? edge_iterator eb, ee; - boost::tie(eb, ee) = edges(fg); + std::tie(eb, ee) = edges(fg); assert(static_cast(std::distance(eb, ee)) == num_edges(g)); id_map ids; unsigned int count = 0; - for(boost::tie(eb, ee) = edges(fg); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(fg); eb != ee; ++eb) { edge_descriptor e = *eb; std::pair r = ids.insert(get(boost::edge_index, g, e)); // unique? @@ -103,7 +103,7 @@ void test_vertex_iterators(Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); vertex_iterator vb, ve; std::size_t count = 0; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb){ + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb){ ++count; } @@ -113,7 +113,7 @@ void test_vertex_iterators(Graph& g) id_map ids; count = 0; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { std::pair r = ids.insert(get(boost::vertex_index, g, *vb)); assert(r.second); ++count; @@ -133,12 +133,12 @@ void test_out_edges(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { vertex_descriptor t = target(*oeb, fg); vertex_descriptor s = source(*oeb, fg); assert(s != t); @@ -162,11 +162,11 @@ void test_in_edges(const Graph& g) Adapter fg(g, 0, boost::make_assoc_property_map(map)); vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { vertex_descriptor t = target(*ieb, fg); vertex_descriptor s = source(*ieb, fg); assert(t == around); @@ -190,18 +190,18 @@ void test_in_out_edges(const Graph& g) // check that the sets of in out edges are the same vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fg); vb != ve; ++vb) { id_map v_ids; std::vector in, out; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, fg); ieb != iee; ++ieb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, source(*ieb, fg))); assert(r.second); in.push_back(source(*ieb, fg)); } out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, fg); oeb != oee; ++oeb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, target(*oeb, fg))); // insertion must fail @@ -232,7 +232,7 @@ void test_edge_find(const Graph& g) typedef std::pair ret; edge_iterator eb, ee; - for(boost::tie(eb, ee) = edges(fg); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(fg); eb != ee; ++eb) { vertex_descriptor s = source(*eb, fg); vertex_descriptor t = target(*eb, fg); ret found = edge(s, t, fg); @@ -256,14 +256,14 @@ void test_faces(const Graph& g) unsigned int count = 0; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(fg); fb != fe; ++fb) { + for(std::tie(fb, fe) = faces(fg); fb != fe; ++fb) { ++count; // reverse look-up halfedge_descriptor assoc = halfedge(*fb, fg); assert(face(assoc, fg) == *fb); // check the enclosure halfedge_around_face_iterator encb, ence; - for(boost::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, fg), fg); encb != ence; ++encb) { + for(std::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, fg), fg); encb != ence; ++encb) { assert(face(*encb, fg) == *fb); } } @@ -579,6 +579,102 @@ void test_Polyhedron_tetrahedron() test_mesh(poly_adapter); } +void non_manifoldness_test1() +{ + // works out-of-the-box because Face_filtered_graph handles already non-manifold cycles + SM mesh; + SM::Vertex_index v0=add_vertex(mesh); + SM::Vertex_index v1=add_vertex(mesh); + SM::Vertex_index v2=add_vertex(mesh); + SM::Vertex_index v3=add_vertex(mesh); + SM::Vertex_index v4=add_vertex(mesh); + SM::Vertex_index v5=add_vertex(mesh); + SM::Vertex_index v6=add_vertex(mesh); + + SM::Face_index f0=mesh.add_face(v0,v1,v2); + SM::Face_index f1=mesh.add_face(v0,v3,v4); + SM::Face_index f2=mesh.add_face(v0,v5,v6); + SM::Halfedge_index h = halfedge(f0,mesh); + while(target(h, mesh)!=v0) + h=next(h,mesh); + set_halfedge(v0, h, mesh); + + std::vector selection = {f1, f2}; + CGAL::Face_filtered_graph ffg(mesh, selection); + + SM out; + CGAL::copy_face_graph(ffg, out); + + assert(vertices(out).size()==5); + assert(faces(out).size()==2); +} + +void non_manifoldness_test2() +{ + SM mesh; + SM::Vertex_index v0=add_vertex(mesh); + SM::Vertex_index v0b=add_vertex(mesh); + SM::Vertex_index v0t=add_vertex(mesh); + + SM::Vertex_index v1=add_vertex(mesh); + SM::Vertex_index v2=add_vertex(mesh); + SM::Vertex_index v3=add_vertex(mesh); + + SM::Vertex_index v4=add_vertex(mesh); + SM::Vertex_index v5=add_vertex(mesh); + SM::Vertex_index v6=add_vertex(mesh); + + SM::Vertex_index v7=add_vertex(mesh); + SM::Vertex_index v8=add_vertex(mesh); + SM::Vertex_index v9=add_vertex(mesh); + + SM::Face_index f00=mesh.add_face(v1,v2,v0); + SM::Face_index f01=mesh.add_face(v2,v3,v0); + SM::Face_index f02=mesh.add_face(v3,v1,v0); + + SM::Face_index f10=mesh.add_face(v4,v5,v0b); + SM::Face_index f11=mesh.add_face(v5,v6,v0b); + SM::Face_index f12=mesh.add_face(v6,v4,v0b); + + SM::Face_index f20=mesh.add_face(v7,v8,v0t); + SM::Face_index f21=mesh.add_face(v8,v9,v0t); + SM::Face_index f22=mesh.add_face(v9,v7,v0t); + + assert(f00!=SM::Face_index()); + assert(f01!=SM::Face_index()); + assert(f02!=SM::Face_index()); + assert(f10!=SM::Face_index()); + assert(f11!=SM::Face_index()); + assert(f12!=SM::Face_index()); + assert(f20!=SM::Face_index()); + assert(f21!=SM::Face_index()); + assert(f22!=SM::Face_index()); + + #define UPDATE_V(fX, vX) \ + { SM::Halfedge_index h = halfedge(fX,mesh);\ + while(target(h, mesh)!=vX) h=next(h,mesh);\ + set_target(h, v0, mesh); } + + UPDATE_V(f10, v0b) + UPDATE_V(f11, v0b) + UPDATE_V(f12, v0b) + UPDATE_V(f20, v0t) + UPDATE_V(f21, v0t) + UPDATE_V(f22, v0t) + + remove_vertex(v0b, mesh); + remove_vertex(v0t, mesh); + + std::vector selection = {f10, f11, f12, f20, f21, f22}; + CGAL::Face_filtered_graph ffg(mesh, selection); + + SM out; + CGAL::copy_face_graph(ffg, out); + + assert(vertices(out).size()==7); + assert(faces(out).size()==6); +} + int main(int, char**) { test_graph_range(poly_data()); @@ -590,6 +686,8 @@ int main(int, char**) #endif test_invalid_selections(); + non_manifoldness_test1(); + non_manifoldness_test2(); test_SM_tetrahedron(); test_Polyhedron_tetrahedron(); diff --git a/BGL/test/BGL/test_OpenMesh.cpp b/BGL/test/BGL/test_OpenMesh.cpp index 0dede3e68ed..e3ddcc9c2ca 100644 --- a/BGL/test/BGL/test_OpenMesh.cpp +++ b/BGL/test/BGL/test_OpenMesh.cpp @@ -10,13 +10,29 @@ typedef Traits::edge_descriptor edge_descriptor; typedef Traits::halfedge_descriptor halfedge_descriptor; typedef Traits::vertex_descriptor vertex_descriptor; typedef Traits::face_descriptor face_descriptor; -//typedef Kernel::Point_3 Point_3; int main() { Om om; - for (Om::EdgeHandle ed : edges(om)) { - std::cout << "edge" << std::endl; + for (Om::EdgeHandle ed : edges(om)) + { + CGAL_USE(ed); + } + for (edge_descriptor ed : edges(om)) + { + CGAL_USE(ed); + } + for (halfedge_descriptor hd : halfedges(om)) + { + CGAL_USE(hd); + } + for (face_descriptor fd : faces(om)) + { + CGAL_USE(fd); + } + for (vertex_descriptor vd : vertices(om)) + { + CGAL_USE(vd); } return 0; } diff --git a/BGL/test/BGL/test_Prefix.h b/BGL/test/BGL/test_Prefix.h index ca92ed230f2..fe866af6842 100644 --- a/BGL/test/BGL/test_Prefix.h +++ b/BGL/test/BGL/test_Prefix.h @@ -238,7 +238,7 @@ struct Surface_fixture_1 { pm = get(CGAL::vertex_point, const_cast(m)); typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(m); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(m); vb != ve; ++vb) { if (get(pm, *vb) == Point_3(0, 0, 0)) u = *vb; else if(get(pm, *vb) == Point_3(1, 0, 0)) @@ -259,13 +259,13 @@ struct Surface_fixture_1 { f1 = CGAL::is_border(halfedge(u, m),m) ? face(opposite(halfedge(u, m), m), m) : face(halfedge(u, m), m); assert(f1 != boost::graph_traits::null_face()); CGAL::Halfedge_around_face_iterator hafib, hafie; - for(boost::tie(hafib, hafie) = CGAL::halfedges_around_face(halfedge(f1, m), m); hafib != hafie; ++hafib) + for(std::tie(hafib, hafie) = CGAL::halfedges_around_face(halfedge(f1, m), m); hafib != hafie; ++hafib) { if(! CGAL::is_border(opposite(*hafib, m), m)) f2 = face(opposite(*hafib, m), m); } typename boost::graph_traits::face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(m); fb != fe; ++fb) { + for(std::tie(fb, fe) = faces(m); fb != fe; ++fb) { if(*fb != f1 && *fb != f2) f3 = *fb; } @@ -289,7 +289,7 @@ struct Surface_fixture_2 { pm = get(CGAL::vertex_point, const_cast(m)); typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(m); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(m); vb != ve; ++vb) { if (get(pm, *vb) == Point_3(0, 2, 0)) u = *vb; else if(get(pm, *vb) == Point_3(2, 2, 0)) @@ -308,25 +308,25 @@ struct Surface_fixture_2 { assert(y != boost::graph_traits::null_vertex()); typename boost::graph_traits::halfedge_descriptor h; bool found; - boost::tie(h, found) = halfedge(x, v, m); + std::tie(h, found) = halfedge(x, v, m); assert(found); assert(! CGAL::is_border(h,m)); f1 = face(h, m); assert(f1 != boost::graph_traits::null_face()); - boost::tie(h, found) = halfedge(v, u, m); + std::tie(h, found) = halfedge(v, u, m); assert(found); assert(!CGAL::is_border(h,m)); f2 = face(h, m); assert(f2 != boost::graph_traits::null_face()); - boost::tie(h, found) = halfedge(u, w, m); + std::tie(h, found) = halfedge(u, w, m); assert(found); assert(!CGAL::is_border(h,m)); f3 = face(h, m); assert(f3 != boost::graph_traits::null_face()); - boost::tie(h, found) = halfedge(w, x, m); + std::tie(h, found) = halfedge(w, x, m); assert(found); assert(!CGAL::is_border(h,m)); f4 = face(h, m); @@ -351,7 +351,7 @@ struct Surface_fixture_3 { pm = get(CGAL::vertex_point, const_cast(m)); typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(m); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(m); vb != ve; ++vb) { if (get(pm, *vb) == Point_3(0, 1, 0)) u = *vb; else if(get(pm, *vb) == Point_3(0, 0, 0)) @@ -399,7 +399,7 @@ struct Surface_fixture_4 { int found = 0; typename boost::graph_traits::halfedge_iterator hb, he; - for(boost::tie(hb, he) = halfedges(m); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(m); hb != he; ++hb) { if(CGAL::is_border(*hb,m)){ if(get(pm, target(*hb,m)) == Point_3(0,0,0)){ if(found == 0){ @@ -435,7 +435,7 @@ struct Surface_fixture_5 { int found = 0; typename boost::graph_traits::halfedge_iterator hb, he; - for(boost::tie(hb, he) = halfedges(m); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(m); hb != he; ++hb) { if(CGAL::is_border(*hb,m)){ if(get(pm, target(*hb,m)) == Point_3(2,1,0)){ h1 = *hb; @@ -500,7 +500,7 @@ struct Surface_fixture_8 { int found = 0; typename boost::graph_traits::halfedge_iterator hb, he; - for(boost::tie(hb, he) = halfedges(m); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(m); hb != he; ++hb) { if(get(pm, source(*hb,m)) == Point_3(0,0,0) && get(pm, target(*hb,m)) == Point_3(1,0,0)){ h1 = *hb; @@ -521,8 +521,6 @@ struct Surface_fixture_8 { Graph m; typename boost::graph_traits::halfedge_descriptor h1, h2, h3; - }; - #endif /* CGAL_TEST_PREFIX_H */ diff --git a/BGL/test/BGL/test_bgl_dual.cpp b/BGL/test/BGL/test_bgl_dual.cpp index 9a79832fcb9..e6a6330a256 100644 --- a/BGL/test/BGL/test_bgl_dual.cpp +++ b/BGL/test/BGL/test_bgl_dual.cpp @@ -42,13 +42,13 @@ int main() { out_edge_iterator b,e; - boost::tie(b,e) = out_edges(vd,dual); + std::tie(b,e) = out_edges(vd,dual); std::cerr << vd << " " << source(*b,dual) << std::endl; } { in_edge_iterator b,e; - boost::tie(b,e) = in_edges(vd,dual); + std::tie(b,e) = in_edges(vd,dual); std::cerr << vd << " " << source(*b,dual) << std::endl; } std::cerr << "done"<< std::endl; diff --git a/BGL/test/BGL/test_circulator.cpp b/BGL/test/BGL/test_circulator.cpp index 1c862324bb6..cd0a18cbbe4 100644 --- a/BGL/test/BGL/test_circulator.cpp +++ b/BGL/test/BGL/test_circulator.cpp @@ -102,7 +102,7 @@ int main(int argc, char* argv[]) { halfedge_around_target_iterator vit, end; vertex_descriptor vd = target(hd,P); - boost::tie(vit,end) = halfedges_around_target(hd,P); + std::tie(vit,end) = halfedges_around_target(hd,P); while(vit!= end) { halfedge_descriptor hd = *vit; assert(target(hd,P) == vd); @@ -113,7 +113,7 @@ int main(int argc, char* argv[]) { halfedge_around_face_iterator vit, end; - boost::tie(vit,end) = halfedges_around_face(hd,P); + std::tie(vit,end) = halfedges_around_face(hd,P); while(vit!= end) { halfedge_descriptor hd = *vit; @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) { out_edge_iterator ohi, end; - for(boost::tie(ohi,end) = out_edges(target(hd,P),P); ohi != end; ++ohi){ + for(std::tie(ohi,end) = out_edges(target(hd,P),P); ohi != end; ++ohi){ edge_descriptor ed = *ohi; halfedge_descriptor hd2 = halfedge(ed,P); std::cout << get(CGAL::vertex_point, P, target(hd2,P)) << std::endl; diff --git a/BGL/test/BGL/test_graph_traits.cpp b/BGL/test/BGL/test_graph_traits.cpp index 082469a58a9..19e03408f21 100644 --- a/BGL/test/BGL/test_graph_traits.cpp +++ b/BGL/test/BGL/test_graph_traits.cpp @@ -26,9 +26,9 @@ void test_halfedge_around_vertex_iterator(const Graph& g) { CGAL_GRAPH_TRAITS_MEMBERS(Graph); vertex_iterator vit, vend; - for(boost::tie(vit, vend) = vertices(g); vit != vend; ++vit) { + for(std::tie(vit, vend) = vertices(g); vit != vend; ++vit) { halfedge_around_target_iterator havit, havend; - for(boost::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, g), g); + for(std::tie(havit, havend) = CGAL::halfedges_around_target(halfedge(*vit, g), g); havit != havend; ++havit) { assert(target(*havit, g) == *vit); @@ -47,11 +47,11 @@ void test_halfedge_around_face_iterator(const Graph& g) { CGAL_GRAPH_TRAITS_MEMBERS(Graph); face_iterator fit, fend; - for(boost::tie(fit, fend) = faces(g); fit != fend; ++fit) { + for(std::tie(fit, fend) = faces(g); fit != fend; ++fit) { halfedge_around_face_iterator hafit, hafend; - boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); + std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); assert(std::distance(hafit, hafend) != 0); - for(boost::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); hafit != hafend; ++hafit) { + for(std::tie(hafit, hafend) = CGAL::halfedges_around_face(halfedge(*fit, g), g); hafit != hafend; ++hafit) { assert(face(*hafit, g) == *fit); } } @@ -66,12 +66,12 @@ void test_halfedge_iterators(const G& g) // do we iterate as many as that? halfedge_iterator hb, he; - boost::tie(hb, he) = halfedges(g); + std::tie(hb, he) = halfedges(g); assert(static_cast(std::distance(hb, he)) == num_halfedges(g)); id_map ids; unsigned int count = 0; - for(boost::tie(hb, he) = halfedges(g); hb != he; ++hb) { + for(std::tie(hb, he) = halfedges(g); hb != he; ++hb) { std::pair r = ids.insert(get(boost::halfedge_index, g, *hb)); // unique? assert(r.second); @@ -92,12 +92,12 @@ void test_edge_iterators(const G& g) // do we iterate as many as that? edge_iterator eb, ee; - boost::tie(eb, ee) = edges(g); + std::tie(eb, ee) = edges(g); assert(static_cast(std::distance(eb, ee)) == num_edges(g)); id_map ids; unsigned int count = 0; - for(boost::tie(eb, ee) = edges(g); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(g); eb != ee; ++eb) { edge_descriptor e = *eb; std::pair r = ids.insert(get(boost::edge_index, g, e)); // unique? @@ -115,7 +115,7 @@ void test_vertex_iterators(const G& g) vertex_iterator vb, ve; std::size_t count = 0; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb){ + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb){ ++count; } @@ -125,7 +125,7 @@ void test_vertex_iterators(const G& g) id_map ids; count = 0; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { std::pair r = ids.insert(get(boost::vertex_index, g, *vb)); assert(r.second); ++count; @@ -142,12 +142,12 @@ void test_out_edges(const G& g) typedef typename Traits::vertex_descriptor vertex_descriptor; vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { vertex_descriptor t = target(*oeb, g); vertex_descriptor s = source(*oeb, g); assert(s != t); @@ -169,11 +169,11 @@ void test_in_edges(const G& g) typedef typename Traits::vertex_descriptor vertex_descriptor; vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { id_map v_ids; vertex_descriptor around = *vb; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { vertex_descriptor t = target(*ieb, g); vertex_descriptor s = source(*ieb, g); assert(t == around); @@ -196,18 +196,18 @@ void test_in_out_edges(const G& g) // check that the sets of in out edges are the same vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(g); vb != ve; ++vb) { id_map v_ids; std::vector in, out; in_edge_iterator ieb, iee; - for(boost::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { + for(std::tie(ieb, iee) = in_edges(*vb, g); ieb != iee; ++ieb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, source(*ieb, g))); assert(r.second); in.push_back(source(*ieb, g)); } out_edge_iterator oeb, oee; - for(boost::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { + for(std::tie(oeb, oee) = out_edges(*vb, g); oeb != oee; ++oeb) { std::pair r = v_ids.insert(get(boost::vertex_index, g, target(*oeb, g))); // insertion must fail @@ -239,13 +239,13 @@ void test_adjacent_vertices(const G& g) vertex_descriptor v = *(vertices(g).begin()); adjacency_iterator vb, ve; - boost::tie(vb, ve) = adjacent_vertices(v, g); + std::tie(vb, ve) = adjacent_vertices(v, g); in_edge_iterator ieb, iee; - boost::tie(ieb, iee) = in_edges(v, g); + std::tie(ieb, iee) = in_edges(v, g); out_edge_iterator oeb, oee; - boost::tie(oeb, oee) = out_edges(v, g); + std::tie(oeb, oee) = out_edges(v, g); assert(std::distance(vb, ve) == std::distance(ieb, iee)); assert(std::distance(vb, ve) == std::distance(oeb, oee)); @@ -271,7 +271,7 @@ void test_edge_find(const G& g) typedef std::pair ret; edge_iterator eb, ee; - for(boost::tie(eb, ee) = edges(g); eb != ee; ++eb) { + for(std::tie(eb, ee) = edges(g); eb != ee; ++eb) { vertex_descriptor s = source(*eb, g); vertex_descriptor t = target(*eb, g); ret found = edge(s, t, g); @@ -293,14 +293,14 @@ void test_faces(const G& g) unsigned int count = 0; face_iterator fb, fe; - for(boost::tie(fb, fe) = faces(g); fb != fe; ++fb) { + for(std::tie(fb, fe) = faces(g); fb != fe; ++fb) { ++count; // reverse look-up halfedge_descriptor assoc = halfedge(*fb, g); assert(face(assoc, g) == *fb); // check the enclosure halfedge_around_face_iterator encb, ence; - for(boost::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, g), g); encb != ence; ++encb) { + for(std::tie(encb, ence) = CGAL::halfedges_around_face(halfedge(*fb, g), g); encb != ence; ++encb) { assert(face(*encb, g) == *fb); } } diff --git a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt index 11d40187de3..1d4deb97575 100644 --- a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/CMakeLists.txt @@ -3,7 +3,7 @@ project(Barycentric_coordinates_2_Benchmarks) -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt index cd3533b5ca7..43a49733d1a 100644 --- a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Barycentric_coordinates_2_Examples) diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt index c50f052a490..7b01647d5c1 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Barycentric_coordinates_2_Tests) diff --git a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt index 305e502bd47..4106c9defb4 100644 --- a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt +++ b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt @@ -6,7 +6,7 @@ # Used in /CGAL/Documentation/doc/Documentation/Developer_manual/create_and_use_a_cmakelist.txt. # Careful when modifying -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Basic_viewer_Examples) #CGAL_Qt6 is needed for the drawing. diff --git a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp index 5c98556e0cf..f7f677e9660 100644 --- a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp +++ b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp @@ -92,7 +92,7 @@ int main(int argc, char* argv[]) Mesh::Property_map faces_size; bool created; - boost::tie(faces_size, created)=sm.add_property_map("f:size",0.); + std::tie(faces_size, created)=sm.add_property_map("f:size",0.); assert(created); for(face_descriptor fd : sm.faces()) diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt index 661e4d89ae5..adfd0e20e78 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt @@ -669,10 +669,10 @@ The traits class used to instantiate the `General_polygon_set_2` class template must model the concept `GeneralPolygonSetTraits_2`, and is tailored to handle a specific family of curves. The concept `GeneralPolygonSetTraits_2` refines the concept -`ArrangementDirectionalXMonotoneTraits_2` specified next. +`AosDirectionalXMonotoneTraits_2` specified next. -The concept `ArrangementDirectionalXMonotoneTraits_2` refines the -concept `ArrangementXMonotoneTraits_2` (see +The concept `AosDirectionalXMonotoneTraits_2` refines the +concept `AosXMonotoneTraits_2` (see Section \ref arr_sssecinsert_x_mon in the 2D Arrangements package). Thus, a model of this concept must define the type `X_monotone_curve_2`, which represents an \f$ x\f$-monotone curve, and the type `Point_2`, @@ -687,7 +687,7 @@ curve is not required to have a designated source and target, it i smaller) and the right (lexicographically larger) endpoints of a given curve. -The `ArrangementDirectionalXMonotoneTraits_2` concept treats its +The `AosDirectionalXMonotoneTraits_2` concept treats its \f$ x\f$-monotone curves as directed objects. It thus requires two additional operations on \f$ x\f$-monotone curves:

    @@ -702,10 +702,10 @@ The traits classes `Arr_segment_traits_2`, `Arr_conic_traits_2` and `Arr_rational_function_traits_2`, which are bundled in the `Arrangement_2` package and distributed with \cgal, are all models of the refined concept -`ArrangementDirectionalXMonotoneTraits_2`.\cgalFootnote{The \cgalFootnoteCode{Arr_polyline_traits_2} class is not a model of the, \cgalFootnoteCode{ArrangementDirectionalXMonotoneTraits_2} concept, as the \f$ x\f$-monotone curve it defines is always directed from left to right. Thus, an opposite curve cannot be constructed. However, it is not very useful to construct a polygon whose edges are polylines, as an ordinary polygon with linear edges can represent the same entity.} +`AosDirectionalXMonotoneTraits_2`.\cgalFootnote{The \cgalFootnoteCode{Arr_polyline_traits_2} class is not a model of the, \cgalFootnoteCode{AosDirectionalXMonotoneTraits_2} concept, as the \f$ x\f$-monotone curve it defines is always directed from left to right. Thus, an opposite curve cannot be constructed. However, it is not very useful to construct a polygon whose edges are polylines, as an ordinary polygon with linear edges can represent the same entity.} Just as with the case of computations using models of the -`ArrangementXMonotoneTraits_2` concept, operations are robust only +`AosXMonotoneTraits_2` concept, operations are robust only when exact arithmetic is used. When inexact arithmetic is used, (nearly) degenerate configurations may result in abnormal termination of the program or even incorrect results. @@ -761,7 +761,7 @@ curves. The class-template `General_polygon_2` models the concept `GeneralPolygon_2`. Its sole template parameter must be instantiated with a model of the concept -`ArrangementDirectionalXMonotoneTraits_2` from which it obtains the +`AosDirectionalXMonotoneTraits_2` from which it obtains the `X_monotone_curve_2` type. It uses the geometric operations on this type provided by such a model to maintain a container of directed curves of type `X_monotone_curve_2`, which represents a @@ -772,7 +772,7 @@ The class-template models the concept `GeneralPolygonSetTraits_2`, and can be used to instantiate the class template `General_polygon_set_2`. It serves as an adapter for a geometric traits class, which models the -concept `ArrangementDirectionalXMonotoneTraits_2`. +concept `AosDirectionalXMonotoneTraits_2`. It can be used for performing set-operations on general polygons. The implementation of the adapter is rather simple, as it is derived from the instantiated template-parameter `ArrXMonotoneTraits_2` @@ -781,13 +781,13 @@ the methods provided by the instantiated parameter `GeneralPolygon`, which is a model of the concept `GeneralPolygon_2`. By default, the `GeneralPolygon` parameter is defined as -`General_polygon_2`. +`General_polygon_2`. The code excerpt listed below defines a general-polygon set type that can be used to perform Boolean set-operations on point sets bounded by the \f$ x\f$-monotone curve type defined by the arrangement-traits class `Arr_traits_2`, which is some representative model of the concept -`ArrangementDirectionalXMonotoneTraits_2`. +`AosDirectionalXMonotoneTraits_2`. \code{.cpp} #include diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Boolean_set_operations_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Boolean_set_operations_2.h index 39faf23e21a..4fd5c2c9e38 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Boolean_set_operations_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Boolean_set_operations_2.h @@ -90,7 +90,7 @@ void complement(const Polygon_2& pgn, * \param pgn the input polygon. * \param res the complement of \p pgn. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template void @@ -136,7 +136,7 @@ OutputIterator complement(const Polygon_with_holes_2& pgn, * `General_polygon_with_holes_2<>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -161,7 +161,7 @@ void complement(const Polygon_2& pgn, * \param res the resulting complement of \p pgn * \param traits a traits object. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. */ template @@ -193,7 +193,7 @@ OutputIterator complement(const Polygon_with_holes_2& pgn, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. */ template @@ -438,7 +438,7 @@ OutputIterator difference(const Polygon_with_holes_2& pgn1, * Its dereference type must be convertibe to * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. - * \pre `%ArrTraits` must be a model of the concept `ArrangementDirectionalXMonotoneTraits_2`. + * \pre `%ArrTraits` must be a model of the concept `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator difference(const General_polygon_2& pgn1, @@ -454,7 +454,7 @@ OutputIterator difference(const General_polygon_2& pgn1, * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -471,7 +471,7 @@ difference(const General_polygon_with_holes_2>& pgn * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -578,7 +578,7 @@ OutputIterator difference(const Polygon_with_holes_2& pgn1, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -597,7 +597,7 @@ OutputIterator difference(const General_polygon_2& pgn1, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -617,7 +617,7 @@ difference(const General_polygon_with_holes_2>& pgn * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -858,7 +858,7 @@ bool do_intersect(const Polygon_with_holes_2& pgn1, * \return `true` if `pgn1` and `pgn2` intersect in their interior and `false` * otherwise. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool do_intersect(const General_polygon_2& pgn1, @@ -870,7 +870,7 @@ bool do_intersect(const General_polygon_2& pgn1, * \return `true` if `pgn1` and `pgn2` intersect in their interior and `false` * otherwise. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool @@ -883,7 +883,7 @@ do_intersect(const General_polygon_2& pgn1, * \return `true` if `pgn1` and `pgn2` intersect in their interior and `false` * otherwise. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool do_intersect(const General_polygon_with_holes_2>& pgn1, @@ -1058,7 +1058,7 @@ bool do_intersect(const Polygon_with_holes_2& pgn1, * otherwise. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool do_intersect(const General_polygon_2& pgn1, @@ -1073,7 +1073,7 @@ bool do_intersect(const General_polygon_2& pgn1, * otherwise. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool @@ -1089,7 +1089,7 @@ do_intersect(const General_polygon_2& pgn1, * otherwise. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool @@ -1415,7 +1415,7 @@ OutputIterator intersection(const Polygon_with_holes_2& pgn1, * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator intersection(const General_polygon_2& pgn1, @@ -1431,7 +1431,7 @@ OutputIterator intersection(const General_polygon_2& pgn1, * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -1448,7 +1448,7 @@ intersection(const General_polygon_with_holes_2>& p * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -1672,7 +1672,7 @@ intersection(const Polygon_with_holes_2& pgn1, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -1693,7 +1693,7 @@ OutputIterator intersection(const General_polygon_2& pgn1, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -1715,7 +1715,7 @@ intersection(const General_polygon_with_holes_2>& p * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -2026,7 +2026,7 @@ bool join(const Polygon_with_holes_2& pgn1, * \param res the resulting union of \p pgn1 and \p pgn2. * \return `true` if the two input polygons overlap. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool join(const General_polygon_2& pgn1, @@ -2039,7 +2039,7 @@ bool join(const General_polygon_2& pgn1, * \param res the resulting union of \p pgn1 and \p pgn2. * \return `true` if the two input polygons overlap. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool @@ -2053,7 +2053,7 @@ join(const General_polygon_2& pgn1, * \param res the resulting union of \p pgn1 and \p pgn2. * \return `true` if the two input polygons overlap. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template bool @@ -2217,7 +2217,7 @@ bool join(const Polygon_with_holes_2& pgn2, * \param traits a traits object. * \return `true` if the two input polygons overlap. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. */ template @@ -2234,7 +2234,7 @@ bool join(const General_polygon_2& pgn1, * \param traits a traits object. * \return `true` if the two input polygons overlap. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. */ template @@ -2252,7 +2252,7 @@ join(const General_polygon_2& pgn1, * \param traits a traits object. * \return `true` if the two input polygons overlap. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. */ template @@ -2568,7 +2568,7 @@ oriented_side(const Polygon_with_holes_2& pgn1, * \param pgn1 1st the input polygon. * \param pgn2 the 2nd input polygon. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template Oriented_side oriented_side(const General_polygon_2& pgn1, @@ -2578,7 +2578,7 @@ Oriented_side oriented_side(const General_polygon_2& pgn1, * \param pgn1 the 1st input polygon. * \param pgn2 the 2nd input polygon. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template Oriented_side @@ -2589,7 +2589,7 @@ oriented_side(const General_polygon_2& pgn1, * \param pgn1 the 1st input polygon. * \param pgn2 the 2nd input polygon. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template Oriented_side @@ -2655,7 +2655,7 @@ Oriented_side oriented_side(const Polygon_with_holes_2& pgn1, * \param pgn2 the 2nd input polygon. * \param traits a traits object. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. * */ @@ -2669,7 +2669,7 @@ Oriented_side oriented_side(const General_polygon_2& pgn1, * \param pgn2 the 2nd input polygon. * \param traits a traits object. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. * */ @@ -2684,7 +2684,7 @@ oriented_side(const General_polygon_2& pgn1, * \param pgn2 the 2nd input polygon. * \param traits a traits object. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. * */ @@ -2727,7 +2727,7 @@ Oriented_side oriented_side(const Point_2& p, * \param p the input point. * \param pgn the input polygon. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template Oriented_side oriented_side(const Point_2& p, @@ -2770,7 +2770,7 @@ Oriented_side oriented_side(const Point_2& p, * \param pgn the input polygon. * \param traits a traits object. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre `GpsTraits` must be a model of the concept `GeneralPolygonSetTraits_2`. */ template @@ -3063,7 +3063,7 @@ symmetric_difference(const Polygon_with_holes_2& pgn1, * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator symmetric_difference(const General_polygon_2& pgn1, @@ -3081,7 +3081,7 @@ OutputIterator symmetric_difference(const General_polygon_2& pgn1, * `General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -3100,7 +3100,7 @@ symmetric_difference(const General_polygon_with_holes_2>`. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. */ template OutputIterator @@ -3332,7 +3332,7 @@ symmetric_difference(const Polygon_with_holes_2& pgn1, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -3353,7 +3353,7 @@ OutputIterator symmetric_difference(const General_polygon_2& pgn1, * \param traits a traits object. * \return the past-the-end iterator of the output container. * \pre `%ArrTraits` must be a model of the concept - * `ArrangementDirectionalXMonotoneTraits_2`. + * `AosDirectionalXMonotoneTraits_2`. * \pre GpsTraits must be a model of `GeneralPolygonSetTraits_2`. */ template @@ -3375,7 +3375,7 @@ symmetric_difference(const General_polygon_with_holes_2 diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_2.h index c5c628cc757..ac8899ed76e 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_2.h @@ -7,10 +7,10 @@ namespace CGAL { The class `General_polygon_2` models the concept `GeneralPolygon_2`. It represents a simple general-polygon. It is parameterized with the type `ArrTraits` that models the concept -`ArrangementDirectionalXMonotoneTraits_2`. The latter is a refinement -of the concept `ArrangementXMonotoneTraits_2`. In addition to the -requirements of the concept `ArrangementXMonotoneTraits_2`, a -model of the concept `ArrangementDirectionalXMonotoneTraits_2` must +`AosDirectionalXMonotoneTraits_2`. The latter is a refinement +of the concept `AosXMonotoneTraits_2`. In addition to the +requirements of the concept `AosXMonotoneTraits_2`, a +model of the concept `AosDirectionalXMonotoneTraits_2` must support the following functions:
    • Given an \f$ x\f$-monotone curve, construct its opposite curve. diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_set_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_set_2.h index 7490789ba66..f65b5d11004 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_set_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/General_polygon_set_2.h @@ -50,7 +50,7 @@ boundary and the holes are also pairwise disjoint, except perhaps at the vertices. \sa `Arrangement_2` -\sa `ArrangementXMonotoneTraits_2` +\sa `AosXMonotoneTraits_2` \sa `Nef_polyhedron_2` */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Gps_traits_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Gps_traits_2.h index 6d65a9e5e43..ca47397e6a2 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Gps_traits_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/Gps_traits_2.h @@ -7,8 +7,8 @@ namespace CGAL { The traits class `Gps_traits_2` models the concept `GeneralPolygonSetTraits_2`. It inherits from the instantiated type of the template parameter `ArrTraits`, which must model the -concept `ArrangementDirectionalXMonotoneTraits_2`, (which in turn refines -the concept `ArrangementXMonotoneTraits_2`). The template parameter +concept `AosDirectionalXMonotoneTraits_2`, (which in turn refines +the concept `AosXMonotoneTraits_2`). The template parameter `GeneralPolygon_t` must be instantiated with a model of the concept of `GpsTraitsGeneralPolygon_2`. By default, the latter is instantiated by `CGAL::General_polygon_2`. diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrangementDirectionalXMonotoneTraits_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/AosDirectionalXMonotoneTraits_2.h similarity index 80% rename from Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrangementDirectionalXMonotoneTraits_2.h rename to Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/AosDirectionalXMonotoneTraits_2.h index 3278e482000..1f2e9dac658 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrangementDirectionalXMonotoneTraits_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/AosDirectionalXMonotoneTraits_2.h @@ -7,14 +7,14 @@ This concept refines the basic arrangement \f$ x\f$-monotone traits concept. A model of this concept is able to handle directed \f$ x\f$-monotone curves that intersect in their interior. Namely, an instance of the `X_monotone_curve_2` type defined by a model of the concept -`ArrangementXMonotoneTraits_2` is only required to have a left +`AosXMonotoneTraits_2` is only required to have a left (lexicographically smaller) endpoint and a right endpoint. If the traits class is also a model of -`ArrangementDirectionalXMonotoneTraits_2`, the \f$ x\f$-monotone curve is +`AosDirectionalXMonotoneTraits_2`, the \f$ x\f$-monotone curve is also required to have a direction, namely one of these two endpoint serves as its source and the other as its target. -\cgalRefines{ArrangementXMonotoneTraits_2} +\cgalRefines{AosXMonotoneTraits_2} \cgalHasModelsBegin \cgalHasModels{CGAL::Arr_segment_traits_2} @@ -26,11 +26,11 @@ as its source and the other as its target. \cgalHasModels{CGAL::Arr_algebraic_segment_traits_2} \cgalHasModelsEnd -\sa `ArrangementXMonotoneTraits_2` +\sa `AosXMonotoneTraits_2` */ -class ArrangementDirectionalXMonotoneTraits_2 { +class AosDirectionalXMonotoneTraits_2 { public: /// \name Functor Types @@ -74,17 +74,17 @@ typedef unspecified_type Merge_2; /*! default constructor. */ -ArrangementDirectionalXMonotoneTraits_2(); +AosDirectionalXMonotoneTraits_2(); /*! copy constructor */ -ArrangementDirectionalXMonotoneTraits_2(ArrangementDirectionalXMonotoneTraits_2 other); +AosDirectionalXMonotoneTraits_2(AosDirectionalXMonotoneTraits_2 other); /*! assignment operator. */ -ArrangementDirectionalXMonotoneTraits_2 operator=(other); +AosDirectionalXMonotoneTraits_2 operator=(other); /// @} @@ -103,5 +103,4 @@ Construct_opposite_2 construct_opposite_2_object(); /// @} -}; /* end ArrangementDirectionalXMonotoneTraits_2 */ - +}; /* end AosDirectionalXMonotoneTraits_2 */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--AreMergeable_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--AreMergeable_2.h index 65fd4f347a8..93f15a825bf 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--AreMergeable_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--AreMergeable_2.h @@ -6,7 +6,7 @@ namespace ArrDirectionalTraits { \cgalRefines{AdaptableBinaryFunction} \cgalHasModelsBegin -\cgalHasModels{ArrangementDirectionalXMonotoneTraits_2::Are_mergeable_2} +\cgalHasModels{AosDirectionalXMonotoneTraits_2::Are_mergeable_2} \cgalHasModelsEnd */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--CompareEndpointsXy_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--CompareEndpointsXy_2.h index e7714c04561..daf5b7a705c 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--CompareEndpointsXy_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--CompareEndpointsXy_2.h @@ -7,7 +7,7 @@ namespace ArrDirectionalTraits { \cgalRefines{AdaptableUnaryFunction} \cgalHasModelsBegin -\cgalHasModels{ArrangementDirectionalXMonotoneTraits_2::Compare_endpoints_xy_2} +\cgalHasModels{AosDirectionalXMonotoneTraits_2::Compare_endpoints_xy_2} \cgalHasModelsEnd */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--ConstructOpposite_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--ConstructOpposite_2.h index 92ee2585b2d..c61205872cb 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--ConstructOpposite_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--ConstructOpposite_2.h @@ -7,7 +7,7 @@ namespace ArrDirectionalTraits { \cgalRefines{AdaptableUnaryFunction} \cgalHasModelsBegin -\cgalHasModels{ArrangementDirectionalXMonotoneTraits_2::Construct_opposite_2} +\cgalHasModels{AosDirectionalXMonotoneTraits_2::Construct_opposite_2} \cgalHasModelsEnd */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h index 35c4fdf3273..4b6fcea1cc0 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Intersect_2.h @@ -6,7 +6,7 @@ namespace ArrDirectionalTraits { \cgalRefines{AdaptableBinaryFunction} \cgalHasModelsBegin -\cgalHasModels{ArrangementDirectionalXMonotoneTraits_2::Intersect_2} +\cgalHasModels{AosDirectionalXMonotoneTraits_2::Intersect_2} \cgalHasModelsEnd */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Merge_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Merge_2.h index 18f8f26e936..fa931a25d70 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Merge_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Merge_2.h @@ -6,7 +6,7 @@ namespace ArrDirectionalTraits { \cgalRefines{AdaptableBinaryFunction} \cgalHasModelsBegin -\cgalHasModels{ArrangementDirectionalXMonotoneTraits_2::Merge_2} +\cgalHasModels{AosDirectionalXMonotoneTraits_2::Merge_2} \cgalHasModelsEnd */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Split_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Split_2.h index 5d6529d4862..8cb1a811b3f 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Split_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/ArrDirectionalTraits--Split_2.h @@ -6,7 +6,7 @@ namespace ArrDirectionalTraits { \cgalRefines{AdaptableUnaryFunction} \cgalHasModelsBegin -\cgalHasModels{ArrangementDirectionalXMonotoneTraits_2::Split_2} +\cgalHasModels{AosDirectionalXMonotoneTraits_2::Split_2} \cgalHasModelsEnd */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcel.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcel.h index 6d28d6afbf4..2df5a74cbda 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcel.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcel.h @@ -9,12 +9,12 @@ It maintains the incidence relation among them. The halfedges are ordered in pairs sometimes referred to as twins, such that each halfedge pair represent an edge. -A model of the `GeneralPolygonSetDcel` simply refines `ArrangementDcel`, +A model of the `GeneralPolygonSetDcel` simply refines `AosDcel`, the `Halfedge` and `Face` types being models of the concepts `GeneralPolygonSetDcelHalfedge` and `GeneralPolygonSetDcelFace` respectively -\cgalRefines{ArrangementDcel} +\cgalRefines{AosDcel} \cgalHasModelsBegin \cgalHasModels{CGAL::Gps_default_dcel} @@ -28,4 +28,3 @@ respectively class GeneralPolygonSetDcel {}; /* end GeneralPolygonSetDcel */ - diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelFace.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelFace.h index 01a99bce20e..5201673abe7 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelFace.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelFace.h @@ -7,14 +7,14 @@ A face record in a \em Dcel data structure used by the `General_polygon_set_2` and `Polygon_set_2` template classes to represent the underlying internal `Arrangement_2` data structure. -\cgalRefines{ArrangementDcelFace} +\cgalRefines{AosDcelFace} \cgalHasModelsBegin \cgalHasModels{CGAL::Gps_face_base} \cgalHasModelsEnd -\sa `ArrangementDcel` -\sa `ArrangementDcelVertex` +\sa `AosDcel` +\sa `AosDcelVertex` \sa `GeneralPolygonSetDcelHalfedge` */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelHalfedge.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelHalfedge.h index a21a5fd8b7f..975fc355f4c 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelHalfedge.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetDcelHalfedge.h @@ -6,14 +6,14 @@ A halfedge record in a \em Dcel data structure used by the `General_polygon_set_2` and `Polygon_set_2` template classes to represent the underlying internal `Arrangement_2` data structure. -\cgalRefines{ArrangementDcelHalfedge} +\cgalRefines{AosDcelHalfedge} \cgalHasModelsBegin \cgalHasModels{CGAL::Gps_face_halfedge} \cgalHasModelsEnd -\sa `ArrangementDcel` -\sa `ArrangementDcelVertex` +\sa `AosDcel` +\sa `AosDcelVertex` \sa `GeneralPolygonSetDcelFace` */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetTraits_2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetTraits_2.h index 2c8966d8239..a1c48bf7217 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetTraits_2.h +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GeneralPolygonSetTraits_2.h @@ -11,7 +11,7 @@ a type that represents a general polygon and another one that represents general polygon with holes. It also requires operations that operate on these types. -\cgalRefines{ArrangementDirectionalXMonotoneTraits_2} +\cgalRefines{AosDirectionalXMonotoneTraits_2} \cgalHasModelsBegin \cgalHasModels{CGAL::Gps_segment_traits_2} @@ -19,7 +19,7 @@ types. \cgalHasModels{CGAL::Gps_traits_2} \cgalHasModelsEnd -\sa `ArrangementDirectionalXMonotoneTraits_2` +\sa `AosDirectionalXMonotoneTraits_2` */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt index a562dd4e48a..d9e29fbf99a 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt @@ -14,7 +14,6 @@ namespace ArrDirectionalTraits {} /*! \addtogroup PkgBooleanSetOperations2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Regularized Boolean Set-Operations,PkgBooleanSetOperations2} \cgalPkgPicture{Boolean_set_operations_2.png} \cgalPkgSummaryBegin @@ -42,7 +41,7 @@ containment predicates. - `GpsTraitsGeneralPolygon_2` - `GpsTraitsGeneralPolygonWithHoles_2` - `GeneralPolygon_2` -- `ArrangementDirectionalXMonotoneTraits_2` +- `AosDirectionalXMonotoneTraits_2` - `GeneralPolygonSetTraits_2` - `GeneralPolygonSetDcel` - `GeneralPolygonSetDcelFace` diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt b/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt index aee59825ba1..99d2c05f6ce 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Boolean_set_operations_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Qt6) diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt b/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt index 60bd93b4d37..b7b8ec33bba 100644 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Boolean_set_operations_2_Tests) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt b/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt index 7ec2b717b7b..6777f112a5b 100644 --- a/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt +++ b/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgBoundingVolumesRef /*! \addtogroup PkgBoundingVolumesRef -\todo check generated documentation \cgalPkgDescriptionBegin{Bounding Volumes,PkgBoundingVolumes} \cgalPkgPicture{minCircle.png} \cgalPkgSummaryBegin diff --git a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt index aed57e369fc..1829009c9c0 100644 --- a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Approximate_min_ellipsoid_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt b/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt index 9c56c1f8cd2..4d968380aef 100644 --- a/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_annulus_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_annulus_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt b/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt index 9d537c51338..864ad950c98 100644 --- a/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_circle_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_circle_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt b/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt index 5a8ff8b5094..8e54fb2aab0 100644 --- a/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_ellipse_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_ellipse_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt b/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt index 4ec0538e65a..ee65337ea99 100644 --- a/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_quadrilateral_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_quadrilateral_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt b/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt index 52f22930d06..7df4fa04f95 100644 --- a/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_sphere_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_sphere_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt b/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt index 04fdce0a6c7..5a4d610bd42 100644 --- a/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Min_sphere_of_spheres_d/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Min_sphere_of_spheres_d_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt b/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt index b4232b361a1..5f4df68a419 100644 --- a/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt +++ b/Bounding_volumes/examples/Rectangular_p_center_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Rectangular_p_center_2_Examples) find_package(CGAL REQUIRED) diff --git a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt index a5b3adfd744..143e296e6ff 100644 --- a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt +++ b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Bounding_volumes_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt b/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt index f1de0dd7150..7cad98a5e06 100644 --- a/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/examples/Box_intersection_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Box_intersection_d_Examples) find_package(CGAL REQUIRED) diff --git a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt index a82e578f345..74af1828b43 100644 --- a/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt +++ b/Box_intersection_d/test/Box_intersection_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Box_intersection_d_Tests) find_package(CGAL REQUIRED) diff --git a/CGAL_Core/examples/Core/CMakeLists.txt b/CGAL_Core/examples/Core/CMakeLists.txt index 5f1d17eeb8a..a3552430f3c 100644 --- a/CGAL_Core/examples/Core/CMakeLists.txt +++ b/CGAL_Core/examples/Core/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Core_Examples) # CGAL and its components diff --git a/CGAL_Core/include/CGAL/CORE/BigFloat.h b/CGAL_Core/include/CGAL/CORE/BigFloat.h index 5b1bd138bca..671e58d644a 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloat.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloat.h @@ -600,6 +600,7 @@ inline long longValue(const BigFloat& bf) { return bf.longValue(); } +//@} } //namespace CORE diff --git a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc index 3f53e34da44..b287edaecc7 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc +++ b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc @@ -544,7 +544,7 @@ template int BiPoly::getXdegree(){ int deg=-1; for(int i=0; i <=ydeg; i++) - deg = max(deg, coeffX[i].getTrueDegree()); + deg = (max)(deg, coeffX[i].getTrueDegree()); return deg; } diff --git a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt index ee152bc87a8..69a3b23a9d9 100644 --- a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt +++ b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGALimageIO_Examples) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt index 9a5154fe35a..92bc01f4576 100644 --- a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt +++ b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGAL_ImageIO_Tests) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt index 6c942000068..a27008458d1 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGAL_ipelets_Demo) if(NOT POLICY CMP0070 AND POLICY CMP0053) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp index f5423b0ab19..0aa825dcd77 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp @@ -85,7 +85,7 @@ void ASphapeIpelet::protected_run(int fn) Alpha_shape_2 A(LWP.begin(),LWP.end()); int alpha=-1; int nb_ret; - boost::tie(nb_ret,alpha)=request_value_from_user((boost::format("# Spectral critical value (0-%d)") % A.number_of_alphas()).str() ); + std::tie(nb_ret,alpha)=request_value_from_user((boost::format("# Spectral critical value (0-%d)") % A.number_of_alphas()).str() ); if (nb_ret == -1) return; if(alpha<0 || (std::size_t) alpha>A.number_of_alphas()){ diff --git a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp index 97aad8daa24..826ef549364 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp @@ -86,7 +86,7 @@ void Cone_spanners_ipelet::protected_run(int fn) } int ret_val; - boost::tie(ret_val,number_of_cones)=request_value_from_user("Enter the number of cones"); + std::tie(ret_val,number_of_cones)=request_value_from_user("Enter the number of cones"); if (ret_val < 0) { print_error_message("Incorrect value"); return; @@ -129,7 +129,7 @@ void Cone_spanners_ipelet::protected_run(int fn) } } boost::graph_traits::edge_iterator ei, ei_end; - for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + for (std::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { boost::graph_traits::edge_descriptor e = *ei; boost::graph_traits::vertex_descriptor u = source(e, g); boost::graph_traits::vertex_descriptor v = target(e, g); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp index 92104a15cff..0c35beae131 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp @@ -83,7 +83,7 @@ void generator::protected_run(int fn) origin= Kernel::Vector_2((bbox.xmin()+bbox.xmax())/2,(bbox.ymin()+bbox.ymax())/2); if (size<1){ size=200; - //boost::tie(ret_val,size)=request_value_from_user((boost::format("Size (default : %1%)") % size).str()); + //std::tie(ret_val,size)=request_value_from_user((boost::format("Size (default : %1%)") % size).str()); //if (ret_val == -1) return; //if (ret_val == 0) size=200; origin = Kernel::Vector_2(200,200); @@ -92,7 +92,7 @@ void generator::protected_run(int fn) int nbelements=30; - boost::tie(ret_val,nbelements)=request_value_from_user((boost::format("Number of elements (default : %1%)") % nbelements).str() ); + std::tie(ret_val,nbelements)=request_value_from_user((boost::format("Number of elements (default : %1%)") % nbelements).str() ); if (ret_val == -1) return; if (ret_val == 0) nbelements=30; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp index 8b4a70e49fe..f737113bbd6 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp @@ -94,7 +94,7 @@ void IpeletMesh2::protected_run(int fn) int y=static_cast( floor((bbox.max)().y()-(bbox.min)().y()) ); int ret_val; - boost::tie(ret_val,alpha)=request_value_from_user((boost::format("Max edge length (BBox %1%x%2%)") % x % y).str() ); + std::tie(ret_val,alpha)=request_value_from_user((boost::format("Max edge length (BBox %1%x%2%)") % x % y).str() ); if (ret_val == -1) return; if(alpha<0){ diff --git a/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp b/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp index 2d3f050d6cd..add1a29eb06 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/mst.cpp @@ -82,9 +82,9 @@ void mstIpelet::protected_run(int /*fn*/) vertex_iterator vit, ve; // Associate indices to the vertices int index = 0; - // boost::tie assigns the first and second element of the std::pair + // std::tie assigns the first and second element of the std::pair // returned by boost::vertices to the variables vit and ve - for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){ + for(std::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){ vertex_descriptor vd = *vit; vertex_id_map[vd] = index++; } diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp index 9361353d575..56244ed708f 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp @@ -172,7 +172,7 @@ void MdelaunayIpelet::protected_run(int fn) if(fn==4 ||fn==9){ int order; int ret_val; - boost::tie(ret_val,order)=request_value_from_user("Enter order"); + std::tie(ret_val,order)=request_value_from_user("Enter order"); if (ret_val < 0){ print_error_message("Incorrect value"); return; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp index 3727c487040..731f8a1181f 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp @@ -80,7 +80,7 @@ void MregularIpelet::protected_run(int fn) if(fn==4 || fn==9){ int ret_val; - boost::tie(ret_val,order)=request_value_from_user("Enter order"); + std::tie(ret_val,order)=request_value_from_user("Enter order"); if (ret_val < 0){ print_error_message("Incorrect value"); return; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp b/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp index bf1954cf307..73f99255cb8 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/nearest_neighbor_graph.cpp @@ -56,7 +56,7 @@ void nngIpelet::protected_run(int fn) int ret_val; int kNeighbors=1; - boost::tie(ret_val,kNeighbors)=request_value_from_user((boost::format("Number of nearest neighbors (default : k=%1%)") % kNeighbors).str() ); + std::tie(ret_val,kNeighbors)=request_value_from_user((boost::format("Number of nearest neighbors (default : k=%1%)") % kNeighbors).str() ); if (ret_val == -1) return; if (ret_val == 0) kNeighbors=1; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp index 71557e65968..6ba3994a584 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp @@ -124,7 +124,7 @@ void SkeletonIpelet::protected_run(int fn) if (fn==0 || fn==1) draw_straight_skeleton(*ss,max_edge); else{ - boost::tie(ret_val,dist)= + std::tie(ret_val,dist)= request_value_from_user( (boost::format("Offset value (BBox %1%x%2%)") % (bbox.xmax()-bbox.xmin()) % (bbox.ymax()-bbox.ymin())).str() ); diff --git a/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt index ae82aa48f7f..f52731322b7 100644 --- a/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/test/CGAL_ipelets/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(CGAL_ipelets_Tests) find_package(CGAL REQUIRED) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb6cbcce79a..c4ac65d480d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Top level CMakeLists.txt for CGAL-branchbuild # Minimal version of CMake: -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) message("== CMake setup ==") project(CGAL CXX C) diff --git a/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXMonotone_2.h b/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXMonotone_2.h index 0767ad52573..d47fd62c986 100644 --- a/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXMonotone_2.h +++ b/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXMonotone_2.h @@ -18,7 +18,7 @@ public: Splits the arc `ca` into `x`-monotone arcs that are returned through the output iterator. Note that, to ensure an easy interface with the `Arrangement_2` package, the arcs are returned as `CGAL::Object`'s -(see the `ArrangementTraits_2` concept). +(see the `AosTraits_2` concept). */ template < class OutputIterator > OutputIterator @@ -27,4 +27,3 @@ operator()(const CircularKernel::Circular_arc_2 &ca, OutputIterator oit); /// @} }; /* end CircularKernel::MakeXMonotone_2 */ - diff --git a/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXYMonotone_2.h b/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXYMonotone_2.h index 7e454234f27..5cbed951333 100644 --- a/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXYMonotone_2.h +++ b/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel--MakeXYMonotone_2.h @@ -18,7 +18,7 @@ public: Splits the arc `ca` into `y`-monotone arcs that are returned through the output iterator. Note that, to ensure an easy interface with the `Arrangement_2` package, the arcs are returned as `CGAL::Object`'s -(see the `ArrangementTraits_2` concept). +(see the `AosTraits_2` concept). */ template < class OutputIterator > OutputIterator @@ -27,4 +27,3 @@ operator()(const CircularKernel::Circular_arc_2 &ca, OutputIterator oit); /// @} }; /* end CircularKernel::MakeXYMonotone_2 */ - diff --git a/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt b/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt index f596f9b0a1b..3092d4092ba 100644 --- a/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt +++ b/Circular_kernel_2/doc/Circular_kernel_2/PackageDescription.txt @@ -22,7 +22,6 @@ /*! \addtogroup PkgCircularKernel2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Circular Geometry Kernel,PkgCircularKernel2} \cgalPkgPicture{Boolean_operation_detail.png} \cgalPkgSummaryBegin diff --git a/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt index 7b2f5e9e627..33f717ffe50 100644 --- a/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/examples/Circular_kernel_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_2_Examples) find_package(CGAL REQUIRED) diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h index b5830954ec7..0bfc65d0a55 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h @@ -1565,7 +1565,7 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a, double ymax = (is_on_upper) ? to_interval ( CircularFunctors::y_extremal_point(a.supporting_circle(),false).y() ).second : - CGAL::max(left_bb.ymax(),right_bb.ymax()); + (CGAL::max)(left_bb.ymax(),right_bb.ymax()); */ return Bbox_2(left_bb.xmin(),ymin,right_bb.xmax(),ymax); } diff --git a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt index c74331fa0da..18d14536942 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_2_Tests) find_package(CGAL REQUIRED) diff --git a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt index 15b323a35e4..eb14ee65d51 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_3_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt index dd790cb013e..6570aa61957 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/examples/Circular_kernel_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_3_Examples) find_package(CGAL REQUIRED) diff --git a/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt index 11f64e04486..3194864b973 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/test/Circular_kernel_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_3_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Circulator/examples/Circulator/CMakeLists.txt b/Circulator/examples/Circulator/CMakeLists.txt index 45ce196888c..7ac0a4ca88c 100644 --- a/Circulator/examples/Circulator/CMakeLists.txt +++ b/Circulator/examples/Circulator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circulator_Examples) find_package(CGAL REQUIRED) diff --git a/Circulator/test/Circulator/CMakeLists.txt b/Circulator/test/Circulator/CMakeLists.txt index 379b55cc364..a502c47e06f 100644 --- a/Circulator/test/Circulator/CMakeLists.txt +++ b/Circulator/test/Circulator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circulator_Tests) find_package(CGAL REQUIRED) diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index 803d4279ead..e9e93a6d3a6 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Classification_Examples) # CGAL and its components diff --git a/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h b/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h index 2a5c8e6e9c7..53ef4ff89e5 100644 --- a/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h +++ b/Classification/include/CGAL/Classification/Feature/Vertical_dispersion.h @@ -127,7 +127,7 @@ public: continue; std::vector::iterator min_it, max_it; - boost::tie(min_it, max_it) + std::tie(min_it, max_it) = boost::minmax_element (hori.begin(), hori.end()); std::vector occupy (1 + (std::size_t)((*max_it - *min_it) / grid.resolution()), false); diff --git a/Classification/include/CGAL/Classification/Point_set_neighborhood.h b/Classification/include/CGAL/Classification/Point_set_neighborhood.h index c27c874f0c2..5a051426088 100644 --- a/Classification/include/CGAL/Classification/Point_set_neighborhood.h +++ b/Classification/include/CGAL/Classification/Point_set_neighborhood.h @@ -317,9 +317,8 @@ private: Point ref (std::floor(p.x() / voxel_size), std::floor(p.y() / voxel_size), std::floor(p.z() / voxel_size)); - typename std::map >::iterator it; - boost::tie (it, boost::tuples::ignore) - = grid.insert (std::make_pair (ref, std::vector())); + typename std::map >::iterator it + = grid.insert (std::make_pair (ref, std::vector())).first; it->second.push_back (i); } diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index 332dc9216d8..0135ea6f175 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Classification_Tests) # CGAL and its components diff --git a/Classification/test/Classification/test_classification_point_set.cpp b/Classification/test/Classification/test_classification_point_set.cpp index 0a1dc9cee79..bb0cce75796 100644 --- a/Classification/test/Classification/test_classification_point_set.cpp +++ b/Classification/test/Classification/test_classification_point_set.cpp @@ -53,9 +53,9 @@ int main (int, char**) map_added = pts.add_normal_map().second; assert (map_added); normal_map = pts.normal_map(); - boost::tie (echo_map, map_added) = pts.add_property_map ("echo"); + std::tie (echo_map, map_added) = pts.add_property_map ("echo"); assert (map_added); - boost::tie (color_map, map_added) = pts.add_property_map ("color"); + std::tie (color_map, map_added) = pts.add_property_map ("color"); assert (map_added); for (std::size_t i = 0; i < 1000; ++ i) diff --git a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt index 828f4756926..98a1e50f7e1 100644 --- a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Combinatorial_map_Examples) find_package(CGAL REQUIRED) diff --git a/Combinatorial_map/include/CGAL/Cell_iterators.h b/Combinatorial_map/include/CGAL/Cell_iterators.h index 93104ba01e2..9f73b23f232 100644 --- a/Combinatorial_map/include/CGAL/Cell_iterators.h +++ b/Combinatorial_map/include/CGAL/Cell_iterators.h @@ -86,7 +86,8 @@ namespace CGAL { Tag_true>::value); CGAL_assertion(amap.is_whole_map_unmarked(mcell_mark_number)); - mark_cell(amap, adart, mcell_mark_number); + if(this->cont()) + { mark_cell(amap, adart, mcell_mark_number); } } /// Destructor. @@ -126,7 +127,8 @@ namespace CGAL { { unmark_treated_darts(); Ite::rewind(); - mark_cell(*this->mmap, (*this), mcell_mark_number); + if(this->cont()) + { mark_cell(*this->mmap, (*this), mcell_mark_number); } } /// Prefix ++ operator. @@ -199,7 +201,8 @@ namespace CGAL { static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); - mark_cell(amap, adart, mmark_number); + if(this->cont()) + { mark_cell(amap, adart, mmark_number); } } /// Destructor. @@ -234,7 +237,8 @@ namespace CGAL { { unmark_treated_darts(); Ite::rewind(); - mark_cell(*this->mmap, (*this), mmark_number); + if(this->cont()) + { mark_cell(*this->mmap, (*this), mmark_number); } } /// Postfix ++ operator. @@ -253,7 +257,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } @@ -306,7 +310,8 @@ namespace CGAL { static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); - mark_cell(amap, (*this), mmark_number); + if(this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Constructor with a dart in parameter (for end iterator). @@ -314,8 +319,8 @@ namespace CGAL { Base(amap, adart), mmark_number(amap.get_new_mark()) { - if (adart!=this->mmap->null_descriptor) - mark_cell(amap, (*this), mmark_number); + if (this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Destructor. @@ -350,7 +355,8 @@ namespace CGAL { { unmark_treated_darts(); Base::rewind(); - mark_cell(*this->mmap, (*this), mmark_number); + if(this->cont()) + { mark_cell(*this->mmap, (*this), mmark_number); } } /// Postfix ++ operator. @@ -369,7 +375,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index b14fe21083a..7395743edb0 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -610,16 +610,16 @@ public: } iterator begin() { return empty()?end():iterator(this, 0, 0); } - iterator end() { return iterator(this, upper_bound()); } + iterator end() { return iterator(this, null_descriptor); } const_iterator begin() const { return empty()?end():const_iterator(this, 0, 0); } - const_iterator end() const { return const_iterator(this, upper_bound()); } + const_iterator end() const { return const_iterator(this, null_descriptor); } - reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rbegin() { return reverse_iterator(iterator(this, upper_bound())); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator - rbegin() const { return const_reverse_iterator(end()); } + rbegin() const { return const_reverse_iterator(iterator(this, upper_bound())); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } @@ -878,7 +878,8 @@ namespace internal { CC_iterator_with_index(const iterator &it): m_ptr_to_cc(it.m_ptr_to_cc), m_index(it.m_index) { - CGAL_assertion(m_index<=m_ptr_to_cc->upper_bound()); + CGAL_assertion(m_index<=m_ptr_to_cc->upper_bound() || + m_index==DSC::null_descriptor); } // Same for assignment operator @@ -928,14 +929,16 @@ namespace internal { // It's either pointing to end(), or valid. CGAL_assertion_msg(m_ptr_to_cc!=nullptr, "Incrementing a singular iterator or an empty container iterator ?"); - CGAL_assertion_msg(m_indexupper_bound(), - "Incrementing end() ?"); + CGAL_assertion_msg(m_indexupper_bound() && + m_index!=DSC::null_descriptor, + "Incrementing end() ?"); // If it's not end(), then it's valid, we can do ++. do { ++m_index; } while(m_indexupper_bound() && (!m_ptr_to_cc->is_used(m_index))); + if(m_index==m_ptr_to_cc->upper_bound()) { m_index=DSC::null_descriptor; } } void decrement() @@ -969,7 +972,7 @@ namespace internal { pointer operator->() const { return &((*m_ptr_to_cc)[m_index]); } - bool is_end() const { return m_index>=m_ptr_to_cc->upper_bound(); } + bool is_end() const { return m_index==DSC::null_descriptor; } // Can itself be used for bit-squatting. size_type for_compact_container() const diff --git a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt index b440e257636..028f26c9d93 100644 --- a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Combinatorial_map_Tests) find_package(CGAL REQUIRED) @@ -12,6 +12,8 @@ set(hfiles Combinatorial_map_2_test.h Combinatorial_map_3_test.h # create a target per cppfile create_single_source_cgal_program(Combinatorial_map_test.cpp ${hfiles}) create_single_source_cgal_program(Combinatorial_map_copy_test.cpp ${hfiles}) +create_single_source_cgal_program(cmap_test_split_attribute.cpp) +create_single_source_cgal_program(Combinatorial_map_empty_it_test.cpp) # Same targets, defining USE_COMPACT_CONTAINER_WITH_INDEX to test index version add_executable(Combinatorial_map_test_index Combinatorial_map_test.cpp ${hfiles}) @@ -24,7 +26,10 @@ target_compile_definitions(Combinatorial_map_copy_test_index PRIVATE USE_COMPACT target_link_libraries(Combinatorial_map_copy_test_index PRIVATE CGAL::CGAL CGAL::Data) cgal_add_compilation_test(Combinatorial_map_copy_test_index) -create_single_source_cgal_program(cmap_test_split_attribute.cpp) +add_executable(Combinatorial_map_empty_it_test_index Combinatorial_map_empty_it_test.cpp) +target_compile_definitions(Combinatorial_map_empty_it_test_index PRIVATE USE_COMPACT_CONTAINER_WITH_INDEX) +target_link_libraries(Combinatorial_map_empty_it_test_index PRIVATE CGAL::CGAL CGAL::Data) +cgal_add_compilation_test(Combinatorial_map_empty_it_test_index) # Link with OpenMesh if possible find_package(OpenMesh QUIET) diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_empty_it_test.cpp b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_empty_it_test.cpp new file mode 100644 index 00000000000..a7364439192 --- /dev/null +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_empty_it_test.cpp @@ -0,0 +1,53 @@ +#include + +struct Map_3_dart_items_3: public CGAL::Generic_map_min_items +{ +#ifdef USE_COMPACT_CONTAINER_WITH_INDEX + typedef CGAL::Tag_true Use_index; +#endif +}; + +using Map3=CGAL::Combinatorial_map<3, Map_3_dart_items_3>; +Map3 m; + +template +bool test_empty_it(const Range& r, const std::string& txt) +{ + bool res=true; + if(r.size()!=0) + { + std::cout<<"[ERROR "<(m.darts(), "Dart_range"); + res=res && test_empty_it + (const_cast(m).darts(), "Dart_const_range"); + + res=res && test_empty_it> + (m.one_dart_per_cell<3>(), "One_dart_per_cell_range<0>"); + + res=res && test_empty_it> + (const_cast(m).one_dart_per_cell<3>(), + "One_dart_per_cell_const_range<0>"); + + if(!res) + { return(EXIT_FAILURE); } + + std::cout<<"ALL SUCCESS."<::edge_iterator ei, ei_end; - for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + for (std::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { boost::graph_traits::edge_descriptor e = *ei; boost::graph_traits::vertex_descriptor u = source(e, g); boost::graph_traits::vertex_descriptor v = target(e, g); diff --git a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h index 3d1ebc15efb..5a6a73299fb 100644 --- a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h @@ -193,7 +193,7 @@ protected: const Less_by_direction orderMid(g, cw90(bisector_direction)); typename Graph_::vertex_iterator vit, ve; - boost::tie(vit, ve) = boost::vertices(g); + std::tie(vit, ve) = boost::vertices(g); // Step 1: Sort S according to order induced by D1 std::vector S(vit, ve); @@ -218,7 +218,7 @@ protected: typename Graph_::edge_descriptor existing_e; bool existing; // check whether the edge already exists - boost::tie(existing_e, existing)=boost::edge(*it, *ri, g); + std::tie(existing_e, existing)=boost::edge(*it, *ri, g); if (!existing) boost::add_edge(*it, *ri, g); } diff --git a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h index 7f6fdb16a17..58090bdd506 100644 --- a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h @@ -179,7 +179,7 @@ protected: const Less_by_direction orderD2 (g, cwBound); typename Graph_::vertex_iterator vit, ve; - boost::tie(vit, ve) = boost::vertices(g); + std::tie(vit, ve) = boost::vertices(g); // Step 1: Sort S according to order induced by D1 std::vector S(vit, ve); @@ -205,7 +205,7 @@ protected: typename Graph_::edge_descriptor existing_e; bool existing; // check whether the edge already exists - boost::tie(existing_e, existing)=boost::edge(*it, *min, g); + std::tie(existing_e, existing)=boost::edge(*it, *min, g); if (!existing) boost::add_edge(*it, *min, g); } diff --git a/Cone_spanners_2/include/CGAL/gnuplot_output_2.h b/Cone_spanners_2/include/CGAL/gnuplot_output_2.h index d2cb402e37a..ac3fcebb911 100644 --- a/Cone_spanners_2/include/CGAL/gnuplot_output_2.h +++ b/Cone_spanners_2/include/CGAL/gnuplot_output_2.h @@ -109,7 +109,7 @@ std::string gnuplot_edge_list (const Graph& g) ss << std::fixed; // Use fixed floating-point notation typename Graph::edge_iterator eit, ee; - for (boost::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) { + for (std::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) { typename Graph::vertex_descriptor src = boost::source(*eit, g); typename Graph::vertex_descriptor end = boost::target(*eit, g); ss << "set arrow from "; @@ -129,7 +129,7 @@ std::string gnuplot_vertex_list(const Graph& g) { ss << std::fixed; typename Graph::vertex_iterator vit, ve; - for (boost::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) { + for (std::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) { ss << to_double(g[*vit].x()) << " " << to_double(g[*vit].y()) << std::endl; } return ss.str(); diff --git a/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt b/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt index e4d05d60618..559a6418940 100644 --- a/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt +++ b/Cone_spanners_2/test/Cone_spanners_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Cone_spanners_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt b/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt index 6fb39bf6485..3e4532f6ffc 100644 --- a/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt +++ b/Convex_decomposition_3/examples/Convex_decomposition_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_decomposition_3_Examples) find_package(CGAL REQUIRED) diff --git a/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt b/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt index 660388d7120..e06420b426b 100644 --- a/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt +++ b/Convex_decomposition_3/test/Convex_decomposition_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_decomposition_3_Tests) find_package(CGAL REQUIRED) diff --git a/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt b/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt index dad37d65a65..76a81ede555 100644 --- a/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt +++ b/Convex_hull_2/examples/Convex_hull_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_2_Examples) find_package(CGAL REQUIRED) diff --git a/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt b/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt index ba7b0c0b8c1..3a37f23f9aa 100644 --- a/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt +++ b/Convex_hull_2/test/Convex_hull_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_2_Tests) find_package(CGAL REQUIRED) diff --git a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt index add02f31d30..99b49365013 100644 --- a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_3_Examples) # CGAL and its components diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index eac14144073..b2089fdc53c 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -963,7 +963,7 @@ convex_hull_3(InputIterator first, InputIterator beyond, } CGAL_assertion(num_vertices(P)>=3); typename boost::graph_traits::vertex_iterator b,e; - boost::tie(b,e) = vertices(P); + std::tie(b,e) = vertices(P); if (num_vertices(P) == 3){ typename boost::property_map::type vpmap = get(CGAL::vertex_point, P); typedef typename Traits::Triangle_3 Triangle_3; diff --git a/Convex_hull_3/include/CGAL/convexity_check_3.h b/Convex_hull_3/include/CGAL/convexity_check_3.h index cd18bf1d394..b895641d98c 100644 --- a/Convex_hull_3/include/CGAL/convexity_check_3.h +++ b/Convex_hull_3/include/CGAL/convexity_check_3.h @@ -83,7 +83,7 @@ bool is_strongly_convex_3(const Polyhedron& P, const Traits& traits) typename boost::property_map::const_type vpmap = get(CGAL::vertex_point, P); vertex_iterator v_it, v_it_e; - boost::tie(v_it, v_it_e) = vertices(P); + std::tie(v_it, v_it_e) = vertices(P); if (v_it == v_it_e) return false; @@ -97,7 +97,7 @@ bool is_strongly_convex_3(const Polyhedron& P, const Traits& traits) typename Traits::Coplanar_3 coplanar = traits.coplanar_3_object(); face_iterator f_it, f_it_e; - boost::tie(f_it, f_it_e) = faces(P); + std::tie(f_it, f_it_e) = faces(P); Point_3 p; Point_3 q; Point_3 r; diff --git a/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt index 3f8e9eb6830..600579792d5 100644 --- a/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/test/Convex_hull_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_3_Tests) find_package(CGAL REQUIRED) diff --git a/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt b/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt index a1a4b8a3de1..bf45d7bfeb3 100644 --- a/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt +++ b/Convex_hull_d/doc/Convex_hull_d/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgConvexHullDRef /*! \addtogroup PkgConvexHullDRef -\todo check generated documentation \cgalPkgDescriptionBegin{dD Convex Hulls and Delaunay Triangulations,PkgConvexHullD} \cgalPkgPicture{convex_hull_d-teaser.png} \cgalPkgSummaryBegin diff --git a/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt b/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt index 5e04a505476..15d4dd6b201 100644 --- a/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt +++ b/Convex_hull_d/test/Convex_hull_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Convex_hull_d_Tests) find_package(CGAL REQUIRED) diff --git a/Distance_2/test/Distance_2/CMakeLists.txt b/Distance_2/test/Distance_2/CMakeLists.txt index 18adb56e7b8..944049ddb60 100644 --- a/Distance_2/test/Distance_2/CMakeLists.txt +++ b/Distance_2/test/Distance_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Distance_2_Tests) find_package(CGAL REQUIRED) diff --git a/Distance_3/benchmark/Distance_3/CMakeLists.txt b/Distance_3/benchmark/Distance_3/CMakeLists.txt new file mode 100644 index 00000000000..3cc6ca18f7d --- /dev/null +++ b/Distance_3/benchmark/Distance_3/CMakeLists.txt @@ -0,0 +1,23 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + +cmake_minimum_required(VERSION 3.12...3.31) +project(Distance_3_Benchs) + +find_package(CGAL REQUIRED) + +if(MSVC) + # Turn off a VC++ warning on a potential division by zero + # in Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h + # where CGAL_assume() does not help + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4723") +endif() + +# create a target per cppfile +file( + GLOB cppfiles + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(cppfile ${cppfiles}) + create_single_source_cgal_program("${cppfile}") +endforeach() diff --git a/Distance_3/benchmark/Distance_3/bench_compare_distance_3.cpp b/Distance_3/benchmark/Distance_3/bench_compare_distance_3.cpp new file mode 100644 index 00000000000..d7005a594ab --- /dev/null +++ b/Distance_3/benchmark/Distance_3/bench_compare_distance_3.cpp @@ -0,0 +1,297 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +// #define CGAL_USE_GTE_AS_SANITY_CHECK +#ifdef CGAL_USE_GTE_AS_SANITY_CHECK +#include +#include +#endif + +#include +#include + +struct randomint +{ + randomint() ; + int get() const { return sequence[cur]; } + int next() { + cur = (cur + 1) % 11; + return get(); + } + +private: + int sequence[11]; + int cur; +}; + +inline randomint::randomint() +{ + cur = 0; + sequence[0] = 19; + sequence[1] = 5; + sequence[2] = 17; + sequence[3] = 13; + sequence[4] = 29; + sequence[5] = 2; + sequence[6] = 23; + sequence[7] = 31; + sequence[8] = 3; + sequence[9] = 37; + sequence[10] = 11; +} + +randomint ri; + +template +struct Test +{ + typedef typename K::RT RT; + typedef typename K::FT FT; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_3 P; + typedef typename K::Segment_3 S; + typedef typename K::Vector_3 V; + typedef typename K::Ray_3 R; + typedef typename K::Line_3 L; + typedef typename K::Triangle_3 T; + typedef typename K::Plane_3 Pl; + typedef typename K::Tetrahedron_3 Tet; + typedef typename K::Iso_cuboid_3 Cub; + +private: + CGAL::Random& r; + double m = 0, M = 1; + +public: + Test(CGAL::Random& r) : r(r) { } + +private: + inline RT to_nt(int d) const { return RT(d); } + + P p(int x, int y, int z) + { + int w = ri.next(); + return P(to_nt(x*w), to_nt(y*w), to_nt(z*w), to_nt(w)); + } + + P random_point() const + { + return P(FT(r.get_double(m, M)), FT(r.get_double(m, M)), FT(r.get_double(m, M))); + } + + Pl pl(int a, int b, int c, int d) + { + int w = ri.next(); + return Pl(to_nt(a*w), to_nt(b*w), to_nt(c*w), to_nt(d*w)); + } + + +private: + void P_P(int N, FT d2) + { + std::cout << "Point - Point" << std::endl; + CGAL::Real_timer t; + t.start(); + for(int i=0; i(F& f){ + + }; + P_P(10000000, FT(0.1)); + P_S(1000000, FT(0.1)); + + std::cout << std::endl; + P_T(500000, FT(10)); + P_T(500000, FT(0.1)); + P_T(500000, FT(0.001)); + std::cout << std::endl; + + P_Tet(200000, FT(0.1)); + + std::cout << std::endl; + S_S(500000, FT(10)); + S_S(500000, FT(0.1)); + S_S(500000, FT(0.001)); + std::cout << std::endl; + S_L(500000, FT(0.1)); + + std::cout << std::endl; + T_T(500000, FT(10)); + T_T(500000, FT(0.1)); + T_T(500000, FT(0.001)); + std::cout << std::endl; + std::cout << std::endl; + } +}; + +int main(int argc, char** argv) +{ + std::cout.precision(17); + std::cerr.precision(17); + + std::cout << "3D Distance tests" << std::endl; + + CGAL::Random rp; + CGAL::Random r(argc==1?rp.get_seed():std::stoi(argv[1])); + std::cout << "random seed = " << r.get_seed() << std::endl; + + Test >(r).run(); + Test >(r).run(); +// Test > >(r).run(); + + // Test >(r).run(); + + Test(r).run(); + + Test(r).run(); + + std::cout << "Done!" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Distance_3/benchmark/Distance_3/bench_distance_3.cpp b/Distance_3/benchmark/Distance_3/bench_distance_3.cpp new file mode 100644 index 00000000000..641bd01f0ae --- /dev/null +++ b/Distance_3/benchmark/Distance_3/bench_distance_3.cpp @@ -0,0 +1,280 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +// #define CGAL_USE_GTE_AS_SANITY_CHECK +#ifdef CGAL_USE_GTE_AS_SANITY_CHECK +#include +#include +#endif + +#include +#include + +struct randomint +{ + randomint() ; + int get() const { return sequence[cur]; } + int next() { + cur = (cur + 1) % 11; + return get(); + } + +private: + int sequence[11]; + int cur; +}; + +inline randomint::randomint() +{ + cur = 0; + sequence[0] = 19; + sequence[1] = 5; + sequence[2] = 17; + sequence[3] = 13; + sequence[4] = 29; + sequence[5] = 2; + sequence[6] = 23; + sequence[7] = 31; + sequence[8] = 3; + sequence[9] = 37; + sequence[10] = 11; +} + +randomint ri; + +template +struct Test +{ + typedef typename K::RT RT; + typedef typename K::FT FT; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_3 P; + typedef typename K::Segment_3 S; + typedef typename K::Vector_3 V; + typedef typename K::Ray_3 R; + typedef typename K::Line_3 L; + typedef typename K::Triangle_3 T; + typedef typename K::Plane_3 Pl; + typedef typename K::Tetrahedron_3 Tet; + typedef typename K::Iso_cuboid_3 Cub; + +private: + CGAL::Random& r; + double m = 0, M = 1; + +public: + Test(CGAL::Random& r) : r(r) { } + +private: + inline RT to_nt(int d) const { return RT(d); } + + P p(int x, int y, int z) + { + int w = ri.next(); + return P(to_nt(x*w), to_nt(y*w), to_nt(z*w), to_nt(w)); + } + + P random_point() const + { + return P(FT(r.get_double(m, M)), FT(r.get_double(m, M)), FT(r.get_double(m, M))); + } + + Pl pl(int a, int b, int c, int d) + { + int w = ri.next(); + return Pl(to_nt(a*w), to_nt(b*w), to_nt(c*w), to_nt(d*w)); + } + + +private: + void P_P(int N) + { + std::cout << "Point - Point" << std::endl; + CGAL::Real_timer t; + t.start(); + for(int i=0; i +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include + +template +class Old_compare_squared_distance_3 +{ + typedef typename K::FT FT; +public: + typedef typename K::Comparison_result result_type; + + template + CGAL::Needs_FT + operator()(const T1& p, const T2& q, const FT& d2) const + { + return CGAL::compare(CGAL::internal::squared_distance(p, q, K()), d2); + } +}; + +template +struct Test +{ + typedef typename K::RT RT; + typedef typename K::FT FT; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_3 P; + typedef typename K::Segment_3 S; + typedef typename K::Vector_3 V; + typedef typename K::Ray_3 R; + typedef typename K::Line_3 L; + typedef typename K::Triangle_3 T; + typedef typename K::Plane_3 Pl; + typedef typename K::Tetrahedron_3 Tet; + typedef typename K::Iso_cuboid_3 Cub; + + typedef std::vector >::iterator Iterator; + typedef CGAL::Box_intersection_d::Box_with_handle_d CBox; + + size_t nb_closed_pairs; + size_t nb_tested_pairs; + +public: + Test() : nb_closed_pairs(0), nb_tested_pairs(0){ } + + void close_triangles(std::vector

      &points, std::vector >& triangles, FT d2){ + std::vector< CBox > boxes; + auto extend_bbox3=[&](const Iterator it, FT& d2){ + CGAL::Bbox_3 bb = points[(*it)[0]].bbox()+points[(*it)[1]].bbox()+points[(*it)[2]].bbox(); + return CGAL::Bbox_3(bb.xmin(),bb.ymin(),bb.zmin(),bb.xmax()+CGAL::to_double(d2),bb.ymax()+CGAL::to_double(d2),bb.zmax()+CGAL::to_double(d2)); + }; + + auto callback=[&](const CBox &ba, const CBox &bb){ + boost::container::small_vector &a = *(ba.handle()); + boost::container::small_vector &b = *(bb.handle()); + + std::sort(a.begin(), a.end()); + std::sort(b.begin(), b.end()); + std::vector v; + std::set_intersection(a.begin(), a.end(), b.begin(), b.end(),std::back_inserter(v)); + + if(v.size()!=0) //they have common vertices + return; + + nb_tested_pairs++; + if(nb_tested_pairs>1000000) + return; + + T tr1(points[a[0]], points[a[1]], points[a[2]]); + T tr2(points[b[0]], points[b[1]], points[b[2]]); + bool comp = K().compare_squared_distance_3_object()(tr1, tr2, d2)!=CGAL::LARGER; + if(comp) + { + nb_closed_pairs++; + } + }; + + for(Iterator it=triangles.begin(); it!=triangles.end(); ++it) + boxes.emplace_back(extend_bbox3(it, d2), it); + + CGAL::box_self_intersection_d(boxes.begin(), boxes.end(), callback); + } + + void run(std::string filename, FT d2) + { + nb_closed_pairs=0; + std::vector

      input_points; + std::vector> input_triangles; + + if (!CGAL::IO::read_polygon_soup(filename, input_points, input_triangles)) + { + std::cerr << "Cannot read " << filename << "\n"; + return; + } + CGAL::Real_timer t; + t.start(); + close_triangles(input_points, input_triangles, d2); + t.stop(); + std::cout << "#points = " << input_points.size() << " and #triangles = " << input_triangles.size() << " has " << nb_closed_pairs << " pairs at squared distance " << d2 << " in " << t.time() << " sec." << std::endl; + } +}; + +int main(int argc, char** argv) +{ + const std::string filename = argc == 1 ? CGAL::data_file_path("meshes/elephant.off") + : std::string(argv[1]); + + // const std::string out_file = argc <= 2 ? "rounded_soup.off" + // : std::string(argv[2]); + + std::cout.precision(17); + std::cerr.precision(17); + + std::cout << "3D Distance bench" << std::endl; + + std::vector::Point_3> input_points; + std::vector> input_triangles; + + if (!CGAL::IO::read_polygon_soup(filename, input_points, input_triangles)) + { + std::cerr << "Cannot read " << filename << "\n"; + return 1; + } + CGAL::Bbox_3 bb = CGAL::bbox_3(input_points.begin(), input_points.end()); + double max= (std::max)((std::max)(bb.xmax()-bb.xmin(),bb.ymax()-bb.ymin()),bb.zmax()-bb.zmin()); + +// Test >().run(filename); +// Test >().run(filename); +// Test > >(r).run(); + + // Test >(r).run(); + + // Test().run(filename, max*max); + // Test().run(filename, 10*max*max/input_points.size()); + + double average_length=0; + double min_sq_length=CGAL::squared_distance(input_points[input_triangles[0][0]],input_points[input_triangles[0][1]]); + for(auto &tr: input_triangles){ + for(int i=0; i<3; ++i){ + double l=CGAL::squared_distance(input_points[tr[i]], input_points[tr[(i+1)%3]]); + min_sq_length=(std::min)(min_sq_length, l); + average_length+=std::sqrt(l); + } + } + average_length/=(3*input_triangles.size()); + + std::cout << "Simple_Cartesian" << std::endl; + Test >().run(filename, average_length*average_length/256); + Test >().run(filename, min_sq_length*4); + + // Equivalent to EPECK since there are only predicates + // Test().run(filename, 100*max/input_points.size()); + // std::cout << "EPICK" << std::endl; + // Test().run(filename, average_length*average_length/256); + // Test().run(filename, min_sq_length*4); + + std::cout << "EPECK" << std::endl; + Test().run(filename, average_length*average_length/256); + Test().run(filename, min_sq_length*4); + + std::cout << "Done!" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Distance_3/include/CGAL/Distance_3/Line_3_Line_3.h b/Distance_3/include/CGAL/Distance_3/Line_3_Line_3.h index 03495be04fa..a27c6b7aaa6 100644 --- a/Distance_3/include/CGAL/Distance_3/Line_3_Line_3.h +++ b/Distance_3/include/CGAL/Distance_3/Line_3_Line_3.h @@ -45,17 +45,18 @@ squared_distance(const typename K::Line_3& line1, return squared_distance_to_plane(normal, diff, k); } -} // namespace internal - template -inline -typename K::FT -squared_distance(const Line_3& line1, - const Line_3& line2) +typename K::Comparison_result +compare_squared_distance(const typename K::Line_3& line1, + const typename K::Line_3& line2, + const K& k, + const typename K::FT& d2) { - return K().compute_squared_distance_3_object()(line1, line2); + return compare(squared_distance(line1,line2,k),d2); } +} // namespace internal + } // namespace CGAL #endif // CGAL_DISTANCE_3_LINE_3_LINE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Line_3_Plane_3.h b/Distance_3/include/CGAL/Distance_3/Line_3_Plane_3.h index 6bb4d125c59..df4a14ef8ed 100644 --- a/Distance_3/include/CGAL/Distance_3/Line_3_Plane_3.h +++ b/Distance_3/include/CGAL/Distance_3/Line_3_Plane_3.h @@ -61,26 +61,28 @@ squared_distance(const typename K::Plane_3& pl, return squared_distance(l, pl, k); } +template +inline typename K::Comparison_result +compare_squared_distance(const typename K::Line_3& l, + const typename K::Plane_3& pl, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(l, pl, k), d2); +} + +template +inline typename K::Comparison_result +compare_squared_distance(const typename K::Plane_3& pl, + const typename K::Line_3& l, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(l, pl, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Line_3& line, - const Plane_3& plane) -{ - return K().compute_squared_distance_3_object()(line, plane); -} - -template -inline -typename K::FT -squared_distance(const Plane_3& plane, - const Line_3& line) -{ - return K().compute_squared_distance_3_object()(plane, line); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_LINE_3_PLANE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Plane_3_Plane_3.h b/Distance_3/include/CGAL/Distance_3/Plane_3_Plane_3.h index d18fb366b7f..6331d938d82 100644 --- a/Distance_3/include/CGAL/Distance_3/Plane_3_Plane_3.h +++ b/Distance_3/include/CGAL/Distance_3/Plane_3_Plane_3.h @@ -39,17 +39,18 @@ squared_distance(const typename K::Plane_3& plane1, return sq_dist(plane1.point(), plane2); } -} // namespace internal - template -inline -typename K::FT -squared_distance(const Plane_3& plane1, - const Plane_3& plane2) +inline typename K::Comparison_result +compare_squared_distance(const typename K::Plane_3& plane1, + const typename K::Plane_3& plane2, + const K& k, + const typename K::FT& d2) { - return K().compute_squared_distance_3_object()(plane1, plane2); + return compare(squared_distance(plane1,plane2,k), d2); } +} // namespace internal + } // namespace CGAL #endif // CGAL_DISTANCE_3_PLANE_3_PLANE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Line_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Line_3.h index 0d1527c48a7..b265894c910 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Line_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Line_3.h @@ -66,26 +66,30 @@ squared_distance(const typename K::Line_3& line, return squared_distance(pt, line, k); } +template +inline +typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt, + const typename K::Line_3& line, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(pt, line, k), d2); +} + +template +inline +typename K::Comparison_result +compare_squared_distance(const typename K::Line_3& line, + const typename K::Point_3& pt, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(pt, line, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Point_3& pt, - const Line_3& line) -{ - return K().compute_squared_distance_3_object()(pt, line); -} - -template -inline -typename K::FT -squared_distance(const Line_3& line, - const Point_3& pt) -{ - return K().compute_squared_distance_3_object()(line, pt); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_POINT_3_LINE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Plane_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Plane_3.h index 7544a72d963..921b13a446f 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Plane_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Plane_3.h @@ -48,26 +48,26 @@ squared_distance(const typename K::Plane_3& plane, return squared_distance(pt, plane, k); } -} // namespace internal - template -inline -typename K::FT -squared_distance(const Point_3& pt, - const Plane_3& plane) +inline typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt, + const typename K::Plane_3& plane, + const K& k, + const typename K::FT& d2) { - return K().compute_squared_distance_3_object()(pt, plane); + return compare(squared_distance(pt, plane, k), d2); } template -inline -typename K::FT -squared_distance(const Plane_3& plane, - const Point_3& pt) +inline typename K::Comparison_result +compare_squared_distance(const typename K::Plane_3& plane, + const typename K::Point_3& pt, + const K& k, + const typename K::FT& d2) { - return K().compute_squared_distance_3_object()(plane, pt); + return compare_squared_distance(pt, plane, k, d2); } -} // namespace CGAL +} } // namespace CGAL::internal #endif // CGAL_DISTANCE_3_POINT_3_PLANE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Point_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Point_3.h index 6b307e571c7..4d7de336e31 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Point_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Point_3.h @@ -32,17 +32,19 @@ squared_distance(const typename K::Point_3& pt1, return k.compute_squared_distance_3_object()(pt1, pt2); } -} // namespace internal - template inline -typename K::FT -squared_distance(const Point_3& pt1, - const Point_3& pt2) +typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt1, + const typename K::Point_3& pt2, + const K& k, + const typename K::FT& d2) { - return internal::squared_distance(pt1, pt2, K()); + return compare(k.compute_squared_distance_3_object()(pt1, pt2), d2); } +} // namespace internal + } // namespace CGAL #endif // CGAL_DISTANCE_3_POINT_3_POINT_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Ray_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Ray_3.h index 7eff899b0eb..bb4195cbb75 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Ray_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Ray_3.h @@ -87,26 +87,28 @@ squared_distance(const typename K::Ray_3& ray, return squared_distance(pt, ray, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt, + const typename K::Ray_3& ray, + const K& k, + const typename K::FT &d2) +{ + return compare(squared_distance(pt, ray, k), d2); +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Ray_3& ray, + const typename K::Point_3& pt, + const K& k, + const typename K::FT &d2) +{ + return compare_squared_distance(pt, ray, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Point_3& pt, - const Ray_3& ray) -{ - return K().compute_squared_distance_3_object()(pt, ray); -} - -template -inline -typename K::FT -squared_distance(const Ray_3& ray, - const Point_3& pt) -{ - return K().compute_squared_distance_3_object()(ray, pt); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_POINT_3_RAY_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Segment_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Segment_3.h index 554c0a58d2d..07f79bfd912 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Segment_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Segment_3.h @@ -79,6 +79,7 @@ squared_distance(const typename K::Point_3& pt, typedef typename K::Vector_3 Vector_3; typename K::Construct_vector_3 vector = k.construct_vector_3_object(); + typename K::Compute_squared_distance_3 sq_dist = k.compute_squared_distance_3_object(); // assert that the segment is valid (non zero length). const Vector_3 diff = vector(seg.source(), pt); @@ -90,7 +91,7 @@ squared_distance(const typename K::Point_3& pt, const RT e = wdot(segvec, segvec, k); if(wmult((K*)0, d, segvec.hw()) > wmult((K*)0, e, diff.hw())) - return squared_distance(pt, seg.target(), k); + return sq_dist(pt, seg.target()); // This is an expanded call to squared_distance_to_line() to avoid recomputing 'e' const Vector_3 wcr = wcross(segvec, diff, k); @@ -108,26 +109,30 @@ squared_distance(const typename K::Segment_3& seg, return squared_distance(pt, seg, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt, + const typename K::Segment_3& seg, + const K& k, + const typename K::FT& d2) +{ + //Doing an early exit was slower. + return compare(squared_distance(pt, seg, k), d2); +} + +template +inline +typename K::Comparison_result +compare_squared_distance(const typename K::Segment_3& seg, + const typename K::Point_3& pt, + const K& k, + const typename K::FT &d2) +{ + return compare_squared_distance(pt, seg, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Point_3& pt, - const Segment_3& seg) -{ - return K().compute_squared_distance_3_object()(pt, seg); -} - -template -inline -typename K::FT -squared_distance(const Segment_3& seg, - const Point_3& pt) -{ - return K().compute_squared_distance_3_object()(seg, pt); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_POINT_3_SEGMENT_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Tetrahedron_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Tetrahedron_3.h index 04d148818a3..031a60a6650 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Tetrahedron_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Tetrahedron_3.h @@ -43,10 +43,28 @@ squared_distance(const typename K::Point_3& pt, const Point_3& t2 = vertex(tet, 2); const Point_3& t3 = vertex(tet, 3); - bool dmin_initialized = false; + Orientation ori_tet = orientation(t0,t1,t2,t3); + + if(ori_tet==COPLANAR){ + //Degen Tetrahedron + //Get the minimum of three triangles (no need to test the fourth) + bool inside = false; + typename K::FT dmin = squared_distance_to_triangle(pt, t0, t1, t2, k, inside); + if(inside) + return dmin; + typename K::FT d = squared_distance_to_triangle(pt, t0, t1, t3, k, inside); + if(inside) + return d; + dmin=(std::min)(d,dmin); + d = squared_distance_to_triangle(pt, t0, t2, t3, k, inside); + return (std::min)(d,dmin); + } + + bool dmin_initialized = false; //dmin_initialized and !on_bounded_side have always the samed value typename K::FT dmin; bool inside = false; - if(orientation(t0,t1,t2, pt) == NEGATIVE) + + if(orientation(pt, t0,t1,t2) == ori_tet) { on_bounded_side = false; dmin = squared_distance_to_triangle(pt, t0, t1, t2, k, inside); @@ -55,7 +73,7 @@ squared_distance(const typename K::Point_3& pt, return dmin; } - if(orientation(t0,t3,t1, pt) == NEGATIVE) + if(orientation(pt, t0,t3,t1) == ori_tet) { on_bounded_side = false; const typename K::FT d = squared_distance_to_triangle(pt, t0, t3, t1, k, inside); @@ -73,7 +91,7 @@ squared_distance(const typename K::Point_3& pt, } } - if(orientation(t1,t3,t2, pt) == NEGATIVE) + if(orientation(pt, t1,t3,t2) == ori_tet) { on_bounded_side = false; const typename K::FT d = squared_distance_to_triangle(pt, t1, t3, t2, k, inside); @@ -91,7 +109,7 @@ squared_distance(const typename K::Point_3& pt, } } - if(orientation(t2,t3,t0, pt) == NEGATIVE) + if(orientation(pt, t2,t3,t0) == ori_tet) { on_bounded_side = false; const typename K::FT d = squared_distance_to_triangle(pt, t2, t3, t0, k, inside); @@ -125,24 +143,100 @@ squared_distance(const typename K::Tetrahedron_3& tet, return squared_distance(pt, tet, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt, + const typename K::Tetrahedron_3& tet, + const K& k, + const typename K::FT& d2) +{ + typedef typename K::Point_3 Point_3; + + typename K::Construct_vertex_3 vertex = k.construct_vertex_3_object(); + typename K::Orientation_3 orientation = k.orientation_3_object(); + + /* The content of this function is very similar with the one above, the difference is we can exit earlier if + we found a triangle closer than d or plane farther than d since we do not need the exact distance. + (there are also early exits in calling functions) */ + + bool on_bounded_side = true; + bool inside_or_far_to_the_plane = false; + const Point_3& t0 = vertex(tet, 0); + const Point_3& t1 = vertex(tet, 1); + const Point_3& t2 = vertex(tet, 2); + const Point_3& t3 = vertex(tet, 3); + + Orientation ori_tet = orientation(t0,t1,t2,t3); + + if(ori_tet==COPLANAR){ + //Degen Tetrahedron + //Get the minimum of three triangles (no need to test the fourth) + typename K::Comparison_result res = compare_squared_distance_to_triangle(pt, t0, t1, t2, k, d2, inside_or_far_to_the_plane); + if(inside_or_far_to_the_plane) + return res; + typename K::Comparison_result temp_res = compare_squared_distance_to_triangle(pt, t0, t1, t3, k, d2, inside_or_far_to_the_plane); + if(inside_or_far_to_the_plane) + return temp_res; + res=smaller_of(res,temp_res); + temp_res = compare_squared_distance_to_triangle(pt, t0, t2, t3, k, d2, inside_or_far_to_the_plane); + return smaller_of(res,temp_res); + } + + typename K::Comparison_result res=LARGER; + if(orientation(pt, t0,t1,t2) == ori_tet) + { + on_bounded_side = false; + res = compare_squared_distance_to_triangle(pt, t0, t1, t2, k, d2, inside_or_far_to_the_plane); + if(inside_or_far_to_the_plane || res==SMALLER) + return res; + } + + if(orientation(pt, t0,t3,t1) == ori_tet) + { + on_bounded_side = false; + const typename K::Comparison_result temp_res = compare_squared_distance_to_triangle(pt, t0, t3, t1, k, d2, inside_or_far_to_the_plane); + if(inside_or_far_to_the_plane || temp_res==SMALLER) + return temp_res; + res = smaller_of(res, temp_res); + } + + if(orientation(pt, t1,t3,t2) == ori_tet) + { + on_bounded_side = false; + const typename K::Comparison_result temp_res = compare_squared_distance_to_triangle(pt, t1, t3, t2, k, d2, inside_or_far_to_the_plane); + if(inside_or_far_to_the_plane || temp_res==SMALLER) + return temp_res; + res = smaller_of(res, temp_res); + } + + if(orientation(pt, t2,t3,t0) == ori_tet) + { + on_bounded_side = false; + const typename K::Comparison_result temp_res = compare_squared_distance_to_triangle(pt, t2, t3, t0, k, d2, inside_or_far_to_the_plane); + if(inside_or_far_to_the_plane || temp_res==SMALLER) + return temp_res; + res = smaller_of(res, temp_res); + } + + if(on_bounded_side) + return compare(typename K::FT(0),d2); + + return res; +} + +template +inline +typename K::Comparison_result +compare_squared_distance(const typename K::Tetrahedron_3& tet, + const typename K::Point_3& pt, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(pt, tet, k, d2); +} + } // namespace internal -template -typename K::FT -squared_distance(const Tetrahedron_3& tet, - const Point_3& pt) -{ - return K().compute_squared_distance_3_object()(tet, pt); -} - -template -typename K::FT -squared_distance(const Point_3& pt, - const Tetrahedron_3& tet) -{ - return K().compute_squared_distance_3_object()(pt, tet); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_POINT_3_TETRAHEDRON_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Point_3_Triangle_3.h b/Distance_3/include/CGAL/Distance_3/Point_3_Triangle_3.h index 8b58e9a81a6..94c2f836990 100644 --- a/Distance_3/include/CGAL/Distance_3/Point_3_Triangle_3.h +++ b/Distance_3/include/CGAL/Distance_3/Point_3_Triangle_3.h @@ -69,7 +69,7 @@ squared_distance_to_triangle_RT(const typename K::Point_3& pt, if(normal == NULL_VECTOR) { // The case normal==NULL_VECTOR covers the case when the triangle - // is colinear, or even more degenerate. In that case, we can + // is collinear, or even more degenerate. In that case, we can // simply take also the distance to the three segments. squared_distance_RT(pt, segment(t2, t0), num, den, k); @@ -206,7 +206,7 @@ squared_distance_to_triangle(const typename K::Point_3& pt, if(normal == NULL_VECTOR) { // The case normal == NULL_VECTOR covers the case when the triangle - // is colinear, or even more degenerate. In that case, we can + // is collinear, or even more degenerate. In that case, we can // simply take also the distance to the three segments. // // Note that in the degenerate case, at most 2 edges cover the full triangle, @@ -292,26 +292,140 @@ squared_distance(const typename K::Triangle_3& t, return squared_distance(pt, t, k); } +template +typename K::Comparison_result +compare_squared_distance_to_triangle(const typename K::Point_3& pt, + const typename K::Point_3& t0, + const typename K::Point_3& t1, + const typename K::Point_3& t2, + const K& k, + const typename K::FT &d2, + bool& inside_or_far_to_the_plane) +{ + typedef typename K::Vector_3 Vector_3; + + typename K::Construct_segment_3 segment = k.construct_segment_3_object(); + typename K::Construct_vector_3 vector = k.construct_vector_3_object(); + typename K::Compare_squared_distance_3 csq_dist = k.compare_squared_distance_3_object(); + + /* The content of this function is very similar with the one above, the difference is we can exit earlier if + we found a segment closer than d or if the point is farther than d to the plane since we do not need the exact distance */ + + const Vector_3 e1 = vector(t0, t1); + const Vector_3 oe3 = vector(t0, t2); + const Vector_3 normal = wcross(e1, oe3, k); + + if(normal == NULL_VECTOR) + { + // The case normal == NULL_VECTOR covers the case when the triangle + // is collinear, or even more degenerate. In that case, we can + // simply take also the distance to the three segments. + // + // Note that in the degenerate case, at most 2 edges cover the full triangle, + // and only two distances could be used + typename K::Comparison_result res1 = csq_dist(pt, segment(t2, t0), d2); + if(certainly(res1 == SMALLER)) + return SMALLER; + typename K::Comparison_result res2 = csq_dist(pt, segment(t1, t2), d2); + return smaller_of(res1,res2); + } + + // Compare first the distance to the plane, if larger we can exit early + typename K::Comparison_result res_p_pl = compare(squared_distance_to_plane(normal, vector(t0, pt), k), d2); + if(certainly(res_p_pl==LARGER)) + { + inside_or_far_to_the_plane=true; + return LARGER; + } + + //If we are smaller when compare to a segment, we can exit early + if(!on_left_of_triangle_edge(pt, normal, t0, t1, k)) + { + typename K::Comparison_result res_p_s1 = csq_dist(pt, segment(t0, t1), d2); + if(certainly(res_p_s1==SMALLER)) + return SMALLER; + if(!on_left_of_triangle_edge(pt, normal, t1, t2, k)) + { + // can't be to the right of all three segments + typename K::Comparison_result res_p_s2 = csq_dist(pt, segment(t1, t2), d2); + return smaller_of(res_p_s1, res_p_s2); + } + else // on_left_of_triangle_edge(pt, normal, t1, t2, k) + { + if(!on_left_of_triangle_edge(pt, normal, t2, t0, k)) + { + typename K::Comparison_result res_p_s3 = csq_dist(pt, segment(t2, t0), d2); + return smaller_of(res_p_s1, res_p_s3); + } + else // on_left_of_triangle_edge(pt, normal, t2, t0, k) + { + return res_p_s1; + } + } + } + else // on_left_of_triangle_edge(pt, normal, t0, t1, k) + { + if(!on_left_of_triangle_edge(pt, normal, t1, t2, k)) + { + typename K::Comparison_result res_p_s2 = csq_dist(pt, segment(t1, t2), d2); + if(certainly(res_p_s2 == SMALLER)) + return SMALLER; + if(!on_left_of_triangle_edge(pt, normal, t2, t0, k)) + { + typename K::Comparison_result res_p_s3 = csq_dist(pt, segment(t2, t0), d2); + return smaller_of(res_p_s2, res_p_s3); + } + else // on_left_of_triangle_edge(pt, normal, t2, t0, k) + { + return res_p_s2; + } + } + else // on_left_of_triangle_edge(pt, normal, t1, t2, k) + { + if(!on_left_of_triangle_edge(pt, normal, t2, t0, k)) + { + return csq_dist(pt, segment(t2, t0), d2); + } + else // on_left_of_triangle_edge(pt, normal, t2, t0, k) + { + inside_or_far_to_the_plane = true; + return res_p_pl; + } + } + } +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Point_3& pt, + const typename K::Triangle_3& t, + const K& k, + const typename K::FT& d2) +{ + typename K::Construct_vertex_3 vertex = k.construct_vertex_3_object(); + + bool unused_inside_or_far_to_the_plane = false; + return compare_squared_distance_to_triangle(pt, + vertex(t, 0), + vertex(t, 1), + vertex(t, 2), + k, + d2, + unused_inside_or_far_to_the_plane); +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Triangle_3& t, + const typename K::Point_3& pt, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(pt, t, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Point_3& pt, - const Triangle_3& t) -{ - return K().compute_squared_distance_3_object()(pt, t); -} - -template -inline -typename K::FT -squared_distance(const Triangle_3& t, - const Point_3& pt) -{ - return K().compute_squared_distance_3_object()(t, pt); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_POINT_3_TRIANGLE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Ray_3_Line_3.h b/Distance_3/include/CGAL/Distance_3/Ray_3_Line_3.h index d4b51b59cbe..ed431f63128 100644 --- a/Distance_3/include/CGAL/Distance_3/Ray_3_Line_3.h +++ b/Distance_3/include/CGAL/Distance_3/Ray_3_Line_3.h @@ -77,26 +77,28 @@ squared_distance(const typename K::Line_3& line, return squared_distance(ray, line, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Ray_3& ray, + const typename K::Line_3& line, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(ray, line, k), d2); +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Line_3& line, + const typename K::Ray_3& ray, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(ray, line, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Line_3& line, - const Ray_3& ray) -{ - return K().compute_squared_distance_3_object()(line, ray); -} - -template -inline -typename K::FT -squared_distance(const Ray_3& ray, - const Line_3& line) -{ - return K().compute_squared_distance_3_object()(ray, line); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_RAY_3_LINE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Ray_3_Plane_3.h b/Distance_3/include/CGAL/Distance_3/Ray_3_Plane_3.h index bdc9a956146..eb2a4810a32 100644 --- a/Distance_3/include/CGAL/Distance_3/Ray_3_Plane_3.h +++ b/Distance_3/include/CGAL/Distance_3/Ray_3_Plane_3.h @@ -72,26 +72,28 @@ squared_distance(const typename K::Plane_3& plane, return squared_distance(ray, plane, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Ray_3& ray, + const typename K::Plane_3& plane, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(ray, plane, k), d2); +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Plane_3& plane, + const typename K::Ray_3& ray, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(ray, plane, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Ray_3& ray, - const Plane_3& plane) -{ - return K().compute_squared_distance_3_object()(ray, plane); -} - -template -inline -typename K::FT -squared_distance(const Plane_3& plane, - const Ray_3& ray) -{ - return K().compute_squared_distance_3_object()(plane, ray); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_RAY_3_PLANE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Ray_3_Ray_3.h b/Distance_3/include/CGAL/Distance_3/Ray_3_Ray_3.h index 8ca1eca308c..9367e095e92 100644 --- a/Distance_3/include/CGAL/Distance_3/Ray_3_Ray_3.h +++ b/Distance_3/include/CGAL/Distance_3/Ray_3_Ray_3.h @@ -117,6 +117,16 @@ squared_distance(const typename K::Ray_3& ray1, } } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Ray_3& ray1, + const typename K::Ray_3& ray2, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(ray1, ray2, k), d2); +} + } // namespace internal template @@ -129,15 +139,6 @@ ray_ray_squared_distance_parallel(const Vector_3& ray1dir, return internal::ray_ray_squared_distance_parallel(ray1dir, ray2dir, s1_min_s2, K()); } -template -inline -typename K::FT -squared_distance(const Ray_3& ray1, - const Ray_3& ray2) -{ - return K().compute_squared_distance_3_object()(ray1, ray2); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_RAY_3_RAY_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Segment_3_Line_3.h b/Distance_3/include/CGAL/Distance_3/Segment_3_Line_3.h index 5781c5ceb74..f5d3336b5d6 100644 --- a/Distance_3/include/CGAL/Distance_3/Segment_3_Line_3.h +++ b/Distance_3/include/CGAL/Distance_3/Segment_3_Line_3.h @@ -38,6 +38,8 @@ squared_distance(const typename K::Segment_3& seg, typename K::Construct_vector_3 vector = k.construct_vector_3_object(); typename K::Compute_squared_distance_3 sq_dist = k.compute_squared_distance_3_object(); + //Probably writable with less if than currently + const Point_3& linepoint = line.point(); const Point_3& start = seg.source(); const Point_3& end = seg.target(); @@ -60,26 +62,12 @@ squared_distance(const typename K::Segment_3& seg, const RT sdm_ss2l = wdot(perpend2line, start_min_lp, k); const RT sdm_se2l = wdot(perpend2line, end_min_lp, k); - if(sdm_ss2l < RT(0)) { - crossing = (sdm_se2l >= RT(0)); - } else { - if(sdm_se2l <= RT(0)) { - crossing = true; - } else { - crossing = (sdm_ss2l == RT(0)); - } - } + crossing = (sdm_ss2l*sdm_se2l) <= RT(0); - if(crossing) { + if(crossing) return squared_distance_to_plane(normal, start_min_lp, k); - } else { - const RT dm = distance_measure_sub(sdm_ss2l, sdm_se2l, start_min_lp, end_min_lp, k); - if(dm <= RT(0)) { - return squared_distance_to_line(linedir, start_min_lp, k); - } else { - return squared_distance_to_line(linedir, end_min_lp, k); - } - } + else + return min(squared_distance_to_line(linedir, start_min_lp, k), squared_distance_to_line(linedir, end_min_lp, k)); } template @@ -91,25 +79,29 @@ squared_distance(const typename K::Line_3& line, return squared_distance(seg, line, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Segment_3& seg, + const typename K::Line_3& line, + const K& k, + const typename K::FT& d2) +{ + // Perform an early exit was slower + return compare(squared_distance(seg, line, k), d2); +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Line_3& line, + const typename K::Segment_3& seg, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(seg, line, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Segment_3& seg, - const Line_3& line) -{ - return K().compute_squared_distance_3_object()(seg, line); -} - -template -inline -typename K::FT -squared_distance(const Line_3& line, - const Segment_3& seg) -{ - return K().compute_squared_distance_3_object()(line, seg); -} } // namespace CGAL diff --git a/Distance_3/include/CGAL/Distance_3/Segment_3_Plane_3.h b/Distance_3/include/CGAL/Distance_3/Segment_3_Plane_3.h index 1c8d6799556..4b46049940c 100644 --- a/Distance_3/include/CGAL/Distance_3/Segment_3_Plane_3.h +++ b/Distance_3/include/CGAL/Distance_3/Segment_3_Plane_3.h @@ -37,12 +37,13 @@ squared_distance(const typename K::Segment_3 &seg, typedef typename K::Point_3 Point_3; typename K::Construct_vector_3 vector = k.construct_vector_3_object(); + typename K::Compute_squared_distance_3 sq_dist = k.compute_squared_distance_3_object(); const Point_3& start = seg.start(); const Point_3& end = seg.end(); if (start == end) - return squared_distance(start, plane, k); + return sq_dist(start, plane); const Point_3& planepoint = plane.point(); const Vector_3 start_min_pp = vector(planepoint, start); @@ -83,26 +84,28 @@ squared_distance(const typename K::Plane_3& plane, return squared_distance(seg, plane, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Segment_3 &seg, + const typename K::Plane_3 &plane, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(seg, plane, k), d2); +} + +template +inline typename K::Comparison_result +compare_squared_distance(const typename K::Plane_3& plane, + const typename K::Segment_3& seg, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(seg, plane, k, d2); +} + } // namespace internal -template -inline -typename K::FT -squared_distance(const Segment_3& seg, - const Plane_3& plane) -{ - return K().compute_squared_distance_3_object()(seg, plane); -} - -template -inline -typename K::FT -squared_distance(const Plane_3& plane, - const Segment_3& seg) -{ - return K().compute_squared_distance_3_object()(plane, seg); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_SEGMENT_3_PLANE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Segment_3_Ray_3.h b/Distance_3/include/CGAL/Distance_3/Segment_3_Ray_3.h index 5943630d76f..d35fda6d08b 100644 --- a/Distance_3/include/CGAL/Distance_3/Segment_3_Ray_3.h +++ b/Distance_3/include/CGAL/Distance_3/Segment_3_Ray_3.h @@ -73,6 +73,8 @@ squared_distance(const typename K::Segment_3& seg, const Point_3& ss = seg.source(); const Point_3& se = seg.target(); + //TODO This seems complicated compared to Segment_3_Segment_3.h. Consider improving by adapting Lumelsky's method for segment-segment intersection. + if(ss == se) return sq_dist(ss, ray); @@ -166,6 +168,26 @@ squared_distance(const typename K::Ray_3& ray, return squared_distance(seg, ray, k); } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Ray_3& ray, + const typename K::Segment_3& seg, + const K& k, + const typename K::FT& d2) +{ + return compare(squared_distance(ray, seg, k), d2); +} + +template +typename K::Comparison_result +compare_squared_distance(const typename K::Segment_3& seg, + const typename K::Ray_3& ray, + const K& k, + const typename K::FT& d2) +{ + return compare_squared_distance(ray, seg, k, d2); +} + } // namespace internal template @@ -177,24 +199,6 @@ squared_distance_parallel(const Segment_3& seg, return internal::squared_distance_parallel(ray, seg, K()); } -template -inline -typename K::FT -squared_distance(const Segment_3& seg, - const Ray_3& ray) -{ - return K().compute_squared_distance_3_object()(seg, ray); -} - -template -inline -typename K::FT -squared_distance(const Ray_3& ray, - const Segment_3& seg) -{ - return K().compute_squared_distance_3_object()(ray, seg); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_SEGMENT_3_RAY_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Segment_3_Segment_3.h b/Distance_3/include/CGAL/Distance_3/Segment_3_Segment_3.h index ad933787204..8967e982a79 100644 --- a/Distance_3/include/CGAL/Distance_3/Segment_3_Segment_3.h +++ b/Distance_3/include/CGAL/Distance_3/Segment_3_Segment_3.h @@ -59,14 +59,6 @@ squared_distance(const typename K::Segment_3& s1, const Vector_3 v1 = cv(p1, q1), v2 = cv(p2, q2); const Vector_3 p1p2 = cv(p1, p2); - // @todo compute these only when needed? - const FT a = sp(v1, v1); - const FT b = - sp(v1, v2); - const FT c = - b; - const FT d = - sp(v2, v2); - const FT e = sp(v1, p1p2); - const FT f = sp(v2, p1p2); - if(p1 == q1) { if(p2 == q2) @@ -77,6 +69,9 @@ squared_distance(const typename K::Segment_3& s1, return res; } + const FT d = - sp(v2, v2); + const FT f = sp(v2, p1p2); + CGAL_assertion(d < 0); res.x = 0; @@ -87,6 +82,9 @@ squared_distance(const typename K::Segment_3& s1, } else if(p2 == q2) { + const FT a = sp(v1, v1); + const FT e = sp(v1, p1p2); + CGAL_assertion(a > 0); res.y = 0; @@ -96,10 +94,17 @@ squared_distance(const typename K::Segment_3& s1, return res; } + const FT a = sp(v1, v1); + const FT b = - sp(v1, v2); + const FT c = - b; + const FT d = - sp(v2, v2); + const FT e = sp(v1, p1p2); + const FT f = sp(v2, p1p2); + CGAL_assertion(a > 0 && d < 0); const FT det = a*d - b*c; - if(det == 0) + if(is_zero(det)) res.x = 0; else res.x = boost::algorithm::clamp((e*d - b*f) / det, 0, 1); @@ -183,26 +188,102 @@ squared_distance(const typename K::Segment_3& seg1, return res.squared_distance; } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Segment_3& s1, + const typename K::Segment_3& s2, + const K& k, + const typename K::FT& d2) +{ + typedef typename K::FT FT; + typedef typename K::Point_3 Point_3; + typedef typename K::Vector_3 Vector_3; + + typename K::Construct_vertex_3 vertex = k.construct_vertex_3_object(); + typename K::Construct_vector_3 cv = k.construct_vector_3_object(); + typename K::Compute_scalar_product_3 sp = k.compute_scalar_product_3_object(); + typename K::Compute_squared_distance_3 sq_dist = k.compute_squared_distance_3_object(); + typename K::Compare_squared_distance_3 csq_dist = k.compare_squared_distance_3_object(); + + /* The content of this function is very similar with the one above, the difference is we can exit earlier if + the supporting line are farther than d since we do not need the exact distance. */ + +#if 1 + const Point_3& p1 = vertex(s1, 0); + const Point_3& q1 = vertex(s1, 1); + const Point_3& p2 = vertex(s2, 0); + const Point_3& q2 = vertex(s2, 1); + const Vector_3 v1 = cv(p1, q1), v2 = cv(p2, q2); + const Vector_3 p1p2 = cv(p1, p2); + + // If degenerate segment, compare the distance between the point and the other segment + if(p1 == q1) + if(p2 == q2) + return csq_dist(p1,p2,d2); + else + return csq_dist(p1,s2,d2); + else if(p2 == q2) + return csq_dist(s1,p2,d2); + + // Compare first the distance between the lines, if larger we can exit early + typename K::Comparison_result res_ll=csq_dist(s1.supporting_line(), s2.supporting_line(), d2); + if(certainly(res_ll==LARGER)) + return LARGER; + + // Compute the distance between the segments + // TODO some factorization with above function? only the last case is different + + const FT a = sp(v1, v1); + const FT b = - sp(v1, v2); + const FT c = - b; + const FT d = - sp(v2, v2); + const FT e = sp(v1, p1p2); + const FT f = sp(v2, p1p2); + + CGAL_assertion(a > 0 && d < 0); + const FT det = a*d - b*c; + FT res_x; + if(is_zero(det)) + res_x = 0; + else + res_x = boost::algorithm::clamp((e*d - b*f) / det, 0, 1); + + FT xc = res_x*c; + // res.y = (f - xc) / d, by definition, but building it up more efficiently + if(f > xc) // y < 0 <=> f - xc / d < 0 <=> f - xc > 0 (since d is -||v2||) + { + // res_y = 0; + res_x = boost::algorithm::clamp(e/a, 0, 1); // (e + y*c) / a + return compare(sq_dist(p1+res_x*v1,p2), d2); + } + else // y >= 0 + { + FT n = f - xc; // delay the division by d + if(n < d) // y > 1 <=> n / d > 1 <=> n < d (once again, important to note that d is negative!) + { + // res_y = 1; + res_x = boost::algorithm::clamp((e + c) / a, 0, 1); // (e + y*c) / a + return compare(sq_dist(p1+res_x*v1,p2+v2), d2); + } + else if(res_x==0 || res_x==1) // 0 <= y <= 1 + { + FT res_y = n / d; + return compare(sq_dist(p1 + res_x*v1, p2 + res_y*v2), d2); + } + else + { + //Already computed by distance line line + return res_ll; + } + } +#else + // Faster with Simple_cartesian, a bit slower with EPICK or EPECK specifically if d2 is small + return compare(squared_distance(s1, s2 ,k), d2); +#endif +} + } // namespace internal -template -inline -typename K::FT -squared_distance_parallel(const Segment_3& seg1, - const Segment_3& seg2) -{ - return internal::squared_distance_parallel(seg1, seg2, K()); -} - -template -inline -typename K::FT -squared_distance(const Segment_3& seg1, - const Segment_3& seg2) -{ - return K().compute_squared_distance_3_object()(seg1, seg2); -} - } // namespace CGAL #endif // CGAL_DISTANCE_3_SEGMENT_3_SEGMENT_3_H diff --git a/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h b/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h index 73f4b0eb69c..9bf27fb6c2a 100644 --- a/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h +++ b/Distance_3/include/CGAL/Distance_3/Triangle_3_Triangle_3.h @@ -207,23 +207,71 @@ squared_distance(const typename K::Triangle_3& tr1, FT sqd_q2 = CGAL::squared_distance(vertex(tr2, 1), tr1); FT sqd_r2 = CGAL::squared_distance(vertex(tr2, 2), tr1); - const FT m = std::min({sqd_p1, sqd_q1, sqd_r1, sqd_p2, sqd_q2, sqd_r2}); + const FT m = (std::min)({sqd_p1, sqd_q1, sqd_r1, sqd_p2, sqd_q2, sqd_r2}); return m; #endif } -} // namespace internal - -template -inline -typename K::FT -squared_distance(const Triangle_3& tr1, - const Triangle_3& tr2) +template +typename K::Comparison_result +compare_squared_distance_disjoint(const typename K::Triangle_3& tr1, + const typename K::Triangle_3& tr2, + const K& k, + const typename K::FT& d2) { - return K().compute_squared_distance_3_object()(tr1, tr2); + typedef typename K::Segment_3 Segment_3; + + typename K::Construct_vertex_3 vertex = k.construct_vertex_3_object(); + typename K::Compare_squared_distance_3 csq_dist = k.compare_squared_distance_3_object(); + + typename K::Comparison_result res(LARGER); + + // The tiangle are supposed to be disjoint + assert(!do_intersect(tr1, tr2)); + + for(int i=0; i<3; ++i) + { + //Compare the distance between edges + for(int j=0; j<3; ++j) + { + typename K::Comparison_result temp_res_ss=csq_dist(Segment_3(vertex(tr1, i%3), vertex(tr1, (i+1)%3)),Segment_3(vertex(tr2, j%3), vertex(tr2, (j+1)%3)),d2); + if(certainly(temp_res_ss==SMALLER)) + return SMALLER; + res=smaller_of(res, temp_res_ss); + } + + //Compare the distance between vertices and triangles + typename K::Comparison_result temp_res_v_pl= csq_dist(vertex(tr1, i), tr2,d2); + if(certainly(temp_res_v_pl==SMALLER)) + return SMALLER; + res=smaller_of(res, temp_res_v_pl); + + temp_res_v_pl= csq_dist(vertex(tr2, i), tr1,d2); + if(certainly(temp_res_v_pl==SMALLER)) + return SMALLER; + res=smaller_of(res, temp_res_v_pl); + } + return res; + } +template +typename K::Comparison_result +compare_squared_distance(const typename K::Triangle_3& tr1, + const typename K::Triangle_3& tr2, + const K& k, + const typename K::FT& d2){ + //TODO did something more intelligent (sq_dist and csq_dist does not exist for Segment-Triangle) + if(tr1.is_degenerate() || tr2.is_degenerate()) + return compare(squared_distance(tr1,tr2, k), d2); + if(do_intersect(tr1, tr2)) + return compare(typename K::FT(0), d2); + return compare_squared_distance_disjoint(tr1, tr2, k, d2); +} + +} // namespace internal + } // namespace CGAL #endif // CGAL_DISTANCE_3_TRIANGLE_3_TRIANGLE_3_H diff --git a/Distance_3/include/CGAL/Distance_3/internal/squared_distance_utils_3.h b/Distance_3/include/CGAL/Distance_3/internal/squared_distance_utils_3.h index 7dbf82e246e..260301cf8b1 100644 --- a/Distance_3/include/CGAL/Distance_3/internal/squared_distance_utils_3.h +++ b/Distance_3/include/CGAL/Distance_3/internal/squared_distance_utils_3.h @@ -23,9 +23,35 @@ #include #include +#include + namespace CGAL { namespace internal { +inline +Comparison_result smaller_of(const Comparison_result& a, const Comparison_result& b) +{ + return (std::min)(a,b); +} + +inline +Uncertain smaller_of(const Uncertain& a, const Uncertain& b) +{ + return Uncertain((std::min)(a.inf(),b.inf()), (std::min)(a.sup(),b.sup())); +} + +inline +Uncertain smaller_of(const Uncertain& a, const Comparison_result& b) +{ + return smaller_of(a,make_uncertain(b)); +} + +inline +Uncertain smaller_of(const Comparison_result& a, const Uncertain& b) +{ + return smaller_of(make_uncertain(a),b); +} + template bool is_null(const typename K::Vector_3 &v, const K&) { @@ -39,7 +65,10 @@ wdot(const typename K::Vector_3 &u, const typename K::Vector_3 &v, const K&) { - return (u.hx()*v.hx() + u.hy()*v.hy() + u.hz()*v.hz()); + if constexpr(std::is_same_v) + return std::fma(u.hx(), v.hx(), std::fma(u.hy(), v.hy(), u.hz()*v.hz())); + else + return (u.hx()*v.hx() + u.hy()*v.hy() + u.hz()*v.hz()); } template @@ -84,6 +113,26 @@ wdot(const typename K::Point_3 &p, return wdot_tag(p, q, r, k, tag); } +inline +double diff_of_products(const double a, const double b, const double c, const double d) +{ +// Kahan method, less numerical error +#if 1 + double w = d * c; + double e = std::fma(c, -d, w); + double f = std::fma(a, b, -w); + return f + e; +#else + return std::fma(a, b, -c*d); +#endif +} + +template +OFT diff_of_products(const OFT& a, const OFT& b, const OFT& c, const OFT& d, std::enable_if_t>* = 0) +{ + return a*b - c*d; +} + template typename K::Vector_3 wcross(const typename K::Vector_3 &u, @@ -92,9 +141,9 @@ wcross(const typename K::Vector_3 &u, { typedef typename K::Vector_3 Vector_3; return Vector_3( - u.hy()*v.hz() - u.hz()*v.hy(), - u.hz()*v.hx() - u.hx()*v.hz(), - u.hx()*v.hy() - u.hy()*v.hx()); + diff_of_products(u.hy(),v.hz(),u.hz(),v.hy()), + diff_of_products(u.hz(),v.hx(),u.hx(),v.hz()), + diff_of_products(u.hx(),v.hy(),u.hy(),v.hx())); } template @@ -221,6 +270,16 @@ squared_distance_to_line(const typename K::Vector_3& dir, return Rational_traits().make_rational(num, den); } +template +typename K::Comparison_result +compare_squared_distance_to_line(const typename K::Vector_3& dir, + const typename K::Vector_3& diff, + const K& k, + const typename K::FT &d2) +{ + return compare(squared_distance_to_line(dir,diff,k),d2); +} + template inline bool diff --git a/Distance_3/include/CGAL/global_functions_distance_3.h b/Distance_3/include/CGAL/global_functions_distance_3.h new file mode 100644 index 00000000000..388867ae697 --- /dev/null +++ b/Distance_3/include/CGAL/global_functions_distance_3.h @@ -0,0 +1,109 @@ +// Copyright (c) 2025 +// GeometryFactory (France), +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Léo Valque + +#ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_DISTANCE_3_H +#define CGAL_KERNEL_GLOBAL_FUNCTIONS_DISTANCE_3_H + +// Distance functions calling the kernel functor. + +#define CGAL_SQUARED_DISTANCE_FUNCTION(A, B) \ +template \ +inline \ +typename K::FT \ +squared_distance(const A& a, const B& b) \ +{ \ + return K().compute_squared_distance_3_object()(a, b); \ +} \ +template \ +inline \ +typename K::FT \ +squared_distance(const B& a, const A& b) \ +{ \ + return K().compute_squared_distance_3_object()(b, a); \ +} + +#define CGAL_SQUARED_DISTANCE_FUNCTION_SELF(A) \ +template \ +inline \ +typename K::FT \ +squared_distance(const A& a, const A& b) \ +{ \ + return K().compute_squared_distance_3_object()(a, b); \ +} + +#define CGAL_COMPARE_SQUARED_DISTANCE_FUNCTION(A, B) \ +template \ +inline \ +typename K::Comparison_result \ +compare_squared_distance(const A& a, \ + const B& b, \ + const typename K::FT& d2) \ +{ \ + return K().compare_squared_distance_3_object()(a, b, d2); \ +} \ +template \ +inline \ +typename K::Comparison_result \ +compare_squared_distance(const B& b, \ + const A& a, \ + const typename K::FT& d2) \ +{ \ + return K().compare_squared_distance_3_object()(b, a, d2); \ +} + +#define CGAL_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(A) \ +template \ +inline \ +typename K::Comparison_result \ +compare_squared_distance(const A& a, \ + const A& b, \ + const typename K::FT& d2) \ +{ \ + return K().compare_squared_distance_3_object()(a, b, d2); \ +} + +#define CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(A) \ +CGAL_SQUARED_DISTANCE_FUNCTION_SELF(A) \ +CGAL_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(A) + +#define CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(A, B) \ +CGAL_SQUARED_DISTANCE_FUNCTION(A, B) \ +CGAL_COMPARE_SQUARED_DISTANCE_FUNCTION(A, B) + +namespace CGAL { + +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(Point_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(Line_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(Ray_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(Segment_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(Triangle_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION_SELF(Plane_3) + +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Point_3, Line_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Point_3, Ray_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Point_3, Segment_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Point_3, Plane_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Point_3, Triangle_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Point_3, Tetrahedron_3) + +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Line_3, Plane_3) + +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Ray_3, Line_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Ray_3, Plane_3) + +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Segment_3, Line_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Segment_3, Ray_3) +CGAL_COMPUTE_AND_COMPARE_SQUARED_DISTANCE_FUNCTION(Segment_3, Plane_3) + +} //namespace CGAL + +#endif // CGAL_KERNEL_GLOBAL_FUNCTIONS_DISTANCE_3_H diff --git a/Distance_3/include/CGAL/squared_distance_3.h b/Distance_3/include/CGAL/squared_distance_3.h index 69436bbe6dc..f2e51c4b51f 100644 --- a/Distance_3/include/CGAL/squared_distance_3.h +++ b/Distance_3/include/CGAL/squared_distance_3.h @@ -20,9 +20,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -45,4 +45,6 @@ #include +#include + #endif // CGAL_DISTANCE_3_H diff --git a/Distance_3/test/Distance_3/CMakeLists.txt b/Distance_3/test/Distance_3/CMakeLists.txt index 9d4d21a31ec..0bdc29865c1 100644 --- a/Distance_3/test/Distance_3/CMakeLists.txt +++ b/Distance_3/test/Distance_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Distance_3_Tests) find_package(CGAL REQUIRED) diff --git a/Distance_3/test/Distance_3/test_compare_distance_3.cpp b/Distance_3/test/Distance_3/test_compare_distance_3.cpp new file mode 100644 index 00000000000..fbf0ecb32b4 --- /dev/null +++ b/Distance_3/test/Distance_3/test_compare_distance_3.cpp @@ -0,0 +1,785 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +// #define CGAL_USE_GTE_AS_SANITY_CHECK +#ifdef CGAL_USE_GTE_AS_SANITY_CHECK +#include +#include +#endif + +#include +#include + +struct randomint +{ + randomint() ; + int get() const { return sequence[cur]; } + int next() { + cur = (cur + 1) % 11; + return get(); + } + +private: + int sequence[11]; + int cur; +}; + +inline randomint::randomint() +{ + cur = 0; + sequence[0] = 19; + sequence[1] = 5; + sequence[2] = 17; + sequence[3] = 13; + sequence[4] = 29; + sequence[5] = 2; + sequence[6] = 23; + sequence[7] = 31; + sequence[8] = 3; + sequence[9] = 37; + sequence[10] = 11; +} + +randomint ri; + +template +struct Test +{ + typedef typename K::RT RT; + typedef typename K::FT FT; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_3 P; + typedef typename K::Segment_3 S; + typedef typename K::Vector_3 V; + typedef typename K::Ray_3 R; + typedef typename K::Line_3 L; + typedef typename K::Triangle_3 T; + typedef typename K::Plane_3 Pl; + typedef typename K::Tetrahedron_3 Tet; + typedef typename K::Iso_cuboid_3 Cub; + +private: + CGAL::Random& r; + const double epsilon = 1e-14; + int N = 10; + double m = 0, M = 1; + +public: + Test(CGAL::Random& r, const double epsilon) : r(r), epsilon(epsilon) { } + +private: + inline RT to_nt(int d) const { return RT(d); } + + P p(int x, int y, int z) + { + int w = ri.next(); + return P(to_nt(x*w), to_nt(y*w), to_nt(z*w), to_nt(w)); + } + + P random_point() const + { + return P(FT(r.get_double(m, M)), FT(r.get_double(m, M)), FT(r.get_double(m, M))); + } + + Pl pl(int a, int b, int c, int d) + { + int w = ri.next(); + return Pl(to_nt(a*w), to_nt(b*w), to_nt(c*w), to_nt(d*w)); + } + +private: + template + bool are_equal(const Type& t1, const Type& t2, const bool verbose = true) + { + const FT diff = CGAL::abs(t1 - t2); + if(diff > std::numeric_limits::epsilon() && + diff > epsilon * (CGAL::abs(t1) + CGAL::abs(t2))) + { + if(verbose) + { + std::cerr << "Approximate comparison failed (t1|t2): got " << t1 << " but expected " << t2 << std::endl; + std::cerr << "Diff: " << CGAL::abs(t1 - t2) << " vs eps: " << epsilon * (CGAL::abs(t1) + CGAL::abs(t2)) << std::endl; + } + return false; + } + + return true; + } + + void do_intersect_check(const P&, const P&) { } + + template + void do_intersect_check(const P& p, const O2& o2) + { + if(!o2.is_degenerate() && CGAL::do_intersect(p, o2)) + { + assert(are_equal(CGAL::squared_distance(p, o2), FT(0))); + assert(are_equal(CGAL::squared_distance(o2, p), FT(0))); + } + } + + template + void do_intersect_check(const O1& o1, const O2& o2) + { + if(!o1.is_degenerate() && !o2.is_degenerate() && CGAL::do_intersect(o1, o2)) + { + assert(are_equal(CGAL::squared_distance(o1, o2), FT(0))); + assert(are_equal(CGAL::squared_distance(o2, o1), FT(0))); + } + } + + template + void check_compare_squared_distance(const O1& o1, const O2& o2, const FT& expected_result) + { + // const FT res_o1o2 = K().compare_squared_distance_3_object()(o1, o2, expected_result); + // const FT res_o2o1 = K().compare_squared_distance_3_object()(o2, o1, expected_result); + + // std::cout << std::endl << "Test" << std::endl; + + // std::cout << o1 << std::endl << o2 << std::endl; + // std::cout << CGAL::squared_distance(o1, o2) << " " << expected_result << std::endl; + // std::cout << CGAL::SMALLER << CGAL::EQUAL << CGAL::LARGER << std::endl; + // std::cout << CGAL::compare_squared_distance(o1, o2, expected_result) << std::endl; + + const bool res_e_o1o2 = (CGAL::compare_squared_distance(o1, o2, expected_result) == CGAL::EQUAL); + const bool res_e_o2o1 = (CGAL::compare_squared_distance(o2, o1, expected_result) == CGAL::EQUAL); + const bool res_s_o1o2 = (CGAL::compare_squared_distance(o1, o2, expected_result*(1+epsilon)+1) == CGAL::SMALLER); + const bool res_s_o2o1 = (CGAL::compare_squared_distance(o2, o1, expected_result*(1+epsilon)+1) == CGAL::SMALLER); + const bool res_l_o1o2 = (CGAL::compare_squared_distance(o1, o2, expected_result*(1-epsilon)-1) == CGAL::LARGER); + const bool res_l_o2o1 = (CGAL::compare_squared_distance(o2, o1, expected_result*(1-epsilon)-1) == CGAL::LARGER); + + // The equal result is guaranteed only on exact construction kernel + if(epsilon==0) + { + assert(res_e_o1o2); + assert(res_e_o2o1); + } + assert(res_s_o1o2); + assert(res_s_o2o1); + assert(res_l_o1o2); + assert(res_l_o2o1); + } + + template + void check_compare_squared_distance_with_bound(const O1& o1, const O2& o2, const FT& upper_bound) + { + // const FT res_o1o2 = K().compare_squared_distance_3_object()(o1, o2, expected_result); + // const FT res_o2o1 = K().compare_squared_distance_3_object()(o2, o1, expected_result); + + const FT up = upper_bound * (1 + epsilon) + std::numeric_limits::epsilon(); + + const bool res_o1o2 = (CGAL::compare_squared_distance(o1, o2, up) != CGAL::LARGER); + const bool res_o2o1 = (CGAL::compare_squared_distance(o2, o1, up) != CGAL::LARGER); + + assert(res_o1o2); + assert(res_o2o1); + } + +private: + void P_P() + { + std::cout << "Point - Point" << std::endl; + check_compare_squared_distance(p(0, 0, 0), p(0, 0, 0), 0); + check_compare_squared_distance(p(3, 5, 7), p(0, 0, 0), 83); + } + + void P_S() + { + std::cout << "Point - Segment" << std::endl; + check_compare_squared_distance(p(0, 1, 2), S{p(-3, 0, 0), p( 2, 0, 0)}, 5); + check_compare_squared_distance(p(0, 1, 2), S{p( 3, 0, 0), p( 2, 0, 0)}, 9); + check_compare_squared_distance(p(0, 1, 2), S{p( 2, 0, 0), p( 3, 0, 0)}, 9); + check_compare_squared_distance(p(6, 1, 2), S{p( 2, 0, 0), p( 3, 0, 0)}, 14); + } + + void P_T() + { + std::cout << "Point - Triangle" << std::endl; + check_compare_squared_distance(p(0, 1, 2), T{p(0, 0, 0), p(2, 0, 0), p(0, 2, 0)}, 4); + + T t(p(0,0,0), p(3,0,0), p(3,3,0)); + check_compare_squared_distance (p(-1, -1, 0), t, 2); + check_compare_squared_distance (p(-1, 0, 0), t, 1); + check_compare_squared_distance (p(0, 0, 0), t, 0); + check_compare_squared_distance (p(1, 0, 0), t, 0); + check_compare_squared_distance (p(4, 0, 0), t, 1); + check_compare_squared_distance (p(1, -1, 0), t, 1); + check_compare_squared_distance (p(1, 1, 1), t, 1); + check_compare_squared_distance (p(1, 0, 1), t, 1); + check_compare_squared_distance (p(0, 0, 1), t, 1); + + // // Degenerate + check_compare_squared_distance (p(1, 2, 3), T(p(4,3,2), p(4,3,2), p(4,3,2)), squared_distance(p(1, 2, 3), p(4,3,2))); + check_compare_squared_distance (p(1, 2, 3), T(p(4,3,2), p(10,12,3), p(4,3,2)), squared_distance(p(1, 2, 3), p(4,3,2))); + check_compare_squared_distance (p(0, 0, 0), T(p(4,3,2), p(4,-3,-2), p(4,3,2)), squared_distance(p(0, 0, 0), p(4,0,0))); + + // On the triangle + check_compare_squared_distance (p(7, 1, -5), T(p(2,9,8), p(-4,-3,-5), p(7, 1, -5)), 0); // vertex + check_compare_squared_distance (p(7, 1, -5), T(p(14,2,-10), p(-7,-1,5), p(8, 3, -1)), 0); // edge + check_compare_squared_distance (p(1, 4, -3), T(p(0,-8,-3), p(-5,14,-3), p(10, 1, -3)), 0); // face + + // General + check_compare_squared_distance (p(-15, 1, 0), T(p(-10, 1, 0), p(0,0,0), p(10,0,0)), 25); + check_compare_squared_distance (p(-5, 0, 0), T(p(-10, 1, 0), p(0,0,0), p(10,0,0)), squared_distance(p(-5, 0, 0), S(p(-10, 1, 0), p(0,0,0)))); + check_compare_squared_distance (p(0, -3, 0), T(p(-10, 1, 0), p(0,0,0), p(10,0,0)), 9); + check_compare_squared_distance (p(3, -3, 0), T(p(-10, 1, 0), p(0,0,0), p(10,0,0)), squared_distance(p(3, -3, 0), S(p(0,0,0), p(10,0,0)))); + check_compare_squared_distance (p(16, 1, 1), T(p(-10, 1, 0), p(0,0,0), p(10,0,0)), 38); + check_compare_squared_distance (p(5, 5, 2), T(p(-10, 1, 0), p(0,0,0), p(10,0,0)), squared_distance(p(5, 5, 2), S(p(10,0,0), p(-10,1,0)))); + + for(int i=0; i1) in the code + for(int j=-2;j<4; j+=2) + { + for(int k=-3;k<3; k+=2) + { + P p2{j, k, z}; + P p3{j, k+2, z}; + + // to explicit the expected distances + if(j == -2 && k == -3) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, CGAL::squared_distance(p3, p0)); + else if(j == -2 && k == -1) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, 1); + else if(j == -2 && k == 1) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, CGAL::squared_distance(p2, p0)); + else if(j == 0 && k == -3) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, 1); + else if(j == 0 && k == -1) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, 0); + else if(j == 0 && k == 1) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, 1); + else if(j == 2 && k == -3) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, CGAL::squared_distance(p3, p1)); + else if(j == 2 && k == -1) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, 1); + else if(j == 2 && k == 1) + check_compare_squared_distance(S{p0, p1}, S{p2, p3}, CGAL::squared_distance(p2, p1)); + } + } + + for(int i=0; i, gte::Segment<3, FT> > GTE_SS_checker; + gte::Segment<3, FT> gte_s1{{p8.x(), p8.y(), p8.z()}, {p9.x(), p9.y(), p9.z()}}; + gte::Segment<3, FT> gte_s2{{p3.x(), p3.y(), p3.z()}, {p2.x(), p2.y(), p2.z()}}; + auto gte_res = GTE_SS_checker(gte_s1, gte_s2); + std::cout << "-------" << std::endl; + std::cout << "old: " << CGAL::internal::squared_distance_old(s89, s32, K()) << std::endl; + std::cout << "dist (GTE) : " << gte_res.sqrDistance << std::endl; +#endif + + // Because do_intersect() with constructions is likely to return 'false' even for overlaps + assert(are_equal(CGAL::squared_distance(s89, s32), result, false /*verbose*/) || + are_equal(CGAL::squared_distance(s32, s89), FT(0))); + } + + // completely generic + S s1{p0, p1}, s2{p2, p3}; + do_intersect_check(s1, s2); + +#ifdef CGAL_USE_GTE_AS_SANITY_CHECK + gte::DCPQuery, gte::Segment<3, FT> > GTE_SS_checker; + gte::Segment<3, FT> gte_s1{{p0.x(), p0.y(), p0.z()}, {p1.x(), p1.y(), p1.z()}}; + gte::Segment<3, FT> gte_s2{{p2.x(), p2.y(), p2.z()}, {p3.x(), p3.y(), p3.z()}}; + auto gte_res = GTE_SS_checker(gte_s1, gte_s2); + + std::cout << "dist (CGAL) : " << CGAL::squared_distance(s1, s2) << std::endl; + std::cout << "dist (GTE) : " << gte_res.sqrDistance << std::endl; + assert(are_equal(CGAL::squared_distance(s1, s2), gte_res.sqrDistance)); +#endif + } + + // a few brute force checks: sample a segments and use squared_distance(P3, S3) + for(int i=0; i<10; ++i) + { + P p0 = random_point(); + P p1 = random_point(); + P p2 = random_point(); + P p3 = random_point(); + + S s01{p0, p1}; + S s23{p2, p3}; + + FT upper_bound = CGAL::squared_distance(p0, p2); + + V p01 = V{p0, p1} / FT(N); + for(int l=0; l, gte::Triangle3 > GTE_TT_checker; + gte::Triangle3 gte_tr1{{p0.x(), p0.y(), p0.z()}, {p1.x(), p1.y(), p1.z()}, {p2.x(), p2.y(), p2.z()}}; + gte::Triangle3 gte_tr2{{p3.x(), p3.y(), p3.z()}, {p4.x(), p4.y(), p4.z()}, {p5.x(), p5.y(), p5.z()}}; + auto gte_res = GTE_TT_checker(gte_tr1, gte_tr2); + + std::cout << "dist (CGAL) : " << CGAL::squared_distance(tr1, tr2) << std::endl; + std::cout << "dist (GTE) : " << gte_res.sqrDistance << std::endl; + std::cout << "diff CGAL GTE : " << (gte_res.sqrDistance - CGAL::squared_distance(tr1, tr2)) << std::endl; + + // don't assert on purpose, GTE has slightly (10^-30 different results, even with an exact NT) + are_equal(CGAL::squared_distance(tr1, tr2), gte_res.sqrDistance); +#endif + } + } + +public: + void run() + { + std::cout << "Kernel: " << typeid(K).name() << std::endl; + + P_P(); + P_S(); + P_R(); + P_L(); + P_T(); + P_Pl(); + P_Tet(); + + S_S(); + S_R(); + S_L(); + S_Pl(); + + R_R(); + R_L(); + R_Pl(); + + L_L(); + L_Pl(); + + T_T(); + + Pl_Pl(); + } +}; + +int main() +{ + std::cout.precision(17); + std::cerr.precision(17); + + std::cout << "3D Distance tests" << std::endl; + + CGAL::Random r; + std::cout << "random seed = " << r.get_seed() << std::endl; + + // @todo Some tests are too difficult for these kernels +// Test >(r, 1e-5).run(); +// Test >(r, 1e-5).run(); +// Test > >(r, 1e-5).run(); + + // Test >(r, 0).run(); + + const double epick_eps = 10 * std::numeric_limits::epsilon(); + Test(r, epick_eps).run(); + + Test(r, 0).run(); + + std::cout << "Done!" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Distance_3/test/Distance_3/test_distance_3.cpp b/Distance_3/test/Distance_3/test_distance_3.cpp index f297e93016b..db899ac309f 100644 --- a/Distance_3/test/Distance_3/test_distance_3.cpp +++ b/Distance_3/test/Distance_3/test_distance_3.cpp @@ -241,10 +241,36 @@ private: void P_Tet() { std::cout << "Point - Tetrahedron\n"; + //Degenerate Tetrahedron + check_squared_distance (p(2, 2, 2), Tet(p(0, 0, 0), p( 6, 0, 0), p( 0, 6, 0), p( 6, 6, 0)), 4); + check_squared_distance (p(3, 3, 0), Tet(p(0, 0, 0), p( 6, 0, 0), p( 0, 6, 0), p( 6, 6, 0)), 0); + check_squared_distance (p(8, 8, 0), Tet(p(0, 0, 0), p( 6, 0, 0), p( 0, 6, 0), p( 6, 6, 0)), 8); + + //Inside Tetrahedron + check_squared_distance (p(1, 1, 1), Tet(p(0, 0, 0), p( 3, 0, 0), p( 0, 3, 0), p( 0, 0, 3)), 0); + check_squared_distance (p(1, 1, 1), Tet(p(0, 0, 0), p( 3, 0, 0), p( 0, 0, 3), p( 0, 3, 0)), 0); check_squared_distance (p(0, 0, 0), Tet(p(0, 0, 0), p( 1, 0, 0), p( 0, 1, 0), p( 0, 0, 1)), 0); + + //General check_squared_distance (p(0, 0, 2), Tet(p(0, 0, 0), p( 1, 0, 0), p( 0, 1, 0), p( 0, 0, 1)), 1); check_squared_distance (p(0, 0, -1), Tet(p(0, 0, 0), p( 1, 0, 0), p( 0, 1, 0), p( 0, 0, 1)), 1); check_squared_distance (p(5, 0, 0), Tet(p(0, 0, 0), p( 1, 0, 0), p( 0, 1, 0), p( 4, 0, 1)), 2); + check_squared_distance (p(1, 1, -1), Tet(p(0, 0, 1), p( 0, 0, 0), p( 4, 0, 0), p( 0, 4, 0)), 1); + check_squared_distance (p(1, 1, -1), Tet(p(0, 0, 1), p( 0, 0, 0), p( 0, 4, 0), p( 4, 0, 0)), 1); + + for(int i=0; ioptional: put `Scripts/scripts` and `Scripts/developer_scripts` on your `PATH` environment variable or - Alternatively, you can call the scripts mentioned below using their full path or a relative path -- define the environment variable `CGAL_DIR`. It should be the directory where you built CGAL. -- optional: define the environment variables for Boost, GMP, and any optional third party lib, e.g. Eigen. -- On Windows: define the environment variable `MAKE_CMD` (put the line `export MAKE_CMD=nmake` in your `$HOME/.bashrc` for VC++) -- On Windows: define the environment variable `CMAKE_GENERATOR` (put the line export CMAKE_GENERATOR='-GNMake Makefiles' in your `$HOME/.bashrc` for VC++) -- go in the directory you want to test -- Run `cgal_test_with_cmake` in the `test` and `examples` directories of the package. This should run CMake, compile and run, and you can see what happened in the generated file `error.txt`. +All examples and tests in CGAL are now compatible with `ctest`. So to test all examples or all tests +of a package, you simply need to configure with `cmake` the examples/tests of the package you want to +test, adding the option `CGAL_ENABLE_TESTING` and setting its value to `ON`. In order to report more +warnings, it is recommended to also add the option `CGAL_DEV_MODE` and to set it to `ON`. +Then a call to the command `ctest` will compile and run the tests/examples. + \section fullTestsuite Running the Whole Testsuite We describe here how to proceed to the testing of a full copy of `master` or any branch by creating a flat release (that is having a layout similar to a release rather than a branch layout with header files gathered by packages). -The creation of the flat release is done using the script `create_internal_release` located in the directory `Scripts/developer_scripts`. -Running the script with no argument will give the complete usage of this script. We only describe one way of using it. +The creation of the flat release is done using the `cmake` script `cgal_create_release_with_cmake.cmake` located in the directory `Scripts/developer_scripts`. +You can run it using the option `-P` of `cmake`: `cmake -P cgal_create_release_with_cmake.cmake`. +For an up-to-date documentation of available options, check the comments at the beginning of the script. -The prerequisite is to have a checkout of the branch we want to test. -In the example, it will be located in ~/Git/cgal/. - -First one goes into a directory where the flat release will be created: -\code -> cd /tmp -\endcode - -Then the script `create_internal_release` is ran: -\code - > create_internal_release -r CGAL-I-FOO -a ~/Git/cgal/ -\endcode - -The directory `CGAL-I-FOO` now contains the flat release of the branch in `~/Git/cgal`. -Then you need to compile this flat release and set `CGAL_DIR` accordingly as explained in the installation manual. - -To run the test-suite simply do: -\code - > cd CGAL-I-FOO/test - > ./run_testsuite_with_cmake -\endcode -and wait for the results to be written in the file `error.txt`. +Then for testing all examples, tests, and demos, in a build directory call `cmake` on the created release +(the path is given by the script if not manually specified) +`cmake -DBUILD_TESTING=ON -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON ../CGAL-X.XX/` +Finally, a call to the command `ctest` will compile and run the tests, examples, and demos. */ diff --git a/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt b/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt index eeae486b236..da9bc70ce2a 100644 --- a/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt +++ b/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt @@ -35,6 +35,6 @@ These options should suffice to create a `CMakeLists.txt` script for most directories containing programs. However, in some special cases, it might still be required to create the script manually, for instance, if some source files/executables need a different linking than -other source files. The Section \subpage devman_create_and_use_a_cmakelist provides more details. +other source files. The Section \ref devman_create_and_use_a_cmakelist provides more details. */ diff --git a/Documentation/doc/Documentation/Developer_manual/developer_manual.txt b/Documentation/doc/Documentation/Developer_manual/developer_manual.txt index a133c654aba..6c3b3f0504a 100644 --- a/Documentation/doc/Documentation/Developer_manual/developer_manual.txt +++ b/Documentation/doc/Documentation/Developer_manual/developer_manual.txt @@ -23,4 +23,5 @@ The developer manual is primarily aimed at \cgal developers, but may also be int - \subpage devman_info - \subpage devman_create_cgal_CMakeLists - \subpage deprecated +- \subpage Doxygen_for_CGAL */ diff --git a/Documentation/doc/Documentation/Doxyfile.in b/Documentation/doc/Documentation/Doxyfile.in index 1b174bb8635..d3e21f24daa 100644 --- a/Documentation/doc/Documentation/Doxyfile.in +++ b/Documentation/doc/Documentation/Doxyfile.in @@ -19,6 +19,7 @@ FILTER_PATTERNS = *.txt=${CMAKE_BINARY_DIR}/pkglist_filter HTML_EXTRA_FILES += ${CGAL_DOC_RESOURCE_DIR}/hacks.js \ ${CGAL_DOC_RESOURCE_DIR}/menu_version.js \ + ${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css \ ${CMAKE_BINARY_DIR}/how_to_cite_cgal.bib \ ${CMAKE_BINARY_DIR}/how_to_cite.html \ ${CGAL_PACKAGE_DOC_DIR}/fig/g-196x196-doc.png diff --git a/Documentation/doc/Customizations.txt b/Documentation/doc/Documentation/Doxygen_for_CGAL.md similarity index 77% rename from Documentation/doc/Customizations.txt rename to Documentation/doc/Documentation/Doxygen_for_CGAL.md index c1debd91db6..2c13a7cc054 100644 --- a/Documentation/doc/Customizations.txt +++ b/Documentation/doc/Documentation/Doxygen_for_CGAL.md @@ -1,4 +1,4 @@ -# Doxygen for CGAL # +\page Doxygen_for_CGAL Doxygen for CGAL This is the documentation of doxygen hacks that are applied to make the output of Doxygen more suitable to CGAL. It explains the general @@ -14,17 +14,17 @@ hacks that create what you see. ### Package Overview ### The package overview is build by having a special command that is -filtered by the python script pkglist_filter.py. +filtered by the python script `pkglist_filter.py`. -A command has to be of the form \package_listing{PKG_NAME}, where -PKG_NAME cannot contain a closing }. +A command has to be of the form `\package_listing{PKG_NAME}`, where +`PKG_NAME` cannot contain a closing `}`. The command is replaced by the text between the two delimiters -PkgDescBegin and PkgDescEnd in the file ../PKG_NAME/doc/PKG_NAME/PackageDescription.txt +`cgalPkgDescriptionBegin` and `cgalPkgDescriptionEnd` in the file `../PKG_NAME/doc/PKG_NAME/PackageDescription.txt` -If PKG_NAME is of the form A/B the selected file is -../A/doc/B/PackageDescription.txt. This is to support packages like -TDS_2, which don't reside in their own packages in the SCM. +If `PKG_NAME` is of the form `A/B` the selected file is +`../A/doc/B/PackageDescription.txt`. This is to support packages like +`TDS_2`, which don't reside in their own packages in the SCM. ### Footnotes ### @@ -50,13 +50,13 @@ LaTex. This hack fiddles with the internal structures and functions of the treeview to remove the unnecessary intermediate top-level module part. -It assigns the first element of the module array (found in module.js) +It assigns the first element of the module array (found in `module.js`) to the Reference Manual entry. This makes the tree view link go to that group directly instead of the intermediate link. It also removes one level of nesting. Unfortunately this changes the overall tree structure. To adjust for -that we hijack the gotoNode function of navtree.js and *augment* it +that we hijack the `gotoNode` function of `navtree.js` and *augment* it with an additional check for the specific tree level we borked and redirect it. diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index 7875c5791d3..5739b44d85e 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -54,7 +54,7 @@ or `h The \stl comes with the compiler, and as such no installation is required. \subsection thirdpartyBoost Boost -Version 1.72 or later +Version 1.74 or later The \boost libraries are a set of portable C++ source libraries. Most of \boost libraries are header-only, but a few of them need to be compiled or @@ -86,7 +86,6 @@ Version supported are GMP Version 5.0.1 or later, MPFR Version 3.0.0 or later The \boost library also provides a module for multi precision integers and rational numbers: \boost multiprecision. -Versions supported are \boost Version 1.72 or later. The components \cgal, and `CGAL_Qt6` require either \gmp and \mpfr, or \boost multiprecision for multi precision numbers. `CGAL_Core` requires \boost multiprecision. diff --git a/Documentation/doc/Documentation/advanced/Configuration_variables.txt b/Documentation/doc/Documentation/advanced/Configuration_variables.txt index d4ac891a30f..399d3e3ea73 100644 --- a/Documentation/doc/Documentation/advanced/Configuration_variables.txt +++ b/Documentation/doc/Documentation/advanced/Configuration_variables.txt @@ -103,21 +103,11 @@ other but never both. \subsection installation_boost Boost Libraries -\subsubsection inst_boost_1_72_plus Version 1.72 and Later Starting from \boost 1.72, the cmake config mode can be used for configuring the \boost version to use by setting the environment variable `Boost_DIR` to the path containing the file `BoostConfig.cmake`. For example if you manually installed \boost 1.77 with `--prefix=`, then you should set `Boost_DIR=/lib/cmake/Boost-1.77.0`. -\subsubsection inst_boost_up_2_1_69 Version 1.69 and Earlier - -\warning If you have a version of Boost greater than 1.69 already installed on your system, and you want to configure and compile with an earlier version of Boost, then you will need to set the CMake variable `Boost_NO_BOOST_CMAKE` to `ON` (otherwise the `FindBoost.cmake` module of CMake will start searching for `BoostConfig.cmake`, and ignore the `BOOST_ROOT` variable). - -In most cases, if \boost is not automatically found, setting the `BOOST_ROOT` -variable is enough. If it is not, you can specify the header and library -directories individually. You can also provide the full pathname to a specific compiled library -if it cannot be found in the library directory or its name is non-standard. - By default, when \boost binary libraries are needed, the shared versions are used if present. You can set the variable `CGAL_Boost_USE_STATIC_LIBS` to `ON` if you want to link @@ -128,17 +118,6 @@ the `.dll` files are found by the dynamic linker, at run time. For example, you can add the path to the \boost `.dll` to the `PATH` environment variable. -| Variable | Description | Type | -| :- | :- | :- | -| `BOOST_ROOT`\cgalFootnote{The environment variable can be spelled either \cgalFootnoteCode{BOOST_ROOT} or \cgalFootnoteCode{BOOSTROOT}} | Root directory of your \boost installation | Either CMake or Environment | -| `Boost_INCLUDE_DIR` | Directory containing the `boost/version.hpp` file | CMake | -| `BOOST_INCLUDEDIR` | Idem | Environment | -| `Boost_LIBRARY_DIRS` | Directory containing the compiled \boost libraries | CMake | -| `BOOST_LIBRARYDIR` | Idem | Environment | -| `Boost_(xyz)_LIBRARY_RELEASE` | Full pathname to a release build of the compiled 'xyz' \boost library | CMake | -| `Boost_(xyz)_LIBRARY_DEBUG` | Full pathname to a debug build of the compiled 'xyz' \boost library | CMake | - - \subsection installation_gmp GMP and MPFR Libraries Under Windows, auto-linking is used, so only the directory diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 517347b09fa..269ec3e051e 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -431,7 +431,7 @@ Boissonnat} } @article{cgal:cgm-fobbo-11, - title={Fast Oriented Bounding Box Optimization on the Rotation Group $\SO(3, \mathrm{R})$}, + title={Fast Oriented Bounding Box Optimization on the Rotation Group $SO(3, \mathrm{R})$}, author={Chang, Chia-Tche and Gorissen, Bastien and Melchior, Samuel}, journal={ACM Transactions on Graphics (TOG)}, volume={30}, diff --git a/Documentation/doc/resources/1.10.0/BaseDoxyfile.in b/Documentation/doc/resources/1.10.0/BaseDoxyfile.in index d37679fa4a5..fb19fbae049 100644 --- a/Documentation/doc/resources/1.10.0/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.10.0/BaseDoxyfile.in @@ -486,24 +486,6 @@ HTML_HEADER = ${CGAL_DOC_HEADER_PACKAGE} HTML_FOOTER = ${CGAL_DOC_RESOURCE_DIR}/footer.html -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). -# Note: Since the styling of scrollbars can currently not be overruled in -# Webkit/Chromium, the styling will be left out of the default doxygen.css if -# one or more extra stylesheets have been specified. So if scrollbar -# customization is desired it has to be added explicitly. For an example see the -# documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = ${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css - # Doxygen stores a couple of settings persistently in the browser (via e.g. # cookies). By default these settings apply to all HTML pages generated by # doxygen across all projects. The HTML_PROJECT_COOKIE tag can be used to store @@ -541,6 +523,18 @@ DISABLE_INDEX = YES GENERATE_TREEVIEW = YES +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for diff --git a/Documentation/doc/resources/1.10.0/cgal_stylesheet.css b/Documentation/doc/resources/1.10.0/cgal_stylesheet.css index 71fe3a10aff..d7d2a77ba35 100644 --- a/Documentation/doc/resources/1.10.0/cgal_stylesheet.css +++ b/Documentation/doc/resources/1.10.0/cgal_stylesheet.css @@ -52,7 +52,7 @@ h2 { font-family: Arial, Helvetica; font-weight: bold; font-size: 12px; - height: 14px; + height: 22px; width: 16px; display: inline-block; background-color: #FF0000; @@ -67,7 +67,7 @@ h2 { font-family: Arial, Helvetica; font-weight: bold; font-size: 12px; - height: 14px; + height: 22px; width: 16px; display: inline-block; background-color: #0000FF; @@ -82,7 +82,7 @@ h2 { font-family: Arial, Helvetica; font-weight: bold; font-size: 12px; - height: 14px; + height: 22px; width: 16px; display: inline-block; background-color: #67489A; diff --git a/Documentation/doc/resources/1.10.0/header.html b/Documentation/doc/resources/1.10.0/header.html index 3549905fa84..0b1efb0d3c4 100644 --- a/Documentation/doc/resources/1.10.0/header.html +++ b/Documentation/doc/resources/1.10.0/header.html @@ -26,6 +26,7 @@ $search $mathjax $darkmode + $extrastylesheet diff --git a/Documentation/doc/resources/1.10.0/header_package.html b/Documentation/doc/resources/1.10.0/header_package.html index 19b6e358b4c..d39b6ab93dc 100644 --- a/Documentation/doc/resources/1.10.0/header_package.html +++ b/Documentation/doc/resources/1.10.0/header_package.html @@ -43,6 +43,7 @@ + $mathjax $darkmode diff --git a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in index 7fb06630c20..4bd2e290d30 100644 --- a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in @@ -477,24 +477,6 @@ HTML_HEADER = ${CGAL_DOC_HEADER_PACKAGE} HTML_FOOTER = ${CGAL_DOC_RESOURCE_DIR}/footer.html -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). -# Note: Since the styling of scrollbars can currently not be overruled in -# Webkit/Chromium, the styling will be left out of the default doxygen.css if -# one or more extra stylesheets have been specified. So if scrollbar -# customization is desired it has to be added explicitly. For an example see the -# documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = ${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css - # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the diff --git a/Documentation/doc/resources/1.8.13/header.html b/Documentation/doc/resources/1.8.13/header.html index 8c8b86f5b9d..3400f24ed80 100644 --- a/Documentation/doc/resources/1.8.13/header.html +++ b/Documentation/doc/resources/1.8.13/header.html @@ -17,7 +17,6 @@ $treeview $search $mathjax - $extrastylesheet diff --git a/Documentation/doc/resources/1.8.13/header_package.html b/Documentation/doc/resources/1.8.13/header_package.html index 544fd3ced7f..4c3cd1e8591 100644 --- a/Documentation/doc/resources/1.8.13/header_package.html +++ b/Documentation/doc/resources/1.8.13/header_package.html @@ -33,7 +33,6 @@ - - $mathjax $darkmode diff --git a/Documentation/doc/scripts/pkglist_filter.py b/Documentation/doc/scripts/pkglist_filter.py index 92208a6f4d9..f6cbff6c7d9 100755 --- a/Documentation/doc/scripts/pkglist_filter.py +++ b/Documentation/doc/scripts/pkglist_filter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import codecs import re @@ -28,16 +28,10 @@ def main(argv): for l in pkgdesc: do_print = do_print or re.match(".*cgalPkgDescriptionBegin.*", l) if(do_print): - if hasattr(sys.stdout, 'buffer'): - sys.stdout.buffer.write(l.encode('utf-8')) #python3 - else: - sys.stdout.write(l.encode('utf-8')) #python2 + sys.stdout.buffer.write(l.encode('utf-8')) do_print = do_print and (not re.match(".*cgalPkgDescriptionEnd.*", l)) else: - if hasattr(sys.stdout, 'buffer'): - sys.stdout.buffer.write(line.encode('utf-8')) #python3 - else: - sys.stdout.write(line.encode('utf-8')) #python2 + sys.stdout.buffer.write(line.encode('utf-8')) if __name__ == "__main__": main(sys.argv) diff --git a/Envelope_2/doc/Envelope_2/CGAL/Envelope_diagram_1.h b/Envelope_2/doc/Envelope_2/CGAL/Envelope_diagram_1.h index abb127ae839..9bc1b4f9710 100644 --- a/Envelope_2/doc/Envelope_2/CGAL/Envelope_diagram_1.h +++ b/Envelope_2/doc/Envelope_2/CGAL/Envelope_diagram_1.h @@ -11,9 +11,9 @@ time, and the space needed to store the diagram class is linear in the complexity of the envelope. The envelope-diagram class is parameterized by a traits class, which is a -model of the `ArrangementXMonotoneTraits_2` concept, in case we handle +model of the `AosXMonotoneTraits_2` concept, in case we handle only envelopes of \f$ x\f$-monotone curves, or of the refined -`ArrangementTraits_2` concept in case we handle arbitrary planar curves. +`AosTraits_2` concept in case we handle arbitrary planar curves. \cgalModels{EnvelopeDiagram_1} diff --git a/Envelope_2/doc/Envelope_2/CGAL/envelope_2.h b/Envelope_2/doc/Envelope_2/CGAL/envelope_2.h index 347374d63e2..75ad86a2970 100644 --- a/Envelope_2/doc/Envelope_2/CGAL/envelope_2.h +++ b/Envelope_2/doc/Envelope_2/CGAL/envelope_2.h @@ -48,7 +48,7 @@ The lower envelope is represented using the output minimization diagram `diag`. \tparam InputIterator must be an input iterator with value type `EnvelopeDiagram::X_monotone_curve_2`. \tparam EnvelopeDiagram must be a model of the concept `EnvelopeDiagram_1`. -\tparam Traits must be a model of the concept `ArrangementXMonotoneTraits_2`. +\tparam Traits must be a model of the concept `AosXMonotoneTraits_2`. */ template void lower_envelope_x_monotone_2 @@ -107,7 +107,7 @@ The upper envelope is represented using the output maximization diagram `diag`. \tparam InputIterator must be an input iterator with value type `EnvelopeDiagram::X_monotone_curve_2`. \tparam EnvelopeDiagram must be a model of the concept `EnvelopeDiagram_1`. -\tparam Traits must be a model of the concept `ArrangementXMonotoneTraits_2`. +\tparam Traits must be a model of the concept `AosXMonotoneTraits_2`. */ template void upper_envelope_x_monotone_2 diff --git a/Envelope_2/doc/Envelope_2/Envelope_2.txt b/Envelope_2/doc/Envelope_2/Envelope_2.txt index 13e94452c13..0bdc3a95a17 100644 --- a/Envelope_2/doc/Envelope_2/Envelope_2.txt +++ b/Envelope_2/doc/Envelope_2/Envelope_2.txt @@ -136,11 +136,11 @@ Any model of the `EnvelopeDiagram_1` concept must define a geometric traits class, which in turn defines the `Point_2` and `X_monotone_curve_2` types defined with the diagram features. The geometric traits class must be a model of the -`ArrangementXMonotoneTraits_2` concept in case we construct +`AosXMonotoneTraits_2` concept in case we construct envelopes of \f$ x\f$-monotone curves. If we are interested in handling arbitrary (not necessarily \f$ x\f$-monotone) curves, the traits class -must be a model of the `ArrangementTraits_2` concept. This -concepts refined the `ArrangementXMonotoneTraits_2` concept; +must be a model of the `AosTraits_2` concept. This +concepts refined the `AosXMonotoneTraits_2` concept; a traits class that models this concepts must also defines a `Curve_2` type, representing an arbitrary planar curve, and provide a functor for subdividing such curves into \f$ x\f$-monotone @@ -199,4 +199,3 @@ that compute envelopes of arbitrary curves. */ } /* namespace CGAL */ - diff --git a/Envelope_2/doc/Envelope_2/PackageDescription.txt b/Envelope_2/doc/Envelope_2/PackageDescription.txt index 28824ca8e7d..0fe4c06e4ea 100644 --- a/Envelope_2/doc/Envelope_2/PackageDescription.txt +++ b/Envelope_2/doc/Envelope_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgEnvelope2Ref /*! \addtogroup PkgEnvelope2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Envelopes,PkgEnvelope2} \cgalPkgPicture{Envelope_2/fig/Envelope_2.png} \cgalPkgSummaryBegin diff --git a/Envelope_2/examples/Envelope_2/CMakeLists.txt b/Envelope_2/examples/Envelope_2/CMakeLists.txt index 54144877d58..4afdfc6f5f8 100644 --- a/Envelope_2/examples/Envelope_2/CMakeLists.txt +++ b/Envelope_2/examples/Envelope_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_2_Examples) find_package(CGAL REQUIRED) diff --git a/Envelope_2/test/Envelope_2/CMakeLists.txt b/Envelope_2/test/Envelope_2/CMakeLists.txt index 37225c2f3a0..9e771071fb6 100644 --- a/Envelope_2/test/Envelope_2/CMakeLists.txt +++ b/Envelope_2/test/Envelope_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_2_Tests) find_package(CGAL REQUIRED) diff --git a/Envelope_3/doc/Envelope_3/Concepts/EnvelopeTraits_3.h b/Envelope_3/doc/Envelope_3/Concepts/EnvelopeTraits_3.h index fc72154073a..7c9b36b783f 100644 --- a/Envelope_3/doc/Envelope_3/Concepts/EnvelopeTraits_3.h +++ b/Envelope_3/doc/Envelope_3/Concepts/EnvelopeTraits_3.h @@ -3,7 +3,7 @@ * * This concept defines the minimal set of geometric predicates and operations * needed to compute the envelope of a set of arbitrary surfaces in \f$ - * \mathbb{R}^3\f$. It refines the `ArrangementXMonotoneTraits_2` concept. In + * \mathbb{R}^3\f$. It refines the `AosXMonotoneTraits_2` concept. In * addition to the `Point_2` and `X_monotone_curve_2` types and the * `Has_boundary_category` category tag listed in the base concept, it also * lists the `Surface_3` and `Xy_monotone_surface_3` types, which represent @@ -12,7 +12,7 @@ * operations usually involve the projection of 3D objects onto the \f$ * xy\f$-plane. * - * \cgalRefines{ArrangementXMonotoneTraits_2} + * \cgalRefines{AosXMonotoneTraits_2} * * \cgalHasModelsBegin * \cgalHasModels{CGAL::Env_triangle_traits_3} diff --git a/Envelope_3/doc/Envelope_3/PackageDescription.txt b/Envelope_3/doc/Envelope_3/PackageDescription.txt index 7579fff2c1e..920f6b7054b 100644 --- a/Envelope_3/doc/Envelope_3/PackageDescription.txt +++ b/Envelope_3/doc/Envelope_3/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgEnvelope3Ref /*! \addtogroup PkgEnvelope3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Envelopes,PkgEnvelope3} \cgalPkgPicture{Envelope_3/fig/Envelope_3.png} \cgalPkgSummaryBegin diff --git a/Envelope_3/examples/Envelope_3/CMakeLists.txt b/Envelope_3/examples/Envelope_3/CMakeLists.txt index 089c44b56b4..283a2b54ce4 100644 --- a/Envelope_3/examples/Envelope_3/CMakeLists.txt +++ b/Envelope_3/examples/Envelope_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_3_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Envelope_3/test/Envelope_3/CMakeLists.txt b/Envelope_3/test/Envelope_3/CMakeLists.txt index 251474dc57a..b9038463e38 100644 --- a/Envelope_3/test/Envelope_3/CMakeLists.txt +++ b/Envelope_3/test/Envelope_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Envelope_3_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt index 9852fdad283..290027a019c 100644 --- a/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/benchmark/Filtered_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Filtered_kernel_test) add_executable(bench_simple_comparisons bench_simple_comparisons.cpp) diff --git a/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt index bd9a629f447..cd7bdb737ce 100644 --- a/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/examples/Filtered_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Filtered_kernel_Examples) find_package(CGAL REQUIRED) diff --git a/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt b/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt index da741c2f754..1536d81a950 100644 --- a/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt +++ b/Filtered_kernel/test/Filtered_kernel/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Filtered_kernel_Tests) find_package(CGAL REQUIRED) diff --git a/Generalized_map/examples/Generalized_map/CMakeLists.txt b/Generalized_map/examples/Generalized_map/CMakeLists.txt index d0ec729d64c..84d5801abdc 100644 --- a/Generalized_map/examples/Generalized_map/CMakeLists.txt +++ b/Generalized_map/examples/Generalized_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generalized_map_Examples) find_package(CGAL REQUIRED) diff --git a/Generalized_map/include/CGAL/GMap_cell_iterators.h b/Generalized_map/include/CGAL/GMap_cell_iterators.h index 1dbef9dcd6e..d739d64d3c2 100644 --- a/Generalized_map/include/CGAL/GMap_cell_iterators.h +++ b/Generalized_map/include/CGAL/GMap_cell_iterators.h @@ -73,7 +73,8 @@ namespace CGAL { static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); - mark_cell(amap, (*this), mmark_number); + if(this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Constructor with a dart in parameter (for end iterator). @@ -81,8 +82,8 @@ namespace CGAL { Base(amap, adart), mmark_number(amap.get_new_mark()) { - if (adart!=this->mmap->null_descriptor) - mark_cell(amap, (*this), mmark_number); + if (this->cont()) + { mark_cell(amap, (*this), mmark_number); } } /// Destructor. @@ -136,7 +137,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } @@ -249,7 +250,7 @@ namespace CGAL { this->mmap->is_marked((*this), mmark_number)); if (this->cont()) - mark_cell(*this->mmap, (*this), mmark_number); + { mark_cell(*this->mmap, (*this), mmark_number); } return *this; } diff --git a/Generalized_map/test/Generalized_map/CMakeLists.txt b/Generalized_map/test/Generalized_map/CMakeLists.txt index 24ac67748cd..792b023745e 100644 --- a/Generalized_map/test/Generalized_map/CMakeLists.txt +++ b/Generalized_map/test/Generalized_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generalized_map_Tests) # CGAL and its components diff --git a/Generator/benchmark/Generator/CMakeLists.txt b/Generator/benchmark/Generator/CMakeLists.txt index e1daf72a299..b8d4c9b9e01 100644 --- a/Generator/benchmark/Generator/CMakeLists.txt +++ b/Generator/benchmark/Generator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Generator/examples/Generator/CMakeLists.txt b/Generator/examples/Generator/CMakeLists.txt index 39e4934705d..0575929b894 100644 --- a/Generator/examples/Generator/CMakeLists.txt +++ b/Generator/examples/Generator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_Examples) find_package(CGAL REQUIRED) diff --git a/Generator/test/Generator/CMakeLists.txt b/Generator/test/Generator/CMakeLists.txt index e7708299971..060c4b02905 100644 --- a/Generator/test/Generator/CMakeLists.txt +++ b/Generator/test/Generator/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_Tests) find_package(CGAL REQUIRED) diff --git a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt index d421e758dc2..0f092bdddba 100644 --- a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt +++ b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Alpha_shapes_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt index 79a9c584324..0e495788267 100644 --- a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Apollonius_graph_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt index 7a1c55e2375..a28575fd8a7 100644 --- a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt +++ b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Bounding_volumes_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt index 3689b6a4495..7f84c3aa5e6 100644 --- a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt +++ b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Circular_kernel_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Generator/CMakeLists.txt b/GraphicsView/demo/Generator/CMakeLists.txt index 75ab3c6083e..b1b3ef328c6 100644 --- a/GraphicsView/demo/Generator/CMakeLists.txt +++ b/GraphicsView/demo/Generator/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Generator_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/GraphicsView/CMakeLists.txt b/GraphicsView/demo/GraphicsView/CMakeLists.txt index 9568fd3efae..357832f21b3 100644 --- a/GraphicsView/demo/GraphicsView/CMakeLists.txt +++ b/GraphicsView/demo/GraphicsView/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(GraphicsView_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt index 0a682e80fa8..b08284c8501 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(L1_Voronoi_diagram_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt index 2dbae37b697..970f4eb17ba 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt +++ b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Largest_empty_rect_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index f630c8c6e80..08f3756e10f 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_2_triangulation_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 85a964989c8..eb899f59ba3 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 Core) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt index 7f805e60986..2ea54637c3c 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 Core) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index fc773d81ace..d7aafeb267e 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_Linf_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 Core) diff --git a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt index 9d3c41854bf..ea60ca9c267 100644 --- a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt +++ b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Snap_rounding_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt index fd02ea6c1e9..a4a73095859 100644 --- a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt +++ b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt index 3c76339638a..d07003892d3 100644 --- a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt +++ b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_lines_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/GraphicsView/demo/Triangulation_2/CMakeLists.txt b/GraphicsView/demo/Triangulation_2/CMakeLists.txt index 141852b3ed5..613df8d2348 100644 --- a/GraphicsView/demo/Triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_2_Demo) set(CMAKE_AUTOMOC ON) diff --git a/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf b/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf index 9a27c4e4f65..15cbfc98f09 100644 --- a/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf +++ b/GraphicsView/doc/GraphicsView/fig_src/uml-design.pdf @@ -1,5 +1,5 @@ %PDF-1.4 -%âãÏÓ +%âãÃÓ 1 0 obj << diff --git a/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h b/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h index e97c999ee10..24c60dcdcf6 100644 --- a/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h +++ b/GraphicsView/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h @@ -90,7 +90,7 @@ private: template GraphicsViewPolygonWithHolesInput::GraphicsViewPolygonWithHolesInput(QObject *parent, QGraphicsScene* s) - : GraphicsViewInput(parent), scene_(s), polygon_input(false) + : GraphicsViewInput(parent), polygon_input(false), scene_(s) { pwhItem = new CGAL::Qt::PolygonWithHolesGraphicsItem(&pwh); pwhItem->setBrush(::Qt::yellow); @@ -151,7 +151,7 @@ GraphicsViewPolygonWithHolesInput::processInput(CGAL::Object o) template void -GraphicsViewPolygonWithHolesInput::keyPressEvent ( QKeyEvent * event ) +GraphicsViewPolygonWithHolesInput::keyPressEvent ( QKeyEvent * /* event */ ) { } diff --git a/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt b/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt index 48650817c57..ea6800cd6b1 100644 --- a/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt +++ b/HalfedgeDS/doc/HalfedgeDS/PackageDescription.txt @@ -19,7 +19,6 @@ /*! \addtogroup PkgHalfedgeDSRef -\todo check generated documentation \cgalPkgDescriptionBegin{Halfedge Data Structures,PkgHalfedgeDS} \cgalPkgPicture{HalfedgeDS/fig/HalfedgeDS-teaser-small.png} \cgalPkgSummaryBegin diff --git a/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt b/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt index 49a4bd1c16f..d2669e130dc 100644 --- a/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt +++ b/HalfedgeDS/examples/HalfedgeDS/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(HalfedgeDS_Examples) find_package(CGAL REQUIRED) diff --git a/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h b/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h index a39cfd90715..fcb7e3a9175 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h +++ b/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include namespace CGAL { @@ -70,7 +70,7 @@ public: { unsigned int data = 0; typename boost::graph_traits::edge_iterator it, end; - for(boost::tie(it, end) = edges(p); it != end; ++it, ++data) + for(std::tie(it, end) = edges(p); it != end; ++it, ++data) (*map_)[*it] = data; } diff --git a/HalfedgeDS/package_info/HalfedgeDS/dependencies b/HalfedgeDS/package_info/HalfedgeDS/dependencies index ffbfcd5b201..1015a2da048 100644 --- a/HalfedgeDS/package_info/HalfedgeDS/dependencies +++ b/HalfedgeDS/package_info/HalfedgeDS/dependencies @@ -1,6 +1,7 @@ Algebraic_foundations BGL Circulator +Distance_2 Distance_3 HalfedgeDS Hash_map diff --git a/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt b/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt index bab4ef15f0a..cd29aa12692 100644 --- a/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt +++ b/HalfedgeDS/test/HalfedgeDS/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(HalfedgeDS_Tests) find_package(CGAL REQUIRED) diff --git a/Hash_map/benchmark/Hash_map/CMakeLists.txt b/Hash_map/benchmark/Hash_map/CMakeLists.txt index 51860317694..860f31fd055 100644 --- a/Hash_map/benchmark/Hash_map/CMakeLists.txt +++ b/Hash_map/benchmark/Hash_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hash_map) # CGAL and its components diff --git a/Hash_map/benchmark/Hash_map/hm.cpp b/Hash_map/benchmark/Hash_map/hm.cpp index 891ca23ef10..070b7c7cd4d 100644 --- a/Hash_map/benchmark/Hash_map/hm.cpp +++ b/Hash_map/benchmark/Hash_map/hm.cpp @@ -157,11 +157,11 @@ run(const G& g) #if 0 - std::cerr << "boost::tie(vb,ve) = vertices(g);\n"; + std::cerr << "std::tie(vb,ve) = vertices(g);\n"; t.reset(); t.start(); for(int i=0; i<100; i++){ typename boost::graph_traits::vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices(g); + std::tie(vb,ve) = vertices(g); for(; vb != ve; ++vb) { vertex_descriptor vd = *vb; #ifdef NOHASH diff --git a/Hash_map/test/Hash_map/CMakeLists.txt b/Hash_map/test/Hash_map/CMakeLists.txt index c2a6220bc7a..22e0de0f9a6 100644 --- a/Hash_map/test/Hash_map/CMakeLists.txt +++ b/Hash_map/test/Hash_map/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hash_map_Tests) find_package(CGAL REQUIRED) diff --git a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt index 250921f012f..8bc9d360ca3 100644 --- a/Heat_method_3/examples/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/examples/Heat_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Heat_method_3_Examples) # CGAL and its components diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index a4510dd552c..16078898df6 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -297,7 +297,7 @@ private: } CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; for(face_descriptor f : faces(tm)) { - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); vertex_descriptor current = *(vbegin); vertex_descriptor neighbor_one = *(++vbegin); vertex_descriptor neighbor_two = *(++vbegin); @@ -350,7 +350,7 @@ private: Matrix indexD(dimension,1); CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; for(face_descriptor f : faces(tm)) { - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); vertex_descriptor current = *(vbegin); vertex_descriptor neighbor_one = *(++vbegin); vertex_descriptor neighbor_two = *(++vbegin); @@ -514,7 +514,7 @@ private: CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; for(face_descriptor f : faces(tm)) { - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); vertex_descriptor current = *(vbegin); vertex_descriptor neighbor_one = *(++vbegin); vertex_descriptor neighbor_two = *(++vbegin); diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index 77a399704ec..64a61c993ba 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -446,7 +446,7 @@ private: for(face_descriptor f : faces(m_intrinsic_tm)) { CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,m_intrinsic_tm),m_intrinsic_tm); + std::tie(vbegin, vend) = vertices_around_face(halfedge(f,m_intrinsic_tm),m_intrinsic_tm); halfedge_descriptor hd = halfedge(f,m_intrinsic_tm); if(face(hd,m_intrinsic_tm) != f) { hd = opposite(hd,m_intrinsic_tm); diff --git a/Heat_method_3/test/Heat_method_3/CMakeLists.txt b/Heat_method_3/test/Heat_method_3/CMakeLists.txt index 056f15040a3..f8b3f13f0b1 100644 --- a/Heat_method_3/test/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/test/Heat_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Heat_method_3_Tests) # CGAL and its components diff --git a/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt index 7664529ebee..55c2cce7fb5 100644 --- a/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/benchmark/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_benchmark) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt index 7c0da4ed37b..c27e6da78fa 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_Demo) # Find includes in corresponding build directories diff --git a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h index ef2d984340b..b89c95f5656 100644 --- a/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/doc/Hyperbolic_triangulation_2/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -200,7 +200,19 @@ public: /*! Returns the hyperbolic segment formed by the vertices of edge `e`. */ - Hyperbolic_segment hyperbolic_segment (const Edge& e) const; + Hyperbolic_segment hyperbolic_segment(const Edge& e) const; + + /*! + Returns the hyperbolic point given by the finite vertex `vh`. + */ + Point point(const Vertex_handle vh) const; + + /*! + Returns the point given by vertex `i` of face `fh`. + \pre `t.dimension()` \f$ \geq0\f$ and \f$ i \in\{0,1,2\}\f$ in dimension 2, \f$ i \in\{0,1\}\f$ in dimension 1, \f$ i = 0\f$ in dimension 0, and the vertex is finite. + */ + Point point(const Face_handle fh, const int i) const; + ///@} diff --git a/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt index 04291fd4612..48b87097c62 100644 --- a/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/examples/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h index d95bfe27fba..0b79c1af1b3 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -740,6 +740,32 @@ public: Hyperbolic_segment segment(const Edge& e) const { return hyperbolic_segment(e); } Hyperbolic_segment segment(const Edge_circulator& e) const { return hyperbolic_segment(e); } + const Point& point(const Vertex_handle vh) const + { + CGAL_precondition(!is_infinite(vh)); + return vh->point(); + } + + const Point& point(const Face_handle fh, const int i) const + { + CGAL_precondition(!is_infinite(fh->vertex(i))); + CGAL_precondition(0 <= i && i <= 2); + return fh->vertex(i)->point(); + } + + Point& point(const Vertex_handle vh) + { + CGAL_precondition(!is_infinite(vh)); + return vh->point(); + } + + Point& point(const Face_handle fh, const int i) + { + CGAL_precondition(!is_infinite(fh->vertex(i))); + CGAL_precondition(0 <= i && i <= 2); + return fh->vertex(i)->point(); + } + size_type number_of_vertices() const { return Base::number_of_vertices(); } Vertex_circulator adjacent_vertices(Vertex_handle v) const { return Vertex_circulator(v, *this); } @@ -825,32 +851,6 @@ public: } public: - const Point& point(const Vertex_handle vh) const - { - CGAL_precondition(!is_infinite(vh)); - return vh->point(); - } - - const Point& point(const Face_handle fh, const int i) const - { - CGAL_precondition(!is_infinite(fh->vertex(i))); - CGAL_precondition(0 <= i && i <= 2); - return fh->vertex(i)->point(); - } - - Point& point(const Vertex_handle vh) - { - CGAL_precondition(!is_infinite(vh)); - return vh->point(); - } - - Point& point(const Face_handle fh, const int i) - { - CGAL_precondition(!is_infinite(fh->vertex(i))); - CGAL_precondition(0 <= i && i <= 2); - return fh->vertex(i)->point(); - } - bool is_valid() { if (!Base::is_valid()) diff --git a/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt b/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt index 4d4c4397245..4c251645f27 100644 --- a/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt +++ b/Hyperbolic_triangulation_2/test/Hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Hyperbolic_triangulation_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt b/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt index a15bb4b041c..aa77a9b9cc9 100644 --- a/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt +++ b/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgInscribedAreasRef -\todo check generated documentation \cgalPkgDescriptionBegin{Inscribed Areas,PkgInscribedAreas} \cgalPkgPicture{ler-detail.png} \cgalPkgSummaryBegin diff --git a/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt b/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt index ae8130bfe5d..b9a8add8e8e 100644 --- a/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt +++ b/Inscribed_areas/examples/Inscribed_areas/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Inscribed_areas_Examples) find_package(CGAL REQUIRED) diff --git a/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt b/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt index afd79762867..0b5ba8ac02e 100644 --- a/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt +++ b/Inscribed_areas/test/Inscribed_areas/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Inscribed_areas_Tests) find_package(CGAL REQUIRED) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 7a159e087bf..8d1c1d09cd4 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -3,13 +3,51 @@ ## [Release 6.1](https://github.com/CGAL/cgal/releases/tag/v6.1) +### General Changes +- The minimal supported version of Boost is now 1.74.0. + +### [Polygon Mesh Processing](https://doc.cgal.org/6.1/Manual/packages.html#PkgPolygonMeshProcessing) +- Added the function `CGAL::Polygon_mesh_processing::discrete_mean_curvature` and `CGAL::Polygon_mesh_processing::discrete_Guassian_curvature` to evaluate the discrete curvature at a vertex of a mesh. +- Added the function `CGAL::Polygon_mesh_processing::angle_sum` to compute the sum of the angles around a vertex. + + ### [Algebraic Kernel](https://doc.cgal.org/6.1/Manual/packages.html#PkgAlgebraicKernelD) - **Breaking change**: Classes based on the RS Library are no longer provided. +### [BGL](https://doc.cgal.org/6.1/Manual/packages.html#PkgBGL) +- Added the function `CGAL::Euler::remove_degree_2_vertex()`, which enables users to remove vertices which have exactly two incident edges. + ### [2D Arrangements](https://doc.cgal.org/6.1/Manual/packages.html#PkgArrangementOnSurface2) - Introduces two traits decorators, namely `Arr_tracing_traits_2` and `Arr_counting_traits_2`, which can be used to extract debugging and informative metadata about the traits in use while a program is being executed. +- Fixed the Landmark point-location strategy so that it can be applied to arrangements on a sphere. +- Fixed a bug in the extensions of vertex and halfedge types of the DCEL when used to instantiate Arrangement_with_history_2 or similar arrangement classes that derive from Arrangement_2. +- Renamed the prefix of the names of all concepts in the Arrangement_on_surface_2 package from "Arrangement" to "Aos". +- Renamed the old concept `AosApproximateTraits_2` to `AosApproximatePointTraits_2` to make room for the new concept `AosApproximateTraits_2`. This concept requires the provision of a functor called `Approximate_2` that has an operator that approximates the coordinates of a point. +- Introduced a new concept called `AosApproximateTraits_2`. It refines the concept `AosApproximatePointTraits_2`. This concept requires the provision of a functor called `Approximate_2`. In addition to an operator that approximates the coordinates of a point, it also requires the provision of (i) an operator that approximates a points, and (ii) an operator that approximates a curve. +- Changed all "typedef" style statements in the user manual to "using" style. (Observe that a similar update to the examples has already been made in a previous release.) +- Fixed do_intersect() of a 2D Arrangement and a curve. + +### [3D Mesh Generation](https://doc.cgal.org/6.1/Manual/packages.html#PkgMesh3) + +- Added two new meshing parameters that enable mesh initialization customization : + - `initial_points_generator` : enables the user to specify a functor that generates initial points, + - `initial_points` : enables the user to specify a `Range` of initial points. + + +### [2D Triangulations](https://doc.cgal.org/6.1/Manual/packages.html#PkgTriangulation2) + +- **Breaking change**: In the class template `Constrained_triangulation_plus_2`, the value type of the range returned + by `subconstraints()` has changed from `const std::pair*>` to `Subconstraint`. + The old range type is now returned by a new function named `subconstraints_and_contexts()`. + +### [Polygon Repair](https://doc.cgal.org/6.1/Manual/packages.html#PkgPolygonRepair) + +- Add a the non-zero rule, as well as functions to compute the conservative inner and outer hull of similar polygons. + +### Triangulations +- All triangulations now offer the functions `point(Vertex_handle)` and `point(Simplex, int)`, which enables users to access the geometric position of a vertex and of the i-th vertex of a simplex of a triangulation. ## [Release 6.0.1](https://github.com/CGAL/cgal/releases/tag/v6.0.1) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 7ec3a5575ce..0cdd9edf184 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -4,7 +4,7 @@ # ${CGAL_SOURCE_DIR} and to the root binary directory of the project as # ${CGAL_BINARY_DIR} or ${CGAL_BINARY_DIR}. if(NOT PROJECT_NAME) - cmake_minimum_required(VERSION 3.12...3.29) + cmake_minimum_required(VERSION 3.12...3.31) project(CGAL CXX C) endif() @@ -826,36 +826,44 @@ if(NOT TARGET ALL_CGAL_TARGETS) add_custom_target(ALL_CGAL_TARGETS) endif() -macro(add_programs subdir target ON_OFF) +function(CGAL_add_subdirectories subdir name ON_OFF) + cmake_minimum_required(VERSION 3.14) + # CMake>=3.14 for `if(DEFINED CACHE{...})` + # see https://cmake.org/cmake/help/v3.31/command/if.html#defined cache_set(CGAL_EXECUTABLE_TARGETS "") - add_custom_target(${target}) - add_dependencies(ALL_CGAL_TARGETS ${target}) + add_custom_target(${name}) + add_dependencies(ALL_CGAL_TARGETS ${name}) - option(WITH_${target} "Select ${target}" ${ON_OFF}) - if(WITH_${target}) - add_subdirectory(${subdir} EXCLUDE_FROM_ALL) + if(DEFINED CACHE{WITH_${name}} AND "${WITH_${name}}" AND CMAKE_PROJECT_NAME STREQUAL "CGAL") + set(ON_OFF ON) + endif() + option(CGAL_WITH_${name} "Compile CGAL ${name}" ${ON_OFF}) + + if(CGAL_WITH_${name}) + CGAL_handle_subdirectories(${subdir} ${name}) endif() cache_get(CGAL_EXECUTABLE_TARGETS) foreach(CGAL_EXECUTABLE_TARGET ${CGAL_EXECUTABLE_TARGETS}) - add_dependencies(${target} ${CGAL_EXECUTABLE_TARGET}) + add_dependencies(${name} ${CGAL_EXECUTABLE_TARGET}) endforeach() -endmacro() +endfunction() # This allows programs to locate CGALConfig.cmake set(CGAL_DIR ${CGAL_BINARY_DIR}) if(NOT RUNNING_CGAL_AUTO_TEST) - add_programs(examples examples OFF) - add_programs(demo demos OFF) + CGAL_add_subdirectories(examples examples OFF) + CGAL_add_subdirectories(demo demos OFF) if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") - add_programs(test tests OFF) + CGAL_add_subdirectories(test tests OFF) endif() + CGAL_add_subdirectories(benchmark benchmarks OFF) endif() message("== Setting paths ==") diff --git a/Installation/cmake/modules/CGALHelpers.cmake b/Installation/cmake/modules/CGALHelpers.cmake new file mode 100644 index 00000000000..936ef591f03 --- /dev/null +++ b/Installation/cmake/modules/CGALHelpers.cmake @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 3.14) +include_guard(GLOBAL) + +function(process_CGAL_subdirectory entry subdir type_name) + # For example, subdir can be "examples", type_name "example", and entry "Mesh_2" + get_filename_component(ENTRY_DIR_NAME "${entry}" NAME) + + if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source + make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") + endif() + + message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}") + + set(source_dir "") + if(EXISTS ${entry}/CMakeLists.txt) + set(source_dir ${entry}) + else() + if(CGAL_CREATE_CMAKE_SCRIPT) + execute_process( + COMMAND bash ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir "${entry}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" + RESULT_VARIABLE RESULT_VAR OUTPUT_VARIABLE OUTPUT_VAR ERROR_VARIABLE ERROR_VAR) + if(RESULT_VAR) + message(AUTHOR_WARNING "Error with ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir ${entry}\n${OUTPUT_VAR}\n${ERROR_VAR}") + else() + set(source_dir "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") + endif() + endif() + endif() + if(source_dir) + add_subdirectory( "${source_dir}" "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" EXCLUDE_FROM_ALL) + endif() +endfunction() + +function(CGAL_handle_subdirectories subdir_name plural_name) + string(TOUPPER "${plural_name}" plural_name_upper) + if("${plural_name}" MATCHES "s$") + string(LENGTH "${plural_name}" plural_name_length) + math(EXPR plural_name_length_minus_one "${plural_name_length} - 1") + string(SUBSTRING "${plural_name}" 0 "${plural_name_length_minus_one}" singular_name) + else() + set(singular_name "${plural_name}") + endif() + + project(CGAL_${plural_name_upper}) + + if(CGAL_BRANCH_BUILD) + + foreach(package ${CGAL_CONFIGURED_PACKAGES}) + #message (STATUS "Current package: ${package}") + file(GLOB listtmp "${package}/${subdir_name}/*") + list(APPEND list CONFIGURE_DEPENDS ${listtmp}) + endforeach() + + else() + + file(GLOB list "${subdir_name}/*") + + endif() + + if(NOT list) + return() + endif() + + list(SORT list) + + message("== Generating build files for ${plural_name} ==") + foreach(entry ${list}) + + if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) + + file(GLOB files "${entry}/*.cpp") + + # If there is no .cpp files, ignore the sub-directory + if(files) + process_cgal_subdirectory("${entry}" ${subdir_name} ${singular_name}) + endif() + + endif() + + endforeach() + message("== Generating build files for ${plural_name} (DONE) ==\n") + +endfunction() diff --git a/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake index 0b0a2b80b1b..464d2bdd911 100644 --- a/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake +++ b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(Boost_IOSTREAMS_FOUND AND NOT TARGET CGAL::Boost_iostreams_support) if( WIN32 ) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index d6d992267bb..c0976f84628 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -6,6 +6,19 @@ set(CGAL_CreateSingleSourceCGALProgram_included TRUE) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_add_test.cmake) include(CMakeParseArguments) +function(CGAL_check_target_name target_name new_target_var_name) + set(cmake_reserved_names all ALL_BUILD help install + INSTALL preinstall clean edit_cache + rebuild_cache ZERO_CHECK package PACKAGE package_source test RUN_TESTS) + + while(TARGET "${target_name}" OR target_name IN_LIST cmake_reserved_names) + message(AUTHOR_WARNING "The executable name ${target_name} is reserved by CMake or already exists. Renaming it to ${target_name}_") + set(target_name "${target_name}_") + endwhile() + + set(${new_target_var_name} ${target_name} PARENT_SCOPE) +endfunction() + function(create_single_source_cgal_program firstfile ) set(options NO_TESTING) set(oneValueArgs) @@ -42,6 +55,7 @@ function(create_single_source_cgal_program firstfile ) set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} ) endforeach() + CGAL_check_target_name(${exe_name} exe_name) add_executable(${exe_name} ${all}) if(CXX_FEATURES) target_compile_features(${exe_name} PRIVATE ${CXX_FEATURES}) diff --git a/Installation/cmake/modules/CGAL_Macros.cmake b/Installation/cmake/modules/CGAL_Macros.cmake index 596bc592a15..49b6bf19ec2 100644 --- a/Installation/cmake/modules/CGAL_Macros.cmake +++ b/Installation/cmake/modules/CGAL_Macros.cmake @@ -456,51 +456,4 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) endif() -function(process_CGAL_subdirectory entry subdir type_name) - # For example, subdir can be "examples", type_name "example", and entry "Mesh_2" - get_filename_component(ENTRY_DIR_NAME "${entry}" NAME) - - if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source - make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - endif() - - set(ADD_SUBDIR TRUE) - - if(EXISTS ${entry}/../../dont_submit) - file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${ENTRY_DIR_NAME}/?\$") - if(dont_submit_grep) - set(ADD_SUBDIR FALSE) - endif() - file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/${ENTRY_DIR_NAME}/?\$") - if(dont_submit_grep) - set(ADD_SUBDIR FALSE) - endif() - file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/?\$") - if(dont_submit_grep) - set(ADD_SUBDIR FALSE) - endif() - endif() - - if(ADD_SUBDIR) - message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}") - if(EXISTS ${entry}/CMakeLists.txt) - set(source_dir ${entry}) - add_subdirectory( ${entry} ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME} ) - else() - if(CGAL_CREATE_CMAKE_SCRIPT) -# message("bah ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir ${entry}") - execute_process( - COMMAND bash ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir "${entry}" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" - RESULT_VARIABLE RESULT_VAR OUTPUT_QUIET) - if(NOT RESULT_VAR) -# message("Subdir ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - set(source_dir "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - add_subdirectory( "${source_dir}" "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") - endif() - endif() - endif() - else() - message(STATUS "${subdir}/${ENTRY_DIR_NAME} is in dont_submit") - endif() -endfunction() +include(${CMAKE_CURRENT_LIST_DIR}/CGALHelpers.cmake) diff --git a/Installation/cmake/modules/CGAL_SetupBoost.cmake b/Installation/cmake/modules/CGAL_SetupBoost.cmake index ee561027370..abd5fe9fc0c 100644 --- a/Installation/cmake/modules/CGAL_SetupBoost.cmake +++ b/Installation/cmake/modules/CGAL_SetupBoost.cmake @@ -10,16 +10,13 @@ # # and defines the function :command:`use_CGAL_Boost_support`. -if ( CGAL_Boost_Setup ) - return() -endif() -set ( CGAL_Boost_Setup TRUE ) - +include_guard(GLOBAL) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake) -find_package( Boost 1.72 REQUIRED ) +cmake_policy(VERSION 3.12...3.30) +find_package( Boost 1.74 REQUIRED ) -if(Boost_FOUND AND Boost_VERSION VERSION_LESS 1.72) +if(Boost_FOUND AND Boost_VERSION VERSION_LESS 1.74) if(DEFINED Boost_DIR AND NOT Boost_DIR) # Unset that cache variable that is set in the cache by FindBoost # (while it was searching for boost-cmake). diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index e3dadc7b4e4..a73e12026d1 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -23,7 +23,7 @@ # If set, the `LEDA` library will be searched and used to provide # the exact number types used by CGAL kernels. # -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(CGAL_SetupCGALDependencies_included) return() endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake index 94d2d839375..710a5d7e579 100644 --- a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake @@ -48,7 +48,7 @@ set_property(GLOBAL PROPERTY CGAL_Core_FOUND TRUE) # function(CGAL_setup_CGAL_Core_dependencies target) - find_package( Boost 1.72 REQUIRED ) + find_package( Boost 1.74 REQUIRED ) if (NOT CGAL_DISABLE_GMP AND GMP_FOUND) use_CGAL_GMP_support(CGAL_Core INTERFACE) endif() diff --git a/Installation/cmake/modules/CGAL_SetupLEDA.cmake b/Installation/cmake/modules/CGAL_SetupLEDA.cmake index 171f6f39e9d..4037c21f5b1 100644 --- a/Installation/cmake/modules/CGAL_SetupLEDA.cmake +++ b/Installation/cmake/modules/CGAL_SetupLEDA.cmake @@ -9,7 +9,7 @@ # find_package(LEDA) # # and defines the function :command:`use_CGAL_LEDA_support`. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(CGAL_SetupLEDA_included) return() endif() diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake index 4559bf506d1..43d17a055f8 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -6,7 +6,7 @@ # the configuration. # # See https://stackoverflow.com/a/43300621/1728537 for the starting point. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) if(CGAL_SKIP_CMAKE_HOOKS) return() diff --git a/Installation/cmake/modules/display-third-party-libs-versions.cmake b/Installation/cmake/modules/display-third-party-libs-versions.cmake index 96ef4e14992..7f7d8695797 100644 --- a/Installation/cmake/modules/display-third-party-libs-versions.cmake +++ b/Installation/cmake/modules/display-third-party-libs-versions.cmake @@ -1,9 +1,27 @@ set(LIBRARIES_TO_CHECK - Eigen3 Qt6 TBB OpenMesh Boost - GMP Threads SuiteSparse MPFI METIS - VTK SCIP OSQP LASLIB GLPK - ITT Ceres MPFR libpointmatcher ITK - OpenGR OpenCV ZLIB + Boost + Ceres + Eigen3 + GLPK + GMP + ITK + ITT + LASLIB + libpointmatcher + METIS + MPFI + MPFR + OpenCV + OpenGR + OpenMesh + OSQP + Qt6 + SCIP + SuiteSparse + TBB + Threads + VTK + ZLIB ) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake) diff --git a/Installation/demo/CMakeLists.txt b/Installation/demo/CMakeLists.txt index 96c284fa9d8..92606a5b9d2 100644 --- a/Installation/demo/CMakeLists.txt +++ b/Installation/demo/CMakeLists.txt @@ -1,39 +1,7 @@ -cmake_minimum_required(VERSION 3.12...3.29) -project(CGAL_DEMOS) - -if(CGAL_BRANCH_BUILD) - - foreach(package ${CGAL_CONFIGURED_PACKAGES}) - #message (STATUS "Current package: ${package}") - file(GLOB listtmp "${package}/demo/*") - list(APPEND list ${listtmp}) - endforeach() - -else() - - file(GLOB list "*") +cmake_minimum_required(VERSION 3.12...3.31) +if(NOT CGAL_MODULES_DIR) + find_package(CGAL REQUIRED) endif() - -list(SORT list) - -find_package(CGAL REQUIRED) -include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) - -message("== Generating build files for demos ==") -foreach(entry ${list}) - - if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) - - file(GLOB files "${entry}/*.cpp") - - # If there is no .cpp files, ignore the sub-directory - if(files) - process_cgal_subdirectory("${entry}" demo demo) - # Note: process_CGAL_subdirectory is defined in cmake/modules/CGAL_Macros.cmake - endif() - - endif() - -endforeach() -message("== Generating build files for demos (DONE) ==\n") +include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) +CGAL_handle_subdirectories(demo demos) diff --git a/Installation/examples/CMakeLists.txt b/Installation/examples/CMakeLists.txt index e62d49c187d..e0034b4727f 100644 --- a/Installation/examples/CMakeLists.txt +++ b/Installation/examples/CMakeLists.txt @@ -1,39 +1,6 @@ -cmake_minimum_required(VERSION 3.12...3.29) -project(CGAL_EXAMPLES) - -if(CGAL_BRANCH_BUILD) - - foreach(package ${CGAL_CONFIGURED_PACKAGES}) - #message (STATUS "Current package: ${package}") - file(GLOB listtmp "${package}/examples/*") - list(APPEND list ${listtmp}) - endforeach() - -else() - - file(GLOB list "*") - +cmake_minimum_required(VERSION 3.12...3.31) +if(NOT CGAL_MODULES_DIR) + find_package(CGAL REQUIRED) endif() - -list(SORT list) - -find_package(CGAL REQUIRED) -include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) - -message("== Generating build files for examples ==") -foreach(entry ${list}) - - if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) - - file(GLOB files "${entry}/*.cpp") - - # If there is no .cpp files, ignore the sub-directory - if(files) - process_cgal_subdirectory("${entry}" examples example) - # Note: process_CGAL_subdirectory is defined in cmake/modules/CGAL_Macros.cmake - endif() - - endif() - -endforeach() -message("== Generating build files for examples (DONE) ==\n") +include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) +CGAL_handle_subdirectories(examples examples) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index a154b5caad8..a9e215f26e2 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -461,6 +461,11 @@ namespace CGAL { using cpp11::copy_n; } // end of the temporary compatibility with CGAL-4.14 #endif // CGAL_NO_DEPRECATED_CODE + +#if __has_include() +# include +#endif + namespace CGAL { // Typedef for the type of nullptr. @@ -501,7 +506,7 @@ namespace cpp11{ # define CGAL_FALLTHROUGH while(false){} #endif -#if __cpp_lib_format >= 201907L || (__has_include() && (__cplusplus >= 202000L || _MSVC_LANG >= 202000L)) +#if __cpp_lib_format >= 201907L # define CGAL_CAN_USE_CXX20_FORMAT 1 #endif diff --git a/Installation/test/CMakeLists.txt b/Installation/test/CMakeLists.txt index e0163f201ab..64d616edd57 100644 --- a/Installation/test/CMakeLists.txt +++ b/Installation/test/CMakeLists.txt @@ -1,39 +1,8 @@ -cmake_minimum_required(VERSION 3.12...3.29) -project(CGAL_TESTS) +cmake_minimum_required(VERSION 3.12...3.31) -if(CGAL_BRANCH_BUILD) - - foreach(package ${CGAL_CONFIGURED_PACKAGES}) - #message (STATUS "Current package: ${package}") - file(GLOB listtmp "${package}/test/*") - list(APPEND list ${listtmp}) - endforeach() - -else() - - file(GLOB list "*") +if(NOT CGAL_MODULES_DIR) + find_package(CGAL REQUIRED) endif() - -list(SORT list) - -find_package(CGAL REQUIRED) -include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) - -message("== Generating build files for tests ==") -foreach(entry ${list}) - - if(NOT ${entry} MATCHES ".*\\.svn\$" AND IS_DIRECTORY ${entry}) - - file(GLOB files "${entry}/*.cpp") - - # If there is no .cpp files, ignore the sub-directory - if(files) - process_cgal_subdirectory("${entry}" test test) - # Note: process_CGAL_subdirectory is defined in cmake/modules/CGAL_Macros.cmake - endif() - - endif() - -endforeach() -message("== Generating build files for tests (DONE) ==\n") +include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) +CGAL_handle_subdirectories(test tests) diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index 5fb67b8eae2..183337517e3 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Installation_Tests ) diff --git a/Installation/test/Installation/cgal_test_with_cmake b/Installation/test/Installation/cgal_test_with_cmake deleted file mode 100755 index afafb02d7d7..00000000000 --- a/Installation/test/Installation/cgal_test_with_cmake +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh - -# This is a script for the CGAL test suite. Such a script must obey -# the following rules: -# -# - the name of the script is cgal_test_with_cmake -# - for every target two one line messages are written to the file 'error.txt' -# the first one indicates if the compilation was successful -# the second one indicates if the execution was successful -# if one of the two was not successful, the line should start with 'ERROR:' -# - running the script should not require any user interaction -# - the script should clean up object files and executables - - ERRORFILE=error.txt - -#---------------------------------------------------------------------# -# remove the previous error file -#---------------------------------------------------------------------# - -rm -f ../$ERRORFILE -touch ../$ERRORFILE - -#---------------------------------------------------------------------# -# compile_and_run -#---------------------------------------------------------------------# -echo "Configuring... " -mkdir build_dir -cd build_dir -if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_RELEASE_DIR" -DCGAL_ENABLE_TESTING=ON -DWITH_tests=ON \ - ..' ; then - - echo " successful configuration" >> ../$ERRORFILE -else - echo " ERROR: configuration" >> ../$ERRORFILE -fi -cd .. - -#---------------------------------------------------------------------# -# configure, compile and run the tests -#---------------------------------------------------------------------# - -cd build_dir -ctest -L Installation_Tests -VV |tee res.txt -SUCCES="y" -FAILED=$(cat res.txt|grep "\*\*\*Failed") -if [ -z "$FAILED" ]; then - echo " successful run of Installation tests" >> ../$ERRORFILE -else - echo " ERROR: run of Installation tests" >> ../$ERRORFILE - SUCCES="" -fi -cat ../$ERRORFILE diff --git a/Installation/test/Installation/test_configuration.cmake.in b/Installation/test/Installation/test_configuration.cmake.in index fa820a795a5..e300407f0c8 100644 --- a/Installation/test/Installation/test_configuration.cmake.in +++ b/Installation/test/Installation/test_configuration.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(test_configuration) find_package(CGAL) add_definitions(-DQT_NO_KEYWORDS) diff --git a/Installation/test/Installation/test_configuration_qt.cmake.in b/Installation/test/Installation/test_configuration_qt.cmake.in index 5dda5a91bc2..3e2e50894f4 100644 --- a/Installation/test/Installation/test_configuration_qt.cmake.in +++ b/Installation/test/Installation/test_configuration_qt.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(test_configuration) find_package(CGAL COMPONENTS Qt6) add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) diff --git a/Installation/test/Installation/test_find_package.cmake.in b/Installation/test/Installation/test_find_package.cmake.in index cf759c73b85..eab8e03ed2e 100644 --- a/Installation/test/Installation/test_find_package.cmake.in +++ b/Installation/test/Installation/test_find_package.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( test_find_package_${mode} ) find_package(CGAL ${VERSION} ${EXACT}REQUIRED PATHS ${CGAL_DIR} diff --git a/Interpolation/examples/Interpolation/CMakeLists.txt b/Interpolation/examples/Interpolation/CMakeLists.txt index 0277e9aaf30..7d49ebcd9ae 100644 --- a/Interpolation/examples/Interpolation/CMakeLists.txt +++ b/Interpolation/examples/Interpolation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interpolation_Examples) find_package(CGAL REQUIRED) diff --git a/Interpolation/test/Interpolation/CMakeLists.txt b/Interpolation/test/Interpolation/CMakeLists.txt index cbfc358658e..f0b23d66367 100644 --- a/Interpolation/test/Interpolation/CMakeLists.txt +++ b/Interpolation/test/Interpolation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interpolation_Tests) find_package(CGAL REQUIRED) diff --git a/Intersections_2/test/Intersections_2/CMakeLists.txt b/Intersections_2/test/Intersections_2/CMakeLists.txt index 5fc9f53991f..773045a2af5 100644 --- a/Intersections_2/test/Intersections_2/CMakeLists.txt +++ b/Intersections_2/test/Intersections_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Intersections_2_Tests) find_package(CGAL REQUIRED) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h b/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h index 4aba04c9e1a..9693b6ce436 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/tetrahedron_lines_intersections_3.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/Intersections_3/test/Intersections_3/CMakeLists.txt b/Intersections_3/test/Intersections_3/CMakeLists.txt index 9b9ae08edee..8d34a143d23 100644 --- a/Intersections_3/test/Intersections_3/CMakeLists.txt +++ b/Intersections_3/test/Intersections_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Intersections_3_Tests) find_package(CGAL REQUIRED) diff --git a/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt b/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt index 458b71b043f..e0750e6dada 100644 --- a/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt +++ b/Interval_skip_list/examples/Interval_skip_list/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interval_skip_list_Examples) find_package(CGAL REQUIRED) diff --git a/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt b/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt index 690a918f787..12315e15177 100644 --- a/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt +++ b/Interval_skip_list/test/Interval_skip_list/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interval_skip_list_Tests) find_package(CGAL REQUIRED) diff --git a/Interval_support/test/Interval_support/CMakeLists.txt b/Interval_support/test/Interval_support/CMakeLists.txt index fd3788e50e9..d586b8c075f 100644 --- a/Interval_support/test/Interval_support/CMakeLists.txt +++ b/Interval_support/test/Interval_support/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Interval_support_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt index cc0ea70929d..90af6ff6785 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt +++ b/Jet_fitting_3/doc/Jet_fitting_3/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgJetFitting3Ref /*! \addtogroup PkgJetFitting3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{Estimation of Local Differential Properties of Point-Sampled Surfaces,PkgJetFitting3} \cgalPkgPicture{DavidDetail.png} \cgalPkgSummaryBegin diff --git a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt index a8bcc29b90c..abb85906be2 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Jet_fitting_3_Examples) find_package(CGAL REQUIRED) diff --git a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt index 114067d5247..62b395e1d4b 100644 --- a/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/test/Jet_fitting_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Jet_fitting_3_Tests) find_package(CGAL REQUIRED) diff --git a/Kernel_23/benchmark/Kernel_23/CMakeLists.txt b/Kernel_23/benchmark/Kernel_23/CMakeLists.txt index 3d2109157eb..2a5152a9e61 100644 --- a/Kernel_23/benchmark/Kernel_23/CMakeLists.txt +++ b/Kernel_23/benchmark/Kernel_23/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_23_benchmark) find_package(CGAL QUIET OPTIONAL_COMPONENTS Core) diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index bc591e356c9..f3297c729d9 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -8123,6 +8123,12 @@ public: bool operator()(const Kernel::Iso_cuboid_3&c, const Kernel::Point_3&p); + /*! + returns true iff `p` lies on the bounded side of `c`. + */ + bool operator()(const Kernel::Circle_3& c, + const Kernel::Point_3& p); + /*! returns true iff the line segment `ab` is inside the union of the bounded sides of `s1` and `s2`. @@ -8385,6 +8391,11 @@ public: bool operator()(const Kernel::Iso_cuboid_3&c, const Kernel::Point_3&p); + /*! + returns true iff `p` lies on the unbounded side of `c`. + */ + bool operator()(const Kernel::Circle_3&c, + const Kernel::Point_3&p); /// @} diff --git a/Kernel_23/doc/Kernel_23/Concepts/GeomObjects.h b/Kernel_23/doc/Kernel_23/Concepts/GeomObjects.h index 57ad06016b8..e85d5b723bc 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/GeomObjects.h +++ b/Kernel_23/doc/Kernel_23/Concepts/GeomObjects.h @@ -56,6 +56,8 @@ public: \sa `Kernel::ConstructPlane_3` \sa `Kernel::Equal_3` \sa `Kernel::HasOn_3` + \sa `Kernel::HasOnBoundedSide_3` + \sa `Kernel::HasOnUnboundedSide_3` \sa `Kernel::IsDegenerate_3` */ @@ -81,6 +83,7 @@ public: \sa `Kernel::ConstructDirection_2` \sa `Kernel::ConstructOppositeDirection_2` \sa `Kernel::ConstructPerpendicularDirection_2` + \sa `Kernel::ConstructRay_2` \sa `Kernel::CounterclockwiseInBetween_2` \sa `Kernel::Equal_2` @@ -101,9 +104,12 @@ public: \cgalHasModels{CGAL::Direction_3} \cgalHasModelsEnd + \sa `Kernel::ConstructCircle_3` \sa `Kernel::ConstructDirection_3` \sa `Kernel::ConstructOppositeDirection_3` - \sa `Kernel::Equal_2` + \sa `Kernel::ConstructPlane_3` + \sa `Kernel::ConstructRay_3` + \sa `Kernel::Equal_3` */ class Direction_3 { @@ -125,9 +131,17 @@ A type representing isocuboids in three dimensions. \sa `Kernel::BoundedSide_3` \sa `Kernel::ComputeVolume_3` +\sa `Kernel::ComputeXmax_3` +\sa `Kernel::ComputeXmin_3` +\sa `Kernel::ComputeYmax_3` +\sa `Kernel::ComputeYmin_3` +\sa `Kernel::ComputeZmax_3` +\sa `Kernel::ComputeZmin_3` \sa `Kernel::ConstructIsoCuboid_3` +\sa `Kernel::ConstructMaxVertex_3` +\sa `Kernel::ConstructMinVertex_3` \sa `Kernel::ConstructVertex_3` -\sa `Kernel::Equal_2` +\sa `Kernel::Equal_3` \sa `Kernel::HasOnBoundary_3` \sa `Kernel::HasOnBoundedSide_3` \sa `Kernel::HasOnUnboundedSide_3` @@ -151,13 +165,15 @@ public: \cgalHasModelsEnd \sa `Kernel::ConstructIsoRectangle_2` - \sa `Kernel::ComputeXmin_2` \sa `Kernel::ComputeXmax_2` - \sa `Kernel::ComputeYmin_2` + \sa `Kernel::ComputeXmin_2` \sa `Kernel::ComputeYmax_2` + \sa `Kernel::ComputeYmin_2` \sa `Kernel::BoundedSide_2` \sa `Kernel::ComputeArea_2` \sa `Kernel::ConstructIsoRectangle_2` + \sa `Kernel::ConstructMaxVertex_2` + \sa `Kernel::ConstructMinVertex_2` \sa `Kernel::ConstructVertex_2` \sa `Kernel::DoIntersect_2` \sa `Kernel::Equal_2` @@ -185,8 +201,11 @@ public: \cgalHasModelsEnd \sa `Kernel::CompareXAtY_2` - \sa `Kernel::ComputeSquaredDistance_2` \sa `Kernel::CompareYAtX_2` + \sa `Kernel::ComputeA_2` + \sa `Kernel::ComputeB_2` + \sa `Kernel::ComputeC_2` + \sa `Kernel::ComputeSquaredDistance_2` \sa `Kernel::ConstructBisector_2` \sa `Kernel::ConstructDirection_2` \sa `Kernel::ConstructLine_2` @@ -194,6 +213,7 @@ public: \sa `Kernel::ConstructPerpendicularLine_2` \sa `Kernel::ConstructPointOn_2` \sa `Kernel::ConstructProjectedPoint_2` + \sa `Kernel::ConstructRay_2` \sa `Kernel::DoIntersect_2` \sa `Kernel::Equal_2` \sa `Kernel::HasOnNegativeSide_2` @@ -222,6 +242,7 @@ public: \cgalHasModels{CGAL::Line_3} \cgalHasModelsEnd + \sa `Kernel::AreParallel_3` \sa `Kernel::ComputeSquaredDistance_3` \sa `Kernel::ConstructDirection_3` \sa `Kernel::ConstructLine_3` @@ -230,6 +251,7 @@ public: \sa `Kernel::ConstructPlane_3` \sa `Kernel::ConstructPointOn_3` \sa `Kernel::ConstructProjectedPoint_3` + \sa `Kernel::ConstructRay_3` \sa `Kernel::DoIntersect_3` \sa `Kernel::Equal_3` \sa `Kernel::HasOn_3` @@ -299,18 +321,23 @@ public: \cgalHasModels{CGAL::Plane_3} \cgalHasModelsEnd + \sa `Kernel::AreParallel_3` \sa `Kernel::ComputeSquaredDistance_3` \sa `Kernel::ConstructBaseVector_3` \sa `Kernel::ConstructBisector_3` + \sa `Kernel::ConstructCircle_3` \sa `Kernel::ConstructLiftedPoint_3` \sa `Kernel::ConstructOppositePlane_3` \sa `Kernel::ConstructOrthogonalVector_3` + \sa `Kernel::ConstructProjectedXYPoint_2` \sa `Kernel::ConstructPerpendicularLine_3` \sa `Kernel::ConstructPerpendicularPlane_3` \sa `Kernel::ConstructPlane_3` \sa `Kernel::ConstructPointOn_3` \sa `Kernel::ConstructProjectedPoint_3` \sa `Kernel::ConstructProjectedXYPoint_2` + \sa `Kernel::ConstructRadicalPlane_3` + \sa `Kernel::ConstructSupportingPlane_3` \sa `Kernel::DoIntersect_3` \sa `Kernel::Equal_3` \sa `Kernel::HasOnNegativeSide_3` @@ -365,6 +392,7 @@ public: \sa `Kernel::ConstructPoint_2` \sa `Kernel::ConstructProjectedPoint_2` \sa `Kernel::ConstructProjectedXYPoint_2` + \sa `Kernel::ConstructRay_2` \sa `Kernel::ConstructTranslatedPoint_2` \sa `Kernel::DoIntersect_2` \sa `Kernel::Equal_2` @@ -425,6 +453,7 @@ public: \sa `Kernel::ConstructPointOn_3` \sa `Kernel::ConstructPoint_3` \sa `Kernel::ConstructProjectedPoint_3` + \sa `Kernel::ConstructRay_3` \sa `Kernel::ConstructTranslatedPoint_3` \sa `Kernel::CoplanarOrientation_3` \sa `Kernel::CoplanarSideOfBoundedCircle_3` @@ -496,6 +525,7 @@ public: \cgalHasModels{CGAL::Ray_3} \cgalHasModelsEnd + \sa `Kernel::AreParallel_3` \sa `Kernel::ComputeSquaredDistance_3` \sa `Kernel::ConstructDirection_3` \sa `Kernel::ConstructLine_3` @@ -562,6 +592,7 @@ public: \cgalHasModels{CGAL::Segment_3} \cgalHasModelsEnd + \sa `Kernel::AreParallel_3` \sa `Kernel::ComputeSquaredDistance_3` \sa `Kernel::ComputeSquaredLength_3` \sa `Kernel::ConstructDirection_3` @@ -600,7 +631,7 @@ public: \sa `Kernel::ConstructOppositeSphere_3` \sa `Kernel::ConstructRadicalPlane_3` \sa `Kernel::ConstructSphere_3` - \sa `Kernel::Equal_2` + \sa `Kernel::Equal_3` \sa `Kernel::HasOnBoundary_3` \sa `Kernel::HasOnBoundedSide_3` \sa `Kernel::HasOnNegativeSide_3` @@ -631,7 +662,7 @@ public: \sa `Kernel::ConstructCentroid_3` \sa `Kernel::ConstructTetrahedron_3` \sa `Kernel::ConstructVertex_3` - \sa `Kernel::Equal_2` + \sa `Kernel::Equal_3` \sa `Kernel::HasOnBoundary_3` \sa `Kernel::HasOnBoundedSide_3` \sa `Kernel::HasOnNegativeSide_3` @@ -735,6 +766,7 @@ public: \sa `Kernel::ConstructDividedVector_2` \sa `Kernel::ConstructSumOfVectors_2` \sa `Kernel::ConstructDifferenceOfVectors_2` + \sa `Kernel::ConstructRay_2` \sa `Kernel::ConstructVector_2` \sa `Kernel::Equal_2` \sa `Kernel::Orientation_2` @@ -764,13 +796,14 @@ A type representing vectors in three dimensions. \sa `Kernel::ComputeY_3` \sa `Kernel::ComputeZ_3` \sa `Kernel::ConstructCrossProductVector_3` +\sa `Kernel::ConstructDifferenceOfVectors_3` \sa `Kernel::ConstructDirection_3` +\sa `Kernel::ConstructDividedVector_3` \sa `Kernel::ConstructOppositeVector_3` \sa `Kernel::ConstructOrthogonalVector_3` +\sa `Kernel::ConstructRay_3` \sa `Kernel::ConstructScaledVector_3` -\sa `Kernel::ConstructDividedVector_3` \sa `Kernel::ConstructSumOfVectors_3` -\sa `Kernel::ConstructDifferenceOfVectors_3` \sa `Kernel::ConstructVector_3` \sa `Kernel::Equal_3` \sa `Kernel::Orientation_3` diff --git a/Kernel_23/examples/Kernel_23/CMakeLists.txt b/Kernel_23/examples/Kernel_23/CMakeLists.txt index f1a8ba7716f..a9f8d9090b5 100644 --- a/Kernel_23/examples/Kernel_23/CMakeLists.txt +++ b/Kernel_23/examples/Kernel_23/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_23_Examples) find_package(CGAL REQUIRED) diff --git a/Kernel_23/examples/Kernel_23/MyKernel.cpp b/Kernel_23/examples/Kernel_23/MyKernel.cpp index 834a22629b8..0894706db7b 100644 --- a/Kernel_23/examples/Kernel_23/MyKernel.cpp +++ b/Kernel_23/examples/Kernel_23/MyKernel.cpp @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 5a7b0774e6d..c932ea5acfe 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -937,15 +937,14 @@ namespace CommonKernelFunctors { Needs_FT operator()(const T1& p, const T2& q, const FT& d2) const { - return CGAL::compare(internal::squared_distance(p, q, K()), d2); + return internal::compare_squared_distance(p, q, K(), d2); } template Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { - return CGAL::compare(internal::squared_distance(p, q, K()), - internal::squared_distance(r, s, K())); + return internal::compare_squared_distance(p, q, K(), internal::squared_distance(r, s, K())); } }; @@ -965,22 +964,14 @@ namespace CommonKernelFunctors { typename K::Compute_scalar_product_3 scalar_product = k.compute_scalar_product_3_object(); - double product = CGAL::sqrt(to_double(scalar_product(u,u)) * to_double(scalar_product(v,v))); + double product = to_double(approximate_sqrt(scalar_product(u,u) * scalar_product(v,v))); if(product == 0) return 0; // cosine double dot = to_double(scalar_product(u,v)); - double cosine = dot / product; - - if(cosine > 1.){ - cosine = 1.; - } - if(cosine < -1.){ - cosine = -1.; - } - + double cosine = std::clamp(dot / product, -1., 1.); return std::acos(cosine) * 180./CGAL_PI; } diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_3.h b/Kernel_23/include/CGAL/Kernel/global_functions_3.h index 6fb9b975647..b660dd84f05 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_3.h @@ -412,16 +412,6 @@ compare_slope(const Point_3 &p, return internal::compare_slope(p, q, r, s, K()); } -template < class K > -inline -typename K::Comparison_result -compare_squared_distance(const Point_3 &p, - const Point_3 &q, - const typename K::FT &d2) -{ - return internal::compare_squared_distance(p, q, d2, K()); -} - template < class K > inline typename K::Comparison_result diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 106eced3810..ce9af1c75bc 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_23_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h b/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h index aa572c2df9a..f2edc867e1d 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Aff_transformation_d.h @@ -98,7 +98,7 @@ in the plane spanned by the base vectors \f$ b_{e1}\f$ and \f$ b_{e2}\f$ in \f$ d\f$-space. Thus the default use delivers a planar rotation in the \f$ x\f$-\f$ y\f$ plane. -\pre \f$ sin_num^2 + cos_num^2 = den^2\f$ and \f$ 0 \leq e_1 < e_2 < d\f$. +\pre \f$ sin\_num^2 + cos\_num^2 = den^2\f$ and \f$ 0 \leq e_1 < e_2 < d\f$. \pre `den != 0`. */ diff --git a/Kernel_d/doc/Kernel_d/PackageDescription.txt b/Kernel_d/doc/Kernel_d/PackageDescription.txt index f8c024183a2..783f291db01 100644 --- a/Kernel_d/doc/Kernel_d/PackageDescription.txt +++ b/Kernel_d/doc/Kernel_d/PackageDescription.txt @@ -21,7 +21,6 @@ /*! \addtogroup PkgKernelDRef -\todo check generated documentation \cgalPkgDescriptionBegin{dD Geometry Kernel,PkgKernelD} \cgalPkgPicture{hypercube.png} \cgalPkgSummaryBegin diff --git a/Kernel_d/test/Kernel_d/CMakeLists.txt b/Kernel_d/test/Kernel_d/CMakeLists.txt index 6798d13a087..221d83e5d9c 100644 --- a/Kernel_d/test/Kernel_d/CMakeLists.txt +++ b/Kernel_d/test/Kernel_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kernel_d_Tests) find_package(CGAL REQUIRED) diff --git a/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt b/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt index 0ae368020c1..5541e7b43ee 100644 --- a/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt +++ b/Kinetic_space_partition/examples/Kinetic_space_partition/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_space_partition_Examples) diff --git a/Kinetic_space_partition/include/CGAL/KSP/debug.h b/Kinetic_space_partition/include/CGAL/KSP/debug.h index eae47856078..6615721be51 100644 --- a/Kinetic_space_partition/include/CGAL/KSP/debug.h +++ b/Kinetic_space_partition/include/CGAL/KSP/debug.h @@ -929,14 +929,6 @@ void dump_polygon(const std::vector& pts, const std::string saver.export_polygon_soup_3(pts2, filename); } -void dump_polygon(const std::vector& pts, const std::string& filename) { - Saver saver; - std::vector > pts2; - pts2.push_back(pts); - - saver.export_polygon_soup_3(pts2, filename); -} - void dump_polygona(const std::vector& pts, const std::string& filename) { Saver saver; std::vector > pts2; diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h b/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h index 85c93daeb05..8514cff93d8 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Data_structure.h @@ -159,7 +159,6 @@ public: } }; - // ToDo:: check all kind of iterators/circulators using PEdge_around_pvertex_iterator = boost::transform_iterator >; using PEdges_around_pvertex = CGAL::Iterator_range; @@ -1390,16 +1389,19 @@ public: return support_plane(support_plane_idx).to_2d(segment_3); } -/* - IkSegment_2 to_2d(const std::size_t support_plane_idx, const IkSegment_3& segment_3) const { + template + auto to_2d(const std::size_t support_plane_idx, const IkSegment_3& segment_3) const + -> std::enable_if_t, IkSegment_2> { return support_plane(support_plane_idx).to_2d(segment_3); - }*/ + } Point_2 to_2d(const std::size_t support_plane_idx, const Point_3& point_3) const { return support_plane(support_plane_idx).to_2d(point_3); } - IkPoint_2 to_2d(const std::size_t support_plane_idx, const IkPoint_3& point_3) const { + template + auto to_2d(const std::size_t support_plane_idx, const IkPoint_3& point_3) const + -> std::enable_if_t, IkPoint_2> { return support_plane(support_plane_idx).to_2d(point_3); } diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h b/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h index f3e5550a4d9..9942d696dcc 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Initializer.h @@ -493,7 +493,7 @@ private: typename Intersection_graph::Kinetic_interval& kinetic_interval = m_data.igraph().kinetic_interval(e, sp_idx); crossing_iedges.push_back(e); - if (emin > s || std::isinf(min_speed)) { + if (emin > s || std::isinf(CGAL::to_double(min_speed))) { typename Intersection_kernel::FT bary_edge_exact = (emin - s) / (t - s); FT bary_edge = from_exact((emin - s) / (t - s)); CGAL_assertion(bary_edge_exact >= 0); @@ -505,7 +505,7 @@ private: kinetic_interval.push_back(std::pair(0, 0)); } - if (t > emax || std::isinf(max_speed)) { + if (t > emax || std::isinf(CGAL::to_double(max_speed))) { typename Intersection_kernel::FT bary_edge_exact = (emax - s) / (t - s); FT bary_edge = from_exact((emax - s) / (t - s)); CGAL_assertion(0 <= bary_edge_exact && bary_edge_exact <= 1); diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h b/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h index b85e37ea14d..c4f0e0c5ed9 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Support_plane.h @@ -377,7 +377,7 @@ public: for (const auto& pair : points) { const auto& point = pair.first; directions.push_back(typename Intersection_kernel::Vector_2(to_exact(m_data->centroid), point)); - const FT length = CGAL::sqrt(CGAL::abs(from_exact(directions.back() * directions.back()))); + const FT length = CGAL::approximate_sqrt(CGAL::abs(from_exact(directions.back() * directions.back()))); sum_length += length; num += 1; } @@ -676,8 +676,9 @@ public: m_data->plane.to_2d(Point_3(0, 0, 0) + vec)); } - template::type > - const typename Intersection_kernel::Point_2 to_2d(const typename Intersection_kernel::Point_3& point) const { + template + auto to_2d(const typename Intersection_kernel::Point_3& point) const + ->std::enable_if_t, const typename Intersection_kernel::Point_2> { return m_data->exact_plane.to_2d(point); } @@ -687,8 +688,9 @@ public: m_data->plane.to_2d(line.point() + line.to_vector())); } - template::type > - const typename Intersection_kernel::Line_2 to_2d(const typename Intersection_kernel::Line_3& line) const { + template + auto to_2d(const typename Intersection_kernel::Line_3& line) const + -> std::enable_if_t, const typename Intersection_kernel::Line_2> { return typename Intersection_kernel::Line_2( m_data->exact_plane.to_2d(line.point()), m_data->exact_plane.to_2d(line.point() + line.to_vector())); @@ -700,25 +702,21 @@ public: m_data->plane.to_2d(segment.target())); } - template::type > - const typename Intersection_kernel::Segment_2 to_2d(const typename Intersection_kernel::Segment_3& segment) const { + template + auto to_2d(const typename Intersection_kernel::Segment_3& segment) const + -> std::enable_if_t, const typename Intersection_kernel::Segment_2> { return typename Intersection_kernel::Segment_2( m_data->exact_plane.to_2d(segment.source()), m_data->exact_plane.to_2d(segment.target())); } - const Vector_3 to_3d(const Vector_2& vec) const { - return Vector_3( - m_data->plane.to_3d(Point_2(FT(0), FT(0))), - m_data->plane.to_3d(Point_2(FT(0), FT(0)) + vec)); - } - const Point_3 to_3d(const Point_2& point) const { return m_data->plane.to_3d(point); } - template::type > - const typename Intersection_kernel::Point_3 to_3d(const typename Intersection_kernel::Point_2& point) const { + template + auto to_3d(const typename Intersection_kernel::Point_2& point) const + ->std::enable_if_t, const typename Intersection_kernel::Point_3> { return m_data->exact_plane.to_3d(point); } diff --git a/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h b/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h index a11a1f9dc71..23a43b8f646 100644 --- a/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h +++ b/Kinetic_space_partition/include/CGAL/Kinetic_space_partition_3.h @@ -398,6 +398,8 @@ public: using NP_helper = Point_set_processing_3_np_helper; using PointMap = typename NP_helper::Point_map; + static_assert(std::is_same_v); + PointMap point_map = NP_helper::get_point_map(np); To_exact to_exact; diff --git a/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt b/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt index 3df57e9e4d0..edae7092c3f 100644 --- a/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt +++ b/Kinetic_space_partition/test/Kinetic_space_partition/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_space_partition_Tests) @@ -10,30 +10,24 @@ set(CMAKE_CXX_STANDARD 17) find_package(CGAL QUIET COMPONENTS Core) include(CGAL_CreateSingleSourceCGALProgram) -find_package(Boost REQUIRED) -if(Boost_FOUND) - message(STATUS "Found Boost") - - find_package(Eigen3 3.1.0 REQUIRED) - if(Eigen3_FOUND) - message(STATUS "Found Eigen") - include(CGAL_Eigen3_support) - - set(targets kinetic_3d_test_all issue_8624) - - set(project_linked_libraries) - set(project_compilation_definitions) - - foreach(target ${targets}) - create_single_source_cgal_program("${target}.cpp") - if(TARGET ${target}) - target_link_libraries(${target} PRIVATE ${project_linked_libraries} CGAL::Eigen3_support) - target_compile_definitions(${target} PRIVATE ${project_compilation_definitions}) - endif() - endforeach() - else() - message(ERROR "This program requires the Eigen library, and will not be compiled.") - endif() -else() - message(ERROR "This program requires the Boost library, and will not be compiled.") +find_package(Eigen3 3.1.0 REQUIRED) +if(NOT Eigen3_FOUND) + message(ERROR "This project requires the Eigen library, and will not be compiled.") + return() endif() + +message(STATUS "Found Eigen") +include(CGAL_Eigen3_support) + +set(targets kinetic_3d_test_all issue_8624) + +set(project_linked_libraries) +set(project_compilation_definitions) + +foreach(target ${targets}) + create_single_source_cgal_program("${target}.cpp") + if(TARGET ${target}) + target_link_libraries(${target} PRIVATE ${project_linked_libraries} CGAL::Eigen3_support) + target_compile_definitions(${target} PRIVATE ${project_compilation_definitions}) + endif() +endforeach() diff --git a/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt b/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt index 5445891abb0..9ec2ba71fb9 100644 --- a/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt +++ b/Kinetic_surface_reconstruction/examples/Kinetic_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_surface_reconstruction_Examples) diff --git a/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h b/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h index 9ff59a0202a..b2325f285d9 100644 --- a/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h +++ b/Kinetic_surface_reconstruction/include/CGAL/Kinetic_surface_reconstruction_3.h @@ -1546,7 +1546,7 @@ private: n = m_lcc.beta(n, 1); } while (n != dh); - KSP_3::internal::dump_polygon(face, fn); + KSP_3::internal::dump_polygon(face, fn); } void write_edge(typename LCC::Dart_descriptor dh, const std::string& fn) { @@ -1707,7 +1707,7 @@ private: m_face_area_lcc.resize(m_faces_lcc.size(), 0); for (std::size_t i = 0; i < m_faces_lcc.size(); i++) - m_face_area_lcc[i] = m_face_area_lcc[i] * 2.0 * m_total_inliers / total_area; + m_face_area_lcc[i] = m_face_area_lcc[i] * FT(2.0) * FT(m_total_inliers) / total_area; } FT area(typename LCC::Dart_descriptor face_dart, Plane_3 &pl, std::vector *tris = nullptr) { diff --git a/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt b/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt index bf6b5fc9d13..b4a355e2b65 100644 --- a/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt +++ b/Kinetic_surface_reconstruction/test/Kinetic_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Kinetic_surface_reconstruction_Tests) diff --git a/Lab/demo/Lab/CGAL_Lab.cpp b/Lab/demo/Lab/CGAL_Lab.cpp index 85880fb8add..ff4d0d3c598 100644 --- a/Lab/demo/Lab/CGAL_Lab.cpp +++ b/Lab/demo/Lab/CGAL_Lab.cpp @@ -83,7 +83,7 @@ CGAL_Lab::CGAL_Lab(int& argc, char **argv, tr("Ignore the autostart.js file, if any.")); parser.addOption(no_autostart); QCommandLineOption verbose("verbose", - tr("Print the paths explored byt the application searching for plugins.")); + tr("Print the paths explored by the application searching for plugins.")); parser.addOption(verbose); QCommandLineOption old("old", tr("Force OpenGL 2.1 context.")); diff --git a/Lab/demo/Lab/CGALlab.h b/Lab/demo/Lab/CGALlab.h index 0e40646762d..51afe5d0db0 100644 --- a/Lab/demo/Lab/CGALlab.h +++ b/Lab/demo/Lab/CGALlab.h @@ -20,7 +20,7 @@ public: * Constructor : calls the constructor of QApplication */ CGAL_Lab(int& argc, char **argv, - QString application_name = "Polyhedron_3 demo", + QString application_name = "CGAL Lab", QString main_window_title = "CGAL Lab", QStringList input_keywords = QStringList()); diff --git a/Lab/demo/Lab/CGALlab_macros.cmake b/Lab/demo/Lab/CGALlab_macros.cmake index 73f2733bc79..5a1756a0e43 100644 --- a/Lab/demo/Lab/CGALlab_macros.cmake +++ b/Lab/demo/Lab/CGALlab_macros.cmake @@ -63,30 +63,20 @@ add_dependencies(CGALlab_compile_all_plugins CGALlab_all_plugins) STRING(TOLOWER "${plugin_implementation_base_name}.json" base_name) SET(filename "${CMAKE_CURRENT_BINARY_DIR}/${base_name}") LIST(LENGTH ARG_KEYWORDS size) + SET(keywords "") if(${size} GREATER 0) - SET(keywords ) - FILE(WRITE ${filename} "{ \"Keywords\" : [") foreach(keyword ${ARG_KEYWORDS}) - LIST(APPEND keywords "\"${keyword}\", ") + SET(keywords "${keywords}\"${keyword}\", ") if(NOT TARGET ${keyword}) add_custom_target(${keyword}) endif() add_dependencies( ${keyword} ${plugin_name}) endforeach() - LIST(LENGTH keywords size) - math(EXPR size "${size} - 1") - LIST(GET keywords -1 last_element) - LIST(REMOVE_AT keywords ${size}) - STRING(LENGTH ${last_element} size) - math(EXPR size "${size} - 2") - STRING(SUBSTRING ${last_element} 0 ${size} last_element) - LIST(APPEND keywords ${last_element}) - foreach(keyword ${keywords}) - file(APPEND ${filename} ${keyword}) - endforeach() - file(APPEND ${filename} "], \n") - string(TIMESTAMP VERSION "%Y-%m-%d %H:%M") - file(APPEND ${filename} "\"ConfigDate\" : \"${VERSION}\" }") + # Remove the last comma and space + string(REGEX REPLACE ", $" "" keywords "${keywords}") endif() + file(WRITE ${filename} "{\n \"Keywords\" : [ ${keywords} ],\n") + string(TIMESTAMP VERSION "%Y-%m-%d %H:%M") + file(APPEND ${filename} " \"ConfigDate\" : \"${VERSION}\"\n}\n") CGAL_install_hooks() endmacro(cgal_lab_plugin) diff --git a/Lab/demo/Lab/CMakeLists.txt b/Lab/demo/Lab/CMakeLists.txt index 885cd774ce1..13e6104e252 100644 --- a/Lab/demo/Lab/CMakeLists.txt +++ b/Lab/demo/Lab/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Lab_Demo) include(FeatureSummary) diff --git a/Lab/demo/Lab/Color_map.h b/Lab/demo/Lab/Color_map.h index a7a608112eb..909fc2f6a93 100644 --- a/Lab/demo/Lab/Color_map.h +++ b/Lab/demo/Lab/Color_map.h @@ -23,9 +23,9 @@ compute_color_map(QColor base_color, std::size_t nb_of_colors, Output_color_iterator out) { - qreal hue = base_color.hueF(); - const qreal step = (static_cast(1)) / nb_of_colors; + const qreal step = (static_cast(0.85)) / nb_of_colors; + qreal hue = base_color.hueF(); qreal h = (hue == -1) ? 0 : hue; for(std::size_t i=0; ibbox(); - CGAL::qglviewer::Vec min(static_cast(bbox.xmin())+viewer->offset().x, static_cast(bbox.ymin())+viewer->offset().y, static_cast(bbox.zmin())+viewer->offset().z), - max(static_cast(bbox.xmax())+viewer->offset().x, static_cast(bbox.ymax())+viewer->offset().y, static_cast(bbox.zmax())+viewer->offset().z); + CGAL::qglviewer::Vec min{static_cast(bbox.xmin()) + viewer->offset().x, + static_cast(bbox.ymin()) + viewer->offset().y, + static_cast(bbox.zmin()) + viewer->offset().z}; + CGAL::qglviewer::Vec max{static_cast(bbox.xmax()) + viewer->offset().x, + static_cast(bbox.ymax()) + viewer->offset().y, + static_cast(bbox.zmax()) + viewer->offset().z}; viewer->setSceneBoundingBox(min, max); viewerShow(static_cast(min.x), static_cast(min.y), static_cast(min.z), static_cast(max.x), static_cast(max.y), static_cast(max.z)); diff --git a/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp index 5b7e647e96c..689d2c5b318 100644 --- a/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp +++ b/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp @@ -46,9 +46,9 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po std::cerr << m_clusters.size() << " cluster(s) found" << std::endl; bool training_found = false; - boost::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); + std::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); bool classif_found = false; - boost::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); + std::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); training_found = !training_found; // add_property_map returns false if classif_found = !classif_found; // property was already there diff --git a/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp index 11ef26725a6..a5169477661 100644 --- a/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp +++ b/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp @@ -41,9 +41,9 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n backup_existing_colors_and_add_new(); bool training_found = false; - boost::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); + std::tie (m_training, training_found) = m_points->point_set()->add_property_map("training", -1); bool classif_found = false; - boost::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); + std::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); training_found = !training_found; // add_property_map returns false if classif_found = !classif_found; // property was already there diff --git a/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp index f0eb9086215..ae298d99940 100644 --- a/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -350,11 +351,11 @@ private: template void displayMapLegend(const std::vector& values) { - const std::size_t size = (std::min)(color_map.size(), std::size_t(1024)); + const std::size_t size = (std::min)(color_map.size(), std::size_t(4096)); const int text_height = 20; const int height = text_height * static_cast(size) + text_height; - const int width = 140; + const int width = 200; const int cell_width = width / 3; const int top_margin = 15; const int left_margin = 5; @@ -381,13 +382,13 @@ private: tick_height, color); - QRect text_rect(left_margin + cell_width + 10, drawing_height - top_margin - j, 50, text_height); - painter.drawText(text_rect, Qt::AlignCenter, QObject::tr("%1").arg(values[i], 0, 'f', 3, QLatin1Char(' '))); + QRect text_rect(left_margin + cell_width + 10, drawing_height - top_margin - j, 100, text_height); + painter.drawText(text_rect, Qt::AlignCenter, QObject::tr("%1").arg(values[i], 0, 'f', 6, QLatin1Char(' '))); } if(color_map.size() > size) { - QRect text_rect(left_margin + cell_width + 10, 0, 50, text_height); + QRect text_rect(left_margin + cell_width + 10, 0, 100, text_height); painter.drawText(text_rect, Qt::AlignCenter, QObject::tr("[...]")); } @@ -463,6 +464,8 @@ private: "Largest Angle Per Face", "Scaled Jacobian", "Face Area", + "Discrete Mean Curvature", + "Discrete Gaussian Curvature", "Interpolated Corrected Mean Curvature", "Interpolated Corrected Gaussian Curvature"}); property_simplex_types = { Property_simplex_type::FACE, @@ -470,6 +473,8 @@ private: Property_simplex_type::FACE, Property_simplex_type::FACE, Property_simplex_type::VERTEX, + Property_simplex_type::VERTEX, + Property_simplex_type::VERTEX, Property_simplex_type::VERTEX }; detectSMScalarProperties(*(sm_item->face_graph())); } @@ -516,12 +521,12 @@ private Q_SLOTS: // Curvature property-specific slider const std::string& property_name = dock_widget->propertyBox->currentText().toStdString(); - const bool is_curvature_property = (property_name == "Interpolated Corrected Mean Curvature" || - property_name == "Interpolated Corrected Gaussian Curvature"); - dock_widget->expandingRadiusLabel->setVisible(is_curvature_property); - dock_widget->expandingRadiusSlider->setVisible(is_curvature_property); - dock_widget->expandingRadiusLabel->setEnabled(is_curvature_property); - dock_widget->expandingRadiusSlider->setEnabled(is_curvature_property); + const bool is_interpolated_curvature_property = (property_name == "Interpolated Corrected Mean Curvature" || + property_name == "Interpolated Corrected Gaussian Curvature"); + dock_widget->expandingRadiusLabel->setVisible(is_interpolated_curvature_property); + dock_widget->expandingRadiusSlider->setVisible(is_interpolated_curvature_property); + dock_widget->expandingRadiusLabel->setEnabled(is_interpolated_curvature_property); + dock_widget->expandingRadiusSlider->setEnabled(is_interpolated_curvature_property); } else // no or broken property { @@ -570,6 +575,16 @@ private: { displayArea(sm_item); } + else if(property_name == "Discrete Mean Curvature") + { + displayDiscreteCurvatureMeasure(sm_item, MEAN_CURVATURE); + sm_item->setRenderingMode(Gouraud); + } + else if(property_name == "Discrete Gaussian Curvature") + { + displayDiscreteCurvatureMeasure(sm_item, GAUSSIAN_CURVATURE); + sm_item->setRenderingMode(Gouraud); + } else if(property_name == "Interpolated Corrected Mean Curvature") { displayInterpolatedCurvatureMeasure(sm_item, MEAN_CURVATURE); @@ -682,6 +697,8 @@ private: removeDisplayPluginProperty(item, "f:display_plugin_largest_angle"); removeDisplayPluginProperty(item, "f:display_plugin_scaled_jacobian"); removeDisplayPluginProperty(item, "f:display_plugin_area"); + removeDisplayPluginProperty(item, "v:display_plugin_discrete_mean_curvature"); + removeDisplayPluginProperty(item, "v:display_plugin_discrete_Gaussian_curvature"); removeDisplayPluginProperty(item, "v:display_plugin_interpolated_corrected_mean_curvature"); removeDisplayPluginProperty(item, "v:display_plugin_interpolated_corrected_Gaussian_curvature"); } @@ -864,6 +881,35 @@ private: displaySMProperty("f:display_plugin_area", *sm); } +private: + void displayDiscreteCurvatureMeasure(Scene_surface_mesh_item* sm_item, + CurvatureType mu_index) + { + SMesh* sm = sm_item->face_graph(); + if(sm == nullptr) + return; + + if(mu_index != MEAN_CURVATURE && mu_index != GAUSSIAN_CURVATURE) + return; + + std::string vdc_name = (mu_index == MEAN_CURVATURE) ? "v:display_plugin_discrete_mean_curvature" + : "v:display_plugin_discrete_Gaussian_curvature"; + + bool not_initialized; + SMesh::Property_map vdc; + std::tie(vdc, not_initialized) = sm->add_property_map(vdc_name, 0); + + if(not_initialized) + { + if(mu_index == MEAN_CURVATURE) + PMP::discrete_mean_curvatures(*sm, vdc); + else + PMP::discrete_Gaussian_curvatures(*sm, vdc); + } + + displaySMProperty(vdc_name, *sm); + } + private Q_SLOTS: void setExpandingRadius() { @@ -1131,6 +1177,10 @@ private: zoomToSimplexWithPropertyExtremum(faces(mesh), mesh, "f:display_plugin_scaled_jacobian", extremum); else if(property_name == "Face Area") zoomToSimplexWithPropertyExtremum(faces(mesh), mesh, "f:display_plugin_area", extremum); + else if(property_name == "Discrete Mean Curvature") + zoomToSimplexWithPropertyExtremum(vertices(mesh), mesh, "v:display_plugin_discrete_mean_curvature", extremum); + else if(property_name == "Discrete Gaussian Curvature") + zoomToSimplexWithPropertyExtremum(vertices(mesh), mesh, "v:display_plugin_discrete_Gaussian_curvature", extremum); else if(property_name == "Interpolated Corrected Mean Curvature") zoomToSimplexWithPropertyExtremum(vertices(mesh), mesh, "v:display_plugin_interpolated_corrected_mean_curvature", extremum); else if(property_name == "Interpolated Corrected Gaussian Curvature") @@ -1470,6 +1520,8 @@ isSMPropertyScalar(const std::string& name, name == "f:display_plugin_largest_angle" || name == "f:display_plugin_scaled_jacobian" || name == "f:display_plugin_area" || + name == "v:display_plugin_discrete_mean_curvature" || + name == "v:display_plugin_discrete_Gaussian_curvature" || name == "v:display_plugin_interpolated_corrected_mean_curvature" || name == "v:display_plugin_interpolated_corrected_Gaussian_curvature") return false; diff --git a/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp index 58512209f23..9fcea780b98 100644 --- a/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp @@ -250,7 +250,7 @@ public: if(!c3t3_item || extension != "vtu") return false; - std::ofstream os(output_filename.data()); + std::ofstream os(output_filename.data(), std::ios::binary); os << std::setprecision(16); const C3t3& c3t3 = c3t3_item->c3t3(); @@ -447,8 +447,8 @@ public: cit != c3t3_item->c3t3().triangulation().finite_cells_end(); ++cit) { - CGAL_assertion(cit->info() >= 0); - c3t3_item->c3t3().add_to_complex(cit, cit->info()); + if(cit->info() != 0) + c3t3_item->c3t3().add_to_complex(cit, cit->info()); for(int i=0; i < 4; ++i) { if(cit->surface_patch_index(i)>0) diff --git a/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp index e55c30779bb..515ad8a999c 100644 --- a/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp @@ -124,7 +124,7 @@ void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, int constant_coordinat { typename Map::iterator it; bool insert_ok; - boost::tie(it,insert_ok) = + std::tie(it,insert_ok) = descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); if (insert_ok){ const Kernel::Point_3& pt=fit->vertex(i)->point(); diff --git a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt index 6edbaf4da55..b63737188ff 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt @@ -2,6 +2,8 @@ include(CGALlab_macros) remove_definitions(-DQT_STATICPLUGIN) +set(CMAKE_AUTOMOC ON) + qt6_wrap_cpp(VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_thread.h) qt6_wrap_cpp(VOLUME_MOC_OUTFILES diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp index 2aadc761957..f2c255a10fc 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -592,7 +592,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.protect->setChecked(features_protection_available); ui.facegraphCheckBox->setVisible(mesh_type == Mesh_type::SURFACE_ONLY); - ui.initializationGroup->setVisible(input_is_labeled_img); + ui.initializationGroup->setVisible(input_is_labeled_img || input_is_gray_img); ui.grayImgGroup->setVisible(input_is_gray_img); if(input_is_gray_img) diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp index e46ecd6c4de..d1e560c5aa7 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp @@ -20,19 +20,6 @@ using namespace CGAL::Three; typedef Tr::Bare_point Bare_point; -struct Compare_to_isovalue { - double iso_value; - bool less; - typedef bool result_type; - - Compare_to_isovalue(double iso_value, bool less) - : iso_value(iso_value), less(less) {} - - bool operator()(double x) const { - return (x < iso_value) == less; - } -}; - Meshing_thread* cgal_code_mesh_3(QList pMeshes, const Polylines_container& polylines, const SMesh* pBoundingMesh, @@ -355,6 +342,8 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, param.protect_features = protect_features || protect_borders || !polylines.empty(); param.detect_connected_components = detect_connected_components; + param.iso_value = iso_value; + param.inside_is_less = inside_is_less; param.facet_angle = facet_angle; param.facet_sizing = facet_sizing; param.facet_min_sizing = facet_min_sizing; diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h index 37d59c7e0a5..433d6cfc549 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h @@ -27,7 +27,8 @@ #include #include #include -#include +#include +#include #include "C3t3_type.h" #include "Meshing_thread.h" @@ -40,6 +41,19 @@ namespace CGAL { class Image_3; } +struct Compare_to_isovalue { + double iso_value; + bool less; + typedef bool result_type; + + Compare_to_isovalue(double iso_value, bool less) + : iso_value(iso_value), less(less) {} + + bool operator()(double x) const { + return (x < iso_value) == less; + } +}; + struct Mesh_parameters { double facet_angle; @@ -55,6 +69,8 @@ struct Mesh_parameters double edge_distance; bool protect_features; bool detect_connected_components; + float iso_value; + bool inside_is_less; int manifold; const CGAL::Image_3* image_3_ptr; const CGAL::Image_3* weights_ptr; @@ -111,6 +127,7 @@ private: void initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag); void initialize(const Mesh_criteria& criteria, Mesh_fnt::Labeled_image_domain_tag); + void initialize(const Mesh_criteria& criteria, Mesh_fnt::Gray_image_domain_tag); Edge_criteria edge_criteria(double b, double minb, double d, Mesh_fnt::Domain_tag); Edge_criteria edge_criteria(double b, double minb, double d, Mesh_fnt::Polyhedral_domain_tag); @@ -231,16 +248,61 @@ Mesh_function:: initialize(const Mesh_criteria& criteria, Mesh_fnt::Labeled_image_domain_tag) // for a labeled image { - if(p_.detect_connected_components) { - CGAL_IMAGE_IO_CASE(p_.image_3_ptr->image(), - initialize_triangulation_from_labeled_image(c3t3_ - , *domain_ - , *p_.image_3_ptr - , criteria - , Word() - , p_.protect_features); - ); - } else { + namespace p = CGAL::parameters; + // Initialization of the labeled image, either with the protection of sharp + // features, or with the initial points (or both). + if (p_.detect_connected_components) + { + CGAL::Mesh_3::internal::C3t3_initializer< + C3t3, + Domain, + Mesh_criteria, + CGAL::internal::has_Has_features::value >() + (c3t3_, + *domain_, + criteria, + p_.protect_features, + p::mesh_3_options(p::pointer_to_stop_atomic_boolean = &stop_, + p::nonlinear_growth_of_balls = true).v, + CGAL::Construct_initial_points_labeled_image(*p_.image_3_ptr, *domain_)); + } + else + { + initialize(criteria, Mesh_fnt::Domain_tag()); + } +} + +template < typename D_, typename Tag > +void +Mesh_function:: +initialize(const Mesh_criteria& criteria, Mesh_fnt::Gray_image_domain_tag) +// for a gray image +{ + namespace p = CGAL::parameters; + // Initialization of the gray image, either with the protection of sharp + // features, or with the initial points (or both). + if (p_.detect_connected_components) + { + CGAL::Construct_initial_points_gray_image generator + (*p_.image_3_ptr, + *domain_, + p_.iso_value, + Compare_to_isovalue(p_.iso_value, p_.inside_is_less)); + CGAL::Mesh_3::internal::C3t3_initializer< + C3t3, + Domain, + Mesh_criteria, + CGAL::internal::has_Has_features::value >() + (c3t3_, + *domain_, + criteria, + p_.protect_features, + p::mesh_3_options(p::pointer_to_stop_atomic_boolean = &stop_, + p::nonlinear_growth_of_balls = true).v, + generator); + } + else + { initialize(criteria, Mesh_fnt::Domain_tag()); } } @@ -254,8 +316,7 @@ initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag) namespace p = CGAL::parameters; // Initialization of the mesh, either with the protection of sharp // features, or with the initial points (or both). - // If `detect_connected_components==true`, the initialization is - // already done. + CGAL::Mesh_3::internal::C3t3_initializer< C3t3, Domain, diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp index df2f5ca5287..a21cdbbf655 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp @@ -1,7 +1,5 @@ #include "config.h" -#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER - #include #include "ui_Offset_meshing_dialog.h" @@ -761,5 +759,3 @@ inflate_mesh() } #include "Offset_meshing_plugin.moc" - -#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp index 15883fa976a..46539303a43 100644 --- a/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp @@ -375,7 +375,7 @@ void Basic_generator_plugin::generateCube() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -416,7 +416,7 @@ void Basic_generator_plugin::generateCube() if (list.size()!=6){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 6 doubles."); + msgBox->setText("ERROR : Input should consist of 6 doubles."); msgBox->exec(); return; } @@ -467,7 +467,7 @@ void Basic_generator_plugin::generatePrism() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -514,7 +514,7 @@ void Basic_generator_plugin::generatePyramid() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -557,7 +557,7 @@ void Basic_generator_plugin::generateSphere() if (list.size()!=4){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of four doubles."); + msgBox->setText("ERROR : Input should consist of four doubles."); msgBox->exec(); return; } @@ -607,7 +607,7 @@ void Basic_generator_plugin::generateTetrahedron() if (list.size() != 3) { QMessageBox* msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 doubles."); + msgBox->setText("ERROR : Input should consist of 3 doubles."); msgBox->exec(); return; } @@ -641,7 +641,7 @@ void Basic_generator_plugin::generateTetrahedron() if (list.size() != 12) { QMessageBox* msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 12 doubles."); + msgBox->setText("ERROR : Input should consist of 12 doubles."); msgBox->exec(); return; } @@ -685,7 +685,7 @@ void Basic_generator_plugin::generatePoints() if (list.size()%3!=0){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of triplets."); + msgBox->setText("ERROR : Input should consist of triplets."); msgBox->exec(); return; } @@ -742,14 +742,14 @@ void Basic_generator_plugin::generateLines() if(!is_2d && list.size()%3!=0){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of triplets."); + msgBox->setText("ERROR : Input should consist of triplets."); msgBox->exec(); return false; } else if(is_2d && list.size()%2!=0){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of pairs."); + msgBox->setText("ERROR : Input should consist of pairs."); msgBox->exec(); return false; } @@ -912,7 +912,7 @@ void Basic_generator_plugin::generateGrid() if (list.size()!=6){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 6 doubles."); + msgBox->setText("ERROR : Input should consist of 6 doubles."); msgBox->exec(); return; } diff --git a/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui b/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui index eed6885a04c..f749ca97ab7 100644 --- a/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui +++ b/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui @@ -18,7 +18,7 @@ - 4 + 6 @@ -43,7 +43,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -180,7 +180,7 @@ QGroupBox::title { - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -198,7 +198,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -232,7 +232,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -315,7 +315,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -349,7 +349,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -495,7 +495,7 @@ QGroupBox::title { - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -513,7 +513,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -880,7 +880,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html> @@ -919,7 +919,7 @@ li.checked::marker { content: "\2612"; } - Qt::Vertical + Qt::Orientation::Vertical @@ -1045,7 +1045,7 @@ QGroupBox::title { - Qt::Vertical + Qt::Orientation::Vertical @@ -1081,7 +1081,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html> @@ -1149,7 +1149,7 @@ p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } -</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html> @@ -1167,7 +1167,7 @@ li.checked::marker { content: "\2612"; } - Qt::Vertical + Qt::Orientation::Vertical @@ -1206,7 +1206,7 @@ li.checked::marker { content: "\2612"; } - Qt::Horizontal + Qt::Orientation::Horizontal diff --git a/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp index 1adc2ae81ea..b0a7ca79f35 100644 --- a/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp @@ -897,7 +897,7 @@ private: { typename Map::iterator it; bool insert_ok; - boost::tie(it,insert_ok) = + std::tie(it,insert_ok) = descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); if (insert_ok){ const EPICK::Point_2& pt=fit->vertex(i)->point(); diff --git a/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp index dbe630ad09f..9ffa83fe5ba 100644 --- a/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp @@ -67,7 +67,7 @@ void compute(SMesh* sMesh, bool created = false; SMesh::Property_map> principal_curvatures_and_directions_map; - boost::tie(principal_curvatures_and_directions_map, created) = sMesh->add_property_map> + std::tie(principal_curvatures_and_directions_map, created) = sMesh->add_property_map> ("v:principal_curvatures_and_directions_map", { 0, 0, Vector(0,0,0), Vector(0,0,0) }); @@ -84,7 +84,8 @@ void compute(SMesh* sMesh, for (Vertex_descriptor v : vertices(*sMesh)) { const PMP::Principal_curvatures_and_directions pc = principal_curvatures_and_directions_map[v]; - max_curvature_magnitude_on_mesh = std::max(max_curvature_magnitude_on_mesh, std::max(abs(pc.min_curvature), abs(pc.max_curvature))); + max_curvature_magnitude_on_mesh = + (std::max)(max_curvature_magnitude_on_mesh, (std::max)(abs(pc.min_curvature), abs(pc.max_curvature))); } for(Vertex_descriptor v : vertices(*sMesh)) diff --git a/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp index 7c333459555..884f0bb04f8 100644 --- a/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp @@ -692,7 +692,7 @@ if(!contracted_item) item->mcs->poles(pole_points); vertex_iterator vb, ve; int id = 0; - for (boost::tie(vb, ve) = vertices(*pMesh); vb != ve; ++vb) + for (std::tie(vb, ve) = vertices(*pMesh); vb != ve; ++vb) { std::vector line; line.clear(); diff --git a/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp index 12e6a6ead33..f668a2ffa37 100644 --- a/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp @@ -109,28 +109,28 @@ QList CGAL_Lab_orient_soup_plugin::actions() const { << actionClean; } -void set_vcolors(SMesh* smesh, std::vector colors) +void set_vcolors(SMesh* smesh, const std::vector& colors) { typedef SMesh SMesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; - SMesh::Property_map vcolors = - smesh->property_map("v:color").value(); + + SMesh::Property_map vcolors; bool created; - boost::tie(vcolors, created) = smesh->add_property_map("v:color",CGAL::IO::Color(0,0,0)); + std::tie(vcolors, created) = smesh->add_property_map("v:color",CGAL::IO::Color(0,0,0)); assert(colors.size()==smesh->number_of_vertices()); int color_id = 0; for(vertex_descriptor vd : vertices(*smesh)) vcolors[vd] = colors[color_id++]; } -void set_fcolors(SMesh* smesh, std::vector colors) +void set_fcolors(SMesh* smesh, const std::vector& colors) { typedef SMesh SMesh; typedef boost::graph_traits::face_descriptor face_descriptor; - SMesh::Property_map fcolors = - smesh->property_map("f:color").value(); + + SMesh::Property_map fcolors; bool created; - boost::tie(fcolors, created) = smesh->add_property_map("f:color",CGAL::IO::Color(0,0,0)); + std::tie(fcolors, created) = smesh->add_property_map("f:color",CGAL::IO::Color(0,0,0)); assert(colors.size()==smesh->number_of_faces()); int color_id = 0; for(face_descriptor fd : faces(*smesh)) diff --git a/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp index eaf633c7cf5..6daad328b43 100644 --- a/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp @@ -210,6 +210,7 @@ public: connect(ui_widget.Select_sharp_edges_button, SIGNAL(clicked()), this, SLOT(on_Select_sharp_edges_button_clicked())); connect(ui_widget.selectionOrEuler, SIGNAL(currentChanged(int)), this, SLOT(on_SelectionOrEuler_changed(int))); connect(ui_widget.editionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_editionBox_changed(int))); + connect(ui_widget.movePoint_pushButton, SIGNAL(clicked()), this, SLOT(on_movePoint_pushButton_clicked())); ui_widget.Sharp_edges_label->hide(); ui_widget.Sharp_angle_spinbox->hide(); @@ -701,7 +702,7 @@ public Q_SLOTS: begin != selection_item->selected_edges.end(); ++begin) { fg_vertex_descriptor source = target(opposite(halfedge(*begin,*poly),*poly),*poly); - boost::tie(it_find, insert_OK) + std::tie(it_find, insert_OK) = p2vd.insert(std::make_pair(source, Edge_graph::vertex_descriptor())); if (insert_OK) { @@ -711,7 +712,7 @@ public Q_SLOTS: Edge_graph::vertex_descriptor src=it_find->second; fg_vertex_descriptor targ = target(halfedge(*begin,*poly),*poly); - boost::tie(it_find, insert_OK) + std::tie(it_find, insert_OK) = p2vd.insert(std::make_pair(targ, Edge_graph::vertex_descriptor())); if (insert_OK) { @@ -987,6 +988,10 @@ public Q_SLOTS: { Q_EMIT set_operation_mode(mode); } + + ui_widget.movePointCoordinates_textEdit->setVisible(false); + ui_widget.movePoint_pushButton->setVisible(false); + switch(mode) { //Join vertex @@ -1025,24 +1030,97 @@ public Q_SLOTS: } //Add vertex and face to border case 9: + { + QPixmap pm(":/cgal/Lab/resources/euler_deg2.png"); + ui_widget.docImage_Label->setPixmap(pm); + break; + } + case 10: { QPixmap pm(":/cgal/Lab/resources/add_facet1.png"); ui_widget.docImage_Label->setPixmap(pm); break; } //add facet to border - case 10: + case 11: { QPixmap pm(":/cgal/Lab/resources/add_facet2.png"); ui_widget.docImage_Label->setPixmap(pm); break; } + // Move point + case 12: + { + ui_widget.docImage_Label->clear(); + ui_widget.movePointCoordinates_textEdit->setVisible(true); + ui_widget.movePoint_pushButton->setVisible(true); + ui_widget.movePoint_pushButton->setEnabled(true); + break; + } default: ui_widget.docImage_Label->clear(); break; } on_LassoCheckBox_changed(ui_widget.lassoCheckBox->isChecked()); } + + void on_movePoint_pushButton_clicked() + { + QString text = ui_widget.movePointCoordinates_textEdit->toPlainText(); + Scene_points_with_normal_item* item = new Scene_points_with_normal_item(); + QStringList list = text.split(QRegularExpression("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); + int counter = 0; + double coord[3]; + bool ok = true; + if (list.isEmpty()) return; + if (list.size() != 3){ + QMessageBox *msgBox = new QMessageBox; + msgBox->setWindowTitle("Error"); + msgBox->setText("ERROR : Input should consist of a triplet."); + msgBox->exec(); + return; + } + + for(QString s : list) + { + if(!s.isEmpty()) + { + double res = s.toDouble(&ok); + if(!ok) + { + QMessageBox *msgBox = new QMessageBox; + msgBox->setWindowTitle("Error"); + msgBox->setText("ERROR : Coordinates are invalid."); + msgBox->exec(); + break; + } + else + { + coord[counter++] = res; + } + } + } + + if(counter == 3) + { + const Kernel::Point_3 p(coord[0], coord[1], coord[2]); + item->point_set()->insert(p); + counter = 0; + + ui_widget.movePointCoordinates_textEdit->clear(); + + Scene_polyhedron_selection_item* selection_item = getSelectedItem(); + if(!selection_item) + selection_item = onTheFlyItem(); + if (!selection_item) { + print_message("Error: there is no selected polyhedron selection item!"); + return; + } + + selection_item->moveVertex(p); + } + } + void on_Select_sharp_edges_button_clicked() { Scene_polyhedron_selection_item* selection_item = getSelectedItem(); if(!selection_item) diff --git a/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui b/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui index d7b76c83d06..5a9dce0a662 100644 --- a/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui +++ b/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui @@ -7,7 +7,7 @@ 0 0 630 - 532 + 579 @@ -46,7 +46,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -61,7 +61,7 @@ - 0 + 1 @@ -176,7 +176,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -200,7 +200,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -218,7 +218,7 @@ Sharp edges angle: - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter @@ -274,7 +274,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -294,7 +294,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -367,7 +367,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -386,7 +386,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -479,7 +479,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -572,20 +572,7 @@ - - - Qt::Vertical - - - - 20 - 40 - - - - - - + @@ -633,6 +620,11 @@ Remove center vertex + + + Remove degree 2 vertex + + Add vertex and face to border (Advanced) @@ -659,6 +651,29 @@ + + + + true + + + + 0 + 0 + + + + New Coordinates: X Y Z + + + + + + + Apply move + + + @@ -666,15 +681,28 @@ - - - - Ctrl+Z to cancel the temporary selection. Ctrl+U to undo last operation (if applicable). - - - + + + + Ctrl+Z to cancel the temporary selection. Ctrl+U to undo last operation (if applicable). + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + @@ -685,7 +713,7 @@ - Qt::Vertical + Qt::Orientation::Vertical diff --git a/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index 1baaa63af33..5a0c76720ea 100644 --- a/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -277,7 +277,7 @@ private: Point_set::Property_map shape_id; if (dialog.add_property()) { bool added = false; - boost::tie(shape_id, added) = points->template add_property_map ("shape", -1); + std::tie(shape_id, added) = points->template add_property_map ("shape", -1); if (!added) { for (auto it = points->begin(); it != points->end(); ++ it) shape_id[*it] = -1; @@ -563,7 +563,7 @@ private: if (dialog.add_property()) { bool added = false; - boost::tie (shape_id, added) = points->template add_property_map ("shape", -1); + std::tie (shape_id, added) = points->template add_property_map ("shape", -1); if (!added) { for (Point_set::iterator it = points->begin(); it != points->end(); ++ it) diff --git a/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp index ea75b2286ca..95cff942339 100644 --- a/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp @@ -223,10 +223,10 @@ private Q_SLOTS: bool d, r, g, b; new_item->point_set()->remove_colors(); //bind pmaps - boost::tie(distance_map , d) = new_item->point_set()->add_property_map("distance",0); - boost::tie(fred_map , r) = new_item->point_set()->add_property_map("red",0); - boost::tie(fgreen_map, g) = new_item->point_set()->add_property_map("green",0); - boost::tie(fblue_map , b) = new_item->point_set()->add_property_map("blue",0); + std::tie(distance_map , d) = new_item->point_set()->add_property_map("distance",0); + std::tie(fred_map , r) = new_item->point_set()->add_property_map("red",0); + std::tie(fgreen_map, g) = new_item->point_set()->add_property_map("green",0); + std::tie(fblue_map , b) = new_item->point_set()->add_property_map("blue",0); new_item->point_set()->check_colors(); Point_set* points = new_item->point_set(); diff --git a/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp deleted file mode 100644 index 217e5888724..00000000000 --- a/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ /dev/null @@ -1,691 +0,0 @@ -#include "config.h" -#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER -#include -#include "ui_Remeshing_dialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include "Scene_surface_mesh_item.h" -#include "Scene_polygon_soup_item.h" -#include "Scene_polylines_item.h" -#include -#include -#include -#include - -#include "C3t3_type.h" - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include // std::shared_ptr - -namespace CGAL{ - -template -class Offset_function -{ - typedef AABB_face_graph_triangle_primitive Primitive; - typedef AABB_traits_3 Traits; - typedef AABB_tree Tree; - typedef Side_of_triangle_mesh Side_of; - -public: - - Offset_function(TriangleMesh& tm, double offset_distance) - : m_tree_ptr(new Tree(std::begin(faces(tm)), - std::end(faces(tm)), - tm) ) - , m_side_of_ptr( new Side_of(*m_tree_ptr) ) - , m_offset_distance(offset_distance) - , m_is_closed( is_closed(tm) ) - { - CGAL_assertion(!m_tree_ptr->empty()); - } - - double operator()(const typename GeomTraits::Point_3& p) const - { - using CGAL::sqrt; - - Bounded_side side = m_is_closed?m_side_of_ptr->operator()(p):ON_UNBOUNDED_SIDE; - if (side==ON_BOUNDARY) return m_offset_distance; - - typename GeomTraits::Point_3 closest_point = m_tree_ptr->closest_point(p); - double distance = sqrt(squared_distance(p, closest_point)); - - return (side == ON_UNBOUNDED_SIDE ? -distance : distance) + m_offset_distance; - } - -private: - std::shared_ptr m_tree_ptr; - std::shared_ptr m_side_of_ptr; - double m_offset_distance; - bool m_is_closed; - -}; - -class Polygon_soup_offset_function { - typedef Scene_polygon_soup_item::Points Points; - typedef Scene_polygon_soup_item::Polygons Polygons; - - typedef Polygons::const_iterator Polygon_iterator; - - - class Polygon_soup_point_property_map { - const Points* points_vector_ptr; - public: - typedef Polygon_iterator key_type; - typedef EPICK::Point_3 value_type; - typedef const value_type& reference; - typedef boost::readable_property_map_tag category; - - Polygon_soup_point_property_map() = default; - Polygon_soup_point_property_map(const Points* ptr) - : points_vector_ptr(ptr) - {} - - friend reference get(Polygon_soup_point_property_map map, - key_type polygon_it) - { - return (*map.points_vector_ptr)[*polygon_it->begin()]; - } - }; - - - class Polygon_soup_triangle_property_map { - const Points* points_vector_ptr; - public: - typedef Polygon_iterator key_type; - typedef EPICK::Triangle_3 value_type; - typedef value_type reference; - typedef boost::readable_property_map_tag category; - - Polygon_soup_triangle_property_map() = default; - Polygon_soup_triangle_property_map(const Points* ptr) - : points_vector_ptr(ptr) - {} - - friend value_type get(Polygon_soup_triangle_property_map map, - key_type polygon_it) - { - auto it = polygon_it->begin(); - CGAL_assertion(it != polygon_it->end()); - const auto id0 = *it++; - CGAL_assertion(it != polygon_it->end()); - const auto id1 = *it++; - CGAL_assertion(it != polygon_it->end()); - const auto id2 = *it++; - CGAL_assertion(it == polygon_it->end()); - - return value_type( (*map.points_vector_ptr)[id0], - (*map.points_vector_ptr)[id1], - (*map.points_vector_ptr)[id2] ); - } - }; - - struct AABB_primitive : - public CGAL::AABB_primitive - { - typedef CGAL::AABB_primitive Base; - - typedef Polygon_iterator Id; - - template - AABB_primitive(Id id, ObjectPmap&& opmap, PointPmap&& ppmap) - : Base(id, std::forward(opmap), std::forward(ppmap)) - {} - - template - AABB_primitive(Iterator it, ObjectPmap&& opmap, PointPmap&& ppmap) - : Base(*it, std::forward(opmap), std::forward(ppmap)) - {} - }; // end struct template AABB_primitive - - - typedef CGAL::AABB_traits_3 AABB_traits; - typedef CGAL::AABB_tree AABB_tree; - - std::shared_ptr m_tree_ptr; - double m_offset_distance; - - typedef Polygon_soup_triangle_property_map ObjectPmap; - typedef Polygon_soup_point_property_map PointPmap; -public: - Polygon_soup_offset_function(const Scene_polygon_soup_item* soup, - const double offset_distance) - : m_tree_ptr - (std::make_shared(begin(soup->polygons()), - end(soup->polygons()), - ObjectPmap(&soup->points()), - PointPmap(&soup->points())) - ) - , m_offset_distance(offset_distance) - { - CGAL_assertion(! m_tree_ptr->empty() ); - } - - double operator()(const EPICK::Point_3& p) const - { - using CGAL::sqrt; - - EPICK::Point_3 closest_point = m_tree_ptr->closest_point(p); - double distance = sqrt(squared_distance(p, closest_point)); - - return m_offset_distance - distance; - } - -}; // end class Polygon_soup_offset_function - -} //end of CGAL namespace - -Scene_surface_mesh_item* make_item(SMesh* sm) -{ - return new Scene_surface_mesh_item(sm); -} - -CGAL::Offset_function -offset_function(SMesh* surface_mesh_ptr, double offset_value) { - return { *surface_mesh_ptr, offset_value }; -} - -CGAL::Polygon_soup_offset_function -offset_function(Scene_polygon_soup_item* item, double offset_value) { - return { item, offset_value }; -} - -template -struct Result_type { - typedef T type; -}; - -template <> -struct Result_type { - typedef SMesh type; -}; - -template -CGAL::Bbox_3 bbox(Mesh* mesh_ptr) { - return CGAL::Polygon_mesh_processing::bbox(*mesh_ptr); -} - -CGAL::Bbox_3 bbox(Scene_polygon_soup_item* item) { - return item->bbox(); -} -class MeshGuard{ - SMesh* mesh; - bool done; -public: - MeshGuard(SMesh* mesh):mesh(mesh), done(false){} - void setDone(){done = true;} - ~MeshGuard(){ - if(!done) - delete mesh; - } -}; -// declare the CGAL function -template -SMesh* cgal_off_meshing(QWidget*, - Mesh* tm_ptr, - Scene_polylines_item* polylines_item, - const double offset_value, - const double angle, - const double sizing, - const double approx, - const double edge_size, - int tag) -{ - typedef EPICK GT; - typedef CGAL::Labeled_mesh_domain_3 Mesh_domain_base; - typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain; - typedef C3t3::Triangulation Tr; - typedef CGAL::Mesh_criteria_3 Mesh_criteria; - typedef GT::Sphere_3 Sphere_3; - - CGAL::Bbox_3 bbox = ::bbox(tm_ptr); - - GT::Point_3 center((bbox.xmax()+bbox.xmin())/2, - (bbox.ymax()+bbox.ymin())/2, - (bbox.zmax()+bbox.zmin())/2); - double sqrad = 0.6 * std::sqrt( CGAL::square(bbox.xmax()-bbox.xmin())+ - CGAL::square(bbox.ymax()-bbox.ymin())+ - CGAL::square(bbox.zmax()-bbox.zmin()) ) - + offset_value; - sqrad=CGAL::square(sqrad); - - CGAL::Timer timer; - timer.start(); - - namespace p = CGAL::parameters; - - Mesh_domain domain = - Mesh_domain::create_implicit_mesh_domain - (p::function = offset_function(tm_ptr, offset_value), - p::bounding_object = Sphere_3(center, sqrad), - p::relative_error_bound = 1e-7, - p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); }); - - const CGAL::Mesh_facet_topology topology = CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH; - auto manifold_option = p::non_manifold(); - if(tag == 1) manifold_option = p::manifold_with_boundary(); - if(tag == 2) manifold_option = p::manifold(); - Mesh_criteria criteria(p::facet_angle = angle, - p::facet_size = sizing, - p::facet_distance = approx, - p::facet_topology = topology, - p::edge_size = edge_size); - - if (polylines_item!=nullptr) - { - typedef std::vector Surface_patch_ids; - std::vector surface_patch_ids; - - domain.add_features_and_incidences(polylines_item->polylines.begin(), - polylines_item->polylines.end(), - CGAL::Identity_property_map(), - CGAL::Constant_property_map( - surface_patch_ids)); - } - - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - p::no_perturb(), - p::no_exude(), - manifold_option); - - const Tr& tr = c3t3.triangulation(); - - timer.stop(); - std::cerr << "done (" << timer.time() << " ms, " << tr.number_of_vertices() << " vertices)" << std::endl; - - if(tr.number_of_vertices() > 0) - { - typedef typename Result_type::type Result_mesh; - // add remesh as new polyhedron - Result_mesh *pRemesh = new Result_mesh; - //if the thread is interrupted before the mesh is returned, delete it. - MeshGuard guard(pRemesh); - CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, *pRemesh); - guard.setDone(); - if(CGAL::is_closed(*pRemesh) - && ! CGAL::Polygon_mesh_processing::is_outward_oriented(*pRemesh)) - { - CGAL::Polygon_mesh_processing::reverse_face_orientations(*pRemesh); - } - - return pRemesh; - } - else - return nullptr; -} - -struct Mesher_thread:public QThread{ - Q_OBJECT - -private: - SMesh* sMesh; - Scene_polygon_soup_item* soup_item; - Scene_polylines_item* polylines_item; - const double offset_value; - const double angle; - const double sizing; - const double approx; - const double edge_size; - int tag_index; -public: - Mesher_thread( SMesh* tm_ptr, - Scene_polygon_soup_item* soup_item, - Scene_polylines_item* polylines_item, - const double offset_value, - const double angle, - const double sizing, - const double approx, - const double edge_size, - int tag) - :sMesh(tm_ptr), soup_item(soup_item), polylines_item(polylines_item), - offset_value(offset_value), angle(angle), - sizing(sizing), approx(approx), edge_size(edge_size), tag_index(tag){ - } - void run() override { - SMesh* new_mesh= nullptr; - if(soup_item) - new_mesh = cgal_off_meshing(CGAL::Three::Three::mainWindow(), - soup_item, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - else - new_mesh = cgal_off_meshing(CGAL::Three::Three::mainWindow(), - sMesh, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::getWaitCondition()->wakeAll(); - CGAL::Three::Three::getMutex()->unlock(); - Q_EMIT resultReady(new_mesh); - } -Q_SIGNALS: - void resultReady(SMesh *new_mesh); -}; - -using namespace CGAL::Three; -class CGAL_Lab_offset_meshing_plugin : - public QObject, - protected CGAL_Lab_plugin_interface -{ - Q_OBJECT - Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") - -public: - void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { - this->scene = scene_interface; - this->mw = mainWindow; - actionOffsetMeshing = new QAction(tr("Offset Meshing"), mw); - actionOffsetMeshing->setProperty("subMenuName", "3D Surface Mesh Generation"); - if(actionOffsetMeshing) { - connect(actionOffsetMeshing, SIGNAL(triggered()), - this, SLOT(offset_meshing())); - } - - actionInflateMesh= new QAction(tr("Inflate Mesh"), mw); - actionInflateMesh->setProperty("subMenuName", "Operations on Polyhedra"); - if(actionInflateMesh) { - connect(actionInflateMesh, SIGNAL(triggered()), - this, SLOT(inflate_mesh())); - } - } - - bool applicable(QAction*) const { - if ( scene->selectionIndices().size() != 1 && - scene->selectionIndices().size() != 2 ) - { - return false; - } - - for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) - { - if ( qobject_cast(scene->item(index)) || - qobject_cast(scene->item(index)) ) - return true; - } - return false; - } - - QList actions() const { - return QList() << actionOffsetMeshing - << actionInflateMesh; - } -public Q_SLOTS: - void offset_meshing(); - void inflate_mesh(); - -private: - QAction* actionOffsetMeshing; - QAction* actionInflateMesh; - Scene_interface *scene; - QMainWindow *mw; -}; // end class CGAL_Lab_offset_meshing_plugin - -void CGAL_Lab_offset_meshing_plugin::inflate_mesh() -{ - const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_item* item = scene->item(index); - if(item == nullptr){ - return; - } - - Scene_surface_mesh_item* sm_item = - qobject_cast(item); - - if(sm_item == nullptr){ - return; - } - - SMesh* sMesh = sm_item->face_graph(); - - if(sMesh == nullptr){ - return; - } - - double diag = sm_item->diagonalBbox(); - double offset_value = QInputDialog::getDouble(mw, - QString("Choose Inflate Distance"), - QString("Inflate Distance (use negative number for deflate)"), - 0.1*diag, - -(std::numeric_limits::max)(), - (std::numeric_limits::max)(), 10); - - auto vpm = get(CGAL::vertex_point,*sMesh); - auto vnm = - sMesh->property_map("v:normal").value(); - - for(const auto& v : vertices(*sMesh)) - { - Point_3 p = get(vpm, v); - EPICK::Vector_3 n = get(vnm, v); - n/=(CGAL::sqrt(n.squared_length())); - put(vpm, v, p + offset_value*n); - } - sm_item->invalidateOpenGLBuffers(); -} - -void CGAL_Lab_offset_meshing_plugin::offset_meshing() -{ - Scene_surface_mesh_item* sm_item = nullptr; - Scene_polygon_soup_item* soup_item = nullptr; - Scene_polylines_item* polylines_item = nullptr; - Scene_item* item = nullptr; - - bool mesh_or_soup_item_found = false; - - for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) - { - if (!mesh_or_soup_item_found) - { - sm_item = qobject_cast(scene->item(index)); - if (sm_item == nullptr) - { - soup_item = qobject_cast(item); - if (soup_item != nullptr) - { - item=scene->item(index); - mesh_or_soup_item_found = true; - continue; - } - } - else - { - item=scene->item(index); - mesh_or_soup_item_found = true; - continue; - } - } - polylines_item = qobject_cast(scene->item(index)); - } - - SMesh* sMesh = nullptr; - double diag = 0; - Scene_item::Bbox box; - if(sm_item) - { - sMesh = sm_item->face_graph(); - if(!sMesh) - return; - box = bbox(sMesh); - } - else if(soup_item != nullptr) - { - box = bbox(soup_item); - } - else if(soup_item == nullptr) - return; - double X=(box.max)(0)-(box.min)(0), - Y = (box.max)(1)-(box.min)(1), - Z = (box.max)(2)-(box.min)(2); - diag = CGAL::sqrt(X*X+Y*Y+Z*Z); - double offset_value = QInputDialog::getDouble(mw, - QString("Choose Offset Value"), - QString("Offset Value (use negative number for inset)"), - 0.1*diag, - -(std::numeric_limits::max)(), - (std::numeric_limits::max)(), 10); - - QDialog dialog(mw); - Ui::Remeshing_dialog ui; - ui.setupUi(&dialog); - ui.angle->setRange(1.0, 30.0); - connect(ui.buttonBox, SIGNAL(accepted()), - &dialog, SLOT(accept())); - connect(ui.buttonBox, SIGNAL(rejected()), - &dialog, SLOT(reject())); - - ui.sizing->setRange(diag * 10e-6, // min - diag); // max - ui.sizing->setValue(diag * 0.05); // default value - - ui.approx->setRange(diag * 10e-7, // min - diag); // max - ui.approx->setValue(diag * 0.005); - - if (polylines_item!=nullptr) - { - ui.edge_sizing->setRange(diag * 10e-6, // min - diag); // max - ui.edge_sizing->setValue(diag * 0.05); // default value - } - else - ui.edge_sizing->setEnabled(false); - - int i = dialog.exec(); - if(i == QDialog::Rejected) - return; - - const double angle = ui.angle->value(); - const double approx = ui.approx->value(); - const double sizing = ui.sizing->value(); - const double edge_size=polylines_item!=nullptr?ui.edge_sizing->value():0; - const int tag_index = ui.tags->currentIndex(); - - if(tag_index < 0) return; - - QApplication::setOverrideCursor(Qt::WaitCursor); - - std::cerr << "mesh with:" - << "\n angle=" << angle - << "\n sizing=" << sizing - << "\n approx=" << approx - << "\n tag=" << tag_index - << std::boolalpha - << std::endl; - Mesher_thread* worker = nullptr; - if(soup_item) - worker = new Mesher_thread(nullptr, - soup_item, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - else - worker = new Mesher_thread(sMesh, - nullptr, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - connect(worker, &QThread::finished, worker, &QObject::deleteLater); - connect(worker, &Mesher_thread::resultReady, this, - [item, angle, sizing, approx, offset_value/* , index */] - (SMesh *new_mesh){ - QApplication::restoreOverrideCursor(); - if(!new_mesh){ - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = false; - CGAL::Three::Three::getMutex()->unlock(); - return; - } - Scene_surface_mesh_item* new_item = new Scene_surface_mesh_item(new_mesh); - new_item->setName(tr("%1 offset %5 (%2 %3 %4)") - .arg(item->name()) - .arg(angle) - .arg(sizing) - .arg(approx) - .arg(offset_value)); - new_item->setColor(Qt::magenta); - new_item->setWireframeMode(); - CGAL::Three::Three::scene()->addItem(new_item); -// CGAL::Three::Three::scene()->itemChanged(index); - QApplication::restoreOverrideCursor(); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = false; - CGAL::Three::Three::getMutex()->unlock(); - }); - QMessageBox* message_box = new QMessageBox(QMessageBox::NoIcon, - "Meshing", - "Offset meshing in progress...", - QMessageBox::Cancel, - mw); - message_box->setDefaultButton(QMessageBox::Cancel); - QAbstractButton* cancelButton = message_box->button(QMessageBox::Cancel); - cancelButton->setText(tr("Stop")); - - connect(cancelButton, &QAbstractButton::clicked, - this, [worker](){ - worker->terminate(); - QApplication::restoreOverrideCursor();//waitcursor - QApplication::restoreOverrideCursor();//busycursor - }); - connect(worker, &Mesher_thread::finished, - message_box, &QMessageBox::close); - message_box->open(); - - QApplication::setOverrideCursor(Qt::BusyCursor); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = true; - CGAL::Three::Three::getMutex()->unlock(); - worker->start(); -} - -#include "Offset_meshing_plugin.moc" - -#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp index 90477043da7..5ed52540c41 100644 --- a/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp @@ -562,7 +562,7 @@ bool Scene_polyhedron_shortest_path_item::deferred_load( std::vector listOfFaces; listOfFaces.reserve(CGAL::num_faces(*polyhedron())); face_iterator current, end; - for (boost::tie(current, end) = CGAL::faces(*polyhedron()); current != end; ++current) + for (std::tie(current, end) = CGAL::faces(*polyhedron()); current != end; ++current) { listOfFaces.push_back(*current); } diff --git a/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 786727bc145..9be866438e9 100644 --- a/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -1572,7 +1572,7 @@ void Scene_edit_polyhedron_item_priv::read_roi(const char* file_name, Mesh* mesh std::vector all_vertices; all_vertices.reserve(num_vertices(fs.get_deform_mesh(mesh)->halfedge_graph())); mesh_vi vb, ve; - for(boost::tie(vb, ve) = vertices(fs.get_deform_mesh(mesh)->halfedge_graph()); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(fs.get_deform_mesh(mesh)->halfedge_graph()); vb != ve; ++vb) { all_vertices.push_back(*vb); } // read roi @@ -1731,7 +1731,7 @@ void Scene_edit_polyhedron_item::update_normals() { void Scene_edit_polyhedron_item::set_all_vertices_as_roi() { boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(*surface_mesh()); vb != ve; ++vb) + for(std::tie(vb, ve) = vertices(*surface_mesh()); vb != ve; ++vb) { insert_roi_vertex(*vb, surface_mesh()); } diff --git a/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt b/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt index 71dab011d58..ffa00e9b08d 100644 --- a/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Three_examples) if(NOT POLICY CMP0070 AND POLICY CMP0053) diff --git a/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp b/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp index 7df511b6169..a00454c375b 100644 --- a/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp +++ b/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp @@ -779,19 +779,26 @@ void Scene_polyhedron_selection_item::set_operation_mode(int mode) //set the selection type to vertex set_active_handle_type(static_cast(0)); break; - //Add vertex and face to border + //Remove degree 2 vertex case 9: - Q_EMIT updateInstructions("Select a border edge. (1/2)"); - //set the selection type to Edge - set_active_handle_type(static_cast(2)); + Q_EMIT updateInstructions("Select the vertex you want to remove." + "Warning: This will clear the undo stack."); + //set the selection type to vertex + set_active_handle_type(static_cast(0)); break; - //Add face to border + //Add vertex and face to border case 10: Q_EMIT updateInstructions("Select a border edge. (1/2)"); //set the selection type to Edge set_active_handle_type(static_cast(2)); break; + //Add face to border case 11: + Q_EMIT updateInstructions("Select a border edge. (1/2)"); + //set the selection type to Edge + set_active_handle_type(static_cast(2)); + break; + case 12: Q_EMIT updateInstructions("Select a vertex. (1/2)"); //set the selection type to Edge set_active_handle_type(static_cast(0)); @@ -1011,7 +1018,24 @@ bool Scene_polyhedron_selection_item::treat_selection(const std::setinvalidateOpenGLBuffers(); + } + else + { + d->tempInstructions("Vertex not selected: The vertex must have degree 2 (and not be incident to a triangle)", + "Select the vertex you want to remove." + "Warning: This will clear the undo stack."); + } + break; + } + //Move point + case 12: CGAL::QGLViewer* viewer = Three::mainViewer(); const CGAL::qglviewer::Vec offset = viewer->offset(); if(viewer->manipulatedFrame() != d->manipulated_frame) @@ -1032,7 +1056,7 @@ bool Scene_polyhedron_selection_item::treat_selection(const std::set= degree -/* -std::size_t facet_degree(fg_halfedge_descriptor h, const Face_graph& polyhedron) -{ - return degree(h,polyhedron); -} -*/ bool Scene_polyhedron_selection_item:: treat_selection(const std::set& selection) { VPmap vpm = get(CGAL::vertex_point, *polyhedron()); @@ -1203,7 +1220,7 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::setfirst_selected) @@ -1255,7 +1272,7 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::setfirst_selected) @@ -1963,6 +1980,23 @@ void Scene_polyhedron_selection_item::moveVertex() } } +void Scene_polyhedron_selection_item::moveVertex(const Point_3& new_position) +{ + const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); + fg_vertex_descriptor vh = *temp_selected_vertices.begin(); + + VPmap vpm = get(CGAL::vertex_point,*polyhedron()); + put(vpm, vh, Point_3(new_position.x() - offset.x, + new_position.y() - offset.y, + new_position.z() - offset.z)); + const Point_3& p = get(vpm,vh); + d->manipulated_frame->setPosition(p.x()+offset.x, p.y()+offset.y, p.z()+offset.z); + setProperty("need_invalidate_aabb_tree", true); + invalidateOpenGLBuffers(); + poly_item->updateVertex(vh); + // poly_item->invalidateOpenGLBuffers(); +} + void Scene_polyhedron_selection_item::validateMoveVertex() { temp_selected_vertices.clear(); diff --git a/Lab/demo/Lab/Scene_polyhedron_selection_item.h b/Lab/demo/Lab/Scene_polyhedron_selection_item.h index 7a2cc2f16bd..23af5a1cfee 100644 --- a/Lab/demo/Lab/Scene_polyhedron_selection_item.h +++ b/Lab/demo/Lab/Scene_polyhedron_selection_item.h @@ -415,7 +415,7 @@ public: fg_vertex_descriptor t = all_vertices[id2]; fg_halfedge_descriptor hd; bool exists; - boost::tie(hd,exists) = halfedge(s,t,*polyhedron()); + std::tie(hd,exists) = halfedge(s,t,*polyhedron()); if(! exists) { return false; } selected_edges.insert(edge(hd,*polyhedron())); } @@ -917,6 +917,7 @@ public Q_SLOTS: void updateTick(); void moveVertex(); + void moveVertex(const Point_3&); protected: bool eventFilter(QObject* /*target*/, QEvent * gen_event) { diff --git a/Lab/demo/Lab/Scene_surface_mesh_item.cpp b/Lab/demo/Lab/Scene_surface_mesh_item.cpp index 30e0d59ab83..cf8ed877f77 100644 --- a/Lab/demo/Lab/Scene_surface_mesh_item.cpp +++ b/Lab/demo/Lab/Scene_surface_mesh_item.cpp @@ -545,7 +545,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } if(name.testFlag(Scene_item_rendering_helper::NORMALS)) { - EPICK::Vector_3 n = fnormals[fd]; + const EPICK::Vector_3& n = fnormals[fd]; CPF::add_normal_in_buffer(n, flat_normals); } if(name.testFlag(Scene_item_rendering_helper::COLORS)) @@ -553,7 +553,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: if(has_fpatch_id) { //The sharp features detection produces patch ids >=1, this - //is meant to insure the wanted id is in the range [min,max] + //is meant to ensure the wanted id is in the range [min,max] QColor c = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; CGAL::IO::Color color(c.red(),c.green(),c.blue()); CPF::add_color_in_buffer(color, f_colors); diff --git a/Lab/demo/Lab/Viewer.cpp b/Lab/demo/Lab/Viewer.cpp index b93cb2cb7b1..00e98fa2b88 100644 --- a/Lab/demo/Lab/Viewer.cpp +++ b/Lab/demo/Lab/Viewer.cpp @@ -1838,7 +1838,7 @@ void Viewer::setLighting() if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 3 floats."); + msgBox->setText("ERROR : Input should consist of 3 floats."); msgBox->exec(); return; } diff --git a/Lab/demo/Lab/cgal_test_with_cmake b/Lab/demo/Lab/cgal_test_with_cmake deleted file mode 100755 index c7774ce26ee..00000000000 --- a/Lab/demo/Lab/cgal_test_with_cmake +++ /dev/null @@ -1,236 +0,0 @@ -#! /bin/sh - -# This is a script for the CGAL test suite. Such a script must obey -# the following rules: -# -# - the name of the script is cgal_test_with_cmake -# - for every target two one line messages are written to the file 'error.txt' -# the first one indicates if the compilation was successful -# the second one indicates if the execution was successful -# if one of the two was not successful, the line should start with 'ERROR:' -# - running the script should not require any user interaction -# - the script should clean up object files and executables - - ERRORFILE=error.txt - DO_RUN= - if [ -z "${MAKE_CMD}" ]; then - MAKE_CMD=make - fi - NEED_CLEAN= - -#---------------------------------------------------------------------# -# configure -#---------------------------------------------------------------------# - -configure() -{ - echo "Configuring... " - - if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_DIR" \ - .' ; then - - echo " successful configuration" >> $ERRORFILE - else - echo " ERROR: configuration" >> $ERRORFILE - fi -} - -#---------------------------------------------------------------------# -# compile_and_run -#---------------------------------------------------------------------# - -compile_and_run() -{ - echo "Compiling $1 ... " - SUCCES="y" - - if eval '${MAKE_CMD} VERBOSE=ON -fMakefile $1' ; then - echo " successful compilation of $1" >> $ERRORFILE - else - echo " ERROR: compilation of $1" >> $ERRORFILE - SUCCES="" - fi - - if [ -n "$DO_RUN" ] ; then - if [ -n "${SUCCES}" ] ; then - OUTPUTFILE=ProgramOutput.$1.$PLATFORM - rm -f $OUTPUTFILE - COMMAND="./$1" - if [ -f $1.cmd ] ; then - COMMAND="$COMMAND `cat $1.cmd`" - fi - if [ -f $1.cin ] ; then - COMMAND="cat $1.cin | $COMMAND" - fi - echo "Executing $1 ... " - echo - ulimit -t 3600 2> /dev/null - if eval $COMMAND > $OUTPUTFILE 2>&1 ; then - echo " successful execution of $1" >> $ERRORFILE - else - echo " ERROR: execution of $1" >> $ERRORFILE - fi - else - echo " ERROR: not executed $1" >> $ERRORFILE - fi - fi -} - -#---------------------------------------------------------------------# -# remove the previous error file -#---------------------------------------------------------------------# - -rm -f $ERRORFILE -touch $ERRORFILE - -#---------------------------------------------------------------------# -# configure, compile and run the tests -#---------------------------------------------------------------------# - -configure - -if [ $# -ne 0 ] ; then - for file in $* ; do - compile_and_run $file - done -else - echo "Run all tests." - - for target in \ -demo_framework \ -gl_splat \ -point_dialog \ -CGALlab \ -cgal_lab \ -scene_basic_objects \ -scene_color_ramp \ -scene_c2t3_item \ -scene_c3t3_item \ -scene_combinatorial_map_item \ -scene_edit_polyhedron_item \ -scene_image_item \ -scene_implicit_function_item \ -scene_nef_polyhedron_item \ -scene_points_with_normal_item \ -scene_polygon_soup_item \ -scene_polyhedron_item \ -scene_polyhedron_item_decorator \ -scene_polyhedron_and_sm_item_k_ring_selection \ -scene_poly_item_k_ring_selection \ -scene_sm_item_k_ring_selection \ -scene_polyhedron_selection_item \ -scene_polyhedron_shortest_path_item \ -scene_polyhedron_transform_item \ -scene_polylines_item \ -scene_surface_mesh_item \ -scene_textured_polyhedron_item \ -basic_generator_plugin \ -c3t3_io_plugin \ -camera_positions_plugin \ -classification_plugin \ -clip_cgal_lab_plugin \ -convex_hull_plugin \ -corefinement_plugin \ -create_bbox_mesh_plugin \ -cut_plugin \ -detect_sharp_edges_plugin \ -detect_sharp_edges_sm_plugin \ -distance_plugin \ -distance_sm_plugin \ -edit_cgal_lab_plugin \ -edit_sm_plugin \ -extrude_poly_plugin \ -extrude_sm_plugin \ -fairing_plugin \ -features_detection_plugin \ -gocad_plugin \ -hole_filling_plugin \ -hole_filling_sm_plugin \ -hole_filling_polyline_plugin \ -inside_out_plugin \ -interpolated_corrected_principal_curvatures_plugin\ -surface_intersection_plugin \ -surface_intersection_sm_plugin \ -io_image_plugin \ -io_implicit_function_plugin \ -isotropic_remeshing_plugin \ -jet_fitting_plugin \ -join_and_split_polyhedra_plugin \ -kernel_plugin \ -mean_curvature_flow_skeleton_plugin \ -mean_curvature_flow_skeleton_sm_plugin \ -merge_point_sets_plugin \ -mesh_2_plugin \ -mesh_3_optimization_plugin \ -mesh_3_plugin \ -mesh_segmentation_plugin \ -mesh_segmentation_sm_plugin \ -mesh_simplification_plugin \ -nef_io_plugin \ -nef_plugin \ -off_plugin \ -off_to_nef_plugin \ -offset_meshing_plugin \ -alpha_wrap_3_plugin \ -orient_soup_plugin \ -parameterization_plugin \ -pca_plugin \ -p_klein_function_plugin \ -ply_to_xyz_plugin \ -point_inside_cgal_lab_plugin \ -point_set_average_spacing_plugin \ -point_set_bilateral_smoothing_plugin \ -point_set_from_vertices_plugin \ -point_set_interference_plugin \ -point_set_normal_estimation_plugin \ -point_set_outliers_removal_plugin \ -point_set_selection_plugin \ -point_set_shape_detection_plugin \ -point_set_simplification_plugin \ -point_set_smoothing_plugin \ -point_set_upsampling_plugin \ -point_set_wlop_plugin \ -polyhedron_slicer_plugin \ -polyhedron_stitching_plugin \ -polylines_io_plugin \ -p_sphere_function_plugin \ -p_tanglecube_function_plugin \ -random_perturbation_plugin \ -repair_cgal_lab_plugin \ -selection_io_plugin \ -selection_sm_io_plugin \ -selection_plugin \ -selection_sm_plugin \ -self_intersection_plugin \ -shortest_path_plugin \ -surface_mesh_approximation_plugin \ -stl_plugin \ -subdivision_methods_plugin \ -surface_mesh_io_plugin \ -surface_reconstruction_plugin \ -surf_to_sm_io_plugin \ -transform_cgal_lab_plugin \ -triangulate_facets_plugin \ -trivial_plugin \ -vtk_plugin \ -xyz_plugin \ -smoothing_plugin \ - all - do - if ${MAKE_CMD} -f Makefile help | grep "$target" > /dev/null; then - compile_and_run "$target" - NEED_CLEAN=y - fi - done -fi - -# -# The clean target generated by CMake under cygwin -# always fails for some reason -# -if [ -n "${NEED_CLEAN}" ]; then - if ! ( uname | grep -q "CYGWIN" ) ; then - ${MAKE_CMD} -fMakefile clean || true - fi -fi diff --git a/Lab/demo/Lab/implicit_functions/CMakeLists.txt b/Lab/demo/Lab/implicit_functions/CMakeLists.txt index 5b42135b28f..8a3b34484c5 100644 --- a/Lab/demo/Lab/implicit_functions/CMakeLists.txt +++ b/Lab/demo/Lab/implicit_functions/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the CGAL Mesh_3 demo implicit functions. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) include(CGALlab_macros) diff --git a/Lab/demo/Lab/include/Point_set_3.h b/Lab/demo/Lab/include/Point_set_3.h index fcfb3805c9e..a0444c9b744 100644 --- a/Lab/demo/Lab/include/Point_set_3.h +++ b/Lab/demo/Lab/include/Point_set_3.h @@ -135,7 +135,7 @@ public: bool add_radius() { bool out = false; - boost::tie (m_radius, out) = this->template add_property_map ("radius", 0.); + std::tie (m_radius, out) = this->template add_property_map ("radius", 0.); return out; } double& radius (const Index& index) { return m_radius[index]; } @@ -409,21 +409,15 @@ public: { if (other.template has_property_map("red")) { - boost::tie (m_red, boost::tuples::ignore) - = this->template add_property_map("red", 0); - boost::tie (m_green, boost::tuples::ignore) - = this->template add_property_map("green", 0); - boost::tie (m_blue, boost::tuples::ignore) - = this->template add_property_map("blue", 0); + m_red = this->template add_property_map("red", 0).first; + m_green = this->template add_property_map("green", 0).first; + m_blue = this->template add_property_map("blue", 0).first; } else { - boost::tie (m_red, boost::tuples::ignore) - = this->template add_property_map("r", 0); - boost::tie (m_green, boost::tuples::ignore) - = this->template add_property_map("g", 0); - boost::tie (m_blue, boost::tuples::ignore) - = this->template add_property_map("b", 0); + m_red = this->template add_property_map("r", 0).first; + m_green = this->template add_property_map("g", 0).first; + m_blue = this->template add_property_map("b", 0).first; } } diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt b/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt index 23999e2d847..78c8cb770db 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(LCC_performance_2) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) @@ -16,7 +16,7 @@ include_directories(BEFORE "/usr/include/libxml2/") #add_compile_definitions("-pg") #SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") # add_compile_definitions("-g") - +return() # OpenMesh find_package(OpenMesh REQUIRED) include(CGAL_OpenMesh_support) @@ -35,7 +35,7 @@ target_link_libraries(lcc_performance_2 CGAL::CGAL) add_executable( surface_mesh_performance performance_2.h surface_mesh_performance.h surface_mesh_performance.cpp) -target_link_libraries(surface_mesh_performance surface_mesh) +target_link_libraries(surface_mesh_performance lcc_surface_mesh_lib) # Open_mesh add_executable(openmesh_performance performance_2.h openmesh_performance.h @@ -79,7 +79,7 @@ add_executable( target_link_libraries( performance_2 CGAL::CGAL - surface_mesh + lcc_surface_mesh_lib algo assimp container diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt index 9c7a8ad46a4..b80ccb6d124 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB_RECURSE SRCS ./*.cpp) file(GLOB_RECURSE HDRS ./*.h) if(UNIX) - add_library(surface_mesh SHARED ${SRCS} ${HDRS}) + add_library(lcc_surface_mesh_lib SHARED ${SRCS} ${HDRS}) elseif(WIN32) - add_library(surface_mesh STATIC ${SRCS} ${HDRS}) + add_library(lcc_surface_mesh_lib STATIC ${SRCS} ${HDRS}) endif() diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt b/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt index 5166eee35ab..1a65d867deb 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(LCC_performance_3) +return() + if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. cmake_policy(SET CMP0053 OLD) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt index 16b346a7564..b71bfe57fe0 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. # cmake ../ -DCMAKE_BUILD_TYPE=Debug -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Linear_cell_complex_Demo) # Find includes in corresponding build directories diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 22760ad87b6..e9604793e4b 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Linear_cell_complex_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt index 3f12de77cee..d19fc827d59 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/test/Linear_cell_complex/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Linear_cell_complex_Tests) find_package(CGAL REQUIRED) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index b89f1382ed9..1e64ecb66bd 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -750,6 +750,8 @@ sub create_summary_page { my ($platform_num, $platform) = (0, ""); foreach $platform (@platforms_to_do) { my $platform_info = $platforms_info{$platform}; + my $build_type = $platform_is_optimized{$platform} ? " - " : "YES"; + $platform_info->{debug} = $build_type; foreach my $test_directory (sort keys %test_directories) { my $result_letter = $testresults[$platform_num]->{$test_directory}; if (defined($result_letter) && grep { $_ eq $result_letter } @letters) { @@ -769,7 +771,7 @@ sub create_summary_page { release => $release_name, platforms => \@platforms_data, }; - my $json = JSON->new->allow_nonref; + my $json = JSON->new->allow_nonref->pretty; my $json_text = $json->encode($final_data); my $fh = new IO::Compress::Gzip "$testresult_dir/$release_name/search_index.json.gz" or die "IO::Compress::Gzip failed: $GzipError\n"; diff --git a/Matrix_search/doc/Matrix_search/PackageDescription.txt b/Matrix_search/doc/Matrix_search/PackageDescription.txt index 202989f2da3..1dabc40e68c 100644 --- a/Matrix_search/doc/Matrix_search/PackageDescription.txt +++ b/Matrix_search/doc/Matrix_search/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgMatrixSearchRef -\todo check generated documentation \cgalPkgDescriptionBegin{Monotone and Sorted Matrix Search,PkgMatrixSearch} \cgalPkgPicture{matrix.png} \cgalPkgSummaryBegin diff --git a/Matrix_search/examples/Matrix_search/CMakeLists.txt b/Matrix_search/examples/Matrix_search/CMakeLists.txt index 489663a3b18..9fb3b898c53 100644 --- a/Matrix_search/examples/Matrix_search/CMakeLists.txt +++ b/Matrix_search/examples/Matrix_search/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Matrix_search_Examples) find_package(CGAL REQUIRED) diff --git a/Matrix_search/test/Matrix_search/CMakeLists.txt b/Matrix_search/test/Matrix_search/CMakeLists.txt index d4f61200d6f..9e9f6d6d7a2 100644 --- a/Matrix_search/test/Matrix_search/CMakeLists.txt +++ b/Matrix_search/test/Matrix_search/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Matrix_search_Tests) find_package(CGAL REQUIRED) diff --git a/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp b/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp index 22b2e16b82d..e5088183176 100644 --- a/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp +++ b/Matrix_search/test/Matrix_search/sorted_matrix_search_test.cpp @@ -148,7 +148,7 @@ main( int argc, char* argv[]) */ // evt. update max_entry: - max_entry = max( a[dim - 1] + b[dim - 1], max_entry); + max_entry = (max)( a[dim - 1] + b[dim - 1], max_entry); // keep both vectors: vectors.push_back( a); diff --git a/Mesh_2/demo/Mesh_2/CMakeLists.txt b/Mesh_2/demo/Mesh_2/CMakeLists.txt index 4c827ece080..c66e7cf908d 100644 --- a/Mesh_2/demo/Mesh_2/CMakeLists.txt +++ b/Mesh_2/demo/Mesh_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script (and then adapted manually). # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_2_Demo) find_package(CGAL REQUIRED) diff --git a/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h b/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h index 35b4dda2756..5513693788b 100644 --- a/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h +++ b/Mesh_2/doc/Mesh_2/CGAL/IO/write_VTU.h @@ -6,6 +6,8 @@ namespace IO { //! //! The faces output are those for which `DelaunayMeshFaceBase_2::is_in_domain()` returns `true`, //! the edges are those for which `ConstrainedTriangulationFaceBase_2::is_constrained()` returns `true`. +//!\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of `os`. +//! //! \tparam CDT a `Constrained_Delaunay_triangulation_2` with face type model of `DelaunayMeshFaceBase_2`. //! //! \param os the stream used for writing. @@ -23,9 +25,12 @@ void write_VTU(std::ostream& os, //! \brief writes the faces of a domain and its constrained edges embedded in //! a 2D constrained Delaunay triangulation using the `PolyData` XML //! format. - //! The faces output are those for which `get(ipm, f)` returns - //! `true` where `f` is a `CDT::Face_handle`, +//! The faces output are those for which `get(ipm, f)` returns +//! `true` where `f` is a `CDT::Face_handle`, //! the edges are those for which `ConstrainedTriangulationFaceBase_2::is_constrained()` returns `true`. +//! +//!\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of `os`. +//! //! \tparam CDT a `Constrained_Delaunay_triangulation_2` with face //! type model of `DelaunayMeshFaceBase_2`. //! \tparam InDomainPmap a class model of `ReadWritePropertyMap` with diff --git a/Mesh_2/examples/Mesh_2/CMakeLists.txt b/Mesh_2/examples/Mesh_2/CMakeLists.txt index 474a477a39a..c94cec90f83 100644 --- a/Mesh_2/examples/Mesh_2/CMakeLists.txt +++ b/Mesh_2/examples/Mesh_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h b/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h index a3e54124402..5601684ed22 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h @@ -78,7 +78,7 @@ public: void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; } // namespace CGAL diff --git a/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h b/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h index 3093f3b49a9..0c62a20fb5c 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesh_vertex_base_2.h @@ -67,7 +67,7 @@ public: void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); #endif // CGAL_MESH_2_DEBUG_REFINEMENT_POINTS }; diff --git a/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h b/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h index 1729fc795f6..fe316a611e6 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h @@ -63,7 +63,8 @@ private: Faces_level faces_level; Seeds seeds; - bool seeds_mark; + bool seeds_mark = false; + bool initialized = false; public: /** \name CONSTRUCTORS */ Delaunay_mesher_no_edge_refinement_2(Tr& tr_, const Criteria& criteria_ = Criteria()) @@ -72,20 +73,18 @@ public: null_level(), null_visitor(), edges_level(tr, null_level), - faces_level(tr, criteria, edges_level), - initialized(false) + faces_level(tr, criteria, edges_level) { } Delaunay_mesher_no_edge_refinement_2(Tr& tr_, Edges_level& edges_level_, - const Criteria& criteria_ = Criteria()) + const Criteria& criteria_ = Criteria()) : tr(tr_), criteria(criteria_), null_level(), null_visitor(), edges_level(edges_level_), - faces_level(tr, criteria, edges_level), - initialized(false) + faces_level(tr, criteria, edges_level) { } @@ -101,12 +100,6 @@ public: return seeds.end(); } -private: - /** \name INITIALIZED */ - - bool initialized; - -public: /** \name MARKING FUNCTIONS */ /** The value type of \a InputIterator should be `Point`, and represents diff --git a/Mesh_2/include/CGAL/Mesh_2/Clusters.h b/Mesh_2/include/CGAL/Mesh_2/Clusters.h index f52dcb16d20..13533041f46 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Clusters.h +++ b/Mesh_2/include/CGAL/Mesh_2/Clusters.h @@ -160,15 +160,14 @@ public: void create_clusters(Tag_true) { cluster_map.clear(); Unique_hash_map created(false); - for(typename Tr::Subconstraint_iterator it = tr.subconstraints_begin(); - it != tr.subconstraints_end(); ++it) { - Vertex_handle vh = it->first.first; + for(const auto& sc : tr.subconstraints()) { + Vertex_handle vh = sc.first; if(!created[vh]){ created[vh] = true; create_clusters_of_vertex(vh); } - vh = it->first.second; + vh = sc.second; if(!created[vh]){ created[vh] = true; create_clusters_of_vertex(vh); diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h index 852ec07faf0..2208f28fc45 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h @@ -344,14 +344,8 @@ protected: void scan_triangulation_impl(Tag_true) { - // with constraint hierarchy - - for(typename Tr::Subconstraint_iterator it = tr.subconstraints_begin(); - it != tr.subconstraints_end(); ++it) + for(const auto& [v1, v2] : tr.subconstraints()) { - const Vertex_handle& v1 = it->first.first; - const Vertex_handle& v2 = it->first.second; - if(!is_locally_conform(tr, v1, v2) ){ add_constrained_edge_to_be_conformed(v1, v2); } diff --git a/Mesh_2/test/Mesh_2/CMakeLists.txt b/Mesh_2/test/Mesh_2/CMakeLists.txt index 9ce291f819a..7b2093bebf5 100644 --- a/Mesh_2/test/Mesh_2/CMakeLists.txt +++ b/Mesh_2/test/Mesh_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) @@ -14,3 +14,7 @@ file( foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") endforeach() + +if(cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES) + target_compile_features(test_mesh_terrain PRIVATE cxx_std_20) +endif() diff --git a/Mesh_2/test/Mesh_2/conform_plus.cpp b/Mesh_2/test/Mesh_2/conform_plus.cpp index 83978e3d9ef..6e4128dd68e 100644 --- a/Mesh_2/test/Mesh_2/conform_plus.cpp +++ b/Mesh_2/test/Mesh_2/conform_plus.cpp @@ -18,15 +18,7 @@ int main() std::pair p; - for(CDT::Subconstraint_iterator sit = cdt.subconstraints_begin(); - sit != cdt.subconstraints_end(); - ++sit){ - - p = (*sit).first; - - Vertex_handle vh1 = p.first; - Vertex_handle vh2 = p.second; - + for(const auto& [vh1, vh2] : cdt.subconstraints()) { std::cerr << "subconstraint: " << vh1->point() << " -- " << vh2->point() << std::endl; } @@ -36,15 +28,8 @@ int main() int counter = 0; - for(CDT::Subconstraint_iterator sit = cdt.subconstraints_begin(); - sit != cdt.subconstraints_end(); - ++sit){ + for(const auto& [vh1, vh2] : cdt.subconstraints()) { ++counter; - p = (*sit).first; - - Vertex_handle vh1 = p.first; - Vertex_handle vh2 = p.second; - std::cerr << "subconstraint: " << vh1->point() << " -- " << vh2->point() << std::endl; } diff --git a/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp b/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp index 4ac052fab12..2fe8c8058de 100644 --- a/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp +++ b/Mesh_2/test/Mesh_2/test_mesh_terrain.cpp @@ -1,3 +1,13 @@ +// Test also CGAL::Random_allocator +#if __has_include() +# include +# if __cpp_lib_format >= 201907L +# define CGAL_DEBUG_RANDOM_ALLOCATOR 1 +# endif +#endif +#include +#define CGAL_ALLOCATOR(T) CGAL::Random_allocator + #include #include #include @@ -21,6 +31,9 @@ typedef K::Point_3 Point; int main() { +#if CGAL_DEBUG_RANDOM_ALLOCATOR + std::clog << "CGAL::Random_allocator debug mode is enabled..." << std::endl; +#endif Delaunay dt; typedef Delaunay::Vertex_handle Vertex_handle; Vertex_handle va = dt.insert(Point(-4,0, 0)); diff --git a/Mesh_2/test/Mesh_2/test_meshing.cpp b/Mesh_2/test/Mesh_2/test_meshing.cpp index 48d6ccffaf0..db91f5a0c08 100644 --- a/Mesh_2/test/Mesh_2/test_meshing.cpp +++ b/Mesh_2/test/Mesh_2/test_meshing.cpp @@ -1,5 +1,4 @@ // 154 515 565 -#include #include "test_dependencies.h" #include #if CGAL_USE_CORE || CGAL_USE_LEDA diff --git a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt index 7e195ce1ff1..3d405fe7a39 100644 --- a/Mesh_3/benchmark/Mesh_3/CMakeLists.txt +++ b/Mesh_3/benchmark/Mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_3_benchmark) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h index acfb0b6efd8..018449f3585 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h @@ -451,6 +451,90 @@ unspecified_type odt(const Named_function_parameters& np = parameters::default_v template unspecified_type perturb(const Named_function_parameters& np = parameters::default_values()); +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::initial_points_generator()` enables the user to specify a functor that follows + * the `InitialPointsGenerator_3` concept to the mesh generation function `make_mesh_3()`. This functor is called + * for the initialization of the meshing process, by inserting well-distributed surface vertices. + * If this parameter is not specified, the default behavior + * is executed, which calls the domain's `construct_initial_points_object()` for the initialization of the meshing process. + * + * Initialization is considered to be complete if the triangulation is a 3D triangulation + * with at least one facet in the restricted Delaunay triangulation (i.e., its dual intersects the + * input surface). + * + * If one dimensional features are requested, their initialization is performed first. + * If provided, the points of `parameters::initial_points()` are inserted next. + * Then, `parameters::initial_points_generator()` is used to generate more initial points + * and complete the initialization. + * If the generator does not generate enough points for the initialization to be complete, + * the domain's `construct_initial_points_object()` will be called to generate enough input points. + * + * \tparam InitialPointsGenerator a model of the `InitialPointsGenerator_3` concept + * + * @param generator an instance of `InitialPointsGenerator` + * + * \cgalHeading{Example} + * + * \snippet mesh_3D_image_with_image_initialization.cpp Meshing + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::parameters::initial_points()` + * \sa `MeshDomain_3::Construct_initial_points` + * + */ +template +unspecified_type initial_points_generator(const InitialPointsGenerator& generator); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::initial_points()` enables the user to specify a container, model of `Range`, that contains + * initial points constructed on surfaces, + * to be used in the `make_mesh_3()` function for mesh generation. Items in the container are + * tuple-like objects containing a `Weighted_point_3`, an `int`, and a `MeshDomain::Index`, + * where `Weighted_point_3` represents the position and the weight of the point, + * `int` the dimension of the minimal subcomplex on which the point lies, + * and `MeshDomain::Index` the corresponding subcomplex index. + * These initial points are inserted after one dimensional features initialization. + * + * Initialization is considered to be complete if the triangulation is a 3D triangulation + * with at least one facet in the restricted Delaunay triangulation (i.e., its dual intersects the + * input surface). + * + * If the parameter `parameters::initial_points_generator()` is set, + * the points from this parameter will be inserted before calling the initial points generator. + * + * If after the insertion of initial points (possibly together with the input generator), + * the initialization is not complete, + * the domain's `construct_initial_points_object()` will be called. + * + * \tparam MeshDomain a model of `MeshDomain_3` + * \tparam C3t3 a model of `MeshComplex_3InTriangulation_3` + * \tparam InitialPointsRange a model of `Range` containing tuple-like objects of + * `C3t3::Triangulation::Geom_traits::Weighted_point_3, int, MeshDomain::Index`. + * + * @param initial_points an instance of `InitialPointsRange` + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Create the initial_points vector + * std::vector> initial_points; + * // Perform mesh generation from a labeled image with initial points + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::initial_points(std::cref(initial_points))); // Use std::cref to avoid a copy + * \endcode + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::parameters::initial_points_generator()` + * \sa `MeshDomain_3::Construct_initial_points` + * + */ +template +unspecified_type initial_points(const InitialPointsRange& initial_points); } /* namespace parameters */ } /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/InitialPointsGenerator_3.h b/Mesh_3/doc/Mesh_3/Concepts/InitialPointsGenerator_3.h new file mode 100644 index 00000000000..351ac34126f --- /dev/null +++ b/Mesh_3/doc/Mesh_3/Concepts/InitialPointsGenerator_3.h @@ -0,0 +1,64 @@ +/*! +\ingroup PkgMesh3SecondaryConcepts +\cgalConcept + +The function object concept `InitialPointsGenerator_3` is designed to construct +a set of initial points on the surface of the domain. + +\cgalHasModelsBegin +\cgalHasModels{CGAL::Construct_initial_points_labeled_image} +\cgalHasModels{CGAL::Construct_initial_points_gray_image} +\cgalHasModelsEnd + +*/ + +class InitialPointsGenerator_3 { +public: + +/// \name Types (exposition only) +/// @{ +/// These types are used in the concept's description but are not part of the concept itself. + +/*! +* Mesh domain type to be meshed, model of `MeshDomain_3` +*/ +typedef unspecified_type MeshDomain; + +/*! + * Type of the output mesh complex, model of `MeshComplex_3InTriangulation_3` + */ +typedef unspecified_type C3t3; +/// @} + +/// \name Operations +/// @{ +/// Initial points generators are designed to output, via their operators `operator(OutputIterator)`, +/// a set of surface points for mesh initialization to an output iterator. + +/*! +outputs a set of surface points for mesh initialization. + +If, after insertion of these points, the triangulation is still not 3D, +or does not have any facets +in the restricted Delaunay triangulation, then more points will be added automatically +by the mesh generator. + +@tparam OutputIterator model of `OutputIterator` whose value type is a tuple-like object made of 3 elements: + - a `C3t3::Triangulation::Point` : the point `p`, + - an `int` : the minimal dimension of the subcomplexes on which `p` lies, + - a `MeshDomain_3::Index` : the index of the corresponding subcomplex. + +@param pts an output iterator for the points +@param n a lower bound on the number of points to construct for initialization. + When `n` is set to its default value `0`, the functor must provide enough + points to initialize the mesh generation process, i.e., to have a 3D triangulation + with at least one facet in the restricted Delaunay triangulation. + If these conditions are not satisfied, then more points will be added automatically + by the mesh generator. +*/ +template +OutputIterator operator()(OutputIterator pts, const int n = 0); + +/// @} + +}; /* end InitialPointsGenerator_3 */ diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index 18c58c248e6..5355f1a2635 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -39,7 +39,9 @@ INPUT += \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Compact_mesh_cell_base_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_in_image.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_on_image_bbox.h \ - ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_labeled_image.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_gray_image.h PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation" HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \ diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index 065bba5222d..781a89547dd 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -737,54 +737,29 @@ without the weights (left, 25563 vertices) and with the weights (right, 19936 ve \subsubsection Mesh_3DomainsFrom3DImagesWithCustomInitialization Domains From 3D Images, with a Custom Initialization -The example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp is a modification +The example \ref Mesh_3/mesh_3D_image_with_image_initialization.cpp is a modification of \ref Mesh_3/mesh_3D_image.cpp. The goal of that example is to show how the default initialization of the triangulation, using random rays, can be replaced by a new implementation. In this case, the initialization detects all connected components in the 3D segmented image, and inserts points in the triangulation for each connected component. -For the meshing, in the previous example (\ref Mesh_3/mesh_3D_image.cpp), we called `make_mesh_3()` as follows. +\snippet Mesh_3/mesh_3D_image_with_image_initialization.cpp Meshing -\snippet Mesh_3/mesh_3D_image.cpp Meshing +The parameter `CGAL::parameters::initial_points_generator` is used. +It expects a functor that returns a set of points for the mesh +initialization (following the concept `InitialPointsGenerator_3`). The functor +`Construct_initial_points_labeled_image` is used in this example. +It constructs points using the API of the mesh domain, as follows. +First, the functor `construct_intersection` is created: -In the example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp, -that call is replaced by: - -# the creation of an empty `%c3t3` object, - -# a call to a non-documented function - `initialize_triangulation_from_labeled_image()` that inserts points in - the triangulation, - -# then the call to `refine_mesh_3()`. - -\snippet Mesh_3/mesh_3D_image_with_custom_initialization.cpp Meshing - -The code of the function `initialize_triangulation_from_labeled_image()` is -in the non-documented header \ref -CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h. As it is -undocumented and may be removed or modified at any time, if you wish to -use it then you should copy-paste it to your user code. The code of that -function is rather complicated. The following lines show how to insert new -points in the `%c3t3` object, with the calls to -`MeshVertexBase_3::set_dimension()` and -`MeshVertexBase_3::set_index()`. - -\snippet CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h insert initial points - -The value of `index` must be consistent with the possible values of -`Mesh_domain::Index`. In \ref -CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h, it is -constructed using the API of the mesh domain, as follows. First the functor -`construct_intersect` is created - -\dontinclude CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h -\skip Construct_intersection construct_intersection = -\until construct_intersection_object +\snippet CGAL/Mesh_3/Construct_initial_points_labeled_image.h construct intersection then the `%Mesh_domain::Intersection` object (a `%tuple` with three elements) is constructed using a call to the functor `construct_intersection` -\skip Intersection intersect = -\until construct_intersection -and eventually `%index` is the element \#1 of `%intersect`. -\skipline get<1>(intersect) +\snippet CGAL/Mesh_3/Construct_initial_points_labeled_image.h use construct intersection +and eventually `%intersect_index` is the element \#1 of `%intersect`. +\snippet CGAL/Mesh_3/Construct_initial_points_labeled_image.h get construct intersection +The dimension of the underlying simplex is stored as the element \#2 of `%intersect``. The result of the custom initialization can be seen in \cgalFigureRef{mesh3custominitimage3D}. The generated 3D image contains a @@ -810,34 +785,25 @@ the center is meshed Right: the mesh generated after the initialization of all connected components \cgalFigureCaptionEnd - Note that the example \ref -Mesh_3/mesh_3D_image_with_custom_initialization.cpp also shows how to +Mesh_3/mesh_3D_image_with_image_initialization.cpp also shows how to create a 3D image using the undocumented API of CGAL_ImageIO. -\snippet Mesh_3/mesh_3D_image_with_custom_initialization.cpp Create the image +\snippet Mesh_3/mesh_3D_image_with_image_initialization.cpp Create_the_image The code of the function `%random_labeled_image()` is in the header file \ref Mesh_3/random_labeled_image.h. -The example \ref Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp is another -custom initialization example, for meshing of 3D gray-level images. Similarly to -the segmented image example above, the code consists in: - -# the creation of an empty `%c3t3` object, - -# a call to a non-documented function - `initialize_triangulation_from_gray_image()` that inserts points in - the triangulation, - -# then the call to `refine_mesh_3()`. +The example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp features +a custom functor that initializes the triangulation. -\snippet Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp Meshing - -The code of the function `initialize_triangulation_from_gray_image()` is -in the non-documented header \ref -CGAL/Mesh_3/initialize_triangulation_from_gray_image.h. As it is -undocumented and may be removed or modified at any time, if you wish to -use it then you should copy-paste it to your user code. +A struct `Custom_Initial_points_generator` that places 1D-feature points +alongside a line is created. +Finally, the example \ref Mesh_3/mesh_3D_image_with_initial_points.cpp features +a point container that initializes the triangulation using the meshing parameter +`parameters::initial_points()`. \subsection Mesh_3UsingVariableSizingField Using Variable Sizing Field diff --git a/Mesh_3/doc/Mesh_3/PackageDescription.txt b/Mesh_3/doc/Mesh_3/PackageDescription.txt index 79706cd0523..926491fc627 100644 --- a/Mesh_3/doc/Mesh_3/PackageDescription.txt +++ b/Mesh_3/doc/Mesh_3/PackageDescription.txt @@ -29,6 +29,9 @@ /// The two main functions to generate a mesh are `make_mesh_3()` and `refine_mesh_3()`. /// The other functions enable to optimize an existing mesh. +/// \defgroup PkgMesh3Initializers Mesh Initialization Functors +/// \ingroup PkgMesh3Ref +/// The functors in this group perform mesh initialization by providing initial points. /// \defgroup PkgMesh3Parameters Parameter Functions /// \ingroup PkgMesh3Ref @@ -77,6 +80,7 @@ related to the template parameters of some models of the main concepts: - `BisectionGeometricTraits_3` - `IntersectionGeometricTraits_3` +- `InitialPointsGenerator_3` - `MeshCellBase_3` - `MeshVertexBase_3` - `MeshDomainField_3` @@ -110,6 +114,11 @@ The following functors are available for feature detection: - `CGAL::Mesh_3::Detect_features_in_image` - `CGAL::Mesh_3::Detect_features_on_image_bbox` +The following functors are available for mesh initialization: + +- `CGAL::Construct_initial_points_labeled_image` +- `CGAL::Construct_initial_points_gray_image` + \cgalCRPSection{Function Templates} - `CGAL::make_mesh_3()` @@ -120,10 +129,12 @@ The following functors are available for feature detection: - `CGAL::odt_optimize_mesh_3()` - `CGAL::Mesh_3::generate_label_weights()` -\cgalCRPSection{CGAL::parameters Functions} +\cgalCRPSection{%CGAL::parameters Functions} - `CGAL::parameters::features()` - `CGAL::parameters::no_features()` +- `CGAL::parameters::initial_points()` +- `CGAL::parameters::initial_points_generator()` - `CGAL::parameters::exude()` - `CGAL::parameters::no_exude()` - `CGAL::parameters::perturb()` diff --git a/Mesh_3/doc/Mesh_3/examples.txt b/Mesh_3/doc/Mesh_3/examples.txt index 4b853a9847b..f045ee58b03 100644 --- a/Mesh_3/doc/Mesh_3/examples.txt +++ b/Mesh_3/doc/Mesh_3/examples.txt @@ -1,16 +1,15 @@ /*! \example Mesh_3/implicit_functions.cpp \example Mesh_3/mesh_3D_image.cpp -\example Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp \example Mesh_3/mesh_3D_image_with_features.cpp \example Mesh_3/mesh_3D_image_with_custom_initialization.cpp +\example Mesh_3/mesh_3D_image_with_initial_points.cpp +\example Mesh_3/mesh_3D_image_with_image_initialization.cpp \example Mesh_3/mesh_3D_image_with_detection_of_features.cpp \example Mesh_3/mesh_3D_image_with_input_features.cpp \example Mesh_3/mesh_3D_weighted_image.cpp \example Mesh_3/mesh_3D_weighted_image_with_detection_of_features.cpp \example Mesh_3/random_labeled_image.h -\example CGAL/Mesh_3/initialize_triangulation_from_gray_image.h -\example CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h \example Mesh_3/mesh_3D_image_variable_size.cpp \example Mesh_3/mesh_hybrid_mesh_domain.cpp \example Mesh_3/mesh_implicit_domains.cpp diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 18924a5dfeb..a1e2e345e97 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mesh_3_Examples) add_compile_definitions(CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX @@ -157,10 +157,15 @@ if(TARGET CGAL::CGAL_ImageIO) PRIVATE CGAL::Eigen3_support) create_single_source_cgal_program( - "mesh_3D_gray_image_with_custom_initialization.cpp") - target_link_libraries(mesh_3D_gray_image_with_custom_initialization + "mesh_3D_image_with_image_initialization.cpp") + target_link_libraries(mesh_3D_image_with_image_initialization PRIVATE CGAL::Eigen3_support) + create_single_source_cgal_program( + "mesh_3D_image_with_initial_points.cpp") + target_link_libraries(mesh_3D_image_with_initial_points + PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") target_link_libraries(mesh_3D_image_variable_size PRIVATE CGAL::Eigen3_support) @@ -199,7 +204,8 @@ if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) mesh_3D_weighted_image_with_detection_of_features mesh_3D_image_variable_size mesh_3D_image_with_custom_initialization - mesh_3D_gray_image_with_custom_initialization + mesh_3D_image_with_initial_points + mesh_3D_image_with_image_initialization mesh_3D_image_with_features mesh_3D_image_with_detection_of_features mesh_3D_image_with_input_features diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp deleted file mode 100644 index afed1a34b52..00000000000 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -typedef float Image_word_type; - -// Domain -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; - -// Parallel tag -#ifdef CGAL_CONCURRENT_MESH_3 -typedef CGAL::Parallel_tag Concurrency_tag; -#else -typedef CGAL::Sequential_tag Concurrency_tag; -#endif - -// Triangulation -typedef CGAL::Mesh_triangulation_3::type Tr; -typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; - -// Criteria -typedef CGAL::Mesh_criteria_3 Mesh_criteria; - -namespace params = CGAL::parameters; - -int main(int argc, char* argv[]) -{ - const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("images/skull_2.9.inr"); - /// [Load image] - CGAL::Image_3 image; - if (!image.read(fname)) { - std::cerr << "Error: Cannot read file " << fname << std::endl; - return EXIT_FAILURE; - } - /// [Domain creation] - Mesh_domain domain = - Mesh_domain::create_gray_image_mesh_domain(image, params::iso_value(2.9f).value_outside(0.f)); - /// [Domain creation] - - /// [Mesh criteria] - Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(2). - cell_radius_edge_ratio(3).cell_size(8)); - - /// [Meshing] - C3t3 c3t3; - initialize_triangulation_from_gray_image(c3t3, - domain, - image, - criteria, - 2.9f,//isolevel - Image_word_type(0)); - CGAL::refine_mesh_3(c3t3, domain, criteria); - /// [Meshing] - - /// Output - CGAL::dump_c3t3(c3t3, "out"); - - return 0; -} diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp index ce8fc8db39c..d3d718138ad 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include #include @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/squircle.nii"); - vtkImageData* vtk_image = nullptr; + vtkSmartPointer vtk_image = nullptr; Image_word_type iso = (argc>2)? boost::lexical_cast(argv[2]): 1; double fs = (argc>3)? boost::lexical_cast(argv[3]): 1; double fd = (argc>4)? boost::lexical_cast(argv[4]): 0.1; @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) if (path.has_extension()){ fs::path stem = path.stem(); if ((path.extension() == ".nii") || (stem.has_extension() && (stem.extension() == ".nii") && (path.extension() == ".gz"))) { - vtkNIFTIImageReader* reader = vtkNIFTIImageReader::New(); + auto reader = vtkSmartPointer::New(); reader->SetFileName(fname.c_str()); reader->Update(); vtk_image = reader->GetOutput(); @@ -81,7 +81,7 @@ int main(int argc, char* argv[]) } } else if (fs::is_directory(path)) { - vtkDICOMImageReader* dicom_reader = vtkDICOMImageReader::New(); + auto dicom_reader = vtkSmartPointer::New(); dicom_reader->SetDirectoryName(argv[1]); vtkDemandDrivenPipeline* executive = @@ -91,7 +91,7 @@ int main(int argc, char* argv[]) executive->SetReleaseDataFlag(0, 0); // where 0 is the port index } - vtkImageGaussianSmooth* smoother = vtkImageGaussianSmooth::New(); + auto smoother = vtkSmartPointer::New(); smoother->SetStandardDeviations(1., 1., 1.); smoother->SetInputConnection(dicom_reader->GetOutputPort()); smoother->Update(); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp index 253c41a920b..fd07fd1090f 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp @@ -5,55 +5,85 @@ #include #include -#include - #include #include #include #include + +#include + // Domain -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Image_domain = CGAL::Labeled_mesh_domain_3; +using Mesh_domain = CGAL::Mesh_domain_with_polyline_features_3; #ifdef CGAL_CONCURRENT_MESH_3 -typedef CGAL::Parallel_tag Concurrency_tag; +using Concurrency_tag = CGAL::Parallel_tag; #else -typedef CGAL::Sequential_tag Concurrency_tag; +using Concurrency_tag = CGAL::Sequential_tag; #endif // Triangulation -typedef CGAL::Mesh_triangulation_3::type Tr; - -typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; +using Tr = CGAL::Mesh_triangulation_3::type; +using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; // Criteria -typedef CGAL::Mesh_criteria_3 Mesh_criteria; +using Mesh_criteria = CGAL::Mesh_criteria_3; namespace params = CGAL::parameters; int main() { - /// [Create the image] - CGAL::Image_3 image = random_labeled_image(); - /// [Create the image] + const std::string fname = CGAL::data_file_path("images/420.inr"); + // Loads image + CGAL::Image_3 image; + if(!image.read(fname)){ + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } // Domain - Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image + , params::features_detector(CGAL::Mesh_3::Detect_features_on_image_bbox())); // Mesh criteria - Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1). - cell_radius_edge_ratio(3).cell_size(3)); + const double edge_size = 3; + Mesh_criteria criteria(params::edge_size(edge_size) + .facet_angle(30).facet_size(3).facet_distance(1) + .cell_radius_edge_ratio(3).cell_size(3)); + + // custom_initial_points_generator will put points on the mesh for initialization. + // Those points are objects of type std::tuple. + // Weighted_point_3 is the point's position and weight, + // int is the dimension of the minimal dimension subcomplex on which the point lies, + // Index is the underlying subcomplex index. + auto custom_initial_points_generator = [&](auto pts_out_iterator, int) { + using Point_3 = K::Point_3; + using Weighted_point_3 = K::Weighted_point_3; + using Index = Mesh_domain::Index; + using Point_dim_index = std::tuple; + + Point_3 a{0.0, 50.0, 66.66}; + Point_3 b{100.0, 50.0, 66.66}; + + // Add points along the segment [a, b] + double dist_ab = CGAL::sqrt(CGAL::squared_distance(a, b)); + int nb = static_cast(std::floor(dist_ab / edge_size)); + auto vector = (b - a) / static_cast(nb); + + Point_3 p = a; + for(int i = 0; i < nb; ++i) { + *pts_out_iterator++ = Point_dim_index{Weighted_point_3{p}, 1, Index(1)}; + p += vector; + } + return pts_out_iterator; + }; /// [Meshing] - C3t3 c3t3; - initialize_triangulation_from_labeled_image(c3t3, - domain, - image, - criteria, - static_cast(0)); - CGAL::refine_mesh_3(c3t3, domain, criteria); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + params::initial_points_generator(custom_initial_points_generator)); /// [Meshing] // Output diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_image_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_image_initialization.cpp new file mode 100644 index 00000000000..1117c2ed351 --- /dev/null +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_image_initialization.cpp @@ -0,0 +1,64 @@ +#include "random_labeled_image.h" +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +// Domain +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; + +#ifdef CGAL_CONCURRENT_MESH_3 +typedef CGAL::Parallel_tag Concurrency_tag; +#else +typedef CGAL::Sequential_tag Concurrency_tag; +#endif + +// Triangulation +typedef CGAL::Mesh_triangulation_3::type Tr; + +typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + +// Criteria +typedef CGAL::Mesh_criteria_3 Mesh_criteria; + +namespace params = CGAL::parameters; + +int main() +{ + /// [Create_the_image] + CGAL::Image_3 image = random_labeled_image(); + /// [Create_the_image] + + // Domain + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); + + // Mesh criteria + Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1) + .cell_radius_edge_ratio(3).cell_size(3)); + + /// [Meshing] + // Mesh generation with a custom initialization that places points + // on the surface of each connected component of the image. + CGAL::Construct_initial_points_labeled_image img_pts_generator(image, domain); + + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + params::initial_points_generator(img_pts_generator)); + /// [Meshing] + + // Output + std::ofstream medit_file("out.mesh"); + CGAL::IO::write_MEDIT(medit_file, c3t3); + medit_file.close(); + + return 0; +} diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_initial_points.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_initial_points.cpp new file mode 100644 index 00000000000..947fe4d890d --- /dev/null +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_initial_points.cpp @@ -0,0 +1,77 @@ +#include "random_labeled_image.h" +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +// Domain +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Labeled_mesh_domain_3 Image_domain; +typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain; + +#ifdef CGAL_CONCURRENT_MESH_3 +typedef CGAL::Parallel_tag Concurrency_tag; +#else +typedef CGAL::Sequential_tag Concurrency_tag; +#endif + +// Triangulation +typedef CGAL::Mesh_triangulation_3::type Tr; + +typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + +// Criteria +typedef CGAL::Mesh_criteria_3 Mesh_criteria; + +namespace params = CGAL::parameters; + +int main() +{ + const std::string fname = CGAL::data_file_path("images/420.inr"); + // Loads image + CGAL::Image_3 image; + if(!image.read(fname)){ + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } + + // Domain + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image + , params::features_detector(CGAL::Mesh_3::Detect_features_in_image())); + + // Mesh criteria + Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1).edge_size(3) + .cell_radius_edge_ratio(3).cell_size(3)); + + using Point_3 = K::Point_3; + using Weighted_point_3 = K::Weighted_point_3; + using Index = Mesh_domain::Index; + using Initial_point_t = std::tuple; + + // Creation of the initial_points vector + std::vector initial_points = { + {Weighted_point_3(Point_3(30.0, 50.0, 83.33), 30.0), 1, Index(1)}, + {Weighted_point_3(Point_3(70.0, 50.0, 83.33), 50.0), 1, Index(1)} + }; + + /// [Meshing] + // Mesh generation from labeled image with initial points. + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + params::initial_points(std::cref(initial_points))); + /// [Meshing] + + // Output + std::ofstream ofs("out.mesh"); + CGAL::IO::write_MEDIT(ofs, c3t3); + + return 0; +} diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index 82380d7865b..e47d899faec 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -644,7 +644,7 @@ private: #ifdef CGAL_INTRUSIVE_LIST Cell_handle next_intrusive_ = {}, previous_intrusive_ = {}; #endif - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); std::array surface_center_index_table_ = {}; /// Stores visited facets (4 first bits) diff --git a/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_gray_image.h b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_gray_image.h new file mode 100644 index 00000000000..6dd6c4a3c9c --- /dev/null +++ b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_gray_image.h @@ -0,0 +1,114 @@ +// Copyright (c) 2015,2016 GeometryFactory +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau, Jane Tournois and Ange Clement + +#ifndef CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H +#define CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H + +#include + +#include +#include + +#include + +namespace CGAL +{ + +/*! + * \ingroup PkgMesh3Initializers + * + * Functor for generating initial points in gray images. + * This functor is a model of the `InitialPointsGenerator_3` concept, + * and can be passed as a parameter to `CGAL::make_mesh_3` using the + * `CGAL::parameters::initial_points_generator()` parameter function. + * + * On images that contain multiple connected components, + * this functor will scan the full image and + * output enough points on the surface of each component + * to initialize them all. Each connected component is guaranteed to be + * represented by at least one cell of the triangulation. + * + * \cgalModels{InitialPointsGenerator_3} + * + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + * @tparam MeshDomain model of `MeshDomain_3` + * @tparam Functor a function object that takes the number type in which the image is encoded, + * and returns the `MeshDomain::Index` of the corresponding subcomplex index. + * The default type is `CGAL::Null_functor`. + * + * \sa `CGAL::parameters::initial_points_generator()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::Construct_initial_points_labeled_image` + */ +template +struct Construct_initial_points_gray_image +{ + const CGAL::Image_3 & image_; + const MeshDomain& domain_; + const typename MeshDomain::R::FT iso_value_; + Functor image_values_to_subdomain_indices_; + + /*! + * Constructs a functor for generating initial points in gray images. + * @param image the gray image that defines the mesh domain + * @param domain the mesh domain + * @param iso_value the iso value corresponding to the surface of the domain + * @param image_values_to_subdomain_indices a function object that takes + * the number type in which `image` is encoded, + * and returns the corresponding `MeshDomain::Index`. + * The default functor is `CGAL::Null_functor` + * and corresponds to meshing the areas where the image values are + * greater than `iso_value`. + */ + Construct_initial_points_gray_image(const CGAL::Image_3 & image, + const MeshDomain& domain, + const double iso_value, + const Functor image_values_to_subdomain_indices = CGAL::Null_functor()) + : image_(image) + , domain_(domain) + , iso_value_(static_cast(iso_value)) + , image_values_to_subdomain_indices_(image_values_to_subdomain_indices) + { } + + /*! + * \brief constructs at least `n` points by collecting them on the surface of all + * subdomains in the image, + * even if they are not connected components. + * Using this functor guarantees to initialize each connected component. + * + * @tparam OutputIterator model of `OutputIterator` for + * tuple-like objects containing + * - a `Weighted_point_3` for the point + * - an `int` for the minimal dimension of the subcomplexes on which the point lies + * - a `MeshDomain::Index` for the corresponding subcomplex index + * @tparam MeshDomain model of `MeshDomain_3` + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + * + */ + template + OutputIterator operator()(OutputIterator pts, const int n = 20) const + { + using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; + using C_i_v_t_s_i = Create_gray_image_values_to_subdomain_indices; + using Image_values_to_subdomain_indices = typename C_i_v_t_s_i::type; + + Image_values_to_subdomain_indices transform_fct = + C_i_v_t_s_i()(image_values_to_subdomain_indices_, iso_value_); + Construct_initial_points_labeled_image init_pts{ image_, domain_ }; + init_pts(pts, transform_fct, n); + return pts; + } +}; + +} // end namespace CGAL + +#endif // CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h new file mode 100644 index 00000000000..ac79ecce0b6 --- /dev/null +++ b/Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h @@ -0,0 +1,332 @@ +// Copyright (c) 2015,2016 GeometryFactory +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau and Ange Clement + +#ifndef CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_LABELED_IMAGE_H +#define CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_LABELED_IMAGE_H + +#include + +#include + +#include +#include + +#include + +namespace CGAL +{ + +namespace Mesh_3 +{ +namespace internal +{ + +template +struct Get_point +{ + const double vx, vy, vz; + const double tx, ty, tz; + const std::size_t xdim, ydim, zdim; + Get_point(const CGAL::Image_3* image) + : vx(image->vx()) + , vy(image->vy()) + , vz(image->vz()) + , tx(image->tx()) + , ty(image->ty()) + , tz(image->tz()) + , xdim(image->xdim()) + , ydim(image->ydim()) + , zdim(image->zdim()) + {} + + Point operator()(const std::size_t i, + const std::size_t j, + const std::size_t k) const + { + double x = double(i) * vx + tx; + double y = double(j) * vy + ty; + double z = double(k) * vz + tz; + + if (i == 0) x += 1. / 6. * vx; + else if (i == xdim - 1) x -= 1. / 6. * vx; + if (j == 0) y += 1. / 6. * vy; + else if (j == ydim - 1) y -= 1. / 6. * vy; + if (k == 0) z += 1. / 6. * vz; + else if (k == zdim - 1) z -= 1. / 6. * vz; + + return Point(x, y, z); + } +}; + +} // end namespace internal +} // end namespace Mesh_3 + +/*! + * \ingroup PkgMesh3Initializers + * + * Functor for generating initial points in labeled images. + * This functor is a model of the `InitialPointsGenerator_3` concept, + * and can be passed as a parameter to `CGAL::make_mesh_3` using the + * `CGAL::parameters::initial_points_generator()` parameter function. + * + * This functor scans the complete image to detect all its connected components, + * and constructs points on the surface of each of them. + * Its goal is to initialize each component, each of them corresponding + * to a subdomain. + * It ensures that each component will be initialized, i.e. represented + * by at least one cell of the triangulation. + * + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + * @tparam MeshDomain model of `MeshDomain_3` + * + * \cgalModels{InitialPointsGenerator_3} + * + * \sa `CGAL::parameters::initial_points_generator()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::Construct_initial_points_gray_image` + */ +template +struct Construct_initial_points_labeled_image +{ + const CGAL::Image_3& image_; + const MeshDomain& domain_; + + /*! + * Constructs a functor for generating initial points in labeled images. + * @param image the labeled image that defines the mesh domain + * @param domain the mesh domain + */ + Construct_initial_points_labeled_image(const CGAL::Image_3& image, + const MeshDomain& domain) + : image_(image) + , domain_(domain) + { } + + /*! + * \brief constructs at least `n` initial points. + * + * @tparam OutputIterator model of `OutputIterator` for + * tuple-like objects containing + * - a `Weighted_point_3` for the point + * - an `int` for the minimal dimension of the subcomplexes on which the point lies + * - a `MeshDomain::Index` for the corresponding subcomplex index + */ + template + OutputIterator operator()(OutputIterator pts, const int n = 20) const + { + CGAL_IMAGE_IO_CASE(image_.image(), operator()(pts, CGAL::Identity(), n)); + return pts; + } + + /* //internal undocumented + * \brief Same as above, but a `TransformOperator` that transforms values of the image is used. + * + * @tparam OutputIterator model of `OutputIterator` for + * tuple-like objects containing + * - a `Weighted_point_3` for the point + * - an `int` for the minimal dimension of the subcomplexes on which the point lies + * - a `MeshDomain::Index` for the corresponding subcomplex index + * @tparam TransformOperator functor that transforms values of the image. + * It must provide the following type:
      + * `result_type`: a type that supports the '==' operator
      + * and the following operator:
      + * `result_type operator()(Word v)` + * with `Word` the type of the image values. + * @tparam C3t3 model of `MeshComplex_3InTriangulation_3` + */ + template + OutputIterator operator()(OutputIterator pts, TransformOperator transform, int n = 20) const + { + typedef typename MeshDomain::Subdomain Subdomain; + typedef typename MeshDomain::Point_3 Point_3; + typedef typename MeshDomain::Index Index; + + typedef typename C3t3::Triangulation Tr; + typedef typename Tr::Geom_traits GT; + typedef typename GT::FT FT; + typedef typename Tr::Weighted_point Weighted_point; + typedef typename Tr::Segment Segment_3; + typedef typename Tr::Vertex_handle Vertex_handle; + typedef typename Tr::Cell_handle Cell_handle; + typedef typename GT::Vector_3 Vector_3; + + C3t3 c3t3; + Tr& tr = c3t3.triangulation(); + + typename GT::Compare_weighted_squared_radius_3 cwsr = + tr.geom_traits().compare_weighted_squared_radius_3_object(); + typename GT::Construct_point_3 cp = + tr.geom_traits().construct_point_3_object(); + typename GT::Construct_weighted_point_3 cwp = + tr.geom_traits().construct_weighted_point_3_object(); + + const double max_v = (std::max)((std::max)(image_.vx(), + image_.vy()), + image_.vz()); + + struct Seed { + std::size_t i, j, k; + std::size_t radius; + }; + using Seeds = std::vector; + + Seeds seeds; + Mesh_3::internal::Get_point get_point(&image_); + std::cout << "Searching for connected components..." << std::endl; + CGAL_IMAGE_IO_CASE(image_.image(), search_for_connected_components_in_labeled_image(image_, + std::back_inserter(seeds), + CGAL::Emptyset_iterator(), + transform, + Word())); + std::cout << " " << seeds.size() << " components were found." << std::endl; + std::cout << "Construct initial points..." << std::endl; + for(const Seed seed : seeds) + { + const Point_3 seed_point = get_point(seed.i, seed.j, seed.k); + Cell_handle seed_cell = tr.locate(cwp(seed_point)); + + const Subdomain seed_label + = domain_.is_in_domain_object()(seed_point); + const Subdomain seed_cell_label + = ( tr.dimension() < 3 + || seed_cell == Cell_handle() + || tr.is_infinite(seed_cell)) + ? Subdomain() //seed_point is OUTSIDE_AFFINE_HULL + : domain_.is_in_domain_object()( + seed_cell->weighted_circumcenter(tr.geom_traits())); + + if ( seed_label != std::nullopt + && seed_cell_label != std::nullopt + && *seed_label == *seed_cell_label) + continue; //this means the connected component has already been initialized + + const double radius = double(seed.radius + 1)* max_v; + CGAL::Random_points_on_sphere_3 points_on_sphere_3(radius); + // [construct intersection] + typename MeshDomain::Construct_intersection construct_intersection = + domain_.construct_intersection_object(); + // [construct intersection] + + std::vector directions; + if(seed.radius < 2) { + // shoot in six directions + directions.push_back(Vector_3(-radius, 0, 0)); + directions.push_back(Vector_3(+radius, 0, 0)); + directions.push_back(Vector_3(0, -radius, 0)); + directions.push_back(Vector_3(0, +radius, 0)); + directions.push_back(Vector_3(0, 0, -radius)); + directions.push_back(Vector_3(0, 0, +radius)); + } else { + for(int i = 0; i < n; ++i) + { + // shoot n random directions + directions.push_back(*points_on_sphere_3++ - CGAL::ORIGIN); + } + } + + for(const Vector_3& v : directions) + { + const Point_3 test = seed_point + v; + const Segment_3 test_segment(seed_point, test); + + // [use construct intersection] + const typename MeshDomain::Intersection intersect = + construct_intersection(test_segment); + // [use construct intersection] + if (std::get<2>(intersect) != 0) + { + // [get construct intersection] + const Point_3& intersect_point = std::get<0>(intersect); + const Index& intersect_index = std::get<1>(intersect); + // [get construct intersection] + Weighted_point pi(intersect_point); + + // This would cause trouble to optimizers + // check pi will not be hidden + typename Tr::Locate_type lt; + int li, lj; + Cell_handle pi_cell = tr.locate(pi, lt, li, lj); + if(lt != Tr::OUTSIDE_AFFINE_HULL) { + switch (tr.dimension()) + { //skip dimension 0 + case 1: + if (tr.side_of_power_segment(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) + continue; + break; + case 2: + if (tr.side_of_power_circle(pi_cell, 3, pi, true) != CGAL::ON_BOUNDED_SIDE) + continue; + break; + case 3: + if (tr.side_of_power_sphere(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) + continue; + } + } + + //check pi is not inside a protecting ball + std::vector conflict_vertices; + if (tr.dimension() == 3) + { + tr.vertices_on_conflict_zone_boundary(pi, pi_cell + , std::back_inserter(conflict_vertices)); + } + else + { + for (typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin(); + vit != tr.finite_vertices_end(); ++vit) + { + const Weighted_point& wp = tr.point(vit); + if (cwsr(wp, FT(0)) == CGAL::SMALLER) // 0 < wp's weight + conflict_vertices.push_back(vit); + } + } + + bool pi_inside_protecting_sphere = false; + for(Vertex_handle cv : conflict_vertices) + { + if(tr.is_infinite(cv)) + continue; + + const Weighted_point& cv_wp = tr.point(cv); + if (cwsr(cv_wp, FT(0)) == CGAL::EQUAL) // 0 == wp's weight + continue; + + // if the (squared) distance between intersect_point and cv is smaller or equal than cv's weight + if (cwsr(cv_wp, - tr.min_squared_distance(intersect_point, cp(cv_wp))) != CGAL::LARGER) + { + pi_inside_protecting_sphere = true; + break; + } + } + if (pi_inside_protecting_sphere) + continue; + + // insert point in temporary triangulation + Vertex_handle v = tr.insert(pi); + + // `v` could be null if `pi` is hidden by other vertices of `tr`. + CGAL_assertion(v != Vertex_handle()); + + c3t3.set_dimension(v, 2); // by construction, points are on surface + c3t3.set_index(v, intersect_index); + + *pts++ = std::make_pair(pi, intersect_index); // dimension 2 by construction, points are on surface + } + } + } + return pts; + } +}; + +} // end namespace CGAL + +#endif // CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_LABELED_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index 036094d60b0..982681d4ac2 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -687,14 +687,16 @@ initialize() bbox.xmin() + 0.5*xdelta, bbox.ymin() + 0.5*ydelta, bbox.zmin() + 0.5*zdelta); -# ifdef CGAL_CONCURRENT_MESH_3_VERBOSE - std::cerr << "Adding points on a far sphere (radius = " << radius <<")..."; -# endif CGAL::Random rnd(0); Random_points_on_sphere_3 random_point(radius, rnd); const int NUM_PSEUDO_INFINITE_VERTICES = static_cast( float(std::thread::hardware_concurrency()) * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core); +#ifdef CGAL_MESH_3_VERBOSE + std::cerr << "Adding " << NUM_PSEUDO_INFINITE_VERTICES + << " points on a far sphere (radius = " << radius << ")..."; +#endif + for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point) r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_weighted_point_3_object() (r_c3t3_.triangulation().geom_traits().construct_translated_point_3_object()(*random_point, center))); @@ -745,11 +747,12 @@ initialize() bbox.xmin() + 0.5*xdelta, bbox.ymin() + 0.5*ydelta, bbox.zmin() + 0.5*zdelta); -# ifdef CGAL_MESH_3_VERBOSE - std::cerr << "Adding points on a far sphere (radius = " << radius << ")..."; -# endif Random_points_on_sphere_3 random_point(radius); const int NUM_PSEUDO_INFINITE_VERTICES = 12*2; +# ifdef CGAL_MESH_3_VERBOSE + std::cerr << "Adding " << NUM_PSEUDO_INFINITE_VERTICES + << " points on a far sphere (radius = " << radius << ")..."; +#endif for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point) r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_weighted_point_3_object() (r_c3t3_.triangulation().geom_traits().construct_translated_point_3_object()(*random_point, center))); diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index dfe2fb0a4ed..2e936424d62 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -234,6 +234,7 @@ private: Weight w, int dim, const Index& index, + Vertex_handle prev, ErasedVeOutIt out); /// Inserts balls between the points identified by the handles `vp` and `vq` @@ -549,7 +550,7 @@ Protect_edges_sizing_field:: operator()(const bool refine) { // This class is only meant to be used with non-periodic triangulations - CGAL_assertion(!(std::is_same::value)); + CGAL_assertion(!(std::is_same_v)); #ifdef CGAL_MESH_3_VERBOSE std::cerr << "Inserting protection balls..." << std::endl @@ -630,7 +631,7 @@ insert_corners() // Get weight (the ball radius is given by the 'query_size' function) const FT query_weight = CGAL::square(query_size(p, 0, p_index)); FT w = use_minimal_size() - ? (std::min)(minimal_weight_, query_weight) + ? (std::max)(minimal_weight(), query_weight) : query_weight; #if CGAL_MESH_3_PROTECTION_DEBUG & 1 @@ -639,7 +640,8 @@ insert_corners() // The following lines ensure that the weight w is small enough so that // corners balls do not intersect - if(dt.number_of_vertices() >= 2) + if( dt.number_of_vertices() >= 2 + && (!use_minimal_size() || w != minimal_weight())) { typename Dt::Vertex_handle vh; CGAL_assertion_code( bool p_found = ) @@ -656,10 +658,13 @@ insert_corners() dt, vh, finite_incident_cells); w = (std::min)(w, nearest_sq_dist / FT(9)); + + if(use_minimal_size()) + w = (std::max)(w, minimal_weight_); } // Insert corner with ball (dim is zero because p is a corner) - Vertex_handle v = smart_insert_point(p, w, 0, p_index, + Vertex_handle v = smart_insert_point(p, w, 0, p_index, Vertex_handle(), CGAL::Emptyset_iterator()).first; CGAL_assertion(v != Vertex_handle()); @@ -760,7 +765,7 @@ template std::pair::Vertex_handle, ErasedVeOutIt> Protect_edges_sizing_field:: -smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, +smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, Vertex_handle prev, ErasedVeOutIt out) { #if CGAL_MESH_3_PROTECTION_DEBUG & 1 @@ -791,7 +796,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, // Check that new point will not be inside a power sphere typename Tr::Locate_type lt; int li, lj; - Cell_handle ch = tr.locate(wp0, lt, li, lj); + Cell_handle ch = tr.locate(wp0, lt, li, lj, prev); Vertex_handle nearest_vh = tr.nearest_power_vertex(p, ch); FT sq_d = sq_distance(p, cp(tr.point(nearest_vh))); @@ -1059,6 +1064,7 @@ insert_balls_on_edges() CGAL::square(p_size), 1 /*dim*/, p_index, + Vertex_handle(), CGAL::Emptyset_iterator()).first; } // No 'else' because in that case 'is_vertex(..)' already filled @@ -1248,6 +1254,7 @@ insert_balls(const Vertex_handle& vp, point_weight, dim, index, + Vertex_handle(), out); if(forced_stop()) return out; const Vertex_handle new_vertex = pair.first; @@ -1338,7 +1345,7 @@ insert_balls(const Vertex_handle& vp, // Insert point into c3t3 std::pair pair = - smart_insert_point(new_point, point_weight, dim, index, out); + smart_insert_point(new_point, point_weight, dim, index, prev, out); Vertex_handle new_vertex = pair.first; out = pair.second; diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h deleted file mode 100644 index 1d3a6b7601e..00000000000 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2015,2016 GeometryFactory -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Laurent Rineau, Jane Tournois - -#ifndef CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H -#define CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H - -#include - -#include -#include - -#include - -template -void initialize_triangulation_from_gray_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - const FT& iso_value, - Image_word_type, - const Functor image_values_to_subdomain_indices = CGAL::Null_functor(), - bool protect_features = false) -{ - typedef typename CGAL::Default::Get::type Functor_; - - using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; - typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; - typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; - Image_values_to_subdomain_indices transform_fct = - C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); - - initialize_triangulation_from_labeled_image(c3t3, domain, image, criteria, - Image_word_type(), - protect_features, - transform_fct); -} - -#endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h deleted file mode 100644 index ec3e5761a9a..00000000000 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (c) 2015,2016 GeometryFactory -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Laurent Rineau - -#ifndef CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H -#define CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -template -struct Get_point -{ - const double vx, vy, vz; - const double tx, ty, tz; - const std::size_t xdim, ydim, zdim; - Get_point(const CGAL::Image_3* image) - : vx(image->vx()) - , vy(image->vy()) - , vz(image->vz()) - , tx(image->tx()) - , ty(image->ty()) - , tz(image->tz()) - , xdim(image->xdim()) - , ydim(image->ydim()) - , zdim(image->zdim()) - {} - - Point operator()(const std::size_t i, - const std::size_t j, - const std::size_t k) const - { - double x = double(i) * vx + tx; - double y = double(j) * vy + ty; - double z = double(k) * vz + tz; - - if (i == 0) x += 1. / 6. * vx; - else if (i == xdim - 1) x -= 1. / 6. * vx; - if (j == 0) y += 1. / 6. * vy; - else if (j == ydim - 1) y -= 1. / 6. * vy; - if (k == 0) z += 1. / 6. * vz; - else if (k == zdim - 1) z -= 1. / 6. * vz; - - return Point(x, y, z); - } -}; -template -void init_tr_from_labeled_image_call_init_features(C3T3&, - const MeshDomain&, - const MeshCriteria&, - CGAL::Tag_false) -{ -} -template -void init_tr_from_labeled_image_call_init_features(C3T3& c3t3, - const MeshDomain& domain, - const MeshCriteria& criteria, - CGAL::Tag_true) -{ - CGAL::Mesh_3::internal::init_c3t3_with_features(c3t3, - domain, - criteria); - std::cout << c3t3.triangulation().number_of_vertices() - << " initial points on 1D-features" << std::endl; -} - -template > -void initialize_triangulation_from_labeled_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - Image_word_type, - bool protect_features = false, - TransformOperator transform = CGAL::Identity()) -{ - typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits GT; - typedef typename GT::FT FT; - typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Bare_point Bare_point; - typedef typename Tr::Segment Segment_3; - typedef typename Tr::Vertex_handle Vertex_handle; - typedef typename Tr::Cell_handle Cell_handle; - - typedef typename GT::Vector_3 Vector_3; - - typedef MeshDomain Mesh_domain; - - Tr& tr = c3t3.triangulation(); - - typename GT::Compare_weighted_squared_radius_3 cwsr = - tr.geom_traits().compare_weighted_squared_radius_3_object(); - typename GT::Construct_point_3 cp = - tr.geom_traits().construct_point_3_object(); - typename GT::Construct_weighted_point_3 cwp = - tr.geom_traits().construct_weighted_point_3_object(); - - if(protect_features) { - init_tr_from_labeled_image_call_init_features - (c3t3, domain, criteria, - CGAL::internal::Has_features()); - } - - const double max_v = (std::max)((std::max)(image.vx(), - image.vy()), - image.vz()); - - struct Seed { - std::size_t i, j, k; - std::size_t radius; - }; - using Seeds = std::vector; - using Subdomain = typename Mesh_domain::Subdomain; - - Seeds seeds; - Get_point get_point(&image); - std::cout << "Searching for connected components..." << std::endl; - search_for_connected_components_in_labeled_image(image, - std::back_inserter(seeds), - CGAL::Emptyset_iterator(), - transform, - Image_word_type()); - std::cout << " " << seeds.size() << " components were found." << std::endl; - std::cout << "Construct initial points..." << std::endl; - for(const Seed seed : seeds) - { - const Bare_point seed_point = get_point(seed.i, seed.j, seed.k); - Cell_handle seed_cell = tr.locate(cwp(seed_point)); - - const Subdomain seed_label - = domain.is_in_domain_object()(seed_point); - const Subdomain seed_cell_label - = ( tr.dimension() < 3 - || seed_cell == Cell_handle() - || tr.is_infinite(seed_cell)) - ? Subdomain() //seed_point is OUTSIDE_AFFINE_HULL - : domain.is_in_domain_object()( - seed_cell->weighted_circumcenter(tr.geom_traits())); - - if ( seed_label != std::nullopt - && seed_cell_label != std::nullopt - && *seed_label == *seed_cell_label) - continue; //this means the connected component has already been initialized - - const double radius = double(seed.radius + 1)* max_v; - CGAL::Random_points_on_sphere_3 points_on_sphere_3(radius); - typename Mesh_domain::Construct_intersection construct_intersection = - domain.construct_intersection_object(); - - std::vector directions; - if(seed.radius < 2) { - // shoot in six directions - directions.push_back(Vector_3(-radius, 0, 0)); - directions.push_back(Vector_3(+radius, 0, 0)); - directions.push_back(Vector_3(0, -radius, 0)); - directions.push_back(Vector_3(0, +radius, 0)); - directions.push_back(Vector_3(0, 0, -radius)); - directions.push_back(Vector_3(0, 0, +radius)); - } else { - for(int i = 0; i < 20; ++i) - { - // shoot 20 random directions - directions.push_back(*points_on_sphere_3++ - CGAL::ORIGIN); - } - } - - for(const Vector_3& v : directions) - { - const Bare_point test = seed_point + v; - - const typename Mesh_domain::Intersection intersect = - construct_intersection(Segment_3(seed_point, test)); - if (std::get<2>(intersect) != 0) - { - const Bare_point& bpi = std::get<0>(intersect); - Weighted_point pi = cwp(bpi); - - // This would cause trouble to optimizers - // check pi will not be hidden - typename Tr::Locate_type lt; - int li, lj; - Cell_handle pi_cell = tr.locate(pi, lt, li, lj); - if(lt != Tr::OUTSIDE_AFFINE_HULL) { - switch (tr.dimension()) - { //skip dimension 0 - case 1: - if (tr.side_of_power_segment(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) - continue; - break; - case 2: - if (tr.side_of_power_circle(pi_cell, 3, pi, true) != CGAL::ON_BOUNDED_SIDE) - continue; - break; - case 3: - if (tr.side_of_power_sphere(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE) - continue; - } - } - - //check pi is not inside a protecting ball - std::vector conflict_vertices; - if (tr.dimension() == 3) - { - tr.vertices_on_conflict_zone_boundary(pi, pi_cell - , std::back_inserter(conflict_vertices)); - } - else - { - for (typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin(); - vit != tr.finite_vertices_end(); ++vit) - { - const Weighted_point& wp = tr.point(vit); - if (cwsr(wp, FT(0)) == CGAL::SMALLER) // 0 < wp's weight - conflict_vertices.push_back(vit); - } - } - - bool pi_inside_protecting_sphere = false; - for(Vertex_handle cv : conflict_vertices) - { - if(tr.is_infinite(cv)) - continue; - - const Weighted_point& cv_wp = tr.point(cv); - if (cwsr(cv_wp, FT(0)) == CGAL::EQUAL) // 0 == wp's weight - continue; - - // if the (squared) distance between bpi and cv is smaller or equal than cv's weight - if (cwsr(cv_wp, - tr.min_squared_distance(bpi, cp(cv_wp))) != CGAL::LARGER) - { - pi_inside_protecting_sphere = true; - break; - } - } - if (pi_inside_protecting_sphere) - continue; - const typename Mesh_domain::Index index = std::get<1>(intersect); - - /// The following lines show how to insert initial points in the - /// `c3t3` object. [insert initial points] - Vertex_handle v = tr.insert(pi); - - // `v` could be null if `pi` is hidden by other vertices of `tr`. - CGAL_assertion(v != Vertex_handle()); - - c3t3.set_dimension(v, 2); // by construction, points are on surface - c3t3.set_index(v, index); - /// [insert initial points] - } - // else - // { - // std::cerr << - // boost::format("Error. Segment (%1%, %2%) does not intersect the surface!\n") - // % it->first % test; - // } - } - } - std::cout << " " << tr.number_of_vertices() << " initial points." << std::endl; - if ( c3t3.triangulation().dimension() != 3 ) - { - std::cout << " not enough points: triangulation.dimension() == " - << c3t3.triangulation().dimension() << std::endl; - CGAL::Mesh_3::internal::init_c3t3(c3t3, domain, criteria, 20); - std::cout << " -> " << tr.number_of_vertices() << " initial points." << std::endl; - } -} - -#endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h b/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h index 31218f7c60d..db92293abf4 100644 --- a/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h +++ b/Mesh_3/include/CGAL/Mesh_3/internal/Graph_manipulations.h @@ -100,7 +100,7 @@ struct Graph_manipulations edge_descriptor edge; bool b; // test if the edge is already here, using add_edge - boost::tie(edge, b) = add_edge(va, vb, g); + std::tie(edge, b) = add_edge(va, vb, g); remove_edge(edge, g); if(!b) { // The edge was already here. @@ -129,7 +129,7 @@ struct Graph_manipulations if(v1 != v2) { edge_descriptor edge; bool b; - boost::tie(edge, b) = add_edge(v1, v2, g); + std::tie(edge, b) = add_edge(v1, v2, g); return b; } else return false; diff --git a/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h b/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h index f51af8cd0b3..8debd8dfdfc 100644 --- a/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/internal/helpers.h @@ -72,7 +72,7 @@ struct Angle_tester else { out_edge_iterator out_edge_it, out_edges_end; - boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); + std::tie(out_edge_it, out_edges_end) = out_edges(v, g); vertex_descriptor v1 = target(*out_edge_it++, g); vertex_descriptor v2 = target(*out_edge_it++, g); diff --git a/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h b/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h index 7b3dde34edc..67bcedd1a6b 100644 --- a/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h +++ b/Mesh_3/include/CGAL/Mesh_3/polylines_to_protect.h @@ -325,7 +325,7 @@ struct Angle_tester else { out_edge_iterator out_edge_it, out_edges_end; - boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); + std::tie(out_edge_it, out_edges_end) = out_edges(v, g); vertex_descriptor v1 = target(*out_edge_it++, g); vertex_descriptor v2 = target(*out_edge_it++, g); diff --git a/Mesh_3/include/CGAL/Mesh_cell_base_3.h b/Mesh_3/include/CGAL/Mesh_cell_base_3.h index d2f09a0606a..ac5535f7090 100644 --- a/Mesh_3/include/CGAL/Mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_cell_base_3.h @@ -273,7 +273,7 @@ private: #ifdef CGAL_INTRUSIVE_LIST Cell_handle next_intrusive_, previous_intrusive_; #endif - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; // end class Mesh_cell_base_3 diff --git a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h index 454c0c94aff..04b6d247da1 100644 --- a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h +++ b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h @@ -41,10 +41,9 @@ private: typedef CGAL::HalfedgeDS_vertex_base Pdv_base; Set_of_indices indices; - std::size_t time_stamp_; - + std::size_t time_stamp_ = std::size_t(-2); public: - int nb_of_feature_edges; + int nb_of_feature_edges = 0; bool is_corner() const { return nb_of_feature_edges > 2; @@ -85,8 +84,8 @@ public: return indices; } - Mesh_polyhedron_vertex() : Pdv_base(), time_stamp_(-1), nb_of_feature_edges(0) {} - Mesh_polyhedron_vertex(const Point& p) : Pdv_base(p), time_stamp_(-1), nb_of_feature_edges(0) {} + Mesh_polyhedron_vertex() = default; + Mesh_polyhedron_vertex(const Point& p) : Pdv_base(p) {} }; template @@ -95,7 +94,7 @@ public CGAL::HalfedgeDS_halfedge_base { private: bool feature_edge; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: @@ -143,7 +142,7 @@ public CGAL::HalfedgeDS_face_base { private: Patch_id_ patch_id_; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: diff --git a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h index 46b09094e95..db43424ec4f 100644 --- a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h @@ -250,7 +250,7 @@ private: Vertex_handle next_intrusive_; Vertex_handle previous_intrusive_; #endif - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: friend std::istream& operator>>(std::istream &is, Mesh_vertex_3& v) diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 6cae4726dd1..4350b92faff 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -25,8 +25,11 @@ #include #include #include +#include +#include #include +#include #include @@ -38,46 +41,126 @@ namespace CGAL { namespace Mesh_3 { namespace internal { -template < typename C3T3, typename MeshDomain, typename MeshCriteria > +template +struct Push_to_initial_point { + // This struct cannot be a lambda-expression before C++20, because we need it to be copyable/assignable. + std::vector* points_vector_ptr; + C3T3* c3t3_ptr; + + Push_to_initial_point(std::vector* points_vector_ptr, C3T3* c3t3_ptr) + : points_vector_ptr(points_vector_ptr) + , c3t3_ptr(c3t3_ptr) + {} + + template + void operator()(const Initial_point_and_info& initial_pt) const { + using T = CGAL::cpp20::remove_cvref_t; + if constexpr (CGAL::STL_Extension::internal::tuple_like_of_size_2) + { + const auto& [pt, index] = initial_pt; + const auto& cwp = c3t3_ptr->triangulation().geom_traits().construct_weighted_point_3_object(); + points_vector_ptr->push_back(PointDimIndex{cwp(pt), 2, index}); + } + else + { + const auto& [weighted_pt, dim, index] = initial_pt; + points_vector_ptr->push_back(PointDimIndex{weighted_pt, dim, index}); + } + }; +}; + +template < typename C3T3, typename MeshDomain, typename InitialPointsGenerator > void -init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&, - const int nb_initial_points) +add_points_from_generator(C3T3& c3t3, + const MeshDomain&, + const int nb_initial_points, + const InitialPointsGenerator& generator) { - typedef typename MeshDomain::Point_3 Point_3; - typedef typename MeshDomain::Index Index; - typedef typename std::pair PI; - typedef std::vector Initial_points_vector; + typedef typename C3T3::Triangulation Tr; typedef typename C3T3::Vertex_handle Vertex_handle; - typedef CGAL::Mesh_3::Triangulation_helpers Th; + typedef CGAL::Mesh_3::Triangulation_helpers Th; - // Mesh initialization : get some points and add them to the mesh - Initial_points_vector initial_points; - if (nb_initial_points > -1) - domain.construct_initial_points_object()(std::back_inserter(initial_points), - nb_initial_points); - else //use default number of points - domain.construct_initial_points_object()(std::back_inserter(initial_points)); + struct PointDimIndex + { + typename Tr::Point m_wpt; + int m_dim; + typename MeshDomain::Index m_index; + }; - typename C3T3::Triangulation::Geom_traits::Construct_weighted_point_3 cwp = - c3t3.triangulation().geom_traits().construct_weighted_point_3_object(); + + std::vector initial_points; + Push_to_initial_point push_initial_point{&initial_points, &c3t3}; + auto output_it = boost::make_function_output_iterator(push_initial_point); + if (nb_initial_points > 0) + generator(output_it, nb_initial_points); + else + generator(output_it); // Insert points and set their index and dimension - for (const PI& pi : initial_points) + for (const auto& [wpoint, dimension, index] : initial_points) { - if(Th().inside_protecting_balls(c3t3.triangulation(), Vertex_handle(), pi.first)) + if(Th().inside_protecting_balls(c3t3.triangulation(), Vertex_handle(), wpoint.point())) continue; - Vertex_handle v = c3t3.triangulation().insert(cwp(pi.first)); + Vertex_handle v = c3t3.triangulation().insert(wpoint); // v could be null if point is hidden if ( v != Vertex_handle() ) { - c3t3.set_dimension(v,2); // by construction, points are on surface - c3t3.set_index(v, pi.second); + c3t3.set_dimension(v,dimension); + c3t3.set_index(v,index); } } } +template +bool +needs_more_init(C3T3& c3t3, const MeshDomain& domain) +{ + // If c3t3 initialization is not sufficient (may happen if + // the user has not specified enough points ), add some surface points + + if (c3t3.triangulation().dimension() != 3) + return true; + else // dimension is 3 but it may not be enough + { + CGAL::Mesh_3::C3T3_helpers helper(c3t3, domain); + helper.update_restricted_facets(); + + if (c3t3.number_of_facets() == 0) { + return true; + } + else + { + helper.update_restricted_cells(); + if (c3t3.number_of_cells() == 0) { + return true; + } + } + return false; + } +} + +template < typename C3T3, typename MeshDomain, typename MeshCriteria, typename InitializationOptions> +void +init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&, + const int nb_initial_points, + const InitializationOptions& init_options) +{ + // 1st insert points from initial_points range and initial_points_generator + add_points_from_generator(c3t3, domain, nb_initial_points, init_options); + + // If c3t3 initialization is not sufficient (may happen if + // the user has not specified enough points ), add some surface points + + // use mesh domain's Construct_initial_points to complete initialization + if(needs_more_init(c3t3, domain)) + { + add_points_from_generator(c3t3, domain, nb_initial_points, + domain.construct_initial_points_object()); + } +} + template < typename EdgeCriteria > struct Edge_criteria_sizing_field_wrapper { @@ -201,19 +284,23 @@ template < typename C3T3, typename MeshCriteria, bool MeshDomainHasHasFeatures, typename HasFeatures = int> -struct C3t3_initializer { }; +struct C3t3_initializer {}; // Partial specialization of C3t3_initializer // Handle cases where MeshDomain::Has_features is not a valid type -template < typename C3T3, typename MD, typename MC, typename HasFeatures > -struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures > +template < typename C3T3, typename MD, typename MC, typename HasFeatures> +struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures> { typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { if ( with_features ) { @@ -222,24 +309,29 @@ struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures > } init_c3t3(c3t3,domain,criteria, - mesh_options.number_of_initial_points); + mesh_options.number_of_initial_points, + init_options); } }; // Partial specialization of C3t3_initializer // Handles cases where MeshDomain::Has_features is a valid type -template < typename C3T3, typename MD, typename MC, typename HasFeatures > -struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures > +template < typename C3T3, typename MD, typename MC, typename HasFeatures> +struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures> { typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { C3t3_initializer < C3T3, MD, MC, true, typename MD::Has_features >() - (c3t3,domain,criteria,with_features,mesh_options); + (c3t3,domain,criteria,with_features,mesh_options,init_options); } }; @@ -247,47 +339,46 @@ struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures > // Handles cases where MeshDomain::Has_features is a valid type and is defined // to CGAL::Tag_true template < typename C3T3, typename MD, typename MC > -struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true > +struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true> : public C3t3_initializer_base < C3T3, MD, MC > { virtual ~C3t3_initializer() { } typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { if ( with_features ) { this->initialize_features(c3t3, domain, criteria,mesh_options); - // If c3t3 initialization is not sufficient (may happen if there is only - // a planar curve as feature for example), add some surface points - - bool need_more_init = c3t3.triangulation().dimension() != 3; - if(!need_more_init) { - CGAL::Mesh_3::C3T3_helpers helper(c3t3, domain); - helper.update_restricted_facets(); - - if (c3t3.number_of_facets() == 0) { - need_more_init = true; - } - else - { - helper.update_restricted_cells(); - if(c3t3.number_of_cells() == 0) { - need_more_init = true; - } - } + // If the initial points are not provided by the default generator, + // there is no need to count the restricted facets and cells for now + // because more vertices will be inserted anyway. + // The check will be done later in init_c3t3() + bool use_default_initializer = false; + if constexpr (std::is_same_v) // check default type + { + use_default_initializer = init_options.is_default(); //check it also has no additional vertices } - if(need_more_init) { + + // If c3t3 initialization from features initialization + // is not sufficient (may happen if there is only + // a planar curve as feature for example), add some surface points. + if (!use_default_initializer || CGAL::Mesh_3::internal::needs_more_init(c3t3, domain)) + { init_c3t3(c3t3, domain, criteria, - mesh_options.number_of_initial_points); + mesh_options.number_of_initial_points, init_options); } } else { init_c3t3(c3t3,domain,criteria, - mesh_options.number_of_initial_points); } + mesh_options.number_of_initial_points, init_options); } } }; @@ -295,14 +386,18 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true > // Handles cases where MeshDomain::Has_features is a valid type and is defined // to CGAL::Tag_false template < typename C3T3, typename MD, typename MC > -struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > +struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false> { typedef parameters::internal::Mesh_3_options Mesh_3_options; + typedef parameters::internal::Initialization_options Default_init_options; + + template void operator()(C3T3& c3t3, const MD& domain, const MC& criteria, bool with_features, - Mesh_3_options mesh_options = Mesh_3_options()) + Mesh_3_options mesh_options = Mesh_3_options(), + const InitOptions& init_options = Default_init_options()) { if ( with_features ) { @@ -311,7 +406,7 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > } init_c3t3(c3t3,domain,criteria, - mesh_options.number_of_initial_points); + mesh_options.number_of_initial_points, init_options); } }; @@ -442,6 +537,39 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > *

    } * \cgalParamDefault{`parameters::exude()`} * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh initialization with a functor} + * \cgalParamDescription{an `InitialPointsGenerator_3` can optionally be provided to start the meshing process. + * The following named parameter controls this option: + *
      + *
    • `parameters::initial_points_generator()` + *
    } + * \cgalParamDefault{the domain's `construct_initial_points_object()` + * will be called for the points initialization.} + * \cgalParamExtra{If the generator does not generate enough points, + * the domain's `construct_initial_points_object()` will be called.} + * \cgalParamExtra{If the parameter `parameters::initial_points()` is set, + * the functor will be called after insertion of the points.} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh initialization with points} + * \cgalParamDescription{a `Range` of initial points, represented as + * tuple-like objects made of `tuple-like` objects of `` can optionally + * be provided to start the meshing process. + * `Weighted_point_3` is the point's position and weight, + * `int` is the dimension of the minimal dimension subcomplex on which + * the point lies, and + * `Index` is the corresponding subcomplex index. + * The following named parameter controls this option: + *
      + *
    • `parameters::initial_points()` + *
    } + * \cgalParamDefault{`std::vector>()`} + * \cgalParamExtra{If this parameter is set, + * the domain's `construct_initial_points_object()` will be called + * only if there is no facet in the restricted Delaunay triangulation + * after points insertion.} + * \cgalParamExtra{If the parameter `parameters::initial_points_generator()` is set, + * the points will be inserted before calling the functor.} + * \cgalParamSectionEnd * \cgalNamedParamsEnd * * Note that regardless of which optimization processes are activated, @@ -469,7 +597,8 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C { using parameters::choose_parameter; using parameters::get_parameter; - C3T3 c3t3; + using parameters::get_parameter_reference; + parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v); parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); @@ -478,10 +607,31 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); + // range of initial points + using Initial_point = std::pair; + using Initial_points_range_ref = typename internal_np::Lookup_named_param_def>::reference; + using Initial_points_range = std::remove_cv_t>; + std::vector empty_vec; + Initial_points_range initial_points = choose_parameter(get_parameter_reference(np, internal_np::initial_points_param), empty_vec); + + // initial points generator + using Initial_points_generator = typename internal_np::Lookup_named_param_def::reference; + auto default_generator = domain.construct_initial_points_object(); + Initial_points_generator initial_points_generator = choose_parameter(get_parameter(np, internal_np::initial_points_generator_param), + default_generator); + const parameters::internal::Initialization_options + initial_points_gen_param(initial_points_generator, initial_points); + + C3T3 c3t3; make_mesh_3_impl(c3t3, domain, criteria, exude_param, perturb_param, odt_param, lloyd_param, features_param.features(), mesh_options_param, - manifold_options_param); + manifold_options_param, + initial_points_gen_param); return c3t3; } @@ -510,7 +660,7 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, * * @return The mesh as a C3T3 object */ -template +template void make_mesh_3_impl(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria& criteria, @@ -519,10 +669,10 @@ void make_mesh_3_impl(C3T3& c3t3, const parameters::internal::Odt_options& odt, const parameters::internal::Lloyd_options& lloyd, const bool with_features, - const parameters::internal::Mesh_3_options& - mesh_options = parameters::internal::Mesh_3_options(), - const parameters::internal::Manifold_options& - manifold_options = parameters::internal::Manifold_options()) + const parameters::internal::Mesh_3_options& mesh_options = {}, + const parameters::internal::Manifold_options& manifold_options = {}, + const parameters::internal::Initialization_options& + initialization_options = {}) { #ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING CGAL::get_default_random() = CGAL::Random(0); @@ -533,11 +683,13 @@ void make_mesh_3_impl(C3T3& c3t3, C3T3, MeshDomain, MeshCriteria, - ::CGAL::internal::has_Has_features::value > () (c3t3, - domain, - criteria, - with_features, - mesh_options); + ::CGAL::internal::has_Has_features::value, + int>()(c3t3, + domain, + criteria, + with_features, + mesh_options, + initialization_options); CGAL_assertion( c3t3.triangulation().dimension() >= 2 ); diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 38df3832193..de33e3d2024 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Mesh_3_Tests ) find_package(CGAL REQUIRED COMPONENTS ImageIO) @@ -49,6 +49,7 @@ create_single_source_cgal_program( "test_meshing_with_default_edge_size.cpp" ) create_single_source_cgal_program( "test_meshing_determinism.cpp" ) create_single_source_cgal_program( "test_meshing_without_features_determinism.cpp" ) create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) +create_single_source_cgal_program( "test_mesh_3_issue_8773.cpp" ) create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" ) create_single_source_cgal_program( "test_meshing_with_one_step.cpp" ) create_single_source_cgal_program( "test_meshing_with_one_step_with_features.cpp" ) @@ -79,6 +80,7 @@ foreach(target test_meshing_determinism test_meshing_without_features_determinism test_mesh_3_issue_1554 + test_mesh_3_issue_8773 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 test_meshing_with_one_step @@ -108,6 +110,7 @@ if(TARGET CGAL::TBB_support) test_meshing_determinism test_meshing_without_features_determinism test_mesh_3_issue_1554 + test_mesh_3_issue_8773 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 test_min_edge_length @@ -129,6 +132,7 @@ if(TARGET CGAL::TBB_support) "execution of test_meshing_polyhedral_complex" "execution of test_mesh_capsule_var_distance_bound" "execution of test_mesh_3_issue_1554" + "execution of test_mesh_3_issue_8773" "execution of test_mesh_polyhedral_domain_with_features_deprecated" "execution of test_mesh_cell_base_3" PROPERTY RUN_SERIAL 1) diff --git a/Mesh_3/test/Mesh_3/test_mesh_3_issue_8773.cpp b/Mesh_3/test/Mesh_3/test_mesh_3_issue_8773.cpp new file mode 100644 index 00000000000..bc348b25676 --- /dev/null +++ b/Mesh_3/test/Mesh_3/test_mesh_3_issue_8773.cpp @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Domain +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Polyhedron = CGAL::Surface_mesh; +using Mesh_domain = CGAL::Polyhedral_mesh_domain_with_features_3; + +// Triangulation +using Tr = CGAL::Mesh_triangulation_3::type; +using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; + +// Criteria +using Mesh_criteria = CGAL::Mesh_criteria_3; + +namespace params = CGAL::parameters; + +void check_stream(const std::ios& stream, + const std::string& filename, + const std::string& operation, + bool ok = true) { + if(!stream || !ok) { + std::cerr << "Stream error after " << operation << " file: " << filename << std::endl; + std::cerr << "Stream state: "; + if(stream.rdstate() == std::ios::goodbit) { + std::cerr << "no error"; + } else { + if(stream.rdstate() & std::ios::eofbit) { + std::cerr << "eofbit "; + } + if(stream.rdstate() & std::ios::failbit) { + std::cerr << "failbit "; + } + if(stream.rdstate() & std::ios::badbit) { + std::cerr << "badbit "; + } + } + std::cerr << std::endl; + std::exit(EXIT_FAILURE); + } +} + +int main(int argc, char* argv[]) { + const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cube.off"); + + // Create input polyhedron + Polyhedron polyhedron; + std::ifstream input(fname); + check_stream(input, fname, "opening"); + input >> polyhedron; + check_stream(input, fname, "reading polyhedron from"); + + // Create domain + Mesh_domain domain(polyhedron); + domain.detect_features(); + + // Mesh criteria (no cell_size set) + Mesh_criteria criteria(params::facet_angle(25).facet_size(0.15).facet_distance(0.05).cell_radius_edge_ratio(3)); + + // Mesh generation + const C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); + + const auto nb_vertices = c3t3.triangulation().number_of_vertices(); + const auto nb_far_vertices = c3t3.number_of_far_points(); + const auto nb_cells = c3t3.number_of_cells(); + + std::cout << "Created a c3t3 with " << c3t3.triangulation().number_of_vertices() << " vertices, and " + << c3t3.number_of_cells() << " cells" << std::endl; + + // Output + { + const std::string filename = "ascii.vtu"; + std::ofstream out(filename); + check_stream(out, filename, "opening"); + CGAL::IO::output_to_vtu(out, c3t3, CGAL::IO::ASCII); + check_stream(out, filename, "writing (ASCII)"); + } + + { + const std::string filename = "binary.vtu"; + std::ofstream out(filename, std::ios::binary); + check_stream(out, filename, "opening"); + CGAL::IO::output_to_vtu(out, c3t3, CGAL::IO::BINARY); + check_stream(out, filename, "writing (BINARY)"); + } + + const std::string filename = "mesh.binary.cgal"; + { + std::ofstream out(filename, std::ios::binary); + check_stream(out, filename, "opening"); + bool ok = CGAL::IO::save_binary_file(out, c3t3); + check_stream(out, filename, "writing (binary)", ok); + } + + // Input + C3t3 bis; + { + std::ifstream in(filename, std::ios::binary); + check_stream(in, filename, "opening (binary)"); + bool ok = CGAL::IO::load_binary_file(in, bis); + check_stream(in, filename, "reading binary file", ok); + } + + { + const std::string bis_filename = "bis.vtu"; + std::ofstream bis_os(bis_filename); + check_stream(bis_os, bis_filename, "opening (bis.vtu)"); + CGAL::IO::output_to_vtu(bis_os, bis, CGAL::IO::ASCII); + check_stream(bis_os, bis_filename, "writing (ASCII)"); + } + + assert(bis.number_of_cells() == nb_cells); + assert(bis.triangulation().number_of_vertices() == nb_vertices); + assert(bis.number_of_far_points() == nb_far_vertices); + + std::cout << "Mesh generation and output completed successfully." << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp b/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp index 5781f445050..3e62a7d11ae 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron.cpp @@ -10,6 +10,14 @@ #include +template class Non_copyable_range_view { + Range& r; +public: + Non_copyable_range_view(Range& r) : r(r) {} + auto begin() const { return r.begin(); } + auto end() const { return r.end(); } +}; + template struct Polyhedron_tester : public Tester { @@ -66,6 +74,30 @@ struct Polyhedron_tester : public Tester // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); + // test initial_points with a tuple-like object + using Weighted_point = typename K::Weighted_point_3; + using Index = typename Mesh_domain::Index; + struct Initial_point + { + Weighted_point weighted_point; + int dimension; + Index index; + }; + std::vector initial_points = { Initial_point{ Weighted_point(.5, .5, .5), 3, Index{}} }; + c3t3 = CGAL::make_mesh_3(domain, criteria, CGAL::parameters::initial_points(initial_points)); + + // test initial_points with a non-copyable range + Non_copyable_range_view initial_points_view{ initial_points }; + c3t3 = CGAL::make_mesh_3(domain, criteria, CGAL::parameters::initial_points(initial_points_view)); + + // test initial_points_generator with a non-const generator generating tuple-like object + auto initial_points_generator = [](auto oit, const int) mutable { + *oit++ = Initial_point{ Weighted_point(.5, .5, .5), 3, Index{} }; + return oit; + }; + c3t3 = CGAL::make_mesh_3(domain, criteria, + CGAL::parameters::initial_points_generator(initial_points_generator)); + CGAL::remove_far_points_in_mesh_3(c3t3); double vol = 1/6.; diff --git a/Minkowski_sum_2/doc/Minkowski_sum_2/Minkowski_sum_2.txt b/Minkowski_sum_2/doc/Minkowski_sum_2/Minkowski_sum_2.txt index 55ebd51677b..1ae50191fab 100644 --- a/Minkowski_sum_2/doc/Minkowski_sum_2/Minkowski_sum_2.txt +++ b/Minkowski_sum_2/doc/Minkowski_sum_2/Minkowski_sum_2.txt @@ -562,7 +562,7 @@ function template computes the offset of a given polygon \f$ P\f$ by a rational radius \f$ r\f$ in an exact manner. The input polygon \f$ P\f$ must be either simple or degenerate consisting of two vertices (representing a line segment). The `traits` argument must model the -concept `ArrangementTraits_2` and it should be capable of handling +concept `AosTraits_2` and it should be capable of handling conic arcs in an exact manner---using an instance of the `Arr_conic_traits_2` class template with the number types provided by the \core library is the preferred option; see \ref arr_sssectr_conic @@ -631,7 +631,7 @@ Similarly, the function template \link inset_polygon_2() `inset_polygon_2(P, r, traits, oi)` \endlink computes the exact inset of \f$ P\f$ with radius \f$ r\f$, and returns its output through the given output iterator `oi`. The `traits` parameter -must model the concept `ArrangementTraits_2` and it should be capable of +must model the concept `AosTraits_2` and it should be capable of handling conic arcs in an exact manner, whereas the value-type of `oi` must be an instance of `Gps_traits_2::Polygon_2`. diff --git a/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt b/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt index 2675890b483..6d3c41dc210 100644 --- a/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt +++ b/Minkowski_sum_2/examples/Minkowski_sum_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_2_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt b/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt index 8101b6f796f..ed1e8ab4b17 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt +++ b/Minkowski_sum_2/test/Minkowski_sum_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/cgal_test_with_cmake b/Minkowski_sum_2/test/Minkowski_sum_2/cgal_test_with_cmake deleted file mode 100755 index 1be7f4c52c1..00000000000 --- a/Minkowski_sum_2/test/Minkowski_sum_2/cgal_test_with_cmake +++ /dev/null @@ -1,125 +0,0 @@ -#! /bin/sh - -# This is a script for the CGAL test suite. Such a script must obey -# the following rules: -# -# - the name of the script is cgal_test_with_cmake -# - for every target two one line messages are written to the file 'error.txt' -# the first one indicates if the compilation was successful -# the second one indicates if the execution was successful -# if one of the two was not successful, the line should start with 'ERROR:' -# - running the script should not require any user interaction -# - the script should clean up object files and executables - - ERRORFILE=error.txt - DO_RUN=y - if [ -z "${MAKE_CMD}" ]; then - MAKE_CMD=make - fi - NEED_CLEAN= - -#---------------------------------------------------------------------# -# configure -#---------------------------------------------------------------------# - -configure() -{ - echo "Configuring... " - - if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_DIR" \ - .' ; then - - echo " successful configuration" >> $ERRORFILE - else - echo " ERROR: configuration" >> $ERRORFILE - fi -} - -#---------------------------------------------------------------------# -# compile_and_run -#---------------------------------------------------------------------# - -compile_and_run() -{ - echo "Compiling $1 ... " - SUCCESS="y" - - if eval '${MAKE_CMD} VERBOSE=ON -fMakefile $1' ; then - echo " successful compilation of $1" >> $ERRORFILE - else - echo " ERROR: compilation of $1" >> $ERRORFILE - SUCCESS="" - fi - - if [ -n "$DO_RUN" ] ; then - if [ -n "${SUCCESS}" ] ; then - OUTPUTFILE=ProgramOutput.$1.$PLATFORM - rm -f $OUTPUTFILE - COMMAND="./$1" - if [ -f $1.cmd ] ; then - COMMAND="$COMMAND `cat $1.cmd`" - fi - if [ -f $1.cin ] ; then - COMMAND="cat $1.cin | $COMMAND" - fi - echo "Executing $1 ... " - echo - ulimit -t 3600 2> /dev/null - if eval $COMMAND > $OUTPUTFILE 2>&1 ; then - echo " successful execution of $1" >> $ERRORFILE - else - echo " ERROR: execution of $1" >> $ERRORFILE - fi - else - echo " ERROR: not executed $1" >> $ERRORFILE - fi - fi -} - -#---------------------------------------------------------------------# -# remove the previous error file -#---------------------------------------------------------------------# - -rm -f $ERRORFILE -touch $ERRORFILE - -#---------------------------------------------------------------------# -# configure, compile and run the tests -#---------------------------------------------------------------------# - -configure - -if [ $# -ne 0 ] ; then - for file in $* ; do - compile_and_run $file - done -else - echo "Run all tests." -if ${MAKE_CMD} -f Makefile help | grep -E "test_approx_offset$" > /dev/null; then - compile_and_run test_approx_offset - NEED_CLEAN=y -fi -if ${MAKE_CMD} -f Makefile help | grep -E "test_exact_offset$" > /dev/null; then - compile_and_run test_exact_offset - NEED_CLEAN=y -fi -if ${MAKE_CMD} -f Makefile help | grep -E "test_minkowski_sum$" > /dev/null; then - compile_and_run test_minkowski_sum - NEED_CLEAN=y -fi -if ${MAKE_CMD} -f Makefile help | grep -E "test_minkowski_sum_with_holes$" > /dev/null; then - compile_and_run test_minkowski_sum_with_holes - NEED_CLEAN=y -fi -fi - -# -# The clean target generated by CMake under cygwin -# always fails for some reason -# -if [ -n "${NEED_CLEAN}" ]; then - if ! ( uname | grep -q "CYGWIN" ) ; then - ${MAKE_CMD} -fMakefile clean - fi -fi diff --git a/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt b/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt index 55255f3db34..5f467e1e05f 100644 --- a/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt +++ b/Minkowski_sum_3/doc/Minkowski_sum_3/PackageDescription.txt @@ -2,7 +2,6 @@ /*! \addtogroup PkgMinkowskiSum3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Minkowski Sum of Polyhedra,PkgMinkowskiSum3} \cgalPkgPicture{Minkowski_sum_3/fig/Minkowski_sum_3_teaser.png} \cgalPkgSummaryBegin diff --git a/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt b/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt index ce370521c8d..aabbb66cef6 100644 --- a/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt +++ b/Minkowski_sum_3/examples/Minkowski_sum_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_3_Examples) find_package(CGAL REQUIRED) diff --git a/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt b/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt index be42c09b870..e0ceeb5a0ae 100644 --- a/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt +++ b/Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Minkowski_sum_3_Tests) find_package(CGAL REQUIRED) diff --git a/Modifier/test/Modifier/CMakeLists.txt b/Modifier/test/Modifier/CMakeLists.txt index f3e97f25058..b108e17d957 100644 --- a/Modifier/test/Modifier/CMakeLists.txt +++ b/Modifier/test/Modifier/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Modifier_Tests) find_package(CGAL REQUIRED) diff --git a/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt b/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt index 3c6dac4fb32..e5b0921efad 100644 --- a/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt +++ b/Modular_arithmetic/examples/Modular_arithmetic/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Modular_arithmetic_Examples) find_package(CGAL REQUIRED) diff --git a/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt b/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt index 2e1de64de95..63f72c081cf 100644 --- a/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt +++ b/Modular_arithmetic/test/Modular_arithmetic/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Modular_arithmetic_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Nef_2/examples/Nef_2/CMakeLists.txt b/Nef_2/examples/Nef_2/CMakeLists.txt index 9ca8957decf..3c490beeff9 100644 --- a/Nef_2/examples/Nef_2/CMakeLists.txt +++ b/Nef_2/examples/Nef_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_2_Examples) find_package(CGAL REQUIRED) diff --git a/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h b/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h index 1eecd047efd..639b4781d6e 100644 --- a/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h +++ b/Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h @@ -627,6 +627,7 @@ public: out << "SweepStatus:\n"; typename SweepStatus::iterator sit3; for( sit3 = YS.begin(); *sit3 != &sh; ++sit3 ) { + if (*sit3==&sl) continue; int b = orientation(sit3, p_sweep); if(*sit3 == &sl) out << " 1"; else if(*sit3 == &sh) out <<"-1"; diff --git a/Nef_2/test/Nef_2/CMakeLists.txt b/Nef_2/test/Nef_2/CMakeLists.txt index ef5af7b668c..cb3cc582064 100644 --- a/Nef_2/test/Nef_2/CMakeLists.txt +++ b/Nef_2/test/Nef_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_2_Tests) find_package(CGAL REQUIRED) diff --git a/Nef_3/doc/Nef_3/PackageDescription.txt b/Nef_3/doc/Nef_3/PackageDescription.txt index de1e15c2f1c..6f591bcfb6c 100644 --- a/Nef_3/doc/Nef_3/PackageDescription.txt +++ b/Nef_3/doc/Nef_3/PackageDescription.txt @@ -11,7 +11,6 @@ /*! \addtogroup PkgNef3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Boolean Operations on Nef Polyhedra,PkgNef3} \cgalPkgPicture{Nef_3-teaser.png} \cgalPkgSummaryBegin diff --git a/Nef_3/examples/Nef_3/CMakeLists.txt b/Nef_3/examples/Nef_3/CMakeLists.txt index 6518c16a63a..fcb40d9df4b 100644 --- a/Nef_3/examples/Nef_3/CMakeLists.txt +++ b/Nef_3/examples/Nef_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_3_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h index b1eb8d6b9ee..463b5f85f60 100644 --- a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h +++ b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h @@ -402,9 +402,9 @@ class Infimaximal_box { typename SNC_structure::Vertex_const_iterator v; CGAL_forall_vertices(v, snc) { Point_3 p(v->point()); - if(p.hx()[0] > eval) eval = p.hx()[0]; - if(p.hy()[0] > eval) eval = p.hy()[0]; - if(p.hz()[0] > eval) eval = p.hz()[0]; + if(abs(p.hx()[0]) > eval) eval = abs(p.hx()[0]); + if(abs(p.hy()[0]) > eval) eval = abs(p.hy()[0]); + if(abs(p.hz()[0]) > eval) eval = abs(p.hz()[0]); } eval *= 4; if(eval == 0) return 1; diff --git a/Nef_3/include/CGAL/Nef_3/K3_tree.h b/Nef_3/include/CGAL/Nef_3/K3_tree.h index 3bec191d7c2..15392c5d5b9 100644 --- a/Nef_3/include/CGAL/Nef_3/K3_tree.h +++ b/Nef_3/include/CGAL/Nef_3/K3_tree.h @@ -517,7 +517,7 @@ Node_handle build_kdtree(Vertex_list& V, Halfedge_list& E, Halffacet_list& F, int coord = depth%3; Point_3 point_on_plane = find_median_point(V, coord); - CGAL_NEF_TRACEN("build_kdtree: plane: "<second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M4) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -482,7 +482,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector()); make_twins(e1,e2); CGAL_assertion(e1->mark()==e2->mark()); @@ -493,7 +493,7 @@ public: CGAL_forall_iterators(it,M3) { // progress++; it->second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M3) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -502,7 +502,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector()); make_twins(e1,e2); CGAL_assertion(e1->mark()==e2->mark()); @@ -513,7 +513,7 @@ public: CGAL_forall_iterators(it,M2) { // progress++; it->second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M2) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -522,7 +522,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector()); make_twins(e1,e2); CGAL_assertion(e1->mark()==e2->mark()); @@ -533,7 +533,7 @@ public: CGAL_forall_iterators(it,M) { // progress++; it->second.sort(Halfedge_key_lt()); - CGAL_NEF_TRACEN("search opposite "<first); + CGAL_NEF_TRACEN("search opposite (M) "<first); typename Halfedge_list::iterator itl; CGAL_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -542,7 +542,7 @@ public: Halfedge_handle e2 = itl->e; CGAL_NEF_TRACEN(" " << e1->source()->point() << " -> " << e2->source()->point()); - CGAL_NEF_TRACEN(e1->vector()<<" -> "<< -e2->vector()); + CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<< -e2->vector()); CGAL_assertion(e1->source()->point() != e2->source()->point()); CGAL_assertion(e1->mark()==e2->mark()); make_twins(e1,e2); @@ -585,10 +585,16 @@ public: break; } else #endif + CGAL_assertion_code(bool found = false;) CGAL_For_all(cet,cete) if ( cet->circle() == ce->circle().opposite() && cet->source()->twin() == ce->source() ) + { + CGAL_assertion_code(found = true;) break; + } + + CGAL_assertion(found); #ifdef CGAL_USE_TRACE if( cet->circle() != ce->circle().opposite() ) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index a3a26fb3041..be8345069e2 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -139,7 +139,7 @@ class SNC_intersection { if( !CGAL::assign( p, o)) return false; CGAL_NEF_TRACEN( "-> intersection point: " << p ); - CGAL_NEF_TRACEN( "-> point in facet interior? "< point in facet interior? "< intersection point: " << p ); - CGAL_NEF_TRACEN( "-> point in facet interior? "< point in facet interior? "<source()->point() << "->" << e->twin()->source()->point()); if (SNC_intersection::does_contain_internally(e->source()->point(), e->twin()->source()->point(), p)) { - _CGAL_NEF_TRACEN("found on edge "<< ss); +// _CGAL_NEF_TRACEN("found on edge "<< ss); return make_object(e); } if((e->source() != v) && (e->twin()->source() != v) && @@ -557,7 +557,7 @@ private: if(SNC_intersection::does_intersect_internally( s, *f, q) ) { q = normalized(q); call_back( e0, *f, q); - _CGAL_NEF_TRACEN("edge intersects facet on plane "<plane()<<" on "<plane()<<" on "< +#include +#include + +using Kernel = CGAL::Extended_cartesian; +using Nef = CGAL::Nef_polyhedron_3; + +int main() +{ + Nef hspace_1(Nef::Plane_3(1.0, 0.0, 0.0, 0.0), Nef::INCLUDED); + Nef hspace_2(Nef::Plane_3(1.0, 0.0, 0.0, 1.0), Nef::INCLUDED); + Nef hspace_3(Nef::Plane_3(0.0, 0.0, 1.0, 1.0), Nef::INCLUDED); + + Nef intersection_1 = hspace_1*hspace_2; + Nef intersection_2 = hspace_2*hspace_3; + + return 0; +} diff --git a/Nef_S2/examples/Nef_S2/CMakeLists.txt b/Nef_S2/examples/Nef_S2/CMakeLists.txt index 98f9d50a745..ca59ec51f5f 100644 --- a/Nef_S2/examples/Nef_S2/CMakeLists.txt +++ b/Nef_S2/examples/Nef_S2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_S2_Examples) find_package(CGAL REQUIRED) diff --git a/Nef_S2/test/Nef_S2/CMakeLists.txt b/Nef_S2/test/Nef_S2/CMakeLists.txt index f017155ef25..0d7c5961cb5 100644 --- a/Nef_S2/test/Nef_S2/CMakeLists.txt +++ b/Nef_S2/test/Nef_S2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Nef_S2_Tests) find_package(CGAL REQUIRED) diff --git a/NewKernel_d/test/NewKernel_d/CMakeLists.txt b/NewKernel_d/test/NewKernel_d/CMakeLists.txt index 9bdfee78314..aa9bf6f75f5 100644 --- a/NewKernel_d/test/NewKernel_d/CMakeLists.txt +++ b/NewKernel_d/test/NewKernel_d/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. # Then modified by hand to add Eigen3. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(NewKernel_d_Tests) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) diff --git a/Number_types/doc/Number_types/CGAL/double.h b/Number_types/doc/Number_types/CGAL/double.h index 5c48d4332c8..a0520d46957 100644 --- a/Number_types/doc/Number_types/CGAL/double.h +++ b/Number_types/doc/Number_types/CGAL/double.h @@ -4,10 +4,10 @@ This header provides all necessary functions so the fundamental type `double` is a model of the concepts `RealEmbeddable` and -`Field`. Due to rounding errors and overflow `double` is considered as +`FieldWithKthRoot`. Due to rounding errors and overflow `double` is considered as not exact. -\cgalModels{FieldWithSqrt,RealEmbeddable} +\cgalModels{FieldWithKthRoot,RealEmbeddable} */ diff --git a/Number_types/doc/Number_types/CGAL/float.h b/Number_types/doc/Number_types/CGAL/float.h index 84f782c4d82..ee5aab1d406 100644 --- a/Number_types/doc/Number_types/CGAL/float.h +++ b/Number_types/doc/Number_types/CGAL/float.h @@ -6,10 +6,10 @@ This header provides all necessary functions so the fundamental type `float` is a model of the concepts `RealEmbeddable` and -`FieldWithSqrt`. Due to rounding errors and overflow `float` is +`FieldWithKthRoot`. Due to rounding errors and overflow `float` is considered as not exact. -\cgalModels{FieldWithSqrt,RealEmbeddable} +\cgalModels{FieldWithKthRoot,RealEmbeddable} */ diff --git a/Number_types/doc/Number_types/CGAL/int.h b/Number_types/doc/Number_types/CGAL/int.h index 8f43eac76b7..6db0d8c9e5c 100644 --- a/Number_types/doc/Number_types/CGAL/int.h +++ b/Number_types/doc/Number_types/CGAL/int.h @@ -3,12 +3,10 @@ \ingroup nt_builtin This header provides all necessary functions so the fundamental types -`int`, `long int`, and `short int` become models of their respective algebraic concepts. - -- `int` is a model of `RealEmbeddable` and `EuclideanRing`, -- `long int` is a model of `RealEmbeddable` and `EuclideanRing` -- `short int` is a model of `RealEmbeddable` and `EuclideanRing` +`int`, `long int`, and `short int` are models of the concepts `RealEmbeddable` and +`EuclideanRing`. Due to overflow neither of those types is considered as exact. +\cgalModels{RealEmbeddable, EuclideanRing} */ diff --git a/Number_types/doc/Number_types/CGAL/long_double.h b/Number_types/doc/Number_types/CGAL/long_double.h index 74275b716d1..283a9458b16 100644 --- a/Number_types/doc/Number_types/CGAL/long_double.h +++ b/Number_types/doc/Number_types/CGAL/long_double.h @@ -5,8 +5,10 @@ This header provides all necessary functions so the fundamental type `long double` is a model of the concepts `RealEmbeddable` and -`FieldWithSqrt`. Due to rounding errors and overflow `long double` is +`FieldWithKthRoot`. Due to rounding errors and overflow `long double` is considered as not exact. + +\cgalModels{FieldWithKthRoot,RealEmbeddable} */ namespace CGAL { diff --git a/Number_types/doc/Number_types/CGAL/long_long.h b/Number_types/doc/Number_types/CGAL/long_long.h index 83e6e23a058..26885845e4c 100644 --- a/Number_types/doc/Number_types/CGAL/long_long.h +++ b/Number_types/doc/Number_types/CGAL/long_long.h @@ -1,8 +1,10 @@ -/// \file long_long.h -/// \ingroup nt_builtin -/// -/// This header provides all necessary functions so the fundamental -/// type `long long int` is an `RealEmbeddable` `EuclideanRing`. Due -/// to overflow `long long int` is considered as not exact. -/// -/// \cgalModels{EuclideanRing,RealEmbeddable} +/*! +\file long_long.h +\ingroup nt_builtin + +This header provides all necessary functions so the fundamental +type `long long int` is a model of the concepts `RealEmbeddable` and `EuclideanRing`. Due +to overflow `long long int` is considered as not exact. + +\cgalModels{RealEmbeddable, EuclideanRing} +*/ \ No newline at end of file diff --git a/Number_types/doc/Number_types/PackageDescription.txt b/Number_types/doc/Number_types/PackageDescription.txt index 84bfd6debbd..ba551f7c153 100644 --- a/Number_types/doc/Number_types/PackageDescription.txt +++ b/Number_types/doc/Number_types/PackageDescription.txt @@ -30,7 +30,6 @@ /*! \addtogroup PkgNumberTypesRef -\todo check generated documentation \cgalPkgDescriptionBegin{Number Types,PkgNumberTypes} \cgalPkgPicture{illustration.png} \cgalPkgSummaryBegin diff --git a/Number_types/include/CGAL/MP_Float.h b/Number_types/include/CGAL/MP_Float.h index f6811a0f116..f5790515241 100644 --- a/Number_types/include/CGAL/MP_Float.h +++ b/Number_types/include/CGAL/MP_Float.h @@ -167,7 +167,7 @@ public: low = static_cast(l & mask); //extract low bits from l high= static_cast((l - low) >> sizeof_limb); //extract high bits from l - CGAL_postcondition ( l == low + ( static_cast(high) << sizeof_limb ) ); + CGAL_postcondition ( l == low + ( high * (limb2(1) << sizeof_limb) ) ); } // Given a limb2, returns the higher limb. diff --git a/Number_types/include/CGAL/leda_bigfloat_interval.h b/Number_types/include/CGAL/leda_bigfloat_interval.h index 25b0e2d8c66..8e347812b9d 100644 --- a/Number_types/include/CGAL/leda_bigfloat_interval.h +++ b/Number_types/include/CGAL/leda_bigfloat_interval.h @@ -202,8 +202,8 @@ public: std::pair lower_I(CGAL::to_interval(x.lower())); std::pair upper_I(CGAL::to_interval(x.upper())); return std::pair< double, double >( - CGAL::min(lower_I.first , upper_I.first ), - CGAL::max(lower_I.second, upper_I.second)); + (CGAL::min)(lower_I.first , upper_I.first ), + (CGAL::max)(lower_I.second, upper_I.second)); } }; }; diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index cf016a80eb9..2866af70bbf 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -3,7 +3,7 @@ # that dependency so as to test all the number types not depending on CORE # when it is not installed -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Number_types_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt b/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt index 3037ca8cb79..dbff84b5cf6 100644 --- a/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt +++ b/Optimal_bounding_box/benchmark/Optimal_bounding_box/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_bounding_box_Benchmark) # CGAL and its components diff --git a/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt b/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt index 816d10c0403..5e9acc6a48d 100644 --- a/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt +++ b/Optimal_bounding_box/examples/Optimal_bounding_box/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_bounding_box_Examples) find_package(CGAL REQUIRED) diff --git a/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt b/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt index 760507a79dd..c2f277d1f6a 100644 --- a/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt +++ b/Optimal_bounding_box/test/Optimal_bounding_box/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_bounding_box_Tests) find_package(CGAL REQUIRED) diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt index 97595c0cf1a..4003e1cb641 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the Optimal_transportation_reconstruction_2 demo. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_transportation_reconstruction_2_Demo) # Find CGAL and CGAL Qt6 diff --git a/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt index bd9f655378c..b5deb81be03 100644 --- a/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_transportation_reconstruction_2_Examples) find_package(CGAL REQUIRED) diff --git a/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt index e29f69f4789..bef1792ee07 100644 --- a/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/test/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Optimal_transportation_reconstruction_2_Tests) find_package(CGAL REQUIRED) diff --git a/Orthtree/benchmark/Orthtree/CMakeLists.txt b/Orthtree/benchmark/Orthtree/CMakeLists.txt index db70e151365..80e8a7f627a 100644 --- a/Orthtree/benchmark/Orthtree/CMakeLists.txt +++ b/Orthtree/benchmark/Orthtree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Orthtree_benchmarks) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Orthtree/examples/Orthtree/CMakeLists.txt b/Orthtree/examples/Orthtree/CMakeLists.txt index d3f055198e0..ac8701d8606 100644 --- a/Orthtree/examples/Orthtree/CMakeLists.txt +++ b/Orthtree/examples/Orthtree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Orthtree_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Orthtree/include/CGAL/Octree.h b/Orthtree/include/CGAL/Octree.h index e59a19be46d..b5d3f600d7c 100644 --- a/Orthtree/include/CGAL/Octree.h +++ b/Orthtree/include/CGAL/Octree.h @@ -25,7 +25,7 @@ namespace CGAL { \brief Alias that specializes the `Orthtree` class to a 3D octree storing 3D points. \tparam GeomTraits a model of `Kernel` - \tparam PointRange a model of `Range` whose value type is the key type of `PointMap` + \tparam PointRange a model of `Range` whose value type is the key type of `PointMap` and whose iterator type is a model of `RandomAccessIterator` \tparam PointMap a model of `ReadablePropertyMap` whose value type is `GeomTraits::Point_3` \tparam cubic_nodes Boolean to enforce cubic nodes */ diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index aad8f8868ea..fa58081f0c3 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -125,7 +125,7 @@ public: /// @{ #ifndef DOXYGEN_RUNNING static inline constexpr bool has_data = Orthtree_impl::has_Node_data::value; - static inline constexpr bool supports_neighbor_search = true;// Orthtree_impl::has_Squared_distance_of_element::value; + static inline constexpr bool supports_neighbor_search = Orthtree_impl::has_Squared_distance_of_element::value; #else static inline constexpr bool has_data = bool_value; ///< `true` if `GeomTraits` is a model of `OrthtreeTraitsWithData` and `false` otherwise. static inline constexpr bool supports_neighbor_search = bool_value; ///< `true` if `GeomTraits` is a model of `CollectionPartitioningOrthtreeTraits` and `false` otherwise. @@ -387,7 +387,8 @@ public: \param max_depth deepest a tree is allowed to be (nodes at this depth will not be split). \param bucket_size maximum number of items a node is allowed to contain. */ - void refine(size_t max_depth = 10, size_t bucket_size = 20) { + template + auto refine(size_t max_depth = 10, size_t bucket_size = 20) -> std::enable_if_t { refine(Orthtrees::Maximum_depth_and_maximum_contained_elements(max_depth, bucket_size)); } @@ -688,10 +689,10 @@ public: \warning Nearest neighbor searches requires `GeomTraits` to be a model of `CollectionPartitioningOrthtreeTraits`. */ - template + template auto nearest_k_neighbors(const Point& query, std::size_t k, - OutputIterator output) const -> std::enable_if_t { + OutputIterator output) const -> std::enable_if_t { Sphere query_sphere(query, (std::numeric_limits::max)()); CGAL_precondition(k > 0); @@ -711,8 +712,8 @@ public: \warning Nearest neighbor searches requires `GeomTraits` to be a model of `CollectionPartitioningOrthtreeTraits`. */ - template - auto neighbors_within_radius(const Sphere& query, OutputIterator output) const -> std::enable_if_t { + template + auto neighbors_within_radius(const Sphere& query, OutputIterator output) const -> std::enable_if_t { return nearest_k_neighbors_within_radius(query, (std::numeric_limits::max)(), output); } @@ -733,12 +734,12 @@ public: \warning Nearest neighbor searches requires `GeomTraits` to be a model of `CollectionPartitioningOrthtreeTraits`. */ - template + template auto nearest_k_neighbors_within_radius( const Sphere& query, std::size_t k, OutputIterator output - ) const -> std::enable_if_t { + ) const -> std::enable_if_t { CGAL_precondition(k > 0); Sphere query_sphere = query; @@ -1305,13 +1306,13 @@ private: // functions : return output; } - template + template auto nearest_k_neighbors_recursive( Sphere& search_bounds, Node_index node, std::vector& results, std::size_t k, - FT epsilon = 0) const -> std::enable_if_t { + FT epsilon = 0) const -> std::enable_if_t { // Check whether the node has children if (is_leaf(node)) { diff --git a/Orthtree/include/CGAL/Orthtree/Split_predicates.h b/Orthtree/include/CGAL/Orthtree/Split_predicates.h index c3b0d929b62..8638387189f 100644 --- a/Orthtree/include/CGAL/Orthtree/Split_predicates.h +++ b/Orthtree/include/CGAL/Orthtree/Split_predicates.h @@ -85,7 +85,7 @@ public: \ingroup PkgOrthtreeSplitPredicates \brief A class used to choose when a node should be split depending on the depth and the number of contained elements. - This predicate makes a note split if it contains more than a + This predicate makes a node split if it contains more than a certain number of items and if its depth is lower than a certain limit. diff --git a/Orthtree/include/CGAL/Orthtree_traits_base.h b/Orthtree/include/CGAL/Orthtree_traits_base.h index 2d1ade67e92..dc31ba2dd2f 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_base.h +++ b/Orthtree/include/CGAL/Orthtree_traits_base.h @@ -89,11 +89,16 @@ struct Orthtree_traits_base { using Adjacency = int; /// @} - auto construct_point_d_object() const { - return [](auto... Args) -> Point_d { - std::initializer_list args_list{Args...}; - return Point_d{static_cast(args_list.size()), args_list.begin(), args_list.end()}; - }; + struct Construct_point_d { + template > + Point_d operator()(Args ...args) { + std::initializer_list args_list{ args... }; + return Point_d{ static_cast(args_list.size()), args_list.begin(), args_list.end() }; + } + }; + + Construct_point_d construct_point_d_object() const { + return Construct_point_d(); } }; @@ -115,7 +120,9 @@ struct Orthtree_traits_base { UP }; - auto construct_point_d_object() const { + using Construct_point_d = Point_d(*)(const FT&, const FT&); + + Construct_point_d construct_point_d_object() const { return [](const FT& x, const FT& y) -> Point_d { return {x, y}; }; @@ -153,7 +160,9 @@ struct Orthtree_traits_base { RIGHT_TOP_FRONT }; - auto construct_point_d_object() const { + using Construct_point_d = Point_d(*)(const FT&, const FT&, const FT&); + + Construct_point_d construct_point_d_object() const { return [](const FT& x, const FT& y, const FT& z) -> Point_d { return {x, y, z}; }; diff --git a/Orthtree/include/CGAL/Orthtree_traits_point.h b/Orthtree/include/CGAL/Orthtree_traits_point.h index f05416b91db..130d6f2a187 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_point.h +++ b/Orthtree/include/CGAL/Orthtree_traits_point.h @@ -96,11 +96,15 @@ public: using Node_index = typename Base::Node_index; using Node_data_element = typename std::iterator_traits::value_type; + static_assert(std::is_same_v::iterator_category, std::random_access_iterator_tag>); + Orthtree_traits_point( PointRange& points, PointMap point_map = PointMap() ) : m_points(points), m_point_map(point_map) {} + using Construct_root_node_bbox = typename Self::Bbox_d(*)(); + auto construct_root_node_bbox_object() const { return [&]() -> typename Self::Bbox_d { @@ -152,41 +156,65 @@ public: }; } - auto construct_root_node_contents_object() const { - return [&]() -> typename Self::Node_data { - return {m_points.begin(), m_points.end()}; - }; + struct Construct_root_node_contents { + PointRange& m_points; + Construct_root_node_contents(PointRange& points) : m_points(points) {} + typename Self::Node_data operator()() { + return { m_points.begin(), m_points.end() }; + } + }; + + Construct_root_node_contents construct_root_node_contents_object() const { + return Construct_root_node_contents(m_points); } - auto distribute_node_contents_object() const { - return [&](Node_index n, Tree& tree, const typename Self::Point_d& center) { + struct Distribute_node_contents { + const PointMap m_point_map; + Distribute_node_contents(const PointMap& point_map) : m_point_map(point_map) {} + void operator()(Node_index n, Tree& tree, const typename Self::Point_d& center) { CGAL_precondition(!tree.is_leaf(n)); reassign_points(tree, m_point_map, n, center, tree.data(n)); }; + }; + + Distribute_node_contents distribute_node_contents_object() const { + return Distribute_node_contents(m_point_map); } - auto construct_sphere_d_object() const { + using Construct_sphere_d = typename Self::Sphere_d(*)(const typename Self::Point_d&, const typename Self::FT&); + + Construct_sphere_d construct_sphere_d_object() const { return [](const typename Self::Point_d& center, const typename Self::FT& squared_radius) -> typename Self::Sphere_d { return typename Self::Sphere_d(center, squared_radius); }; } - auto construct_center_d_object() const { + using Construct_center_d = typename Self::Point_d(*)(const typename Self::Sphere_d&); + + Construct_center_d construct_center_d_object() const { return [](const typename Self::Sphere_d& sphere) -> typename Self::Point_d { return sphere.center(); }; } - auto compute_squared_radius_d_object() const { + using Compute_squared_radius_d = typename Self::FT(*)(const typename Self::Sphere_d&); + + Compute_squared_radius_d compute_squared_radius_d_object() const { return [](const typename Self::Sphere_d& sphere) -> typename Self::FT { return sphere.squared_radius(); }; } - auto squared_distance_of_element_object() const { - return [&](const Node_data_element& index, const typename Self::Point_d& point) -> typename Self::FT { + struct Squared_distance_of_element { + const PointMap m_point_map; + Squared_distance_of_element(const PointMap& point_map) : m_point_map(point_map) {} + typename Self::FT operator()(const Node_data_element& index, const typename Self::Point_d& point) { return CGAL::squared_distance(get(m_point_map, index), point); - }; + }; + }; + + Squared_distance_of_element squared_distance_of_element_object() const { + return Squared_distance_of_element(m_point_map); } PointRange& m_points; diff --git a/Orthtree/test/Orthtree/CMakeLists.txt b/Orthtree/test/Orthtree/CMakeLists.txt index 95fe59cc1f3..dc748180184 100644 --- a/Orthtree/test/Orthtree/CMakeLists.txt +++ b/Orthtree/test/Orthtree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Orthtree_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Partition_2/doc/Partition_2/PackageDescription.txt b/Partition_2/doc/Partition_2/PackageDescription.txt index ec875293336..2d33fd123ce 100644 --- a/Partition_2/doc/Partition_2/PackageDescription.txt +++ b/Partition_2/doc/Partition_2/PackageDescription.txt @@ -7,7 +7,6 @@ /// \ingroup PkgPartition2Ref /*! \addtogroup PkgPartition2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Polygon Partitioning,PkgPartition2} \cgalPkgPicture{Partition_2/fig/Partition_2-teaser-small.png} \cgalPkgSummaryBegin diff --git a/Partition_2/examples/Partition_2/CMakeLists.txt b/Partition_2/examples/Partition_2/CMakeLists.txt index 24b09d7c89e..d49f9f442ac 100644 --- a/Partition_2/examples/Partition_2/CMakeLists.txt +++ b/Partition_2/examples/Partition_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Partition_2_Examples) find_package(CGAL REQUIRED) diff --git a/Partition_2/test/Partition_2/CMakeLists.txt b/Partition_2/test/Partition_2/CMakeLists.txt index a2ad0dec5b1..800296c631c 100644 --- a/Partition_2/test/Partition_2/CMakeLists.txt +++ b/Partition_2/test/Partition_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Partition_2_Tests) find_package(CGAL REQUIRED) diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h index 05f9da516bc..1124eeab784 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/Periodic_2_triangulation_2.h @@ -579,7 +579,7 @@ public: /*! Converts the `Periodic_point` `pp` (point-offset pair) to the - corresponding `Point` in \f$ \mathbb R^3\f$. + corresponding `Point` in \f$ \mathbb R^2\f$. */ Point point(const Periodic_point & pp ) const; @@ -593,6 +593,18 @@ public: */ Triangle triangle(const Periodic_triangle & t) const; + /*! + Equivalent to + the call `t.point(t.periodic_point(fh,i));` + */ + Point point(Face_handle fh, int i) const; + + /*! + Equivalent to + the call `t.point(t.periodic_point(v));` + */ + Point point(Vertex_handle v) const; + /*! Equivalent to the call `t.segment(t.periodic_segment(f,i));` diff --git a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt index 671221a301b..85d443b4c6f 100644 --- a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt +++ b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_2_triangulation_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt index 3857996a534..97515a1033e 100644 --- a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt +++ b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_2_triangulation_2_Tests) find_package(CGAL REQUIRED) diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt index 1141a255ca4..f235193705c 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_mesh_3_Examples) # CGAL and its components diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h index 33420371bfc..fd1e0b9e104 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h @@ -52,8 +52,7 @@ #ifndef CGAL_NO_ASSERTIONS # include // for float_prior #endif -#include -#include + #include #include @@ -62,10 +61,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -393,7 +394,7 @@ private: const Curve_index& curve_index, const CGAL::Orientation orientation) const { Bare_point pa, pb; - boost::tie(pa, pb) = get_positions(va, vb, curve_index, orientation); + std::tie(pa, pb) = get_positions(va, vb, curve_index, orientation); return compute_distance(pa, pb); } @@ -511,11 +512,11 @@ private: const Vertex_handle v2, const Curve_index& curve_index) const; - boost::tuple get_positions(const Vertex_handle v1, - const Vertex_handle v2, - const Vertex_handle v3, - const Curve_index& curve_index, - const CGAL::Orientation orientation) const; + std::tuple get_positions(const Vertex_handle v1, + const Vertex_handle v2, + const Vertex_handle v3, + const Curve_index& curve_index, + const CGAL::Orientation orientation) const; private: C3T3& c3t3_; @@ -953,9 +954,9 @@ get_positions_with_unknown_orientation(const Vertex_handle v1, template -boost::tuple::Bare_point, - typename Protect_edges_sizing_field::Bare_point, - typename Protect_edges_sizing_field::Bare_point> +std::tuple::Bare_point, + typename Protect_edges_sizing_field::Bare_point, + typename Protect_edges_sizing_field::Bare_point> Protect_edges_sizing_field:: get_positions(const Vertex_handle v1, const Vertex_handle v2, @@ -965,11 +966,11 @@ get_positions(const Vertex_handle v1, { Bare_point p1, p2_check, p2, p3; - boost::tie(p1, p2) = get_positions(v1, v2, curve_index, orientation); - boost::tie(p2_check, p3) = get_positions(v2, v3, curve_index, orientation); + std::tie(p1, p2) = get_positions(v1, v2, curve_index, orientation); + std::tie(p2_check, p3) = get_positions(v2, v3, curve_index, orientation); CGAL_assertion(p2_check == p2); - return boost::make_tuple(p1, p2, p3); + return std::make_tuple(p1, p2, p3); } @@ -1674,7 +1675,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, Vertex_handle nearest_vh; FT sq_d; - boost::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); + std::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); CGAL_assertion(nearest_vh != Vertex_handle()); CGAL_assertion(tr.point(nearest_vh) != cwp(tr.canonicalize_point(p))); @@ -1710,7 +1711,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, // Iterate ch = tr.locate(wp0, lt, li, lj, nearest_vh); - boost::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); + std::tie(nearest_vh, sq_d) = tr.nearest_power_vertex_with_sq_distance(p, ch); CGAL_assertion(nearest_vh != Vertex_handle()); } @@ -2000,7 +2001,7 @@ insert_balls(const Vertex_handle& vp, { // Get size of p & q Bare_point vpp, vqp; - boost::tie(vpp, vqp) = get_positions(vp, vq, curve_index, orientation); + std::tie(vpp, vqp) = get_positions(vp, vq, curve_index, orientation); const FT sp = get_radius(vp); const FT sq = get_radius(vq); @@ -2049,7 +2050,7 @@ insert_balls(const Vertex_handle& vp, CGAL_precondition(sp <= sq); Bare_point vpp, vqp; - boost::tie(vpp, vqp) = get_positions(vp, vq, curve_index, d_sign); + std::tie(vpp, vqp) = get_positions(vp, vq, curve_index, d_sign); #if ! defined(CGAL_NO_PRECONDITIONS) if(sp <= 0) @@ -2749,7 +2750,7 @@ is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, curve_index == domain_.curve_index(v2->index())); Bare_point v1p, v2p; - boost::tie(v1p, v2p) = get_positions(v1, v2, curve_index, orientation); + std::tie(v1p, v2p) = get_positions(v1, v2, curve_index, orientation); FT arc_length = domain_.curve_segment_length(v1p, v2p, @@ -2816,7 +2817,7 @@ orientation_of_walk(const Vertex_handle& start, #endif Bare_point start_p, next_p; - boost::tie(start_p, next_p) = get_positions_with_unknown_orientation(start, next, curve_index); + std::tie(start_p, next_p) = get_positions_with_unknown_orientation(start, next, curve_index); #if CGAL_MESH_3_PROTECTION_DEBUG & 4 std::cerr << "positions to determine orientation: " << start_p << " " << next_p << std::endl; #endif @@ -3091,7 +3092,7 @@ is_sizing_field_correct(const Vertex_handle& v1, FT s3 = get_radius(v3); Bare_point p1, p2, p3; - boost::tie(p1, p2, p3) = get_positions(v1, v2, v3, curve_index, orientation); + std::tie(p1, p2, p3) = get_positions(v1, v2, v3, curve_index, orientation); FT D = domain_.curve_segment_length(p1, p3, curve_index, orientation); FT d = domain_.curve_segment_length(p1, p2, curve_index, orientation); diff --git a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt index aae24ad082f..9f3c5f07053 100644 --- a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_mesh_3_Tests) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt index c4c128de19b..6b90b0e0f25 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_triangulation_3_Demo) # Find CGAL diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt index d67cc64b6b1..d29a1ece79f 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_Lloyd_3_Demo) # Find includes in corresponding build directories diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index 254a7a26b11..8a4de97b43a 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -551,6 +551,24 @@ size_type number_of_stored_facets() const; /// `Periodic_triangle`, and `Periodic_tetrahedron`, which have inner type `Point`. /// @{ +/*! +Converts the `Periodic_point` `pp` (point-offset pair) to the +corresponding `Point` in \f$ \mathbb R^3\f$. +*/ +Point point(const Periodic_point& pp) const; + +/*! +Equivalent to +the call `t.point(t.periodic_point(v));` +*/ +Point point(Vertex_handle v) const; + +/*! +Equivalent to +the call `t.point(t.periodic_point(c,idx));` +*/ +Point point(Cell_handle c, int idx) const; + /*! Returns the periodic point given by vertex `v`. If `t` is represented in the 1-sheeted covering space, the offset is always diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt index f3e7a18fe8c..fb35b20f971 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_triangulation_3_Examples) find_package(CGAL REQUIRED) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 5848af0a527..516c3e7434d 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -4414,7 +4414,7 @@ test_next(const Periodic_3_triangulation_3& t1, queue.push_back(std::make_pair(c1,c2)); while(! queue.empty()) { - boost::tie(c1,c2) = queue.back(); + std::tie(c1,c2) = queue.back(); queue.pop_back(); // Precondition: c1, c2 have been registered as well as their 4 vertices. diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt index 815a9b879ee..05b76f88ab1 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_3_triangulation_3_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index 17ac086a9bb..ee71ca43dd8 100644 --- a/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/benchmark/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Benchmarks) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index fc1fe3c37f5..c1caa76995d 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Demo) # Find includes in corresponding build directories diff --git a/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index 333f5b8bb70..fdd4bb5dba1 100644 --- a/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/examples/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt b/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt index e96c2cde310..da0ae01213d 100644 --- a/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt +++ b/Periodic_4_hyperbolic_triangulation_2/test/Periodic_4_hyperbolic_triangulation_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Periodic_4_hyperbolic_triangulation_2_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Point_set_2/doc/Point_set_2/PackageDescription.txt b/Point_set_2/doc/Point_set_2/PackageDescription.txt index a191f6ff181..bf3a90fd689 100644 --- a/Point_set_2/doc/Point_set_2/PackageDescription.txt +++ b/Point_set_2/doc/Point_set_2/PackageDescription.txt @@ -10,7 +10,6 @@ /*! \addtogroup PkgPointSet2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Range and Neighbor Search,PkgPointSet2} \cgalPkgPicture{Point_set_2/fig/point_set.png} \cgalPkgSummaryBegin diff --git a/Point_set_2/examples/Point_set_2/CMakeLists.txt b/Point_set_2/examples/Point_set_2/CMakeLists.txt index 1647542ae82..976cbdd6252 100644 --- a/Point_set_2/examples/Point_set_2/CMakeLists.txt +++ b/Point_set_2/examples/Point_set_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_2_Examples) find_package(CGAL REQUIRED) diff --git a/Point_set_2/test/Point_set_2/CMakeLists.txt b/Point_set_2/test/Point_set_2/CMakeLists.txt index 7c16ce3b6e6..77cf12967f8 100644 --- a/Point_set_2/test/Point_set_2/CMakeLists.txt +++ b/Point_set_2/test/Point_set_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_2_Tests) find_package(CGAL REQUIRED) diff --git a/Point_set_3/examples/Point_set_3/CMakeLists.txt b/Point_set_3/examples/Point_set_3/CMakeLists.txt index a8246bf0f58..1019bcd4ef1 100644 --- a/Point_set_3/examples/Point_set_3/CMakeLists.txt +++ b/Point_set_3/examples/Point_set_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_3_Examples) # CGAL and its components diff --git a/Point_set_3/examples/Point_set_3/point_set_property.cpp b/Point_set_3/examples/Point_set_3/point_set_property.cpp index 98a32e10fce..b34f01737d0 100644 --- a/Point_set_3/examples/Point_set_3/point_set_property.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_property.cpp @@ -40,11 +40,11 @@ int main (int, char**) bool success = false; Color_map color; - boost::tie (color, success) = point_set.add_property_map ("color", black); + std::tie (color, success) = point_set.add_property_map ("color", black); assert (success); FT_map intensity; - boost::tie (intensity, success) = point_set.add_property_map ("intensity", 0.); + std::tie (intensity, success) = point_set.add_property_map ("intensity", 0.); assert (success); point_set.reserve (10); // For memory optimization diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h b/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h index 6fcffaee3d0..aa2de169bf2 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h @@ -219,86 +219,86 @@ bool write_LAS(std::ostream& os, Ushort_map intensity; bool remove_intensity; - boost::tie(intensity, remove_intensity) + std::tie(intensity, remove_intensity) = point_set.template add_property_map("intensity", 0); Uchar_map return_number; bool remove_return_number; - boost::tie(return_number, remove_return_number) + std::tie(return_number, remove_return_number) = point_set.template add_property_map("return_number", 0); Uchar_map number_of_returns; bool remove_number_of_returns; - boost::tie(number_of_returns, remove_number_of_returns) + std::tie(number_of_returns, remove_number_of_returns) = point_set.template add_property_map("number_of_returns", 0); Uchar_map scan_direction_flag; bool remove_scan_direction_flag; - boost::tie(scan_direction_flag, remove_scan_direction_flag) + std::tie(scan_direction_flag, remove_scan_direction_flag) = point_set.template add_property_map("scan_direction_flag", 0); Uchar_map edge_of_flight_line; bool remove_edge_of_flight_line; - boost::tie(edge_of_flight_line, remove_edge_of_flight_line) + std::tie(edge_of_flight_line, remove_edge_of_flight_line) = point_set.template add_property_map("edge_of_flight_line", 0); Uchar_map classification; bool remove_classification; - boost::tie(classification, remove_classification) + std::tie(classification, remove_classification) = point_set.template add_property_map("classification", 0); Uchar_map synthetic_flag; bool remove_synthetic_flag; - boost::tie(synthetic_flag, remove_synthetic_flag) + std::tie(synthetic_flag, remove_synthetic_flag) = point_set.template add_property_map("synthetic_flag", 0); Uchar_map keypoint_flag; bool remove_keypoint_flag; - boost::tie(keypoint_flag, remove_keypoint_flag) + std::tie(keypoint_flag, remove_keypoint_flag) = point_set.template add_property_map("keypoint_flag", 0); Uchar_map withheld_flag; bool remove_withheld_flag; - boost::tie(withheld_flag, remove_withheld_flag) + std::tie(withheld_flag, remove_withheld_flag) = point_set.template add_property_map("withheld_flag", 0); Float_map scan_angle; bool remove_scan_angle; - boost::tie(scan_angle, remove_scan_angle) + std::tie(scan_angle, remove_scan_angle) = point_set.template add_property_map("scan_angle", 0.); Uchar_map user_data; bool remove_user_data; - boost::tie(user_data, remove_user_data) + std::tie(user_data, remove_user_data) = point_set.template add_property_map("user_data", 0); Ushort_map point_source_ID; bool remove_point_source_ID; - boost::tie(point_source_ID, remove_point_source_ID) + std::tie(point_source_ID, remove_point_source_ID) = point_set.template add_property_map("point_source_ID", 0); Uint_map deleted_flag; bool remove_deleted_flag; - boost::tie(deleted_flag, remove_deleted_flag) + std::tie(deleted_flag, remove_deleted_flag) = point_set.template add_property_map("deleted_flag", 0); Double_map gps_time; bool remove_gps_time; - boost::tie(gps_time, remove_gps_time) + std::tie(gps_time, remove_gps_time) = point_set.template add_property_map("gps_time", 0); Ushort_map R; bool remove_R; - boost::tie(R, remove_R) = point_set.template add_property_map("R", 0); + std::tie(R, remove_R) = point_set.template add_property_map("R", 0); Ushort_map G; bool remove_G; - boost::tie(G, remove_G) = point_set.template add_property_map("G", 0); + std::tie(G, remove_G) = point_set.template add_property_map("G", 0); Ushort_map B; bool remove_B; - boost::tie(B, remove_B) = point_set.template add_property_map("B", 0); + std::tie(B, remove_B) = point_set.template add_property_map("B", 0); Ushort_map I; bool remove_I; - boost::tie(I, remove_I) = point_set.template add_property_map("I", 0); + std::tie(I, remove_I) = point_set.template add_property_map("I", 0); if(remove_R) { diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h index f4658b4926b..5cad538b3ea 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h @@ -57,7 +57,7 @@ private: PLY_property_to_point_set_property(Point_set& ps, const std::string& name) : m_name(name) { - boost::tie(m_map, boost::tuples::ignore) = ps.add_property_map(name, Type()); + m_map = ps.add_property_map(name, Type()).first; m_pmap = ps.push_property_map(m_map); } diff --git a/Point_set_3/test/Point_set_3/CMakeLists.txt b/Point_set_3/test/Point_set_3/CMakeLists.txt index b2c092e2aad..9e71a02f4d6 100644 --- a/Point_set_3/test/Point_set_3/CMakeLists.txt +++ b/Point_set_3/test/Point_set_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_3_Tests) # CGAL and its components diff --git a/Point_set_3/test/Point_set_3/point_set_test.cpp b/Point_set_3/test/Point_set_3/point_set_test.cpp index 086feabface..72563b63c54 100644 --- a/Point_set_3/test/Point_set_3/point_set_test.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test.cpp @@ -103,7 +103,7 @@ int main (int, char**) test (!(point_set.has_property_map ("color")), "point set shouldn't have colors."); Point_set::Property_map color_prop; bool garbage; - boost::tie (color_prop, garbage) = point_set.add_property_map ("color", Color()); + std::tie (color_prop, garbage) = point_set.add_property_map ("color", Color()); test (point_set.has_property_map ("color"), "point set should have colors."); for (Point_set::iterator it = point_set.begin(); it != point_set.end(); ++ it) diff --git a/Point_set_3/test/Point_set_3/point_set_test_join.cpp b/Point_set_3/test/Point_set_3/point_set_test_join.cpp index 986f1748cf1..bcd39c531bb 100644 --- a/Point_set_3/test/Point_set_3/point_set_test_join.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test_join.cpp @@ -72,7 +72,7 @@ int main (int, char**) Point_set::Property_map intensity; bool okay; - boost::tie (intensity, okay) = ps3.add_property_map("intensity", 0); + std::tie (intensity, okay) = ps3.add_property_map("intensity", 0); assert (okay); Point_set::iterator it = ps3.insert (Point (double(0), double(1), double(2)), diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 01a9ff49e64..8b5670a14d2 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_processing_3_Examples) # Find CGAL diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index f9ce5352b26..5c5cd75063c 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -388,7 +388,7 @@ create_riemannian_graph( // Add edge typename boost::graph_traits::edge_descriptor e; bool inserted; - boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), + std::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), vertex(neighbor_index, riemannian_graph), riemannian_graph); CGAL_assertion(inserted); @@ -410,7 +410,7 @@ create_riemannian_graph( { typename boost::graph_traits::edge_descriptor e; bool inserted; - boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), + std::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), vertex(source_point_index, riemannian_graph), riemannian_graph); CGAL_assertion(inserted); diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index b4389a10e2a..057375261ad 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Point_set_processing_3_Tests) # Find CGAL diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt index 3e6aeed0e53..3832688cbd9 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Poisson_surface_reconstruction_3_Examples) # Find CGAL diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h index abe83515408..488e15b0b3a 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h @@ -598,24 +598,24 @@ public: } #endif - boost::tuple special_func(const Point& p) const + std::tuple special_func(const Point& p) const { Cell_handle& hint = get_hint(); hint = m_tr->locate(p, hint); if(m_tr->is_infinite(hint)) { int i = hint->index(m_tr->infinite_vertex()); - return boost::make_tuple(hint->vertex((i+1)&3)->f(), - hint, true); + return std::make_tuple(hint->vertex((i+1)&3)->f(), + hint, true); } FT a,b,c,d; barycentric_coordinates(p,hint,a,b,c,d); - return boost::make_tuple(a * hint->vertex(0)->f() + - b * hint->vertex(1)->f() + - c * hint->vertex(2)->f() + - d * hint->vertex(3)->f(), - hint, false); + return std::make_tuple(a * hint->vertex(0)->f() + + b * hint->vertex(1)->f() + + c * hint->vertex(2)->f() + + d * hint->vertex(3)->f(), + hint, false); } /// \endcond diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h index fb0655be01c..36e56fe4d89 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_surface_reconstruction_3/internal/Poisson_sphere_oracle_3.h @@ -24,7 +24,7 @@ #include #include -#include +#include namespace CGAL { @@ -102,7 +102,7 @@ namespace CGAL { { const Self& oracle; - boost::tuple + std::tuple intersection_line_sphere_lambda(const Surface_3& sphere, const Point& a, const Point& b) const @@ -154,18 +154,18 @@ namespace CGAL { switch( CGAL::sign(deltaprime) ) { case ZERO: - return boost::make_tuple(1, ab_ac / ab2, 0); + return std::make_tuple(1, ab_ac / ab2, 0); case POSITIVE: { const FT sqrt_deltaprime = CGAL::sqrt(deltaprime); - return boost::make_tuple(2, - (ab_ac - sqrt_deltaprime) / ab2, - (ab_ac + sqrt_deltaprime) / ab2); + return std::make_tuple(2, + (ab_ac - sqrt_deltaprime) / ab2, + (ab_ac + sqrt_deltaprime) / ab2); } case NEGATIVE: break; } - return boost::make_tuple(0, 0, 0); + return std::make_tuple(0, 0, 0); } //end intersection_line_sphere_lambda template @@ -185,7 +185,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); const Vector ab = vector(a, b); @@ -291,7 +291,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); #ifdef CGAL_SURFACE_MESHER_DEBUG_IMPLICIT_ORACLE @@ -353,7 +353,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 && root_2 > FT(0) ) @@ -392,7 +392,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 ) diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h index 7ebcbbe814e..0be13053ada 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h @@ -286,8 +286,8 @@ namespace CGAL { Cell_handle c1, c2; bool c1_is_inf, c2_is_inf; - boost::tie(value_at_p1, c1, c1_is_inf) = surface.function().special_func(p1); - boost::tie(value_at_p2, c2, c2_is_inf) = surface.function().special_func(p2); + std::tie(value_at_p1, c1, c1_is_inf) = surface.function().special_func(p1); + std::tie(value_at_p2, c2, c2_is_inf) = surface.function().special_func(p2); // If both extremities are in the same volume component, returns // no intersection. @@ -320,7 +320,7 @@ namespace CGAL { Cell_handle c_at_mid; FT value_at_mid; bool c_is_inf; - boost::tie(value_at_mid, c_at_mid, c_is_inf) = surface.function().special_func(mid); + std::tie(value_at_mid, c_at_mid, c_is_inf) = surface.function().special_func(mid); if ( squared_distance(p1, p2) < squared_distance_bound ) // If the two points are close, then we must decide diff --git a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt index 6fdba5526cb..3592fc3e950 100644 --- a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Poisson_surface_reconstruction_3_Tests) # Find CGAL diff --git a/Polygon/examples/Polygon/CMakeLists.txt b/Polygon/examples/Polygon/CMakeLists.txt index 55e73061294..f41d86812bd 100644 --- a/Polygon/examples/Polygon/CMakeLists.txt +++ b/Polygon/examples/Polygon/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polygon/include/CGAL/Multipolygon_with_holes_2.h b/Polygon/include/CGAL/Multipolygon_with_holes_2.h index bdfd3cb47bc..9228850edf5 100644 --- a/Polygon/include/CGAL/Multipolygon_with_holes_2.h +++ b/Polygon/include/CGAL/Multipolygon_with_holes_2.h @@ -24,14 +24,14 @@ namespace CGAL { /*! \ingroup PkgPolygon2Ref * * The class `Multipolygon_with_holes_2` models the concept `MultipolygonWithHoles_2`. - * It is parameterized with two types (`Kernel` and `Container`) that are used to instantiate - * the types `Polygon_2` and `Polygon_with_holes_2`. + * It is parameterized with two types (`Kernel` and `Container_`) that are used to instantiate + * the types `Polygon_2` and `Polygon_with_holes_2`. * The latter is used to represent each polygon with holes. The former is converted to the latter. * * \cgalModels{MultipolygonWithHoles_2} */ template > + class Container_ = std::vector> class Multipolygon_with_holes_2 { public: /// \name Definition @@ -39,14 +39,15 @@ public: /// @{ /// polygon type - using Polygon_2 = CGAL::Polygon_2; + using Polygon_2 = CGAL::Polygon_2; /// polygon with holes type - using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; /// @} using Traits = Kernel; + using Container = Container_; using value_type = Polygon_with_holes_2; using Polygon_with_holes_container = std::deque; @@ -183,10 +184,10 @@ order. \relates Multipolygon_with_holes_2 */ -template +template std::ostream& operator<<(std::ostream& os, - const Multipolygon_with_holes_2& mp) { - typename Multipolygon_with_holes_2::Polygon_with_holes_const_iterator i; + const Multipolygon_with_holes_2& mp) { + typename Multipolygon_with_holes_2::Polygon_with_holes_const_iterator i; switch(IO::get_mode(os)) { case IO::ASCII : @@ -214,11 +215,11 @@ std::ostream& operator<<(std::ostream& os, } } -template -Multipolygon_with_holes_2 transform(const Transformation& t, - const Multipolygon_with_holes_2& mp) +template +Multipolygon_with_holes_2 transform(const Transformation& t, + const Multipolygon_with_holes_2& mp) { - Multipolygon_with_holes_2 result; + Multipolygon_with_holes_2 result; for(const auto& pwh : mp.polygons_with_holes()){ result.add_polygon_with_holes(transform(t, pwh)); } diff --git a/Polygon/include/CGAL/Polygon_2.h b/Polygon/include/CGAL/Polygon_2.h index c3300d939fa..cfe9b4f3472 100644 --- a/Polygon/include/CGAL/Polygon_2.h +++ b/Polygon/include/CGAL/Polygon_2.h @@ -60,8 +60,8 @@ namespace CGAL { /// algorithms were used and what complexity they have. /// -template > +template > class Polygon_2 { public: @@ -70,33 +70,33 @@ class Polygon_2 { /// @{ /// The traits type. - typedef Traits_P Traits; + typedef Traits_ Traits; /// The container type. - typedef Container_P Container; + typedef Container_ Container; /// The number type of the coordinates of the points of the polygon. - typedef typename Traits_P::FT FT; + typedef typename Traits_::FT FT; /// The point type of the polygon. - typedef typename Traits_P::Point_2 Point_2; + typedef typename Traits_::Point_2 Point_2; /// The type of a segment between two points of the polygon. - typedef typename Traits_P::Segment_2 Segment_2; + typedef typename Traits_::Segment_2 Segment_2; /// @} - typedef typename Container_P::difference_type difference_type; - typedef typename Container_P::value_type value_type; - typedef typename Container_P::pointer pointer; - typedef typename Container_P::reference reference; - typedef typename Container_P::const_reference const_reference; + typedef typename Container_::difference_type difference_type; + typedef typename Container_::value_type value_type; + typedef typename Container_::pointer pointer; + typedef typename Container_::reference reference; + typedef typename Container_::const_reference const_reference; //-------------------------------------------------------// // this intermediary step is required by Sun C++ 4.1 - typedef typename Container_P::iterator iterator; - typedef typename Container_P::const_iterator const_iterator; + typedef typename Container_::iterator iterator; + typedef typename Container_::const_iterator const_iterator; //-------------------------------------------------------// typedef typename Container::iterator Vertex_const_iterator; - typedef Polygon_circulator Vertex_const_circulator; + typedef Polygon_circulator Vertex_const_circulator; /// \name Iterators /// @@ -141,11 +141,11 @@ class Polygon_2 { // #else typedef Vertex_const_circulator Vertex_circulator; - typedef Polygon_2_edge_iterator Edge_const_iterator; - typedef Polygon_2_const_edge_circulator Edge_const_circulator; + typedef Polygon_2_edge_iterator Edge_const_iterator; + typedef Polygon_2_const_edge_circulator Edge_const_circulator; - typedef Polygon_2_edge_iterator Vertex_pair_iterator; typedef Iterator_range Edges; @@ -162,7 +162,7 @@ class Polygon_2 { Polygon_2(const Traits & p_traits) : traits(p_traits) {} // Move constructor - // Polygon_2(Polygon_2&& polygon) = default; + // Polygon_2(Polygon_2&& polygon) = default; /// Creates a polygon with vertices from the sequence /// defined by the range \c [first,last). @@ -260,7 +260,7 @@ class Polygon_2 { { if (size() <= 1) return; - typename Container_P::iterator i = d_container.begin(); + typename Container_::iterator i = d_container.begin(); std::reverse(++i, d_container.end()); } @@ -500,32 +500,32 @@ class Polygon_2 { { return d_container.empty(); } /// Returns a const reference to the sequence of vertices of the polygon. - const Container_P& container() const + const Container_& container() const { return d_container; } /// Returns a reference to the sequence of vertices of the polygon. - Container_P& container() + Container_& container() { return d_container; } /// Returns an iterator to the first vertex of the polygon. - typename Container_P::iterator begin() + typename Container_::iterator begin() { return container().begin(); } /// Returns an iterator to the element after the last vertex of the polygon. - typename Container_P::iterator end() + typename Container_::iterator end() { return container().end(); } /// Returns a const iterator to the first vertex of the polygon. - const typename Container_P::const_iterator begin() const + const typename Container_::const_iterator begin() const { return container().begin(); } /// Returns a const iterator to the element after the last vertex of the polygon. - const typename Container_P::const_iterator end() const + const typename Container_::const_iterator end() const { return container().end(); } @@ -544,14 +544,14 @@ class Polygon_2 { /// @} - bool identical(const Polygon_2 &q) const + bool identical(const Polygon_2 &q) const { return this == &q; } - Traits_P const &traits_member() const { return traits;} + Traits_ const &traits_member() const { return traits;} private: - Container_P d_container; - Traits_P traits; + Container_ d_container; + Traits_ traits; }; @@ -563,23 +563,23 @@ class Polygon_2 { /// equal to the vertices of `p1`. Note that the template argument /// `%Container` of `p1` and `p2` may be different. /// \memberof Polygon_2 -template -bool operator==( const Polygon_2 &p1, - const Polygon_2 &p2 ); +template +bool operator==( const Polygon_2 &p1, + const Polygon_2 &p2 ); /// Test for inequality. /// \memberof Polygon_2 -template +template inline bool -operator!=(const Polygon_2 &p1, - const Polygon_2 &p2); +operator!=(const Polygon_2 &p1, + const Polygon_2 &p2); /// Returns the image of the polygon \c p under the transformation \c t. /// \relates Polygon_2 -template -Polygon_2 -transform(const Transformation& t, const Polygon_2& p); +template +Polygon_2 +transform(const Transformation& t, const Polygon_2& p); /// @} // global operators @@ -591,14 +591,14 @@ transform(const Transformation& t, const Polygon_2& p); /// Reads a polygon from stream `is` and assigns it to `p`. /// \pre The extract operator must be defined for `Point_2`. /// \relates Polygon_2 -template -std::istream &operator>>(std::istream &is, Polygon_2& p); +template +std::istream &operator>>(std::istream &is, Polygon_2& p); /// Inserts the polygon `p` into the stream `os`. /// \pre The insert operator must be defined for `Point_2`. /// \relates Polygon_2 -template -std::ostream &operator<<(std::ostream &os, const Polygon_2& p); +template +std::ostream &operator<<(std::ostream &os, const Polygon_2& p); /// @} // IO @@ -612,11 +612,11 @@ std::ostream &operator<<(std::ostream &os, const Polygon_2 namespace CGAL { -template +template inline bool -operator!=(const Polygon_2 &x, - const Polygon_2 &y) +operator!=(const Polygon_2 &x, + const Polygon_2 &y) { return !(x==y); } diff --git a/Polygon/include/CGAL/Polygon_with_holes_2.h b/Polygon/include/CGAL/Polygon_with_holes_2.h index 032b2c52084..7d581a28150 100644 --- a/Polygon/include/CGAL/Polygon_with_holes_2.h +++ b/Polygon/include/CGAL/Polygon_with_holes_2.h @@ -29,21 +29,22 @@ namespace CGAL { The class `Polygon_with_holes_2` models the concept `GeneralPolygonWithHoles_2`. It represents a linear polygon with holes. It is parameterized with two -types (`Kernel` and `Container`) that are used to instantiate -the type `Polygon_2`. This poygon type is used to +types (`Kernel` and `Container_`) that are used to instantiate +the type `Polygon_2`. This polygon type is used to represent the outer boundary and the boundary of the holes (if any exist). \cgalModels{GeneralPolygonWithHoles_2} */ template > + class Container_ = std::vector > class Polygon_with_holes_2 : - public General_polygon_with_holes_2 > + public General_polygon_with_holes_2 > { public: - - typedef CGAL::Polygon_2 Polygon_2; + typedef Kernel Traits; + typedef Container_ Container; + typedef CGAL::Polygon_2 Polygon_2; typedef General_polygon_with_holes_2 Base; typedef typename Base::Hole_const_iterator Hole_const_iterator; typedef typename Base::Size Size; @@ -90,11 +91,11 @@ public: }; - template - Polygon_with_holes_2 transform(const Transformation& t, - const Polygon_with_holes_2& pwh) + template + Polygon_with_holes_2 transform(const Transformation& t, + const Polygon_with_holes_2& pwh) { - Polygon_with_holes_2 result(transform(t, pwh.outer_boundary())); + Polygon_with_holes_2 result(transform(t, pwh.outer_boundary())); for(const auto& hole : pwh.holes()){ result.add_hole(transform(t, hole)); } diff --git a/Polygon/test/Polygon/CMakeLists.txt b/Polygon/test/Polygon/CMakeLists.txt index 3f05c88ad8d..f8f4d524748 100644 --- a/Polygon/test/Polygon/CMakeLists.txt +++ b/Polygon/test/Polygon/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_Tests) find_package(CGAL REQUIRED) diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt index 11c27fb7f81..c24a90d7904 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_mesh_processing) # CGAL and its components diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index 6b74ce9696a..50f198e8317 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -25,7 +25,7 @@ /// \ingroup PkgPolygonMeshProcessingRef /// \defgroup PMP_measure_grp Geometric Measure Functions -/// Functions to compute lengths of edges and borders, areas of faces and patches, as well as volumes of closed meshes. +/// Functions to compute discrete curvatures, lengths of edges and borders, areas of faces and patches, volumes of closed meshes. /// \ingroup PkgPolygonMeshProcessingRef /// \defgroup PMP_orientation_grp Orientation Functions @@ -239,6 +239,11 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polygon_mesh_processing::sample_triangle_mesh()` \cgalCRPSection{Geometric Measure Functions} +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::angle_sum()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvatures()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvature()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_mean_curvature()` \endlink +- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::discrete_mean_curvatures()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::edge_length()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::squared_edge_length()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::face_area()` \endlink @@ -248,7 +253,6 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::face_border_length()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::longest_border()` \endlink - \link PMP_measure_grp `CGAL::Polygon_mesh_processing::centroid()` \endlink -- \link PMP_measure_grp `CGAL::Polygon_mesh_processing::match_faces()` \endlink \cgalCRPSection{Feature Detection Functions} - `CGAL::Polygon_mesh_processing::sharp_edges_segmentation()` diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 245d666ba5c..25379b205f9 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -1225,6 +1225,17 @@ compute the curvatures on a specific vertex. \cgalExample{Polygon_mesh_processing/interpolated_corrected_curvatures_vertex.cpp} +\subsection DCurvartures Discrete Curvatures + +The package also provides methods to compute the standard, non-interpolated discrete mean and Gaussian +curvatures on triangle meshes, based on the work of Meyer et al. \cgalCite{cgal:mdsb-ddgot-02}. +These curvatures are computed at each vertex of the mesh, and are based on the angles of the incident +triangles. The functions are: +- `CGAL::Polygon_mesh_processing::discrete_mean_curvature()` +- `CGAL::Polygon_mesh_processing::discrete_mean_curvatures()` +- `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvature()` +- `CGAL::Polygon_mesh_processing::discrete_Gaussian_curvatures()` + **************************************** \section PMPSlicer Slicer diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt index 1248c37ab68..dba765d7f6a 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt @@ -19,6 +19,10 @@ \example Polygon_mesh_processing/refine_fair_example.cpp \example Polygon_mesh_processing/mesh_slicer_example.cpp \example Polygon_mesh_processing/isotropic_remeshing_example.cpp +\example Polygon_mesh_processing/isotropic_remeshing_of_patch_example.cpp +\example Polygon_mesh_processing/isotropic_remeshing_with_allow_move.cpp +\example Polygon_mesh_processing/isotropic_remeshing_with_custom_sizing_example.cpp +\example Polygon_mesh_processing/isotropic_remeshing_with_sizing_example.cpp \example Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp \example Polygon_mesh_processing/interpolated_corrected_curvatures_PH.cpp \example Polygon_mesh_processing/interpolated_corrected_curvatures_vertex.cpp @@ -48,5 +52,4 @@ \example Polygon_mesh_processing/remesh_almost_planar_patches.cpp \example Polygon_mesh_processing/sample_example.cpp \example Polygon_mesh_processing/soup_autorefinement.cpp -\example Polygon_mesh_processing/isotropic_remeshing_with_allow_move.cpp */ diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 6f010df3bab..cbeb71cb6b9 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_mesh_processing_Examples) # CGAL and its components diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp index ac8378781fe..e549dad832d 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp @@ -32,11 +32,11 @@ int main(int argc, char* argv[]) Mesh::Property_map mean_curvature_map, Gaussian_curvature_map; - boost::tie(mean_curvature_map, created) = + std::tie(mean_curvature_map, created) = smesh.add_property_map("v:mean_curvature_map", 0); assert(created); - boost::tie(Gaussian_curvature_map, created) = + std::tie(Gaussian_curvature_map, created) = smesh.add_property_map("v:Gaussian_curvature_map", 0); assert(created); @@ -44,7 +44,7 @@ int main(int argc, char* argv[]) Mesh::Property_map> principal_curvatures_and_directions_map; - boost::tie(principal_curvatures_and_directions_map, created) = + std::tie(principal_curvatures_and_directions_map, created) = smesh.add_property_map> ("v:principal_curvatures_and_directions_map", { 0, 0, Epic_kernel::Vector_3(0,0,0), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h index bdca099e32c..252a4086087 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -38,7 +37,6 @@ #include #include -#include #include namespace CGAL { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/curvature.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/curvature.h new file mode 100644 index 00000000000..f612535dfc5 --- /dev/null +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/curvature.h @@ -0,0 +1,475 @@ +// Copyright (c) 2021 GeometryFactory (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Andreas Fabri, +// Mael Rouxel-Labbé + +#ifndef CGAL_PMP_CURVATURE_H +#define CGAL_PMP_CURVATURE_H + +#include + +#include +#include +#include +#include + +#include +#include + +namespace CGAL { +namespace Polygon_mesh_processing { + +/** + * \ingroup PMP_measure_grp + * + * computes the sum of the angles around a vertex. + * + * The angle sum is given in degrees. + * + * @tparam PolygonMesh a model of `FaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param v the vertex whose sum of angles is computed + * @param pmesh the polygon mesh to which `v` belongs + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `pmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, pmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must provide the nested functor `Compute_approximate_angle_3`, + * model of `Kernel::ComputeApproximateAngle_3`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @return the sum of angles around `v`. The return type `FT` is a number type either deduced + * from the `geom_traits` \ref bgl_namedparameters "Named Parameters" if provided, + * or the geometric traits class deduced from the point property map of `pmesh`. + * + * \warning This function involves trigonometry. + */ +template +#ifdef DOXYGEN_RUNNING +FT +#else +typename GetGeomTraits::type::FT +#endif +angle_sum(typename boost::graph_traits::vertex_descriptor v, + const PolygonMesh& pmesh, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + using Geom_traits = typename GetGeomTraits::type; + using FT = typename Geom_traits::FT; + + typename GetVertexPointMap::const_type + vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(CGAL::vertex_point, pmesh)); + + Geom_traits gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + CGAL_precondition(is_valid_vertex_descriptor(v, pmesh)); + + typename Geom_traits::Compute_approximate_angle_3 approx_angle = gt.compute_approximate_angle_3_object(); + + FT angle_sum = 0; + for(auto h : halfedges_around_source(v, pmesh)) + { + if(is_border(h, pmesh)) + continue; + + angle_sum += approx_angle(get(vpm, target(h, pmesh)), + get(vpm, source(h, pmesh)), + get(vpm, source(prev(h,pmesh), pmesh))); + } + + return angle_sum; +} + +// Discrete Gaussian Curvature + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete Gaussian curvature at a vertex. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete Gaussian curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param v the vertex whose discrete Gaussian curvature is being computed + * @param tmesh the triangle mesh to which `v` belongs + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @return the discrete Gaussian curvature at `v`. The return type `FT` is a number type either deduced + * from the `geom_traits` \ref bgl_namedparameters "Named Parameters" if provided, + * or the geometric traits class deduced from the point property map of `tmesh`. + * + * \warning This function involves trigonometry. + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +#ifdef DOXYGEN_RUNNING +FT +#else +typename GetGeomTraits::type::FT +#endif +discrete_Gaussian_curvature(typename boost::graph_traits::vertex_descriptor v, + const TriangleMesh& tmesh, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + using GeomTraits = typename GetGeomTraits::type; + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + using VertexPointMap = typename GetVertexPointMap::const_type; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + GeomTraits gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + VertexPointMap vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(vertex_point, tmesh)); + + typename GeomTraits::Construct_vector_3 vector = + gt.construct_vector_3_object(); + typename GeomTraits::Construct_cross_product_vector_3 cross_product = + gt.construct_cross_product_vector_3_object(); + typename GeomTraits::Compute_scalar_product_3 scalar_product = + gt.compute_scalar_product_3_object(); + typename GeomTraits::Compute_squared_length_3 squared_length = + gt.compute_squared_length_3_object(); + + FT angle_sum = 0; + + for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) + { + if(is_border(h, tmesh)) + continue; + + const Vector_3 v0 = vector(get(vpm, v), get(vpm, target(next(h, tmesh), tmesh))); // p1p2 + const Vector_3 v1 = vector(get(vpm, v), get(vpm, source(h, tmesh))); // p1p0 + + const FT dot = scalar_product(v0, v1); + const Vector_3 cross = cross_product(v0, v1); + const FT sqcn = squared_length(cross); + if(is_zero(dot)) + { + angle_sum += CGAL_PI/FT(2); + } + else + { + if(is_zero(sqcn)) // collinear + { + if(dot < 0) + angle_sum += CGAL_PI; + // else + // angle_sum += 0; + } + else + { + angle_sum += std::atan2(CGAL::approximate_sqrt(sqcn), dot); + } + } + } + + Weights::Secure_cotangent_weight_with_voronoi_area wc(tmesh, vpm, gt); + + const FT gaussian_curvature = (2 * CGAL_PI - angle_sum) / wc.voronoi(v); + + return gaussian_curvature; +} + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete Gaussian curvatures at the vertices of a mesh. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete Gaussian curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam VertexCurvatureMap must be a model of `WritablePropertyMap` with key type + * `boost::graph_traits::%vertex_descriptor` and value type `FT`, + * which is either `geom_traits::FT` if this named parameter is provided, + * or `kernel::FT` with the kernel deduced from from the point property map of `tmesh`. + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param tmesh the triangle mesh to which `v` belongs + * @param vcm the property map that contains the computed discrete curvatures + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \warning This function involves trigonometry. + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +void discrete_Gaussian_curvatures(const TriangleMesh& tmesh, + VertexCurvatureMap vcm, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + + for(vertex_descriptor v : vertices(tmesh)) + { + put(vcm, v, discrete_Gaussian_curvature(v, tmesh, np)); + // std::cout << "curvature: " << get(vcm, v) << std::endl; + } +} + +// Discrete Mean Curvature + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete mean curvature at a vertex. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete mean curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param v the vertex whose discrete mean curvature is being computed + * @param tmesh the triangle mesh to which `v` belongs + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @return the discrete mean curvature at `v`. The return type `FT` is a number type either deduced + * from the `geom_traits` \ref bgl_namedparameters "Named Parameters" if provided, + * or the geometric traits class deduced from the point property map of `tmesh`. + * + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +#ifdef DOXYGEN_RUNNING +FT +#else +typename GetGeomTraits::type::FT +#endif +discrete_mean_curvature(typename boost::graph_traits::vertex_descriptor v, + const TriangleMesh& tmesh, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + using GeomTraits = typename GetGeomTraits::type; + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + using VertexPointMap = typename GetVertexPointMap::const_type; + using Point_ref = typename boost::property_traits::reference; + + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + GeomTraits gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + VertexPointMap vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(vertex_point, tmesh)); + +#if 0 + typename GeomTraits::Compute_squared_distance_3 squared_distance = + gt.compute_squared_distance_3_object(); + typename GeomTraits::Compute_approximate_dihedral_angle_3 dihedral_angle = + gt.compute_approximate_dihedral_angle_3_object(); + + const FT two_pi = 2 * CGAL_PI; + + FT hi = 0; + for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) + { + const Point_3& p = get(vpm, source(h, tmesh)); + const Point_3& q = get(vpm, target(h, tmesh)); + const Point_3& r = get(vpm, target(next(h, tmesh), tmesh)); + const Point_3& s = get(vpm, target(next(opposite(h, tmesh), tmesh), tmesh)); + const FT l = squared_distance(p,q); + + FT phi = CGAL_PI * dihedral_angle(p, q, r, s) / FT(180); + + if(phi < 0) + phi += two_pi; + if(phi > two_pi) + phi = two_pi; + + hi += FT(0.5) * l * (CGAL_PI - phi); + } + + return FT(0.5) * hi; +#else + typename GeomTraits::Construct_vector_3 vector = + gt.construct_vector_3_object(); + typename GeomTraits::Construct_sum_of_vectors_3 vector_sum = + gt.construct_sum_of_vectors_3_object(); + typename GeomTraits::Construct_scaled_vector_3 scaled_vector = + gt.construct_scaled_vector_3_object(); + typename GeomTraits::Compute_squared_length_3 squared_length = + gt.compute_squared_length_3_object(); + + Weights::Secure_cotangent_weight_with_voronoi_area wc(tmesh, vpm, gt); + + Vector_3 kh = vector(CGAL::NULL_VECTOR); + for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) + { + const vertex_descriptor v1 = source(h, tmesh); + + const Point_ref p0 = get(vpm, v); + const Point_ref p1 = get(vpm, v1); + + FT local_c = 0; + if(!is_border(h, tmesh)) + { + const vertex_descriptor v2 = target(next(h, tmesh), tmesh); + const Point_ref p2 = get(vpm, v2); + local_c += Weights::cotangent_3_clamped(p0, p2, p1, gt); + } + + if(!is_border(opposite(h, tmesh), tmesh)) + { + const vertex_descriptor v3 = target(next(opposite(h, tmesh), tmesh), tmesh); + const Point_ref p3 = get(vpm, v3); + local_c += Weights::cotangent_3_clamped(p1, p3, p0, gt); + } + + kh = vector_sum(kh, scaled_vector(vector(p0, p1), local_c)); + } + + const FT khn = CGAL::approximate_sqrt(squared_length(kh)); + const FT va = wc.voronoi(v); + CGAL_assertion(!is_zero(va)); + + const FT mean_curvature = khn / (FT(4) * va); + return mean_curvature; +#endif +} + +/** + * \ingroup PMP_measure_grp + * + * computes the discrete mean curvatures at the vertices of a mesh. + * + * We refer to Meyer et al. \cgalCite{cgal:mdsb-ddgot-02} for the definition of discrete mean curvature. + * + * @tparam TriangleMesh a model of `FaceGraph` + * @tparam VertexCurvatureMap must be a model of `WritablePropertyMap` with key type + * `boost::graph_traits::%vertex_descriptor` and value type `FT`, + * which is either `geom_traits::FT` if this named parameter is provided, + * or `kernel::FT` with the kernel deduced from from the point property map of `tmesh`. + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param tmesh the triangle mesh to which `v` belongs + * @param vcm the property map that contains the computed discrete curvatures + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tmesh`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`} + * \cgalParamNEnd + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{The traits class must be a model of `Kernel`.} + * \cgalParamDefault{a \cgal kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \warning The current formulation is not well defined for border vertices. + * + * \pre `tmesh` is a triangle mesh + */ +template +void discrete_mean_curvatures(const TriangleMesh& tmesh, + VertexCurvatureMap vcm, + const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + + for(vertex_descriptor v : vertices(tmesh)) + put(vcm, v, discrete_mean_curvature(v, tmesh, np)); +} + +} // namespace Polygon_mesh_processing +} // namespace CGAL + +#endif //CGAL_PMP_CURVATURE_H diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 5664e2db18e..60e20772372 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1091,6 +1091,10 @@ public: boost::dynamic_bitset<> coplanar_patches_of_tm2_for_union_and_intersection(nb_patches_tm2,false); patch_status_not_set_tm1.set(); patch_status_not_set_tm2.set(); + // extra containers used when entire connected components are identical (filled only if needed) + std::vector coplanar_tm1_to_coplanar_tm2; + std::vector extreme_vertex_per_cc_1; + std::vector extreme_vertex_per_cc_2; // first set coplanar status of patches using the coplanar faces collected during the // extra intersection edges collected. This is important in the case of full connected components @@ -1847,8 +1851,61 @@ public: { if (coplanar_patches_of_tm1.test(patch_id)) { - if (is_tm1_inside_out == is_tm2_inside_out) + // Two "identical" coplanar patches that are entire connected components + // we have the correspondence between cpln patches thanks to faces in tm1_coplanar_faces and tm2_coplanar_faces + CGAL_assertion(tm1_coplanar_faces.size()==tm2_coplanar_faces.size()); + if (coplanar_tm1_to_coplanar_tm2.empty()) // fill container only once + { + coplanar_tm1_to_coplanar_tm2.resize(nb_patches_tm1, NID); + for (std::size_t i=0; i::null_vertex(); + extreme_vertex_per_cc_1.assign(nb_patches_tm1, null_v); + for (face_descriptor fd : faces(tm1)) + { + std::size_t patch_id = tm1_patch_ids[get(fids1, fd)]; + if (!coplanar_patches_of_tm1.test(patch_id)) continue; + halfedge_descriptor hd=halfedge(fd, tm1); + for (halfedge_descriptor h : CGAL::halfedges_around_face(hd, tm1)) + { + vertex_descriptor vd = target(h, tm1); + if (extreme_vertex_per_cc_1[patch_id]==null_v || get(vpm1,extreme_vertex_per_cc_1[patch_id]) Hedge_pair; std::vector< Hedge_pair> hedges_to_link; typename CGAL::Halfedge_around_target_iterator hit, end; - boost::tie(hit,end) = halfedges_around_target(vd, tm1); + std::tie(hit,end) = halfedges_around_target(vd, tm1); for(; hit!=end; ++hit) { // look for a border halfedge incident to the non-manifold vertex that will not be diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 3afa14acaf0..a40970ed97b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -879,14 +879,14 @@ namespace internal { std::array r1 = internal::is_badly_shaped( face(he, mesh_), mesh_, vpmap_, vcmap_, ecmap_, gt_, - cap_threshold, // bound on the angle: above 160 deg => cap 4, // bound on shortest/longest edge above 4 => needle + cap_threshold, // bound on the angle: above 160 deg => cap 0,// collapse length threshold : not needed here 0); // flip triangle height threshold std::array r2 = internal::is_badly_shaped( face(opposite(he, mesh_), mesh_), - mesh_, vpmap_, vcmap_, ecmap_, gt_, cap_threshold, 4, 0, 0); + mesh_, vpmap_, vcmap_, ecmap_, gt_, 4, cap_threshold, 0, 0); const bool badly_shaped = (r1[0] != boost::graph_traits::null_halfedge()//needle || r1[1] != boost::graph_traits::null_halfedge()//cap @@ -1692,6 +1692,17 @@ private: // else keep current status for en and eno } + void remove_border_face(const halfedge_descriptor h) + { + CGAL_assertion(is_border(opposite(h, mesh_), mesh_)); + for (halfedge_descriptor hf : halfedges_around_face(h, mesh_)) + { + set_status(hf, MESH_BORDER); //only 1 or 2 of the listed halfedges + //will survive face removal, but status will be correct + } + CGAL::Euler::remove_face(h, mesh_); + } + template bool fix_degenerate_faces(const vertex_descriptor& v, Bimap& short_edges, @@ -1721,7 +1732,7 @@ private: if(is_border(opposite(h, mesh_), mesh_)) { - CGAL::Euler::remove_face(h, mesh_); + remove_border_face(h); continue; } @@ -1732,7 +1743,7 @@ private: if(is_border(hfo, mesh_)) { - CGAL::Euler::remove_face(h, mesh_); + remove_border_face(h); break; } vertex_descriptor vc = target(hf, mesh_); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h index 20e95e59610..38053bee8fe 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h @@ -67,7 +67,7 @@ void assign_tolerance_with_local_edge_length_bound(const HalfedgeRange& halfedge { const vertex_descriptor vd = target(hd, mesh); CGAL::Halfedge_around_target_iterator hit, hend; - boost::tie(hit, hend) = CGAL::halfedges_around_target(vd, mesh); + std::tie(hit, hend) = CGAL::halfedges_around_target(vd, mesh); CGAL_assertion(hit != hend); FT sq_length = gt.compute_squared_distance_3_object()(get(vpm, source(*hit, mesh)), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index c8653c0196d..e21e0a4a0ed 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1450,7 +1451,7 @@ void build_AABB_tree(const TriangleMesh& tm, >::value>* = 0) { typename boost::graph_traits::face_iterator ffirst, fbeyond; - boost::tie(ffirst, fbeyond) = faces(tm); + std::tie(ffirst, fbeyond) = faces(tm); outTree.rebuild(ffirst, fbeyond, tm, wrapped_vpm); outTree.build(); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index a21e4333ec0..25096d0c26f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -51,17 +51,15 @@ namespace Polygon_mesh_processing { namespace internal { template -std::array::halfedge_descriptor, 2> -is_badly_shaped(const typename boost::graph_traits::face_descriptor f, - TriangleMesh& tmesh, - const VPM& vpm, - const VCM& vcm, - const ECM& ecm, - const Traits& gt, - const double cap_threshold, // angle over 160° ==> cap - const double needle_threshold, // longest edge / shortest edge over this ratio ==> needle - const double collapse_length_threshold, // max length of edges allowed to be collapsed - const double flip_triangle_height_threshold_squared) // max height of triangles allowed to be flipped +typename boost::graph_traits::halfedge_descriptor +is_it_a_needle(const typename boost::graph_traits::face_descriptor f, + TriangleMesh& tmesh, + const VPM& vpm, + const VCM& vcm, + const ECM& /* ecm */, //not used because vcm is filled with end points of edges in ecm + const Traits& gt, + const double needle_threshold, // longest edge / shortest edge over this ratio ==> needle + const double collapse_length_threshold) // max length of edges allowed to be collapsed { namespace PMP = CGAL::Polygon_mesh_processing; @@ -78,23 +76,70 @@ is_badly_shaped(const typename boost::graph_traits::face_descripto if(collapse_length_threshold == 0 || edge_length(res, tmesh, parameters::vertex_point_map(vpm).geom_traits(gt)) <= collapse_length_threshold) { - return make_array(res, null_h); + return res; } } - res = PMP::is_cap_triangle_face(f, tmesh, cap_threshold, parameters::vertex_point_map(vpm).geom_traits(gt)); + return null_h; +} + +template +typename boost::graph_traits::halfedge_descriptor +is_it_a_cap(const typename boost::graph_traits::face_descriptor f, + TriangleMesh& tmesh, + const VPM& vpm, + const VCM& /* vcm */, + const ECM& ecm, + const Traits& gt, + const double cap_threshold, // angle over 160° ==> cap + const double flip_triangle_height_threshold_squared) // max height of triangles allowed to be flipped +{ + namespace PMP = CGAL::Polygon_mesh_processing; + + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + const halfedge_descriptor null_h = boost::graph_traits::null_halfedge(); + + halfedge_descriptor res = + PMP::is_cap_triangle_face(f, tmesh, cap_threshold, parameters::vertex_point_map(vpm).geom_traits(gt)); if( res != null_h && !get(ecm, edge(res, tmesh) ) && (flip_triangle_height_threshold_squared == 0 || typename Traits::Compare_squared_distance_3()( get(vpm, target(next(res,tmesh), tmesh)), typename Traits::Line_3(get(vpm, source(res,tmesh)), get(vpm, target(res,tmesh))), flip_triangle_height_threshold_squared) != LARGER )) { - return make_array(null_h, res); + return res; } - return make_array(null_h, null_h); + return null_h; } +// This function tests both needle-ness and cap-ness +template +std::array::halfedge_descriptor, 2> +is_badly_shaped(const typename boost::graph_traits::face_descriptor f, + TriangleMesh& tmesh, + const VPM& vpm, + const VCM& vcm, + const ECM& ecm, + const Traits& gt, + const double needle_threshold, // longest edge / shortest edge over this ratio ==> needle + const double cap_threshold, // angle over 160° ==> cap + const double collapse_length_threshold, // max length of edges allowed to be collapsed + const double flip_triangle_height_threshold_squared) // max height of triangles allowed to be flipped +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + const halfedge_descriptor null_h = boost::graph_traits::null_halfedge(); + std::array retval = make_array(null_h, null_h); + + retval[0] = is_it_a_needle(f, tmesh, vpm, vcm, ecm, gt, needle_threshold, collapse_length_threshold); + retval[1] = is_it_a_cap(f, tmesh, vpm, vcm, ecm, gt, cap_threshold, flip_triangle_height_threshold_squared); + + return retval; +} + +// This function tests both needle-ness and cap-ness and fills both ranges template void collect_badly_shaped_triangles(const typename boost::graph_traits::face_descriptor f, @@ -112,11 +157,13 @@ void collect_badly_shaped_triangles(const typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - std::array res = is_badly_shaped(f, tmesh, vpm, vcm, ecm, gt, cap_threshold, - needle_threshold, + const halfedge_descriptor null_h = boost::graph_traits::null_halfedge(); + + std::array res = is_badly_shaped(f, tmesh, vpm, vcm, ecm, gt, + needle_threshold, cap_threshold, collapse_length_threshold, flip_triangle_height_threshold_squared); - if(res[0] != boost::graph_traits::null_halfedge()) + if(res[0] != null_h) { #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "add new needle: " << edge(res[0], tmesh) << std::endl; @@ -125,17 +172,15 @@ void collect_badly_shaped_triangles(const typename boost::graph_traits::null_halfedge()) - { #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA - std::cout << "add new cap: " << edge(res[1],tmesh) << std::endl; + std::cout << "add new cap: " << edge(res[1],tmesh) << std::endl; #endif - CGAL_assertion(!is_border(res[1], tmesh)); - CGAL_assertion(!get(ecm, edge(res[1], tmesh))); - edges_to_flip.insert(res[1]); - } + CGAL_assertion(!is_border(res[1], tmesh)); + CGAL_assertion(!get(ecm, edge(res[1], tmesh))); + edges_to_flip.insert(res[1]); } } @@ -607,6 +652,8 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; + const halfedge_descriptor null_h = boost::graph_traits::null_halfedge(); + typedef Static_boolean_property_map Default_VCM; typedef typename internal_np::Lookup_named_param_def::null_face()) @@ -673,36 +721,38 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, } } - // Start the process of removing bad elements - std::set edges_to_collapse; - std::set edges_to_flip; + // @todo maybe using a priority queue handling the more almost degenerate elements first should be used + std::unordered_set edges_to_collapse; + std::unordered_set edges_to_flip; - // @todo could probably do something a bit better by looping edges, consider the incident faces - // f1 / f2 and look at f1 if f1 next_edges_to_collapse; - std::set next_edges_to_flip; + std::unordered_set next_edges_to_collapse; // Treat needles =============================================================================== #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA int kk=0; std::ofstream(std::string("tmp/n-00000.off")) << tmesh; #endif + + auto run_cap_check = [&](halfedge_descriptor h, bool consider_for_collapse=true) + { + halfedge_descriptor cap_h = internal::is_it_a_cap(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, + cap_threshold, flip_triangle_height_threshold_squared); + if(cap_h != null_h) + { +#ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA + std::cout << "\t\t But the face is a cap" << std::endl; +#endif + edges_to_flip.insert(cap_h); + } + else + { + if (consider_for_collapse) next_edges_to_collapse.insert(h); + } + }; + while(!edges_to_collapse.empty()) { + // note that on the first iteration, 'h' does not indicate a known needle halfedge_descriptor h = *edges_to_collapse.begin(); edges_to_collapse.erase(edges_to_collapse.begin()); + CGAL_assertion(is_valid_halfedge_descriptor(h, tmesh)); + + // Verify that the element is still badly shaped + halfedge_descriptor needle_h = internal::is_it_a_needle(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, + needle_threshold, collapse_length_threshold); + if(needle_h == null_h) + { +#ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA + std::cout << "\t Needle criterion not verified" << std::endl; +#endif + run_cap_check(h, false); + continue; + } + else + { + h = needle_h; + } CGAL_assertion(!is_border(h, tmesh)); const edge_descriptor e = edge(h, tmesh); CGAL_assertion(!get(ecm, edge(h, tmesh))); - - if(get(vcm, source(h, tmesh)) && get(vcm, target(h, tmesh))) - continue; + CGAL_assertion(!get(vcm, source(h, tmesh)) && !get(vcm, target(h, tmesh))); #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << " treat needle: " << e << " (" << source(e, tmesh) << " " << tmesh.point(source(h, tmesh)) << " --- " << source(e, tmesh) << " " << tmesh.point(target(h, tmesh)) << ")" << std::endl; #endif + if(CGAL::Euler::does_satisfy_link_condition(e, tmesh)) { - // Verify that the element is still badly shaped - const std::array nc = - internal::is_badly_shaped(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, - cap_threshold, needle_threshold, collapse_length_threshold, flip_triangle_height_threshold_squared); - - if(nc[0] != h) - { -#ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA - std::cout << "\t Needle criteria no longer verified" << std::endl; -#endif - continue; - } - // pick the orientation of edge to keep the vertex minimizing the volume variation const halfedge_descriptor best_h = internal::get_best_edge_orientation(e, tmesh, vpm, vcm, gt); - if(best_h == boost::graph_traits::null_halfedge()) + if(best_h == null_h) { #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t Geometrically invalid edge collapse!" << std::endl; #endif - next_edges_to_collapse.insert(h); + run_cap_check(h); continue; } - if (!accept_change.collapse(edge(best_h, tmesh))) + if(!accept_change.collapse(edge(best_h, tmesh))) { #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t edge collapse prevented by the user functor" << std::endl; #endif - next_edges_to_collapse.insert(h); + run_cap_check(h); continue; } @@ -830,7 +900,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, else v = Euler::collapse_edge(edge(best_h, tmesh), tmesh); - // moving to the midpoint is not a good idea. On a circle for example you might endpoint with + // moving to the midpoint is not a good idea. On a circle for example you might end with // a bad geometry because you iteratively move one point // auto mp = midpoint(tmesh.point(source(h, tmesh)), tmesh.point(target(h, tmesh))); // tmesh.point(v) = mp; @@ -840,10 +910,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, { if(!is_border(hv, tmesh)) { - internal::collect_badly_shaped_triangles(face(hv, tmesh), tmesh, vpm, vcm, ecm, gt, - cap_threshold, needle_threshold, - collapse_length_threshold, flip_triangle_height_threshold_squared, - edges_to_collapse, edges_to_flip); + next_edges_to_collapse.insert(hv); // shape will be tested when popped } } @@ -862,24 +929,40 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t Uncollapsable edge!" << std::endl; #endif - next_edges_to_collapse.insert(h); + run_cap_check(h); } } // Treat caps ================================================================================== - CGAL_assertion(next_edges_to_flip.empty()); #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA kk=0; std::ofstream(std::string("tmp/c-000.off")) << tmesh; #endif + while(!edges_to_flip.empty()) { halfedge_descriptor h = *edges_to_flip.begin(); edges_to_flip.erase(edges_to_flip.begin()); - + CGAL_assertion(is_valid_halfedge_descriptor(h, tmesh)); CGAL_assertion(!is_border(h, tmesh)); + // check if the face is still a cap + halfedge_descriptor cap_h = internal::is_it_a_cap(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, + cap_threshold, flip_triangle_height_threshold_squared); + + if(cap_h == null_h) + { +#ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA + std::cout << "\t Cap criterion no longer verified" << std::endl; +#endif + continue; + } + else + { + h = cap_h; + } + const edge_descriptor e = edge(h, tmesh); CGAL_assertion(!get(ecm, e)); @@ -889,23 +972,11 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, << " --- " << target(e, tmesh) << " " << tmesh.point(target(h, tmesh)) << ")" << std::endl; #endif - std::array nc = internal::is_badly_shaped(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, - cap_threshold, needle_threshold, - collapse_length_threshold, flip_triangle_height_threshold_squared); - // Check the triangle is still a cap - if(nc[1] != h) - { -#ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA - std::cout << "\t Cap criteria no longer verified" << std::endl; -#endif - continue; - } - // special case of `edge(h, tmesh)` being a border edge --> remove the face if(is_border(opposite(h, tmesh), tmesh)) { - // check a non-manifold vertex won't be created - bool removal_is_nm=false; + // check that a non-manifold vertex won't be created + bool removal_is_nm = false; for(halfedge_descriptor hh : CGAL::halfedges_around_target(next(h, tmesh), tmesh)) { if (is_border(hh, tmesh)) @@ -914,13 +985,13 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, break; } } - if (removal_is_nm) continue; + + if(removal_is_nm) + continue; for(halfedge_descriptor hh : CGAL::halfedges_around_face(h, tmesh)) { - // Remove from even 'next_edges_to_flip' because it might have been re-added from a flip edges_to_flip.erase(hh); - next_edges_to_flip.erase(hh); next_edges_to_collapse.erase(hh); } @@ -941,15 +1012,16 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t Flipping prevented: not the best diagonal" << std::endl; #endif - next_edges_to_flip.insert(h); + next_edges_to_collapse.insert(h); continue; } - if (!accept_change.flip(h)) + if(!accept_change.flip(h)) { #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t Flipping prevented: rejected by user functor" << std::endl; #endif + next_edges_to_collapse.insert(h); continue; } @@ -963,16 +1035,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, for(int i=0; i<2; ++i) { CGAL_assertion(!is_border(h, tmesh)); - std::array nc = - internal::is_badly_shaped(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, - cap_threshold, needle_threshold, - collapse_length_threshold, flip_triangle_height_threshold_squared); - - if(nc[1] != boost::graph_traits::null_halfedge() && nc[1] != h) - next_edges_to_flip.insert(nc[1]); - else if(nc[0] != boost::graph_traits::null_halfedge()) - next_edges_to_collapse.insert(nc[0]); - + next_edges_to_collapse.insert(h); h = opposite(h, tmesh); } @@ -984,7 +1047,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, std::cout << "\t Unflippable edge!" << std::endl; #endif CGAL_assertion(!is_border(h, tmesh)); - next_edges_to_flip.insert(h); + next_edges_to_collapse.insert(h); } #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA @@ -1001,7 +1064,6 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, return false; std::swap(edges_to_collapse, next_edges_to_collapse); - std::swap(edges_to_flip, next_edges_to_flip); } return false; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h index 0c06d588abc..361593e8aae 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h @@ -31,7 +31,7 @@ namespace Polygon_mesh_processing { * \ingroup PMPDeprecated * * \deprecated This function is deprecated since \cgal 5.5, -* `CGAL::angle_and_area_smoothing()` should be used instead. +* `CGAL::Polygon_mesh_processing::angle_and_area_smoothing()` should be used instead. */ template CGAL_DEPRECATED void smooth_mesh(const FaceRange& faces, diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index 0dd21ab22e1..1e442ae768f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_mesh_processing_Tests) # CGAL and its components @@ -28,6 +28,7 @@ create_single_source_cgal_program("test_stitching.cpp") create_single_source_cgal_program("remeshing_test.cpp") create_single_source_cgal_program("remeshing_with_isolated_constraints_test.cpp" ) create_single_source_cgal_program("measures_test.cpp") +create_single_source_cgal_program("test_discrete_curvatures.cpp") create_single_source_cgal_program("triangulate_faces_test.cpp") create_single_source_cgal_program("triangulate_faces_hole_filling_dt3_test.cpp") create_single_source_cgal_program("triangulate_faces_hole_filling_all_search_test.cpp") @@ -67,6 +68,7 @@ create_single_source_cgal_program("test_pmp_np_function.cpp") create_single_source_cgal_program("test_degenerate_pmp_clip_split_corefine.cpp") create_single_source_cgal_program("test_isolevel_refinement.cpp") create_single_source_cgal_program("test_corefinement_nm_bo.cpp") +create_single_source_cgal_program("test_corefinement_cavities.cpp") # create_single_source_cgal_program("test_pmp_repair_self_intersections.cpp") find_package(Eigen3 3.2.0 QUIET) #(requires 3.2.0 or greater) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_cavities.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_cavities.cpp new file mode 100644 index 00000000000..ad5bfe39675 --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_cavities.cpp @@ -0,0 +1,123 @@ +#include +#include +#include + +template +void make_hexa(double x, double y, double z, + double X, double Y, double Z, + Mesh& mesh, int t) +{ + CGAL::make_hexahedron( + Point(x,y,Z), + Point(X,y,Z), + Point(X,y,z), + Point(x,y,z), + Point(x,Y,z), + Point(x,Y,Z), + Point(X,Y,Z), + Point(X,Y,z), + mesh); + + using face_descriptor = typename boost::graph_traits::face_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + std::vector fcs(faces(mesh).begin(), faces(mesh).end()); + for (face_descriptor f : fcs) + { + halfedge_descriptor h = halfedge(f, mesh); + if (t==1) h=next(h,mesh); + halfedge_descriptor h2=next(next(h, mesh), mesh); + CGAL::Euler::split_face(h, h2, mesh); + } +} + +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Point_3 = K::Point_3; +using Mesh = CGAL::Surface_mesh; + +namespace PMP = CGAL::Polygon_mesh_processing; + + +void test_operations(Mesh A, Mesh B, + bool reverse_A, bool reverse_B, + std::string round, + std::size_t union_v, std::size_t inter_v, std::size_t diff1_v, std::size_t diff2_v) +{ +#ifndef VERBOSE + CGAL_USE(round); +#endif + if (reverse_A) PMP::reverse_face_orientations(A); + if (reverse_B) PMP::reverse_face_orientations(B); + + Mesh out_union, out_inter, out_diff1, out_diff2; + std::array, 4> output; + output[PMP::Corefinement::UNION] = &out_union; + output[PMP::Corefinement::INTERSECTION] = &out_inter; + output[PMP::Corefinement::TM1_MINUS_TM2] = &out_diff1; + output[PMP::Corefinement::TM2_MINUS_TM1] = &out_diff2; + + Mesh lA=A, lB=B; + PMP::corefine_and_compute_boolean_operations(lA,lB,output); +#ifdef VERBOSE + std::ofstream("out_union_"+round+".off") << out_union; + std::ofstream("out_inter_"+round+".off") << out_inter; + std::ofstream("out_diff1_"+round+".off") << out_diff1; + std::ofstream("out_diff2_"+round+".off") << out_diff2; +#endif + assert(vertices(out_union).size()==union_v); + assert(vertices(out_inter).size()==inter_v); + assert(vertices(out_diff1).size()==diff1_v); + assert(vertices(out_diff2).size()==diff2_v); +} + +int main() +{ + + Mesh A, mh, B; + make_hexa(0, 0, 0, + 4, 4, 4, + A, 0); + make_hexa(1, 1, 1, + 2, 2, 2, + mh, 0); + make_hexa(1, 1, 1, + 2, 2, 2, + B, 1); + + Mesh A2, mh2, B2; + make_hexa(5, 0, 0, + 9, 4, 4, + A2, 0); + make_hexa(6, 1, 1, + 7, 2, 2, + mh2, 0); + make_hexa(6, 1, 1, + 7, 2, 2, + B2, 1); + + A.join(A2); + mh.join(mh2); + PMP::reverse_face_orientations(mh); + A.join(mh); + B.join(B2); + +#ifdef VERBOSE + std::ofstream("A.off") << A; + std::ofstream("B.off") << B; +#endif + + test_operations(A, B, false, false, "r00", 16, 0, 44, 28); + test_operations(A, B, false, true, "r01", 28, 44, 0, 16); + test_operations(A, B, true, false, "r10", 44, 28, 16, 0); + test_operations(A, B, true, true, "r11", 0, 16, 28, 44); + + test_operations(A, A, false, false, "a00", 32, 32, 0, 0); + test_operations(A, A, false, true, "a01", 0, 0, 32, 32); + test_operations(A, A, true, false, "a10", 0, 0, 32, 32); + test_operations(A, A, true, true, "a11", 32, 32, 0, 0); + + test_operations(B, B, false, false, "b00", 16, 16, 0, 0); + test_operations(B, B, false, true, "b01", 0, 0, 16, 16); + test_operations(B, B, true, false, "b10", 0, 0, 16, 16); + test_operations(B, B, true, true, "b11", 16, 16, 0, 0); +} diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_discrete_curvatures.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_discrete_curvatures.cpp new file mode 100644 index 00000000000..d37bf7471ad --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_discrete_curvatures.cpp @@ -0,0 +1,146 @@ +#include +#include +#include + +#include + +#include + +#include +#include + +#define ABS_ERROR 1e-6 + +namespace PMP = CGAL::Polygon_mesh_processing; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef K::FT FT; +typedef CGAL::Surface_mesh SMesh; +typedef CGAL::Polyhedron_3 Polyhedron; + +struct Average_test_info +{ + FT mean_curvature_avg; + FT gaussian_curvature_avg; + FT tolerance = 0.9; + + Average_test_info(FT mean_curvature_avg, + FT gaussian_curvature_avg) + : mean_curvature_avg(mean_curvature_avg), + gaussian_curvature_avg(gaussian_curvature_avg) + { } +}; + +bool passes_comparison(FT result, FT expected, FT tolerance) +{ + std::cout << "result: " << result << std::endl; + std::cout << "expected: " << expected << std::endl; + + if(abs(expected) < ABS_ERROR && abs(result) < ABS_ERROR) + return true; // expected 0, got 0 + else if (abs(expected) < ABS_ERROR) + return false; // expected 0, got non-0 + + return (std::min)(result, expected) / (std::max)(result, expected) > tolerance; +} + +template +void test_curvatures(std::string mesh_path, + Average_test_info test_info) +{ + std::cout << "test discrete curvatures of " << mesh_path << std::endl; + std::cout << "mesh type: " << typeid(mesh_path).name() << std::endl; + + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + TriangleMesh tmesh; + const std::string filename = CGAL::data_file_path(mesh_path); + + if(!CGAL::IO::read_polygon_mesh(filename, tmesh) || faces(tmesh).size() == 0) + { + std::cerr << "Invalid input file." << std::endl; + std::exit(1); + } + + typename boost::property_map>::type + mean_curvature_map = get(CGAL::dynamic_vertex_property_t(), tmesh), + gaussian_curvature_map = get(CGAL::dynamic_vertex_property_t(), tmesh); + + PMP::discrete_mean_curvatures(tmesh, mean_curvature_map); + PMP::discrete_Gaussian_curvatures(tmesh, gaussian_curvature_map); + + FT mean_curvature_avg = 0, gaussian_curvature_avg = 0; + for(vertex_descriptor v : vertices(tmesh)) + { + mean_curvature_avg += get(mean_curvature_map, v); + gaussian_curvature_avg += get(gaussian_curvature_map, v); + } + + mean_curvature_avg /= vertices(tmesh).size(); + gaussian_curvature_avg /= vertices(tmesh).size(); + + std::cout << "checking mean curvature..." << std::endl; + assert(passes_comparison(mean_curvature_avg, test_info.mean_curvature_avg, test_info.tolerance)); + + std::cout << "checking Gaussian curvature..." << std::endl; + assert(passes_comparison(gaussian_curvature_avg, test_info.gaussian_curvature_avg, test_info.tolerance)); +} + +template +void test_angle_sums(const std::string mesh_path, + const std::vector& expected_values) +{ + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + PolygonMesh pmesh; + const std::string filename = CGAL::data_file_path(mesh_path); + + if(!CGAL::IO::read_polygon_mesh(filename, pmesh) || faces(pmesh).size() == 0) + { + std::cerr << "Invalid input file." << std::endl; + std::exit(1); + } + + std::size_t pos = 0; + for(vertex_descriptor v : vertices(pmesh)) + { + FT angle_sum = PMP::angle_sum(v, pmesh, + CGAL::parameters::geom_traits(K()) + .vertex_point_map(get(CGAL::vertex_point, pmesh))); + assert(passes_comparison(angle_sum, expected_values[pos++], 0.9)); + } +} + +int main(int, char**) +{ + // testing on a simple sphere(r = 0.5), on both Polyhedron & SurfaceMesh: + // Expected: Mean Curvature = 2, Gaussian Curvature = 4 + test_curvatures("meshes/sphere.off", Average_test_info(2, 4)); + test_curvatures("meshes/sphere.off", Average_test_info(2, 4)); + + // testing on a simple sphere(r = 10), on both Polyhedron & SurfaceMesh: + // Expected: Mean Curvature = 0.1, Gaussian Curvature = 0.01 + test_curvatures("meshes/sphere966.off", Average_test_info(0.1, 0.01)); + test_curvatures("meshes/sphere966.off", Average_test_info(0.1, 0.01)); + + // testing on a simple half cylinder(r = 1), on both Polyhedron & SurfaceMesh: + // Expected: Mean Curvature = 0.5, Gaussian Curvature = 0 + // To be tested once the discrete curvatures are well defined for boundary vertices + // test_curvatures("meshes/cylinder.off", Average_test_info(0.5, 0)); + // test_curvatures("meshes/cylinder.off", Average_test_info(0.5, 0)); + + test_angle_sums("meshes/quad.off", std::vector(4, 90)); + test_angle_sums("meshes/quad.off", std::vector(4, 90)); + + test_angle_sums("meshes/regular_tetrahedron.off", std::vector(4, 180)); + test_angle_sums("meshes/regular_tetrahedron.off", std::vector(4, 180)); + + test_angle_sums("meshes/cube_quad.off", std::vector(8, 270)); + test_angle_sums("meshes/cube_quad.off", std::vector(8, 270)); + + test_angle_sums("meshes/cube_poly.off", std::vector(8, 270)); + test_angle_sums("meshes/cube_poly.off", std::vector(8, 270)); + + std::cout << "Done." << std::endl; + return EXIT_SUCCESS; +} diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp index 412443a42c7..a15258b0fc9 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_interpolated_corrected_curvatures.cpp @@ -9,8 +9,9 @@ #include +#include #include -#include +#include #define ABS_ERROR 1e-6 @@ -181,7 +182,7 @@ void test_average_curvatures(std::string mesh_path, int main() { // testing on a simple sphere(r = 0.5), on both Polyhedron & SurfaceMesh: - // For this mesh, ina addition to the whole mesh functions, we also compare against the single vertex + // For this mesh, in addition to the whole mesh functions, we also compare against the single vertex // curvature functions to make sure the produce the same results // Expected: Mean Curvature = 2, Gaussian Curvature = 4, Principal Curvatures = 2 & 2 so 2 on avg. test_average_curvatures("meshes/sphere.off", Average_test_info(2, 4, 2), true); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp index b2250c03641..e33c34e45cb 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp @@ -378,7 +378,7 @@ void test_predicates(const G& g, CGAL::Random& rnd) // --------------------------------------------------------------------------- int max = 1000, counter = 0; typename boost::graph_traits::halfedge_iterator hit, hend; - boost::tie(hit, hend) = halfedges(g); + std::tie(hit, hend) = halfedges(g); for(; hit!=hend; ++hit) { const halfedge_descriptor h = *hit; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_remove_caps_needles.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_remove_caps_needles.cpp index 505a731ed89..0b90e28fcfa 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_remove_caps_needles.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_remove_caps_needles.cpp @@ -29,7 +29,7 @@ void general_test(std::string filename) std::ifstream input(filename); Mesh mesh; - if (!input || !(input >> mesh) || !CGAL::is_triangle_mesh(mesh)) { + if (!CGAL::IO::read_polygon_mesh(filename, mesh) || !CGAL::is_triangle_mesh(mesh)) { std::cerr << "Not a valid input file." << std::endl; exit(EXIT_FAILURE); } @@ -57,7 +57,8 @@ void test_with_envelope(std::string filename, double eps) std::ifstream input(filename); Mesh mesh, bk; - if (!input || !(input >> mesh) || !CGAL::is_triangle_mesh(mesh)) { + if (!CGAL::IO::read_polygon_mesh(filename, mesh) || !CGAL::is_triangle_mesh(mesh)) + { std::cerr << "Not a valid input file." << std::endl; exit(EXIT_FAILURE); } @@ -132,7 +133,8 @@ void test_parameters_on_pig(std::string filename) std::ifstream input(filename); Mesh mesh, bk; - if (!input || !(input >> mesh) || !CGAL::is_triangle_mesh(mesh)) { + if (!CGAL::IO::read_polygon_mesh(filename, mesh) || !CGAL::is_triangle_mesh(mesh)) + { std::cerr << "Not a valid input file." << std::endl; exit(EXIT_FAILURE); } @@ -165,13 +167,11 @@ void test_parameters_on_pig(std::string filename) int main(int argc, char** argv) { const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/pig.off"); + double eps = (argc > 2) ? atof(argv[2]) : 0.01; general_test(filename); - if (argc==2) - test_with_envelope(filename, 0.01); - else - if (argc==3) - test_with_envelope(filename, atof(argv[2])); + + test_with_envelope(filename, eps); // only run that test with pig.off if (argc==1) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp index 17228d4603f..716a5a81654 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_predicates.cpp @@ -78,7 +78,7 @@ void test_needles_and_caps(const std::string fname) const FT eps = std::numeric_limits::epsilon(); face_iterator fit, fend; - boost::tie(fit, fend) = faces(mesh); + std::tie(fit, fend) = faces(mesh); // (0 0 0) -- (1 0 0) -- (1 1 0) (90° cap angle) face_descriptor f = *fit; diff --git a/Polygon_repair/doc/Polygon_repair/PackageDescription.txt b/Polygon_repair/doc/Polygon_repair/PackageDescription.txt index 0bd41658ad4..3a311dd0cd1 100644 --- a/Polygon_repair/doc/Polygon_repair/PackageDescription.txt +++ b/Polygon_repair/doc/Polygon_repair/PackageDescription.txt @@ -1,10 +1,11 @@ -// PRETTY PACKAGE NAME should equal the project title in Doxyfile.in - /// \defgroup PkgPolygonRepairRef 2D Polygon Repair Reference /// \defgroup PkgPolygonRepairFunctions Functions /// \ingroup PkgPolygonRepairRef +/// \defgroup PkgPolygonRepairRules Repair Rules +/// \ingroup PkgPolygonRepairRef + /*! \addtogroup PkgPolygonRepairRef @@ -15,7 +16,8 @@ \cgalPkgAuthors{Ken Arroyo Ohori} \cgalPkgDesc{This package provides algorithms to repair 2D polygons, polygons with holes, and multipolygons with holes, by selecting faces of the arrangement of the input based on a selection rule. -Currently, only the even-odd rule is provided. } +The even-odd rule and the non-zero rule are provided for dealing with self intersections. +The %union and the %intersection rule enable to combine similar polygons. } \cgalPkgManuals{Chapter_2D_Polygon_repair,PkgPolygonRepairRef} \cgalPkgSummaryEnd @@ -32,7 +34,12 @@ Currently, only the even-odd rule is provided. } \cgalCRPSection{Functions} - `CGAL::Polygon_repair::repair()` +- `CGAL::Polygon_repair::join()` +- `CGAL::Polygon_repair::intersect()` -\cgalCRPSection{Simplification Rules} +\cgalCRPSection{Repair Rules} - `CGAL::Polygon_repair::Even_odd_rule` +- `CGAL::Polygon_repair::Non_zero_rule` +- `CGAL::Polygon_repair::Union_rule` +- `CGAL::Polygon_repair::Intersection_rule` */ diff --git a/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt b/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt index 26b6f6d62c7..f837f18e9eb 100644 --- a/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt +++ b/Polygon_repair/doc/Polygon_repair/Polygon_repair.txt @@ -9,20 +9,25 @@ namespace CGAL { \section SectionPolygonRepair_Introduction Introduction -This package implements a polygon repair method. Starting from possibly +This package implements polygon repair methods. Starting from possibly invalid input in the form of a polygon, polygon with holes or multipolygon with holes, the method computes an arrangement of the input edges, labels each face according to what it represents (exterior, polygon interior or hole), and reconstructs the polygon(s) represented by the arrangement. The method returns valid output stored in a multipolygon with holes. -Different arrangement and labelling heuristics are possible, but -currently only the even-odd rule is implemented in this package. -This rule results in areas that are alternately assigned as polygon +Different labeling heuristics are possible. This package offers +the even-odd rule, the non-zero rule, the union rule, +as well as the intersection rule. +The even-odd rule results in areas that are alternately assigned as polygon interiors and exterior/holes each time that an input edge is passed. It does not distinguish between edges that are part of outer boundaries -from those of inner boundaries. In a next version we will add the -winding number rule. +from those of inner boundaries. +The non-zero rule results in areas with a non-zero winding number. +The union and intersection rules are useful when given +two or more similar valid polygons with holes. +The union rule results in areas that are contained in at least one of the input polygons with holes. +Similarly, the intersection rule results in areas that are contained in all input polygons with holes. \section SectionPolygonRepair_Definitions Definitions @@ -63,7 +68,51 @@ Invalid: (a) self-intersecting polygon self-intersection, (b) self-touching poly with overlapping polygons, and (h) multipolygon with polygons that touch at an edge. \cgalFigureEnd -\subsection SubsectionPolygonRepair_Output Stricter Conditions for Output + +\section SectionPolygonRepair_EvenOdd Even-Odd and Non-Zero Rule + +While the even-odd rule switches between inside/outside at each edge only taking +into account multiplicity, the non-zero rule takes also into account +the orientation of the edge. + +For some configurations this leads to different results, as can be seen in the figure below. + +\cgalFigureBegin{WindingNonZeroDifferent, WindingNonZeroDifferent.svg} +Input (left), non-zero (middle) even-odd (right). +\cgalFigureEnd + +And there are other configurations where the two rules lead to the same result. + +\cgalFigureBegin{WindingNonZero, WindingNonZero.svg} +Input (left), non-zero and even-odd (right). +\cgalFigureEnd + +A valid polygon with holes, obviously has the same result with both rules applied +as it is just the identity. However an invalid multipolygon with one polygon +enclosing the other one results in the union of the two, that is the enclosing one +for the non-zero rule, while it results in a polygon with hole for the even-odd rule. + +\cgalFigureBegin{MultipolygonHole, MultipolygonHole.svg} +Input (left), non-zero (middle) even-odd (right). +\cgalFigureEnd + +\section SectionPolygonRepair_UnionIntersection Union and Intersection Rule + +Given several valid polygons these rules apply a %Boolean operation: +In the arrangement of two valid multipolygons with holes, the faces that are in any and both multipolygons +with holes are in the resulting multipolygon with holes for a union and intersection, respectively. + +While this %Boolean operation works for any two valid multipolygons, in the scope of repairing +it serves to obtain an approximation from outside and inside when applying union and intersection, respectively, +when the input is similar. + +\cgalFigureBegin{UnionIntersection, UnionIntersection.svg} +Union (top) and Intersection (bottom). +\cgalFigureEnd + + + +\section SubsectionPolygonRepair_Output Notes on the Output The conditions listed above are sufficient to define valid polygons, polygons with holes and multipolygons with holes for most applications. However, in @@ -81,64 +130,10 @@ order - The polygons with holes of a multipolygon with holes are also stored in lexicographic order -\section SectionPolygonRepair_Algorithm Algorithm - -Broadly, the algorithm consists of three steps: - --# Arrangement: the edges in the polygon, polygon with -holes or multipolygon with holes are added as edges in the arrangement. --# Labeling of the faces: the resulting faces are labeled with ids -according to what they represent (exterior, polygon interior or hole). --# Reconstruction of the multipolygon: each boundary is reconstructed, -then these are assembled into individual polygons with holes and put into a -single multipolygon with holes. - -\cgalFigureBegin{inout, inout.svg} -Examples of polygons with holes (a-d) and multipolygons with holes -(e-h) before (left) and after (right) being repaired. -\cgalFigureEnd - -\subsection SubsectionPolygonRepair_Arrangement Arrangement - -For the purposes of the repair operation, the input polygon, polygon with holes -or multipolygon is merely used as a container of input line segments. These line -segments are added to the arrangement as edges. Internally, this is done using -a constrained triangulation where they are added as constraints. - -With the even-odd rule, only the edges that are present an odd number of -times in the input will be edges in the final arrangement. -When these edges are only partially overlapping, only the parts that overlap -an odd number of times will be edges in the final arrangement. - -This procedure is done in two steps: 1. preprocessing to eliminate identical -edges that are present an even number of times, and 2. adding edges incrementally -while applying an even-odd counting mechanism, which erases existing (parts of) -edges when new overlapping ones are added. - -\subsection SubsectionPolygonRepair_Labeling Labeling - -First, the polygon exterior is labeled. For this, all of the faces that can be -accessed from the exterior without passing through an edge are labeled as exterior -faces. - -Then, all other faces are labeled. For the even-odd rule, the label applied -alternates between polygon interior and hole every time that an edge is passed. - -\subsection SubsectionPolygonRepair_Reconstruction Reconstruction of the Multipolygon - -The algorithm reconstructs the multipolygon boundary by boundary, obtaining -counter-clockwise cycles for outer boundaries and clockwise cycles for inner -boundaries. Once all boundaries have been reconstructed, the boundaries are assembled -into multipolygons using the face labels to know which polygon with holes inner/outer -boundaries belong to, and using the orientation to distinguish between the outer and -inner boundaries of each polygon with holes. - -\subsection SubsectionPolygonRepair_Notes Notes on the Output If the input is already valid, the method will return a valid output representing the same area. However, the output might be different in order to conform to the -stricter conditions to generate deterministic output (see -\ref SubsectionPolygonRepair_Output). +stricter conditions to generate deterministic output. Also, it is worth noting that even the repair of a single polygon without holes but with self-intersections can result in a multipolygon with holes. This is why @@ -146,9 +141,11 @@ the repair function will always return a multipolygon with holes. The user can then check whether it consists of a single polygon with holes, and if a polygon with holes has zero holes and extract these if needed. + + \section SectionPolygonRepair_Examples Examples -\subsection SubsectionPolygonRepair_Repair Repairing a (Multi)polygon +\subsection SubsectionPolygonRepair_Repair Repairing a (Multi)polygon with the Even-Odd Rule It is possible to repair a polygon, polygon with holes or multipolygon with holes using the even-odd rule by calling the `Polygon_repair::repair()` function @@ -183,6 +180,8 @@ to edges, which enables correct counting even on partially overlapping edges. Ken Arroyo Ohori developed this package during the Google Summer of Code 2023 mentored by Sébastien Loriot and Andreas Fabri. +The GSoC project was limited to the even-odd rule. Further rules were added +with CGAL 6.1 by Andreas Fabri. */ } /* namespace CGAL */ diff --git a/Polygon_repair/doc/Polygon_repair/dependencies b/Polygon_repair/doc/Polygon_repair/dependencies index 6df3ace8d07..f5c7866adae 100644 --- a/Polygon_repair/doc/Polygon_repair/dependencies +++ b/Polygon_repair/doc/Polygon_repair/dependencies @@ -4,4 +4,5 @@ STL_Extension Algebraic_foundations Circulator Stream_support -Polygon \ No newline at end of file +Polygon +Triangulation_2 diff --git a/Polygon_repair/doc/Polygon_repair/examples.txt b/Polygon_repair/doc/Polygon_repair/examples.txt index e7d63a06e20..3ae4d468ea4 100644 --- a/Polygon_repair/doc/Polygon_repair/examples.txt +++ b/Polygon_repair/doc/Polygon_repair/examples.txt @@ -1,4 +1,6 @@ /*! \example Polygon_repair/repair_polygon_2.cpp +\example Polygon_repair/repair_non_zero_polygon_2.cpp \example Polygon_repair/repair_multipolygon_2.cpp +\example Polygon_repair/repair_union_intersect_2.cpp */ diff --git a/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.ipe b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.ipe new file mode 100644 index 00000000000..6da403058d4 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.ipe @@ -0,0 +1,564 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +64 528 m +64 464 l +192 464 l +192 528 l +h +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 528 m +64 464 l +192 464 l +192 528 l +h + + +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +64 528 m +64 464 l + + +96 480 m +160 480 l + + +160 480 m +160 512 l + + +160 512 m +96 512 l + + +96 512 m +96 480 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +64 528 m +64 464 l + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +480 512 m +544 512 l + + +544 512 m +544 480 l + + +544 480 m +480 480 l + + +448 528 m +448 464 l + + +480 480 m +480 512 l + + +256 464 m +384 464 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h + + +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +64 528 m +64 464 l + + +96 656 m +96 688 l + + +96 688 m +160 688 l + + +160 688 m +160 656 l + + +160 656 m +96 656 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +480 512 m +544 512 l + + +544 512 m +544 480 l + + +544 480 m +480 480 l + + +448 528 m +448 464 l + + +480 480 m +480 512 l + + +64 528 m +64 464 l +192 464 l +192 528 l +h +96 512 m +96 480 l +160 480 l +160 512 l +h + + +64 464 m +192 464 l + + +192 464 m +192 528 l + + +192 528 m +64 528 l + + +480 512 m +544 512 l + + +544 512 m +544 480 l + + +544 480 m +480 480 l + + +448 528 m +448 464 l + + +480 480 m +480 512 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.svg b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.svg new file mode 100644 index 00000000000..fb0747ad459 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/MultipolygonHole.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.ipe b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.ipe new file mode 100644 index 00000000000..5d9ad8bfc53 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.ipe @@ -0,0 +1,446 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +138.353 615.529 m +201.6 633.6 l +229.895 638.316 l +261.333 629.333 l +304 608 l +317.333 613.333 l +336 608 l +432 640 l +480 640 l +501.333 645.333 l +544 624 l +544 592 l +496 592 l +464 576 l +448 576 l +408 560 l +368 560 l +276.364 546.909 l +256 552 l +256 560 l +208 560 l +200 552 l +176 544 l +130.286 562.286 l +112 576 l +138.353 615.529 l + + +96 720 m +130.286 706.286 l +176 672 l +200 696 l +224 704 l +256 696 l +256 688 l +276.364 690.909 l +288 688 l +368 688 l +408 704 l +432 704 l +464 720 l +512 720 l +544 736 l +560 736 l +544 800 l +501.333 789.333 l +480 800 l +432 784 l +384 784 l +317.333 757.333 l +261.333 773.333 l +240 784 l +229.895 782.316 l +224 784 l +201.6 777.6 l +144 768 l +138.353 759.529 l +112 752 l +96 720 l + + +112 720 m +176 672 l +208 704 l +256 704 l +256 688 l +368 704 l +432 704 l +496 736 l +560 736 l +544 800 l +480 784 l +384 784 l +304 752 l +240 784 l +144 768 l +112 720 l + + +96 720 m +176 688 l +224 704 l +288 688 l +368 688 l +448 720 l +512 720 l +544 736 l +544 768 l +480 800 l +336 752 l +224 784 l +112 752 l +96 720 l + + +112 720 m +176 672 l +208 704 l +256 704 l +256 688 l +368 704 l +432 704 l +496 736 l +560 736 l +544 800 l +480 784 l +384 784 l +304 752 l +240 784 l +144 768 l +112 720 l + + +96 720 m +176 688 l +224 704 l +288 688 l +368 688 l +448 720 l +512 720 l +544 736 l +544 768 l +480 800 l +336 752 l +224 784 l +112 752 l +96 720 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.svg b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.svg new file mode 100644 index 00000000000..5374b62ecce --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/UnionIntersection.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.ipe b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.ipe new file mode 100644 index 00000000000..131a5919dcc --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.ipe @@ -0,0 +1,515 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +64 704 m +192 704 l +192 768 l +64 768 l +h +32 752 m +128 752 l +128 720 l +32 720 l +h + + +64 704 m +192 704 l + + +192 704 m +192 768 l + + +192 768 m +64 768 l + + +64 768 m +64 704 l + + +128 720 m +32 720 l + + +32 720 m +32 752 l + + +32 752 m +128 752 l + + +128 752 m +128 720 l + + +384 640 m +256 640 l +256 592 l +320 592 l +320 576 l +304 576 l +304 608 l +384 608 l +h + + +384 528 m +256 528 l + + +256 528 m +256 480 l + + +256 480 m +320 480 l + + +320 480 m +320 464 l + + +320 464 m +304 464 l + + +304 464 m +304 496 l + + +304 496 m +384 496 l + + +384 496 m +384 528 l + + +384 640 m +256 640 l +256 592 l +320 592 l +320 576 l +304 576 l +304 608 l +384 608 l +h + + +384 528 m +256 528 l + + +256 528 m +256 480 l + + +304 496 m +384 496 l + + +384 496 m +384 528 l + + +64 704 m +192 704 l +192 768 l +64 768 l +h +32 752 m +128 752 l +128 720 l +32 720 l +h + + +64 704 m +192 704 l + + +192 704 m +192 768 l + + +192 768 m +64 768 l + + +256 592 m +304 592 l + + +304 592 m +304 608 l + + +304 576 m +320 576 l + + +320 576 m +320 592 l + + +320 592 m +304 592 l + + +304 592 m +304 576 l + + +256 768 m +256 752 l + + +256 752 m +320 752 l + + +320 752 m +320 720 l + + +320 720 m +256 720 l + + +256 720 m +256 704 l + + +224 720 m +256 720 l + + +256 720 m +256 752 l + + +256 752 m +224 752 l + + +224 752 m +224 720 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.svg b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.svg new file mode 100644 index 00000000000..75d37586db8 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZero.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.ipe b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.ipe new file mode 100644 index 00000000000..47617b1dcc9 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.ipe @@ -0,0 +1,650 @@ + + + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + +0.6 0 0 0.6 0 0 e + + + + + +0.5 0 0 0.5 0 0 e + + +0.6 0 0 0.6 0 0 e +0.4 0 0 0.4 0 0 e + + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h + + + + + +-0.5 -0.5 m +0.5 -0.5 l +0.5 0.5 l +-0.5 0.5 l +h + + +-0.6 -0.6 m +0.6 -0.6 l +0.6 0.6 l +-0.6 0.6 l +h +-0.4 -0.4 m +0.4 -0.4 l +0.4 0.4 l +-0.4 0.4 l +h + + + + + + +-0.43 -0.57 m +0.57 0.43 l +0.43 0.57 l +-0.57 -0.43 l +h + + +-0.43 0.57 m +0.57 -0.43 l +0.43 -0.57 l +-0.57 0.43 l +h + + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-0.8 0 l +-1 -0.333 l +h + + + + +-1 0.333 m +0 0 l +-1 -0.333 l + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0 0 m +-1 0.333 l +-1 -0.333 l +h +-1 0 m +-2 0.333 l +-2 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +0.5 0 m +-0.5 0.333 l +-0.3 0 l +-0.5 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + +1 0 m +0 0.333 l +0 -0.333 l +h +0 0 m +-1 0.333 l +-1 -0.333 l +h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +304 576 m +384 576 l +384 640 l +256 640 l +256 592 l +304 592 l +h + + +256 688 m +384 688 l +384 768 l +304 768 l +304 752 l +256 752 l +h +272 736 m +304 736 l +304 720 l +368 720 l +368 704 l +272 704 l +h + + +256 688 m +384 688 l + + +384 688 m +384 768 l + + +368 720 m +368 704 l + + +368 704 m +272 704 l + + +272 704 m +272 736 l + + +256 752 m +256 688 l + + +336 752 m +256 752 l +256 688 l +384 688 l +384 768 l +304 768 l +304 720 l +368 720 l +368 704 l +272 704 l +272 736 l +336 736 l +h + + +256 688 m +384 688 l + + +384 688 m +384 768 l + + +384 768 m +304 768 l + + +304 768 m +304 720 l + + +304 720 m +368 720 l + + +368 720 m +368 704 l + + +368 704 m +272 704 l + + +272 704 m +272 736 l + + +256 752 m +256 688 l + + +384 640 m +256 640 l + + +256 640 m +256 592 l + + +304 576 m +384 576 l + + +384 576 m +384 640 l + + +192 640 m +64 640 l +64 592 l +128 592 l +128 608 l +112 608 l +112 576 l +192 576 l +h + + +384 640 m +256 640 l + + +256 640 m +256 592 l + + +304 608 m +304 576 l + + +304 576 m +384 576 l + + +384 576 m +384 640 l + + +336 752 m +256 752 l +256 688 l +384 688 l +384 768 l +304 768 l +304 720 l +368 720 l +368 704 l +272 704 l +272 736 l +336 736 l +h + + +256 688 m +384 688 l + + +384 688 m +384 768 l + + +384 768 m +304 768 l + + +304 768 m +304 720 l + + +304 720 m +368 720 l + + +368 720 m +368 704 l + + +368 704 m +272 704 l + + +272 704 m +272 736 l + + +272 736 m +336 736 l + + +336 736 m +336 752 l + + +336 752 m +256 752 l + + +256 752 m +256 688 l + + +384 768 m +304 768 l + + +272 736 m +304 736 l + + +304 736 m +304 720 l + + +304 720 m +368 720 l + + +304 768 m +304 752 l + + +304 752 m +256 752 l + + +496 768 m +496 752 l + + +496 752 m +528 752 l + + +528 752 m +528 736 l + + +528 736 m +496 736 l + + +464 736 m +496 736 l + + +496 736 m +496 752 l + + +496 752 m +448 752 l + + +192 640 m +64 640 l +64 592 l +128 592 l +128 608 l +112 608 l +112 576 l +192 576 l +h + + +384 640 m +256 640 l + + +256 640 m +256 592 l + + +256 592 m +320 592 l + + +320 592 m +320 608 l + + +320 608 m +304 608 l + + +304 608 m +304 576 l + + +304 576 m +384 576 l + + +384 576 m +384 640 l + + +512 592 m +496 592 l + + +496 592 m +496 608 l + + +496 608 m +512 608 l + + +512 608 m +512 592 l + + +448 592 m +496 592 l + + +256 592 m +304 592 l + + +304 592 m +304 576 l + + + diff --git a/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.svg b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.svg new file mode 100644 index 00000000000..537b74fa694 --- /dev/null +++ b/Polygon_repair/doc/Polygon_repair/fig/WindingNonZeroDifferent.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Polygon_repair/examples/Polygon_repair/CMakeLists.txt b/Polygon_repair/examples/Polygon_repair/CMakeLists.txt index 93722bb7c3b..3453a093f10 100644 --- a/Polygon_repair/examples/Polygon_repair/CMakeLists.txt +++ b/Polygon_repair/examples/Polygon_repair/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_repair_Examples) -find_package(CGAL REQUIRED) +find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) # create a target per cppfile file( @@ -13,4 +13,11 @@ file( ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") -endforeach() \ No newline at end of file +endforeach() + + + +if(CGAL_Qt6_FOUND) + target_link_libraries(repair_non_zero_polygon_2 PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(repair_union_intersect_2 PUBLIC CGAL::CGAL_Basic_viewer) +endif() diff --git a/Polygon_repair/examples/Polygon_repair/data/winding.wkt b/Polygon_repair/examples/Polygon_repair/data/winding.wkt new file mode 100644 index 00000000000..6fd39f4923c --- /dev/null +++ b/Polygon_repair/examples/Polygon_repair/data/winding.wkt @@ -0,0 +1 @@ +POLYGON((0 0, 10 0, 10 6, 6 6, 6 4 , 10 4, 10 10, 0 10)) \ No newline at end of file diff --git a/Polygon_repair/examples/Polygon_repair/repair_non_zero_polygon_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_non_zero_polygon_2.cpp new file mode 100644 index 00000000000..3ce04501ab0 --- /dev/null +++ b/Polygon_repair/examples/Polygon_repair/repair_non_zero_polygon_2.cpp @@ -0,0 +1,37 @@ +#include +#include +#include + +#include +#include +#include +#ifdef CGAL_USE_BASIC_VIEWER +#include +#endif + +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using Point_2 = Kernel::Point_2; +using Polygon_2 = CGAL::Polygon_2; +using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; +using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + +int main(int argc, char* argv[]) { + + const char* filename = (argc > 1) ? argv[1] : "data/winding.wkt"; + + std::ifstream in(filename); + Polygon_with_holes_2 pin; + CGAL::IO::read_polygon_WKT(in, pin); + + Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(pin, CGAL::Polygon_repair::Non_zero_rule()); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mp); +#endif + + if (mp.number_of_polygons_with_holes() > 1) { + CGAL::IO::write_multi_polygon_WKT(std::cout, mp); + } else { + CGAL::IO::write_polygon_WKT(std::cout, mp.polygons_with_holes()[0]); + } + return 0; +} diff --git a/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp new file mode 100644 index 00000000000..bec35767d1c --- /dev/null +++ b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp @@ -0,0 +1,72 @@ +#include + +#include +#include + +#ifdef CGAL_USE_BASIC_VIEWER +#include +#endif + +#include + +#include + + +#include +#include + +using K = CGAL::Exact_predicates_inexact_constructions_kernel; + +using Point_2 = K::Point_2; +using Polygon_2 = CGAL::Polygon_2; +using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; +using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + +int +main(int argc, char* argv[]) +{ + Multipolygon_with_holes_2 pA; + if (argc == 2) { + { + std::ifstream in(argv[1]); + CGAL::IO::read_multi_polygon_WKT(in, pA); + } + } else { + std::istringstream is("MULTIPOLYGON( ((0 0, 20 0, 20 20, 0 20), (1 1, 1 19, 19 19, 19 1) ) , (( 10 -2, 12 -2, 12 22, 10 22)) )"); + //std::istringstream is("MULTIPOLYGON( ((0 0, 2 0, 2 3, 0 3) ) )"); // (0.1 0.1, 0.1 0.4, 0.4 0.1) + CGAL::IO::read_multi_polygon_WKT(is, pA); + } + + Multipolygon_with_holes_2 mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Union_rule()); + { + std::ofstream out("union.wkt"); + CGAL::IO::write_multi_polygon_WKT(out, mpwh); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mpwh); +#endif + } + mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Intersection_rule()); + { + std::ofstream out("intersection.wkt"); + CGAL::IO::write_multi_polygon_WKT(out, mpwh); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mpwh); +#endif + } + + { + Polygon_2 pB; + pB.push_back(Point_2(-1,-1)); + pB.push_back(Point_2(1,-1)); + pB.push_back(Point_2(1,1)); + pB.push_back(Point_2(-1,1)); + mpwh = CGAL::Polygon_repair::join(mpwh, pB); + + std::ofstream out("joinn.wkt"); + CGAL::IO::write_multi_polygon_WKT(out, mpwh); +#ifdef CGAL_USE_BASIC_VIEWER + CGAL::draw(mpwh); +#endif + } + return 0; +} diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h b/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h new file mode 100644 index 00000000000..a726139d70d --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h @@ -0,0 +1,396 @@ +// Copyright (c) 2024 GeometryFactory SARL (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_BOOLEAN_H +#define CGAL_POLYGON_REPAIR_BOOLEAN_H + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +namespace CGAL { +namespace Polygon_repair { + +/*! +\ingroup PkgTriangulation2Miscellaneous + +\tparam Kernel must be +*/ + +template +class Boolean { + +private: + struct FaceInfo { + + FaceInfo() + {} + + int label; + int layers; + bool processed; + + template + bool + in_domain(const Fct& fct) const + { + return fct(layers); + } + + }; + + using K = Kernel; + using Container = Container_; + using Point_2 = typename K::Point_2; + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + + using Itag = std::conditional_t, Exact_predicates_tag, Exact_intersections_tag>; + using Vb = CGAL::Triangulation_vertex_base_2; + using Fbb = CGAL::Triangulation_face_base_with_info_2; + using Fb = CGAL::Constrained_triangulation_face_base_2; + using Tds = CGAL::Triangulation_data_structure_2; + using CDT = CGAL::Constrained_Delaunay_triangulation_2; + using CDTplus = CGAL::Constrained_triangulation_plus_2; + using Face_handle = typename CDTplus::Face_handle; + using Face_circulator = typename CDTplus::Face_circulator; + using Vertex_handle = typename CDTplus::Vertex_handle; + using Constraint_id = typename CDTplus::Constraint_id; + using Edge = typename CDTplus::Edge; + using Context = typename CDTplus::Context; + + + // @todo taken from Polygon_repair should be factorized + struct Polygon_less { + + bool + operator()(const Polygon_2& pa, const Polygon_2& pb) const + { + typename Polygon_2::Vertex_iterator va = pa.vertices_begin(); + typename Polygon_2::Vertex_iterator vb = pb.vertices_begin(); + while (va != pa.vertices_end() && vb != pb.vertices_end()) { + if (*va != *vb) return *va < *vb; + ++va; + ++vb; + } + if (vb == pb.vertices_end()) return false; + return true; + } + + }; + + + // @todo taken from Polygon_repair should be factorized + struct Polygon_with_holes_less { + Polygon_less pl; + + bool + operator()(const Polygon_with_holes_2& pa, const Polygon_with_holes_2& pb) const + { + if (pl(pa.outer_boundary(), pb.outer_boundary())) return true; + if (pl(pb.outer_boundary(), pa.outer_boundary())) return false; + typename Polygon_with_holes_2::Hole_const_iterator ha = pa.holes_begin(); + typename Polygon_with_holes_2::Hole_const_iterator hb = pb.holes_begin(); + while (ha != pa.holes_end() && hb != pb.holes_end()) { + if (pl(*ha, *hb)) return true; + if (pl(*hb, *ha)) return false; + } + if (hb == pb.holes_end()) return false; + return true; + } + + }; + + + CDTplus cdt; + +public: + +/*! +default constructor. +*/ + Boolean() = default; + + +/*! +sets the polygons as input of the %Boolean operation. +*/ + void + insert(const Polygon_2& pA) + { + cdt.insert_constraint(pA.vertices_begin(), pA.vertices_end(), true); + } + + + void + insert(const Polygon_with_holes_2& pwh) + { + cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + + void + insert(const Multipolygon_with_holes_2& pA) + { + for(const auto& pwh : pA.polygons_with_holes()){ + cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + } +private: + + void + mark_domains(Face_handle start, + int index, + std::list& border) + { + if(start->info().layers != -1){ + return; + } + std::list queue; + queue.push_back(start); + + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + if(fh->info().layers == -1){ + fh->info().layers = index; + for(int i = 0; i < 3; i++){ + Edge e(fh,i); + Face_handle n = fh->neighbor(i); + if(n->info().layers == -1){ + if(cdt.is_constrained(e)){ + border.push_back(e); + }else{ + queue.push_back(n); + } + } + } + } + } + } + + public: + // this marks how many multipolygon interiors overlap a cell of the arrangement of mutipolygons + void + mark_domains() + { + for(Face_handle f : cdt.all_face_handles()){ + f->info().layers = -1; + } + + int overlays = 0; + std::list border; + mark_domains(cdt.infinite_face(), overlays, border); + + while(! border.empty()){ + Edge e = border.front(); + border.pop_front(); + Face_handle fh = e.first; + int fi = e.second; + Face_handle n = fh->neighbor(fi); + if(n->info().layers == -1){ + Vertex_handle u = fh->vertex(cdt.cw(fi)), v = fh->vertex(cdt.ccw(fi)); + int delta = 0; + for(Context c : cdt.contexts(u,v)){ + if(*c.current() ==u && *std::next(c.current()) == v){ + ++delta; + }else if(*c.current() ==v && *std::next(c.current()) == u){ + --delta; + }else{ + CGAL_assertion(false); + } + } + mark_domains(n, fh->info().layers+delta, border); + } + } + } + +private: + template + void + label_domain(Face_handle start, int label, const Fct& fct) + { + std::list queue; + start->info().label = label; + queue.push_back(start); + + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + + for(int i = 0; i < 3; i++){ + Face_handle n = fh->neighbor(i); + if(n->info().in_domain(fct)){ + if(n->info().label == 0){ + n->info().label = label; + queue.push_back(n); + } + } + } + } + } + + // this marks the domain for the Boolean operation applied on the two multipolygons + template + int + label_domains(const Fct& fct) + { + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + face->info().label = 0; + } + int label = 1; + for (auto const face: cdt.all_face_handles()) { + if(face->info().in_domain(fct) && face->info().label == 0){ + label_domain(face, label, fct); + ++label; + } + } + return label; + } + + + + // @todo taken from Polygon_repair and adapted; might be factorized + // Reconstruct ring boundary starting from an edge (face + opposite vertex) that is part of it + template + void + reconstruct_ring(std::list& ring, + Face_handle face_adjacent_to_boundary, + int opposite_vertex, + const Fct& CGAL_assertion_code(fct)) + { + // Create ring + Face_handle current_face = face_adjacent_to_boundary; + int current_opposite_vertex = opposite_vertex; + CGAL_assertion(face_adjacent_to_boundary->info().in_domain(fct)); + do { + CGAL_assertion(current_face->info().in_domain(fct) == face_adjacent_to_boundary->info().in_domain(fct)); + current_face->info().processed = true; + Vertex_handle pivot_vertex = current_face->vertex(current_face->cw(current_opposite_vertex)); + // std::cout << "\tAdding point " << pivot_vertex->point() << std::endl; + ring.push_back(pivot_vertex->point()); + Face_circulator fc = cdt.incident_faces(pivot_vertex, current_face); + do { + ++fc; + } while (fc->info().label != current_face->info().label); + current_face = fc; + current_opposite_vertex = fc->cw(fc->index(pivot_vertex)); + } while (current_face != face_adjacent_to_boundary || + current_opposite_vertex != opposite_vertex); + + // Start at lexicographically smallest vertex + typename std::list::iterator smallest_vertex = ring.begin(); + for (typename std::list::iterator current_vertex = ring.begin(); + current_vertex != ring.end(); ++current_vertex) { + if (*current_vertex < *smallest_vertex) smallest_vertex = current_vertex; + } + if (ring.front() != *smallest_vertex) { + ring.splice(ring.begin(), ring, smallest_vertex, ring.end()); + } + } + + +public: + + // @todo taken from Polygon_repair and adapted; might be factorized + +/*! +performs the Boolean operation applying `fct` and returns the result as a multipolygon with holes. + +\tparam Fct must have the operator `bool operator()(bool, bool)`. +*/ + template + Multipolygon_with_holes_2 + operator()(const Fct& fct) + { + int number_of_polygons = label_domains(fct) - 1; + Multipolygon_with_holes_2 mp; + std::vector polygons; // outer boundaries + std::vector> holes; // holes are ordered (per polygon) + polygons.resize(number_of_polygons); + holes.resize(number_of_polygons); + + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + } + + for (auto const &face: cdt.finite_face_handles()) { + if (! face->info().in_domain(fct)) continue; // exterior triangle + if (face->info().processed) continue; // already reconstructed + for (int opposite_vertex = 0; opposite_vertex < 3; ++opposite_vertex) { + if (face->info().in_domain(fct) == face->neighbor(opposite_vertex)->info().in_domain(fct)) continue; // not adjacent to boundary + + // Reconstruct ring + std::list ring; + reconstruct_ring(ring, face, opposite_vertex, fct); + + // Put ring in polygons + Polygon_2 polygon; + polygon.reserve(ring.size()); + polygon.insert(polygon.vertices_end(), ring.begin(), ring.end()); + if (polygon.orientation() == CGAL::COUNTERCLOCKWISE) { + polygons[face->info().label-1] = std::move(polygon); + } else { + holes[face->info().label-1].insert(std::move(polygon)); + } break; + } + } + + // Create polygons with holes and put in multipolygon + std::set ordered_polygons; + for (std::size_t i = 0; i < polygons.size(); ++i) { + ordered_polygons.insert(Polygon_with_holes_2(std::move(polygons[i]), + std::make_move_iterator(holes[i].begin()), + std::make_move_iterator(holes[i].end()))); + } + for (auto const& polygon: ordered_polygons) { + mp.add_polygon_with_holes(std::move(polygon)); + } + return mp; + } + + +/*! +access to the underlying constrained triangulation. +*/ + const CDTplus& + triangulation() const + { + return cdt; + } + +}; + + + +} // namespace Polygon_repair +} //namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_BOOLEAN_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h index b2dc51bfe36..372fb2479ee 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/Even_odd_rule.h @@ -18,11 +18,15 @@ namespace CGAL { namespace Polygon_repair { -/// \addtogroup PkgPolygonRepairRef +/// \addtogroup PkgPolygonRepairRules /// @{ /*! Tag class to select the even odd rule when calling `CGAL::Polygon_repair::repair()`. + The even-odd rule results in areas that are alternately assigned as polygon +interiors and exterior/holes each time that an input edge is passed. +It does not distinguish between edges that are part of outer boundaries +from those of inner boundaries. */ struct Even_odd_rule {}; diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Intersection_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Intersection_rule.h new file mode 100644 index 00000000000..7c2984b3c2d --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Intersection_rule.h @@ -0,0 +1,38 @@ +// Copyright (c) 2024 GeometryFactory. +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_INTERSECTION_RULE_H +#define CGAL_POLYGON_REPAIR_INTERSECTION_RULE_H + +#include + +namespace CGAL { + +namespace Polygon_repair { + +/// \addtogroup PkgPolygonRepairRules +/// @{ + +/*! + Tag class to select the %intersection rule when calling `CGAL::Polygon_repair::repair()`. + The intersection rule are useful when given +two or more similar valid polygons with holes. +The intersection rule results in areas that are contained in all input polygons with holes. + */ + struct Intersection_rule {}; + +///@} + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_INTERSECTION_RULE_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Non_zero_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Non_zero_rule.h new file mode 100644 index 00000000000..8df2f32ad61 --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Non_zero_rule.h @@ -0,0 +1,36 @@ +// Copyright (c) 2024 GeometryFactory. +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_NON_ZERO_RULE_H +#define CGAL_POLYGON_REPAIR_NON_ZERO_RULE_H + +#include + +namespace CGAL { + +namespace Polygon_repair { + +/// \addtogroup PkgPolygonRepairRules +/// @{ + +/*! + Tag class to select the non zero rule when calling `CGAL::Polygon_repair::repair()`. + The non-zero rule results in areas with a non-zero winding number. + */ + struct Non_zero_rule {}; + +///@} + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_NON_ZERO_RULE_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Union_rule.h b/Polygon_repair/include/CGAL/Polygon_repair/Union_rule.h new file mode 100644 index 00000000000..fbba8d1cbed --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Union_rule.h @@ -0,0 +1,37 @@ +// Copyright (c) 2024 GeometryFactory. +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_UNION_RULE_H +#define CGAL_POLYGON_REPAIR_UNION_RULE_H + +#include + +namespace CGAL { + +namespace Polygon_repair { + +/// \addtogroup PkgPolygonRepairRules +/// @{ + +/*! + Tag class to select the %union rule when calling `CGAL::Polygon_repair::repair()`. + The union rules are useful when given two or more similar valid polygons with holes. +The union rule results in areas that are contained in at least one of the input polygons with holes. + */ + struct Union_rule {}; + +///@} + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_UNION_RULE_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Winding.h b/Polygon_repair/include/CGAL/Polygon_repair/Winding.h new file mode 100644 index 00000000000..c40865c67e7 --- /dev/null +++ b/Polygon_repair/include/CGAL/Polygon_repair/Winding.h @@ -0,0 +1,354 @@ +// Copyright (c) 2024 GeometryFactory SARL (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_POLYGON_REPAIR_WINDING_H +#define CGAL_POLYGON_REPAIR_WINDING_H + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +namespace CGAL { +namespace Polygon_repair { + +#ifndef DOXYGEN_RUNNING +/* +\ingroup PkgPolygonRepairFunctions + +\tparam Kernel must be +*/ + +template +class Winding { + +private: + struct FaceInfo { + + FaceInfo() + {} + + int wind; + int label; + int nesting_level[2]; + bool processed; + + bool + in_domain(int i) const + { + return nesting_level[i] % 2 == 1; + } + + template + bool + in_domain(const Fct& fct) const + { + return fct(in_domain(0), in_domain(1)); + } + + }; + + using K = Kernel; + using Point_2 = typename K::Point_2; + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using Multipolygon_with_holes_2 = CGAL::Multipolygon_with_holes_2; + + using Itag = std::conditional_t, Exact_predicates_tag, Exact_intersections_tag>; + using Vb = CGAL::Triangulation_vertex_base_2; + using Fbb = CGAL::Triangulation_face_base_with_info_2; + using Fb = CGAL::Constrained_triangulation_face_base_2; + using Tds = CGAL::Triangulation_data_structure_2; + using CDT = CGAL::Constrained_Delaunay_triangulation_2; + using CDTplus = CGAL::Constrained_triangulation_plus_2; + using Face_handle = typename CDTplus::Face_handle; + using Face_circulator = typename CDTplus::Face_circulator; + using Vertex_handle = typename CDTplus::Vertex_handle; + using Constraint_id = typename CDTplus::Constraint_id; + using Edge = typename CDTplus::Edge; + using Context = typename CDTplus::Context; + + CDTplus cdt; + constexpr static int uninitialized = std::numeric_limits::lowest(); + + + struct Polygon_less { + bool operator()(const Polygon_2& pa, const Polygon_2& pb) const { + typename Polygon_2::Vertex_iterator va = pa.vertices_begin(); + typename Polygon_2::Vertex_iterator vb = pb.vertices_begin(); + while (va != pa.vertices_end() && vb != pb.vertices_end()) { + if (*va != *vb) return *va < *vb; + ++va; + ++vb; + } + if (vb == pb.vertices_end()) return false; + return true; + } + }; + + struct Polygon_with_holes_less { + Polygon_less pl; + bool operator()(const Polygon_with_holes_2& pa, const Polygon_with_holes_2& pb) const { + if (pl(pa.outer_boundary(), pb.outer_boundary())) return true; + if (pl(pb.outer_boundary(), pa.outer_boundary())) return false; + typename Polygon_with_holes_2::Hole_const_iterator ha = pa.holes_begin(); + typename Polygon_with_holes_2::Hole_const_iterator hb = pb.holes_begin(); + while (ha != pa.holes_end() && hb != pb.holes_end()) { + if (pl(*ha, *hb)) return true; + if (pl(*hb, *ha)) return false; + } + if (hb == pb.holes_end()) return false; + return true; + } + }; + +public: + +/*! +default constructor. +*/ + Winding() = default; + + +/*! +sets the polygon as input of the winding number computation. +*/ + void + insert(const Polygon_2& p) + { + Constraint_id cidA = cdt.insert_constraint(p.vertices_begin(), p.vertices_end(), true); + } + +/*! +sets the polygon as input of the winding number computation. +*/ + void + insert(const Polygon_with_holes_2& pwh) + { + Constraint_id cidA = cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cidA = cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + +/*! +sets the polygon as input of the winding number computation. +*/ + void + insert(const Multipolygon_with_holes_2& mpwh) + { + for(const auto& pwh : mpwh.polygons_with_holes()){ + Constraint_id cidA = cdt.insert_constraint(pwh.outer_boundary().vertices_begin(), pwh.outer_boundary().vertices_end(), true); + for(auto const& hole : pwh.holes()){ + cidA = cdt.insert_constraint(hole.vertices_begin(), hole.vertices_end(), true); + } + } + } + + void label(Face_handle f, int index, std::list>& border) + { + std::list queue; + queue.push_back(f); + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + fh->info().wind = index; + for(int i = 0; i < 3; i++){ + Edge e(fh,i); + Face_handle n = fh->neighbor(i); + if(! cdt.is_constrained(e)){ + if(n->info().wind != index){ + queue.push_back(n); + } + }else{ + if(n->info().wind == uninitialized){ + Vertex_handle u = e.first->vertex(cdt.cw(e.second)); + Vertex_handle v = e.first->vertex(cdt.ccw(e.second)); + int delta = 0; + for(Context c : cdt.contexts(u,v)){ + if(*c.current() ==u && *std::next(c.current()) == v){ + ++delta; + }else if(*c.current() ==v && *std::next(c.current()) == u){ + --delta; + }else{ + CGAL_assertion(false); + } + } + border.push_back(std::make_pair(Edge(n,n->index(fh)),index+delta)); + } + } + } + } + } + + void label() + { + std::list> border; + for(Face_handle f : cdt.all_face_handles()){ + f->info().wind = uninitialized; + } + int index = 0; + label(cdt.infinite_face(),index++, border); + while(! border.empty()){ + Edge e; + int wind; + std::tie(e,wind) = border.front(); + border.pop_front(); + if(e.first->info().wind == uninitialized){ + label(e.first, wind,border); + }else{ + CGAL_assertion(e.first->info().wind == wind); + } + } + } + + void + label_domain(Face_handle start, int label) + { + std::list queue; + queue.push_back(start); + + while(! queue.empty()){ + Face_handle fh = queue.front(); + queue.pop_front(); + fh->info().label = label; + + for(int i = 0; i < 3; i++){ + Face_handle n = fh->neighbor(i); + if(n->info().wind != 0 && n->info().label == 0){ + queue.push_back(n); + } + } + } + } + + int + label_domains() + { + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + face->info().label = 0; + } + int label = 1; + for (auto const face: cdt.all_face_handles()) { + if(face->info().wind != 0 && face->info().label == 0){ + label_domain(face, label); + ++label; + } + } + return label; + } + + void + reconstruct_ring(std::list& ring, + Face_handle face_adjacent_to_boundary, + int opposite_vertex) + { + // Create ring + Face_handle current_face = face_adjacent_to_boundary; + int current_opposite_vertex = opposite_vertex; + CGAL_assertion(face_adjacent_to_boundary->info().wind != 0); + do { + current_face->info().processed = true; + Vertex_handle pivot_vertex = current_face->vertex(current_face->cw(current_opposite_vertex)); + // std::cout << "\tAdding point " << pivot_vertex->point() << std::endl; + ring.push_back(pivot_vertex->point()); + Face_circulator fc = cdt.incident_faces(pivot_vertex, current_face); + do { + ++fc; + } while (fc->info().label != current_face->info().label); + current_face = fc; + current_opposite_vertex = fc->cw(fc->index(pivot_vertex)); + } while (current_face != face_adjacent_to_boundary || + current_opposite_vertex != opposite_vertex); + + // Start at lexicographically smallest vertex + typename std::list::iterator smallest_vertex = ring.begin(); + for (typename std::list::iterator current_vertex = ring.begin(); + current_vertex != ring.end(); ++current_vertex) { + if (*current_vertex < *smallest_vertex) smallest_vertex = current_vertex; + } + if (ring.front() != *smallest_vertex) { + ring.splice(ring.begin(), ring, smallest_vertex, ring.end()); + } + } + + Multipolygon_with_holes_2 + operator()() + { + int number_of_polygons = label_domains() - 1; + + Multipolygon_with_holes_2 mp; + std::vector polygons; // outer boundaries + std::vector> holes; // holes are ordered (per polygon) + polygons.resize(number_of_polygons); + holes.resize(number_of_polygons); + + for (auto const face: cdt.all_face_handles()) { + face->info().processed = false; + } + + for (auto const &face: cdt.finite_face_handles()) { + if (face->info().wind==0) continue; // exterior triangle + if (face->info().processed) continue; // already reconstructed + for (int opposite_vertex = 0; opposite_vertex < 3; ++opposite_vertex) { + + if ((face->info().wind != 0) == (face->neighbor(opposite_vertex)->info().wind != 0)) continue; // not adjacent to boundary + + // Reconstruct ring + std::list ring; + reconstruct_ring(ring, face, opposite_vertex); + + // Put ring in polygons + Polygon_2 polygon; + polygon.reserve(ring.size()); + polygon.insert(polygon.vertices_end(), ring.begin(), ring.end()); + if (polygon.orientation() == CGAL::COUNTERCLOCKWISE) { + polygons[face->info().label-1] = std::move(polygon); + } else { + holes[face->info().label-1].insert(std::move(polygon)); + } break; + } + } + + // Create polygons with holes and put in multipolygon + std::set ordered_polygons; + for (std::size_t i = 0; i < polygons.size(); ++i) { + ordered_polygons.insert(Polygon_with_holes_2(std::move(polygons[i]), + std::make_move_iterator(holes[i].begin()), + std::make_move_iterator(holes[i].end()))); + } + for (auto const& polygon: ordered_polygons) { + mp.add_polygon_with_holes(std::move(polygon)); + } + return mp; + } + +}; + +#endif + +} // namespace Polygon_repair + +} // namespace CGAL + +#endif // CGAL_POLYGON_REPAIR_WINDING_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h b/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h index e75be739e61..1203d1882a2 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/internal/Triangulation_with_even_odd_constraints_2.h @@ -9,8 +9,8 @@ // // Author(s) : Ken Arroyo Ohori -#ifndef CGAL_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H -#define CGAL_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H +#ifndef CGAL_POLYGON_REPAIR_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H +#define CGAL_POLYGON_REPAIR_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H #include #include @@ -124,4 +124,4 @@ public: } // namespace Polygon_repair } // namespace CGAL -#endif // CGAL_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H +#endif // CGAL_POLYGON_REPAIR_TRIANGULATION_WITH_EVEN_ODD_CONSTRAINTS_2_H diff --git a/Polygon_repair/include/CGAL/Polygon_repair/repair.h b/Polygon_repair/include/CGAL/Polygon_repair/repair.h index f6f2e84cfee..03961636059 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/repair.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/repair.h @@ -24,9 +24,14 @@ #include #include #include +#include +#include +#include #include #include +#include +#include namespace CGAL { @@ -39,9 +44,9 @@ class Polygon_repair; /// \ingroup PkgPolygonRepairFunctions /// repairs polygon `p` using the given rule -/// \tparam Kernel parameter of the input and output polygons +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` /// \tparam Container parameter of the input and output polygons -/// \tparam Rule must be `Even_odd_rule` +/// \tparam Rule must be `Even_odd_rule` or `Non_zero_rule` template Multipolygon_with_holes_2 repair(const Polygon_2& p , Rule = Rule()) { @@ -56,9 +61,9 @@ Multipolygon_with_holes_2 repair(const Polygon_2 Multipolygon_with_holes_2 repair(const Polygon_with_holes_2& p, Rule = Rule()) { @@ -71,11 +76,24 @@ Multipolygon_with_holes_2 repair(const Polygon_with_holes_2 +Multipolygon_with_holes_2 repair(const Polygon_with_holes_2& p, Non_zero_rule) +{ + Winding winding; + winding.insert(p); + winding.label(); + winding.label_domains(); + return winding(); +} + + /// \ingroup PkgPolygonRepairFunctions /// repairs multipolygon with holes `p` using the given rule -/// \tparam Kernel parameter of the input and output polygons +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` /// \tparam Container parameter of the input and output polygons -/// \tparam Rule must be `Even_odd_rule` +/// \tparam Rule may be any \ref PkgPolygonRepairRules +/// \pre If the rule is the `Union_rule` or `Non_zero_rule`, each polygon with hole must be free of self-intersections template Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Rule = Rule()) { @@ -88,6 +106,61 @@ Multipolygon_with_holes_2 repair(const Multipolygon_with_hole } return pr.multipolygon(); } + +template +Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Union_rule) +{ + struct Larger_than_zero { + bool operator()(int i) const + { + return i > 0; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(p); + bops.mark_domains(); + Larger_than_zero ltz; + return bops(ltz); +} + + +template +Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Intersection_rule) +{ + struct Equal { + int val; + Equal(int val) + : val(val) + {} + + bool operator()(int i) const + { + return i == val; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(p); + bops.mark_domains(); + Equal equal(p.number_of_polygons_with_holes()); + return bops(equal); +} + +/* +template +Multipolygon_with_holes_2 repair(const Multipolygon_with_holes_2& p, Non_zero_rule rule) +{ + static_assert(std::is_same_v); + CGAL::Polygon_repair::Polygon_repair pr; + pr.add_to_triangulation_even_odd(p); + if (pr.triangulation().number_of_faces() > 0) { + pr.label_triangulation_even_odd(); + pr.reconstruct_multipolygon(); + } return pr.multipolygon(); +} +*/ + template bool is_valid(const Polygon_2& polygon) { if (polygon.vertices().size() < 3) { @@ -514,7 +587,7 @@ public: static void label_region(T& tt, Face_handle face, int label, std::list& to_check, std::list& to_check_added_by) { - // std::cout << "Labelling region with " << label << std::endl; + // std::cout << "Labeling region with " << label << std::endl; std::list to_check_in_region; face->label() = label; to_check_in_region.push_back(face); @@ -712,6 +785,127 @@ protected: #endif // DOXYGEN_RUNNING + + +/// \ingroup PkgPolygonRepairFunctions +/// computes the union of all polygons with holes in `p` +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \pre Each polygon with hole must be free of self-intersections +template +Multipolygon_with_holes_2 +join(const Multipolygon_with_holes_2& pa) +{ + struct Larger_than_zero { + bool operator()(int i) const + { + return i > 0; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(pa); + bops.mark_domains(); + Larger_than_zero ltz; + return bops(ltz); +} + +/// \ingroup PkgPolygonRepairFunctions +/// computes the union of two polygonal domains +/// \tparam Kernel parameter of the output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \tparam PA must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \tparam PB must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \pre The polygons `pa` and `pb` must be free of self-intersections +template +#ifdef DOXYGEN_RUNNING +Multipolygon_with_holes_2 +#else +decltype(auto) +#endif +join(const PA& pa, const PB& pb, const Kernel& = Default(), const Container& = Default()) +{ + typedef typename Default::Get::type Traits; + typedef typename Default::Get::type Container_; + + struct Larger_than_zero { + bool operator()(int i) const + { + return i > 0; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(pa); + bops.insert(pb); + bops.mark_domains(); + Larger_than_zero ltz; + return bops(ltz); +} + + +/// \ingroup PkgPolygonRepairFunctions +/// computes the intersection of all polygons with holes in `p` +/// \tparam Kernel parameter of the input and output polygons. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \pre Each polygon with hole must be free of self-intersections +template +Multipolygon_with_holes_2 +intersect(const Multipolygon_with_holes_2& p) +{ + struct Equal { + int val; + Equal(int val) + : val(val) + {} + + bool operator()(int i) const + { + return i == val; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(p); + bops.mark_domains(); + Equal equal(p.number_of_polygons_with_holes()); + return bops(equal); +} + + +/// \ingroup PkgPolygonRepairFunctions +/// computes the intersection of two polygonal domains +/// \tparam Kernel parameter of the output polygon. Must be model of `ConstrainedDelaunayTriangulationTraits_2 ` +/// \tparam Container parameter of the input and output polygons +/// \tparam PA must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \tparam PB must be `Polygon_2`, or `Polygon_with_holes_2`, or `Multipolygon_with_holes_2` +/// \pre The polygons `pa` and `pb` must be free of self-intersections +template +#ifdef DOXYGEN_RUNNING +Multipolygon_with_holes_2 +#else +decltype(auto) +#endif +intersect(const PA& pa, const PB& pb, const Kernel& = Default(), const Container& = Default()) +{ + typedef typename Default::Get::type Traits; + typedef typename Default::Get::type Container_; + + struct Equal { + bool operator()(int i) const + { + return i == 2; + } + }; + + CGAL::Polygon_repair::Boolean bops; + bops.insert(pa); + bops.insert(pb); + bops.mark_domains(); + Equal equal; + return bops(equal); +} + } // namespace Polygon_repair } // namespace CGAL diff --git a/Polygon_repair/package_info/Polygon_repair/dependencies b/Polygon_repair/package_info/Polygon_repair/dependencies index 8231db1007e..517729e1d03 100644 --- a/Polygon_repair/package_info/Polygon_repair/dependencies +++ b/Polygon_repair/package_info/Polygon_repair/dependencies @@ -20,3 +20,4 @@ Spatial_sorting Stream_support TDS_2 Triangulation_2 +BGL diff --git a/Polygon_repair/test/Polygon_repair/CMakeLists.txt b/Polygon_repair/test/Polygon_repair/CMakeLists.txt index a1564d5dd16..1ec7a341fc2 100644 --- a/Polygon_repair/test/Polygon_repair/CMakeLists.txt +++ b/Polygon_repair/test/Polygon_repair/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygon_repair_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index c2a83f6adaf..677cfe1d36f 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygonal_surface_reconstruction_Examples) diff --git a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt index 343c6c9bf8f..43ee357b3b4 100644 --- a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polygonal_surface_reconstruction_Tests) diff --git a/Polyhedron/doc/Polyhedron/PackageDescription.txt b/Polyhedron/doc/Polyhedron/PackageDescription.txt index 7369093e05d..f0033c7efd7 100644 --- a/Polyhedron/doc/Polyhedron/PackageDescription.txt +++ b/Polyhedron/doc/Polyhedron/PackageDescription.txt @@ -13,7 +13,6 @@ /*! \addtogroup PkgPolyhedronRef -\todo check generated documentation \cgalPkgDescriptionBegin{3D Polyhedral Surface,PkgPolyhedron} \cgalPkgPicture{Polyhedron-teaser-small.png} \cgalPkgSummaryBegin diff --git a/Polyhedron/examples/Polyhedron/CMakeLists.txt b/Polyhedron/examples/Polyhedron/CMakeLists.txt index 3bd3c35604f..aa94d1a604a 100644 --- a/Polyhedron/examples/Polyhedron/CMakeLists.txt +++ b/Polyhedron/examples/Polyhedron/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyhedron_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polyhedron/test/Polyhedron/CMakeLists.txt b/Polyhedron/test/Polyhedron/CMakeLists.txt index 731cae0763b..d84cec3bf76 100644 --- a/Polyhedron/test/Polyhedron/CMakeLists.txt +++ b/Polyhedron/test/Polyhedron/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyhedron_Tests) find_package(CGAL REQUIRED) diff --git a/Polyline_simplification_2/benchmark/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/benchmark/Polyline_simplification_2/CMakeLists.txt new file mode 100644 index 00000000000..5c6747a2883 --- /dev/null +++ b/Polyline_simplification_2/benchmark/Polyline_simplification_2/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.12...3.29) +project(Polyline_simplification_2_Benchmarks) + +# Add Google Benchmark +find_package(benchmark REQUIRED) + +# Add CGAL +find_package(CGAL REQUIRED) + +add_executable(benchmark_simplify benchmark_simplify.cpp) +target_link_libraries(benchmark_simplify PRIVATE benchmark::benchmark CGAL::CGAL CGAL::Data) diff --git a/Polyline_simplification_2/benchmark/Polyline_simplification_2/benchmark_simplify.cpp b/Polyline_simplification_2/benchmark/Polyline_simplification_2/benchmark_simplify.cpp new file mode 100644 index 00000000000..6b78ba89142 --- /dev/null +++ b/Polyline_simplification_2/benchmark/Polyline_simplification_2/benchmark_simplify.cpp @@ -0,0 +1,98 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace PS = CGAL::Polyline_simplification_2; + +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Polygon_2 = CGAL::Polygon_2; +using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + +using Vb = PS::Vertex_base_2; +using Fb = CGAL::Constrained_triangulation_face_base_2; +using TDS = CGAL::Triangulation_data_structure_2; +using CDT = CGAL::Constrained_Delaunay_triangulation_2; +using CT = CGAL::Constrained_triangulation_plus_2; +using Stop = PS::Stop_below_count_ratio_threshold; +using Cost = PS::Squared_distance_cost; + +static void BM_Simplify(benchmark::State& state, std::string filename) { + using Point_2 = K::Point_2; + using MultiPoint = std::vector; + + using LineString = std::vector; + using MultiLineString = std::deque; + + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; + using MultiPolygon = std::deque; + + std::ifstream ifs(filename); + MultiPoint points; + MultiLineString polylines; + MultiPolygon polygons; + if(!CGAL::IO::read_WKT(ifs, points, polylines, polygons) && false) { + state.SkipWithError("Cannot read file " + filename); + return; + } + + state.counters["#points"] = points.size(); + state.counters["#polylines"] = polylines.size(); + state.counters["#polygons"] = polygons.size(); + + CT ct; + for(const auto& point : points) { + ct.insert(point); + } + for(const auto& polyline : polylines) { + ct.insert_constraint(polyline); + } + for(const auto& polygon_with_holes : polygons) { + const Polygon_2& outer_polygon = polygon_with_holes.outer_boundary(); + ct.insert_constraint(outer_polygon); + for(Polygon_with_holes_2::Hole_const_iterator it = polygon_with_holes.holes_begin(); + it != polygon_with_holes.holes_end(); ++it) + { + const Polygon_2& hole = *it; + ct.insert_constraint(hole); + } + } + + state.counters["nb of constraints"] = ct.number_of_constraints(); + state.counters["nb of vertices"] = ct.number_of_vertices(); + state.counters["nb of sub-constraints"] = ct.number_of_subconstraints(); + + for([[maybe_unused]] auto _ : state) { + state.PauseTiming(); + CT ct_copy = ct; // Copy the object `ct` in the loop + state.ResumeTiming(); + PS::simplify(ct_copy, Cost(), Stop(0.5)); + } +} + +int main(int argc, char** argv) { + std::string filename = CGAL::data_file_path("wkt/norway-MP.wkt"); + if(argc > 1) { + std::string_view arg1{argv[1]}; + if(arg1.size() < 2 || arg1[0] != '-' || arg1[1] != '-') { + --argc; + ++argv; + filename = arg1; + } + } + benchmark::RegisterBenchmark("simplify file " + filename, BM_Simplify, filename); + benchmark::Initialize(&argc, argv); + benchmark::RunSpecifiedBenchmarks(); + benchmark::Shutdown(); +} diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt index 97f1671d671..9f5b6aa8870 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyline_simplification_2_Demo) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt index 11ced7973c1..e0f8fe666df 100644 --- a/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/examples/Polyline_simplification_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyline_simplification_2_Examples) find_package(CGAL REQUIRED) diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h index 198928e2145..9e7fe636d01 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h @@ -154,8 +154,11 @@ public: (*it)->set_removable(false); ++it; for(; it != ite; ++it){ - if((std::next(it) != ite) && (std::prev(it)== std::next(it))){ - (*it)->set_removable(false); + if(std::next(it) != ite){ + Vertex_handle vp = *std::prev(it), vn = *std::next(it); + if(vp == vn){ + (*it)->set_removable(false); + } } } it = std::prev(it); diff --git a/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt index 6099c152bd8..3ef613d9a83 100644 --- a/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/test/Polyline_simplification_2/CMakeLists.txt @@ -1,12 +1,13 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polyline_simplification_2_Tests) # CGAL and its components find_package(CGAL REQUIRED) create_single_source_cgal_program( "issue-5774.cpp" ) +create_single_source_cgal_program( "issue-8735.cpp" ) create_single_source_cgal_program( "simplify_polygon_test.cpp" ) create_single_source_cgal_program( "simplify_polyline_with_duplicate_points.cpp" ) diff --git a/Polyline_simplification_2/test/Polyline_simplification_2/issue-8735.cpp b/Polyline_simplification_2/test/Polyline_simplification_2/issue-8735.cpp new file mode 100644 index 00000000000..11f2cb75643 --- /dev/null +++ b/Polyline_simplification_2/test/Polyline_simplification_2/issue-8735.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +namespace PS = CGAL::Polyline_simplification_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel K; +typedef PS::Vertex_base_2 Vb; +typedef CGAL::Constrained_triangulation_face_base_2 Fb; +typedef CGAL::Triangulation_data_structure_2 TDS; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Constrained_triangulation_plus_2 CT; +typedef CT::Point Point; +typedef PS::Stop_above_cost_threshold Stop; +typedef PS::Squared_distance_cost Cost; + +int main() +{ + double tolerance = 100; + CT ct; + std::vector pts; + + pts.push_back(CT::Point(0, 0)); + pts.push_back(CT::Point(2, 0)); + pts.push_back(CT::Point(1, 0)); + pts.push_back(CT::Point(3, 0)); + pts.push_back(CT::Point(4, 1)); + tolerance = 100; + ct.insert_constraint(pts.begin(), pts.end(), false); + + PS::simplify(ct, Cost(), Stop(tolerance * tolerance), false); + + return 0; +} diff --git a/Polynomial/doc/Polynomial/PackageDescription.txt b/Polynomial/doc/Polynomial/PackageDescription.txt index 0f1de49b78b..96273a5ada8 100644 --- a/Polynomial/doc/Polynomial/PackageDescription.txt +++ b/Polynomial/doc/Polynomial/PackageDescription.txt @@ -9,7 +9,6 @@ /// \ingroup PkgPolynomialRef /*! \addtogroup PkgPolynomialRef -\todo check generated documentation \cgalPkgDescriptionBegin{Polynomial,PkgPolynomial} \cgalPkgPicture{Polynomial.png} \cgalPkgSummaryBegin diff --git a/Polynomial/examples/Polynomial/CMakeLists.txt b/Polynomial/examples/Polynomial/CMakeLists.txt index 330d6653e99..5b6244410d9 100644 --- a/Polynomial/examples/Polynomial/CMakeLists.txt +++ b/Polynomial/examples/Polynomial/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polynomial_Examples) find_package(CGAL REQUIRED) diff --git a/Polynomial/test/Polynomial/CMakeLists.txt b/Polynomial/test/Polynomial/CMakeLists.txt index e39eb04c74b..85669731c54 100644 --- a/Polynomial/test/Polynomial/CMakeLists.txt +++ b/Polynomial/test/Polynomial/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polynomial_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt b/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt index aaecb2b37da..b49377cf9ed 100644 --- a/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt +++ b/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt @@ -4,7 +4,6 @@ /*! \addtogroup PkgPolytopeDistanceDRef -\todo check generated documentation \cgalPkgDescriptionBegin{Optimal Distances,PkgPolytopeDistanceD} \cgalPkgPicture{dist.png} \cgalPkgSummaryBegin diff --git a/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt b/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt index 20a8fde663f..5635786cc3a 100644 --- a/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt +++ b/Polytope_distance_d/examples/Polytope_distance_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polytope_distance_d_Examples) find_package(CGAL REQUIRED) diff --git a/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt b/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt index 12ea05b9a05..f229a4a3fc8 100644 --- a/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt +++ b/Polytope_distance_d/test/Polytope_distance_d/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Polytope_distance_d_Tests) find_package(CGAL REQUIRED) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index 9f3d7cbefb7..bfcf7dcc124 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling the PCA demo. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Principal_component_analysis_Demo) include_directories(./) diff --git a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt index c1640a1188d..03acad4f33b 100644 --- a/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt +++ b/Principal_component_analysis/doc/Principal_component_analysis/PackageDescription.txt @@ -17,7 +17,6 @@ /*! \addtogroup PkgPrincipalComponentAnalysisDRef -\todo check generated documentation \cgalPkgDescriptionBegin{Principal Component Analysis,PkgPrincipalComponentAnalysisD} \cgalPkgPicture{teaserLeastSquaresFitting.png} \cgalPkgSummaryBegin diff --git a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt index a7b0a40595b..13cdc5491b6 100644 --- a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Principal_component_analysis_Examples) find_package(CGAL REQUIRED) diff --git a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt index 5541cb45dff..1de7c904d88 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Principal_component_analysis_Tests) find_package(CGAL REQUIRED) diff --git a/Profiling_tools/examples/Profiling_tools/CMakeLists.txt b/Profiling_tools/examples/Profiling_tools/CMakeLists.txt index d43577af955..003528dd134 100644 --- a/Profiling_tools/examples/Profiling_tools/CMakeLists.txt +++ b/Profiling_tools/examples/Profiling_tools/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Profiling_tools_Examples) find_package(CGAL REQUIRED) diff --git a/Profiling_tools/test/Profiling_tools/CMakeLists.txt b/Profiling_tools/test/Profiling_tools/CMakeLists.txt index e366a8e9b9d..be4a6179e39 100644 --- a/Profiling_tools/test/Profiling_tools/CMakeLists.txt +++ b/Profiling_tools/test/Profiling_tools/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Profiling_tools_Tests) find_package(CGAL REQUIRED) diff --git a/Property_map/examples/Property_map/CMakeLists.txt b/Property_map/examples/Property_map/CMakeLists.txt index 79bb8862815..8e54346059c 100644 --- a/Property_map/examples/Property_map/CMakeLists.txt +++ b/Property_map/examples/Property_map/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Property_map_Examples) # CGAL and its components diff --git a/Property_map/test/Property_map/CMakeLists.txt b/Property_map/test/Property_map/CMakeLists.txt index a51a39b66d0..bd35081602c 100644 --- a/Property_map/test/Property_map/CMakeLists.txt +++ b/Property_map/test/Property_map/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Property_map_Tests) # CGAL and its components diff --git a/QP_solver/doc/QP_solver/PackageDescription.txt b/QP_solver/doc/QP_solver/PackageDescription.txt index e63fc8a3310..0da82f7f3b6 100644 --- a/QP_solver/doc/QP_solver/PackageDescription.txt +++ b/QP_solver/doc/QP_solver/PackageDescription.txt @@ -72,7 +72,6 @@ Programs can be written to an output stream in MPSFormat, using one of the follo /*! \addtogroup PkgQPSolverRef -\todo check generated documentation \cgalPkgDescriptionBegin{Linear and Quadratic Programming Solver,PkgQPSolver} \cgalPkgPicture{qp.png} \cgalPkgSummaryBegin diff --git a/QP_solver/examples/QP_solver/CMakeLists.txt b/QP_solver/examples/QP_solver/CMakeLists.txt index 530025ed487..29636c20e0b 100644 --- a/QP_solver/examples/QP_solver/CMakeLists.txt +++ b/QP_solver/examples/QP_solver/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(QP_solver_Examples) find_package(CGAL REQUIRED) diff --git a/QP_solver/test/QP_solver/CMakeLists.txt b/QP_solver/test/QP_solver/CMakeLists.txt index bf4d78ee26d..e113c1a0a72 100644 --- a/QP_solver/test/QP_solver/CMakeLists.txt +++ b/QP_solver/test/QP_solver/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(QP_solver_Tests) find_package(CGAL REQUIRED) diff --git a/Random_numbers/test/Random_numbers/CMakeLists.txt b/Random_numbers/test/Random_numbers/CMakeLists.txt index 9b06ba31570..3a3141fb5d9 100644 --- a/Random_numbers/test/Random_numbers/CMakeLists.txt +++ b/Random_numbers/test/Random_numbers/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Random_numbers_Tests) find_package(CGAL REQUIRED) diff --git a/Ridges_3/doc/Ridges_3/PackageDescription.txt b/Ridges_3/doc/Ridges_3/PackageDescription.txt index d34109ac8e3..5c06986a879 100644 --- a/Ridges_3/doc/Ridges_3/PackageDescription.txt +++ b/Ridges_3/doc/Ridges_3/PackageDescription.txt @@ -5,7 +5,6 @@ /*! \addtogroup PkgRidges3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{Approximation of Ridges and Umbilics on Triangulated Surface Meshes,PkgRidges3} \cgalPkgPicture{RidgesMechPartDetail.png} \cgalPkgSummaryBegin diff --git a/Ridges_3/examples/Ridges_3/CMakeLists.txt b/Ridges_3/examples/Ridges_3/CMakeLists.txt index 6eab0514fad..a3bcb30ed91 100644 --- a/Ridges_3/examples/Ridges_3/CMakeLists.txt +++ b/Ridges_3/examples/Ridges_3/CMakeLists.txt @@ -1,5 +1,5 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Ridges_3_Examples) find_package(CGAL REQUIRED) diff --git a/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h b/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h index c3e5aefec98..72f9add2cb7 100644 --- a/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h +++ b/Ridges_3/examples/Ridges_3/PolyhedralSurf_rings.h @@ -64,7 +64,7 @@ T_PolyhedralSurf_rings(const TPoly& P) { //init the ring_index_map Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for(;itb!=ite;itb++) ring_index_map[*itb] = -1; } diff --git a/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h b/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h index 775fec7d89d..5d4c57f7b43 100644 --- a/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h +++ b/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h @@ -158,7 +158,7 @@ T_PolyhedralSurf_neighbors(const TriangleMesh& P) { //init the is_visited_map Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for(;itb!=ite;itb++) is_visited_map[*itb] = false; } diff --git a/Ridges_3/include/CGAL/Ridges.h b/Ridges_3/include/CGAL/Ridges.h index d4052642864..c52aef7081b 100644 --- a/Ridges_3/include/CGAL/Ridges.h +++ b/Ridges_3/include/CGAL/Ridges.h @@ -336,7 +336,7 @@ Ridge_approximation(const TriangleMesh &p, { //init the is_visited_map and check that the mesh is a triangular one. face_iterator itb,ite; - boost::tie(itb,ite) = faces(P); + std::tie(itb,ite) = faces(P); for(;itb!=ite;itb++) { is_visited_map[*itb] = false; } @@ -411,10 +411,10 @@ compute_ridges(Ridge_interrogation_type r_type, OutputIterator ridge_lines_it, R //reinit the is_visited_map face_iterator itb,ite; - boost::tie(itb,ite) = faces(P); + std::tie(itb,ite) = faces(P); for(;itb!=ite;itb++) is_visited_map[*itb] = false; - boost::tie(itb,ite) = faces(P); + std::tie(itb,ite) = faces(P); for(;itb!=ite;itb++) { face_descriptor f = *itb; diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index f815b9c18ca..e56e0f000b8 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -184,7 +184,7 @@ compute(OutputIterator umbilics_it, FT size) //MAIN loop on P vertices Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for (;itb != ite; itb++) { vertex_descriptor vh = *itb; umbilicEstimatorVertex = cgal_abs(get(k1,vh)-get(k2,vh)); diff --git a/Ridges_3/test/Ridges_3/CMakeLists.txt b/Ridges_3/test/Ridges_3/CMakeLists.txt index 9e7305e6953..e61df02393c 100644 --- a/Ridges_3/test/Ridges_3/CMakeLists.txt +++ b/Ridges_3/test/Ridges_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Ridges_3_Tests) find_package(CGAL REQUIRED) diff --git a/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h b/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h index c3e5aefec98..72f9add2cb7 100644 --- a/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h +++ b/Ridges_3/test/Ridges_3/PolyhedralSurf_rings.h @@ -64,7 +64,7 @@ T_PolyhedralSurf_rings(const TPoly& P) { //init the ring_index_map Vertex_const_iterator itb, ite; - boost::tie(itb,ite) = vertices(P); + std::tie(itb,ite) = vertices(P); for(;itb!=ite;itb++) ring_index_map[*itb] = -1; } diff --git a/SMDS_3/examples/SMDS_3/CMakeLists.txt b/SMDS_3/examples/SMDS_3/CMakeLists.txt index c00acbc0408..77d7ba6b6a8 100644 --- a/SMDS_3/examples/SMDS_3/CMakeLists.txt +++ b/SMDS_3/examples/SMDS_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(SMDS_3_Examples) diff --git a/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h b/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h index 92272897094..9f26f6f3b29 100644 --- a/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h +++ b/SMDS_3/include/CGAL/Compact_simplicial_mesh_cell_base_3.h @@ -47,20 +47,7 @@ public: public: // Constructors - Compact_simplicial_mesh_cell_3() - : time_stamp_(std::size_t(-1)) - {} - - Compact_simplicial_mesh_cell_3(const Compact_simplicial_mesh_cell_3& rhs) - : N(rhs.N) - , V(rhs.V) - , time_stamp_(rhs.time_stamp_) - , subdomain_index_(rhs.subdomain_index_) - { - for(int i=0; i <4; i++){ - surface_index_table_[i] = rhs.surface_index_table_[i]; - } - } + Compact_simplicial_mesh_cell_3() = default; Compact_simplicial_mesh_cell_3(Vertex_handle v0, Vertex_handle v1, @@ -279,7 +266,7 @@ private: std::array N; std::array V; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); // The index of the cell of the input complex that contains me Subdomain_index subdomain_index_ = {}; diff --git a/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h b/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h index e7363047a92..9d3aa0c5d22 100644 --- a/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h +++ b/SMDS_3/include/CGAL/IO/File_binary_mesh_3.h @@ -46,14 +46,13 @@ save_binary_file(std::ostream& os, , bool binary = true) #endif { - typedef typename C3T3::Triangulation::Geom_traits::FT FT; if(binary) os << "binary "; os << "CGAL c3t3 " << CGAL::Get_io_signature()() << "\n"; if(binary) { CGAL::IO::set_binary_mode(os); } else { CGAL::IO::set_ascii_mode(os); - os.precision(std::numeric_limits::digits10+2); + os.precision(std::numeric_limits::max_digits10); } return !!(os << c3t3); // call operator!() twice, because operator bool() is C++11 diff --git a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h index db0cc2fa28d..6255bb26104 100644 --- a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h +++ b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h @@ -973,7 +973,7 @@ private: typedef typename Vertex_map_iterator_first::reference pointer; typedef typename iterator_adaptor_::reference reference; - Vertex_map_iterator_first_dereference() : Self::iterator_adaptor_() { } + Vertex_map_iterator_first_dereference() = default; template < typename Iterator > Vertex_map_iterator_first_dereference(Iterator i) @@ -2034,6 +2034,7 @@ Mesh_complex_3_in_triangulation_3:: rescan_after_load_of_triangulation() { corners_.clear(); + far_vertices_.clear(); for(typename Tr::Finite_vertices_iterator vit = this->triangulation().finite_vertices_begin(), end = this->triangulation().finite_vertices_end(); @@ -2041,6 +2042,8 @@ rescan_after_load_of_triangulation() { if ( vit->in_dimension() == 0 ) { add_to_complex(vit, Corner_index(1)); + } else if(vit->in_dimension() == -1) { + far_vertices_.push_back(vit); } } diff --git a/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h b/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h index 7b250380193..da33e68756b 100644 --- a/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h +++ b/SMDS_3/include/CGAL/SMDS_3/tet_soup_to_c3t3.h @@ -611,9 +611,11 @@ bool build_triangulation_from_file(std::istream& is, continue; } - if(line == "Vertices") + if(line.find("Vertices") != std::string::npos) { is >> nv; + if(verbose) + std::cerr << "Reading "<< nv << " vertices" << std::endl; for(int i=0; i> nf; + + if(verbose) + std::cerr << "Reading "<< nf << " triangles" << std::endl; + for(int i=0; i> ntet; + + if(verbose) + std::cerr << "Reading "<< ntet << " tetrahedra" << std::endl; + for(int i=0; i(rhs)), @@ -191,7 +189,7 @@ private: /// Stores surface_index for each facet of the cell std::array surface_index_table_ = {}; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); // The index of the cell of the input complex that contains me Subdomain_index subdomain_index_ = {}; diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h index 96a2377355c..1a15aaf09d7 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_vertex_base_3.h @@ -130,7 +130,6 @@ public: , index_() , dimension_(-1) , cache_validity(false) - , time_stamp_(std::size_t(-1)) {} // Default copy constructor and assignment operator are ok @@ -218,7 +217,7 @@ private: // that contains me. Negative values are a marker for special vertices. short dimension_; bool cache_validity; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); public: friend std::istream& operator>>(std::istream& is, diff --git a/SMDS_3/include/CGAL/facets_in_complex_3_to_triangle_mesh.h b/SMDS_3/include/CGAL/facets_in_complex_3_to_triangle_mesh.h index a6739367e5e..5b664df32d8 100644 --- a/SMDS_3/include/CGAL/facets_in_complex_3_to_triangle_mesh.h +++ b/SMDS_3/include/CGAL/facets_in_complex_3_to_triangle_mesh.h @@ -106,7 +106,7 @@ void facets_in_complex_3_to_triangle_soup(const C3T3& c3t3, resize(f, 3); std::size_t i = 0; - for(typename Tr::Vertex_handle v : c3t3.triangulation().vertices(Facet(c, s))) + for(typename Tr::Vertex_handle v : c3t3.triangulation().vertices(fit)) { CGAL_assertion(v != typename Tr::Vertex_handle()); CGAL_assertion(!c3t3.triangulation().is_infinite(v)); @@ -128,12 +128,12 @@ void facets_in_complex_3_to_triangle_soup(const C3T3& c3t3, if(export_all_facets) { - if((cell_sdi > opp_sdi) == (s%2 == 1)) + if(cell_sdi > opp_sdi) std::swap(f[0], f[1]); } else { - if(((cell_sdi == sd_index) == (s%2 == 1)) == normals_point_outside_of_the_subdomain) + if( (cell_sdi == sd_index) == normals_point_outside_of_the_subdomain) std::swap(f[0], f[1]); } diff --git a/SMDS_3/test/SMDS_3/CMakeLists.txt b/SMDS_3/test/SMDS_3/CMakeLists.txt index 75c24114c88..5e3c56f8260 100644 --- a/SMDS_3/test/SMDS_3/CMakeLists.txt +++ b/SMDS_3/test/SMDS_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(SMDS_3_Tests) find_package(CGAL REQUIRED) diff --git a/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp b/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp index 4373da1fdc0..1270c1d0db8 100644 --- a/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp +++ b/SMDS_3/test/SMDS_3/test_c3t3_with_features.cpp @@ -346,11 +346,10 @@ struct Tester // Test vertex iterators //------------------------------------------------------- std::cout << "Test vertex iterators\n"; - const Vertex_handle& vertex_to_modify = c3t3.vertices_in_complex_begin(); + Vertex_handle vertex_to_modify = c3t3.vertices_in_complex_begin(); Vertex_handle vertex_to_modify_copy = vertex_to_modify; c3t3.remove_from_complex(vertex_to_modify); - // now `vertex_to_modify` is a dangling ref to a `Vertex_handle` // use a copy of it: `vertex_to_modify_copy` c3t3.add_to_complex(vertex_to_modify_copy,corner_index_bis); diff --git a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt index 785873363e7..cfc92cf79eb 100644 --- a/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/compact_container_benchmark/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Compact_container_benchmark) find_package(CGAL REQUIRED) diff --git a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt index beb128ff1da..91adfa06755 100644 --- a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(copy_n_benchmark_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h b/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h index 1c28472d34d..5331aaca8ab 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Iterator_range.h @@ -21,7 +21,7 @@ namespace CGAL { \ingroup PkgSTLExtensionRef `CGAL::Iterator_range` encapsulates two iterators so they fulfill the `ForwardRange` concept. The class is essentially a clone of `boost::iterator_range`, - and it additionally is derived from `std::pair`, so that one can apply `boost::tie`. + and it additionally is derived from `std::pair`, so that one can apply `std::tie`. */ template class Iterator_range diff --git a/STL_Extension/examples/STL_Extension/CMakeLists.txt b/STL_Extension/examples/STL_Extension/CMakeLists.txt index be616289bff..e0124056098 100644 --- a/STL_Extension/examples/STL_Extension/CMakeLists.txt +++ b/STL_Extension/examples/STL_Extension/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(STL_Extension_Examples) find_package(CGAL REQUIRED) diff --git a/STL_Extension/include/CGAL/Base_with_time_stamp.h b/STL_Extension/include/CGAL/Base_with_time_stamp.h index 962eec8a1e1..5e19193c142 100644 --- a/STL_Extension/include/CGAL/Base_with_time_stamp.h +++ b/STL_Extension/include/CGAL/Base_with_time_stamp.h @@ -16,11 +16,11 @@ namespace CGAL { -template -class Base_with_time_stamp : public Base { +template +class Base_with_time_stamp : public B_w_ts_base { std::size_t time_stamp_ = std::size_t(-2); public: - using Base::Base; + using B_w_ts_base::B_w_ts_base; using Has_timestamp = CGAL::Tag_true; @@ -33,7 +33,7 @@ public: template < class TDS > struct Rebind_TDS { - typedef typename Base::template Rebind_TDS::Other Base2; + typedef typename B_w_ts_base::template Rebind_TDS::Other Base2; typedef Base_with_time_stamp Other; }; }; diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 073300c8a82..9b6cb202e93 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -220,6 +220,10 @@ class Compact_container CGAL_INCREMENT_COMPACT_CONTAINER_BLOCK_SIZE> >::type Increment_policy; typedef TimeStamper_ Ts; + + template using EraseCounterStrategy = + internal::Erase_counter_strategy::value>; + typedef Compact_container Self; typedef Compact_container_traits Traits; public: @@ -354,7 +358,7 @@ public: return all_items[block_number].first[index_in_block]; } - friend void swap(Compact_container& a, Compact_container b) { + friend void swap(Compact_container& a, Compact_container b) noexcept { a.swap(b); } @@ -390,22 +394,16 @@ public: // (just forward the arguments to the constructor, to optimize a copy). template < typename... Args > iterator - emplace(const Args&... args) + emplace(Args&&... args) { if (free_list == nullptr) allocate_new_block(); pointer ret = free_list; free_list = clean_pointee(ret); - std::size_t ts; - CGAL_USE(ts); - if constexpr (Time_stamper::has_timestamp) { - ts = ret->time_stamp(); - } - new (ret) value_type(args...); - if constexpr (Time_stamper::has_timestamp) { - ret->set_time_stamp(ts); - } + const auto ts = Time_stamper::time_stamp(ret); + new (ret) value_type(std::forward(args)...); + Time_stamper::restore_timestamp(ret, ts); Time_stamper::set_time_stamp(ret, time_stamp); CGAL_assertion(type(ret) == USED); ++size_; @@ -414,24 +412,7 @@ public: iterator insert(const T &t) { - if (free_list == nullptr) - allocate_new_block(); - - pointer ret = free_list; - free_list = clean_pointee(ret); - std::size_t ts; - CGAL_USE(ts); - if constexpr (Time_stamper::has_timestamp) { - ts = ret->time_stamp(); - } - std::allocator_traits::construct(alloc, ret, t); - if constexpr (Time_stamper::has_timestamp) { - ret->set_time_stamp(ts); - } - Time_stamper::set_time_stamp(ret, time_stamp); - CGAL_assertion(type(ret) == USED); - ++size_; - return iterator(ret, 0); + return emplace(t); } template < class InputIterator > @@ -450,22 +431,14 @@ public: void erase(iterator x) { - typedef internal::Erase_counter_strategy< - internal::has_increment_erase_counter::value> EraseCounterStrategy; + auto ptr = &*x; + CGAL_precondition(type(ptr) == USED); + EraseCounterStrategy::increment_erase_counter(*x); + const auto ts = Time_stamper::time_stamp(ptr); + std::allocator_traits::destroy(alloc, ptr); + Time_stamper::restore_timestamp(ptr, ts); - CGAL_precondition(type(&*x) == USED); - EraseCounterStrategy::increment_erase_counter(*x); - std::size_t ts; - CGAL_USE(ts); - if constexpr (Time_stamper::has_timestamp) { - ts = x->time_stamp(); - } - std::allocator_traits::destroy(alloc, &*x); - if constexpr (Time_stamper::has_timestamp) { - x->set_time_stamp(ts); - } - - put_on_free_list(&*x); + put_on_free_list(ptr); --size_; } @@ -598,25 +571,7 @@ public: while ( capacity_= 1; --i) - put_on_free_list(new_block + i); + auto [new_block, block_size] = all_items[curblock]; + put_block_on_free_list(new_block, block_size - 2); } while ( curblock>lastblock ); } private: - void allocate_new_block(); +std::pair push_back_new_block(); +void put_block_on_free_list(pointer new_block, size_type block_size); + +void allocate_new_block(); void put_on_free_list(pointer x) { @@ -697,7 +654,7 @@ public: static bool is_begin_or_end(const_pointer ptr) { return type(ptr)==START_END; } - void swap(Self &c) + void swap(Self &c) noexcept { std::swap(alloc, c.alloc); std::swap(capacity_, c.capacity_); @@ -803,23 +760,13 @@ void Compact_container::clear() } template < class T, class Allocator, class Increment_policy, class TimeStamper > -void Compact_container::allocate_new_block() +auto Compact_container::push_back_new_block() + -> std::pair { - typedef internal::Erase_counter_strategy< - internal::has_increment_erase_counter::value> EraseCounterStrategy; - pointer new_block = alloc.allocate(block_size + 2); + std::pair result{new_block, block_size}; all_items.push_back(std::make_pair(new_block, block_size + 2)); capacity_ += block_size; - // We don't touch the first and the last one. - // We mark them free in reverse order, so that the insertion order - // will correspond to the iterator order... - for (size_type i = block_size; i >= 1; --i) - { - EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); - Time_stamper::initialize_time_stamp(new_block + i); - put_on_free_list(new_block + i); - } // We insert this new block at the end. if (last_item == nullptr) // First time { @@ -836,8 +783,33 @@ void Compact_container::allocate_ne set_type(last_item, nullptr, START_END); // Increase the block_size for the next time. Increment_policy::increase_size(*this); + return result; } +template < class T, class Allocator, class Increment_policy, class TimeStamper > +void Compact_container:: +put_block_on_free_list(pointer new_block, size_type block_size) +{ + // The block actually has a size==block_size+2. + // We don't touch the first and the last one. + // We mark them free in reverse order, so that the insertion order + // will correspond to the iterator order... + for (size_type i = block_size; i >= 1; --i) + { + EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); + Time_stamper::initialize_time_stamp(new_block + i); + put_on_free_list(new_block + i); + } +} + +template < class T, class Allocator, class Increment_policy, class TimeStamper > +void Compact_container::allocate_new_block() +{ + auto [new_block, block_size] = push_back_new_block(); + put_block_on_free_list(new_block, block_size); +} + + template < class T, class Allocator, class Increment_policy, class TimeStamper > inline bool operator==(const Compact_container &lhs, diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 7f5533f92b7..653ea056e74 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -202,6 +202,9 @@ class Concurrent_compact_container typedef Concurrent_compact_container Self; typedef Concurrent_compact_container_traits Traits; + template using EraseCounterStrategy = + internal::Erase_counter_strategy::value>; + public: typedef CGAL::Time_stamper_impl Time_stamper; typedef Time_stamper Time_stamper_impl; // backward compatibility @@ -344,28 +347,21 @@ public: // (just forward the arguments to the constructor, to optimize a copy). template < typename... Args > iterator - emplace(const Args&... args) + emplace(Args&&... args) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; FreeList * fl = get_free_list(); pointer ret = init_insert(fl); - auto erase_counter = EraseCounterStrategy::erase_counter(*ret);; - new (ret) value_type(args...); - EraseCounterStrategy::set_erase_counter(*ret, erase_counter); + auto erase_counter = EraseCounterStrategy::erase_counter(*ret); + const auto ts = Time_stamper::time_stamp(ret); + new (ret) value_type(std::forward(args)...); + Time_stamper::restore_timestamp(ret, ts); + EraseCounterStrategy::set_erase_counter(*ret, erase_counter); return finalize_insert(ret, fl); } iterator insert(const T &t) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; - FreeList * fl = get_free_list(); - pointer ret = init_insert(fl); - auto erase_counter = EraseCounterStrategy::erase_counter(*ret);; - std::allocator_traits::construct(m_alloc, ret, t); - EraseCounterStrategy::set_erase_counter(*ret, erase_counter); - return finalize_insert(ret, fl); + return emplace(t); } template < class InputIterator > @@ -385,13 +381,13 @@ public: private: void erase(iterator x, FreeList * fl) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; - CGAL_precondition(type(x) == USED); - EraseCounterStrategy::increment_erase_counter(*x); + EraseCounterStrategy::increment_erase_counter(*x); + auto ptr = &*x; + const auto ts = Time_stamper::time_stamp(ptr); std::allocator_traits::destroy(m_alloc, &*x); + Time_stamper::restore_timestamp(ptr, ts); put_on_free_list(&*x, fl); } @@ -778,9 +774,6 @@ template < class T, class Allocator > void Concurrent_compact_container:: allocate_new_block(FreeList * fl) { - typedef CCC_internal::Erase_counter_strategy< - CCC_internal::has_increment_erase_counter::value> EraseCounterStrategy; - size_type old_block_size; pointer new_block; @@ -818,7 +811,7 @@ void Concurrent_compact_container:: // will correspond to the iterator order... for (size_type i = old_block_size; i >= 1; --i) { - EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); + EraseCounterStrategy::set_erase_counter(*(new_block + i), 0); Time_stamper::initialize_time_stamp(new_block + i); put_on_free_list(new_block + i, fl); } diff --git a/STL_Extension/include/CGAL/Has_timestamp.h b/STL_Extension/include/CGAL/Has_timestamp.h index ad608a4f6b6..3fe442576cc 100644 --- a/STL_Extension/include/CGAL/Has_timestamp.h +++ b/STL_Extension/include/CGAL/Has_timestamp.h @@ -36,6 +36,9 @@ namespace internal { // when T does not have a Has_timestamp tag {}; + template + constexpr bool has_timestamp_v = Has_timestamp::value; + } // end namespace internal } // end namespace CGAL diff --git a/STL_Extension/include/CGAL/Iterator_range.h b/STL_Extension/include/CGAL/Iterator_range.h index e42441e9858..2c41f38266a 100644 --- a/STL_Extension/include/CGAL/Iterator_range.h +++ b/STL_Extension/include/CGAL/Iterator_range.h @@ -18,56 +18,36 @@ namespace CGAL { - /*! -\ingroup PkgSTLExtensionRef - /// `CGAL::Iterator_range` is a... - */ - template - class Iterator_range - : public std::pair{ +/*! + \ingroup PkgSTLExtensionRef + `CGAL::Iterator_range` encapsulates two iterators so they fulfill the `ForwardRange` concept. + The class is essentially a clone of `boost::iterator_range`, + and it additionally is derived from `std::pair`, so that one can apply `boost::tie`. +*/ +template +class Iterator_range : public std::pair +{ + typedef std::pair Base; - typedef std::pair Base; +public: + typedef I iterator; + typedef I const_iterator; - public: + Iterator_range() = default; + Iterator_range(I b, I e) + : Base(b, e) {} + Iterator_range(const std::pair& ip) + : Base(ip) {} - typedef I iterator; - typedef I const_iterator; - - Iterator_range(I b, I e) - : Base(b,e) - {} - - - // Iterator_range(const Iterator_range& ip) - // : Base(ip) - // {} - - Iterator_range(const std::pair& ip) - : Base(ip) - {} - - I begin() const - { - return this->first; - } - - I end() const - { - return this->second; - } + I begin() const { return this->first; } + I end() const { return this->second; } /// returns `std::distance(begin(), end())` - std::size_t - size() const - { - return static_cast(std::distance(begin(), end())); - } + std::size_t size() const { return static_cast(std::distance(begin(), end())); } /// returns `std::distance(begin(), end())==0` - bool empty() const - { - return begin()==end(); - } + bool empty() const { return begin() == end(); } operator std::tuple() { @@ -87,37 +67,25 @@ namespace CGAL { } }; - template - Iterator_range - make_range(const T& b, const T&e) - { - return Iterator_range(b,e); - } +template +Iterator_range +make_range(const T& b, const T&e) +{ + return Iterator_range(b,e); +} - template - Iterator_range - make_range(const std::pair& p) - { - return Iterator_range(p.first,p.second); - } +template +Iterator_range +make_range(const std::pair& p) +{ + return Iterator_range(p.first,p.second); +} } // namespace CGAL -// At global scope... - +namespace boost::foreach { template -inline boost::mpl::true_ * - boost_foreach_is_lightweight_proxy( CGAL::Iterator_range *&, boost::foreach::tag ) -{ - return 0; + struct is_lightweight_proxy> : boost::mpl::true_ {}; } -namespace boost { namespace foreach -{ - template - struct is_lightweight_proxy< CGAL::Iterator_range > - : mpl::true_ - { - }; -}} #endif // CGAL_ITERATOR_RANGE_H diff --git a/STL_Extension/include/CGAL/Random_allocator.h b/STL_Extension/include/CGAL/Random_allocator.h new file mode 100644 index 00000000000..6c8b9dd49cf --- /dev/null +++ b/STL_Extension/include/CGAL/Random_allocator.h @@ -0,0 +1,201 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_RANDOM_ALLOCATOR_H +#define CGAL_RANDOM_ALLOCATOR_H + +#include +#include +#include +#include +#include + +#if CGAL_DEBUG_RANDOM_ALLOCATOR +# if __has_include() +# include +# include +# if __cpp_lib_format >= 201907L +# define CGAL_DEBUG_RANDOM_ALLOCATOR_OKAY 1 +# endif +# endif +# if ! CGAL_DEBUG_RANDOM_ALLOCATOR_OKAY +# error "CGAL_DEBUG_RANDOM_ALLOCATOR requires and C++20 std::format" +# endif +#endif + +namespace CGAL { + +// A random allocator that allocates blocks of memory and returns random +// locations. To use only for debugging purposes. That allocator is: +// - not efficient, +// - not thread-safe, +// - and increases memory-fragmentation and non-locality. +template > class Random_allocator +{ + constexpr static std::size_t minimal_block_size = 1024; + constexpr static std::size_t random_size = 64; + + struct Blocks + { + struct Block + { + T* data = nullptr; + boost::dynamic_bitset<> available; + std::size_t maximal_continuous_free_space = 0; + + auto size() const { return available.size(); } + }; + + Upstream_allocator alloc; + std::vector blocks; // List of allocated blocks + + void allocate_new_block(std::size_t block_size = minimal_block_size) + { + auto& block = blocks.emplace_back(); + block.data = alloc.allocate(block_size); + block.available.resize(block_size, true); + block.maximal_continuous_free_space = block_size; + } + + Blocks(const Upstream_allocator& alloc) : alloc(alloc) { allocate_new_block(); } + + ~Blocks() + { + for(auto& block : blocks) { + alloc.deallocate(block.data, block.size()); + } + } + }; + using Block = typename Blocks::Block; + using Ptr = std::shared_ptr; + + Ptr ptr_; + std::mt19937 gen; + +public: + using value_type = T; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using allocator_type = Upstream_allocator; + + Random_allocator(const Upstream_allocator& alloc = {}) noexcept; + + pointer allocate(size_type n, const void* hint = 0); + void deallocate(pointer p, size_type n); + + template void construct(U* p, Args&&... args); + template void destroy(U* p); + + size_type max_size() const noexcept; + + template struct rebind + { + using upstream_traits = std::allocator_traits; + using other_upstream_allocator = typename upstream_traits::template rebind_alloc; + using other = Random_allocator; + }; + + bool operator==(const Random_allocator&) const noexcept; + bool operator!=(const Random_allocator&) const noexcept; +}; + +// Implementation of Random_allocator methods +template +Random_allocator::Random_allocator(const Upstream_allocator& alloc) noexcept + : ptr_(std::make_shared(alloc)), gen(std::random_device()()) +{ +} + +template +typename Random_allocator::pointer +Random_allocator::allocate(size_type n, const void* hint) +{ + boost::container::static_vector, random_size> found_spaces; + for(auto it = ptr_->blocks.rbegin(), end = ptr_->blocks.rend(); it != end; ++it) { + auto& block = *it; + if(block.maximal_continuous_free_space < n) + continue; + auto& available = block.available; + const auto block_size = block.size(); + size_type found_max_free_space = 0; + auto index = available.find_first(); + while(index != boost::dynamic_bitset<>::npos) { + available.flip(); + const auto end_of_free_block = (std::min)(available.find_next(index), block_size); + available.flip(); + auto free_space = end_of_free_block - index; + found_max_free_space = (std::max)(found_max_free_space, free_space); + while(free_space > n && found_spaces.size() < found_spaces.capacity()) { + found_spaces.emplace_back(std::addressof(block), index); + free_space -= n; + index += n; + } + index = block.available.find_next(end_of_free_block); + } + block.maximal_continuous_free_space = found_max_free_space; + if(found_spaces.size() == found_spaces.capacity()) + break; + } + if(!found_spaces.empty()) { + std::uniform_int_distribution<> dis(0, found_spaces.size() - 1); + auto i = dis(gen); + auto [block, index] = found_spaces[i]; + block->available.set(index, n, false); +#if CGAL_DEBUG_RANDOM_ALLOCATOR + std::clog << std::format("CGAL::Random_allocator debug info: n = {}, found_spaces.size() = {}, i = {}," + " block id = {}, block size = {}, index = {}\n", + n, found_spaces.size(), i, block - ptr_->blocks.data(), block->size(), index); +#endif // CGAL_DEBUG_RANDOM_ALLOCATOR + return block->data + index; + } + size_type block_size = (std::max)(n * random_size, minimal_block_size); + ptr_->allocate_new_block(block_size); + return allocate(n, hint); +} + +template +void Random_allocator::deallocate(pointer p, size_type n) +{ + for(auto& block : ptr_->blocks) { + if(block.data <= p && p < block.data + block.size()) { + block.available.set(p - block.data, n, true); + return; + } + } +} + +template +template +void Random_allocator::construct(U* p, Args&&... args) +{ + ::new((void*)p) U(std::forward(args)...); +} + +template +template +void Random_allocator::destroy(U* p) +{ + p->~U(); +} + +template +typename Random_allocator::size_type +Random_allocator::max_size() const noexcept +{ + return (std::numeric_limits::max)() / sizeof(T); +} + +} // namespace CGAL + +#endif // CGAL_RANDOM_ALLOCATOR_H diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h index 09487cc44f9..10611ef80bd 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h @@ -12,6 +12,15 @@ #define CGAL_MESH_OPTION_CLASSES_H #include +#include +#include +#include + +#include + +#include +#include +#include namespace CGAL { @@ -165,6 +174,171 @@ private: bool b_; }; +// Mesh initialization +// Holds the two parameters `initial_points_generator` and `initial_points`, +// without knowing their types, into a single generator. +template +struct Initialization_options +{ + using Point = typename C3t3::Triangulation::Point; + using Default_initial_point_type + = std::tuple; + using Initial_points_range + = typename CGAL::Default::Get>::type; + + template + static auto cbegin(Range&& range) { + return std::cbegin(std::forward(range)); + } + + template + static auto cend(Range&& range) { + return std::cend(std::forward(range)); + } + using Initial_points_const_iterator = decltype(cbegin(std::declval())); + + struct Output_function_ref { + // This reference-like type uses type erasure to store a reference to a callable + // + // See the video "Breaking Dependencies - C++ Type Erasure - The Implementation Details" + // by Klaus Iglberger at CppCon 2022, from time code 49:57. + // URL: https://youtu.be/qn6OqefuH08?si=YzhwpgNLur8_jOeC&t=2997" + + using Erased_call_function_pointer_type = void(*)(void*, const Default_initial_point_type&); + + // store the address of the callable + void* const f_ = nullptr; + // and the call function (the non-capturing lambda generated by the templated constructor) + Erased_call_function_pointer_type const call_ = nullptr; + + template , + Output_function_ref> + > + > + Output_function_ref(Function&& f) + : f_(std::addressof(f)) + , call_( [](void* f, const Default_initial_point_type& p) { + using F = CGAL::cpp20::remove_cvref_t; + auto* real_f = static_cast(f); + (*real_f)(p); + } ) + { + } + + template + void operator()(Tuple_like&& p) const + { + using Tuple_like_no_cvref = CGAL::cpp20::remove_cvref_t; + if constexpr (CGAL::STL_Extension::internal::tuple_like_of_size_2) { + const auto& [pt, index] = p; + call_(f_, Default_initial_point_type(pt, 2, index)); + } else if constexpr (std::is_same_v) { + call_(f_, std::forward(p)); + } else { + const auto& [pt, dim, index] = p; + call_(f_, Default_initial_point_type(pt, dim, index)); + } + } + }; // end of struct Output_function_ref + + using Point_output_function_iterator = boost::function_output_iterator; + + struct Generator_ref { // type-erased reference to a generator, same as Output_function_ref + using Erased_call_function_pointer_type = Point_output_function_iterator(*)(void*, Point_output_function_iterator, const int); + + void * const generator_ = nullptr; + Erased_call_function_pointer_type const call_ = nullptr; + + template , + Generator_ref> + > + > + Generator_ref(Generator&& generator) + : generator_(std::addressof(generator)) + , call_( [](void* g, Point_output_function_iterator oit, const int n) { + using Real_generator = CGAL::cpp20::remove_cvref_t; + auto* real_g = static_cast(g); + return (*real_g)(oit, n); + } ) + { + } + + Generator_ref() = default; + + Point_output_function_iterator operator()(Point_output_function_iterator oit, const int n) const + { + return call_(generator_, oit, n); + } + + Point_output_function_iterator operator()(Point_output_function_iterator oit, const int n) + { + return call_(generator_, oit, n); + } + + bool operator==(std::nullptr_t) const { return generator_ == nullptr; } + }; // end of struct Generator_ref + + Initialization_options() + {} + + template + Initialization_options(Initial_points_generator& generator, + const Initial_points_range& initial_points) + : initial_points_generator_(std::forward(generator)) + , begin_it(cbegin(initial_points)) + , end_it(cend(initial_points)) + {} + + template + static OutputIterator call_operator(Self& self, OutputIterator pts_it, const int n) + { + // add initial_points + pts_it = std::copy(self.begin_it, self.end_it, pts_it); + + if(self.initial_points_generator_ == nullptr) { + return pts_it; + } + + // Now, create an output iterator type-erasing the type of `pts_it`... + auto output_to_pts_it = [&](const Default_initial_point_type& p) { *pts_it++ = p; }; + Output_function_ref function_ref{ output_to_pts_it }; // maintains a non-const reference to pts_it + Point_output_function_iterator output_iterator{ function_ref }; + + // ...and use the type-erased output iterator with the type-erased generator. + self.initial_points_generator_(output_iterator, n); + return pts_it; + } + + template + OutputIterator operator()(OutputIterator pts, const int n = 0) + { + return call_operator(*this, pts, n); + } + + template + OutputIterator operator()(OutputIterator pts, const int n = 0) const + { + return call_operator(*this, pts, n); + } + + bool is_default() const + { + return begin_it == end_it && initial_points_generator_ == nullptr; + } + +private: + Generator_ref initial_points_generator_; //reference that type-erases the generator type + + // The two iterators point to the `initial_points` container + Initial_points_const_iterator begin_it; + Initial_points_const_iterator end_it; +}; + // ----------------------------------- // Features generator // ----------------------------------- diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index f8be50bc5a1..ed872dd7787 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -351,6 +351,8 @@ CGAL_add_named_parameter_with_compatibility(do_reset_c3t3_t, do_reset_c3t3, do_r CGAL_add_named_parameter_with_compatibility(mesh_param_t, mesh_param, mesh_options) CGAL_add_named_parameter_with_compatibility(manifold_param_t, manifold_param, manifold_option) CGAL_add_named_parameter_with_compatibility(features_option_param_t,features_options_param,features_options) +CGAL_add_named_parameter_with_compatibility(initial_points_generator_param_t,initial_points_generator_param,initial_points_generator) +CGAL_add_named_parameter_with_compatibility(initial_points_param_t,initial_points_param,initial_points) CGAL_add_named_parameter_with_compatibility_cref_only(image_3_param_t, image_3_param, image) CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value) diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/tuple_like_helpers.h b/STL_Extension/include/CGAL/STL_Extension/internal/tuple_like_helpers.h new file mode 100644 index 00000000000..de9cc33c7eb --- /dev/null +++ b/STL_Extension/include/CGAL/STL_Extension/internal/tuple_like_helpers.h @@ -0,0 +1,33 @@ +// Copyright (c) 2024 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_STL_EXTENSION_INTERNAL_TUPLE_LIKE_HELPERS_H +#define CGAL_STL_EXTENSION_INTERNAL_TUPLE_LIKE_HELPERS_H + +#include +#include + +namespace CGAL::STL_Extension::internal { + + template + constexpr bool has_tuple_size_v = false; + + template + constexpr bool has_tuple_size_v::value)>> = true; + + template > + constexpr bool tuple_like_of_size_2 = false; + + template + constexpr bool tuple_like_of_size_2 = (std::tuple_size_v == 2); + +} // end namespace CGAL::STL_Extension::internal + +#endif // CGAL_STL_EXTENSION_INTERNAL_TUPLE_LIKE_HELPERS_H diff --git a/STL_Extension/include/CGAL/Skiplist.h b/STL_Extension/include/CGAL/Skiplist.h index 3be7908c90c..e7d7b60b422 100644 --- a/STL_Extension/include/CGAL/Skiplist.h +++ b/STL_Extension/include/CGAL/Skiplist.h @@ -75,7 +75,7 @@ public: all_iterator , typename all_list::iterator , T - > + , std::bidirectional_iterator_tag> { public: all_iterator() {} @@ -91,7 +91,7 @@ public: skip_iterator , typename skip_list::iterator , T - > + , std::bidirectional_iterator_tag> { public: skip_iterator() {} diff --git a/STL_Extension/include/CGAL/Time_stamper.h b/STL_Extension/include/CGAL/Time_stamper.h index 081c003b69b..01187a33085 100644 --- a/STL_Extension/include/CGAL/Time_stamper.h +++ b/STL_Extension/include/CGAL/Time_stamper.h @@ -30,13 +30,17 @@ struct Time_stamper { static constexpr bool has_timestamp = true; + static bool is_valid(const T* pt) { + return pt != nullptr && pt->time_stamp() != std::size_t(-2); + } + static void initialize_time_stamp(T* pt) { pt->set_time_stamp(std::size_t(-1)); } template static void set_time_stamp(T* pt, time_stamp_t& time_stamp_) { - CGAL_assertion(pt->time_stamp() != std::size_t(-2)); + CGAL_assertion(is_valid(pt)); if(pt->time_stamp() == std::size_t(-1)) { const std::size_t new_ts = time_stamp_++; pt->set_time_stamp(new_ts); @@ -64,13 +68,18 @@ struct Time_stamper static std::size_t time_stamp(const T* pt) { - CGAL_assertion(pt == nullptr || pt->time_stamp() != std::size_t(-2)); + CGAL_assertion(is_valid(pt)); if(pt == nullptr){ return std::size_t(-1); } return pt->time_stamp(); } + static void restore_timestamp(T* pt, std::size_t ts) + { + pt->set_time_stamp(ts); + } + static auto display_id(const T* pt, int offset = 0) { if(pt == nullptr) @@ -80,7 +89,7 @@ struct Time_stamper } static std::size_t hash_value(const T* p) { - CGAL_assertion(p == nullptr || p->time_stamp() != std::size_t(-2)); + CGAL_assertion(nullptr== p || is_valid(p)); if(nullptr == p) return std::size_t(-1); else @@ -116,6 +125,10 @@ public: return 0; } + static void restore_timestamp(T*, std::size_t) + { + } + static auto display_id(const T* pt, int) { return static_cast(pt); diff --git a/STL_Extension/include/CGAL/unordered_flat_map.h b/STL_Extension/include/CGAL/unordered_flat_map.h new file mode 100644 index 00000000000..73ff2135033 --- /dev/null +++ b/STL_Extension/include/CGAL/unordered_flat_map.h @@ -0,0 +1,84 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_UNORDERED_FLAT_MAP_H +#define CGAL_UNORDERED_FLAT_MAP_H + +#include + +#include +#if BOOST_VERSION >= 108100 && !defined(CGAL_USE_BOOST_UNORDERED) +# define CGAL_USE_BOOST_UNORDERED 1 +#endif + +#if CGAL_USE_BARE_STD_SET +# define CGAL_USE_BARE_STD_MAP CGAL_USE_BARE_STD_SET +#endif + +#if CGAL_USE_BARE_STD_MAP // to benchmark with the ordered std::map +# include +# include +#elif CGAL_USE_BOOST_UNORDERED +# include +# include +#else // Boost before 1.81.0, use the C++11 std::unordered_map +# include +# include +#endif + +#include // for std::hash, std::equal_to +#include // for std::allocator + +namespace CGAL { + +template < + typename Key, + typename T, + typename Hash = std::hash, + typename KeyEqual = std::equal_to, + typename Allocator = std::allocator> + > +#if CGAL_USE_BARE_STD_MAP + + using unordered_flat_map = std::map, Allocator>; + +#elif CGAL_USE_BOOST_UNORDERED + + using unordered_flat_map = boost::unordered_flat_map; + +#else // use the C++11 std::unordered_map + + using unordered_flat_map = std::unordered_map; + +#endif + +template < + typename Key, + typename Hash = std::hash, + typename KeyEqual = std::equal_to, + typename Allocator = std::allocator + > +#if CGAL_USE_BARE_STD_MAP + + using unordered_flat_set = std::set, Allocator>; + +#elif CGAL_USE_BOOST_UNORDERED + + using unordered_flat_set = boost::unordered_flat_set; + +#else // use the C++11 std::unordered_set + + using unordered_flat_set = std::unordered_set; + +#endif + +} // end namespace CGAL + +#endif // CGAL_UNORDERED_FLAT_MAP_H diff --git a/STL_Extension/include/CGAL/unordered_flat_set.h b/STL_Extension/include/CGAL/unordered_flat_set.h new file mode 100644 index 00000000000..bf71b173013 --- /dev/null +++ b/STL_Extension/include/CGAL/unordered_flat_set.h @@ -0,0 +1,17 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_UNORDERED_FLAT_SET_H +#define CGAL_UNORDERED_FLAT_SET_H + +// lazy implementation: define the two template aliases in the same header file +#include + +#endif // CGAL_UNORDERED_FLAT_SET_H diff --git a/STL_Extension/test/STL_Extension/CMakeLists.txt b/STL_Extension/test/STL_Extension/CMakeLists.txt index fafddb64a21..b1007acfcb5 100644 --- a/STL_Extension/test/STL_Extension/CMakeLists.txt +++ b/STL_Extension/test/STL_Extension/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(STL_Extension_Tests) find_package(CGAL REQUIRED) diff --git a/STL_Extension/test/STL_Extension/test_Compact_container.cpp b/STL_Extension/test/STL_Extension/test_Compact_container.cpp index bf6b0d83948..8cb5d9726ec 100644 --- a/STL_Extension/test/STL_Extension/test_Compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Compact_container.cpp @@ -18,7 +18,6 @@ template struct Node_1 : public CGAL::Compact_container_base { - Node_1() {} // // it is important `time_stamp_` is not initialized bool operator==(const Node_1 &) const { return true; } bool operator!=(const Node_1 &) const { return false; } bool operator< (const Node_1 &) const { return false; } @@ -49,7 +48,7 @@ struct Node_1 } ///@} int m_erase_counter; - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; class Node_2 diff --git a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp index a42676f8f7f..e919369cabf 100644 --- a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp @@ -32,7 +32,6 @@ int main() struct Node_1 : public CGAL::Compact_container_base { - Node_1() {} bool operator==(const Node_1 &) const { return true; } bool operator!=(const Node_1 &) const { return false; } bool operator< (const Node_1 &) const { return false; } @@ -45,7 +44,7 @@ struct Node_1 void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; } - std::size_t time_stamp_; + std::size_t time_stamp_ = std::size_t(-2); }; class Node_2 diff --git a/STL_Extension/test/STL_Extension/test_namespaces.cpp b/STL_Extension/test/STL_Extension/test_namespaces.cpp index 63a9971c576..f7293e8a7c4 100644 --- a/STL_Extension/test/STL_Extension/test_namespaces.cpp +++ b/STL_Extension/test/STL_Extension/test_namespaces.cpp @@ -13,7 +13,7 @@ int main() { - CGAL::cpp0x::array arr; + CGAL::cpp0x::array arr{1, 2, 3}; std::array arr2; CGAL::cpp0x::tuple tuple; diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index 194a7c45a7a..5210e9a1e61 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Scale_space_reconstruction_3_Examples) find_package(CGAL REQUIRED) diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp index a562362bfcf..398e35353b9 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { // Also store the input points as vertex property Surface_mesh::Property_map original; bool created; - boost::tie(original, created) = mesh.add_property_map("v:original"); + std::tie(original, created) = mesh.add_property_map("v:original"); assert(created); int i = 0; diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal deleted file mode 100755 index 8d0f0f3b8f8..00000000000 --- a/Scripts/developer_scripts/autotest_cgal +++ /dev/null @@ -1,951 +0,0 @@ -#!/bin/bash -# ---------------------------------------------------- -# ---------------------------------------------------- -# autotest_cgal: a script to automagically install and -# test internal CGAL releases -# ---------------------------------------------------- -# You will need -# * GNU wget and ftp -# * or alternatively curl -# -# Furthermore you have to edit .autocgalrc in order to -# customize it for your environment. -# In particular you have to change the BUILHOSTS -# variable to contain the names of your hosts and -# set the COMPILERS_ variables to the -# os-compilers descriptions on which you want to run -# the testsuite. -# ---------------------------------------------------- -# ---------------------------------------------------- -# -# $URL$ -# $Id$ - -#sets the umask to 022 & 0777 -umask 022 - -# Warn deprecated use of environment variables to pass on flags -if [ -n "$TESTSUITE_CXXFLAGS" ] ; then - echo "\$TESTSUITE_CXXFLAGS is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_CXX_FLAGS instead" >&2; -fi - -if [ -n "$TESTSUITE_CXXFLAGS_RELEASE" ] ; then - echo "\$TESTSUITE_CXXFLAGS_RELEASE is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_CXX_FLAGS_RELEASE instead" >&2; -fi - -if [ -n "$TESTSUITE_CXXFLAGS_DEBUG" ] ; then - echo "\$TESTSUITE_CXXFLAGS_DEBUG is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_CXX_FLAGS_DEBUG instead" >&2; -fi - -if [ -n "$TESTSUITE_LDFLAGS" ] ; then - echo "\$TESTSUITE_LDFLAGS is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_(MODULE|SHARED|EXE)_LINKER_FLAGS instead" >&2; -fi - -if [ -n "$TESTSUITE_LDFLAGS_RELEASE" ] ; then - echo "\$TESTSUITE_LDFLAGS_RELEASE is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_(MODULE|SHARED|EXE)_LINKER_FLAGS_RELEASE instead" >&2; -fi - -if [ -n "$TESTSUITE_LDFLAGS_DEBUG" ] ; then - echo "\$TESTSUITE_LDFLAGS_DEBUG is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_(MODULE|SHARED|EXE)_LINKER_FLAGS_DEBUG instead" >&2; -fi - -# We want english warning and error messages!! -LANG=C -LC_ALL=C -export LANG -export LC_ALL - -SCP="scp" -WGET="wget" -WGET_OPTS="--no-check-certificate --no-verbose" -CURL="curl" -CURL_OPTS="-k --remote-name --silent --location-trusted" -CGAL_URL="https://cgal.geometryfactory.com/CGAL/Releases" -LATEST_LOCATION="${CGAL_URL}/LATEST" -TAR="tar" -GZIP="gzip" -GUNZIP="gunzip" -COMPRESSOR="${GZIP}" -SENDMAIL="mail" -CGAL_TESTER=`whoami` -CGAL_TESTER_NAME="${CGAL_TESTER}" -CGAL_TESTER_ADDRESS="${CGAL_TESTER}" -CONSOLE_OUTPUT="y" -CGAL_ROOT=`pwd` -UPLOAD_RESULT_DESTINATION="cgaltest@cgaltest.geometryfactory.com:incoming" -BUILD_HOSTS="must_be_set_in_.autocgalrc" -MAIL_ADDRESS="must_be_set_in_.autocgalrc" -MYSHELL="" -REFERENCE_PLATFORMS_DIR="must_be_set_in_.autocgalrc" -ACTUAL_DIR=`pwd` -RSH="rsh" -NICE_OPTIONS="-19" -USE_TARGZ="n" -USE_TARBZ="n" -PLATFORMS="" -PLATFORM="" -USE_REFERENCE_PLATFORMS="" -SHOW_PROGRESS="" - -# ---------------------------------------------------------------------------------------- -# write to logfile -# $1 = logfile -# ---------------------------------------------------------------------------------------- -log() -{ - LOGFILE=${1} - shift - if [ -n "${CONSOLE_OUTPUT}" ]; then - printf "${*} ...\n" - fi - printf "\n-------------------------------------------------------\n" >> "${LOGFILE}" - printf " ${*} ...\n" >> "${LOGFILE}" - printf "\n-------------------------------------------------------\n" >> "${LOGFILE}" -} - -log_done() -{ - if [ -n "${CONSOLE_OUTPUT}" ]; then - printf \ - " done\n-------------------------------------------------------\n" - fi - printf "\n-------------------------------------------------------\n" >> "${1}" - printf " **DONE**\n" >> "${1}" - printf "\n-------------------------------------------------------\n" >> "${1}" -} - -# ---------------------------------------------------------------------------------------- -# produce a string containing the actual date/time -# (used to identify files) -# ---------------------------------------------------------------------------------------- -datestr() -{ - date +%d%m%Y%H%M -} - -# ---------------------------------------------------------------------------------------- -# Print error and exit -# ---------------------------------------------------------------------------------------- -error() -{ - if [ -n "${CONSOLE_OUTPUT}" ]; then - printf "\nERROR: ${*}, exiting.\n" >&2 - fi - printf "\nERROR: ${*}, exiting.\n" >> "${ACTUAL_LOGFILE}" - ${COMPRESSOR} -9f "${ACTUAL_LOGFILE}" - FILENAME="${CGAL_RELEASE_ID}-log`datestr`.gz" - mv "${ACTUAL_LOGFILE}.gz" "${LOGS_DIR}/${FILENAME}" - if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then - for i in ${MAIL_ADDRESS}; do - printf "ERROR\n${LOGS_DIR}/${FILENAME}\n" | \ - ${SENDMAIL} -s "completed autotest" "${i}" - done - fi - rm -rf "$LOCK_FILE"; - exit 1 -} - -# ---------------------------------------------------------------------------------------- -# Return 0 if $1 exists in the list $2, otherwise returns non-zero. -# ---------------------------------------------------------------------------------------- -is_in_list() -{ - ELEMENT=${1} - LIST=${2} - - for E in ${LIST} ; do - if [ "${E}" = "${ELEMENT}" ] ; then - return 0 - fi - done - - return 1 -} - -# ---------------------------------------------------------------------------------------- -# function to print the value of variable $1 -# ---------------------------------------------------------------------------------------- -value_of() -{ - _value=`eval "printf '$'${1}"` - eval "printf \"${_value}\"" -} - -# ---------------------------------------------------------------------------------------- -# Executes a command remotely -# $1 = HOST -# $2 = COMMAND -# ---------------------------------------------------------------------------------------- -remote_command() -{ - if [ "${1}" = "localhost" ]; then - eval $2 - else - printf "** Logging into host ${1} **\n" - ${RSH} ${1} ${MYSHELL} \"${2}\" - fi -} - -# ---------------------------------------------------------------------------------------- -# Downloads the file "LATEST" whose contents indicates which release to test -# ---------------------------------------------------------------------------------------- -download_latest() -{ - if [ -r "LATEST" ]; then - rm -rf LATEST - fi - log "${ACTUAL_LOGFILE}" "getting LATEST" - if [ -n "${USE_CURL}" ]; then - ${CURL} ${CURL_OPTS} "${LATEST_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1 - else - ${WGET} ${WGET_OPTS} "${LATEST_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1 - fi - if [ ! -f "LATEST" ]; then - error "COULD NOT DOWNLOAD LATEST!" - fi -} - -# ---------------------------------------------------------------------------------------- -# Exits the testsuite if the latest release has been already tested. -# This is tested by comparing files LATEST and RELEASE_NR, where -# RELEASE_NR is a copy of the previous LATEST. -# ---------------------------------------------------------------------------------------- -abort_if_latest_already_tested() -{ - if [ -r "RELEASE_NR" ]; then - cmp LATEST RELEASE_NR >> "${ACTUAL_LOGFILE}" - if [ ! ${?} != 0 ]; then - log "${ACTUAL_LOGFILE}" "This release has already been tested." - rm -f "$LOCK_FILE"; - exit 1; - fi - fi -} - - -# ---------------------------------------------------------------------------------------- -# get CGAL -# ---------------------------------------------------------------------------------------- -get_cgal() -{ - if [ -z "$CGAL_LOCATION" ]; then - for i in `cat LATEST` - do - CGAL_LOCATION="${CGAL_URL}/${i}"; - CGAL_ZIPFILE="${i}"; - done - else - CGAL_ZIPFILE=`echo "$CGAL_LOCATION" | sed 's|.*/||'` - fi - - CGAL_RELEASE_ID=`echo $CGAL_ZIPFILE | sed "s/.tar.gz//"` - if [ ! "${CGAL_RELEASE_ID}" = "${CGAL_ZIPFILE}" ]; then - USE_TARGZ="y" - else - CGAL_RELEASE_ID=`echo $CGAL_ZIPFILE | sed "s/.tar.bz2//"` - if [ ! "${CGAL_RELEASE_ID}" = "${CGAL_ZIPFILE}" ]; then - USE_TARBZ="y" - fi - fi - - log "${ACTUAL_LOGFILE}" "CGAL_ZIPFILE = ${CGAL_ZIPFILE}" - log "${ACTUAL_LOGFILE}" "CGAL_RELEASE_ID = ${CGAL_RELEASE_ID}" - - log "${ACTUAL_LOGFILE}" "getting CGAL" - rm -f "${CGAL_ZIPFILE}" - if [ -n "${USE_CURL}" ]; then - ${CURL} ${CURL_OPTS} "${CGAL_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1 - else - ${WGET} ${WGET_OPTS} "${CGAL_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1 - fi - if [ ${?} != 0 ]; then - error "Could not get CGAL" - fi - log_done "${ACTUAL_LOGFILE}" -} - - -# ---------------------------------------------------------------------------------------- -# Unzips and untars the downloaded CGAL release -# ---------------------------------------------------------------------------------------- -unzip_cgal() -{ - cd "${CGAL_ROOT}" - - log "${ACTUAL_LOGFILE}" "unzipping CGAL" - if [ "${USE_TARGZ}" = "y" ]; then - DECOMPRESSOR="${GUNZIP}" - log_done "${ACTUAL_LOGFILE}" - fi - - if [ "${USE_TARBZ}" = "y" ]; then - DECOMPRESSOR="bunzip2" - fi - - log "${ACTUAL_LOGFILE}" "untarring CGAL" - ${DECOMPRESSOR} -c "${CGAL_ZIPFILE}" | ${TAR} xf - >> "${ACTUAL_LOGFILE}" 2>&1 - if [ ${?} != 0 ]; then - error "Could not untar CGAL" - fi - - # check, if CGAL_DIR exists - if [ -d "${CGAL_ROOT}/${CGAL_RELEASE_ID}" ]; then - # Reset CGAL-I symlink - log "${ACTUAL_LOGFILE}" "Resetting CGAL-I symlink to ${CGAL_ROOT}/${CGAL_RELEASE_ID}" - rm -f CGAL-I - ln -s "${CGAL_ROOT}/${CGAL_RELEASE_ID}" CGAL-I - # Reset CGAL-3.x-I symlink - CGAL_RELEASE=`echo "${CGAL_RELEASE_ID}" | sed 's/I\([^-]*\)-.*/I\1/'` - log "${ACTUAL_LOGFILE}" "Resetting ${CGAL_RELEASE} symlink to ${CGAL_ROOT}/${CGAL_RELEASE_ID}" - rm -f "${CGAL_RELEASE}" - ln -s "${CGAL_ROOT}/${CGAL_RELEASE_ID}" "${CGAL_RELEASE}" - else - error "directory ${CGAL_ROOT}/${CGAL_RELEASE_ID} does not exist" - fi - - log_done "${ACTUAL_LOGFILE}" -} - - -# ---------------------------------------------------------------------------------------- -# Uniquely adds $1 to the global, space-separated list $PLATFORMS -# (if it is not in the list already) -# ---------------------------------------------------------------------------------------- -add_to_platforms() -{ - if ! is_in_list "${1}" "${PLATFORMS}" ; then - PLATFORMS="${PLATFORMS} ${1}" - fi -} - -# ---------------------------------------------------------------------------------------- -# Uniquely adds to the global, space-separated list $PLATFORMS all the directories found -# under ${REFERENCE_PLATFORMS_DIR} -# ---------------------------------------------------------------------------------------- -collect_all_reference_platforms() -{ - log "${ACTUAL_LOGFILE}" "Indicated to build on ALL platform folders" - if [ -d "${REFERENCE_PLATFORMS_DIR}" ]; then - cd "${REFERENCE_PLATFORMS_DIR}" - for PLATFORM in * ; do - if [ -d "${PLATFORM}" ]; then - add_to_platforms "${PLATFORM}" - fi - done - else - log "${ACTUAL_LOGFILE}" "WARNING: Invalid reference platforms directory: ${REFERENCE_PLATFORMS_DIR}" - fi -} - -# ---------------------------------------------------------------------------------------- -# Uniquely adds to the global, space-separated list $PLATFORMS all the directories found -# under $1 -# ---------------------------------------------------------------------------------------- -collect_all_current_platforms() -{ - PLATFORMS="" - cd "${1}" - for PLATFORM in * ; do - if [ -d "${PLATFORM}" ]; then - PLATFORMS="${PLATFORMS} ${PLATFORM}" - fi - done -} - -# ---------------------------------------------------------------------------------------- -# Uniquely adds to the global, space-separated list $PLATFORMS all the directory names -# listed in the space-separated list $1 -# NOTE: If any such name is "all", it's NOT added as a platform and the flag -# USE_REFERENCE_PLATFORMS is set instead. -# ---------------------------------------------------------------------------------------- -build_platforms_list() -{ - for LOCAL_PLATFORM in $1; do - if [ "${LOCAL_PLATFORM}" = "all" ] ; then - USE_REFERENCE_PLATFORMS='y' - else - add_to_platforms "${LOCAL_PLATFORM}" - fi - done -} - -# ---------------------------------------------------------------------------------------- -# Sets up the variables indicating the directories to use. -# Crates all platform directories under the current release binary folder. -# ---------------------------------------------------------------------------------------- -setup_dirs() -{ - # dir for the actual release - CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-I"` - - CGAL_TEST_DIR=${CGAL_DIR}/test - CGAL_DATA_DIR=${CGAL_DIR}/data - export CGAL_DATA_DIR=$(echo "$CGAL_DATA_DIR" | sed -E 's/\/cygdrive\/([a-z])\//\U\1:\//') - - if [ ! -d "${CGAL_DIR}/cmake" ]; then - mkdir "${CGAL_DIR}/cmake" - log "${ACTUAL_LOGFILE}" "Creating ${CGAL_DIR}/cmake" - fi - - if [ ! -d "${CGAL_DIR}/cmake/platforms" ]; then - mkdir "${CGAL_DIR}/cmake/platforms" - log "${ACTUAL_LOGFILE}" "Creating ${CGAL_DIR}/cmake/platforms" - fi - - export CGAL_RELEASE_DIR="${CGAL_DIR}" - - CGAL_RELEASE_ID=`basename "${CGAL_RELEASE_DIR}"` - - CGAL_BINARY_DIR_BASE=${CGAL_RELEASE_DIR}/cmake/platforms - - log "${ACTUAL_LOGFILE}" "Release to test ${CGAL_RELEASE_DIR}" - log "${ACTUAL_LOGFILE}" "CGAL_RELEASE_ID=${CGAL_RELEASE_ID}" - - if [ ! -r "${LOGS_DIR}" ]; then - mkdir "$LOGS_DIR" - fi - - # - # Collects the list of platform directories to build and test on - # - # The global variable PLATFORMS contains all the platform directories for all hosts - # as indicated in .autocgalrc. - # If .autocgalrc says "all" in any entry for BUILD_ON_* or COMPILERS_*, the platform - # directories existing in the reference release are added to $PLATFORMS - # - PLATFORMS="" - - for HOST in ${BUILD_HOSTS}; do - - build_platforms_list "`value_of BUILD_ON_${HOST}`" - build_platforms_list "`value_of COMPILERS_${HOST}`" - - done - - if [ -n "${USE_REFERENCE_PLATFORMS}" ]; then - collect_all_reference_platforms - fi - - - for PLATFORM in ${PLATFORMS}; do - - # MSVC2015 does not support C++17 - if [ "$CGAL_RELEASE_ID" \> "CGAL-6.0" ]; then - if [ "$PLATFORMS" = "MSVC2015-Release-64bits" ]; then - continue - fi - fi - - CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${PLATFORM} - - if [ ! -d "${CGAL_BINARY_DIR}" ]; then - log "${ACTUAL_LOGFILE}" "Creating platform directory ${CGAL_BINARY_DIR}" - mkdir "${CGAL_BINARY_DIR}" - fi - - done -} - - -# ---------------------------------------------------------------------------------------- -# copy stuff from old CGAL installation -# ---------------------------------------------------------------------------------------- -copy_old_stuff() -{ - if [ -d "${REFERENCE_PLATFORMS_DIR}" ]; then - - cd "${CGAL_BINARY_DIR_BASE}" - - for PLATFORM in * ; do - if [ -d "${PLATFORM}" ]; then - - # if the reference platform folder contains a setup script, copy it - if [ -f "${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/setup" ]; then - log "${ACTUAL_LOGFILE}" "Copying reference platform setup script [${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/setup] in [${CGAL_BINARY_DIR_BASE}/${PLATFORM}]" - cp "${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/setup" "${CGAL_BINARY_DIR_BASE}/${PLATFORM}" - - # hack on Windows, where 'cp' does not copy the Windows ACLs - chmod a+r "${CGAL_BINARY_DIR_BASE}/${PLATFORM}/setup" - fi - fi - done - - fi -} - - -# ---------------------------------------------------------------------------------------- -# Builds the CGAL library on the host specified at $1 -# ---------------------------------------------------------------------------------------- -build_cgal_on_host() -{ - HOST=${1} - - PLATFORMS="`value_of BUILD_ON_${HOST}`" - - - if [ -z "${PLATFORMS}" ]; then - PLATFORMS=`value_of COMPILERS_${HOST}` - fi - - if [ "${PLATFORMS}" = "all" ]; then - collect_all_current_platforms "${CGAL_BINARY_DIR_BASE}" - fi - - if [ -n "${PLATFORMS}" ]; then - - for PLATFORM in ${PLATFORMS} ; do - - CGAL_BINARY_DIR="${CGAL_BINARY_DIR_BASE}/${PLATFORM}" - - log "${ACTUAL_LOGFILE}" "Building cgal libs on host ${HOST} and platform ${PLATFORM}\nUnder ${CGAL_BINARY_DIR}\n" - - if [ -f "${CGAL_BINARY_DIR}/localbuildscript" ] ; then - log "${ACTUAL_LOGFILE}" "WARNING! Already built on platform ${PLATFORM}." - else - - if [ -f "${CGAL_BINARY_DIR}/setup" ]; then - cp "${CGAL_BINARY_DIR}/setup" "${CGAL_BINARY_DIR}/localbuildscript" - else - rm -f "${CGAL_BINARY_DIR}/localbuildscript" - fi - - cat >> "${CGAL_BINARY_DIR}/localbuildscript" <> "${CGAL_BINARY_DIR}/localbuildscript" <&1 | tee "${ACTUAL_LOGFILE}.build.${PLATFORM}" - else - remote_command ${HOST} "${CGAL_BINARY_DIR}/localbuildscript" > "${ACTUAL_LOGFILE}.build.${PLATFORM}" 2>&1 - fi - - cp "${ACTUAL_LOGFILE}.build.${PLATFORM}" "${CGAL_BINARY_DIR}/installation.log" - fi - - done - else - error "There are no platform directories under ${CGAL_BINARY_DIR_BASE} to test! " - fi - -} - - -# ---------------------------------------------------------------------------------------- -# builds cgal -# ---------------------------------------------------------------------------------------- -build_cgal() -{ - for HOST in ${BUILD_HOSTS}; do - build_cgal_on_host "${HOST}" - done - - # NOTE: At this point PWD is in the last platform directory where CGAL was built - - log_done "${ACTUAL_LOGFILE}" - cp "${ACTUAL_LOGFILE}" "${CGAL_BINARY_DIR_BASE}/installation.log" - ${COMPRESSOR} -9f "${ACTUAL_LOGFILE}" - mv "${ACTUAL_LOGFILE}.gz" "${LOGS_DIR}/${CGAL_RELEASE_ID}-log`datestr`.gz" -} - -# ---------------------------------------------------------------------------------------- -# Runs the test on the host $1 under the platform folder $2 -# the variable PROCESSORS_electra, where electra is the -# name of the machine, is used to specify the number of -# processors to use -# ---------------------------------------------------------------------------------------- -run_test_on_host_and_platform() -{ - HOST=${1} - PLATFORM=${2} - - NUMBER_OF_PROCESSORS="`value_of PROCESSORS_${HOST}`" - CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${PLATFORM} - cd "${CGAL_BINARY_DIR}" - log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "Testing on host ${HOST} and platform ${PLATFORM}" - if [ "${NUMBER_OF_PROCESSORS}" = "1" ] ; then - MAKE_OPTS="" - else - MAKE_OPTS="-j ${NUMBER_OF_PROCESSORS}" - fi - - if [ -f "${CGAL_BINARY_DIR}/localtestscript" ]; then - log "${ACTUAL_LOGFILE}" "WARNING! Already tested on platform ${PLATFORM}." - else - if [ -f "${CGAL_BINARY_DIR}/setup" ]; then - cp "${CGAL_BINARY_DIR}/setup" "${CGAL_BINARY_DIR}/localtestscript" - else - rm -f "${CGAL_BINARY_DIR}/localtestscript" - fi - - for file in "${CGAL_BINARY_DIR}/localtestscript" "${CGAL_BINARY_DIR}/localtestscript-redo-results-collection"; do - cat >> "$file" <> "${CGAL_BINARY_DIR}/localtestscript" <> "$file" <> "$file" <<'EOF' - for demo_dir in *_Demo; do - echo "pushd ${demo_dir}" - pushd "${demo_dir}" - bash ../cgal_demo_copy_all_dlls_cygwin.sh "${demo_dir}_with_dlls" "" - mv "${demo_dir}_with_dlls" .. - popd - done -EOF -cat >> "$file" <> "${CGAL_BINARY_DIR}/localtestscript" <&1 | tee "${ACTUAL_LOGFILE}.test.${PLATFORM}" - else - remote_command ${HOST} "${CGAL_BINARY_DIR}/localtestscript" > "${ACTUAL_LOGFILE}.test.${PLATFORM}" 2>&1 - fi - - log_done "${ACTUAL_LOGFILE}.test.${PLATFORM}" - - fi -} - -publish_results() -{ - HOST=${1} - PLATFORM=${2} - - # - # collect results and put them on the web - # - cd "${CGAL_TEST_DIR}" - - log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "COLLECTING RESULTS ${PLATFORM}-${HOST}" - - # If this file does not exist results collection failed. Fake a results so this fact is itself reported - if [ ! -f "results_${CGAL_TESTER}_${PLATFORM}.txt" ]; then - log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "Results collection for tester ${CGAL_TESTER} and platform ${PLATFORM} failed!" - echo "Results collection failed!" >> "results_${CGAL_TESTER}_${PLATFORM}.txt" - ${TAR} cf "results_${CGAL_TESTER}_${PLATFORM}.tar" "results_${CGAL_TESTER}_${PLATFORM}.txt" - ${COMPRESSOR} -9f "results_${CGAL_TESTER}_${PLATFORM}.tar" - fi - - ${TAR} cf "test_results-${HOST}_${PLATFORM}.tar" "results_${CGAL_TESTER}_${PLATFORM}.tar.gz" "results_${CGAL_TESTER}_${PLATFORM}.txt" - ${COMPRESSOR} -9f "test_results-${HOST}_${PLATFORM}.tar" - COMPILER=`printf "%s" "$2" | tr -c '[A-Za-z0-9]./[=-=]*_\'\''\":?() ' 'x'` - FILENAME="${CGAL_RELEASE_ID}_${CGAL_TESTER}-test`datestr`-${COMPILER}-cmake.tar.gz" - LOGFILENAME="${CGAL_RELEASE_ID}-log`datestr`-${HOST}.gz" - ${COMPRESSOR} -9f "${ACTUAL_LOGFILE}.test.${PLATFORM}" - mv "${ACTUAL_LOGFILE}.test.${PLATFORM}.gz" "${LOGS_DIR}/${LOGFILENAME}" - - log_done "${ACTUAL_LOGFILE}.test.${PLATFORM}" - - log "${ACTUAL_LOGFILE}" "Test results: ${CGAL_TEST_DIR}/test_results-${HOST}_${PLATFORM}.tar.gz" - - if [ -z "${DO_NOT_UPLOAD}" ]; then - log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "PUTTING RESULTS ON THE WEB" - put_on_web "test_results-${HOST}_${PLATFORM}.tar.gz" "${FILENAME}" - if [ -e "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" ]; then - put_on_web "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" "demos-${FILENAME}" - fi - log_done "${ACTUAL_LOGFILE}" - fi - - # - # notify the CGAL world - # - if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then - for i in ${MAIL_ADDRESS}; do - echo "Notifying ${i} about autotest finished." - printf "result collection::\n${FILENAME}\n" | ${SENDMAIL} -s "autohandle" ${i} - done - fi -} - -# ---------------------------------------------------------------------------------------- -# Runs the test on the host $1 -# ---------------------------------------------------------------------------------------- -run_test_on_host() -{ - HOST=${1} - - PLATFORMS=`value_of COMPILERS_${HOST}` - - if [ "${PLATFORMS}" = "all" ]; then - collect_all_current_platforms "${CGAL_BINARY_DIR_BASE}" - fi - - for PLATFORM in ${PLATFORMS}; do - run_test_on_host_and_platform "${HOST}" "${PLATFORM}" - publish_results "${HOST}" "${PLATFORM}" - done -} - -# ---------------------------------------------------------------------------------------- -# run the testsuites -# ---------------------------------------------------------------------------------------- -run_test() -{ - log "${ACTUAL_LOGFILE}" "running the testsuites" - if [ -n "${CONSOLE_OUTPUT}" ]; then - printf "\n-------------------------------------------------------\n" - fi - - for HOST in ${BUILD_HOSTS}; do - run_test_on_host ${HOST} & - done -} - -# ---------------------------------------------------------------------------------------- -# function to put result files on the web -# $1 = source filename (full path) -# $2 = target filename (basename only) -# ---------------------------------------------------------------------------------------- -put_on_web() -{ - log "${ACTUAL_LOGFILE}" "Uploading results ${1} to $UPLOAD_RESULT_DESTINATION/$2" - - "$SCP" "${1}" "$UPLOAD_RESULT_DESTINATION/$2" >> "${ACTUAL_LOGFILE}" -} - - - - -# ---------------------------------------------------- -# START OF MAIN BODY -# ---------------------------------------------------- - -# Parse command line arguments -for arg in "$@" -do - case "$arg" in - "-c") - echo "Using latest unzipped release instead of getting a new one from the server" - USE_LATEST_UNZIPPED="y" - ;; - "-l") - echo "Not uploading results to dashboard" - DO_NOT_UPLOAD="y" - ;; - "-n") - # echo "No testsuite will be launched. Installation only." - DO_NOT_TEST="y" - ;; - "-s") - echo "Showing progress." - SHOW_PROGRESS="y" - ;; - "-k") - echo "Compiled test/ directory will be kept." - KEEP_TESTS="y" - ;; - *) - CGAL_LOCATION=$arg - esac -done - -# Load settings -if [ -f "$HOME/.autocgal_with_cmake_rc" ]; then - . "$HOME/.autocgal_with_cmake_rc" -else - if [ -f "$HOME/.autocgalrc" ]; then - . "$HOME/.autocgalrc" - else - echo "CONFIGURATION FILE .autocgal_with_cmake_rc or .autocgalrc NOT FOUND" >&2; - exit 1 - fi -fi - -LOGS_DIR="${CGAL_ROOT}/AUTOTEST_LOGS" -LOCK_FILE="${CGAL_ROOT}/autotest_cgal_with_cmake.lock" -LIST_TEST_PACKAGES="${CGAL_ROOT}/list_test_packages" - -# Setup logfile -ACTUAL_LOGFILE="${CGAL_ROOT}/`basename ${0}`.log" -rm -f "${ACTUAL_LOGFILE}" - -echo "Running `basename ${0}` "'$Revision$' >> "${ACTUAL_LOGFILE}" - -# Sanity checks -if [ "${REFERENCE_PLATFORMS_DIR}" = "must_be_set_in_.autocgalrc" ]; then - error "REFERENCE_PLATFORMS_DIR must be set in .autocaglrc" -fi - -if [ "${BUILD_HOSTS}" = "must_be_set_in_.autocgalrc" ]; then - error "BUILD_HOSTS must be set in .autocgalrc" -else - for i in ${BUILD_HOSTS}; do - TEXT="`value_of COMPILERS_${i}`" - if [ -z "${TEXT}" -a "${i}" != "localhost" ]; then - error "COMPILERS_${i} must be defined in .autocgalrc" - else - TEXT="`value_of PROCESSORS_${i}`" - TEMPVAR="PROCESSORS_${i}" - if [ -z "${TEXT}" ]; then - log "${ACTUAL_LOGFILE}" "\ngiving default 1 values TO PROCESSORS_${i} ..."; - eval $TEMPVAR="1"; - fi - fi - done -fi - -# Make that file writable (lockfile create read-only files -chmod u+w "$LOCK_FILE" -# Put the PID of current process in the lock file -echo $$ > "$LOCK_FILE" - -fi - -# that line makes the script remove the lock file in case of unwanted exit -trap "rm -f \"$LOCK_FILE\"" EXIT HUP INT TERM - -# Notify test started -if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then - for i in ${MAIL_ADDRESS}; do - echo "Notifying ${i} about autotest started." - printf "subject says it all\n" | \ - ${SENDMAIL} -s "Started autotest" ${i} - done -fi - - - -cd "$CGAL_ROOT" - -# Starts the process - -if [ -z "${USE_LATEST_UNZIPPED}" ]; then - if [ -z "$CGAL_LOCATION" ]; then - download_latest - abort_if_latest_already_tested - fi - get_cgal - unzip_cgal -fi - -setup_dirs - -copy_old_stuff - -build_cgal - -if [ "${BUILD_HOSTS}" = "localhost" ]; then - TEXT="`value_of COMPILERS_localhost`" - if [ -z "${DO_NOT_TEST}" ]; then - if [ -z "${TEXT}" ]; then - printf "Skipping testing phase (use the -n option to remove this message).\n" - DO_NOT_TEST="y" - fi - fi -fi - -if [ -z "${DO_NOT_TEST}" ]; then - run_test -fi - -cd "${CGAL_ROOT}" - -if [ -e "LATEST" ]; then - mv LATEST RELEASE_NR -fi - -rm -f "$LOCK_FILE"; - -# EOF - -## Local Variables: -## sh-basic-offset: 2 -## End: diff --git a/Scripts/developer_scripts/autotest_cgal_with_cmake b/Scripts/developer_scripts/autotest_cgal_with_cmake deleted file mode 100755 index bfe9f0addd8..00000000000 --- a/Scripts/developer_scripts/autotest_cgal_with_cmake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ${0%_with_cmake} ${1+"$@"} diff --git a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake index 96479acffeb..1d8a21b403e 100644 --- a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake +++ b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake @@ -1,4 +1,4 @@ -#option : +#options: # GIT_REPO the path to the Git repository, default is the current working directory # DESTINATION the path where the release is created, default is /tmp # PUBLIC=[ON/OFF] indicates if a public release should be built, default is OFF @@ -10,7 +10,7 @@ # GPL_PACKAGE_LIST=path to a file containing the list of GPL packages to include in the release. If not provided all of them are. # GENERATE_TARBALLS=[ON/OFF] indicates if release tarballs should be created as DESTINATION -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_program(BASH NAMES bash sh) function(process_package pkg) if(VERBOSE) @@ -208,8 +208,7 @@ foreach(manpage ${MANPAGES}) configure_file(${GIT_REPO}/Installation/${manpage} ${release_dir}/${manpage} @ONLY) endforeach() -# make an extra copy of examples and demos for the testsuite and generate -# create_cgal_test_with_cmake for tests, demos, and examples +# make an extra copy of examples and demos for the testsuite if (TESTSUITE) SET(FMT_ARG "format:SCM branch:%n%H %d%n%nShort log from master:%n") execute_process( @@ -228,23 +227,6 @@ if (TESTSUITE) #append result in .scm-branch file(APPEND ${release_dir}/.scm-branch "${OUT_VAR}") - file(GLOB tests RELATIVE "${release_dir}/test" "${release_dir}/test/*") - foreach(d ${tests}) - if(IS_DIRECTORY "${release_dir}/test/${d}") - if(NOT EXISTS "${release_dir}/test/${d}/cgal_test_with_cmake") - execute_process( - COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake - WORKING_DIRECTORY "${release_dir}/test/${d}" - RESULT_VARIABLE RESULT_VAR - OUTPUT_VARIABLE OUT_VAR - ) - if(NOT "${RESULT_VAR}" STREQUAL "0") - message(FATAL_ERROR "Error while running create_cgal_test_with_cmake in ${release_dir}/test/${d}") - endif() - endif() - endif() - endforeach() - file(MAKE_DIRECTORY "${release_dir}/tmp") #copy demo/PKG to test/PKG_Demo file(GLOB demos RELATIVE "${release_dir}/demo" "${release_dir}/demo/*") @@ -257,17 +239,6 @@ if (TESTSUITE) #do the copy in 2 pass since we cannot specify the target name file(COPY "${release_dir}/demo/${d}" DESTINATION "${release_dir}/tmp") file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Demo") - if(NOT EXISTS "${release_dir}/test/${d}_Demo/cgal_test_with_cmake") - execute_process( - COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake --no-run - WORKING_DIRECTORY "${release_dir}/test/${d}_Demo" - RESULT_VARIABLE RESULT_VAR - OUTPUT_VARIABLE OUT_VAR - ) - if(NOT "${RESULT_VAR}" STREQUAL "0") - message(FATAL_ERROR "Error while running create_cgal_test_with_cmake in ${release_dir}/test/${d}_Demo") - endif() - endif() endif() endif() endforeach() @@ -278,17 +249,6 @@ if (TESTSUITE) #do the copy in 2 pass since we cannot specify the target name file(COPY "${release_dir}/examples/${d}" DESTINATION "${release_dir}/tmp") file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Examples") - if(NOT EXISTS "${release_dir}/test/${d}_Examples/cgal_test_with_cmake") - execute_process( - COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake - WORKING_DIRECTORY "${release_dir}/test/${d}_Examples" - RESULT_VARIABLE RESULT_VAR - OUTPUT_VARIABLE OUT_VAR - ) - if(NOT "${RESULT_VAR}" STREQUAL "0") - message(FATAL_ERROR "Error while running create_cgal_test_with_cmake in ${release_dir}/test/${d}_Examples") - endif() - endif() endif() endforeach() file(REMOVE_RECURSE "${release_dir}/tmp") diff --git a/Scripts/developer_scripts/cgal_test_with_cmake b/Scripts/developer_scripts/cgal_test_with_cmake deleted file mode 100755 index 4a5c94aa7e9..00000000000 --- a/Scripts/developer_scripts/cgal_test_with_cmake +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -dir=${PWD%/*} -dir=${dir##*/} - -if [ "x${dir}" = "xdemo" ]; then - in_demo="--no-run" -fi - -[ ! -e CMakeLists.txt ] && echo "No CMakeLists.txt in current directory, creating it" && cgal_create_cmake_script test - -# If there is already a cgal_test_with_cmake script in the current directory, execute it. -[ ! -x cgal_test_with_cmake ] && echo "No cgal_test_with_cmake in current directory, creating it" && create_cgal_test_with_cmake ${in_demo} - -./cgal_test_with_cmake $@ -cat error.txt diff --git a/Scripts/developer_scripts/cgal_testsuite_report.py b/Scripts/developer_scripts/cgal_testsuite_report.py new file mode 100755 index 00000000000..e7953776764 --- /dev/null +++ b/Scripts/developer_scripts/cgal_testsuite_report.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python3 +import os +import json +from typing import Dict, List +from dataclasses import dataclass +from datetime import datetime +import subprocess +import re +import requests + +CGAL_SERVER_URL = "https://cgal.geometryfactory.com/CGAL" +LATEST_VERSION_URL = f"{CGAL_SERVER_URL}/Releases/LATEST" +JSON_DATA_URL_TEMPLATE = f"{ + CGAL_SERVER_URL}/testsuite/CGAL-{{version}}/search_index.json" +TESTSUITE_URL_TEMPLATE = f"{ + CGAL_SERVER_URL}/testsuite/results-{{version}}.shtml" +TIMEOUT_DURATION = 10 + + +@dataclass +class TPLInfo: + name: str + version: str + status: str + + +@dataclass +class PlatformInfo: + name: str + debug: str + os: str + tester: str + compiler: str + tpl_info: List[TPLInfo] + + +def fetch_data_from_url(url: str) -> str: + """Fetch data from a given URL.""" + response = requests.get(url, timeout=TIMEOUT_DURATION) + response.raise_for_status() + return response.text.strip() + + +def get_latest_version() -> str: + """Return latest CGAL version from LATEST (CGAL-.tar.gz)""" + tarball_name = fetch_data_from_url(LATEST_VERSION_URL) + match = re.match(r'CGAL-([^.]+\.[^-]+-[^-]+-\d+)', tarball_name) + if not match: + raise ValueError(f"Unexpected tarball name format: {tarball_name}") + return match.group(1) + + +def fetch_json_data(version: str) -> Dict: + """Fetch JSON data for the given CGAL testsuite.""" + url = JSON_DATA_URL_TEMPLATE.format(version=version) + json_data = fetch_data_from_url(url) + return json.loads(json_data) + + +def analyze_tpl_data(json_data: Dict) -> List[PlatformInfo]: + """Analyze TPL data from JSON and return a list of PlatformInfo.""" + platforms_info = [] + for platform in json_data.get('platforms', []): + tpl_list = [ + TPLInfo( + name=item.get('name', 'Unknown'), + version=item.get('version', 'N/A'), + status=item.get('status', 'unknown') + ) + for item in platform.get('third_party_libs', []) + ] + platform_info = PlatformInfo( + name=platform.get('platform_name', 'Unknown Platform'), + debug=platform.get('debug', '-'), + os=platform.get('operating_system', '-'), + tester=platform.get('tester_name', '-'), + compiler=platform.get('compiler', '-'), + tpl_info=tpl_list + ) + platforms_info.append(platform_info) + return platforms_info + + +def get_docker_images() -> Dict[str, List[str]]: + """ + Get Docker image information by calling `list_test_runner_machines`. + Returns a dictionary with machine names as keys and lists of images as values. + """ + try: + script_dir = os.path.dirname(os.path.abspath(__file__)) + result = subprocess.run( + [os.path.join(script_dir, 'list_test_runner_machines'), '--plain'], + capture_output=True, + text=True, + check=True + ) + output = result.stdout.strip() + + machines_info = {} + current_machine = None + parsing_images = False + + for line in output.splitlines(): + if line.startswith("## "): + current_machine = line.strip("# ").strip() + machines_info[current_machine] = [] + parsing_images = False + + elif line.startswith("Tested images:"): + parsing_images = True + + elif parsing_images and (line.startswith("cgal/testsuite-docker:") or line.startswith("docker.io/cgal/testsuite-docker:")): + machines_info[current_machine].append(line.strip()) + + return machines_info + + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"Error running `list_test_runner_machines`: {e}") from e + except Exception as e: + raise RuntimeError(f"Error parsing Docker information: {e}") from e + + +def add_docker_summary(report: List[str], machines_info: Dict[str, List[str]]): + """Add a summary of Docker images used on each machine to the report.""" + report.append("\n## Docker Test Summary") + for machine, images in machines_info.items(): + report.append(f"\n### Machine: {machine} ({len(images)} images)") + report.append("\n#### Tested Images\n") + for image in images: + report.append(f"- {image}") + + +def generate_markdown_report(platforms_info: List[PlatformInfo], version: str) -> str: + """Generate a markdown report from the platforms information.""" + machines_info = get_docker_images() + report = [] + report.append("# TestSuite Report") + report.append(f"\nGenerated on: { + datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") + url = TESTSUITE_URL_TEMPLATE.format(version=version) + report.append(f"\nCGAL Version: [{version}]({url})") + add_docker_summary(report, machines_info) + report.append("\n## Platforms Summary\n") + report.append("| Platform | Debug | OS | Tester | Compiler |") + report.append("|----------|-------|----|--------|----------|") + for platform in platforms_info: + report.append( + f"| {platform.name} | {platform.debug} | {platform.os} | " + f"{platform.tester} | {platform.compiler} |" + ) + report.append("\n## Detailed Third-party Libraries") + for platform in platforms_info: + report.append(f"\n### Platform: {platform.name}\n") + tpl_list = sorted(platform.tpl_info, key=lambda x: x.name) + report.append("| Library Name | Version | Status |") + report.append("|--------------|---------|--------|") + for tpl in tpl_list: + version_str = str(tpl.version) if tpl.version else "N/A" + status_str = "âŒ" if tpl.version == "not found" else "✅" + report.append(f"| {tpl.name} | {version_str} | {status_str} |") + found_tpls = sum(1 for tpl in tpl_list if tpl.version != "not found") + total_tpls = len(tpl_list) + report.append( + f"\n**Summary**: found {found_tpls} third-party libraries out of {total_tpls}") + return "\n".join(report) + + +def main(): + """Main function to generate the testsuite report.""" + try: + version = get_latest_version() + json_data = fetch_json_data(version) + platforms_info = analyze_tpl_data(json_data) + markdown_report = generate_markdown_report(platforms_info, version) + print(markdown_report) + except requests.RequestException as e: + print(f"**Error fetching data:**\n\n```\n{str(e)}\n```\n") + raise + except json.JSONDecodeError as e: + print(f"**Error: Invalid JSON data**\n\n```\n{str(e)}\n```") + print(f"\nFile:\n\n```json\n{e.doc}\n```") + raise + except Exception as e: + print(f"**Error processing data:**\n\n```\n{str(e)}\n```\n") + raise + + +if __name__ == "__main__": + main() diff --git a/Scripts/developer_scripts/create_cgal_test b/Scripts/developer_scripts/create_cgal_test deleted file mode 100755 index e10c3d11dea..00000000000 --- a/Scripts/developer_scripts/create_cgal_test +++ /dev/null @@ -1,214 +0,0 @@ -#! /bin/bash -# -# ============================================================================= -# $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Scripts/developer_scripts/create_cgal_test $ -# $Id: create_cgal_test 36975 2007-03-09 22:52:40Z spion $ -# -# author(s) : Wieger Wesselink, Geert-Jan Giezeman -# -# coordinator : Utrecht University -# ============================================================================= -# -# This script creates a cgal_test_with_cmake script with entries for files with a common -# C++ file extension (as mentioned in the g++ man page) in the current test directory. - -VERSION=1.1 - -DO_RUN="y" - -usage() -{ - echo 'Usage : create_cgal_test [--no-run]' - echo - echo ' --help : prints this usage help' - echo ' --no-run : produces a cgal_test_with_cmake script that only does compilation, no execution' - exit -} - -while [ $1 ]; do - case "$1" in - -h|-help|--h|--help) - usage; - ;; - --no-run) - DO_RUN="" - shift; continue - ;; - *) - echo "Unknown option: $1" - usage - ;; - esac -done - - -header() -{ - echo "#---------------------------------------------------------------------#" - echo "# $1" - echo "#---------------------------------------------------------------------#" -} - -create_script() -{ - echo "#! /bin/sh" - echo - echo "# This is a script for the CGAL test suite. Such a script must obey" - echo "# the following rules:" - echo "#" - echo "# - the name of the script is cgal_test_with_cmake" - echo "# - for every target two one line messages are written to the file 'error.txt'" - echo "# the first one indicates if the compilation was successful" - echo "# the second one indicates if the execution was successful" - echo "# if one of the two was not successful, the line should start with 'ERROR:'" - echo "# - running the script should not require any user interaction" - echo "# - the script should clean up object files and executables" - echo -cat << EOF - ERRORFILE=error.txt - DO_RUN=${DO_RUN} - if [ -z "\${MAKE_CMD}" ]; then - MAKE_CMD=make - fi - NEED_CLEAN= - -EOF - header "configure" -cat << 'EOF' - -configure() -{ - echo "Configuring... " - - if eval 'cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_DIR" \ - --no-warn-unused-cli \ - .' ; then - - echo " successful configuration" >> $ERRORFILE - else - echo " ERROR: configuration" >> $ERRORFILE - fi -} - -EOF - header "compile_and_run " -cat << EOF - -compile_and_run() -{ - if [ -z "\${CGAL_DATA_DIR}" ]; then - if [ -d \${CGAL_DIR}/data ]; then - export CGAL_DATA_DIR=\${CGAL_DIR}/data - else - if [ -d \${CGAL_DIR}/Data/data ]; then - export CGAL_DATA_DIR=\${CGAL_DIR}/Data/data - else - echo "ERROR: Cannot run test script, please set the variable CGAL_DATA_DIR" - exit 1 - fi - fi - fi - - echo "Runs will be using CGAL_DATA_DIR = \${CGAL_DATA_DIR}" - - echo "Compiling \$1 ... " - SUCCESS="y" - - if eval '"\${MAKE_CMD}" VERBOSE=ON -fMakefile \$1' ; then - echo " successful compilation of \$1" >> \$ERRORFILE - else - echo " ERROR: compilation of \$1" >> \$ERRORFILE - SUCCESS="" - fi - - if [ -n "\$DO_RUN" ] ; then - if [ -n "\${SUCCESS}" ] ; then - OUTPUTFILE=ProgramOutput.\$1.\$PLATFORM - rm -f \$OUTPUTFILE - COMMAND="./\$1" - if [ -f \$1.cmd ] ; then - COMMAND="\$COMMAND \`eval echo \$(cat \$1.cmd)\`" - fi - if [ -f \$1.cin ] ; then - COMMAND="cat \$1.cin | \$COMMAND" - fi - echo "Executing \$1 ... " - echo - ulimit -t 3600 2> /dev/null - if eval \$COMMAND > \$OUTPUTFILE 2>&1 ; then - echo " successful execution of \$1" >> \$ERRORFILE - else - echo " ERROR: execution of \$1" >> \$ERRORFILE - fi - else - echo " ERROR: not executed \$1" >> \$ERRORFILE - fi - fi -} - -EOF - header "remove the previous error file" -cat << EOF - -rm -f \$ERRORFILE -touch \$ERRORFILE - -EOF - header "configure, compile and run the tests" -cat << EOF - -configure - -if [ \$# -ne 0 ] ; then - for file in \$* ; do - compile_and_run \$file - done -else - echo "Run all tests." -EOF - - # workaround for Cygwin, to avoid that the 'sort' from - # C:\Windows\system32 is used instead of /usr/bin/sort - PATH=/usr/bin:$PATH - - for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do - if [ -n "`grep '\' $file`" ] ; then - BASE=`basename $file .cc` - BASE=`basename $BASE .cp` - BASE=`basename $BASE .cxx` - BASE=`basename $BASE .cpp` - BASE=`basename $BASE .CPP` - BASE=`basename $BASE .c++` - BASE=`basename $BASE .C` - cat < cgal_test_with_cmake -chmod 755 cgal_test_with_cmake -echo "created cgal_test_with_cmake, version $VERSION, in $PWD ..." diff --git a/Scripts/developer_scripts/create_cgal_test_with_cmake b/Scripts/developer_scripts/create_cgal_test_with_cmake deleted file mode 100755 index 0b7e222cbd7..00000000000 --- a/Scripts/developer_scripts/create_cgal_test_with_cmake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec "${0%_with_cmake}" ${1+"$@"} diff --git a/Scripts/developer_scripts/create_internal_release b/Scripts/developer_scripts/create_internal_release deleted file mode 100755 index a48b2a0996d..00000000000 --- a/Scripts/developer_scripts/create_internal_release +++ /dev/null @@ -1,650 +0,0 @@ -#!/usr/bin/env perl -#this script generates the internal release - -use warnings; - -use Cwd; -use File::Find; -use Getopt::Std; -use File::Spec; -use File::Temp; -use Archive::Tar; -use Archive::Tar::File; -use File::Copy; -use File::Copy::Recursive qw(dircopy); -use File::Path qw(mkpath); -use POSIX qw(strftime); - -$Getopt::Std::STANDARD_HELP_VERSION = 1; - -package main; -local $VERSION='$Id$'; - -sub HELP_MESSAGE() { - usage() -} - -sub usage() { - print STDERR<<"EOF"; -usage: - $0 (-h|-r) - [-n version number] - [-d releasedir] [-a allpackagesdir] - [-c candidatesdir] - [-l lockfile] - -Exactly one of the options -h or -r must be present. - -h show this message and quit - -r release version to be created - - -n version number (CGAL_VERSION_NR) - -d releasedir, default releasedir is the current dir - -a allpackagesdir, default is releasedir/trunk - -c candidatesdir - -l lockfile, default is releasedir/release_creation.lock - - The version number is stored in VERSION and include/CGAL/version.h. - The RELEASEDIR is the place where the new release will be created. - The ALLPACKAGESDIR is the directory that contains the checked out packages - from the SCM. Could be trunk or some branch. - The LOCKFILE is some file used by lockfile command as a mutex. - -Example of how to use the script: ->svn co svn+ssh://scm.gforge.inria.fr/svn/cgal/trunk ->./create_internal_release -r CGAL-3.3-I-1 -or ->./create_internal_release -r CGAL-3.3-I-7 -d \$HOME -a \$HOME/CGALSVN/trunk -l release_creation.lock - - -EOF -} - - -my $TEMPFILE="TEMPFILE.$$"; - -#----------------------------------------------------# -# initialization # -#----------------------------------------------------# - -my ( - $VERSION, - $VERSION_NR, - $LOCKFILE, - $ALLPACKAGESDIR, - $CANDIDATESDIR, - $RELEASEDIR, - $MAINDIR, - $SCRIPTSDIR, - $DEVELSCRIPTSDIR, - $LOCKCMD, -# 'files' is an associative array (hash table in perl language) that maps -# from files names (relative to CGAL_DIR) to the name of the package that -# provided it. - %files, -# 'LISTOFALLPACKAGES' is an associative array that maps from packages names -# to the full path of the working copy that provided it. - %LISTOFALLPACKAGES -); - -%LISTOFALLPACKAGES = (); - -sub termination_signal_handler { - unlink $LOCKFILE; - exit 1; -} - -sub lock() -{ - if (system("$LOCKCMD", "-r", '10', "$LOCKFILE") != 0) { - print STDERR <<"TOTHIER"; -The script could not proceed because -it could not acquire the needed lock on file $LOCKFILE. -TOTHIER - exit 1; - } - $SIG{QUIT} = \&termination_signal_handler; - $SIG{HUP} = \&termination_signal_handler; - $SIG{INT} = \&termination_signal_handler; - $SIG{TERM} = \&termination_signal_handler; -} - -sub unlock() -{ - unlink $LOCKFILE; - $SIG{QUIT} = 'DEFAULT'; - $SIG{HUP} = 'DEFAULT'; - $SIG{INT} = 'DEFAULT'; - $SIG{TERM} = 'DEFAULT'; -} - -sub add_one_package($) { - my ($package) = @_; -} - -sub list_packages($) { - my ($packages_directory) = @_; - opendir PACKAGESDIR, $packages_directory or die; - while (defined($package_name = readdir(PACKAGESDIR))) { - my $package_full_path = File::Spec->catdir($packages_directory, $package_name); - next if $package_name =~ /^\..*$/; - next if (! -d $package_full_path ); - next if ($package_full_path =~ /Maintenance$/); # skip Maintenance package - $LISTOFALLPACKAGES{$package_name} = $packages_directory; - } - closedir(PACKAGESDIR); -} - -sub install_packages() { - my ($filename, $direc, $tmp_package_name); - print "Installing packages ...\n"; - chdir $RELEASEDIR or die; - - if( ! open(LOG_CONFLICTS, ">>&=3") ) { - open(LOG_CONFLICTS, ">&", STDOUT) or die; - } - foreach my $package_name (keys(%LISTOFALLPACKAGES)) { - my $package_comes_from = $LISTOFALLPACKAGES{$package_name}; - my $package_full_path = File::Spec->catdir($package_comes_from, $package_name); - $dont_submit="$package_full_path/dont_submit"; - chdir "$package_comes_from" or die; - @command = ('tar', '-cf', "$RELEASEDIR/temppack.tar", '--exclude=.svn'); - # comment for later: once the tar version installed on - # cgal.geometryfactory.com knows the option --exclude-vcs, use that - # option instead of --exclude=.svn - # -- Laurent Rineau, 2009/12/04 (idea by Sylvain Pion) - if( -f $dont_submit ) { - @command = (@command, "--exclude-from=$dont_submit"); - } - @command = (@command, @global_dont_submit_tar_options); - @command = (@command, "-C", "$package_name", "."); - foreach( @command ) { - print "$_ "; - } - print "\n"; - system(@command); - - # generate the list of header file per package that not in an internal subdirectory. Files start with CGAL - $tempdir = File::Temp->newdir(); - if ( -d "$package_full_path/include" ) { - @filelistcmd = ('tar', '-tf', "$RELEASEDIR/temppack.tar", '--wildcards', "./include/\*\*.h", - "--transform=s/.\\\/include\\\///", '--show-transformed-names', - '--exclude=**/internal', "--index-file=$tempdir/$package_name.txt"); - system(@filelistcmd); - } - - move("$RELEASEDIR/temppack.tar", "$RELEASEDIR/$VERSION/"); - - chdir "$RELEASEDIR/$VERSION" or die; - my $tar = Archive::Tar->new; - open my $TARFILL, "$RELEASEDIR/$VERSION/temppack.tar" or die; - if(! $tar->read($TARFILL)) { - unlink 'temppack.tar'; - next; - } - for( $tar->get_files() ) - { - my $filename = $_->name(); - if( ! $_->is_dir() ) - { - if(exists($files{$_->name()})) - { - print LOG_CONFLICTS "File ", $_->name(), " from package ", $package_name; - print LOG_CONFLICTS " conflicts with one from package ", $files{$_->name()}. "\n"; - } - else - { - $files{$_->name()} = $package_name; - } - } - else { # is_dir() returned true - next if ($filename !~ /^\.\/?$/) and ($filename =~ /^\.\.?\/?$/); - my $package_from_from = $LISTOFALLPACKAGES{$package_name}; - mkpath($filename); -# system("svn info $package_comes_from/$package_name/$filename | grep URL >> $filename/.scm-urls\n"); - } - } - system('tar', '-xf', "temppack.tar"); - if ( -e "$tempdir/$package_name.txt" ) { - if ( -d "$RELEASEDIR/$VERSION/doc/$package_name/" ) { - system("mv", ,"$tempdir/$package_name.txt", "$RELEASEDIR/$VERSION/doc/$package_name/filelist.txt"); - } else { - system("rm", ,"$tempdir/$package_name.txt"); - } - } - -# $tmp_package_name = "temp_${package_name}"; -# system("mv", "$package_name", "$tmp_package_name"); -# opendir packagename, "$tmp_package_name"; -# @fichiers = readdir packagename; -# closedir packagename; -# #shift @fichiers; shift @fichiers; -# foreach $fichier (@fichiers){ -# if ($fichier ne '.' && $fichier ne '..'){ -# system('cp', '-r', "$tmp_package_name/$fichier", "$RELEASEDIR/$VERSION"); -# } -# } -# system('rm', '-rf', "$tmp_package_name"); - } - close(LOG_CONFLICTS); - unlink 'temppack.tar'; - ( -d "$ALLPACKAGESDIR/.git" ) && system("git --git-dir=$ALLPACKAGESDIR/.git --work-tree=$ALLPACKAGESDIR log -n1 '--format=format:SCM branch:%n%H %d%n%nShort log from master:%n' > .scm-branch"); - ( -d "$ALLPACKAGESDIR/.git" ) && system("git --git-dir=$ALLPACKAGESDIR/.git --work-tree=$ALLPACKAGESDIR log --first-parent --format='%h %s%n parents: %p%n' cgal/master.. >> .scm-branch"); - # foreach my $file (sort keys(%files)) { - # print "$files{$file}: $file\n"; - # } -} - - -#-----------------------------------------------------------------------# -# set the version information in VERSION and include/CGAL/version.h # -#-----------------------------------------------------------------------# - -sub create_version_file() -{ -#if VERSION starts with CGAL-, we remove "CGAL-" from version -#the $newver variable will store the right version - if ($VERSION =~ /CGAL-(.*)/) { - $newver = $1; - } else { - $newver = $VERSION; - } - - # Create VERSION file - chdir "$RELEASEDIR/$VERSION" or die; - open(TEMPFILE, ">tempfile") or die; - print TEMPFILE "$newver"; - close TEMPFILE || die "Error closing temporary file: $!\n"; - move("tempfile", 'VERSION'); - - # Create include/CGAL/version.h file - chdir "$RELEASEDIR/$VERSION/include/CGAL" or die; - open(TEMPFILE, ">tempfile") or die; - - my $RELEASE_DATE = strftime "%Y%m%d", localtime; -# TODO : add `svnversion` Revision. - - print TEMPFILE << 'EOF'; -// Copyright (c) 2006 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. -// -// SPDX-License-Identifier: LGPL-3.0-or-later -// -// Author(s) : - - -// This file is automatically created by create_internal_release. -// Do not edit manually. - -#ifndef CGAL_VERSION_H -#define CGAL_VERSION_H - -#define CGAL_xstr(s) #s -#define CGAL_str(s) CGAL_xstr(s) - -EOF - print TEMPFILE "#define CGAL_VERSION $newver\n"; - print TEMPFILE "#define CGAL_VERSION_NR $VERSION_NR\n"; - print TEMPFILE "#define CGAL_SVN_REVISION 0\n"; - print TEMPFILE "#define CGAL_GIT_HASH 0\n"; - print TEMPFILE "#define CGAL_RELEASE_DATE $RELEASE_DATE\n"; - -print TEMPFILE << 'EOF'; -#define CGAL_VERSION_STR CGAL_str(CGAL_VERSION) - -#endif -EOF - - close TEMPFILE || die "Error closing temporary file: $!\n"; - move("tempfile", 'version.h'); - chdir '../..' or die; -} - -#---------------------------------------------------------------# -# CreateExampleTestDirs -#---------------------------------------------------------------# - -sub CreateExampleTestDirs() -{ - my $DIR; - chdir "$RELEASEDIR/$VERSION" or die; - chdir 'examples' or return; - print "Creating $VERSION/test/example directories ...\n"; - foreach $DIR (glob("*")) { - if ( -d $DIR ) { - print "Creating test/${DIR}_Examples ...\n"; - dircopy("$DIR", "../test/${DIR}_Examples"); - } - } - chdir '..'; -} - - -#---------------------------------------------------------------# -# CreateDemoTestDirs -#---------------------------------------------------------------# - -sub CreateDemoTestDirs() -{ - my $DIR; - chdir "$RELEASEDIR/$VERSION" or die; - chdir 'demo' or return; - print "Creating $VERSION/test/demo directories ...\n"; - foreach $DIR (glob("*")) { - if ( -d $DIR) { - if( ("$DIR" ne "icons") && ("$DIR" ne "resources") ) { - print "Creating test/${DIR}_Demo ...\n"; - dircopy("$DIR", "../test/${DIR}_Demo"); - } - else { - print "Creating test/${DIR}...\n"; - dircopy("$DIR", "../test/${DIR}"); - } - } - } - chdir '..'; -} - - -#---------------------------------------------------------------# -# make_testscripts and generate makefiles in test and examples -#---------------------------------------------------------------# - -sub make_testscripts() -{ - my ($DIR, $BASEDIR); - chdir "$RELEASEDIR/$VERSION" or die; - $BASEDIR = cwd(); - print "Creating and checking makefiles ...\n"; - - chdir 'test'; - foreach $DIR (glob("*")) { - if ( (-d $DIR) && ("$DIR" ne "icons") && ("$DIR" ne "resources") ) { - chdir $DIR; - if ( -f 'Makefile') { - rename 'Makefile', 'makefile'; - } - if ( -f 'makefile' ) { - open MAKEFILE, "makefile"; - open NEW_MAKEFILE, ">makefile.new"; - while () { - s/\.o\b/\$(OBJ_EXT)/g; - s/-g\b/\$(DEBUG_OPT)/g; - print NEW_MAKEFILE $_; - } - close NEW_MAKEFILE; - close MAKEFILE; - rename("makefile.new","makefile"); - } else { - my $options = '-t'; - if ( -f 'cgal_create_makefile_options') { - if (open(OPTIONS, "; - chomp; - if (/^[\w\s-]+$/) { $options = $_; - } else { - print STDERR "Rejected cgal_create_makefile_options in $DIR\n"; - } - close OPTIONS; - } - } - system("$SCRIPTSDIR/cgal_create_makefile", $options) == 0 or die "Execution of $SCRIPTSDIR/cgal_create_makefile failed"; - } - if ( ! -f 'cgal_test' ) { - $_ = $DIR; - # chomp; - if (/_Demo$/) { - system("$DEVELSCRIPTSDIR/create_cgal_test", "--no-run") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test --no-run failed"; - } else { - system("$DEVELSCRIPTSDIR/create_cgal_test") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test failed"; - } - } - chdir '..'; - } - } - chdir $BASEDIR; - chdir 'examples'; - - print "Creating makefiles in examples\n"; - foreach $DIR (glob("*")) { - if ( -d $DIR ) { - chdir $DIR; - if ( -f 'Makefile') { - rename 'Makefile', 'makefile'; - } - if ( -f 'makefile' ) { - open MAKEFILE, "makefile"; - open NEW_MAKEFILE, ">makefile.new"; - while () { - s/\.o\b/\$(OBJ_EXT)/g; - s/-g\b/\$(DEBUG_OPT)/g; - print NEW_MAKEFILE $_; - } - close NEW_MAKEFILE; - close MAKEFILE; - rename("makefile.new","makefile"); - } else { - my $options = '-d'; - if ( -f 'cgal_create_makefile_options') { - if (open(OPTIONS, "; - chomp; - if (/^[\w\s-]+$/) { $options = $_; - } else { - print STDERR "Rejected cgal_create_makefile_options in $DIR\n"; - } - close OPTIONS; - } - } - system("$SCRIPTSDIR/cgal_create_makefile", $options) == 0 or die "Execution of $SCRIPTSDIR/cgal_create_makefile failed"; - } - chdir '..'; - } - } - chdir $BASEDIR; -} - - -#---------------------------------------------------------------# -# Generates a CMakeLists.txt in every subdirectory -# of the current directory if none already exists -#---------------------------------------------------------------# - -sub generate_cmake_scripts -{ - my $options = $_[0]; - - foreach $DIR (glob("*")) - { - if ( (-d $DIR) && ("$DIR" ne "icons") && ("$DIR" ne "resources") ) - { - chdir $DIR; - - if ( ! -f 'CMakeLists.txt' ) - { - $_ = $DIR; - - if ( -f 'cgal_create_cmake_script_options') - { - if (open(OPTIONS, "; - chomp; - if (/^[\w\s-]+$/) - { - $options = $_; - } - else - { - print STDERR "Rejected cgal_create_cmake_script_options in $DIR\n"; - } - close OPTIONS; - } - } - system("\"$SCRIPTSDIR/cgal_create_cmake_script\" $options") == 0 or die "Execution of \"$SCRIPTSDIR/cgal_create_cmake_script $options\" failed"; - } - - chdir '..'; - } - } -} - -sub generate_cgal_test_with_cmake -{ - foreach $DIR (glob("*")) - { - if ( (-d $DIR) && ("$DIR" ne "icons") && ("$DIR" ne "resources") ) - { - chdir $DIR; - if ( ! -f 'cgal_test_with_cmake' ) - { - $_ = $DIR; - my $options = (/_Demo$/) ? '--no-run' : '' ; - - system("$DEVELSCRIPTSDIR/create_cgal_test_with_cmake", $options) == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test_with_cmake $options failed in directory $DIR"; - } - chdir '..'; - } - } -} - -sub make_testscripts_for_cmake -{ - my ($DIR, $BASEDIR); - chdir "$RELEASEDIR/$VERSION" or die; - $BASEDIR = cwd(); - - chdir 'test'; - - print "Creating test scripts\n"; - generate_cgal_test_with_cmake(); - - print "Creating cmake scripts in test\n"; - generate_cmake_scripts('test'); - - chdir $BASEDIR; - chdir 'examples'; - - print "Creating cmake scripts in examples\n"; - generate_cmake_scripts('example'); - - chdir $BASEDIR; - chdir 'demo'; - - print "Creating cmake scripts in demo\n"; - generate_cmake_scripts('demo'); - - chdir $BASEDIR; -} - - -#----------------------------------------------------# -# Main entry point # -#----------------------------------------------------# - - -sub main(){ - - $RELEASEDIR=cwd(); - $ALLPACKAGESDIR="$RELEASEDIR/trunk"; - $LOCKFILE="$RELEASEDIR/release_creation.lock"; - $LOCKCMD='lockfile'; - - our ($opt_h, $opt_r, $opt_a, $opt_c, $opt_d, $opt_l, $opt_p, $opt_s, $opt_n); - - if(! getopts('hr:a:c:d:l:p:s:n:') || $::opt_h ) { - usage(); - die "\n"; - } - if ($::opt_d){ - $RELEASEDIR = $::opt_d; - $ALLPACKAGESDIR = "$RELEASEDIR/trunk"; - $LOCKFILE="$RELEASEDIR/release_creation.lock"; - } - - if ($::opt_r){ - $VERSION = $::opt_r; - if ($::opt_n){ - $VERSION_NR = $::opt_n; - } else { - $VERSION_NR = $VERSION; - } - } else { - usage(); - die "\n"; - } - if ($::opt_a){ - $ALLPACKAGESDIR = File::Spec->rel2abs( $::opt_a ) ; - } - if ($::opt_c){ - $CANDIDATESDIR = File::Spec->rel2abs( $::opt_c ) ; - } - if ($::opt_l){ - $LOCKFILE = $::opt_l; - } - $SCRIPTSDIR="$ALLPACKAGESDIR/Scripts/scripts"; - $DEVELSCRIPTSDIR="$ALLPACKAGESDIR/Scripts/developer_scripts"; - $global_dont_submit="$ALLPACKAGESDIR/Maintenance/release_building/global_dont_submit"; - @global_dont_submit_tar_options = (); - if (open(GLOBAL_DONT_SUBMIT, "<", $global_dont_submit) ) { - while() { - chomp; - @global_dont_submit_tar_options = (@global_dont_submit_tar_options, "--exclude=$_"); - } - close(GLOBAL_DONT_SUBMIT); - } - print "Initializing variables ...\n"; - print " Release dir: $RELEASEDIR\n"; - print " All packages dir: $ALLPACKAGESDIR\n"; - if($CANDIDATESDIR) { - print " Candidates packages dir: $CANDIDATESDIR\n"; - } - print " Scripts dir: $SCRIPTSDIR\n"; - print " Developer Scripts dir: $DEVELSCRIPTSDIR\n"; - print " Lockfile: $LOCKFILE\n"; - umask(002); - chdir $RELEASEDIR or die; - if (! -d $VERSION){ - print "Creating release directory ${VERSION} ...\n"; - mkdir($VERSION, 0775); - } else { - print "$VERSION already exists in $RELEASEDIR\n"; - print "Please remove it first\n"; - exit 1; - } - lock; - - list_packages($ALLPACKAGESDIR); - if($CANDIDATESDIR) { - list_packages($CANDIDATESDIR); - } - install_packages(); - - CreateDemoTestDirs(); - CreateExampleTestDirs(); - create_version_file(); - #make_testscripts(); - make_testscripts_for_cmake(); - - unlock; -} - -main(); - -# Set the indent level of perl-mode, in Emacs. -# For that file it is mostly 2, so let's choose 2. -### Local Variables: -### perl-indent-level: 2 -### End: diff --git a/Scripts/developer_scripts/create_new_release b/Scripts/developer_scripts/create_new_release index e5f91c48877..c8ab40d3929 100755 --- a/Scripts/developer_scripts/create_new_release +++ b/Scripts/developer_scripts/create_new_release @@ -4,14 +4,6 @@ # # Radu Ursu, Sylvain Pion, 2004-2006. -# TODO : -# - Cleanup the public/internal separation: -# - have CGAL_VERSION_NR be not affected by the internal version -# - have CGAL_REVISION be the revision (replacing the internal number) -# - The public release case should pass the info to create_internal_release. -# [new] : create_internal_release should not know about internal/public mode. -# - Merge [some parts] into ./create_internal_release ? - DO_PUBLIC="" # Also build the public versions DO_IT="" # Real mode (copy to HTTP server), versus local testing DO_NOT_TAG="" # If set, do not call tag diff --git a/Scripts/developer_scripts/list_test_runner_machines b/Scripts/developer_scripts/list_test_runner_machines new file mode 100755 index 00000000000..78977ca81e3 --- /dev/null +++ b/Scripts/developer_scripts/list_test_runner_machines @@ -0,0 +1,320 @@ +#!/bin/bash + +# Declare an associative array to store the images used on each machine +declare -A MACHINE_CONTAINER_IMAGES + +TEST_MACHINES=( + "lrineau@bonnard" + "lrineau@cgal" + "cgaltest@friedrich" + "lrineau@rubens" +) + +machine_title() { + printf '\n## %s ##\n' "$1" +} + +machine_info() { + HOST=$1 + remote_script=$(printf "export PS4='+ %s >> %s'\n" "$HOST" "$PS4")$'\n'$( + cat <<'EOF' +source /etc/os-release +printf '\n- OS: `%s`\n- container implementation: `%s`\n' "$PRETTY_NAME" "$(docker --version)" +EOF + ) + ssh "$HOST" bash -$- -s <<<"$remote_script" +} + +machine_tested_images() { + echo + echo '```plain' + printf '%s\n' "${MACHINE_CONTAINER_IMAGES["$1"]}" + echo '```' +} + +docker_is_active_cmd() { + systemctl is-active -q docker + return $? +} +declare -xf docker_is_active_cmd + +docker_cmd() { + if docker_is_active_cmd; then + docker "$@" + else + podman --url unix:/var/run/podman/podman.sock "$@" + fi +} +declare -xf docker_cmd + +list_of_containers_cmd() { + docker_cmd ps -a --format '{{.Names}}' --filter name="CGAL-" +} +declare -xf list_of_containers_cmd + +container_status_cmd() { + docker_cmd inspect --format '{{.State.Status}}' "$1" +} +declare -xf container_status_cmd + +container_human_readable_status_cmd() { + docker_cmd ps --all --filter name="$1" --format '{{.Status}}' +} +declare -xf container_human_readable_status_cmd + +simplify_date_cmd() { + date=$1 + pattern=' \+[0-9]{4} [+]?[A-Z0-9]{3,}$' + if [[ $date =~ $pattern ]]; then + date=${date% *} + fi + echo "$date" +} +declare -xf simplify_date_cmd + +container_start_time_cmd() { + simplify_date_cmd "$(docker_cmd inspect --format '{{.State.StartedAt}}' "$1")" +} +declare -xf container_start_time_cmd + +container_end_time_cmd() { + simplify_date_cmd "$(docker_cmd inspect --format '{{.State.FinishedAt}}' "$1")" +} +declare -xf container_end_time_cmd + +container_running_time_cmd() { + start_time=$(container_start_time_cmd "$1") + end_time=$(container_end_time_cmd "$1") + status=$(container_status_cmd "$1") + if [ "$status" = "running" ]; then + end_time=$(date -u '+%Y-%m-%dT%H:%M:%S.%NZ') + fi + secs=$(($(date -d "$end_time" +%s) - $(date -d "$start_time" +%s))) + printf '%02dh:%02dm:%02ds\n' $((secs / 3600)) $((secs % 3600 / 60)) $((secs % 60)) +} +declare -xf container_running_time_cmd + +display_one_container_line_cmd() { + printf '%s\t%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" "$5" +} +declare -xf display_one_container_line_cmd + +list_cgal_test_container_cmd() { + # docker_cmd ps -a --filter name=CGAL- + display_one_container_line_cmd "CONTAINER" "START TIME" "END TIME" "RUNNING TIME" "STATUS" + for container in $(list_of_containers_cmd); do + start_time="$(container_start_time_cmd "$container")" + end_time="$(container_end_time_cmd "$container")" + dur=$(container_running_time_cmd "$container") + status="$(container_status_cmd "$container") - $(container_human_readable_status_cmd "$container")" + display_one_container_line_cmd "$container" "$start_time" "$end_time" "$dur" "$status" + done +} +declare -xf list_cgal_test_container_cmd + +display_all_exported_cmd_functions() { + functions=$(declare -F | awk '/ -fx .*_cmd$/ {print $3}') + for func in $functions; do + declare -f "$func" + done +} + +machine_list_cgal_test_container() { + printf '\n```tsv\n' + remote_script=$( + display_all_exported_cmd_functions + printf "export PS4='+ %s >> %s'\n" "$1" "$PS4" + echo list_cgal_test_container_cmd + ) + ssh "$1" bash -$- -s <<<"$remote_script" + printf '```\n' +} + +help() { + cat <&2 + echo "ERROR: $1" + echo + help + exit 1 +} + +command -v sed >/dev/null || { + error_out 'sed is required' +} + +if [[ $1 == --table ]] && ! command -v pandoc >/dev/null; then + error_out 'pandoc is required for the option --table' +fi +if [[ $1 == --column ]] && ! command -v column >/dev/null; then + error_out 'column is required for the option --column' +fi +if [[ $1 == --bat ]] && ! command -v bat >/dev/null; then + error_out 'bat is required for the option --bat' +fi + +set_pretty_csv_to_md_table() { + pretty_csv() ( + echo + sed '/```/ d; /^$/ d' | pandoc -f tsv -t gfm + ) +} + +set_pretty_csv_to_column() { + pretty_csv() { + echo + column -t -s $'\t' -o $'\t' | sed 's/^\(```[^ ]*\) *\t.*/\1/' + } +} + +set_pretty_csv_to_column_and_bat() { + pretty_csv() { + echo + column -t -s $'\t' -o $'\t' | sed 's/^\(```[^ ]*\) *\t.*/\1/' | bat --paging=never --plain -l csv + } +} + +set_pretty_csv_to_bat() { + pretty_csv() { + bat --tabs=50 --paging=never --plain -l csv + } +} + +set_pretty_csv_to_cat() { + pretty_csv() { + cat + } +} + +WHAT=() + +add_to_what() { + for i in "$@"; do + WHAT+=("$i") + done +} + +what_contains() { + local item=$1 + for i in "${WHAT[@]}"; do + if [[ "$i" == "$item" ]]; then + return 0 + fi + done + return 1 +} + +for arg in "$@"; do + case "$arg" in + --table) set_pretty_csv_to_md_table ;; + --column) set_pretty_csv_to_column ;; + --bat) set_pretty_csv_to_bat ;; + --plain) set_pretty_csv_to_cat ;; + --images) add_to_what images ;; + --containers) add_to_what containers ;; + --info) add_to_what info ;; + -h | --help) + help >&2 + exit 0 + ;; + *) + error_out "Unknown option $arg" + ;; + esac +done + +if [ ${#WHAT[@]} -eq 0 ]; then + add_to_what info images containers +fi + +STDOUT_IS_A_TTY= +if <&1 tty -s; then + STDOUT_IS_A_TTY=1 +fi + +BAT= +[ -n "$STDOUT_IS_A_TTY" ] && BAT=$(command -v bat) + +COLUMN=$(command -v column) + +PANDOC=$(command -v pandoc) +if ! declare -f pretty_csv >/dev/null; then + if [ -n "$BAT" ]; then + if [ -n "$COLUMN" ]; then + set_pretty_csv_to_column_and_bat + else + set_pretty_csv_to_bat + fi + elif [ -n "$PANDOC" ]; then + set_pretty_csv_to_md_table + elif [ -n "$COLUMN" ]; then + set_pretty_csv_to_column + else + set_pretty_csv_to_cat + fi +fi + +ERROR_MACHINES="" +for machine in "${TEST_MACHINES[@]}"; do + USER=${machine%@*} + HOST=${machine#*@} + # shellcheck disable=SC2029 + MACHINE_CONTAINER_IMAGES[$machine]=$(ssh "$HOST" cat "/home/$USER/.config/CGAL/test_cgal_docker_images") || { + ERROR_MACHINES="$ERROR_MACHINES $machine" + } +done +if [ -n "$ERROR_MACHINES" ]; then + printf '\n> %s\n> %s\n' '[!CAUTION]' 'ERROR:' + for machine in $ERROR_MACHINES; do + USER=${machine%@*} + HOST=${machine#*@} + # shellcheck disable=SC2016 + printf '> - ERROR: cannot read file `/home/%s/.config/CGAL/test_cgal_docker_images` on ssh host `%s`\n' "$USER" "$HOST" + done + exit 1 +fi +cat </dev/null |cut -d/ -f1 |grep -E -v Installation||true) - -LIST_OF_PKGS="" -for PKG in $(ls) ; do - if [ -f $PKG/package_info/$PKG/dependencies ]; then - if [ -n "$(comm -12 <(echo "$TMP_LIST"|sort) <(cat $PKG/package_info/$PKG/dependencies|sort))" ]; then - LIST_OF_PKGS="$LIST_OF_PKGS $PKG" - fi - fi -done -if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi -if [ "$LIST_OF_PKGS" != "" ]; then - for f in $LIST_OF_PKGS - do - echo "echo \"$f\"" >> ${CGAL_ROOT}/list_test_packages - echo "echo \"${f}_Examples\"" >> ${CGAL_ROOT}/list_test_packages - echo "echo \"${f}_Demo\"" >> ${CGAL_ROOT}/list_test_packages - done -fi -#create the release from the branch -echo " Create release..." -CGAL_VERSION="$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-Ic-${PR_NUMBER}" -cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log -echo "done." -DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log); - -cd ${CGAL_ROOT} - -if [ -L CGAL-I ]; then rm CGAL-I; fi -ln -s $PWD/CGAL-TEST/$DEST CGAL-I -if [ -d CGAL-I/cmake/platforms ]; then - rm -rf CGAL-I/cmake/platforms/* -fi -echo "starting testsuite..." - -./autotest_cgal -c - -echo "finished." -)>${CGAL_ROOT}/autotest.log2 2>&1 & - -echo "exit." -exit 0 diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index 64739b8cac6..eb0f9e916ee 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -206,7 +206,7 @@ fi #check no file contains non-utf8 characters echo '.. Checking if non utf-8 characters are used...' -txt_not_utf8=$(git ls-files -z --stage | awk -F"\t" 'BEGIN { RS="\0" }; { printf "%s\n", $2; }' | xargs file -N | grep "text" | grep -E -v "UTF-8|ASCII|CSV|XML|EPS|FIG|assembler source|Perl script|from flex") +txt_not_utf8=$(git ls-files -z --stage | awk -F"\t" 'BEGIN { RS="\0" }; { printf "%s\n", $2; }' | xargs file -N | grep "text" | grep -E -v "UTF-8|ASCII|CSV|XML|EPS|FIG|JSON|pixmap|magic|assembler source|Perl script|from flex") if [ -n "${txt_not_utf8}" ]; then echo "The following files have non utf-8 characters:" echo ${txt_not_utf8} diff --git a/Scripts/scripts/cgal_create_CMakeLists b/Scripts/scripts/cgal_create_CMakeLists index e83f25c1286..122db278a79 100755 --- a/Scripts/scripts/cgal_create_CMakeLists +++ b/Scripts/scripts/cgal_create_CMakeLists @@ -85,7 +85,7 @@ create_cmake_script_with_options() # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) EOF #--------------------------------------------------------------------------- diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index 3b74a4a3da6..c3ca8376f43 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -31,7 +31,7 @@ create_cmake_script() # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( ${PROJECT}${TYPE} ) find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core ) @@ -49,7 +49,7 @@ EOF echo "include_directories (BEFORE \"${SOURCE_DIR}include\")" echo fi - + for file in `ls "$SOURCE_DIR"*.cc "$SOURCE_DIR"*.cp "$SOURCE_DIR"*.cxx "$SOURCE_DIR"*.cpp "$SOURCE_DIR"*.CPP "$SOURCE_DIR"*.c++ "$SOURCE_DIR"*.C 2>/dev/null | sort` ; do # Create an executable for each cpp that contains a function "main()" BASE=`basename $file .cc` @@ -90,18 +90,21 @@ while [ $1 ]; do -h|-help|--h|--help) usage; exit ;; - example) + example) if [ -z "$TYPE" ]; then TYPE=_Examples; shift; else usage; exit 1; fi ;; - demo) + demo) if [ -z "$TYPE" ]; then TYPE=_Demo; shift; else usage; exit 1; fi ;; - test) + test) if [ -z "$TYPE" ]; then TYPE=; shift; else usage; exit 1; fi ;; + benchmark) + if [ -z "$TYPE" ]; then TYPE=_Benchmarks; shift; else usage; exit 1; fi + ;; --source_dir) - if [ -d "$2" ]; then - SOURCE_DIR=$2; + if [ -d "$2" ]; then + SOURCE_DIR=$2; shift; shift; else @@ -112,7 +115,7 @@ while [ $1 ]; do echo "Error: \"$2\" is not a directory!" echo fi - usage; exit 1; + usage; exit 1; fi ;; *) diff --git a/SearchStructures/doc/SearchStructures/PackageDescription.txt b/SearchStructures/doc/SearchStructures/PackageDescription.txt index a2f35335bfc..3fdc12fd5b8 100644 --- a/SearchStructures/doc/SearchStructures/PackageDescription.txt +++ b/SearchStructures/doc/SearchStructures/PackageDescription.txt @@ -10,7 +10,6 @@ /*! \addtogroup PkgSearchStructuresRef -\todo check generated documentation \cgalPkgDescriptionBegin{dD Range and Segment Trees,PkgSearchStructures} \cgalPkgPicture{segment_tree.png} \cgalPkgSummaryBegin diff --git a/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt b/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt index cd2ca858e8c..e76de2ed570 100644 --- a/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt +++ b/SearchStructures/examples/RangeSegmentTrees/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(RangeSegmentTrees_Examples) find_package(CGAL REQUIRED) diff --git a/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt b/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt index 661aac496bb..4d9c045cdca 100644 --- a/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt +++ b/SearchStructures/test/RangeSegmentTrees/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(RangeSegmentTrees_Tests) find_package(CGAL REQUIRED) diff --git a/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt b/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt index 7b51d363797..c8eaef98912 100644 --- a/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt index 947f7034f0d..8db5cfb3b9b 100644 --- a/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt +++ b/Segment_Delaunay_graph_2/doc/Segment_Delaunay_graph_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgSegmentDelaunayGraph2Ref /*! \addtogroup PkgSegmentDelaunayGraph2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Segment Delaunay Graphs,PkgSegmentDelaunayGraph2} \cgalPkgPicture{svd.png} \cgalPkgSummaryBegin diff --git a/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt b/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt index 18da5df1518..5b83dc70bdf 100644 --- a/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt index 9507b4e0539..39174628037 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp index aabc32a7b35..57ed0cc3fd4 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/test_sdg_traits_2.cpp @@ -1,14 +1,11 @@ -#include -#include -#include -#include -#include -#include -#include + #include #include +#include +#include + #if defined(CGAL_USE_CORE) || defined(CGAL_USE_LEDA) #include #endif @@ -16,6 +13,10 @@ #include #include +#include +#include +#include +#include typedef CGAL::Simple_cartesian Double_Kernel; typedef CGAL::Simple_cartesian > IT_Kernel; diff --git a/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 490127d7e40..c6070560bce 100644 --- a/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_Linf_2/benchmark/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_2_example) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt b/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt index 3b8dcdecfb0..42096623238 100644 --- a/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt +++ b/Segment_Delaunay_graph_Linf_2/doc/Segment_Delaunay_graph_Linf_2/PackageDescription.txt @@ -4,7 +4,6 @@ /*! \addtogroup PkgSegmentDelaunayGraphLinf2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{L Infinity Segment Delaunay Graphs,PkgSegmentDelaunayGraphLinf2} \cgalPkgPicture{sdglinf-small.png} diff --git a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 36922d90e81..85becfa330f 100644 --- a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_Linf_2_Examples) find_package(CGAL REQUIRED) diff --git a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 7c8b12dcd47..d4b41c10d96 100644 --- a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Segment_Delaunay_graph_Linf_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp index 570eb727a6f..0e96c246782 100644 --- a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp +++ b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/test_sdg_linf_traits_2.cpp @@ -5,20 +5,20 @@ #define CGAL_SDG_DEBUG(a) { a } #endif +#include +#include + #include #include #include #include -#include #include #include #include #include #include -#include -#include diff --git a/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt b/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt index d8a58dc8c2e..95db7735c9c 100644 --- a/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt +++ b/Set_movable_separability_2/examples/Set_movable_separability_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Set_movable_separability_2_Examples) find_package(CGAL REQUIRED) diff --git a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/is_pullout_direction.h b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/is_pullout_direction.h index a521d29ed2b..035ccbef593 100644 --- a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/is_pullout_direction.h +++ b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/is_pullout_direction.h @@ -55,7 +55,7 @@ bool is_pullout_direction { //NOT CHECKED AT ALL CGAL_precondition(pgn.is_simple()); - CGAL_precondition(!internal::is_any_edge_colinear(pgn, traits)); + CGAL_precondition(!internal::is_any_edge_collinear(pgn, traits)); auto e_it = pgn.edges_begin(); auto cc_in_between = traits.counterclockwise_in_between_2_object(); @@ -137,7 +137,7 @@ is_pullout_direction(const CGAL::Polygon_2& pgn, typedef typename Polygon_2::Edge_const_iterator Edge_iter; CGAL_precondition(pgn.is_simple()); - CGAL_precondition(!internal::is_any_edge_colinear(pgn, traits)); + CGAL_precondition(!internal::is_any_edge_collinear(pgn, traits)); Edge_iter e_it = pgn.edges_begin(); auto segment_outer_circle = diff --git a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/pullout_directions.h b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/pullout_directions.h index 7073c0392fc..bd3223fea36 100644 --- a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/pullout_directions.h +++ b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/pullout_directions.h @@ -73,7 +73,7 @@ pullout_directions CastingTraits_2& traits) { CGAL_precondition(pgn.is_simple()); - CGAL_precondition(!internal::is_any_edge_colinear(pgn, traits)); + CGAL_precondition(!internal::is_any_edge_collinear(pgn, traits)); CGAL_precondition(pgn.edges_end()!=i); typedef CastingTraits_2 Casting_traits_2; diff --git a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/top_edges.h b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/top_edges.h index 0aa6b3a92b9..748cb8214ff 100644 --- a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/top_edges.h +++ b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/Single_mold_translational_casting/top_edges.h @@ -75,7 +75,7 @@ OutputIterator top_edges(const CGAL::Polygon_2& polygon, typedef CastingTraits_2 Traits; CGAL_precondition(polygon.is_simple()); - CGAL_precondition(!internal::is_any_edge_colinear(polygon, traits)); + CGAL_precondition(!internal::is_any_edge_collinear(polygon, traits)); auto e_it = polygon.edges_begin(); auto segment_outer_circle = diff --git a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/internal/Utils.h b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/internal/Utils.h index 139e6102933..f59c53b41af 100644 --- a/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/internal/Utils.h +++ b/Set_movable_separability_2/include/CGAL/Set_movable_separability_2/internal/Utils.h @@ -41,7 +41,7 @@ get_segment_outer_circle(const typename Kernel::Segment_2 seg, } template -bool is_any_edge_colinear(const CGAL::Polygon_2& pgn, Kernel& kernel) +bool is_any_edge_collinear(const CGAL::Polygon_2& pgn, Kernel& kernel) { typedef typename Kernel::Point_2 Point_2; typedef typename CGAL::Polygon_2 Polygon_2; diff --git a/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt b/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt index 7169e884959..633c1dc785c 100644 --- a/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt +++ b/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Set_movable_separability_2_Tests) if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) diff --git a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt index 5b6beaced89..600d1b6b8b0 100644 --- a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt +++ b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_detection_Benchmarks) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_detection/examples/Shape_detection/CMakeLists.txt b/Shape_detection/examples/Shape_detection/CMakeLists.txt index 0a942592731..7e5581c3126 100644 --- a/Shape_detection/examples/Shape_detection/CMakeLists.txt +++ b/Shape_detection/examples/Shape_detection/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_detection_Examples) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_detection/test/Shape_detection/CMakeLists.txt b/Shape_detection/test/Shape_detection/CMakeLists.txt index 85d23cf07d2..b8976228add 100644 --- a/Shape_detection/test/Shape_detection/CMakeLists.txt +++ b/Shape_detection/test/Shape_detection/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_detection_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt b/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt index 58f2ab7b2b0..d9dd81993d4 100644 --- a/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/benchmark/Shape_regularization/CMakeLists.txt @@ -3,7 +3,7 @@ project(Shape_regularization_Benchmarks) -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt index ed0104fe41a..fc4314a4124 100644 --- a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_regularization_Examples) diff --git a/Shape_regularization/test/Shape_regularization/CMakeLists.txt b/Shape_regularization/test/Shape_regularization/CMakeLists.txt index 02762c7aa8a..a9ad0ee3e82 100644 --- a/Shape_regularization/test/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/test/Shape_regularization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Shape_regularization_Tests) diff --git a/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt b/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt index 10bbb63a0e4..be6cde05f0e 100644 --- a/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt +++ b/Skin_surface_3/examples/Skin_surface_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Skin_surface_3_Examples) find_package(CGAL REQUIRED) diff --git a/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt b/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt index 3e6401efc37..2b31a9b2e8c 100644 --- a/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt +++ b/Skin_surface_3/test/Skin_surface_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Skin_surface_3_Tests) find_package(CGAL REQUIRED) diff --git a/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h b/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h index 5cc0f58e596..a63d3f20095 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h +++ b/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h @@ -9,7 +9,7 @@ the free function \ref CGAL::snap_rounding_2() `CGAL::snap_rounding_2} diff --git a/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt b/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt index 39d8c15bcd7..58e533bedcf 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt +++ b/Snap_rounding_2/doc/Snap_rounding_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgSnapRounding2Ref /*! \addtogroup PkgSnapRounding2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Snap Rounding,PkgSnapRounding2} \cgalPkgPicture{snap-detail.png} \cgalPkgSummaryBegin diff --git a/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt index 5b3941923b9..e09fa21f5d5 100644 --- a/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/examples/Snap_rounding_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Snap_rounding_2_Examples) find_package(CGAL REQUIRED) diff --git a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt index eba48480599..9add288c3ac 100644 --- a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Snap_rounding_2_Tests) find_package(CGAL REQUIRED) diff --git a/Snap_rounding_2/test/Snap_rounding_2/cgal_test_with_cmake b/Snap_rounding_2/test/Snap_rounding_2/cgal_test_with_cmake deleted file mode 100755 index 8c72a52e332..00000000000 --- a/Snap_rounding_2/test/Snap_rounding_2/cgal_test_with_cmake +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/bash - -./cgal_test_base -cmake - diff --git a/Solver_interface/doc/Solver_interface/Concepts/MixedIntegerProgramTraits.h b/Solver_interface/doc/Solver_interface/Concepts/MixedIntegerProgramTraits.h index b20bbdcb36f..eef6a4cf86b 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/MixedIntegerProgramTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/MixedIntegerProgramTraits.h @@ -39,6 +39,8 @@ public: */ MixedIntegerProgramVariable(MixedIntegerProgramTraits* solver, Variable_type type, FT lb =, FT ub, const std::string& name, int idx); + /// @} + /// \name Operations /// @{ @@ -131,6 +133,8 @@ public: */ MixedIntegerProgramLinearConstraint(MixedIntegerProgramTraits* solver, FT lb, FT ub, const std::string& name, int idx); + /// @} + /// \name Operations /// @{ @@ -238,6 +242,8 @@ public: */ MixedIntegerProgramLinearObjective(MixedIntegerProgramTraits* solver, Sense sense); + /// @} + /// \name Operations /// @{ diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index f097c4238f3..0eb7b843212 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Solver_interface_Examples) find_package(CGAL REQUIRED) diff --git a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt index f22da933174..03b97f1de01 100644 --- a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp index 69d372a53d6..057de474521 100644 --- a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp +++ b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp @@ -1002,7 +1002,7 @@ namespace nanoflann if(node->child1 == NULL && node->child2 == NULL) return 1; else{ - return std::max(depth(node->child1)+1,depth(node->child2)+1); + return (std::max)(depth(node->child1)+1,depth(node->child2)+1); } } @@ -1130,8 +1130,8 @@ namespace nanoflann node->sub.divhigh = right_bbox[cutfeat].low; for (int i=0; i<(DIM>0 ? DIM : dim); ++i) { - bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low); - bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high); + bbox[i].low = (std::min)(left_bbox[i].low, right_bbox[i].low); + bbox[i].high = (std::max)(left_bbox[i].high, right_bbox[i].high); } } diff --git a/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt index cf823429fee..be2a6e773f9 100644 --- a/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/tools/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(tools_) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt index bd3f74a6223..71295e2562a 100644 --- a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_Examples) # CGAL and its components diff --git a/Spatial_searching/test/Spatial_searching/CMakeLists.txt b/Spatial_searching/test/Spatial_searching/CMakeLists.txt index c6bce28aef0..e078b954112 100644 --- a/Spatial_searching/test/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/test/Spatial_searching/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_searching_Tests) find_package(CGAL REQUIRED) diff --git a/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt index 7311dc9811e..1b3fa5a4c03 100644 --- a/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/benchmark/Spatial_sorting/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_sorting_) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt index 1fc5703e5b2..152bcab93be 100644 --- a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_sorting_Examples) find_package(CGAL REQUIRED) diff --git a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt index 1aa81dc1929..7b94c7f8bf1 100644 --- a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Spatial_sorting_Tests) find_package(CGAL REQUIRED) diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h index dc4ec8c2d48..1331edf5f38 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h @@ -190,7 +190,7 @@ Straight_skeleton_builder_2& enter_contour( InputPointIterator aBegin, InputPoin /*! defines the weights of the contour last entered through `enter_contour()`. -\tparam InputPointIterator must be a model `InputIterator` whose `value_type` is `FT`. +\tparam WeightIterator must be a model `InputIterator` whose `value_type` is `FT`. \pre `std::distance(aBegin,aEnd)` must be equal to the number of vertices of the contour last entered. \pre Weights are (strictly) positive. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h index 551215202ae..e51856028e3 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h @@ -9,11 +9,11 @@ If `ss` is the interior skeleton of a polygon with holes, the offset polygons wi in its interior. If `ss` is the outer skeleton of a polygon with holes, the offset polygons will be generated in its exterior. -\tparam OfK must be a model of `Kernel`. It is used to instantiate - `Polygon_offset_builder_traits_2` for constructing the offset polygons. +\tparam OfKPolygon is a polygon without holes type determined from `OfK`, see Section \ref SLSOffsetPolygonReturnType. \tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT`. \tparam StraightSkeleton is an object of type `CGAL::Straight_skeleton_2`. -\tparam OfKPolygon is a polygon without holes type determined from `OfK`, see Section \ref SLSOffsetPolygonReturnType. +\tparam OfK must be a model of `Kernel`. It is used to instantiate + `Polygon_offset_builder_traits_2` for constructing the offset polygons. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -44,16 +44,16 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, it is advised to use `create_interior_straight_skeleton_2()` to create the skeleton only once, and then call `create_offset_polygons_2()` for each distance. -\tparam OfK must be a model of `Kernel`. It is used to instantiate - `Polygon_offset_builder_traits_2` for constructing the offset polygons. -\tparam SsK must be a model of `Kernel`. It is used to instantiate - `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. \tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. \tparam HoleIterator must be a model of `InputIterator` with value type being a model of `ConstRange` with value type `SsK::Point_2`. \tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`). -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. +\tparam OfK must be a model of `Kernel`. It is used to instantiate + `Polygon_offset_builder_traits_2` for constructing the offset polygons. +\tparam SsK must be a model of `Kernel`. It is used to instantiate + `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -84,20 +84,20 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, it is advised to use `create_interior_straight_skeleton_2()` to create the skeleton only once, and then call `create_offset_polygons_2()` for each distance +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. \pre `offset` is positive -\pre poly` is weakly simple, counterclockwise polygon. +\pre `poly` is weakly simple, counterclockwise polygon. \sa `CGAL::create_exterior_skeleton_and_offset_polygons_2()` \sa `CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2()` @@ -125,20 +125,20 @@ to obtain the offsets. The construction of this skeleton is the most expensive o therefore, to construct offsets at more than one single distance, use the separate functions `create_exterior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. \pre `offset` is positive -\pre poly` is weakly simple, counterclockwise polygon. +\pre `poly` is weakly simple, counterclockwise polygon. \sa `CGAL::create_interior_skeleton_and_offset_polygons_2()` \sa `CGAL::create_exterior_skeleton_and_offset_polygons_with_holes_2()` diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h index 839612ff6f3..e4aff14d810 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_offset_polygons_from_polygon_with_holes_2.h @@ -8,15 +8,16 @@ of the 2D polygon with holes `poly_with_holes`. This is equivalent to `arrange_offset_polygons_2(create_interior_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))`. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. + \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -42,19 +43,19 @@ at distance `offset` of the 2D polygon `poly_with_holes`. Note that the offset of the outer frame is ignored. This is equivalent to a call to `CGAL::arrange_offset_polygons_2()` on the -output of \link CGAL::create_exterior_skeleton_and_offset_polygons_2() `create_exterior_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))` \endlink +output of \link CGAL::create_exterior_skeleton_and_offset_polygons_2() `create_exterior_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk)` \endlink after having filtered out the polygon corresponding to the offset of the outer frame and having reversed the orientation of all other polygons. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h index e08f4d7b1d2..cdc19eb8ffb 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h @@ -20,19 +20,19 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, it is advised to use the separate functions `create_interior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`). +\tparam HoleIterator must be a model of `InputIterator` with value type being a model of `ConstRange` + with value type `SsK::Point_2`. +\tparam InKWeights must be a model of `SequenceContainer` whose value type is `InK::FT`. +\tparam HoleWeightsIterator must be a model of `InputIterator` with value type being a model of `SequenceContainer` + with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`). -\tparam InKWeights must be a model of `Range` with value type `InK::FT`. -\tparam HoleIterator must be a model of `InputIterator` with value type being a model of `ConstRange` - with value type `SsK::Point_2`. -\tparam HoleWeightsIterator must be a model of `InputIterator` with value type being a model of `ConstRange` - with value type `InK::FT`. -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -45,9 +45,9 @@ template > create_interior_weighted_skeleton_and_offset_polygons_2(FT offset, const InKPolygon& outer_boundary, - const InKWeights& outer_boundary_weights, HoleIterator holes_begin, HoleIterator holes_end, + const InKWeights& outer_boundary_weights, HoleWeightsIterator holes_weights_begin, HoleWeightsIterator holes_weights_end, OfK ofk = CGAL::Exact_predicates_inexact_constructions_kernel, @@ -66,16 +66,16 @@ The construction of this skeleton is the most expensive operation, therefore, to at more than one single distance, use the separate functions `create_interior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` with value type `InK::FT`. -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -109,21 +109,21 @@ to obtain the offsets. The construction of this skeleton is the most expensive o therefore, to construct offsets at more than one single distance, use the separate functions `create_exterior_straight_skeleton_2()` and `create_offset_polygons_2()` instead. +\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` with value type `InK::FT`. -\tparam OfKPolygon is a polygon without holes type determined from `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2`. \pre `offset` is positive -\pre poly` is weakly simple, counterclockwise polygon. +\pre `poly` is weakly simple, counterclockwise polygon. \sa `CGAL::create_interior_skeleton_and_offset_polygons_2()` \sa `CGAL::create_exterior_skeleton_and_offset_polygons_with_holes_2()` diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h index e2f4f109648..7e05b15bc40 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h @@ -1,22 +1,23 @@ namespace CGAL { /*! -\ingroup PkgStraightSkeleton2OffsetFunctions +\ingroup PkgStraightSkeleton2WeightedOffsetFunctions \brief returns a container with all the inner offset polygons with holes at distance `offset` of the 2D polygon with holes `poly_with_holes`. This is equivalent to `arrange_offset_polygons_2(create_interior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))`. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the weighted straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed weighted straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -35,26 +36,27 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT offset, // ---------------------------------------------- EXTERIOR ----------------------------------------- /*! -\ingroup PkgStraightSkeleton2OffsetFunctions +\ingroup PkgStraightSkeleton2WeightedOffsetFunctions \brief returns a container with all the outer offset polygons with holes at distance `offset` of the 2D polygon `poly_with_holes`. Note that the offset of the outer frame is ignored. This is equivalent to a call to `CGAL::arrange_offset_polygons_2()` on the -output of \link CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2() `create_exterior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))` \endlink +output of \link CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2() `create_exterior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk)` \endlink after having filtered out the polygon corresponding to the offset of the outer frame and having reversed the orientation of all other polygons. +\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, + see Section \ref SLSOffsetPolygonReturnType. +\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. +\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) + or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam OfK must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2` for constructing the offset polygons. \tparam SsK must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2` for constructing the straight skeleton. -\tparam FT must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`. -\tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) - or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam OfKPolygon is a polygon without holes type determined by `OfK` and `InKPolygon`, - see Section \ref SLSOffsetPolygonReturnType. \note If `SsK != OfK` the constructed weighted straight skeleton is converted to `CGAL::Straight_skeleton_2`. @@ -65,7 +67,9 @@ having reversed the orientation of all other polygons. template std::vector > create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT offset, - const InKPolygon& poly_with_holes, + const InKPolygon& + poly_with_holes, + const InKWeights& weights, OfK ofk = Exact_predicates_inexact_constructions_kernel(), SsK ssk = Exact_predicates_inexact_constructions_kernel()); diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h index f036609721f..aeb39576705 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_straight_skeleton_2.h @@ -87,14 +87,14 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice \brief creates a weighted straight skeleton in the interior of a 2D polygon, possibly with holes. -Range of weights `weights` must be provided in the same order as the contours (i.e., first +Weights must be provided in the same order as the contours (i.e., first the weights of the outer boundary, and then the weights of the holes, if there are any). Within each range of weights, the weights must be given in the same order as the vertices of the contour: the `i`-th weight in the range is associated to the contour edge between the `i-1`-th and `i`-th vertices. \tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`), or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` whose value type is itself a model of `Range` with value type `InK::FT`. +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \tparam SsK must be a model of `Kernel`. \note `Cartesian_converter` and `NT_converter` are used to convert objects from `InK` to `SsK`, @@ -177,7 +177,7 @@ is associated to the contour edge between the `i-1`-th and `i`-th vertices. \tparam FT must be a model of `FieldNumberType` convertible to `SsK::FT`. \tparam InKPolygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2`) or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2`). -\tparam InKWeights must be a model of `Range` whose value type is itself a model of `Range` with value type `InK::FT`. +\tparam InKWeights must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`. \note `Cartesian_converter` and `NT_converter` are used to convert objects from `InK` to `SsK`, if they differ. diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt index e5caf454fd7..5ddeeabc56c 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Straight_skeleton_2_Examples ) find_package(CGAL REQUIRED COMPONENTS Qt6 Core) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h index 30b1e25de59..102f4552a08 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include @@ -193,8 +195,8 @@ struct Default_return_polygon_type // Polygon type supports holes typename Kernel_traits::type>::Kernel, OfK>::value, - typename Polygon::Polygon_2, // correct kernel - CGAL::Polygon_2 /*incorrect kernel*/ >::type type; + typename Polygon::Polygon_2, // same kernel + CGAL::Polygon_2 /*different kernel*/ >::type type; }; template @@ -203,10 +205,14 @@ struct Default_return_polygon_type // Polygon type does NOT typedef typename std::conditional::type>::Kernel, OfK>::value, - Polygon, // correct kernel - CGAL::Polygon_2 /*incorrect kernel*/ >::type type; + Polygon, // same kernel + CGAL::Polygon_2 /*different kernel*/ >::type type; }; +template +using Polygon_return_type = typename CGAL::Default::Get::type>::type; + // The return type of create_interior/exterior_skeleton_and_offset_polygons_with_holes_2: // - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type should be the same // - if polygon input is just a sequence container of points (e.g. Polygon_2), then use @@ -234,6 +240,10 @@ struct Default_return_polygon_with_holes_type // Polygon ty CGAL::Polygon_with_holes_2 /*incorrect kernel*/ >::type type; }; +template +using Polygon_with_holes_return_type = typename CGAL::Default::Get::type>::type; + } // namespace CGAL_SS_i } // namespace CGAL diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h index 90110820a36..ffe8eaaba49 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h @@ -1454,10 +1454,10 @@ public: CGAL_assertion(fit != mSSkel->SSkel::Base::faces_end()); Halfedge_handle lBorder = fit->halfedge(); - FT lWeight = *aWeightsBegin; CGAL_assertion(lBorder->opposite()->is_border()); - CGAL_STSKEL_BUILDER_TRACE(4, "Assign " << lWeight << " cvt to " << cvt(lWeight) << " to E" << lBorder->id()); - lBorder->set_weight(cvt(lWeight)); + FT lWeight = cvt(*aWeightsBegin); + CGAL_STSKEL_BUILDER_TRACE(4, "Assign " << *aWeightsBegin << " (converted to " << cvt(lWeight) << ") to E" << lBorder->id()); + lBorder->set_weight(lWeight); } return *this; diff --git a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h index cd63666e9e7..2899fa00ed0 100644 --- a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h @@ -20,11 +20,11 @@ #include #include -#include #include #include #include +#include #include namespace CGAL { @@ -48,7 +48,9 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin { typedef typename std::iterator_traits::difference_type difference_type ; typedef typename std::iterator_traits::value_type PolygonPtr ; + typedef typename Kernel_traits::type>::Kernel OfK; + typedef typename PolygonWithHoles::Polygon_2 Inner_polygon; typedef std::shared_ptr PolygonWithHolesPtr ; difference_type lSize = std::distance(aBegin,aEnd); @@ -61,14 +63,16 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin const PolygonPtr lPoly = *it ; - Orientation lOrient = CGAL::Polygon::internal::orientation_2_no_precondition(lPoly->vertices().begin(), - lPoly->vertices().end(), - lPoly->traits_member()); + Orientation lOrient = CGAL::Polygon::internal::orientation_2_no_precondition( + CGAL_SS_i::vertices_begin(lPoly), CGAL_SS_i::vertices_end(lPoly), + OfK() /*lPoly->traits_member()*/); // It's an outer boundary if ( lOrient == COUNTERCLOCKWISE ) { - PolygonWithHolesPtr lOuter( new PolygonWithHoles(*lPoly) ); + PolygonWithHolesPtr lOuter = std::make_shared( + Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), + CGAL_SS_i::vertices_end(lPoly))); *rOut ++ = lOuter ; lTable[lIdx] = lOuter ; } @@ -100,7 +104,7 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin if (lParent == nullptr) return false; - lParent->add_hole(*lPoly); + lParent->add_hole(Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), CGAL_SS_i::vertices_end(lPoly))); } } diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h index bbdf0d15853..139675d2808 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -24,9 +24,8 @@ #include #include +#include #include -#include -#include #include #include @@ -129,7 +128,7 @@ create_partial_exterior_straight_skeleton_2 ( FT const& aMaxOffset std::vector holes ; holes.push_back(lPoly) ; - rSkeleton = create_partial_interior_straight_skeleton_2(aMaxOffset,frame, frame+4, holes.begin(), holes.end(), k ) ; + rSkeleton = create_partial_interior_straight_skeleton_2(aMaxOffset, frame, frame+4, holes.begin(), holes.end(), k ) ; } return rSkeleton ; @@ -142,7 +141,9 @@ template std::vector< std::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false ) { - typedef std::shared_ptr OutPolygonPtr ; + static_assert(!(std::is_same::value)); + + typedef std::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; typedef Straight_skeleton_2 OfSkeleton ; @@ -166,16 +167,18 @@ template std::vector< std::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true ) { - typedef std::shared_ptr OutPolygonPtr ; + static_assert(!(std::is_same::value)); + + typedef std::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; typedef Polygon_offset_builder_traits_2 OffsetBuilderTraits; typedef Polygon_offset_builder_2 OffsetBuilder; - OutPolygonPtrVector rR ; - OffsetBuilder ob(aSs); - ob.construct_offset_contours(aOffset, std::back_inserter(rR) ) ; + typename K::FT lOffset = aOffset; + OutPolygonPtrVector rR ; + ob.construct_offset_contours(lOffset, std::back_inserter(rR) ) ; return rR ; } @@ -190,43 +193,39 @@ Skeleton const& dereference ( std::shared_ptr const& ss ) } // namespace CGAL_SS_i -template -std::vector< std::shared_ptr > +template +std::vector > inline create_offset_polygons_2(const FT& aOffset, const Skeleton& aSs, - const K& k) + const K& k = K()) { typename CGAL_SS_i::Is_same_type::type same_kernel; return CGAL_SS_i::create_offset_polygons_2(aOffset, aSs, k, same_kernel); } -template, - class FT, class Skeleton> -std::vector< std::shared_ptr > -inline -create_offset_polygons_2(const FT& aOffset, - const Skeleton& aSs) -{ - return create_offset_polygons_2(aOffset, aSs, Exact_predicates_inexact_constructions_kernel()); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// INTERIOR -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, HoleIterator aHolesBegin, HoleIterator aHolesEnd, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), + std::enable_if_t::value>* = 0) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + return create_offset_polygons_2( aOffset, CGAL_SS_i::dereference( @@ -240,63 +239,26 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, ofk); } -template::type> -std::vector< std::shared_ptr > -inline -create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aOuterBoundary, - HoleIterator aHolesBegin, - HoleIterator aHolesEnd, - const OfK& ofk) -{ - return create_interior_skeleton_and_offset_polygons_2(aOffset, aOuterBoundary, - aHolesBegin, aHolesEnd, - ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -// Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +// Overload where APolygon is a simple polygon (no holes) +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + std::vector no_holes; - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, - no_holes.begin(), no_holes.end(), - ofk, ssk); -} - -// Overloads common to both polygons with and without holes, a simple polygon is returned in any case -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const OfK& ofk) -{ - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly) -{ - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); + return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, + no_holes.begin(), no_holes.end(), + ofk, ssk); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -307,17 +269,21 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, /*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + return create_offset_polygons_2( aOffset, CGAL_SS_i::dereference( @@ -329,31 +295,6 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, ofk); } -// Overloads common to both polygons with and without holes, a simple polygons is returned in any case -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const OfK& ofk) -{ - return create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly) -{ - return create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_OFFSET_POLYGONS_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h index ccedabda0b5..f22c3a8eea7 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h @@ -14,10 +14,9 @@ #include +#include #include #include -#include -#include #include @@ -36,60 +35,45 @@ namespace CGAL { /*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> // Hole-less polygon type -std::vector > +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { - return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), - aPoly.holes_begin(), aPoly.holes_end(), - ofk, ssk); + using OutPolygon = CGAL_SS_i::Polygon_return_type; + + return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), + aPoly.holes_begin(), aPoly.holes_end(), + ofk, ssk); } /*! create_interior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ -// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +// 'Polygon' might be a polygon with holes or not, but it returns a polygon with holes +template +std::vector > > inline create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + return arrange_offset_polygons_2( - create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk)); -} - -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const OfK& ofk) -{ - return create_interior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly) -{ - return create_interior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); + create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk)); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -100,25 +84,34 @@ create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, /*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +template +std::vector > > inline create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { - typedef typename CGAL_SS_i::Default_return_polygon_type::type Polygon_; - std::vector > raw_output = - create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk); + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + + std::vector > raw_output = + create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk); // filter offset of the outer frame std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for (std::shared_ptr ptr : raw_output) - ptr->reverse_orientation(); + for (std::shared_ptr ptr : raw_output) { + if (ptr->size() > 1) { + // keep the first in place is just to get the same behavior as for Polygon_2 + auto first = std::next(ptr->begin()); + std::reverse(first, ptr->end()); + } + } return arrange_offset_polygons_2(raw_output); } @@ -126,58 +119,38 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, /*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> -std::vector > +template +std::vector > > inline create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + std::vector > polygons = - create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), ofk, ssk); + create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), ofk, ssk); for (typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit) { typename PolygonWithHoles::Polygon_2 hole = *hit; hole.reverse_orientation(); std::vector > hole_polygons = - create_interior_skeleton_and_offset_polygons_2(aOffset, - hole, - ofk,ssk); + create_interior_skeleton_and_offset_polygons_2(aOffset, + hole, + ofk, ssk); polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end()); } return polygons; } -template::type> -std::vector > -inline -create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const OfK& ofk) -{ - return create_exterior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly) -{ - return create_exterior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h index c65e61ffc8c..5a2371e395f 100644 --- a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_2.h @@ -32,14 +32,14 @@ namespace CGAL { -template +template std::shared_ptr< Straight_skeleton_2 > create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd , HoleIterator aHolesBegin , HoleIterator aHolesEnd - , K const& - ) + , const K& = K()) { typedef Straight_skeleton_2 Ss ; @@ -62,30 +62,13 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin return ssb.construct_skeleton(); } -template -std::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > -inline -create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin - , PointIterator aOuterContour_VerticesEnd - , HoleIterator aHolesBegin - , HoleIterator aHolesEnd - ) -{ - return create_interior_straight_skeleton_2(aOuterContour_VerticesBegin - ,aOuterContour_VerticesEnd - ,aHolesBegin - ,aHolesEnd - ,Exact_predicates_inexact_constructions_kernel() - ); -} - -template +template std::shared_ptr< Straight_skeleton_2 > inline create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin , PointIterator aOuterContour_VerticesEnd - , K const& k - ) + , const K& k = K()) { typedef typename std::iterator_traits::value_type InputPoint ; typedef typename Kernel_traits::Kernel InputKernel ; @@ -99,24 +82,12 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin ); } -template -std::shared_ptr< Straight_skeleton_2 > -inline -create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin - , PointIterator aOuterContour_VerticesEnd - ) -{ - return create_interior_straight_skeleton_2(aOuterContour_VerticesBegin - ,aOuterContour_VerticesEnd - ,Exact_predicates_inexact_constructions_kernel() - ); -} - -template +template std::shared_ptr< Straight_skeleton_2 > inline -create_interior_straight_skeleton_2 ( Polygon const& aOutContour, - K const& k, +create_interior_straight_skeleton_2 ( const Polygon& aOutContour, + const K& k = K(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { @@ -126,26 +97,18 @@ create_interior_straight_skeleton_2 ( Polygon const& aOutContour, ); } -template -std::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > > -inline -create_interior_straight_skeleton_2 ( Polygon const& aOutContour ) -{ - return create_interior_straight_skeleton_2(aOutContour, Exact_predicates_inexact_constructions_kernel() ); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// EXTERIOR -template +template std::shared_ptr< Straight_skeleton_2 > create_exterior_straight_skeleton_2 ( FT const& aMaxOffset , PointIterator aVerticesBegin , PointIterator aVerticesEnd - , K const& k - ) + , const K& k = K()) { CGAL_precondition( aMaxOffset > 0 ) ; @@ -195,25 +158,13 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset return rSkeleton ; } -template -std::shared_ptr< Straight_skeleton_2 > -inline -create_exterior_straight_skeleton_2 ( FT const& aMaxOffset - , PointIterator aVerticesBegin - , PointIterator aVerticesEnd - ) -{ - return create_exterior_straight_skeleton_2(aMaxOffset - ,aVerticesBegin - ,aVerticesEnd - ,Exact_predicates_inexact_constructions_kernel() - ); -} - -template +template std::shared_ptr< Straight_skeleton_2 > inline -create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly, K const& k ) +create_exterior_straight_skeleton_2(const FT& aMaxOffset, + const Polygon& aPoly, + const K& k = K()) { return create_exterior_straight_skeleton_2(aMaxOffset ,CGAL_SS_i::vertices_begin(aPoly) @@ -222,17 +173,6 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly ); } -template -std::shared_ptr< Straight_skeleton_2 > -inline -create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly ) -{ - return create_exterior_straight_skeleton_2(aMaxOffset - ,aPoly - ,Exact_predicates_inexact_constructions_kernel() - ); -} - } // namespace CGAL #endif // CGAL_CREATE_STRAIGHT_SKELETON_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h index ae229d32e44..4e8f51dbee4 100644 --- a/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h @@ -26,11 +26,12 @@ namespace CGAL { -template +template std::shared_ptr< Straight_skeleton_2 > inline -create_interior_straight_skeleton_2 ( Polygon const& aPolyWithHoles, - K const& k, +create_interior_straight_skeleton_2 ( const Polygon& aPolyWithHoles, + const K& k = K(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h index d2553849475..0fd2ca8236a 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include @@ -127,6 +125,8 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, typedef typename Kernel_traits::Kernel IK; typedef typename IK::FT IFT; + static_assert((std::is_same::value_type, IFT>::value)); + std::shared_ptr > rSkeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) @@ -169,11 +169,11 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, holes.push_back(lPoly) ; // put a weight large enough such that frame edges are not relevant - const FT frame_weight = FT(10) * *(std::max_element(aWeightsBegin, aWeightsEnd)); + const IFT frame_weight = FT(10) * *(std::max_element(aWeightsBegin, aWeightsEnd)); CGAL_STSKEL_BUILDER_TRACE(4, "Frame weight = " << frame_weight); - std::vector lFrameWeights(4, frame_weight); - std::vector > lHoleWeights; + std::vector lFrameWeights(4, frame_weight); + std::vector > lHoleWeights; lHoleWeights.emplace_back(aWeightsBegin, aWeightsEnd); // If w[0] pointed to v_0, then when we reverse the polygon, the last polygon is pointing to v_{n-1} @@ -200,10 +200,11 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, //////////////////////////////////////////////////////////////////////////////////////////////////// /// INTERIOR -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -212,9 +213,11 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const Weights& aWeights, HoleWeightsIterator aHoles_WeightsBegin, HoleWeightsIterator aHoles_WeightsEnd, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + if(aHolesBegin == aHolesEnd) // see @partial_wsls_pwh { return create_offset_polygons_2( @@ -252,69 +255,33 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, } } -template::type> -std::vector< std::shared_ptr > -inline -create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aOuterBoundary, - HoleIterator aHolesBegin, - HoleIterator aHolesEnd, - const Weights& aWeights, - const OfK& ofk) -{ - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aOuterBoundary, - aHolesBegin, aHolesEnd, - aWeights, - ofk, - Exact_predicates_inexact_constructions_kernel()); -} - // Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + + using IFT = typename boost::range_value::type>::type; + std::vector no_holes; - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, - no_holes.begin(), no_holes.end(), - aWeights, - ofk, ssk); -} + std::vector > no_hole_weights; -// Overloads common to both polygons with and without holes, a simple polygon is returned in any case -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights) -{ - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); + return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, + no_holes.begin(), no_holes.end(), + aWeights[0], + no_hole_weights.begin(), no_hole_weights.end(), + ofk, ssk); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -325,18 +292,22 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, /*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // Overload where Polygon actually is a simple polygon (no holes) -template::type> -std::vector< std::shared_ptr > +template +std::vector > > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< ! CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + return create_offset_polygons_2( aOffset, CGAL_SS_i::dereference( @@ -344,39 +315,12 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, aOffset, CGAL_SS_i::vertices_begin(aPoly), CGAL_SS_i::vertices_end (aPoly), - aWeights[0].begin(), - aWeights[0].end(), + std::begin(aWeights[0]), + std::end(aWeights[0]), ssk)), ofk); } -// Overloads common to both polygons with and without holes, a simple polygons is returned in any case -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector< std::shared_ptr > -inline -create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, - const APolygon& aPoly, - const Weights& aWeights) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h index 51e1fd3752e..ca6f8d8d64f 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h @@ -14,10 +14,9 @@ #include +#include #include -#include -#include -#include +#include #include @@ -35,67 +34,50 @@ namespace CGAL { /*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> // Hole-less polygon type -std::vector > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { - return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), - aPoly.holes_begin(), aPoly.holes_end(), - aWeights[0], - std::next(std::begin(aWeights)), - std::end(aWeights), - ofk, ssk); + using OutPolygon = CGAL_SS_i::Polygon_return_type; + + return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), + aPoly.holes_begin(), aPoly.holes_end(), + aWeights[0], + std::next(std::begin(aWeights)), + std::end(aWeights), + ofk, ssk); } /*! create_interior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +template +std::vector > > inline create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + return arrange_offset_polygons_2( - create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk)); -} - -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights) -{ - return create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); + create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk)); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -103,28 +85,37 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf //////////////////////////////////////////////////////////////////////////////////////////////////// /// EXTERIOR -/*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ +/*! create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */ // Polygon might be a Polygon with holes or not, but it returns a Polygon with holes -template::type> -std::vector > +template +std::vector > > create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, const Polygon& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk) + const OfK& ofk = OfK(), + const SsK& ssk = SsK()) { - typedef typename CGAL_SS_i::Default_return_polygon_type::type Polygon_; - std::vector > raw_output = - create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk); + using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type::type; + using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type; + + std::vector > raw_output = + create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk); // filter offset of the outer frame std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for(std::shared_ptr ptr : raw_output) - ptr->reverse_orientation(); + for (std::shared_ptr ptr : raw_output) { + if (ptr->size() > 1) { + // keep the first in place is just to get the same behavior as for Polygon_2 + auto first = std::next(ptr->begin()); + std::reverse(first, ptr->end()); + } + } return arrange_offset_polygons_2(raw_output); } @@ -132,22 +123,26 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf /*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */ // overload where PolygonWithHoles actually is a type of Polygon that supports holes -template::type> -std::vector > +template +std::vector > > inline create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const PolygonWithHoles& aPoly, const Weights& aWeights, - const OfK& ofk, - const SsK& ssk, + const OfK& ofk = OfK(), + const SsK& ssk = SsK(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { + using OutPolygon = CGAL_SS_i::Polygon_return_type; + CGAL_precondition(aWeights.size() == aPoly.number_of_holes() + 1); std::vector > polygons = - create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), {aWeights[0]}, ofk, ssk); + create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), aWeights, ofk, ssk); std::size_t weight_pos = 1; for(typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit, ++weight_pos) @@ -155,42 +150,16 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, typename PolygonWithHoles::Polygon_2 hole = *hit; hole.reverse_orientation(); std::vector > hole_polygons = - create_interior_skeleton_and_offset_polygons_2(aOffset, - hole, - {aWeights[weight_pos]}, - ofk, ssk); + create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, + hole, + Weights{aWeights[weight_pos]}, + ofk, ssk); polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end()); } return polygons; } -template::type> -std::vector > -inline -create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights, - const OfK& ofk) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, ofk, - Exact_predicates_inexact_constructions_kernel()); -} - -template::type> -std::vector > -inline -create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, - const Polygon& aPoly, - const Weights& aWeights) -{ - return create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h index 96c42fb9925..64237b5924a 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h @@ -26,13 +26,14 @@ #include #include #include +#include #include namespace CGAL { template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, @@ -42,7 +43,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice WeightIterator outer_contour_weights_end, HoleWeightsIterator holes_weights_begin, HoleWeightsIterator holes_weights_end, - const K&) + const K& = K()) { using Skeleton = Straight_skeleton_2; @@ -76,37 +77,16 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice return ssb.construct_skeleton(); } -template -std::shared_ptr > -inline -create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, - PointIterator outer_contour_vertices_end, - HoleIterator holes_begin, - HoleIterator holes_end, - WeightIterator outer_contour_weights_begin, - WeightIterator outer_contour_weights_end, - HoleWeightsIterator holes_weights_begin, - HoleWeightsIterator holes_weights_end) -{ - return create_interior_weighted_straight_skeleton_2(outer_contour_vertices_begin, outer_contour_vertices_end, - holes_begin, holes_end, - outer_contour_weights_begin, outer_contour_weights_end, - holes_weights_begin, holes_weights_end, - Exact_predicates_inexact_constructions_kernel()); -} - template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, WeightIterator outer_contour_weights_begin, WeightIterator outer_contour_weights_end, - const K& k) + const K& k = K()) { using InputPoint = typename std::iterator_traits::value_type; using InputKernel = typename Kernel_traits::Kernel; @@ -126,51 +106,23 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice k); } -template -std::shared_ptr > -inline -create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, - PointIterator outer_contour_vertices_end, - WeightIterator outer_contour_weights_begin, - WeightIterator outer_contour_weights_end) -{ - return create_interior_weighted_straight_skeleton_2(outer_contour_vertices_begin, - outer_contour_vertices_end, - outer_contour_weights_begin, - outer_contour_weights_end, - Exact_predicates_inexact_constructions_kernel()); -} - template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > inline create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, const Weights& weights, - const K& k, + const K& k = K(), std::enable_if_t::value>* = nullptr) { return create_interior_weighted_straight_skeleton_2(CGAL_SS_i::vertices_begin(out_contour), CGAL_SS_i::vertices_end(out_contour), - weights.begin(), - weights.end(), + weights[0].begin(), + weights[0].end(), k); } -template -std::shared_ptr > -inline -create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, - const Weights& weights) -{ - return create_interior_weighted_straight_skeleton_2(out_contour, - weights, - Exact_predicates_inexact_constructions_kernel()); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -179,14 +131,14 @@ create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > create_exterior_weighted_straight_skeleton_2(const FT& max_offset, PointIterator vertices_begin, PointIterator vertices_end, WeightIterator weights_begin, WeightIterator weights_end, - const K& k) + const K& k = K()) { CGAL_precondition(max_offset > 0); CGAL_precondition(std::distance(weights_begin, weights_end) == std::distance(vertices_begin, vertices_end)); @@ -195,6 +147,8 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, using IK = typename Kernel_traits::Kernel; using IFT = typename IK::FT; + static_assert((std::is_same::value_type, IFT>::value)); + std::shared_ptr > skeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) @@ -236,11 +190,11 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, holes.push_back(poly); // put a weight large enough such that frame edges are not relevant - const FT frame_weight = FT(10) * *(std::max_element(weights_begin, weights_end)); + const IFT frame_weight = IFT(10) * *(std::max_element(weights_begin, weights_end)); CGAL_STSKEL_BUILDER_TRACE(4, "Frame weight = " << frame_weight); - std::vector lFrameWeights(4, frame_weight); - std::vector > lHoleWeights; + std::vector lFrameWeights(4, frame_weight); + std::vector > lHoleWeights; lHoleWeights.emplace_back(weights_begin, weights_end); // If w[0] pointed to v_0, then when we reverse the polygon, the last polygon is pointing to v_{n-1} @@ -258,59 +212,25 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, return skeleton; } -template -std::shared_ptr > -inline -create_exterior_weighted_straight_skeleton_2(const FT& max_offset, - PointIterator vertices_begin, - PointIterator vertices_end, - WeightIterator weights_begin, - WeightIterator weights_end) -{ - return create_exterior_weighted_straight_skeleton_2(max_offset, - vertices_begin, - vertices_end, - weights_begin, - weights_end, - Exact_predicates_inexact_constructions_kernel()); -} - template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr > inline create_exterior_weighted_straight_skeleton_2(const FT& max_offset, const Polygon& aPoly, Weights& weights, - const K& k) + const K& k = K()) { return create_exterior_weighted_straight_skeleton_2(max_offset, CGAL_SS_i::vertices_begin(aPoly), CGAL_SS_i::vertices_end(aPoly), - weights.begin(), - weights.end(), + weights[0].begin(), + weights[0].end(), k); } -template -std::shared_ptr > -inline -create_exterior_weighted_straight_skeleton_2(const FT& max_offset, - Weights& weights, - const Polygon& aPoly) -{ - return create_exterior_weighted_straight_skeleton_2(max_offset, - aPoly, - weights, - Exact_predicates_inexact_constructions_kernel()); -} - } // namespace CGAL #endif // CGAL_CREATE_WEIGHTED_STRAIGHT_SKELETON_2_H diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h index acc2046f2a6..df77c7da6d0 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_from_polygon_with_holes_2.h @@ -26,12 +26,12 @@ namespace CGAL { template + typename K = Exact_predicates_inexact_constructions_kernel> std::shared_ptr< Straight_skeleton_2 > inline create_interior_weighted_straight_skeleton_2(const Polygon& poly_with_holes, const Weights& weights, - const K& k, + const K& k = K(), std::enable_if_t< CGAL_SS_i::has_Hole_const_iterator::value>* = nullptr) { diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt index cbc1776327c..e08dcd859b2 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Straight_skeleton_2_Tests) find_package(CGAL REQUIRED COMPONENTS Qt6 Core) @@ -22,17 +22,19 @@ if(CGAL_Qt6_FOUND) endif() if (CGAL_Core_FOUND OR LEDA_FOUND) - create_single_source_cgal_program("test_sls_offset.cpp") - create_single_source_cgal_program("issue7284.cpp") - create_single_source_cgal_program("test_sls_simple.cpp") - create_single_source_cgal_program("test_sls_weighted_polygons_with_holes.cpp") create_single_source_cgal_program("issue7149.cpp") + create_single_source_cgal_program("issue7284.cpp") + create_single_source_cgal_program("test_sls_offset.cpp") + create_single_source_cgal_program("test_sls_weighted_offset.cpp") + create_single_source_cgal_program("test_sls_simple.cpp") + create_single_source_cgal_program("test_sls_weighted_polygons.cpp") + create_single_source_cgal_program("test_sls_weighted_polygons_with_holes.cpp") if(CGAL_Qt6_FOUND) target_link_libraries(issue7149 PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(issue7284 PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_offset PRIVATE CGAL::CGAL_Basic_viewer) + target_link_libraries(test_sls_weighted_offset PRIVATE CGAL::CGAL_Basic_viewer) + target_link_libraries(test_sls_weighted_polygons PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_weighted_polygons_with_holes PRIVATE CGAL::CGAL_Basic_viewer) endif() -else() - message("NOTICE: Some test require CGAL_Core (or LEDA), and will not be compiled.") endif() diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp index 90ed7dc9ef3..7259dd75e96 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp @@ -22,10 +22,13 @@ #include #include -#include +#include + +#include #include #include +#include #include #include @@ -34,90 +37,248 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; typedef CGAL::Timer Timer; + +namespace CGAL { + +template +class Test_polygon_2 : public CGAL::Polygon_2 { + typedef CGAL::Polygon_2 Base; + Test_polygon_2(const Base&); +public: + using Base::Base; +}; + +template +class Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2 { + typedef CGAL::Polygon_with_holes_2 Base; + Test_polygon_with_holes_2(const Base&); +public: + using Base::Base; +}; + +} // namespace CGAL + +using namespace CGAL; + template void test_API() { + typedef typename K::FT FT; + typedef typename K::Point_2 Point_2; + typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; typedef CGAL::Polygon_2 Polygon_2_EPICK; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2_EPICK; + typedef CGAL::Test_polygon_2 Test_Polygon_2; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2; + + typedef CGAL::Test_polygon_2 Test_Polygon_2_EPICK; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2_EPICK; + + std::vector v; Polygon_2 p; Polygon_with_holes_2 pwh; std::vector< std::shared_ptr > res; std::vector< std::shared_ptr > res_EPICK; - std::vector< std::shared_ptr > res_w; - std::vector< std::shared_ptr > res_w_EPICK; + std::vector< std::shared_ptr > res_wh; + std::vector< std::shared_ptr > res_wh_EPICK; + + std::vector< std::shared_ptr > res_test; + std::vector< std::shared_ptr > res_test_EPICK; + std::vector< std::shared_ptr > res_wh_test; + std::vector< std::shared_ptr > res_wh_test_EPICK; // First kernel is the offset construction (and thus output kernel), second kernel is the skeleton construction // simple interior, no holes res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p) ; res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK()) ; - res_EPICK = create_interior_skeleton_and_offset_polygons_2(0, p, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K()) ; - res = create_interior_skeleton_and_offset_polygons_2(0, p, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(0.1, v, K(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(FT(0.1), v, K(), K()) ; // simple interior, holes res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh) ; res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK()) ; - res_EPICK = create_interior_skeleton_and_offset_polygons_2(0, pwh, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K()) ; - res = create_interior_skeleton_and_offset_polygons_2(0, pwh, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), EPICK()) ; + res = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res_test = create_interior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; // simple exterior, no holes res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p) ; res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK()) ; - res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0, p, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K()) ; - res = create_exterior_skeleton_and_offset_polygons_2(0, p, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, p, EPICK(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(0.1, p, K(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), p, K(), K()) ; + + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, v, EPICK(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(0.1, v, K(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), v, K(), K()) ; // simple exterior, holes res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh) ; res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK()) ; - res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0, pwh, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K()) ; - res = create_exterior_skeleton_and_offset_polygons_2(0, pwh, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), EPICK()) ; + res = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; + + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, EPICK(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(0.1, pwh, K(), K()) ; + res_test = create_exterior_skeleton_and_offset_polygons_2(FT(0.1), pwh, K(), K()) ; // Same, but the result has holes -------------------- // arranged interior, no holes - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0, p, EPICK(), K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0, p, K(), EPICK()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, v, K(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, K(), K()) ; // arranged interior, holes - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; - res_w_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0, pwh, EPICK(), K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0, pwh, K(), EPICK()) ; - res_w = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), EPICK()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; + + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_test = create_interior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; // arranged exterior, no holes - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, p, EPICK(), K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, p, K(), EPICK()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, EPICK(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, p, K(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, K(), K()) ; + + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, v, EPICK(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, v, K(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, K(), K()) ; // arranged exterior, holes - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; - res_w_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, pwh, EPICK(), K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0, pwh, K(), EPICK()) ; - res_w = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), EPICK()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; + + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, EPICK(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, K(), K()) ; + res_wh_test = create_exterior_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, K(), K()) ; } template @@ -209,7 +370,7 @@ void test_offset_four_square_holes() outer.push_back(Point( 0, 0)); outer.push_back(Point(10, 0)); outer.push_back(Point(10, 10)); - outer.push_back(Point(0, 10)); + outer.push_back(Point( 0, 10)); hole1.push_back(Point(1, 1)); hole1.push_back(Point(1, 4.5)); @@ -969,9 +1130,8 @@ void test_kernel() std::cout.precision(17); std::cerr.precision(17); -#ifndef CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE - // test_API(); -#endif + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); // Artificial data test_offset_square(); diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp index d90bc8adf5f..4f5ad621567 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_simple.cpp @@ -34,10 +34,13 @@ void Straight_skeleton_traits_external_trace(std::string m) #include #include -#include +#include + +#include #include #include +#include #include #include #include @@ -221,9 +224,8 @@ void test_kernel() { // CGAL_STSKEL_TRAITS_ENABLE_TRACE -#ifndef CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE - // test_API(); -#endif + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); test_skeleton("data/pseudo_split_0.poly", 13, 40, 8); test_skeleton("data/pseudo_split_1.poly", 21, 68, 12); diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp new file mode 100644 index 00000000000..e4e64c2c95b --- /dev/null +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp @@ -0,0 +1,291 @@ +#define CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE +#define CGAL_ENABLE_DISABLE_ASSERTIONS_AT_RUNTIME + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; +typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; +typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; + +namespace CGAL { + +template +class Test_polygon_2 : public CGAL::Polygon_2 { + typedef CGAL::Polygon_2 Base; + Test_polygon_2(const Base&); +public: + using Base::Base; +}; + +template +class Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2 { + typedef CGAL::Polygon_with_holes_2 Base; + Test_polygon_with_holes_2(const Base&); +public: + using Base::Base; +}; + +} // namespace CGAL + +using namespace CGAL; + +template +void test_API() +{ + typedef typename K::FT FT; + typedef typename K::Point_2 Point_2; + + typedef CGAL::Polygon_2 Polygon_2; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + + typedef CGAL::Polygon_2 Polygon_2_EPICK; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2_EPICK; + + typedef CGAL::Test_polygon_2 Test_Polygon_2; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2; + + typedef CGAL::Test_polygon_2 Test_Polygon_2_EPICK; + typedef CGAL::Test_polygon_with_holes_2 Test_Polygon_with_holes_2_EPICK; + + std::vector v; + Polygon_2 p; + Polygon_with_holes_2 pwh; + std::vector > weights; + + std::vector > res; + std::vector > res_EPICK; + std::vector > res_wh; + std::vector > res_wh_EPICK; + + std::vector > res_test; + std::vector > res_test_EPICK; + std::vector > res_wh_test; + std::vector > res_wh_test_EPICK; + + // First kernel is the offset construction (and thus output kernel), second kernel is the skeleton construction + + // simple interior, no holes + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, K(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), v, weights, K(), K()) ; + + // simple interior, holes + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res_test = create_interior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + // simple exterior, no holes + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, EPICK(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, p, weights, K(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), p, weights, K(), K()) ; + + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, EPICK(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, v, weights, K(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), v, weights, K(), K()) ; + + // simple exterior, holes + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, EPICK(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(0.1, pwh, weights, K(), K()) ; + res_test = create_exterior_weighted_skeleton_and_offset_polygons_2(FT(0.1), pwh, weights, K(), K()) ; + + // Same, but the result has holes -------------------- + + // arranged interior, no holes + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, K(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, weights, K(), K()) ; + + // arranged interior, holes + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh_test = create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + + // arranged exterior, no holes + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, EPICK(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, p, weights, K(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), p, weights, K(), K()) ; + + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, EPICK(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, v, weights, K(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), v, weights, K(), K()) ; + + // arranged exterior, holes + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), EPICK()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; + + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), EPICK()) ; + res_wh_test_EPICK = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, EPICK(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(0.1, pwh, weights, K(), K()) ; + res_wh_test = create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights, K(), K()) ; +} + +template +void test_kernel() +{ + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); +} + +int main(int, char**) +{ + std::cout.precision(17); + std::cerr.precision(17); + + test_kernel(); + test_kernel(); + test_kernel(); + + std::cout << "Done!" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp new file mode 100644 index 00000000000..54a3be0ad86 --- /dev/null +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp @@ -0,0 +1,147 @@ +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#include + +namespace SS = CGAL::CGAL_SS_i; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; +typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; +typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; + +template +void test_API() +{ + typedef typename K::FT FT; + + typedef CGAL::Polygon_2 Polygon_2; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + + typedef CGAL::Straight_skeleton_2 Straight_skeleton_EPICK; + typedef std::shared_ptr Straight_skeleton_Ptr_EPICK; + + typedef CGAL::Straight_skeleton_2 Straight_skeleton; + typedef std::shared_ptr Straight_skeleton_Ptr; + + std::vector > weights; + + Polygon_2 p; + Straight_skeleton_Ptr_EPICK ss_epick = CGAL::create_interior_weighted_straight_skeleton_2(p, weights); + Straight_skeleton_Ptr ss = CGAL::create_interior_weighted_straight_skeleton_2(p, weights, K()); + ss_epick = CGAL::create_exterior_weighted_straight_skeleton_2(double(1.01), p, weights); + ss = CGAL::create_exterior_weighted_straight_skeleton_2(int(2), p, weights, K()); + + Polygon_with_holes_2 pwh; + ss_epick = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights); + ss = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); + ss_epick = CGAL::create_exterior_weighted_straight_skeleton_2(double(1.01), p, weights); + ss = CGAL::create_exterior_weighted_straight_skeleton_2(int(2), p, weights, K()); +} + +template +void test_kernel(const int polygon_nv, CGAL::Random& rnd) +{ + using FT = typename K::FT; + using Point_2 = typename K::Point_2; + using Point_3 = typename K::Point_3; + + using Polygon_2 = CGAL::Polygon_2; + + using Straight_skeleton_2 = CGAL::Straight_skeleton_2; + using Straight_skeleton_2_ptr = std::shared_ptr; + + using Mesh = CGAL::Surface_mesh; + + void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); + + typedef CGAL::Random_points_in_square_2 Point_generator; + Polygon_2 pol; + CGAL::random_polygon_2(polygon_nv, std::back_inserter(pol), Point_generator(0.25, rnd)); + + std::vector > weights(1); + for(int i=0; i& ws : weights) + { + for(FT w : ws) + std::cout << w << " "; + std::cout << std::endl; + } + + CGAL::draw(pol); + + Straight_skeleton_2_ptr ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pol, weights, K()); + assert(ss_ptr); + if(!ss_ptr) + { + std::cerr << "Error: failed to create straight skeleton" << std::endl; + return; + } + + CGAL::draw(*ss_ptr); + + ss_ptr = CGAL::create_exterior_weighted_straight_skeleton_2(0.1, pol, weights, K()); + assert(ss_ptr); + if(!ss_ptr) + { + std::cerr << "Error: failed to create straight skeleton" << std::endl; + return; + } + + CGAL::draw(*ss_ptr); + + Mesh sm; + bool success = extrude_skeleton(pol, sm, CGAL::parameters::weights(weights)); + assert(success); + if(!success) + { + std::cerr << "Error: failed to extrude skeleton" << std::endl; + return; + } + + std::cout << num_vertices(sm) << " vertices and " << num_faces(sm) << " faces" << std::endl; + + CGAL::draw(sm); +} + +int main(int argc, char** argv) +{ + std::cout.precision(17); + std::cerr.precision(17); + + const int polygon_nv = (argc > 1) ? std::atoi(argv[1]) : 10; + const int seed = (argc > 2) ? std::atoi(argv[2]) : std::time(nullptr); + + CGAL::Random rnd(seed); + std::cout << "Seed is " << rnd.get_seed() << std::endl; + + test_kernel(polygon_nv, rnd); + test_kernel(polygon_nv, rnd); + test_kernel(polygon_nv, rnd); + + return EXIT_SUCCESS; +} diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp index 7ebe00f75a4..e193238c601 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons_with_holes.cpp @@ -1,6 +1,7 @@ #include #include #include + #include #include @@ -22,44 +23,33 @@ namespace SS = CGAL::CGAL_SS_i; -using K = CGAL::Exact_predicates_inexact_constructions_kernel; -using FT = K::FT; -using Point_2 = K::Point_2; -using Vector_2 = K::Vector_2; -using Point_3 = K::Point_3; +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; +typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK; +typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqrt; -using Polygon_2 = CGAL::Polygon_2; -using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; - -using Straight_skeleton_2 = CGAL::Straight_skeleton_2; -using Straight_skeleton_2_ptr = std::shared_ptr; - -using Mesh = CGAL::Surface_mesh; - -Polygon_2 generate_random_polygon(CGAL::Random& rnd) +template +void test_kernel(const int hole_n, const int hole_nv, CGAL::Random& rnd) { - typedef CGAL::Random_points_in_square_2 Point_generator; + using FT = typename K::FT; + using Point_2 = typename K::Point_2; + using Point_3 = typename K::Point_3; - Polygon_2 poly; - CGAL::random_polygon_2(10, std::back_inserter(poly), Point_generator(0.25, rnd)); - return poly; -} + using Polygon_2 = CGAL::Polygon_2; + using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2; -int main(int argc, char** argv) -{ - std::cout.precision(17); - std::cerr.precision(17); + using Straight_skeleton_2 = CGAL::Straight_skeleton_2; + using Straight_skeleton_2_ptr = std::shared_ptr; - int hole_n = (argc > 1) ? std::atoi(argv[1]) : 2; - int hole_nv = (argc > 2) ? std::atoi(argv[2]) : 10; - int seed = (argc > 3) ? std::atoi(argv[3]) : CGAL::get_default_random().get_seed(); + using Mesh = CGAL::Surface_mesh; - CGAL::Random rnd(seed); + auto generate_random_polygon = [&](CGAL::Random& rnd) -> Polygon_2 + { + typedef CGAL::Random_points_in_square_2 Point_generator; - std::cout << "Seed is " << rnd.get_seed() << std::endl; - std::cout << 2*hole_n << " holes of size " << hole_nv << std::endl; - - std::vector > weights(1); + Polygon_2 poly; + CGAL::random_polygon_2(hole_nv, std::back_inserter(poly), Point_generator(0.25, rnd)); + return poly; + }; // each hole is in a square of size 1 std::vector ob = { Point_2(-hole_n-1, -0.5), @@ -71,6 +61,8 @@ int main(int argc, char** argv) std::cout << "pwh.outer_boundary() = " << pwh.outer_boundary() << std::endl; + std::vector > weights(1); + // tiny weight (far-reaching) for vertical sides weights[0].push_back(rnd.get_double(0.05, 0.5)); weights[0].push_back(rnd.get_double(1, 10)); @@ -118,33 +110,49 @@ int main(int argc, char** argv) std::cout << std::endl; } -// CGAL::draw(pwh); // @tmp remove draw() calls - - auto ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); +// CGAL::draw(pwh); + Straight_skeleton_2_ptr ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); + assert(ss_ptr); if(!ss_ptr) { std::cerr << "Error: failed to create straight skeleton" << std::endl; - return EXIT_FAILURE; + return; } // CGAL::draw(*ss_ptr); - auto offsets = CGAL::create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(FT(0.1), pwh, weights); - CGAL_USE(offsets); - Mesh sm; bool success = extrude_skeleton(pwh, sm, CGAL::parameters::weights(weights)); - + assert(success); if(!success) { std::cerr << "Error: failed to extrude skeleton" << std::endl; - return EXIT_FAILURE; + return; } std::cout << num_vertices(sm) << " vertices and " << num_faces(sm) << " faces" << std::endl; // CGAL::draw(sm); +} + +int main(int argc, char** argv) +{ + std::cout.precision(17); + std::cerr.precision(17); + + int hole_n = (argc > 1) ? std::atoi(argv[1]) : 2; + int hole_nv = (argc > 2) ? std::atoi(argv[2]) : 10; + int seed = (argc > 3) ? std::atoi(argv[3]) : std::time(nullptr); + + CGAL::Random rnd(seed); + + std::cout << "Seed is " << rnd.get_seed() << std::endl; + std::cout << 2*hole_n << " holes of size " << hole_nv << std::endl; + + test_kernel(hole_n, hole_nv, rnd); + test_kernel(hole_n, hole_nv, rnd); + test_kernel(hole_n, hole_nv, rnd); return EXIT_SUCCESS; } diff --git a/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt b/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt index a2ed8ab6571..ff03f42493d 100644 --- a/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt +++ b/Straight_skeleton_extrusion_2/test/Straight_skeleton_extrusion_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Straight_skeleton_extrusion_2_Tests) find_package(CGAL REQUIRED COMPONENTS Qt6 Core) diff --git a/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt b/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt index fde8f8a4077..6075d84f275 100644 --- a/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt +++ b/Stream_lines_2/examples/Stream_lines_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_lines_2_Examples) find_package(CGAL REQUIRED) diff --git a/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt b/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt index dd57b219200..8c0a52900f0 100644 --- a/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt +++ b/Stream_lines_2/test/Stream_lines_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_lines_2_Tests) find_package(CGAL REQUIRED) diff --git a/Stream_support/benchmark/Stream_support/CMakeLists.txt b/Stream_support/benchmark/Stream_support/CMakeLists.txt index 365ada0dc3e..7ba9a8e0799 100644 --- a/Stream_support/benchmark/Stream_support/CMakeLists.txt +++ b/Stream_support/benchmark/Stream_support/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_support) # CGAL and its components diff --git a/Stream_support/examples/Stream_support/CMakeLists.txt b/Stream_support/examples/Stream_support/CMakeLists.txt index 899b86e7d9b..fc5a12d6f6e 100644 --- a/Stream_support/examples/Stream_support/CMakeLists.txt +++ b/Stream_support/examples/Stream_support/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_support_Examples) find_package(CGAL REQUIRED) diff --git a/Stream_support/include/CGAL/IO/VTK/VTK_writer.h b/Stream_support/include/CGAL/IO/VTK/VTK_writer.h index 9be80302861..2769b3ab0f0 100644 --- a/Stream_support/include/CGAL/IO/VTK/VTK_writer.h +++ b/Stream_support/include/CGAL/IO/VTK/VTK_writer.h @@ -25,6 +25,8 @@ template void write_vector(std::ostream& os, const std::vector& vect) { + if(vect.empty()) + return; const char* buffer = reinterpret_cast(&(vect[0])); std::size_t size = vect.size()*sizeof(FT); diff --git a/Stream_support/include/CGAL/IO/WKT.h b/Stream_support/include/CGAL/IO/WKT.h index 3a3eea129d6..2706576b47c 100644 --- a/Stream_support/include/CGAL/IO/WKT.h +++ b/Stream_support/include/CGAL/IO/WKT.h @@ -44,18 +44,42 @@ namespace internal { template void pop_back_if_equal_to_front(CGAL::Polygon_2& poly) { - typename CGAL::Polygon_2::iterator it = poly.end(); - --it; - if((*poly.begin()) == *it) - poly.erase(it); + auto last_it = std::prev(poly.end()); + if((*poly.begin()) == *last_it) + poly.erase(last_it); } template void pop_back_if_equal_to_front(CGAL::Polygon_with_holes_2& pwh) { pop_back_if_equal_to_front(pwh.outer_boundary()); - for(auto i = pwh.holes_begin(); i!= pwh.holes_end(); ++i) - pop_back_if_equal_to_front(*i); + for(auto& hole : pwh.holes()) + pop_back_if_equal_to_front(hole); +} + +template +bool read_wkt_or_fail_stream(std::istream& in, + const std::string& line, + Geometry& geometry) +{ + try { + boost::geometry::read_wkt(line, geometry); + } catch(std::exception& e) { + std::cerr << "error: " << e.what() << std::endl; + in.clear(in.rdstate() | std::ios::failbit); + return false; + } + return true; +} + +bool get_a_new_line(std::istream& in, std::string& line) +{ + in >> std::ws; // skip whitespaces + if(in.good()) { + return !std::getline(in, line).fail(); + } else { + return false; + } } } // namespace internal @@ -76,28 +100,12 @@ template bool read_point_WKT(std::istream& in, Point& point) { - if(!in.good()) - return false; - std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 5).compare("POINT") == 0) + if(line.substr(0, 5).compare("POINT") == 0) { - try - { - boost::geometry::read_wkt(line, point); - } - catch(...) - { - std::cerr << "error." << std::endl; - return false; - } - + internal::read_wkt_or_fail_stream(in, line, point); break; } } @@ -124,25 +132,13 @@ template bool read_multi_point_WKT(std::istream& in, MultiPoint& mp) { - if(!in.good()) - return false; - - CGAL::internal::Geometry_container gc(mp); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 10).compare("MULTIPOINT") == 0) + if(line.substr(0, 10).compare("MULTIPOINT") == 0) { - try{ - boost::geometry::read_wkt(line, gc); - } catch(...){ - std::cerr << "error." << std::endl; - return false; - } + CGAL::internal::Geometry_container gc(mp); + internal::read_wkt_or_fail_stream(in, line, gc); break; } } @@ -156,9 +152,9 @@ bool read_multi_point_WKT(std::istream& in, //! //! The first line starting with LINESTRING in the stream will be used. //! -//! \tparam Linestring must be a model of `RandomAccessRange` of `CGAL::Point_2`, +//! \tparam Linestring must be a model of `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`, //! and have: -//! - a function `push_back()` that takes a `CGAL::Point_2`. +//! - a function `push_back()` that takes a point. //! - a function `clear()`, //! - a function `resize()` that takes a `size_type` //! - an `operator[]()` that takes a `size_type`. @@ -166,29 +162,18 @@ bool read_multi_point_WKT(std::istream& in, //! \attention Only %Cartesian Kernels with double or float as `FT` are supported. //! //! \see `CGAL::Point_2` +//! \see `CGAL::Point_3` template bool read_linestring_WKT(std::istream& in, LineString& polyline) { - if(!in.good()) - return false; - - CGAL::internal::Geometry_container gc(polyline); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 10).compare("LINESTRING") == 0) + if(line.substr(0, 10).compare("LINESTRING") == 0) { - try{ - boost::geometry::read_wkt(line, gc); - } catch(...){ - std::cerr << "error." << std::endl; - return false; - } + CGAL::internal::Geometry_container gc(polyline); + internal::read_wkt_or_fail_stream(in, line, gc); break; } } @@ -209,45 +194,30 @@ bool read_linestring_WKT(std::istream& in, //! //! \attention Only %Cartesian Kernels with double or float as `FT` are supported. //! -//! \see `CGAL::Point_2` template bool read_multi_linestring_WKT(std::istream& in, MultiLineString& mls) { - if(!in.good()) - return false; - - typedef typename MultiLineString::value_type PointRange; - typedef CGAL::internal::Geometry_container LineString; - - std::vector pr_range; - CGAL::internal::Geometry_container, boost::geometry::multi_linestring_tag> gc(pr_range); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 15).compare("MULTILINESTRING") == 0) + if(line.substr(0, 15).compare("MULTILINESTRING") == 0) { - try - { - boost::geometry::read_wkt(line, gc); - } - catch(...) - { - std::cerr << "error." << std::endl; - return false; + using PointRange = typename MultiLineString::value_type; + using LineString = CGAL::internal::Geometry_container; + + std::vector pr_range; + CGAL::internal::Geometry_container, boost::geometry::multi_linestring_tag> gc(pr_range); + + internal::read_wkt_or_fail_stream(in, line, gc); + for(LineString& ls : gc) { + mls.push_back(*ls.range); } break; } } - for(LineString& ls : gc) - mls.push_back(*ls.range); - return !in.fail(); } @@ -266,28 +236,12 @@ template bool read_polygon_WKT(std::istream& in, Polygon& polygon) { - if(!in.good()) - return false; - std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 7).compare("POLYGON") == 0) + if(line.substr(0, 7).compare("POLYGON") == 0) { - try - { - boost::geometry::read_wkt(line, polygon); - } - catch( ...) - { - in.setstate(std::ios::failbit); - return false; - }; - + internal::read_wkt_or_fail_stream(in, line, polygon); internal::pop_back_if_equal_to_front(polygon); break; } @@ -313,31 +267,16 @@ template bool read_multi_polygon_WKT(std::istream& in, MultiPolygon& polygons) { - if(!in.good()) - return false; - - CGAL::internal::Geometry_container gc(polygons); std::string line; - while(std::getline(in, line)) + while(internal::get_a_new_line(in, line)) { - std::istringstream iss(line); - std::string type; - iss >> type; - - if(type.substr(0, 12).compare("MULTIPOLYGON") == 0) + if(line.substr(0, 12).compare("MULTIPOLYGON") == 0) { - try - { - boost::geometry::read_wkt(line, gc); - } - catch( ...) - { - in.setstate(std::ios::failbit); - return false; - }; + CGAL::internal::Geometry_container gc(polygons); + internal::read_wkt_or_fail_stream(in, line, gc); - for(typename CGAL::internal::Geometry_container::iterator it = gc.begin(); it != gc.end(); ++it) - internal::pop_back_if_equal_to_front(*it); + for(auto& p : gc) + internal::pop_back_if_equal_to_front(p); break; } @@ -359,11 +298,12 @@ bool read_multi_polygon_WKT(std::istream& in, //! //! \brief writes `point` into a WKT stream. //! -//! \tparam Point is a `CGAL::Point_2` +//! \tparam Point is a `CGAL::Point_2` or `CGAL::Point_3` //! //! \attention Only %Cartesian Kernels with double or float as `FT` are supported. //! //! \see `CGAL::Point_2` +//! \see `CGAL::Point_3` template std::ostream& write_point_WKT(std::ostream& out, const Point& point) @@ -399,11 +339,12 @@ std::ostream& write_polygon_WKT(std::ostream& out, //! //! \brief writes the content of `ls` into a WKT stream. //! -//! \tparam LineString must be a `RandomAccessRange` of `CGAL::Point_2`. +//! \tparam LineString must be a `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`. //! //! \attention Only %Cartesian Kernels with double or float as `FT` are supported. //! //!\see `CGAL::Point_2` +//!\see `CGAL::Point_3` template std::ostream& write_linestring_WKT(std::ostream& out, LineString ls) @@ -420,11 +361,12 @@ std::ostream& write_linestring_WKT(std::ostream& out, //! //! \brief writes the content of `mp` into a WKT stream. //! -//! \tparam MultiPoint must be a `RandomAccessRange` of `CGAL::Point_2`. +//! \tparam MultiPoint must be a `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`. //! //! \attention Only %Cartesian Kernels with double or float as `FT` are supported. //! //!\see `CGAL::Point_2` +//!\see `CGAL::Point_2` template std::ostream& write_multi_point_WKT(std::ostream& out, MultiPoint& mp) @@ -517,17 +459,15 @@ bool read_WKT(std::istream& is, MultiLineString& polylines, MultiPolygon& polygons) { - if(!is.good()) - return false; + auto fail = [&is]() { is.clear(is.rdstate() | std::ios::failbit); return false; }; - while(is.good() && !is.eof()) + std::string line; + while(is >> std::ws && is.good() && std::getline(is, line)) { typedef typename MultiPoint::value_type Point; typedef typename MultiLineString::value_type LineString; typedef typename MultiPolygon::value_type Polygon; - std::string line; - std::getline(is, line); std::string::size_type header_end = line.find("("); // } if(header_end == std::string::npos){ continue; @@ -549,42 +489,42 @@ bool read_WKT(std::istream& is, if(type == "POINT") { Point p; - CGAL::IO::read_point_WKT(iss, p); + if(!IO::read_point_WKT(iss, p) ) return fail(); points.push_back(p); } else if(type == "LINESTRING") { LineString l; - CGAL::IO::read_linestring_WKT(iss, l); - polylines.push_back(l); + if(!IO::read_linestring_WKT(iss, l)) return fail(); + polylines.push_back(std::move(l)); } else if(type == "POLYGON") { Polygon p; - CGAL::IO::read_polygon_WKT(iss, p); + if(!IO::read_polygon_WKT(iss, p)) return fail(); if(!p.outer_boundary().is_empty()) - polygons.push_back(p); + polygons.push_back(std::move(p)); } else if(type == "MULTIPOINT") { MultiPoint mp; - CGAL::IO::read_multi_point_WKT(iss, mp); + if(!IO::read_multi_point_WKT(iss, mp)) return fail(); for(const Point& point : mp) points.push_back(point); } else if(type == "MULTILINESTRING") { MultiLineString mls; - CGAL::IO::read_multi_linestring_WKT(iss, mls); - for(const LineString& ls : mls) - polylines.push_back(ls); + if(!IO::read_multi_linestring_WKT(iss, mls)) return fail(); + for(LineString& ls : mls) + polylines.push_back(std::move(ls)); } else if(type == "MULTIPOLYGON") { MultiPolygon mp; - CGAL::IO::read_multi_polygon_WKT(iss, mp); - for(const Polygon& poly : mp) - polygons.push_back(poly); + if(!IO::read_multi_polygon_WKT(iss, mp)) return fail(); + for(Polygon& poly : mp) + polygons.push_back(std::move(poly)); } } diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index 74f8dd34bab..631dfb6e5b7 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -216,6 +216,19 @@ public: } }; +template +class Output_rep +{ + Func f; + +public: + Output_rep(Func f) : f(f) {} + std::ostream& operator()(std::ostream& os) const + { + return f(os); + } +}; + /*! \relates Output_rep \brief stream output of the \c Output_rep calls its \c operator(). @@ -1004,12 +1017,53 @@ namespace std { template struct formatter, CharT> : public std::formatter> { + using context = std::basic_format_parse_context; + using context_iterator = typename context::iterator; + + constexpr context_iterator parse_non_precision_chars(context_iterator it, context_iterator end) + { + constexpr std::array letters = {CharT('A'), CharT('B'), CharT('P')}; + constexpr std::array modes = {CGAL::IO::ASCII, CGAL::IO::BINARY, CGAL::IO::PRETTY}; + + if(it == end) + throw "it != end is a precondition of `parse_non_precision_chars(it, end)`"; + + if(*it == CharT('}')) + return it; + if(*it == CharT('.')) + return it; + + for(const auto& letter : letters) { + if(*it == letter) { + mode = modes[std::addressof(letter) - letters.data()]; + return ++it; + } + } + + throw std::format_error(R"( +formatter for CGAL::Output_rep only support stream mode and precision, like `{:X.6}` where X is + - `A` (or missing) for ASCII mode, + - `B` for BINARY mode, or + - `P` for PRETTY mode +)"); + } + constexpr auto parse(std::basic_format_parse_context& ctx) { auto it = ctx.begin(); const auto end = ctx.end(); - if(it == end) - return it; + + if(it == end) return it; + + { + auto next = it; + do { + next = parse_non_precision_chars(it, end); + } while(next != it && (it = next) != end); + } + + if(it == end) return it; + if(*it != CharT('.')) { if(*it == CharT('}')) return it; throw std::format_error("formatter for CGAL::Output_rep only support precision, like `{:.6}`"); @@ -1031,12 +1085,14 @@ struct formatter, CharT> : public std::formatter &rep, FormatContext& ctx) const { std::basic_stringstream ss; + CGAL::IO::set_mode(ss, mode); ss.precision(precision); ss << rep; return std::formatter>::format(ss.str(), ctx); } int precision = 17; + CGAL::IO::Mode mode = CGAL::IO::ASCII; }; } // namespace std diff --git a/Stream_support/include/CGAL/IO/io_tags.h b/Stream_support/include/CGAL/IO/io_tags.h index 0d9f53a4ef7..2be29669531 100644 --- a/Stream_support/include/CGAL/IO/io_tags.h +++ b/Stream_support/include/CGAL/IO/io_tags.h @@ -51,7 +51,7 @@ template<> struct Io_traits { typedef io_Read_write Io_tag; }; template<> struct Io_traits { typedef io_Read_write Io_tag; }; template<> struct Io_traits { typedef io_Read_write Io_tag; }; - +struct IO_manip_tag{}; } //namespace CGAL diff --git a/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h b/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h index e3e26fe8b61..28a1aff6245 100644 --- a/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h +++ b/Stream_support/include/CGAL/Stream_support/internal/Geometry_container.h @@ -46,20 +46,16 @@ struct Geometry_container{ typedef typename Range::size_type size_type; typedef typename Range::value_type value_type; std::shared_ptr range; - bool must_delete; // // Default constructor. // Creates a new internal Range. // De-allocate memory after usage. - Geometry_container():range(new Range()), must_delete(true) - { - } + Geometry_container() : range(std::make_shared()) {} /* - Copy constructor. + Store a pointer to the given range. Memory NOT de-allocated after usage. */ - Geometry_container(Range& range) - :range(&range, Dummy_deleter()), must_delete(false){} + Geometry_container(Range& range) : range(&range, Dummy_deleter()) {} iterator begin() { return range->begin(); } diff --git a/Stream_support/test/Stream_support/CMakeLists.txt b/Stream_support/test/Stream_support/CMakeLists.txt index 217c1cc1de9..0247c46be05 100644 --- a/Stream_support/test/Stream_support/CMakeLists.txt +++ b/Stream_support/test/Stream_support/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Stream_support_Tests) find_package(CGAL REQUIRED) find_path( diff --git a/Stream_support/test/Stream_support/test_WKT.cpp b/Stream_support/test/Stream_support/test_WKT.cpp index 90d9b8da4b2..7af1e011668 100644 --- a/Stream_support/test/Stream_support/test_WKT.cpp +++ b/Stream_support/test/Stream_support/test_WKT.cpp @@ -3,8 +3,8 @@ #include #include - #include +#include #include #include @@ -17,7 +17,69 @@ typedef std::vector MultiPoint typedef std::vector MultiLinestring; typedef std::vector MultiPolygon; + +typedef CGAL::Point_3 Point3; +typedef std::vector Linestring3; +typedef std::vector MultiPoint3; +typedef std::vector MultiLinestring3; //////////////////////////////////////////////////////////////////////////////////////////////////// + +bool test_WKT_3D() +{ + { + Point3 p(1,2,3), q(0,0,0); + std::stringstream ss; + CGAL::IO::write_point_WKT(ss, p); + bool b = CGAL::IO::read_point_WKT(ss, q); + assert(b); + CGAL_USE(b); + assert(p == q); + } + { + Point3 p(1,2,3), q(3,2,1); + MultiPoint3 mp, mq; + mp.push_back(p); + mp.push_back(q); + std::stringstream ss; + CGAL::IO::write_multi_point_WKT(ss, mp); + bool b = CGAL::IO::read_multi_point_WKT(ss, mq); + assert(b); + CGAL_USE(b); + assert(mp == mq); + } + { + Point3 p(1,2,3), q(3,2,1); + Linestring3 mp, mq; + mp.push_back(p); + mp.push_back(q); + std::stringstream ss; + CGAL::IO::write_linestring_WKT(ss, mp); + bool b = CGAL::IO::read_linestring_WKT(ss, mq); + assert(b); + CGAL_USE(b); + assert(mp == mq); + } + { + Point3 p(1,2,3), q(3,2,1), r(4,5,6); + Linestring3 mp, mq; + mp.push_back(p); + mp.push_back(q); + mq.push_back(p); + mq.push_back(r); + MultiLinestring3 mmp, mmq; + mmp.push_back(mp); + mmp.push_back(mq); + std::stringstream ss; + CGAL::IO::write_multi_linestring_WKT(ss, mmp); + bool b = CGAL::IO::read_multi_linestring_WKT(ss, mmq); + assert(b); + CGAL_USE(b); + assert(mmp == mmq); + } + return true; +} + + //////////////////////////////////////////////////////////////////////////////////////////////////// /// Read @@ -273,6 +335,8 @@ int main() assert(ok); ok = test_write_WKT(); assert(ok); + ok = test_WKT_3D(); + assert(ok); return EXIT_SUCCESS; } diff --git a/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt b/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt index f7e403c4e81..e24a5f14ab4 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt +++ b/Subdivision_method_3/examples/Subdivision_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Subdivision_method_3_Examples) find_package(CGAL REQUIRED) diff --git a/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt b/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt index 2e05ac1b014..05c94dc1e01 100644 --- a/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt +++ b/Subdivision_method_3/test/Subdivision_method_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Subdivision_method_3_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh/benchmark/CMakeLists.txt b/Surface_mesh/benchmark/CMakeLists.txt index c963412dd5b..af89e27a5f4 100644 --- a/Surface_mesh/benchmark/CMakeLists.txt +++ b/Surface_mesh/benchmark/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_performance) find_package(CGAL REQUIRED) diff --git a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt index 6b8821ccb12..bae80a7b2c2 100644 --- a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt @@ -6,7 +6,7 @@ # Used in /CGAL/Documentation/doc/Documentation/Developer_manual/create_and_use_a_cmakelist.txt. # Careful when modifying -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_Examples) #CGAL_Qt6 is needed for the drawing. diff --git a/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp b/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp index 05a166dc567..ca8593988b3 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_circulators.cpp @@ -42,7 +42,7 @@ int main() { std::cout << "vertices around face " << f << std::endl; CGAL::Vertex_around_face_iterator vbegin, vend; - for(boost::tie(vbegin, vend) = vertices_around_face(m.halfedge(f), m); + for(std::tie(vbegin, vend) = vertices_around_face(m.halfedge(f), m); vbegin != vend; ++vbegin){ std::cout << *vbegin << std::endl; diff --git a/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp b/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp index 6fe9d48402e..0e16a7f0b38 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp @@ -44,8 +44,8 @@ int main() vb = std::begin(r); ve = std::end(r); - // or with boost::tie, as the CGAL range derives from std::pair - for(boost::tie(vb, ve) = m.vertices(); vb != ve; ++vb){ + // or with std::tie, as the CGAL range derives from std::pair + for(std::tie(vb, ve) = m.vertices(); vb != ve; ++vb){ // Print vertex index and vertex coordinates std::cout << *vb << " " << m.point(*vb) << std::endl; } diff --git a/Surface_mesh/examples/Surface_mesh/sm_join.cpp b/Surface_mesh/examples/Surface_mesh/sm_join.cpp index df0526992fe..d692035479a 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_join.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_join.cpp @@ -25,8 +25,8 @@ int main(int argc, char* argv[]) Mesh::Property_map name1, name2; bool created; sm1.add_property_map("v:weight",7812); - boost::tie(name1, created) = sm1.add_property_map("v:name","hello"); - boost::tie(name2, created) = sm2.add_property_map("v:name","world"); + std::tie(name1, created) = sm1.add_property_map("v:name","hello"); + std::tie(name2, created) = sm2.add_property_map("v:name","world"); sm1 += sm2; diff --git a/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp b/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp index 986b9e9d4e3..61f1f73745f 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp @@ -34,7 +34,7 @@ void kruskal(const Mesh& sm) " point [ \n"; vertex_iterator vb,ve; - for(boost::tie(vb, ve) = vertices(sm); vb!=ve; ++vb){ + for(std::tie(vb, ve) = vertices(sm); vb!=ve; ++vb){ std::cout << " " << sm.point(*vb) << "\n"; } diff --git a/Surface_mesh/examples/Surface_mesh/sm_properties.cpp b/Surface_mesh/examples/Surface_mesh/sm_properties.cpp index 5fa15d74058..9d591e8019c 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_properties.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_properties.cpp @@ -26,7 +26,7 @@ int main() // give each vertex a name, the default is empty Mesh::Property_map name; bool created; - boost::tie(name, created) = m.add_property_map("v:name","m1"); + std::tie(name, created) = m.add_property_map("v:name","m1"); assert(created); // add some names to the vertices name[v0] = "hello"; @@ -36,7 +36,7 @@ int main() // You get an existing property, and created will be false Mesh::Property_map name; bool created; - boost::tie(name, created) = m.add_property_map("v:name", ""); + std::tie(name, created) = m.add_property_map("v:name", ""); assert(! created); } diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index bf1457d7f4c..d38d7ffeabd 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -598,7 +598,7 @@ public: /// \name Range Types /// /// Each range `R` in this section has a nested type `R::iterator`, - /// is convertible to `std::pair`, so that one can use `boost::tie()`, + /// is convertible to `std::pair`, so that one can use `std::tie()`, /// and can be used with `BOOST_FOREACH()`, as well as with the C++11 range based for-loop. ///@{ diff --git a/Surface_mesh/test/Surface_mesh/CMakeLists.txt b/Surface_mesh/test/Surface_mesh/CMakeLists.txt index 62d2cb3bca7..3b516fc15d0 100644 --- a/Surface_mesh/test/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/test/Surface_mesh/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp b/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp index 5e932869a44..999d54de50d 100644 --- a/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp +++ b/Surface_mesh/test/Surface_mesh/sm_circulator_test.cpp @@ -75,7 +75,7 @@ struct test_emptiness : public Surface_fixture m.remove_vertex(iv); assert(m.is_removed(iv)); Sm::Vertex_iterator vb, ve; - for(boost::tie(vb, ve) = m.vertices(); vb != ve; ++vb) { + for(std::tie(vb, ve) = m.vertices(); vb != ve; ++vb) { Sm::Vertex_around_target_range vr = m.vertices_around_target(m.halfedge(*vb)); assert(!is_empty_range(std::begin(vr), std::end(vr))); } diff --git a/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp b/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp index 16fb699982c..d4e47e53b98 100644 --- a/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp +++ b/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp @@ -28,19 +28,19 @@ void standard_iterators() Surface_fixture f; Sm::Vertex_iterator vb, ve; - boost::tie(vb, ve) = f.m.vertices(); + std::tie(vb, ve) = f.m.vertices(); test_iterator(vb, ve, 5); Sm::Halfedge_iterator hb, he; - boost::tie(hb, he) = f.m.halfedges(); + std::tie(hb, he) = f.m.halfedges(); test_iterator(hb, he, 14); Sm::Edge_iterator eb, ee; - boost::tie(eb, ee) = f.m.edges(); + std::tie(eb, ee) = f.m.edges(); test_iterator(eb, ee, 7); Sm::Face_iterator fb, fe; - boost::tie(fb, fe) = f.m.faces(); + std::tie(fb, fe) = f.m.faces(); test_iterator(fb, fe, 3); } @@ -97,7 +97,7 @@ void memory_reuse_test() Faces faces; Sm::Face_iterator fb, fe; - for(boost::tie(fb, fe) = f.m.faces(); fb != fe; ++fb) { + for(std::tie(fb, fe) = f.m.faces(); fb != fe; ++fb) { faces.push_back(VecFace()); Sm::Vertex_around_face_circulator vafb(f.m.halfedge(*fb), f.m), vafe(vafb); if(vafb) @@ -108,7 +108,7 @@ void memory_reuse_test() } Sm::Vertex_iterator vb, ve; - for(boost::tie(vb, ve) = f.m.vertices(); vb != ve; ++vb) { + for(std::tie(vb, ve) = f.m.vertices(); vb != ve; ++vb) { f.m.set_halfedge(*vb, Sm::Halfedge_index()); } @@ -223,10 +223,10 @@ void properties () { Sm::Property_map prop; bool created = false; - boost::tie(prop,created) = f.m.add_property_map("illuminatiproperty", 23); + std::tie(prop,created) = f.m.add_property_map("illuminatiproperty", 23); assert(created == true); - boost::tie(prop, created)= f.m.add_property_map("illuminatiproperty"); + std::tie(prop, created)= f.m.add_property_map("illuminatiproperty"); assert(created == false); } diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt index 469d78b87a5..cb4def4fdcd 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_approximation_Benchmarks) # CGAL and its components diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt index d45a9693351..8da14e07439 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_approximation_Examples) # CGAL and its components diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt index d085b8cec23..35473846c94 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_approximation_Tests) # CGAL and its components diff --git a/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt b/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt index 19d66a7b1a3..c4b711d6aa4 100644 --- a/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt +++ b/Surface_mesh_deformation/benchmark/Surface_mesh_deformation/optimal_rotation/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(benchmark_for_closest_rotation) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt index 58874d3f2dc..0f1a088904f 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_deformation_Demo) set_property(DIRECTORY PROPERTY CGAL_NO_TESTING TRUE) diff --git a/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp b/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp index 9f5036cc3c0..6b5c101ceb6 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp @@ -41,7 +41,7 @@ int main(int argc,char** argv) // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); //the selection is set by a file input.open(argv[2]); diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt index bc5d23347f0..496bc254011 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_deformation_Examples) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp index 5f429231d84..ed83fd3fb13 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example.cpp @@ -33,7 +33,7 @@ int main() // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Select two control vertices ... diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp index fe91ed58baf..4242008b653 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp @@ -29,7 +29,7 @@ int main(int argc, char** argv) // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Select two control vertices ... diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp index 74590db427b..d1927088526 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp @@ -81,7 +81,7 @@ int main() Vertex_index_map vertex_index_map(internal_vertex_index_map); vertex_iterator vb, ve; std::size_t counter = 0; - for(boost::tie(vb, ve) = vertices(mesh); vb != ve; ++vb, ++counter) { + for(std::tie(vb, ve) = vertices(mesh); vb != ve; ++vb, ++counter) { put(vertex_index_map, *vb, counter); } @@ -89,14 +89,14 @@ int main() Hedge_index_map hedge_index_map(internal_hedge_index_map); counter = 0; halfedge_iterator eb, ee; - for(boost::tie(eb, ee) = halfedges(mesh); eb != ee; ++eb, ++counter) { + for(std::tie(eb, ee) = halfedges(mesh); eb != ee; ++eb, ++counter) { put(hedge_index_map, *eb, counter); } Surface_mesh_deformation deform_mesh(mesh, vertex_index_map, hedge_index_map); // Insert the whole mesh as region of interest - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Insert two control vertices diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp index 88ad5c127df..f0acef64d8e 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp @@ -24,7 +24,7 @@ int main() // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); deform_mesh.insert_roi_vertices(vb, ve); // Select two control vertices ... diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp index 112fdfb8467..afccc9903c7 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp @@ -51,7 +51,7 @@ int main(int argc,char** argv) // Definition of the region of interest (use the whole mesh) vertex_iterator vb,ve; - boost::tie(vb, ve) = vertices(mesh); + std::tie(vb, ve) = vertices(mesh); //the selection is set by a file input.open(sel_name); diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp index 61740ac320f..2adbedc0235 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) // Select and insert the vertices of the region of interest vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices(mesh); + std::tie(vb,ve) = vertices(mesh); std::vector roi = extract_k_ring(mesh, *std::next(vb, 47), 9); deform_mesh.insert_roi_vertices(roi.begin(), roi.end()); diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp index 79a82bc238b..08d82307bec 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp @@ -65,7 +65,7 @@ int main() // Select and insert the vertices of the region of interest vertex_iterator vb, ve; - boost::tie(vb,ve) = vertices(mesh); + std::tie(vb,ve) = vertices(mesh); std::vector roi = extract_k_ring(mesh, *std::next(vb, 47), 9); deform_mesh.insert_roi_vertices(roi.begin(), roi.end()); diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt index b0c1b9bc196..354813c8e73 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_deformation_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h b/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h index bdc14cee74e..508cd98f3a6 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/Surface_mesh_deformation_test_commons.h @@ -27,13 +27,13 @@ void init_indices(Polyhedron& poly) { vertex_iterator vb, ve; std::size_t counter = 0; - for(boost::tie(vb, ve) = vertices(poly); vb != ve; ++vb, ++counter) { + for(std::tie(vb, ve) = vertices(poly); vb != ve; ++vb, ++counter) { (*vb)->id() = counter; } counter = 0; halfedge_iterator heb, hee; - for(boost::tie(heb, hee) = halfedges(poly); heb != hee; ++heb, ++counter) { + for(std::tie(heb, hee) = halfedges(poly); heb != hee; ++heb, ++counter) { (*heb)->id() = counter; } } @@ -59,7 +59,7 @@ read_rois(DeformMesh& deform_mesh, std::vector vvertices; vvertices.reserve(num_vertices(polyhedron)); vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(polyhedron); vb != ve; ++vb) { + for(std::tie(vb, ve) = vertices(polyhedron); vb != ve; ++vb) { vvertices.push_back(*vb); } // load handles and roi from txt diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 5d74cdca661..6fb5830e133 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_parameterization_Examples) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h index 151165423f9..6ca9c4c8fe3 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h @@ -121,7 +121,7 @@ Error_code read_cones(const TriangleMesh& tm, std::ifstream& in, VertexIndexMap // Since the cones are unique, we only need to loop all the vertices once TM_vertex_iterator vit, end; - boost::tie(vit, end) = vertices(tm); + std::tie(vit, end) = vertices(tm); for(; vit!=end; ++vit) { for(std::size_t i=0; i::max)(); - for(boost::tie(b,e) = halfedges_around_face(bhd, mesh); b!=e; ++b, ++id) { + for(std::tie(b,e) = halfedges_around_face(bhd, mesh); b!=e; ++b, ++id) { double d = CGAL::abs(offset[id] - value); if(d < min) { best = b; @@ -160,7 +160,7 @@ private: double total_len = compute_border_length(mesh, bhd); halfedge_around_face_iterator b, e; - boost::tie(b,e) = halfedges_around_face(bhd, mesh); + std::tie(b,e) = halfedges_around_face(bhd, mesh); for(halfedge_around_face_iterator it = b; it!= e; ++it) { vertex_descriptor vs = source(*it, mesh); vertex_descriptor vt = target(*it, mesh); diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h index d9da2714623..6a8a74a4ebe 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/Containers_filler.h @@ -86,7 +86,7 @@ struct Index_map_filler { typename Map::iterator it; bool new_element; - boost::tie(it,new_element) = map->insert(std::make_pair(vd,1)); + std::tie(it,new_element) = map->insert(std::make_pair(vd,1)); if(new_element) { it->second = index++; } diff --git a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt index 36f681d45fd..0a0e459223a 100644 --- a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling this folder. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_parameterization_Tests) # Find CGAL diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt index e3f63874b1f..3f7e9457909 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_segmentation_Examples) # CGAL and its components diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h index 7afb29eecf2..7ad3cec0a83 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Filters.h @@ -80,7 +80,7 @@ public: smoothed_values.reserve(num_faces(mesh)); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { std::map neighbors; NeighborSelector()(mesh,*facet_it, window_size, @@ -126,7 +126,7 @@ public: } // put smoothed values back again to values pmap. std::vector::iterator smoothed_value_it = smoothed_values.begin(); - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it, ++smoothed_value_it) { put(values, *facet_it, *smoothed_value_it); @@ -162,7 +162,7 @@ public: std::vector smoothed_values; smoothed_values.reserve(num_faces(mesh)); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { std::map neighbors; NeighborSelector()(mesh, *facet_it, window_size, @@ -188,7 +188,7 @@ public: } // put smoothed values back again to values pmap. std::vector::iterator smoothed_value_it = smoothed_values.begin(); - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { values[*facet_it] = *smoothed_value_it; } diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h index 5709694f491..1baaa2b8c91 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/SDF_calculation.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #define CGAL_NUMBER_OF_MAD 1.5 @@ -90,11 +90,11 @@ private: typedef typename Tree::Primitive_id Primitive_id; // Sampled points from disk, t1 = coordinate-x, t2 = coordinate-y, t3 = weight. - typedef boost::tuple Disk_sample; + typedef std::tuple Disk_sample; typedef std::vector Disk_samples_list; // DiskSampling class responsible for the sampling points in a disk. It is used for generating rays in the cones. For different example see Disk_samplers.h - typedef Vogel_disk_sampling > + typedef Vogel_disk_sampling > Default_sampler; // member variables @@ -303,8 +303,8 @@ public: Primitive_id closest_id; Vector disk_vector = sum_functor( - scale_functor(v1, FT(disk_multiplier * sample_it->get<0>())), - scale_functor(v2, FT(disk_multiplier * sample_it->get<1>())) ); + scale_functor(v1, FT(disk_multiplier * std::get<0>(*sample_it))), + scale_functor(v2, FT(disk_multiplier * std::get<1>(*sample_it))) ); Vector ray_direction = sum_functor(scaled_normal, disk_vector); if(use_diagonal) { @@ -322,7 +322,7 @@ public: "A degenerate segment is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample."); } - boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id) + std::tie(is_intersected, intersection_is_acute, min_distance, closest_id) = cast_and_return_minimum(segment, skip, accept_if_acute); } else { Ray ray(center, ray_direction); @@ -332,7 +332,7 @@ public: "A degenerate ray is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample."); } - boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id) + std::tie(is_intersected, intersection_is_acute, min_distance, closest_id) = ray_casting(ray, skip, accept_if_acute); } @@ -342,7 +342,7 @@ public: visitor(closest_id, min_distance); - ray_distances.push_back(std::make_pair(min_distance, sample_it->get<2>())); + ray_distances.push_back(std::make_pair(min_distance, std::get<2>(*sample_it))); } if(ray_distances.empty()) { @@ -407,9 +407,9 @@ private: * - get<3> Primitive_id : closest intersected primitive if get<0> is true, else Primitive_id() */ template - boost::tuple cast_and_return_minimum( + std::tuple cast_and_return_minimum( const Query& query, SkipPrimitiveFunctor skip, bool accept_if_acute) const { - boost::tuple + std::tuple min_distance(false, false, 0.0, Primitive_id()); typedef typename Tree:: template Intersection_and_primitive_id::Type Intersection_and_primitive_id; @@ -440,16 +440,16 @@ private: Vector i_ray(*i_point, query.source()); double new_distance = to_double( i_ray.squared_length() ); - if(!min_distance.template get<0>() - || new_distance < min_distance.template get<2>()) { - min_distance.template get<3>() = id; - min_distance.template get<2>() = new_distance; - min_distance.template get<0>() = true; + if(!std::get<0>(min_distance) + || new_distance < std::get<2>(min_distance)) { + std::get<3>(min_distance) = id; + std::get<2>(min_distance) = new_distance; + std::get<0>(min_distance) = true; min_id = id; min_i_ray = i_ray; } } - if(!min_distance.template get<0>()) { + if(!std::get<0>(min_distance)) { return min_distance; } @@ -467,32 +467,32 @@ private: } } - min_distance.template get<1>() = true; // founded intersection is acceptable. - min_distance.template get<2>() = std::sqrt(min_distance.template get<2>()); + std::get<1>(min_distance) = true; // founded intersection is acceptable. + std::get<2>(min_distance) = std::sqrt(std::get<2>(min_distance)); return min_distance; } // function similar to `cast_and_return_minimum()` but using the function // first_intersection with a Ray to get the closest intersected primitive template - boost::tuple ray_casting( + std::tuple ray_casting( const Ray& query, SkipFunctor s, bool accept_if_acute) const { const std::optional< typename Tree::template Intersection_and_primitive_id::Type > min_intersection = tree.first_intersection(query, s); if(!min_intersection) - return boost::make_tuple(false, false, 0.0, Primitive_id()); + return std::make_tuple(false, false, 0.0, Primitive_id()); const Point* i_point = std::get_if( &min_intersection->first ); if (!i_point) //segment case ignored - return boost::make_tuple(false, false, 0.0, Primitive_id()); + return std::make_tuple(false, false, 0.0, Primitive_id()); Vector min_i_ray(*i_point, query.source()); - boost::tuple + std::tuple min_distance(true, false, to_double(min_i_ray.squared_length()), min_intersection->second); - const Primitive_id& min_id = min_distance.template get<3>(); + const Primitive_id& min_id = std::get<3>(min_distance); if(accept_if_acute) { // check whether the ray makes acute angle with intersected facet @@ -508,8 +508,8 @@ private: } } - min_distance.template get<1>() = true; // founded intersection is acceptable. - min_distance.template get<2>() = std::sqrt(min_distance.template get<2>()); + std::get<1>(min_distance) = true; // founded intersection is acceptable. + std::get<2>(min_distance) = std::sqrt(std::get<2>(min_distance)); return min_distance; } diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h index a2a2228f6f5..eb78e5ed48d 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/Surface_mesh_segmentation.h @@ -84,7 +84,7 @@ public: double min_sdf = (std::numeric_limits::max)(); // If there is any facet which has no sdf value, assign average sdf value of its neighbors face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { double sdf_value = get(sdf_values, *facet_it); CGAL_assertion(sdf_value == -1 || sdf_value >= 0); // validity check @@ -130,7 +130,7 @@ public: double min_sdf = (std::numeric_limits::max)(); double max_sdf = -min_sdf; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { double sdf_value = get(sdf_values, *facet_it); max_sdf = (std::max)(sdf_value, max_sdf); @@ -147,7 +147,7 @@ public: std::pair linear_normalize_sdf_values(const Polyhedron& mesh, SDFPropertyMap sdf_values) { double min_sdf, max_sdf; - boost::tie(min_sdf, max_sdf) = min_max_value(mesh, sdf_values); + std::tie(min_sdf, max_sdf) = min_max_value(mesh, sdf_values); if(min_sdf == max_sdf) { CGAL_warning_msg(min_sdf == max_sdf, "Linear normalization is not applicable!"); @@ -156,7 +156,7 @@ public: const double max_min_dif = max_sdf - min_sdf; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { put(sdf_values, *facet_it, (get(sdf_values, *facet_it) - min_sdf) / max_min_dif); } @@ -297,7 +297,7 @@ public: AlphaExpansionImplementationTag()); std::vector::iterator label_it = labels.begin(); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it, ++label_it) { put(segment_pmap, *facet_it, *label_it); // fill with cluster-ids @@ -354,7 +354,7 @@ private: std::vector& normalized_sdf_values) { normalized_sdf_values.reserve(num_faces(mesh)); face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { double log_normalized = log(get(sdf_values, *facet_it) * CGAL_NORMALIZATION_ALPHA + 1) / log(CGAL_NORMALIZATION_ALPHA + 1); @@ -398,7 +398,7 @@ private: std::map facet_index_map; std::size_t facet_index = 0; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it, ++facet_index) { facet_index_map[*facet_it] = facet_index; @@ -407,7 +407,7 @@ private: const double epsilon = 5e-6; // edges and their weights. pair stores facet-id pairs (see above) (may be using boost::tuple can be more suitable) edge_iterator edge_it, eend; - for(boost::tie(edge_it,eend) = edges(mesh); + for(std::tie(edge_it,eend) = edges(mesh); edge_it != eend; ++edge_it) { halfedge_descriptor hd = halfedge(*edge_it,mesh); halfedge_descriptor ohd = opposite(hd,mesh); @@ -461,7 +461,7 @@ private: std::size_t segment_id = number_of_clusters; std::vector > segments_with_average_sdf_values; face_iterator facet_it, fend; - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { if(get(segments, *facet_it) < number_of_clusters) { // not visited by depth_first_traversal @@ -488,7 +488,7 @@ private: } // make one-pass on facets. First make segment-id zero based by subtracting number_of_clusters // . Then place its sorted index to pmap - for(boost::tie(facet_it,fend) = faces(mesh); + for(std::tie(facet_it,fend) = faces(mesh); facet_it != fend; ++facet_it) { std::size_t segment_id = get(segments, *facet_it) - number_of_clusters; put(segments, *facet_it, segment_id_to_sorted_id_map[segment_id]); diff --git a/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt b/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt index 9c2e4233b54..d30a6c96f63 100644 --- a/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt +++ b/Surface_mesh_segmentation/test/Surface_mesh_segmentation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_segmentation_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp index 412d7ed844f..811ab9345df 100644 --- a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp +++ b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp @@ -192,7 +192,7 @@ void run_benchmarks(CGAL::Random& rand, size_t numTrials, size_t numSources, siz outData.numFaces = num_faces(polyhedron); face_iterator startFace, endFace; - boost::tie(startFace, endFace) = faces(polyhedron); + std::tie(startFace, endFace) = faces(polyhedron); std::vector allFaces; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt index ba5a6455d26..a30dca613c3 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_shortest_path_Examples) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp index a3b7268b77d..fdf2afc0969 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths.cpp @@ -48,7 +48,7 @@ int main(int argc, char** argv) // into a file readable using CGAL Lab std::ofstream output("shortest_paths_with_id.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp index 34b337d95f4..4192f5e70b8 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) // into a file readable using the CGAL Tmesh demo std::ofstream output("shortest_paths_OpenMesh.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp index a0a05111c91..eab88444695 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) // by copying the faces in a vector to get a direct access to faces std::size_t nb_faces=num_faces(tmesh); face_iterator fit, fit_end; - boost::tie(fit, fit_end) = faces(tmesh); + std::tie(fit, fit_end) = faces(tmesh); std::vector face_vector(fit, fit_end); // and creating a vector of Face_location objects const std::size_t nb_source_points = 30; @@ -59,7 +59,7 @@ int main(int argc, char** argv) // into a file readable using the CGAL Tmesh demo std::ofstream output("shortest_paths_multiple_sources.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp index 8b51ee23d2b..678183446cf 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) // into a file readable using CGAL Lab std::ofstream output("shortest_paths_no_id.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp index 697146cc16b..ea434a51188 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp @@ -48,7 +48,7 @@ int main(int argc, char** argv) // into a file readable using CGAL Lab std::ofstream output("shortest_paths_with_id.polylines.txt"); vertex_iterator vit, vit_end; - for ( boost::tie(vit, vit_end) = vertices(tmesh); + for ( std::tie(vit, vit_end) = vertices(tmesh); vit != vit_end; ++vit) { std::vector points; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt index ea1eb891aab..f5ca543e44a 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_shortest_path_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core) diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp index 22b1869274a..e39457cf08f 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_1.cpp @@ -50,7 +50,7 @@ void shortest_path_regular_tetrahedron() face_iterator startFace; face_iterator endFace; - boost::tie(startFace,endFace) = CGAL::faces(P); + std::tie(startFace,endFace) = CGAL::faces(P); face_descriptor firstFace = *startFace; @@ -66,7 +66,7 @@ void shortest_path_regular_tetrahedron() Kernel::FT halfSideLength = sideLength / Kernel::FT(2.0); Kernel::FT triangleHeight = CGAL::sqrt((sideLength*sideLength) - (halfSideLength*halfSideLength)); - for (boost::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) + for (std::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) { if ((*currentVertex)->point().y()==-1) { @@ -118,7 +118,7 @@ void test_simple_saddle_vertex_mesh() vertex_iterator startVertex; vertex_iterator endVertex; - boost::tie(startVertex, endVertex) = CGAL::vertices(P); + std::tie(startVertex, endVertex) = CGAL::vertices(P); vertex_iterator currentVertex = startVertex; @@ -368,7 +368,7 @@ void test_boundary_mesh() face_iterator startFace; face_iterator endFace; - boost::tie(startFace, endFace) = CGAL::faces(P); + std::tie(startFace, endFace) = CGAL::faces(P); vertex_iterator currentVertex; vertex_iterator endVertex; @@ -380,7 +380,7 @@ void test_boundary_mesh() Point_3 vertexLocations[10]; size_t currentVertexIndex = 0; - for (boost::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) + for (std::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex) { vertexHandles[currentVertexIndex] = *currentVertex; vertexLocations[currentVertexIndex] = vpm[*currentVertex]; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp index 19bda236706..ceb07b5e178 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_2.cpp @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) std::vector vertices; - boost::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); + std::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); for (vertex_iterator it = verticesStart; it != verticesEnd; ++it) { @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) std::vector faces; - boost::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); + std::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); for (face_iterator it = facesStart; it != facesEnd; ++it) { diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp index 26da5f2d915..608a79b29c6 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_3.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) Surface_mesh_shortest_path shortestPaths(polyhedron, traits); face_iterator facesBegin, facesEnd; - boost::tie(facesBegin, facesEnd) = faces(polyhedron); + std::tie(facesBegin, facesEnd) = faces(polyhedron); std::vector facesList; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp index 1774d928a24..b0070bd17d0 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_4.cpp @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) Surface_mesh_shortest_path shortestPaths(polyhedron, traits); face_iterator facesBegin, facesEnd; - boost::tie(facesBegin, facesEnd) = faces(polyhedron); + std::tie(facesBegin, facesEnd) = faces(polyhedron); std::vector facesList; @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) } vertex_iterator startVertexIt, endVertexIt; - boost::tie(startVertexIt, endVertexIt) = vertices(polyhedron); + std::tie(startVertexIt, endVertexIt) = vertices(polyhedron); bool first = true; diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp index 54e3c49e4dd..cc7ed1d29b8 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_test_5.cpp @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) std::vector faces; - boost::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); + std::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); for (face_iterator it = facesStart; it != facesEnd; ++it) { diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp index 784be8d0abd..e02ac923237 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits_test.cpp @@ -64,7 +64,7 @@ void test_simple_2D_barycentric_coordinatess() size_t outVertex0; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type b0Type; - boost::tie(b0Type, outVertex0) = classify_barycentric_coordinates(b0); + std::tie(b0Type, outVertex0) = classify_barycentric_coordinates(b0); CHECK_EQUAL(b0Type, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_VERTEX); CHECK_EQUAL(outVertex0, 0u); @@ -77,7 +77,7 @@ void test_simple_2D_barycentric_coordinatess() size_t outVertex1; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type b1Type; - boost::tie(b1Type, outVertex1) = classify_barycentric_coordinates(b1); + std::tie(b1Type, outVertex1) = classify_barycentric_coordinates(b1); CHECK_EQUAL(b1Type, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_VERTEX); CHECK_EQUAL(outVertex1, 1u); @@ -90,7 +90,7 @@ void test_simple_2D_barycentric_coordinatess() size_t outVertex2; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type b2Type; - boost::tie(b2Type, outVertex2) = classify_barycentric_coordinates(b2); + std::tie(b2Type, outVertex2) = classify_barycentric_coordinates(b2); CHECK_EQUAL(b2Type, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_VERTEX); CHECK_EQUAL(outVertex2, 2u); @@ -100,7 +100,7 @@ void test_simple_2D_barycentric_coordinatess() size_t dummyOut; CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinates_type bLocationType; - boost::tie(bLocationType, dummyOut) = classify_barycentric_coordinates(bLocation); + std::tie(bLocationType, dummyOut) = classify_barycentric_coordinates(bLocation); CHECK_EQUAL(bLocationType, CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATES_ON_BOUNDED_SIDE); @@ -282,7 +282,7 @@ void detect_is_saddle_vertex() vertex_iterator currentVertex; vertex_iterator endVertex; - for (boost::tie(currentVertex, endVertex) = vertices(P); currentVertex != endVertex; ++currentVertex) + for (std::tie(currentVertex, endVertex) = vertices(P); currentVertex != endVertex; ++currentVertex) { if (currentVertexIndex <= 3 || currentVertexIndex == 7) { diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp index aaf41537b8b..35d2c0cab86 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp @@ -168,7 +168,7 @@ struct TestMeshProgramInstance std::vector vertices; - boost::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); + std::tie(verticesStart, verticesEnd) = CGAL::vertices(polyhedron); for (vertex_iterator it = verticesStart; it != verticesEnd; ++it) { @@ -180,7 +180,7 @@ struct TestMeshProgramInstance std::vector faces; - boost::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); + std::tie(facesStart, facesEnd) = CGAL::faces(polyhedron); for (face_iterator it = facesStart; it != facesEnd; ++it) { diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h index 0bbb8e88078..7a8476e10f5 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/EdgeCollapseSimplificationVisitor.h @@ -21,6 +21,8 @@ The type of the surface mesh to simplify. Must be a model of the `MutableFaceGra */ typedef Edge_profile::Triangle_mesh TriangleMesh; +/// @} + /// \name Operations /// @{ diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt index 384067e6005..56a52dd5cc4 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_simplification_Examples) # CGAL and its components diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h index 5c23e83e94f..d53b3458d15 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h @@ -754,7 +754,7 @@ is_collapse_topologically_valid(const Profile& profile) // The following loop checks the link condition for v0_v1. // Specifically, that for every vertex 'k' adjacent to both 'p and 'q', 'pkq' is a face of the mesh. // - for(boost::tie(eb1,ee1) = halfedges_around_source(profile.v0(), m_tm); res && eb1 != ee1; ++eb1) + for(std::tie(eb1,ee1) = halfedges_around_source(profile.v0(), m_tm); res && eb1 != ee1; ++eb1) { halfedge_descriptor v0_k = *eb1; @@ -762,7 +762,7 @@ is_collapse_topologically_valid(const Profile& profile) { vertex_descriptor k = target(v0_k, m_tm); - for(boost::tie(eb2,ee2) = halfedges_around_source(k, m_tm); res && eb2 != ee2; ++eb2) + for(std::tie(eb2,ee2) = halfedges_around_source(k, m_tm); res && eb2 != ee2; ++eb2) { halfedge_descriptor k_v1 = *eb2; diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt index 6707d16ccd9..5453440119b 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_simplification_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp index 00e6cf68501..45eba38aa7a 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp @@ -136,7 +136,7 @@ public: Profile::Triangle_vector triangles; out_edge_iterator eb, ee; - for(boost::tie(eb,ee) = halfedges_around_source(opposite(halfedge(mV,tm()),tm()),tm()); eb != ee; ++ eb) + for(std::tie(eb,ee) = halfedges_around_source(opposite(halfedge(mV,tm()),tm()),tm()); eb != ee; ++ eb) { halfedge_descriptor out_edge1 = *eb; halfedge_descriptor out_edge2 = out_edge1->opposite()->next(); diff --git a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt index 66e08127abd..181714c3a51 100644 --- a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Mean_curvature_skeleton) # CGAL and its components diff --git a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/mcf_scale_invariance.cpp b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/mcf_scale_invariance.cpp index 68724128bb9..80f0cfefa6c 100644 --- a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/mcf_scale_invariance.cpp +++ b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/mcf_scale_invariance.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance.cgal"); + output.open("correspondence.cgal"); for(Skeleton_vertex v : vertices(skeleton)) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " << get(CGAL::vertex_point, tmesh, vd) << "\n"; diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt index b5b8d4cd23f..60ccbd71f69 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_skeletonization_Examples) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp index dd62887970c..8231a94b2fb 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp @@ -63,7 +63,7 @@ int main() output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-lcc.polylines.txt"); + output.open("correspondence-lcc.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " << get(CGAL::vertex_point, lcc, vd) << "\n"; diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp index 27feb13cf08..dd9f23e4b16 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-poly.polylines.txt"); + output.open("correspondence-poly.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " << get(CGAL::vertex_point, tmesh, vd) << "\n"; diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_om_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_om_example.cpp index 553ef55c50f..acbd581434a 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_om_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_om_example.cpp @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-sm.polylines.txt"); + output.open("correspondence-sm.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " << get(CGAL::vertex_point, tmesh, vd) << "\n"; diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp index 04ab407e075..e17ddd6fd45 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-sm.polylines.txt"); + output.open("correspondence-sm.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " << get(CGAL::vertex_point, tmesh, vd) << "\n"; diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp index 83f07c3d25d..6fe3051e353 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp @@ -69,7 +69,7 @@ int main() output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-lcc.polylines.txt"); + output.open("correspondence-lcc.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp index 29ac6e27d2d..f292f434130 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp @@ -69,7 +69,7 @@ int main(int argc, char* argv[]) output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-poly.polylines.txt"); + output.open("correspondence-poly.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp index 63c7cbb384f..c7d7d0625b6 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp @@ -48,7 +48,7 @@ int main(int argc, char* argv[]) output.close(); // Output skeleton points and the corresponding surface points - output.open("correspondance-sm.polylines.txt"); + output.open("correspondence-sm.polylines.txt"); for(Skeleton_vertex v : CGAL::make_range(vertices(skeleton))) for(vertex_descriptor vd : skeleton[v].vertices) output << "2 " << skeleton[v].point << " " << get(CGAL::vertex_point, tmesh, vd) << "\n"; diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index 39b928852ea..b69e59d8e0c 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -344,7 +344,7 @@ double diagonal_length(const Bbox_3& bbox) double init_min_edge_length() { vertex_iterator vb, ve; - boost::tie(vb, ve) = vertices(m_tmesh); + std::tie(vb, ve) = vertices(m_tmesh); Vertex_to_point v_to_p(m_tmesh_point_pmap); Bbox_3 bbox = CGAL::bbox_3(boost::make_transform_iterator(vb, v_to_p), boost::make_transform_iterator(ve, v_to_p)); diff --git a/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h b/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h index f8a1f3eeb20..c1905924ba8 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h +++ b/Surface_mesh_skeletonization/include/CGAL/Surface_mesh_skeletonization/internal/Curve_skeleton.h @@ -177,7 +177,7 @@ public: bool exist; edge_desc edge; - boost::tie(edge, exist) = boost::edge(p1_vd, p2_vd, curve); + std::tie(edge, exist) = boost::edge(p1_vd, p2_vd, curve); if (!exist) { boost::add_edge(p1_vd, p2_vd, curve); @@ -353,7 +353,7 @@ private: // look for ei from p2's incident edges bool found; int ind; - boost::tie(found, ind) = find_edge(vertex_to_edge[p2], ei); + std::tie(found, ind) = find_edge(vertex_to_edge[p2], ei); if (!found) { continue; diff --git a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt index cfbd1507754..d581a0b6d1a 100644 --- a/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/test/Surface_mesh_skeletonization/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_skeletonization_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt index ed4937594fc..287b89df09e 100644 --- a/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/benchmark/Surface_mesh_topology/CMakeLists.txt @@ -1,6 +1,6 @@ project(Surface_mesh_topology_Benchmarks) -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) find_package(CGAL REQUIRED) diff --git a/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp b/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp index 9a5f36d352b..e6d3b3d7104 100644 --- a/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp +++ b/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp @@ -118,13 +118,13 @@ int main(int argc, char** argv) if (!withE) { E=static_cast(random.get_int - (10, std::max(std::size_t(11), - cm.number_of_darts()/10))); } + (10, (std::max)(std::size_t(11), + cm.number_of_darts()/10))); } if (!withD) { D=static_cast(random.get_int - (10, std::max(std::size_t(11), - cm.number_of_darts()/10))); } + (10, (std::max)(std::size_t(11), + cm.number_of_darts()/10))); } diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt index ae6793d8270..b528c238d49 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_topology_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt index dc45d083c3e..298d2838256 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesh_topology_Tests) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Surface_mesher/doc/Surface_mesher/PackageDescription.txt b/Surface_mesher/doc/Surface_mesher/PackageDescription.txt index 39b9d967d97..091d2399df4 100644 --- a/Surface_mesher/doc/Surface_mesher/PackageDescription.txt +++ b/Surface_mesher/doc/Surface_mesher/PackageDescription.txt @@ -21,7 +21,6 @@ /*! \addtogroup PkgSurfaceMesher3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Surface Mesh Generation,PkgSurfaceMesher3} \cgalPkgPicture{segmented_head-small.png} \cgalPkgSummaryBegin diff --git a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt index 4613fe7dc45..56c3805ea0b 100644 --- a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt @@ -1,6 +1,6 @@ # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesher_Examples) find_package(CGAL REQUIRED COMPONENTS ImageIO) diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h b/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h index 2e8cf47f695..92c9b08a56b 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Sphere_oracle_3.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace CGAL { @@ -96,7 +96,7 @@ namespace CGAL { { const Self& oracle; - boost::tuple + std::tuple intersection_line_sphere_lambda(const Surface_3& sphere, const Point& a, const Point& b) const @@ -148,18 +148,18 @@ namespace CGAL { switch( CGAL::sign(deltaprime) ) { case ZERO: - return boost::make_tuple(1, ab_ac / ab2, 0); + return std::make_tuple(1, ab_ac / ab2, 0); case POSITIVE: { const FT sqrt_deltaprime = CGAL::sqrt(deltaprime); - return boost::make_tuple(2, - (ab_ac - sqrt_deltaprime) / ab2, - (ab_ac + sqrt_deltaprime) / ab2); + return std::make_tuple(2, + (ab_ac - sqrt_deltaprime) / ab2, + (ab_ac + sqrt_deltaprime) / ab2); } case NEGATIVE: break; } - return boost::make_tuple(0, 0, 0); + return std::make_tuple(0, 0, 0); } //end intersection_line_sphere_lambda template @@ -179,7 +179,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); const Vector ab = vector(a, b); @@ -285,7 +285,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); #ifdef CGAL_SURFACE_MESHER_DEBUG_IMPLICIT_ORACLE @@ -347,7 +347,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 && root_2 > FT(0) ) @@ -386,7 +386,7 @@ namespace CGAL { int number_of_roots; FT root_1, root_2; - boost::tie(number_of_roots, root_1, root_2) = + std::tie(number_of_roots, root_1, root_2) = intersection_line_sphere_lambda(sphere, a, b); if( number_of_roots == 2 ) diff --git a/Surface_mesher/test/Surface_mesher/CMakeLists.txt b/Surface_mesher/test/Surface_mesher/CMakeLists.txt index 751de47ec99..555e184c83b 100644 --- a/Surface_mesher/test/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/test/Surface_mesher/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_mesher_Tests) find_package(CGAL REQUIRED) diff --git a/Surface_sweep_2/doc/Surface_sweep_2/CGAL/Surface_sweep_2_algorithms.h b/Surface_sweep_2/doc/Surface_sweep_2/CGAL/Surface_sweep_2_algorithms.h index 9e8ecee5e02..5175bb1fa82 100644 --- a/Surface_sweep_2/doc/Surface_sweep_2/CGAL/Surface_sweep_2_algorithms.h +++ b/Surface_sweep_2/doc/Surface_sweep_2/CGAL/Surface_sweep_2_algorithms.h @@ -27,7 +27,7 @@ input curves. When the flag `report_endpoints` is `true`, this function reports all the curve endpoints as well. If a curve endpoint is also an intersection point, it is reported once (regardless of the value of the `report_endpoints` flag). The `Traits` type -must be a model of the `ArrangementTraits_2` concept, such that the +must be a model of the `AosTraits_2` concept, such that the value-type of `InputIterator` is `Traits::Curve_2`, and the value-type of `OutputIterator` is `Traits::Point_2`. The output points are reported in an increasing \f$ xy\f$-lexicographical order. @@ -64,7 +64,7 @@ disjoint in their interior, as induced by the input curves. If the flag `multiple_overlaps` is `true`, then a subcurve that represents an overlap of \f$ k\f$ input curves is reported \f$ k\f$ times; otherwise, each subcurve is reported only once. The `Traits` type must be a model -of the `ArrangementTraits_2` concept, such that the value-type of +of the `AosTraits_2` concept, such that the value-type of `InputIterator` is `Traits::Curve_2`, and the value-type of `OutputIterator` is `Traits::X_monotone_curve_2`. */ @@ -94,7 +94,7 @@ Given a range of curves, check whether there is at least one pair of curves that intersect in their interior. The function returns `true` if such a pair is found, and `false` if all curves are pairwise disjoint in their interior. The `Traits` type must be a model -of the `ArrangementTraits_2` concept, such that the value-type of +of the `AosTraits_2` concept, such that the value-type of `InputIterator` is `Traits::Curve_2`. */ template @@ -103,4 +103,3 @@ bool do_curves_intersect (InputIterator curves_begin, Traits traits = Default_traits()); } /* namespace CGAL */ - diff --git a/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt b/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt index d6d239ae476..8f4d6fcc4d6 100644 --- a/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt +++ b/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt @@ -1,7 +1,6 @@ /// \defgroup PkgSurfaceSweep2Ref 2D Intersection of Curves Reference /*! \addtogroup PkgSurfaceSweep2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Intersection of Curves,PkgSurfaceSweep2} \cgalPkgPicture{Curve_intersections_2.png} \cgalPkgSummaryBegin diff --git a/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt b/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt index 097490409ba..9e16de9d1b9 100644 --- a/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt +++ b/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt @@ -33,7 +33,7 @@ all degenerate cases, including overlapping curves, vertical segments, and tangency between curves. The robustness of the algorithm is guaranteed if the functions are instantiated with a traits class that employs certified computations. This traits class must be a model of -the `ArrangementTraits_2` concept - see the Chapter \ref +the `AosTraits_2` concept - see the Chapter \ref chapterArrangement_on_surface_2 "2D Arrangements" for more details. The complexity of the surface-sweep algorithm is \cgalBigO{(n + diff --git a/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt index 9c8742904a3..efa3b73ce6e 100644 --- a/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_sweep_2_Examples) # CGAL and its components diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 4cf76b87681..66ada8c1f56 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Surface_sweep_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake deleted file mode 100755 index 60483af61d6..00000000000 --- a/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./cgal_test_base -cmake diff --git a/TDS_2/doc/TDS_2/PackageDescription.txt b/TDS_2/doc/TDS_2/PackageDescription.txt index d4dc2c2645e..95af343936f 100644 --- a/TDS_2/doc/TDS_2/PackageDescription.txt +++ b/TDS_2/doc/TDS_2/PackageDescription.txt @@ -3,7 +3,6 @@ /// \ingroup PkgTDS2Ref /*! \addtogroup PkgTDS2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Triangulation Data Structure,PkgTDS2} \cgalPkgPicture{tds_small.png} \cgalPkgSummaryBegin diff --git a/TDS_2/test/TDS_2/CMakeLists.txt b/TDS_2/test/TDS_2/CMakeLists.txt index 283d2478e12..4eae9c44970 100644 --- a/TDS_2/test/TDS_2/CMakeLists.txt +++ b/TDS_2/test/TDS_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(TDS_2_Tests) find_package(CGAL REQUIRED) diff --git a/TDS_3/doc/TDS_3/PackageDescription.txt b/TDS_3/doc/TDS_3/PackageDescription.txt index 06523934036..9f2efbc741f 100644 --- a/TDS_3/doc/TDS_3/PackageDescription.txt +++ b/TDS_3/doc/TDS_3/PackageDescription.txt @@ -10,7 +10,6 @@ /// \ingroup PkgTDS3Ref /*! \addtogroup PkgTDS3Ref -\todo check generated documentation \cgalPkgDescriptionBegin{3D Triangulation Data Structure,PkgTDS3} \cgalPkgPicture{tds3_small.png} \cgalPkgSummaryBegin diff --git a/TDS_3/examples/TDS_3/CMakeLists.txt b/TDS_3/examples/TDS_3/CMakeLists.txt index c0ba49a3d79..21ee9b95fb0 100644 --- a/TDS_3/examples/TDS_3/CMakeLists.txt +++ b/TDS_3/examples/TDS_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(TDS_3_Examples) find_package(CGAL REQUIRED) diff --git a/TDS_3/test/TDS_3/CMakeLists.txt b/TDS_3/test/TDS_3/CMakeLists.txt index 5cca940fe98..90fffaac8da 100644 --- a/TDS_3/test/TDS_3/CMakeLists.txt +++ b/TDS_3/test/TDS_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(TDS_3_Tests) find_package(CGAL REQUIRED) diff --git a/Testsuite/test/collect_cgal_testresults_from_cmake b/Testsuite/test/collect_cgal_testresults_from_cmake deleted file mode 100755 index b8e3370abee..00000000000 --- a/Testsuite/test/collect_cgal_testresults_from_cmake +++ /dev/null @@ -1,283 +0,0 @@ -#!/bin/sh -# collect_cgal_testresults_from_cmake -# =================================== -# collect all files to generate the html page -# containing the testsuite results -# -# to be run in the CGAL/test directory or a local test directory. -# CGAL_TESTER, CGAL_TESTER_NAME, CGAL_TESTER_ADDRESS are environment variables. - - -if [ -z "${CGAL_TEST_PLATFORM}" ]; then - - CGAL_TEST_PLATFORM=`dirname $PWD` - echo "CGAL_TEST_PLATFORM not in the environment, setting it to ${CGAL_TEST_PLATFORM}" -fi - -if [ -z "$1" ] ; then - TEST_DIRECTORIES=`ls` -else - TEST_DIRECTORIES="$*" -fi - -GENERAL_BUILD_LOGFILE='' -PLATFORM_BUILD_LOGFILE='' -TEST_REPORT='' -RESULT_FILE='' - -#print_testresult -# print result on stdout -# print timings on fd3 -print_testresult() -{ - if [ -f skipped ]; then - RESULT="s" - TIMING="0" - elif [ ! -f ErrorOutput_$1 ] ; then - RESULT="?" - TIMING="?" - else - if eval grep ERROR ErrorOutput_$1 > /dev/null ; then - RESULT="n" - else - # grep -q means "quiet": no output, the return code is 0 iff the file - # matches the regular expression. - # grep -i means "case insensitive". - # grep -E means "extended regular expressions". - # All those three options are in the Single Unix Specification version 3 - - # The extended regular expression '[^a-zA-Z_,:-]warning matches any - # string "warning" preceded with a letter that is not a letter or '_' - # or ',' or ':'. That avoids some false positives such as - # '-read_only_relocs,warning' or '-D_CRT_SECURE_NO_WARNINGS', or - # 'QMessageBox::warning'. - if grep -v -F 'CMake Warning at /usr/share/cmake/Modules/FindBoost' CompilerOutput_$1 ProgramOutput.*.$1 | grep -i -E -q '(^|[^a-zA-Z_,:-])warning' - then - if grep -v -F 'CMake Warning at /usr/share/cmake/Modules/FindBoost' CompilerOutput_$1 ProgramOutput.*.$1 | grep -i -E '(^|[^a-zA-Z_,:-])warning' | grep -i -q "include[/\]CGAL\|cmake\|CGAL warning" - then - RESULT="w" - else - RESULT="t" - fi - else - if grep -E -q 'NOTICE: .*(need|require|incompatible|not found).*will not be' CompilerOutput_$1 - then - RESULT="r" - else - RESULT="y" - fi - fi - fi - TIMING=`awk '/^ # Running time: / {print $4}' < ErrorOutput_$1` - fi - echo "$2 $TIMING" >&3 - echo "$2 $RESULT" -} - -parse_flags_and_third_party_choices() -{ - grep -e "^-- USING " ${PLATFORM_BUILD_LOGFILE} >> $RESULT_FILE - echo "------------" >> $RESULT_FILE -} - - -output_main_logs() -{ - [ -e Installation ] || mkdir "Installation" - - INSTALLATION_TEST_REPORT="Installation/$TEST_REPORT" - - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " General Build Log " >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "${GENERAL_BUILD_LOGFILE}" ] ; then - cat "${GENERAL_BUILD_LOGFILE}" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " Platform-specific Build Log " >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "${PLATFORM_BUILD_LOGFILE}" ] ; then - cat "${PLATFORM_BUILD_LOGFILE}" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - - if [ -f "$HOME/.autocgal_with_cmake_rc" ] ; then - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " .autocgal_with_cmake_rc" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - cat "$HOME/.autocgal_with_cmake_rc" >> "$INSTALLATION_TEST_REPORT" - else - if [ -f "$HOME/.autocgalrc" ] ; then - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " .autocgalrc" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - cat "$HOME/.autocgalrc" >> "$INSTALLATION_TEST_REPORT" - fi - fi - - if [ -f "../setup" ] ; then - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " setup" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - cat "../setup" >> "$INSTALLATION_TEST_REPORT" - fi - - - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " CMakeCache.txt" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "../CMakeCache.txt" ] ; then - cat "../CMakeCache.txt" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " include/CGAL/compiler_config.h" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "../include/CGAL/compiler_config.h" ] ; then - cat "../include/CGAL/compiler_config.h" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " CGALConfig.cmake" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "../CGALConfig.cmake" ] ; then - cat "../CGALConfig.cmake" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " CMakeError.log" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "../CMakeFiles/CMakeError.log" ] ; then - cat "../CMakeFiles/CMakeError.log" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - - echo "" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo " CMakeOutput.log" >> "$INSTALLATION_TEST_REPORT" - echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT" - echo "" >> "$INSTALLATION_TEST_REPORT" - if [ -f "../CMakeFiles/CMakeOutput.log" ] ; then - cat "../CMakeFiles/CMakeOutput.log" >> "$INSTALLATION_TEST_REPORT" - else - echo "Not found!" >> "$INSTALLATION_TEST_REPORT" - fi - -} - -echo "---------------------------------------------------------------" -echo " Collecting results of platform $CGAL_TEST_PLATFORM" -echo "---------------------------------------------------------------" - -CURRENT_DIR=`pwd` -TESTER=${CGAL_TESTER:-${USER:-`whoami`}} -TESTER_NAME="${CGAL_TESTER_NAME:-${TESTER}}" -TESTER_ADDRESS="${CGAL_TESTER_ADDRESS:-${TESTER}}" -TEST_REPORT="TestReport_${TESTER}_${CGAL_TEST_PLATFORM}" -RESULT_FILE="$CURRENT_DIR/results_${TESTER}_${CGAL_TEST_PLATFORM}.txt" -TIMING_FILE="$CURRENT_DIR/timings_${TESTER}_${CGAL_TEST_PLATFORM}.txt" -CGAL_DIR=../../../.. -GENERAL_BUILD_LOGFILE="../../installation.log" -PLATFORM_BUILD_LOGFILE="../installation.log" -rm -f "$RESULT_FILE" "$TIMING_FILE" -touch "$RESULT_FILE" "$TIMING_FILE" -sed -n '/CGAL_VERSION /s/#define //p' < "$CGAL_DIR/include/CGAL/version.h" >> "$RESULT_FILE" -echo "TESTER ${TESTER}" >> "$RESULT_FILE" -echo "TESTER_NAME ${TESTER_NAME}" >> "$RESULT_FILE" -echo "TESTER_ADDRESS ${TESTER_ADDRESS}" >> "$RESULT_FILE" -echo "CGAL_TEST_PLATFORM ${CGAL_TEST_PLATFORM}" >> "$RESULT_FILE" -echo "General installation log file: ${GENERAL_BUILD_LOGFILE}" >> "$RESULT_FILE" -echo "Host-specific installation log file: ${PLATFORM_BUILD_LOGFILE}" >> "$RESULT_FILE" - -output_main_logs - -parse_flags_and_third_party_choices - -for DIR in $TEST_DIRECTORIES ; do - if [ -d "$DIR" ] ; then - echo " $DIR ..." - cd "$DIR" - - print_testresult "$CGAL_TEST_PLATFORM" "$DIR" >> "$RESULT_FILE" 3>>"$TIMING_FILE" - - if [ ! "$DIR" = "Installation" ] ; then - rm -f "${TEST_REPORT}" - touch "$TEST_REPORT" - fi - if [ -f .scm-urls ]; then - echo " Test files from:" >> "$TEST_REPORT" - cat .scm-urls >> "$TEST_REPORT" - echo >> "$TEST_REPORT" - elif [ -f ../../../../../.scm-branch ]; then - cat ../../../../../.scm-branch >> "$TEST_REPORT" - echo >> "$TEST_REPORT" - fi - - if [ ! -f ErrorOutput_${CGAL_TEST_PLATFORM} ] ; then - echo "Error: file $DIR/ErrorOutput_${CGAL_TEST_PLATFORM} does not exist!" - else - cat ErrorOutput_${CGAL_TEST_PLATFORM} >> "$TEST_REPORT" - fi - - if [ ! -f CompilerOutput_${CGAL_TEST_PLATFORM} ] ; then - echo "Error: file $DIR/CompilerOutput_${CGAL_TEST_PLATFORM} does not exist!" - else - cat CompilerOutput_${CGAL_TEST_PLATFORM} >> "$TEST_REPORT" - fi - - if 2>&1 eval ls ProgramOutput.*.${CGAL_TEST_PLATFORM} > /dev/null ; then - PROGRAM_OUTPUT=`ls ProgramOutput.*"$CGAL_TEST_PLATFORM"*` - for FILE in $PROGRAM_OUTPUT ; do - echo >> "$TEST_REPORT" - echo "------------------------------------------------------------------" >> "$TEST_REPORT" - echo "- $FILE" >> "$TEST_REPORT" - echo "------------------------------------------------------------------" >> "$TEST_REPORT" - cat $FILE >> "$TEST_REPORT" - done - fi - - cd .. - fi -done - - -OUTPUT_FILE=results_${TESTER}_${CGAL_TEST_PLATFORM}.tar -rm -f $OUTPUT_FILE $OUTPUT_FILE.gz -tar cf $OUTPUT_FILE results_${TESTER}_${CGAL_TEST_PLATFORM}.txt timings_${TESTER}_${CGAL_TEST_PLATFORM}.txt */"$TEST_REPORT" -echo -echo "compressing ..." -gzip -9f $OUTPUT_FILE -echo "results written to file $OUTPUT_FILE.gz" -echo - - -# Local Variables: -# standard-indent: 2 -# End: diff --git a/Testsuite/test/makefile2 b/Testsuite/test/makefile2 deleted file mode 100644 index c1c3dfe4fc1..00000000000 --- a/Testsuite/test/makefile2 +++ /dev/null @@ -1,15 +0,0 @@ -# A GNU makefile which calls run_testsuite_with_cmake over all directories. - -dirs:=$(wildcard */) -targets:=$(addsuffix pink_elephant,$(dirs)) -cleans:=$(addsuffix green_elephant,$(dirs)) - -all: ${targets} - -clean: ${cleans} - -%/pink_elephant: - @+./run_testsuite_with_cmake $* - -%/green_elephant: - @cd $* && $(MAKE) clean diff --git a/Testsuite/test/parse-ctest-dashboard-xml.py b/Testsuite/test/parse-ctest-dashboard-xml.py index 748ada8a48c..e2bf65dc9c4 100644 --- a/Testsuite/test/parse-ctest-dashboard-xml.py +++ b/Testsuite/test/parse-ctest-dashboard-xml.py @@ -78,7 +78,7 @@ for t_id in range(0, len(tests)): warning_pattern=re.compile(r'(.*([^a-zA-Z_,:-])warning)', flags=re.IGNORECASE) w_det=re.compile("warning"); -filter_pattern=re.compile(r'cmake|cgal', flags=re.IGNORECASE); +filter_pattern=re.compile(r'cmake|cgal|.*\.cpp', flags=re.IGNORECASE); with open_file_create_dir(result_file_name.format(dir=os.getcwd(), tester=tester_name, platform=platform_name), 'a+') as results: diff --git a/Testsuite/test/run_testsuite_with_cmake b/Testsuite/test/run_testsuite_with_cmake deleted file mode 100755 index 17a0b7fcaea..00000000000 --- a/Testsuite/test/run_testsuite_with_cmake +++ /dev/null @@ -1,263 +0,0 @@ -#! /bin/sh -# -# This is the test script for the CGAL-library. -# -# Usage: -# run_testsuite for running the test suite in all subdirectories -# run_testsuite for running the test suite in the listed -# subdirectories -# -# To use this script you have to do two things: -# -# 2) set some additional compiler and or linker flags - -TESTSUITE_CXXFLAGS="" -TESTSUITE_LDFLAGS="" - -CURRENTDIR=`pwd` -ERRORFILE=${CURRENTDIR}/error.txt -if [ -n "$CGAL_TEST_PLATFORM" ]; then - PLATFORM=$CGAL_TEST_PLATFORM -else - PLATFORM=no-platform -fi -if [ -n "${CGAL_TIMEOUT_PROG+x}" ]; then - TIMEOUT=$CGAL_TIMEOUT_PROG -else - TIMEOUT=`which timeout` - [ -z "$TIMEOUT" ] && TIMEOUT=`which gtimeout` -fi - -#clear the error file -rm -f "$ERRORFILE" -touch "$ERRORFILE" - -# On Cygwin, killing bash does not kill jobs it has spawned. This -# function takes a PID as argument and prints the list of children -# processes of this process, including itself. -process_tree() -{ - local pid=$1 - local result= - echo $pid - ps -a | awk '!/^ +PID/ {print $1 " " $2}' | { - while read apid appid; do - if [ "$appid" = "$pid" ]; then - process_tree $apid - fi - done - } -} - -# Wait for process with pid $1. -# Wait for $2 periods of $3 seconds, checking after every period -# if the watched process has finished. -wait_for_process() -{ - pid=$1; - cycles=$2 - period=$3 - while [ $cycles -ne 0 ] - do - cycles=`expr $cycles - 1` -# send SIGCONT to the process and check the exit value of kill. -# If the process still exists, the call to kill succeeds (and the signal is -# ignored). - - kill -CONT $pid 2>kill_output 1>/dev/null; terminated=$? -# But under CYGWIN the exit status is not to be trusted. - if [ $terminated -eq 0 ]; then - if grep -i 'no such process' kill_output; then - terminated=1; - fi - fi - rm -f kill_output - if [ $terminated -eq 0 ] - then - sleep $period - else - cycles=0 - running=0 - fi - done - if [ $terminated -eq 0 ] - then - if false; then -# Send signal Terminate (SIGTERM) to the whole process group. -# First disable the default action (quit) for the current process. - trap true TERM - kill -TERM 0 - trap TERM - else - - # $pid is the PID of the forked shell that launched the command - # in background, in run_local_cgal_test(). If the shell is - # Bash, the Bash manual states that it ignores SIGTERM. - # However, it does not catch SIGHUP. That is why the first - # signal send is SIGHUP. - case "`uname`" in - CYGWIN*) - pids=`process_tree $pid`;; - *) pids=$pid;; - esac - for p in $pids; do kill -HUP $p; done - sleep 10 - # If SIGHUP was not enough, SIGKILL will finish the job, 10s after. - for p in $pids; do kill -KILL $p 2>/dev/null; done - fi - return 1 - fi - return 0 -} - -run_local_cgal_test() -{ - # Workaround an issue on Windows when GNU Make is used for "make -f - # makefile2" but nmake is used after. - MAKEFLAGS= - export MAKEFLAGS - - if [ -n "$TIMEOUT" ]; then - "$TIMEOUT" $(( $TIME_PERIOD * 5 )) ./cgal_test_with_cmake > current_compiler_output 2>&1 - else - ./cgal_test_with_cmake > current_compiler_output 2>&1 - fi - exit_value=$? - if [ $exit_value -ne 0 ] - then - printf "%s\n" "$exit_value" > test_failure - fi - return $exit_value -} - -#test_directory -# test_directory() may call itself once: the second parameter avoids that -# it calls itself infinitely. -test_directory() -{ - cd "$CURRENTDIR" - if [ -d $1 ] ; then - echo "DIRECTORY $1:" - echo - - echo "DIRECTORY $1:" >> "$ERRORFILE" - echo >> "$ERRORFILE" - cd "$1" - - COMPILER_OUTPUT=CompilerOutput_$PLATFORM - rm -f "$COMPILER_OUTPUT" - ERROR_OUTPUT=ErrorOutput_$PLATFORM - rm -f "$ERROR_OUTPUT" - - echo "------------------------------------------------------------------" >> "$COMPILER_OUTPUT" - echo "- Compiler output from platform $PLATFORM" >> "$COMPILER_OUTPUT" - echo "------------------------------------------------------------------" >> "$COMPILER_OUTPUT" - echo >> "$COMPILER_OUTPUT" - - echo "------------------------------------------------------------------" >> "$ERROR_OUTPUT" - echo "- Error output from platform $PLATFORM" >> "$ERROR_OUTPUT" - echo "------------------------------------------------------------------" >> "$ERROR_OUTPUT" - echo >> "$ERROR_OUTPUT" - - if [ -f cgal_test_with_cmake -a -x cgal_test_with_cmake ] ; then - export PLATFORM TESTSUITE_CXXFLAGS TESTSUITE_LDFLAGS - rm -f error.txt - START=`date +%s` - TIME_PERIOD=1200 - if [ "$1" = "Polyhedron_Demo" ]; then - TIME_PERIOD=2400 - fi - if [ -n "$TIMEOUT" ]; then - run_local_cgal_test - return_code=$? - if [ $return_code -eq 124 ]; then - echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERRORFILE" - echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERROR_OUTPUT" - else - if [ -f test_failure ] ; then - exit_failure=`cat test_failure` - rm -f test_failure - echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERRORFILE" - echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERROR_OUTPUT" - fi - fi - else - run_local_cgal_test & - - if wait_for_process "$!" "$TIME_PERIOD" "5" - then - if [ -f test_failure ] ; then - exit_failure=`cat test_failure` - rm -f test_failure - echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERRORFILE" - echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERROR_OUTPUT" - fi - else - echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERRORFILE" - echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERROR_OUTPUT" - fi - fi - STOP=`date +%s` - DURATION=`expr "$STOP" - "$START"` - printf " # Running time: %s (seconds)\n\n" "$DURATION" >> "$ERRORFILE" - printf " # Running time: %s (seconds)\n\n" "$DURATION" >> "$ERROR_OUTPUT" - cat current_compiler_output >> "$COMPILER_OUTPUT" - cat current_compiler_output - rm -f current_compiler_output - - if [ -f error.txt ] ; then - cat error.txt >> "$ERRORFILE" - cat error.txt >> "$ERROR_OUTPUT" - else - echo "ERROR: the script cgal_test_with_cmake failed to generate output" >> "$ERRORFILE" - fi - else - if [ -z "$2" ]; then - create_cgal_test - test_directory "$1" "second_time" - else - echo " Could not execute the script cgal_test_with_cmake in directory $1" - echo "ERROR: could not execute the script $1/cgal_test_with_cmake" >> $ERRORFILE - fi - fi - echo >> "$ERRORFILE" - echo >> "$ERROR_OUTPUT" - fi - echo -} - -run_testsuite() -{ - - echo "---------------------------------------------------------------" - echo "- Testing platform $PLATFORM" - echo "---------------------------------------------------------------" - echo - - echo "---------------------------------------------------------------" >> "$ERRORFILE" - echo "- TEST RESULTS FROM PLATFORM $PLATFORM" >> "$ERRORFILE" - echo "---------------------------------------------------------------" >> "$ERRORFILE" - echo >> "$ERRORFILE" - - case "`uname`" in - CYGWIN*) - PATH=`cygpath "$CGAL_DIR"`/bin:`cygpath "$CGAL_DIR"`/lib:$PATH - export PATH - esac - - for DIR in $TEST_DIRECTORIES ; do - if [ ! -f $DIR/skipped ]; then - test_directory "$DIR" - fi - done -} - -[ x"$1" = x"icons" -o x"$1" = x"resources" ] && exit 0 - -if [ -z "$1" ] ; then - TEST_DIRECTORIES=`ls | grep -E -v 'icons|resources'` -else - TEST_DIRECTORIES="$*" -fi - -run_testsuite diff --git a/Testsuite/test/testsuite_branch_build.mk b/Testsuite/test/testsuite_branch_build.mk deleted file mode 100644 index df517e7e8ab..00000000000 --- a/Testsuite/test/testsuite_branch_build.mk +++ /dev/null @@ -1,15 +0,0 @@ -# A GNU makefile which calls run_testsuite_with_cmake over all directories. - -dirs:=$(wildcard ../../*/test/*/) -targets:=$(addsuffix pink_elephant,$(dirs)) -cleans:=$(addsuffix green_elephant,$(dirs)) - -all: ${targets} - -clean: ${cleans} - -%/pink_elephant: - @+./run_testsuite_with_cmake $* - -%/green_elephant: - @cd $* && $(MAKE) clean diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt index 64bbdc1a194..1e2f8f0d0ca 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Tetrahedral_remeshing_Examples) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/peel_slivers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/peel_slivers.h index a4ae96383cd..00d0e16f0a1 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/peel_slivers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/peel_slivers.h @@ -18,6 +18,8 @@ #include #include +#include + namespace CGAL { namespace Tetrahedral_remeshing @@ -70,16 +72,16 @@ std::size_t peel_slivers(C3T3& c3t3, Cell_handle c = c_i.first; const std::array& f_on_surface = c_i.second; - boost::optional patch; + std::optional patch; for (int i = 0; i < 4; ++i) { if (f_on_surface[i]) { Surface_patch_index spi = c3t3.surface_patch_index(c, i); - if (patch != boost::none && patch.get() != spi) + if (patch.has_value() && patch.value() != spi) { //there are 2 different patches - patch = boost::none; + patch.reset(); break; } else @@ -88,7 +90,7 @@ std::size_t peel_slivers(C3T3& c3t3, } } } - if (patch == boost::none) + if (!patch.has_value()) continue; for (int i = 0; i < 4; ++i) @@ -96,7 +98,7 @@ std::size_t peel_slivers(C3T3& c3t3, if (f_on_surface[i]) c3t3.remove_from_complex(c, i); else - c3t3.add_to_complex(c, i, patch.get()); + c3t3.add_to_complex(c, i, patch.value()); } c3t3.remove_from_complex(c); diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h index ba8da5bf4f1..8a53ed2ea9e 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h @@ -38,6 +38,85 @@ namespace Tetrahedral_remeshing { namespace internal { + +template +bool positive_orientation_after_edge_split(const typename C3t3::Edge& e, + const typename C3t3::Cell_handle circ, + const typename C3t3::Triangulation::Geom_traits::Point_3& steiner, + const C3t3&) +{ + using Point = typename C3t3::Triangulation::Geom_traits::Point_3; + + const auto v1 = e.first->vertex(e.second); + const auto v2 = e.first->vertex(e.third); + + std::array pts = {point(circ->vertex(0)->point()), + point(circ->vertex(1)->point()), + point(circ->vertex(2)->point()), + point(circ->vertex(3)->point())}; + // 1st half-cell + const int i1 = circ->index(v1); + const Point p1 = pts[i1]; + pts[i1] = steiner; + if(CGAL::orientation(pts[0], pts[1], pts[2], pts[3]) != CGAL::POSITIVE) + return false; + + // 2nd half-cell + pts[i1] = p1; + pts[circ->index(v2)] = steiner; + if(CGAL::orientation(pts[0], pts[1], pts[2], pts[3]) != CGAL::POSITIVE) + return false; + + return true; +} + +template +std::optional +construct_steiner_point(const typename C3t3::Edge& e, + const C3t3& c3t3) +{ + using Cell_circulator = typename C3t3::Triangulation::Cell_circulator; + using Cell_handle = typename C3t3::Triangulation::Cell_handle; + using Point = typename C3t3::Triangulation::Geom_traits::Point_3; + using FT = typename C3t3::Triangulation::Geom_traits::FT; + + const auto& gt = c3t3.triangulation().geom_traits(); + const auto& tr = c3t3.triangulation(); + const auto& p1 = point(e.first->vertex(e.second)->point()); + const auto& p2 = point(e.first->vertex(e.third)->point()); + const auto vec = gt.construct_vector_3_object()(p1, p2); + + const std::array coeff = {0.33, 0.66, //1/3 and 2/3 + 0.3, 0.7, // 0.5 +/- 0.2 + 0.25, 0.75}; // 0.5 +/- 0.25 + + std::size_t attempt_id = 0; + while(attempt_id < coeff.size()) + { + Point steiner = gt.construct_translated_point_3_object()( + p1, gt.construct_scaled_vector_3_object()(vec, coeff[attempt_id])); + ++attempt_id; + + bool steiner_successful = true; + Cell_circulator circ = tr.incident_cells(e); + Cell_circulator end = circ; + do + { + Cell_handle c = circ; + if(!positive_orientation_after_edge_split(e, c, steiner, c3t3)) + { + steiner_successful = false; + break; + } + } while(++circ != end); + + if(steiner_successful) + return steiner; + } + + return std::nullopt; +} + template typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, CellSelector cell_selector, @@ -57,7 +136,7 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, const Vertex_handle v1 = e.first->vertex(e.second); const Vertex_handle v2 = e.first->vertex(e.third); - const Point m = tr.geom_traits().construct_midpoint_3_object() + Point m = tr.geom_traits().construct_midpoint_3_object() (point(v1->point()), point(v2->point())); //backup subdomain info of incident cells before making changes @@ -78,8 +157,6 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, // remove complex edge before splitting const Curve_index curve_index = (dimension == 1) ? c3t3.curve_index(e) : Curve_index(); - if (dimension == 1) - c3t3.remove_from_complex(e); struct Cell_info { Subdomain_index subdomain_index_; @@ -93,39 +170,38 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, boost::unordered_map> facets_info; // check orientation and collect incident cells to avoid circulating twice + bool steiner_point_found = false; boost::container::small_vector inc_cells; Cell_circulator circ = tr.incident_cells(e); Cell_circulator end = circ; do { inc_cells.push_back(circ); - if (tr.is_infinite(circ)) + if (tr.is_infinite(circ) || steiner_point_found) { ++circ; continue; } - //1st half-cell - std::array pts = { point(circ->vertex(0)->point()), - point(circ->vertex(1)->point()), - point(circ->vertex(2)->point()), - point(circ->vertex(3)->point()) }; - const int i1 = circ->index(v1); - const Point p1 = pts[i1]; - pts[i1] = m; - if(CGAL::orientation(pts[0], pts[1], pts[2], pts[3]) != CGAL::POSITIVE) - return Vertex_handle(); - - //2nd half-cell - pts[i1] = p1; - pts[circ->index(v2)] = m; - if (CGAL::orientation(pts[0], pts[1], pts[2], pts[3]) != CGAL::POSITIVE) - return Vertex_handle(); - + const Cell_handle c = circ; + if(!positive_orientation_after_edge_split(e, c, m, c3t3)) + { + const std::optional steiner = construct_steiner_point(e, c3t3); + if (steiner != std::nullopt) + { + m = *steiner; + steiner_point_found = true; + } + else + return Vertex_handle(); + } ++circ; } while (circ != end); + if (dimension == 1) + c3t3.remove_from_complex(e); + for(Cell_handle c : inc_cells) { const int index_v1 = c->index(v1); @@ -311,6 +387,9 @@ void split_long_edges(C3T3& c3t3, #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG debug::dump_edges(long_edges, "long_edges.polylines.txt"); + std::ofstream can_be_split_ofs("can_be_split_edges.polylines.txt"); + std::ofstream split_failed_ofs("split_failed.polylines.txt"); + std::ofstream ofs("midpoints.off"); ofs << "OFF" << std::endl; ofs << long_edges.size() << " 0 0" << std::endl; @@ -335,7 +414,11 @@ void split_long_edges(C3T3& c3t3, auto [splittable, _] = can_be_split(edge, c3t3, protect_boundaries, cell_selector); if (!splittable) continue; - +#ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG + else + can_be_split_ofs << "2 " << edge.first->vertex(edge.second)->point() + << " " << edge.first->vertex(edge.third)->point() << std::endl; +#endif visitor.before_split(tr, edge); Vertex_handle vh = split_edge(edge, cell_selector, c3t3); @@ -343,6 +426,9 @@ void split_long_edges(C3T3& c3t3, visitor.after_split(tr, vh); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG + else + split_failed_ofs << "2 " << edge.first->vertex(edge.second)->point() << " " + << edge.first->vertex(edge.third)->point() << std::endl; if (vh != Vertex_handle()) ofs << vh->point() << std::endl; #endif @@ -364,8 +450,9 @@ void split_long_edges(C3T3& c3t3, }//end loop on long_edges #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG - if(ofs.is_open()) - ofs.close(); + if(can_be_split_ofs.is_open()) can_be_split_ofs.close(); + if(split_failed_ofs.is_open()) split_failed_ofs.close(); + if(ofs.is_open()) ofs.close(); #endif #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt index de0fb965c4e..63bc0c06023 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Tetrahedral_remeshing_Tests) diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp index e6e1f222c61..45632b69d1f 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp @@ -18,7 +18,7 @@ typedef CGAL::Tetrahedral_remeshing::Remeshing_triangulation_3 Remeshing_tria void generate_input_two_subdomains(const std::size_t nbv, Remeshing_triangulation& tr) { - CGAL::Random rng; + CGAL::Random& rng = CGAL::get_default_random(); typedef Remeshing_triangulation::Point Point; typedef Remeshing_triangulation::Cell_handle Cell_handle; diff --git a/Three/doc/Three/Three.txt b/Three/doc/Three/Three.txt index 2156a47f8a9..a9d180059da 100644 --- a/Three/doc/Three/Three.txt +++ b/Three/doc/Three/Three.txt @@ -328,7 +328,7 @@ Configure CMake as you desire and fetch the right Qt6 packages : set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) - cmake_minimum_required(VERSION 3.12...3.29) + cmake_minimum_required(VERSION 3.12...3.31) #Find CGAL find_package(CGAL COMPONENTS Qt6) @@ -366,7 +366,7 @@ Notice that an external plugin will not be automatically loaded in the Lab. It m set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) - cmake_minimum_required(VERSION 3.12...3.29) + cmake_minimum_required(VERSION 3.12...3.31) #Find CGAL find_package(CGAL COMPONENTS Qt6) diff --git a/Triangulation/applications/Triangulation/CMakeLists.txt b/Triangulation/applications/Triangulation/CMakeLists.txt index 262c38e3bda..2ed210eb1ca 100644 --- a/Triangulation/applications/Triangulation/CMakeLists.txt +++ b/Triangulation/applications/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script_with_options # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_apps) # CGAL and its components diff --git a/Triangulation/benchmark/Triangulation/CMakeLists.txt b/Triangulation/benchmark/Triangulation/CMakeLists.txt index 0abb1fc41f9..5a3787259ee 100644 --- a/Triangulation/benchmark/Triangulation/CMakeLists.txt +++ b/Triangulation/benchmark/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_benchmark) find_package(CGAL REQUIRED COMPONENTS Core) diff --git a/Triangulation/doc/Triangulation/Concepts/TriangulationDataStructure.h b/Triangulation/doc/Triangulation/Concepts/TriangulationDataStructure.h index 197a362532e..e12ab593ff7 100644 --- a/Triangulation/doc/Triangulation/Concepts/TriangulationDataStructure.h +++ b/Triangulation/doc/Triangulation/Concepts/TriangulationDataStructure.h @@ -870,6 +870,7 @@ a vertex of the `c`. */ int index(Vertex_handle v) const; +/// @} /// \name Internal /// \cgalAdvancedBegin diff --git a/Triangulation/examples/Triangulation/CMakeLists.txt b/Triangulation/examples/Triangulation/CMakeLists.txt index 44e2a96f1e0..34edb7814bc 100644 --- a/Triangulation/examples/Triangulation/CMakeLists.txt +++ b/Triangulation/examples/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_Examples) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) diff --git a/Triangulation/test/Triangulation/CMakeLists.txt b/Triangulation/test/Triangulation/CMakeLists.txt index ed03cdab900..23b67f9c497 100644 --- a/Triangulation/test/Triangulation/CMakeLists.txt +++ b/Triangulation/test/Triangulation/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_Tests) if(CMAKE_COMPILER_IS_GNUCCX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h index 29d2b48d745..f9786d793f3 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h @@ -77,16 +77,17 @@ A default constructed `Constraint_id` is a singular value that can not be the ID typedef unspecified_type Constraint_id; /*! -An iterator to visit +A bidirectional iterator to visit all the input constraints. The order of visit is undefined. The value type of this iterator is `Constraint_id`. */ typedef unspecified_type Constraint_iterator; /*! -A range type for iterating over all constraints. +A range type for iterating over all constraints. The iterator type of +the range is `Constraint_iterator`. */ -typedef Iterator_range Constraints; +typedef unspecified_type Constraints; /*! @@ -95,22 +96,33 @@ A subconstraint is a pair of vertices that correspond to an `Edge`. typedef std::pair Subconstraint; /*! -An iterator -to visit all the subconstraints of the triangulation. +A bidirectional iterator to visit all the subconstraints of the triangulation. The order of visit is undefined. -The value type of this iterator is `std::pair*>` -corresponding to the vertices of the -subconstraint. +The value type of this iterator is `Subconstraint`. */ typedef unspecified_type Subconstraint_iterator; /*! -A range type for iterating over all subconstraints. +A range type for iterating over all subconstraints. The iterator type of +the range is `Subconstraint_iterator`. */ -typedef Iterator_range Subconstraints; +typedef unspecified_type Subconstraints; /*! -An iterator on the +A bidirectional iterator to visit all the subconstraints of the triangulation and the +contexts of their enclosing constraints. The order of visit is undefined. +The value type of this iterator is `const std::pair*>`. +*/ +typedef unspecified_type Subconstraint_and_contexts_iterator; + +/*! +A range type for iterating over all subconstraints. The iterator type of +the range is `Subconstraint_and_contexts_iterator`. +*/ +typedef unspecified_type Subconstraints_and_contexts; + +/*! +A bidirectional iterator on the vertices of the chain of subconstraints representing a constraint. The value type of this iterator is `Vertex_handle`. */ @@ -152,10 +164,8 @@ through a subconstraint. }; /*! -An iterator on -constraints enclosing a given subconstraint. The value type of this -iterator -is `Context`. +A bidirectional iterator on constraints enclosing a given subconstraint. +The value type of this iterator is `Context`. */ typedef unspecified_type Context_iterator; @@ -348,6 +358,11 @@ void remove_constraint(Constraint_id cid); /// \name Access /// @{ +/// +/// \note +/// Since CGAL-6.1, the value type of the range returned by `subconstraints()` has changed from +/// `const std::pair*>` to `Subconstraint`. +/// The old range type is now returned by the function `subconstraints_and_contexts()`. /*! returns a `Constraint_iterator` that points at the first @@ -381,6 +396,22 @@ returns a range of subconstraints. */ Subconstraints subconstraints() const; +/*! +returns a `Subconstraint_and_contexts_iterator` pointing at the first +subconstraint of the triangulation. +*/ +Subconstraint_and_contexts_iterator subconstraints_and_contexts_begin() const; + +/*! +returns the past-the-end iterator of the subconstraints of the triangulation. +*/ +Subconstraint_and_contexts_iterator subconstraints_and_contexts_end() const; + +/*! +returns a range of subconstraints with the contexts of their enclosing constraints. +*/ +Subconstraints_and_contexts subconstraints_and_contexts() const; + /*! returns the number of constraints enclosing the subconstraint `(va,vb)`. diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h index 570114a5b99..ffc29f933bb 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h @@ -785,6 +785,7 @@ is returned. */ Vertex_handle move(Vertex_handle v, const Point & p); +/// @} /// \name Specialized Modifiers /// The following member functions offer more specialized versions of @@ -1191,6 +1192,18 @@ Returns the line segment corresponding to edge `*ei`. Segment segment(const Edge_iterator& ei) const; +/*! +Returns the point given by vertex `i` of face `f`. +\pre `t.dimension()` \f$ \geq0\f$ and \f$ i \in\{0,1,2\}\f$ in dimension 2, \f$ i \in\{0,1\}\f$ in dimension 1, \f$ i = 0\f$ in dimension 0, and the vertex is finite. +*/ +const Point& point(Face_handle f, int i) const; + +/*! +Same as the previous method for vertex `v`. +\pre `t.dimension()` \f$ \geq0\f$ and the vertex is finite. +*/ +const Point& point(Vertex_handle v) const; + /*! Compute the circumcenter of the face pointed to by f. This function is available only if the corresponding function is provided in the diff --git a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt index f84ffe376ba..815186bb141 100644 --- a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt +++ b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt @@ -27,7 +27,6 @@ /*! \addtogroup PkgTriangulation2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Triangulations,PkgTriangulation2} \cgalPkgPicture{cdt2d-small.png} \cgalPkgSummaryBegin diff --git a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt index 2e2b15634af..22051dcdf3c 100644 --- a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_2_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp b/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp index 950cb022632..d276b5a4d36 100644 --- a/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp +++ b/Triangulation_2/examples/Triangulation_2/constrained_hierarchy_plus.cpp @@ -23,22 +23,23 @@ int main( ) { Triangulation cdt; - std::cout << "Inserting a grid 5 x 5 of constraints " << std::endl; + std::cout << "Inserting a grid 5 x 5 of 10 intersecting constraints " << std::endl; for (int i = 1; i < 6; ++i) cdt.insert_constraint( Point(0,i), Point(6,i)); for (int j = 1; j < 6; ++j) cdt.insert_constraint( Point(j,0), Point(j,6)); int count = 0; - for (Triangulation::Subconstraint_iterator scit = cdt.subconstraints_begin(); - scit != cdt.subconstraints_end(); - ++scit) ++count; + using Sc = Triangulation::Subconstraint; + for ([[maybe_unused]] const Sc& sc : cdt.subconstraints()) { + ++count; + } std::cout << "The number of resulting constrained edges is "; std::cout << count << std::endl; //verbose mode of is_valid ; shows the number of vertices at each level std::cout << "The number of vertices at successive levels" << std::endl; - assert(cdt.is_valid(true)); + bool valid = cdt.is_valid(true); - return 0; + return valid ? 0 : 1; } diff --git a/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp b/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp index bc00e7071ba..b2b38e93765 100644 --- a/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp +++ b/Triangulation_2/examples/Triangulation_2/polylines_triangulation.cpp @@ -28,13 +28,14 @@ print(const CDTP& cdtp, Cid cid) void contexts(const CDTP& cdtp) { - for(auto sc : cdtp.subconstraints()){ - Vertex_handle vp = sc.first.first, vq = sc.first.second; + for(const auto& sc_and_contexts : cdtp.subconstraints_and_contexts()) { + const auto& [subconstraint, contexts_list_ptr] = sc_and_contexts; + Vertex_handle vp = subconstraint.first, vq = subconstraint.second; if(cdtp.number_of_enclosing_constraints(vp, vq) == 2){ std::cout << "subconstraint " << vp->point() << " " << vq->point() << " is on constraints starting at:\n"; - for(const CDTP::Context& c : cdtp.contexts(vp,vq)){ + for(const CDTP::Context& c : *contexts_list_ptr) { std::cout << (*(c.vertices_begin()))->point() << std::endl; } } diff --git a/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp b/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp index 5eadd29090f..80ef763b404 100644 --- a/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp +++ b/Triangulation_2/examples/Triangulation_2/segment_soup_to_polylines.cpp @@ -31,7 +31,8 @@ int main() cdtp.insert_constraint(Point(100,100), Point(200,200)); // Segment soup of 8 segments as input - std::cout << "Input CDT+ has " << cdtp.number_of_constraints() << " constraints/subconstraints" << std::endl; + std::cout << "Input CDT+ has " << cdtp.number_of_constraints() + << " constraints/subconstraints" << std::endl; std::cout << "Splitting subconstraints graph into constraints" << std::endl; cdtp.split_subconstraint_graph_into_constraints(); @@ -47,5 +48,11 @@ int main() std::cout << std::endl; } + if(cdtp.number_of_constraints() != 5) + { + std::cerr << "Error: expected 5 constraints/subconstraints" << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index caed792fa5e..8e9aa157817 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -40,7 +40,7 @@ struct Get_iterator_value_type{ template struct Get_iterator_value_type{ - typedef typename std::iterator_traits::value_type type; + using type = typename std::iterator_traits::value_type; }; } } //namespace CGAL::internal @@ -56,8 +56,8 @@ class Cdt_2_less_edge { const Tr* tr_ptr; - typedef typename Tr::Point Point; - typedef typename Tr::Edge Edge; + using Point = typename Tr::Point; + using Edge = typename Tr::Edge; public: Cdt_2_less_edge(const Tr* tr_ptr) : tr_ptr(tr_ptr) { } @@ -94,39 +94,49 @@ class Constrained_Delaunay_triangulation_2 : public Constrained_triangulation_2 { public: - typedef Constrained_triangulation_2 Ctr; - typedef typename Ctr::Tds Tds; - typedef typename Ctr::Itag Itag; + using Base = Constrained_triangulation_2; + using Ctr = Base; - typedef Constrained_Delaunay_triangulation_2 CDt; - typedef typename Ctr::Geom_traits Geom_traits; - typedef typename Ctr::Intersection_tag Intersection_tag; + // using-declarations, to import types from the base class + // (do not mix-up with type aliases) + // see: https://en.cppreference.com/w/cpp/language/type_alias + // https://en.cppreference.com/w/cpp/language/using_declaration + using typename Ctr::Tds; + using typename Ctr::Itag; - typedef typename Ctr::Constraint Constraint; - typedef typename Ctr::Vertex_handle Vertex_handle; - typedef typename Ctr::Face_handle Face_handle; - typedef typename Ctr::Edge Edge; - typedef typename Ctr::Finite_faces_iterator Finite_faces_iterator; - typedef typename Ctr::Constrained_edges_iterator Constrained_edges_iterator; - typedef typename Ctr::Face_circulator Face_circulator; - typedef typename Ctr::size_type size_type; - typedef typename Ctr::Locate_type Locate_type; + using typename Ctr::Geom_traits; + using typename Ctr::Intersection_tag; - typedef typename Ctr::List_edges List_edges; - typedef typename Ctr::List_faces List_faces; - typedef typename Ctr::List_vertices List_vertices; - typedef typename Ctr::List_constraints List_constraints; + using typename Ctr::Constraint; +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1920) + using Vertex_handle = typename Ctr::Vertex_handle; // workaround for VC++ 19.16 (from MSVC 2017) +#else + using typename Ctr::Vertex_handle; +#endif + using typename Ctr::Face_handle; + using typename Ctr::Edge; + using typename Ctr::Finite_faces_iterator; + using typename Ctr::Constrained_edges_iterator; + using typename Ctr::Face_circulator; + using typename Ctr::size_type; + using typename Ctr::Locate_type; - typedef internal::Cdt_2_less_edge Less_edge; - typedef boost::container::flat_set Edge_set; + using typename Ctr::List_edges; + using typename Ctr::List_faces; + using typename Ctr::List_vertices; + using typename Ctr::List_constraints; + + // type aliases (aka type defs) + using CDt = Constrained_Delaunay_triangulation_2; + using Point = typename Geom_traits::Point_2; //Tag to distinguish Delaunay from regular triangulations - typedef Tag_false Weighted_tag; + using Weighted_tag = Tag_false; // Tag to distinguish periodic triangulations from others - typedef Tag_false Periodic_tag; + using Periodic_tag = Tag_false; -#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 + // using-declarations to import member functions from the base class using Ctr::geom_traits; using Ctr::number_of_vertices; using Ctr::finite_faces_begin; @@ -151,9 +161,6 @@ public: using Ctr::delete_vertex; using Ctr::push_back; using Ctr::mirror_index; -#endif - - typedef typename Geom_traits::Point_2 Point; Constrained_Delaunay_triangulation_2(const Geom_traits& gt=Geom_traits()) : Ctr(gt) { } @@ -176,7 +183,7 @@ public: CGAL_postcondition( is_valid() ); } - virtual ~Constrained_Delaunay_triangulation_2() {} + ~Constrained_Delaunay_triangulation_2() override {} // Ensure rule-of-five: define the copy- and move- constructors @@ -293,17 +300,17 @@ public: bool is_valid(bool verbose = false, int level = 0) const; protected: - virtual Vertex_handle virtual_insert(const Point & a, - Face_handle start = Face_handle()); - virtual Vertex_handle virtual_insert(const Point& a, - Locate_type lt, - Face_handle loc, - int li ); + Vertex_handle virtual_insert(const Point & a, + Face_handle start = Face_handle()) override; + Vertex_handle virtual_insert(const Point& a, + Locate_type lt, + Face_handle loc, + int li ) override; //Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i); void remove_2D(Vertex_handle v ); - virtual void triangulate_hole(List_faces& intersected_faces, - List_edges& conflict_boundary_ab, - List_edges& conflict_boundary_ba); + void triangulate_hole(List_faces& intersected_faces, + List_edges& conflict_boundary_ab, + List_edges& conflict_boundary_ba) override; public: // MESHING @@ -388,8 +395,8 @@ private: indices.push_back(index++); } - typedef typename Pointer_property_map::type Pmap; - typedef Spatial_sort_traits_adapter_2 Search_traits; + using Pmap = typename Pointer_property_map::type; + using Search_traits = Spatial_sort_traits_adapter_2; spatial_sort(indices.begin(), indices.end(), @@ -604,6 +611,9 @@ public: Face_handle ni, f,ff; Edge ei,eni; + using Less_edge = internal::Cdt_2_less_edge; + using Edge_set = boost::container::flat_set; + Less_edge less_edge(this); Edge_set edge_set(less_edge); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 91d01e3e042..eb71d1223d6 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -51,7 +51,7 @@ struct CGAL_DEPRECATED No_intersection_tag : namespace internal { -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#if defined(CGAL_CDT_2_DEBUG_INTERSECTIONS) || defined(CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2) struct Indentation_level { int n; Indentation_level() : n(0) {} @@ -68,7 +68,7 @@ namespace internal { }; Exit_guard open_new_scope() { return Exit_guard(*this); } } cdt_2_indent_level; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS || CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 template struct Itag { @@ -738,7 +738,7 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) int i; if(this->is_edge(vp.first, vp.second, fh,i)){ fh->set_constraint(i,true); - boost::tie(fh,i) = mirror_edge(Edge(fh,i)); + std::tie(fh,i) = mirror_edge(Edge(fh,i)); fh->set_constraint(i,true); } } @@ -815,7 +815,7 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb) internal::Indentation_level::Exit_guard exit_guard = CGAL::internal::cdt_2_indent_level.open_new_scope(); #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS while(! stack.empty()){ - boost::tie(vaa,vbb) = stack.top(); + std::tie(vaa,vbb) = stack.top(); stack.pop(); CGAL_precondition( vaa != vbb); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index 10cdecc984f..1e0c27333ab 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -22,34 +22,44 @@ #include #include #include -#include #include #include #include +#include #include +#include namespace CGAL { // Comparison functor that compares two Vertex_handle. // Used as 'Compare' functor for the constraint hierarchy. template < class Tr > -class Pct2_vertex_handle_less_xy { +class Ctp_2_compare_vertex_handles { const Tr* tr_p; public: - Pct2_vertex_handle_less_xy(const Tr* tr_p) : tr_p(tr_p) {} + Ctp_2_compare_vertex_handles(const Tr* tr_p) : tr_p(tr_p) {} - typedef typename Tr::Vertex_handle Vertex_handle; + using Vertex_handle = typename Tr::Vertex_handle; bool operator()(const Vertex_handle& va, const Vertex_handle& vb) const { return tr_p->compare_xy(va->point(), vb->point()) == SMALLER; } -}; // end class template Pct2_vertex_handle_less_xy +}; // end class template Ctp_2_compare_vertex_handles + +template +using Ctp_2_point_type = typename Tr::Geom_traits::Point_2; + +template +using Ctp_2_hierarchy_type = + Polyline_constraint_hierarchy_2, + Ctp_2_point_type>; // Tr the base triangulation class // Tr has to be Constrained or Constrained_Delaunay with Constrained_triangulation_plus_vertex_base @@ -57,42 +67,45 @@ public: template < class Tr_> class Constrained_triangulation_plus_2 : public Tr_ + , protected Ctp_2_hierarchy_type { - typedef Tr_ Tr; +public: + using Self = Constrained_triangulation_plus_2; + using Base = Tr_; + using Constraint_hierarchy = Ctp_2_hierarchy_type; +protected: + const auto& hierarchy() const { return static_cast(*this); } + auto& hierarchy() { return static_cast(*this); } + +private: + using Tr = Tr_; template class Face_container { - typedef typename CDT::Vertex_handle Vertex_handle; - typedef typename CDT::Face_handle Face_handle; - private: - typedef boost::tuple TFace; - std::vector faces; + using Vertex_handle = typename CDT::Vertex_handle; + using Face_handle = typename CDT::Face_handle; + + using Array = std::array; + std::vector faces; CDT& cdt; public: - typedef Face_handle value_type; - typedef Face_handle& reference; - typedef const Face_handle& const_reference; - + using value_type = Face_handle; Face_container(CDT& cdt_ ) : cdt(cdt_) {} - void push_back(Face_handle fh) - { - faces.push_back(boost::make_tuple(fh->vertex(0), - fh->vertex(1), - fh->vertex(2))); + void push_back(Face_handle fh) { + faces.push_back(Array{fh->vertex(0), fh->vertex(1), fh->vertex(2)}); } template void write_faces(OutputIterator out) { - for(typename std::vector::reverse_iterator - it = faces.rbegin(); it != faces.rend(); ++it) { + for(auto [v0, v1, v2] : make_range(faces.rbegin(), faces.rend())) { Face_handle fh; - if(cdt.is_face(boost::get<0>(*it), boost::get<1>(*it), boost::get<2>(*it), fh)){ + if(cdt.is_face(v0, v1, v2, fh)) { *out++ = fh; } } @@ -100,108 +113,101 @@ class Constrained_triangulation_plus_2 }; public: - typedef Tr Triangulation; - typedef typename Tr::Intersection_tag Intersection_tag; - typedef Constrained_triangulation_plus_2 Self; - typedef Tr Base; + // type aliases (aka type defs) + using Triangulation = Tr; + using Intersection_tag = typename Tr::Intersection_tag; - -#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 + // using-declarations of types or member functions from the two bases using Triangulation::vertices_begin; using Triangulation::vertices_end; using Triangulation::is_infinite; using Triangulation::number_of_vertices; + + using typename Triangulation::Edge; + using typename Triangulation::Vertex; +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1920) + using Vertex_handle = typename Triangulation::Vertex_handle; // workaround for VC++ 19.16 (from MSVC 2017) +#else + using typename Triangulation::Vertex_handle; #endif + using typename Triangulation::Face_handle; + using typename Triangulation::Face_circulator; + using typename Triangulation::Vertex_iterator; + using typename Triangulation::Vertex_circulator; + using typename Triangulation::Locate_type; + using typename Triangulation::Line_face_circulator; + using typename Triangulation::Geom_traits; + using typename Triangulation::Constraint; + using typename Triangulation::size_type; + using typename Triangulation::List_edges; + using typename Triangulation::List_faces; + using typename Triangulation::List_vertices; + using typename Triangulation::List_constraints; + using typename Triangulation::Constrained_edges_iterator; + + using typename Constraint_hierarchy::Context; + using typename Constraint_hierarchy::Context_iterator; + using typename Constraint_hierarchy::Contexts; + using typename Constraint_hierarchy::Constraint_iterator; + using typename Constraint_hierarchy::Constraints; + using typename Constraint_hierarchy::Subconstraint_iterator; + using typename Constraint_hierarchy::Subconstraints; + using typename Constraint_hierarchy::Subconstraint_and_contexts_iterator; + using typename Constraint_hierarchy::Subconstraints_and_contexts; + using typename Constraint_hierarchy::Constraint_id; + using typename Constraint_hierarchy::Vertex_handle_compare; + #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS using Triangulation::display_vertex; #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typedef typename Triangulation::Edge Edge; - typedef typename Triangulation::Vertex Vertex; - typedef typename Triangulation::Vertex_handle Vertex_handle; - typedef typename Triangulation::Face_handle Face_handle; - typedef typename Triangulation::Face_circulator Face_circulator ; - typedef typename Triangulation::Vertex_iterator Vertex_iterator; - typedef typename Triangulation::Vertex_circulator Vertex_circulator; - typedef typename Triangulation::Locate_type Locate_type; - typedef typename Triangulation::Line_face_circulator Line_face_circulator; - typedef typename Triangulation::Geom_traits Geom_traits; - typedef typename Geom_traits::Point_2 Point; - typedef typename Geom_traits::Segment_2 Segment; - typedef typename Triangulation::Constraint Constraint; - typedef typename Triangulation::size_type size_type; + using Point = typename Triangulation::Geom_traits::Point_2; + using Segment = typename Triangulation::Geom_traits::Segment_2; - typedef typename Triangulation::List_edges List_edges; - typedef typename Triangulation::List_faces List_faces; - typedef typename Triangulation::List_vertices List_vertices; - typedef typename Triangulation::List_constraints List_constraints; - typedef typename Triangulation::Constrained_edges_iterator Constrained_edges_iterator; - - typedef Pct2_vertex_handle_less_xy Vh_less_xy; - typedef Polyline_constraint_hierarchy_2 - Constraint_hierarchy; -public: // Tag to mark the presence of a hierarchy of constraints - typedef Tag_true Constraint_hierarchy_tag; + using Constraint_hierarchy_tag = Tag_true; //Tag to distinguish Delaunay from regular triangulations - typedef Tag_false Weighted_tag; + using Weighted_tag = Tag_false; // Tag to distinguish periodic triangulations from others - typedef Tag_false Periodic_tag; + using Periodic_tag = Tag_false; // for user interface with the constraint hierarchy - typedef typename Constraint_hierarchy::Vertex_it - Vertices_in_constraint_iterator; + using Vertices_in_constraint_iterator = typename Constraint_hierarchy::Vertex_it; - typedef Iterator_range Vertices_in_constraint; + using Vertices_in_constraint = Iterator_range; - typedef typename Constraint_hierarchy::Point_it - Points_in_constraint_iterator; - typedef Iterator_range Points_in_constraint; + using Points_in_constraint_iterator = typename Constraint_hierarchy::Point_it; + using Points_in_constraint = Iterator_range; - typedef typename Constraint_hierarchy::Context Context; - typedef typename Constraint_hierarchy::Context_iterator Context_iterator; - typedef Iterator_range Contexts; - typedef typename Constraint_hierarchy::C_iterator Constraint_iterator; - typedef Iterator_range Constraints; - - typedef typename Constraint_hierarchy::Subconstraint_iterator Subconstraint_iterator; - typedef Iterator_range Subconstraints; - - typedef typename Constraint_hierarchy::Constraint_id Constraint_id; - - typedef std::pair Subconstraint; + using Subconstraint = std::pair; using Triangulation::geom_traits; using Triangulation::cw; using Triangulation::ccw; using Triangulation::incident_faces; -protected: - Constraint_hierarchy hierarchy; - public: Constraint_hierarchy& hierarchy_ref() { - return hierarchy; + return *this; } Constrained_triangulation_plus_2(const Geom_traits& gt=Geom_traits()) : Triangulation(gt) - , hierarchy(Vh_less_xy(this)) + , Constraint_hierarchy(Vertex_handle_compare(this)) { } Constrained_triangulation_plus_2(const Constrained_triangulation_plus_2& ctp) - : Triangulation() - , hierarchy(Vh_less_xy(this)) + : Constrained_triangulation_plus_2(ctp.geom_traits()) { copy_triangulation(ctp);} Constrained_triangulation_plus_2(Constrained_triangulation_plus_2&&) = default; - virtual ~Constrained_triangulation_plus_2() {} + ~Constrained_triangulation_plus_2() override {} Constrained_triangulation_plus_2 & operator=(const Constrained_triangulation_plus_2& ctp) { @@ -215,8 +221,7 @@ public: Constrained_triangulation_plus_2(InputIterator first, InputIterator last, const Geom_traits& gt=Geom_traits() ) - : Triangulation(gt) - , hierarchy(Vh_less_xy(this)) + : Constrained_triangulation_plus_2(gt) { insert_constraints(first, last); CGAL_postcondition( this->is_valid() ); @@ -225,14 +230,13 @@ public: Constrained_triangulation_plus_2(const std::list > &constraints, const Geom_traits& gt=Geom_traits() ) - : Triangulation(gt) - , hierarchy(Vh_less_xy(this)) + : Constrained_triangulation_plus_2(gt) { insert_constraints(constraints.begin(), constraints.end()); CGAL_postcondition( this->is_valid() ); } //Helping - void clear() { Base::clear(); hierarchy.clear(); } + void clear() { Base::clear(); hierarchy().clear(); } void copy_triangulation(const Constrained_triangulation_plus_2 &ctp); void swap(Constrained_triangulation_plus_2 &ctp); @@ -271,7 +275,7 @@ public: return Constraint_id(nullptr); } // protects against inserting twice the same constraint - Constraint_id cid = hierarchy.insert_constraint_old_API(va, vb); + Constraint_id cid = hierarchy().insert_constraint_old_API(va, vb); if (va != vb && (cid != Constraint_id(nullptr)) ) insert_subconstraint(va,vb); return cid; @@ -375,68 +379,82 @@ public: } + + // Removes pos from the constraint cid. + // Returns the iterator to vertex that was just after pos (or end()) + // Writes the modified faces to out template Vertices_in_constraint_iterator remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, OutputIterator out) { if(pos == vertices_in_constraint_begin(cid)){ - ++pos; - Constraint_id aux = hierarchy.split2(cid,pos); + // cid is [P, A, ..., B] -> split to aux=[P, A] and cid=[A...B] + Constraint_id aux = hierarchy().split_head(cid, std::next(pos)); remove_constraint(aux, out); - return pos; + return vertices_in_constraint_begin(cid); } - Vertices_in_constraint_iterator it = vertices_in_constraint_end(cid); - it--; - if(pos == it){ - --pos; - Constraint_id aux = hierarchy.split(cid, pos); + if(pos == std::prev(vertices_in_constraint_end(cid))){ + // cid is [A, ..., B, P] -> split to cid=[A...B] and aux=[B,P] + Constraint_id aux = hierarchy().split_tail(cid, std::prev(pos)); remove_constraint(aux, out); return vertices_in_constraint_end(cid); } - Vertices_in_constraint_iterator pp = pos; - --pp; - Vertex_handle a = *pp; - pp = pos; - ++pp; - Vertex_handle b = *pp; - --it; - Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid); - ++beg; - Face_container fc(*this); + const auto second_vertex_of_cid = std::next(vertices_in_constraint_begin(cid)); + const auto next_to_last_vertex_of_cid = std::prev(vertices_in_constraint_end(cid), 2); Constraint_id head = nullptr, tail = nullptr; - if(pos != beg){ + if(pos != second_vertex_of_cid){ + // cid is [A, ..., B, P, C, ..., D] + // split to: + // head = [A...B] and, + // cid = [B, P, C...D] // split off head - --pos; - head = hierarchy.split2(cid, pos); - ++pos; + head = hierarchy().split_head(cid, std::prev(pos)); } - if(pos != it){ + if(pos != next_to_last_vertex_of_cid){ + // cid is now [B, P, C, ..., D] + // split to: + // cid = [B, P, C] and, + // tail = [C...D] // split off tail - ++pos; - tail = hierarchy.split(cid,pos); + tail = hierarchy().split_tail(cid,std::next(pos)); } - Constraint_id aux = insert_constraint(a, b, std::back_inserter(fc)); - pos = vertices_in_constraint_end(aux); - --pos; - --pos; // this is not necessarily == vertices_in_constraint_begin(aux); - hierarchy.swap(cid, aux); - remove_constraint(aux, std::back_inserter(fc)); + // now: + // cid is [B, P, C] + // head is null or [A...B] + // tail is null or [C...D] + // Let create insert [C,D] and conditionally concatenate head and tail, + // and return the iterator to C - if(head.vl_ptr()){ - hierarchy.concatenate2(head, cid); + Vertex_handle b = *std::prev(pos); + Vertex_handle c = *std::next(pos); + + Face_container fc(*this); + Constraint_id bc = insert_constraint(b, c, std::back_inserter(fc)); + + auto pos_before_c = std::prev(vertices_in_constraint_end(bc), 2); + // `pos_before_c` is not necessarily == vertices_in_constraint_begin(bc) + // there might have been intersecting constraints + + hierarchy().swap(cid, bc); + remove_constraint(bc, std::back_inserter(fc)); // removes [B, P, C] + // now cid is [B, C] + + if(head != nullptr){ + hierarchy().prepend(std::move(head), cid); } - if(tail.vl_ptr()){ - hierarchy.concatenate(cid, tail); + if(tail != nullptr){ + hierarchy().concatenate(cid, std::move(tail)); } fc.write_faces(out); - ++pos; // we went one too far back because the last vertex gets removed by concatenate - return pos; + + // we went one too far back because the last vertex `c` gets removed by concatenate/prepend + return std::next(pos_before_c); } // Inserts vh before pos @@ -445,91 +463,101 @@ public: template Vertices_in_constraint_iterator insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, - Vertex_handle vh, OutputIterator out) + Vertex_handle v, OutputIterator out) { // Insertion before the first vertex if(pos == vertices_in_constraint_begin(cid)){ //std::cout << "insertion before first vertex" << std::endl; - Constraint_id head = insert_constraint(vh, *pos, out); - hierarchy.concatenate2(head, cid); + Constraint_id head = insert_constraint(v, *pos, out); + hierarchy().prepend(std::move(head), cid); return vertices_in_constraint_begin(cid); } // Insertion after the last vertex if(pos == vertices_in_constraint_end(cid)){ //std::cout << "insertion after last vertex" << std::endl; - pos--; - Constraint_id tail = insert_constraint(*pos, vh, out); - pos = vertices_in_constraint_end(tail); - --pos; - hierarchy.concatenate(cid, tail); - return pos; + Constraint_id tail = insert_constraint(*std::prev(pos), v, out); + auto new_pos = std::prev(vertices_in_constraint_end(tail)); + hierarchy().concatenate(cid, std::move(tail)); + CGAL_assertion(v == *new_pos); + return new_pos; } + Vertices_in_constraint_iterator pred = std::prev(pos); + Vertices_in_constraint_iterator latest_vertex = std::prev(vertices_in_constraint_end(cid)); + Vertex_handle a = *pred; Vertex_handle b = *pos; - --pos; - Vertex_handle a = *pos; - ++pos; - Face_container fc(*this); - Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid), vcit; - ++beg; - vcit = beg; - ++beg; - // If the constraint consists only of a segment, and we want to insert - // in the middle - if((pos == vcit) && (beg == vertices_in_constraint_end(cid))){ - //std::cout << "insertion in constraint which is a segment" << std::endl; - Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc)); - Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc)); - pos = vertices_in_constraint_begin(aux2); - concatenate(aux1, aux2); - hierarchy.swap(cid, aux1); - remove_constraint(aux1, std::back_inserter(fc)); - fc.write_faces(out); + if(v == a || v == b){ return pos; - } + + // cid is [..., A, B, ...] and V=*v will be inserted between A and B + + Face_container fc(*this); + Constraint_id a_v_b = insert_constraint(a, v, std::back_inserter(fc)); + Constraint_id aux = insert_constraint(v, b, std::back_inserter(fc)); + auto new_pos = vertices_in_constraint_begin(aux); + concatenate(a_v_b, std::move(aux)); + + // here: + // a_v_b is [A,.. V,.. B] + // aux is empty + // and new_pos is the iterator to V + CGAL_assertion(v == *new_pos); + + CGAL_assertion(std::distance(vertices_in_constraint_begin(a_v_b), new_pos) > 0 && + std::distance(new_pos, vertices_in_constraint_end(a_v_b)) > 0); + // new_pos still points to something in a_v_b. In general a_v_b should only have three vertices, + // but there might have been intersectiong constraints or vertices. + + const auto second_vertex_of_cid = std::next(vertices_in_constraint_begin(cid)); + // If the constraint consists only of a segment, and we want to insert + // in the middle: cid is just the segment [A, B] + if((pos == second_vertex_of_cid) && (second_vertex_of_cid == latest_vertex)){ + //std::cout << "insertion in constraint which is a segment" << std::endl; + hierarchy().swap(cid, a_v_b); + remove_constraint(a_v_b, std::back_inserter(fc)); + fc.write_faces(out); + return new_pos; + } + Constraint_id head = nullptr, tail = nullptr; - Vertices_in_constraint_iterator bit = vertices_in_constraint_begin(cid); - Vertices_in_constraint_iterator pred = pos; - --pred; - ++bit; - if(pos != bit){ + if(pos != second_vertex_of_cid){ //std::cout << "split head" << std::endl; - head = split(cid, pred); - std::swap(head,cid); // split2 does the job + head = hierarchy().split_head(cid, pred); pred = vertices_in_constraint_begin(cid); - pos = pred; - ++pos; + pos = std::next(pred); } - Vertices_in_constraint_iterator eit = vertices_in_constraint_end(cid); - --eit; - if(pos != eit){ + // head is now [..., A] or null + // cid is now [A, B, ...] + CGAL_assertion(*pred == a); + CGAL_assertion(*pos == b); + if(pos != latest_vertex){ //std::cout << "split tail" << std::endl; - tail = split(cid, pos); + tail = hierarchy().split_tail(cid, pos); } + // head is now [..., A] or null + // cid is now [A, B] + // tail is now [B, ...] or null - // make the new constraint - Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc)); - Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc)); - pos = vertices_in_constraint_begin(aux2); - concatenate(aux1, aux2); - - if(head.vl_ptr()){ + if(head != nullptr){ //std::cout << "concatenate head" << std::endl; - remove_constraint(cid, std::back_inserter(fc)); - hierarchy.concatenate(head, aux1); + hierarchy().concatenate(head, std::move(a_v_b)); + hierarchy().swap(cid, head); + remove_constraint(head, std::back_inserter(fc)); } else { - hierarchy.swap(cid, aux1); - remove_constraint(aux1, std::back_inserter(fc)); - head = cid; + hierarchy().swap(cid, a_v_b); + remove_constraint(a_v_b, std::back_inserter(fc)); } + // cid is now [..., A, V, B] + // head is now null empty + // a_v_b is now empty - if(tail.vl_ptr()){ + if(tail != nullptr){ //std::cout << "concatenate tail" << std::endl; - concatenate(head, tail); + concatenate(cid, std::move(tail)); } fc.write_faces(out); - return pos; + return new_pos; } template < class InputIterator, class OutputIterator> @@ -550,19 +578,17 @@ public: if(n == 1){ return nullptr; } - Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]); + Constraint_id ca = hierarchy().insert_constraint(vertices[0],vertices[1]); insert_subconstraint(vertices[0],vertices[1], std::back_inserter(fc)); if(n>2){ for(int j=1; jfixed() = true; // Vertices_in_constraint_iterator end = std::prev(vertices_in_constraint_end(ca)); @@ -593,16 +619,16 @@ private: std::size_t n = vertices.size(); if(n == 1){ - return nullptr; + return Constraint_id{}; } CGAL_assertion(n >= 2); - Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]); + Constraint_id ca = hierarchy().insert_constraint(vertices[0],vertices[1]); insert_subconstraint(vertices[0],vertices[1]); if(n>2){ for(std::size_t j=1; j(*this); Unique_hash_map V(0, number_of_vertices()); int inum = 0; - for(Vertex_iterator vit = vertices_begin(); vit != vertices_end() ; ++vit){ - if(! is_infinite(vit)){ - V[vit] = inum++; + for(auto vh : this->finite_vertex_handles()) { + V[vh] = inum++; + } + for(auto cid : constraints()) { + os << cid.size(); + for(Vertex_handle vh : vertices_in_constraint(cid)) { + os << " " << V[vh]; } + os << std::endl; } - - for(Constraint_iterator cit = constraints_begin(); cit != constraints_end(); ++cit){ - os << (*cit).second->all_size(); - for(Vertex_handle vh : vertices_in_constraint(*cit)){ - os << " " << V[vh]; - } - os << std::endl; - } + return os; } + friend std::ostream& operator<<(std::ostream& os, const Constrained_triangulation_plus_2& ctp) { + return ctp.file_output(os); + } - void file_input(std::istream& is) - { - + auto& file_input(std::istream& is) { is >> static_cast(*this); - std::vector V; - V.reserve(number_of_vertices()); - for(Vertex_iterator vit = vertices_begin(); vit != vertices_end() ; ++vit){ - if(! is_infinite(vit)){ - V.push_back(vit); - } - } - Constraint_id cid; - int n, i0, i1; - while(is >> n){ - is >> i0 >> i1; - cid = insert_constraint(V[i0],V[i1]); + std::vector vertices(number_of_vertices()); + auto [first, last] = this->finite_vertex_handles(); + std::copy(first, last, vertices.data()); - for(int i = 2; i < n; i++){ - i0 = i1; - is >> i1; - Constraint_id cid2 = insert_constraint(V[i0],V[i1]); - cid = concatenate(cid, cid2); + size_type n, id, id_next; + while(is >> n) { + is >> id >> id_next; + Constraint_id cid = insert_constraint(vertices[id], vertices[id_next]); + + for(size_type i = 2; i < n; ++i) { + id = id_next; + is >> id_next; + Constraint_id cid2 = insert_constraint(vertices[id], vertices[id_next]); + cid = concatenate(cid, std::move(cid2)); } } + return is; } + friend std::istream& operator>>(std::istream& is, Constrained_triangulation_plus_2& ctp) { + return ctp.file_input(is); + } template typename Constrained_triangulation_plus_2::Constraint_id @@ -672,23 +695,21 @@ public: { // protects against inserting a zero length constraint if(va == vb){ - return Constraint_id(nullptr); + return Constraint_id(); } // protects against inserting twice the same constraint - Constraint_id cid = hierarchy.insert_constraint(va, vb); + Constraint_id cid = hierarchy().insert_constraint(va, vb); if (va != vb && (cid != nullptr) ) insert_subconstraint(va,vb,out); - for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(cid); - vcit != vertices_in_constraint_end(cid); - vcit++){ - insert_incident_faces(vcit, out); + for(auto vh : vertices_in_constraint(cid)) { + out = insert_incident_faces(vh, out); } return cid; } - virtual Vertex_handle intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb); + Vertex_handle intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb) override; Vertex_handle intersect(Face_handle f, int i, Vertex_handle vaa, Vertex_handle vbb, @@ -711,19 +732,16 @@ public: template void remove_constraint(Constraint_id cid, OutputIterator out) { - std::list vertices(hierarchy.vertices_in_constraint_begin(cid), - hierarchy.vertices_in_constraint_end(cid)); + std::vector vertices(hierarchy().vertices_in_constraint_begin(cid), + hierarchy().vertices_in_constraint_end(cid)); - hierarchy.remove_constraint(cid); - for(typename std::list::iterator it = vertices.begin(), - succ = it; - ++succ != vertices.end(); - ++it){ + hierarchy().remove_constraint(cid); + for(auto it = vertices.begin(), succ = it; ++succ != vertices.end(); ++it){ if(! is_subconstraint(*it, *succ)){ // this checks whether other constraints pass Face_handle fh; - int i; - bool b = Triangulation::is_edge(*it, *succ, fh, i); - CGAL_assume(b); + int i = -1; + Triangulation::is_edge(*it, *succ, fh, i); + CGAL_assertion(i != -1); Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary. } } @@ -739,7 +757,7 @@ public: Vertices_in_constraint_iterator u = std::prev(v); Vertices_in_constraint_iterator w = std::next(v); bool unew = (*u != *w); - hierarchy.simplify(u,v,w); + hierarchy().simplify(u,v,w); Triangulation::remove_incident_constraints(*v); @@ -750,112 +768,73 @@ public: } } - std::size_t remove_points_without_corresponding_vertex(Constraint_id cid) - { - return hierarchy.remove_points_without_corresponding_vertex(cid); - } - std::size_t remove_points_without_corresponding_vertex() - { - return hierarchy.remove_points_without_corresponding_vertex(); - } - + using Constraint_hierarchy::remove_points_without_corresponding_vertex; // CONCATENATE AND SPLIT // concatenates two constraints - Constraint_id - concatenate(Constraint_id first, Constraint_id second); + using Constraint_hierarchy::concatenate; // split a constraint in two constraints, so that vcit becomes the first // vertex of the new constraint // returns the new constraint Constraint_id - split(Constraint_id first, Vertices_in_constraint_iterator vcit); + split(Constraint_id first, Vertices_in_constraint_iterator vcit) { + return hierarchy().split_tail(first, vcit); + } // Query of the constraint hierarchy - Constraint_iterator constraints_begin() const; - Constraint_iterator constraints_end() const; - Constraints constraints() const - { - return Constraints(constraints_begin(),constraints_end()); - } - Subconstraint_iterator subconstraints_begin() const; - Subconstraint_iterator subconstraints_end() const; - - Subconstraints subconstraints() const - { - return Subconstraints(subconstraints_begin(),subconstraints_end()); - } - - Context context(Vertex_handle va, Vertex_handle vb); //AF: const; - - bool is_subconstraint(Vertex_handle va, - Vertex_handle vb); - size_type number_of_enclosing_constraints(Vertex_handle va, - Vertex_handle vb) const; - Context_iterator contexts_begin(Vertex_handle va, - Vertex_handle vb) const; - Context_iterator contexts_end(Vertex_handle va, - Vertex_handle vb) const; - - Contexts contexts(Vertex_handle va, Vertex_handle vb) const - { - return Contexts(contexts_begin(va,vb),contexts_end(va,vb)); - } - - Vertices_in_constraint_iterator vertices_in_constraint_begin(Constraint_id cid) const; - Vertices_in_constraint_iterator vertices_in_constraint_end(Constraint_id cid) const; - - Vertices_in_constraint vertices_in_constraint(Constraint_id cid) const - { - return Vertices_in_constraint(vertices_in_constraint_begin(cid), vertices_in_constraint_end(cid)); - } - - Points_in_constraint_iterator points_in_constraint_begin(Constraint_id cid) const; - Points_in_constraint_iterator points_in_constraint_end(Constraint_id cid) const ; + using Constraint_hierarchy::constraints_begin; + using Constraint_hierarchy::constraints_end; + using Constraint_hierarchy::constraints; + using Constraint_hierarchy::subconstraints_begin; + using Constraint_hierarchy::subconstraints_end; + using Constraint_hierarchy::subconstraints; + using Constraint_hierarchy::subconstraints_and_contexts_begin; + using Constraint_hierarchy::subconstraints_and_contexts_end; + using Constraint_hierarchy::subconstraints_and_contexts; + using Constraint_hierarchy::context; + using Constraint_hierarchy::number_of_enclosing_constraints; + using Constraint_hierarchy::is_subconstraint; + using Constraint_hierarchy::contexts_begin; + using Constraint_hierarchy::contexts_end; + using Constraint_hierarchy::contexts; + using Constraint_hierarchy::vertices_in_constraint_begin; + using Constraint_hierarchy::vertices_in_constraint_end; + using Constraint_hierarchy::vertices_in_constraint; + using Constraint_hierarchy::points_in_constraint_begin; + using Constraint_hierarchy::points_in_constraint_end; Points_in_constraint points_in_constraint(Constraint_id cid) const { return Points_in_constraint(points_in_constraint_begin(cid), points_in_constraint_end(cid)); } - size_type number_of_constraints() { - return static_cast (hierarchy.number_of_constraints());} - size_type number_of_subconstraints(){ - return static_cast (hierarchy.number_of_subconstraints());} - - // public member, used by Mesh_2::Refine_edges - void split_constraint(Vertex_handle v1, Vertex_handle v2, - Vertex_handle va) { - hierarchy.split_constraint(v1,v2,va); - } + using Constraint_hierarchy::number_of_constraints; + using Constraint_hierarchy::number_of_subconstraints; + using Constraint_hierarchy::split_constraint; protected: template - void insert_incident_faces(Vertices_in_constraint_iterator vcit, OutputItertator out) + OutputItertator insert_incident_faces(Vertex_handle vh, OutputItertator out) { - Vertex_handle vh = *vcit; Face_circulator fc = incident_faces(vh), done = fc; - Face_circulator null ; - if ( fc != null ) - { + if(fc != nullptr) { do { Face_handle fh = fc; - out = fh; - out++; - fc++; - }while(fc != done); + *out++ = fh; + } while(++fc != done); } + return out; } - void insert_subconstraint(Vertex_handle vaa, Vertex_handle vbb) - { - insert_subconstraint(vaa,vbb,Emptyset_iterator()); - } +{ + insert_subconstraint(vaa,vbb,Emptyset_iterator()); +} @@ -883,7 +862,7 @@ insert_subconstraint(Vertex_handle vaa, stack.push(std::make_pair(vaa,vbb)); while(! stack.empty()){ - boost::tie(vaa,vbb) = stack.top(); + auto [vaa, vbb] = stack.top(); stack.pop(); CGAL_precondition( vaa != vbb); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS @@ -909,7 +888,7 @@ insert_subconstraint(Vertex_handle vaa, #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS this->mark_constraint(fr,i); if (vi != vbb) { - hierarchy.split_constraint(vaa,vbb,vi); + hierarchy().split_constraint(vaa,vbb,vi); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS std::cerr << CGAL::internal::cdt_2_indent_level << "CT_plus_2::insert_constraint (includes_edge) stack push [vi, vbb] ( " << display_vertex(vi) @@ -933,7 +912,7 @@ insert_subconstraint(Vertex_handle vaa, if ( intersection) { if (vi != vaa && vi != vbb) { - hierarchy.split_constraint(vaa,vbb,vi); + hierarchy().split_constraint(vaa,vbb,vi); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS std::cerr << CGAL::internal::cdt_2_indent_level << "CT_plus_2::insert_constraint stack push [vaa, vi] ( " << display_vertex(vaa) @@ -990,7 +969,7 @@ insert_subconstraint(Vertex_handle vaa, out); if (vi != vbb) { - hierarchy.split_constraint(vaa,vbb,vi); + hierarchy().split_constraint(vaa,vbb,vi); stack.push(std::make_pair(vi,vbb)); } } @@ -1000,7 +979,7 @@ insert_subconstraint(Vertex_handle vaa, //to debug public: - void print_hierarchy() { hierarchy.print(); } + void print_hierarchy(std::ostream& os = std::cout) { hierarchy().print(os); } //template member functions public: @@ -1045,7 +1024,7 @@ copy_triangulation(const Constrained_triangulation_plus_2 &ctp) CGAL_assertion(vit->point() == vvit->point()); vmap[vit] = vvit; } - hierarchy.copy(ctp.hierarchy, vmap); + hierarchy().copy(ctp.hierarchy(), vmap); } template @@ -1054,7 +1033,7 @@ Constrained_triangulation_plus_2:: swap(Constrained_triangulation_plus_2 &ctp) { Base::swap(ctp); - hierarchy.swap(ctp.hierarchy); + hierarchy().swap(ctp.hierarchy()); } template < class Tr > @@ -1098,7 +1077,7 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) << " , #" << v2->time_stamp() << "= " << v2->point() << std::endl; #endif - hierarchy.split_constraint(v1,v2,va); + hierarchy().split_constraint(v1,v2,va); } return va; } @@ -1150,16 +1129,12 @@ intersect(Face_handle f, int i, // (the constraint edge (f,i) will be split in hierarchy by insert) // and return the Vertex_handle of the new Vertex { - Vertex_handle vc, vd, va, vb; - Vertex_handle vcc, vdd; - vcc = f->vertex(cw(i)); - vdd = f->vertex(ccw(i)); - CGAL_assertion_code( bool b1 = ) - hierarchy.enclosing_constraint(vcc,vdd,vc,vd); - CGAL_assertion_code( bool b2 = ) - hierarchy.enclosing_constraint(vaa,vbb,va,vb); - CGAL_assertion(b1); - CGAL_assertion(b2); + const Vertex_handle vcc = f->vertex(cw(i)); + const Vertex_handle vdd = f->vertex(ccw(i)); + const auto [vc, vd] = hierarchy().enclosing_constraint(vcc, vdd); + const auto [va, vb] = hierarchy().enclosing_constraint(vaa, vbb); + CGAL_assertion(vc != vd); + CGAL_assertion(va != vb); const Point& pa = va->point(); const Point& pb = vb->point(); @@ -1220,7 +1195,7 @@ intersect(Face_handle f, int i, // vi == vc or vi == vd may happen even if intersection==true // due to approximate construction of the intersection if (vi != vcc && vi != vdd) { - hierarchy.split_constraint(vcc,vdd,vi); + hierarchy().split_constraint(vcc,vdd,vi); insert_subconstraint(vcc,vi); insert_subconstraint(vi, vdd); } @@ -1230,171 +1205,6 @@ intersect(Face_handle f, int i, return vi; } - // CONCATENATE AND SPLIT - - // concatenates two constraints -template -typename Constrained_triangulation_plus_2::Constraint_id -Constrained_triangulation_plus_2::concatenate(Constraint_id first, Constraint_id second) -{ - return hierarchy.concatenate(first,second); -} - - // split a constraint in two constraints, so that vcit becomes the first - // vertex of the new constraint - // returns the new constraint -template -typename Constrained_triangulation_plus_2::Constraint_id -Constrained_triangulation_plus_2::split(Constraint_id first, Vertices_in_constraint_iterator vcit) -{ - return hierarchy.split(first, vcit); -} - - -template -std::ostream & -operator<<(std::ostream& os, - const Constrained_triangulation_plus_2 &ct) -{ - ct.file_output(os); - return os ; -} - -template -std::istream & -operator>>(std::istream& is, - Constrained_triangulation_plus_2 &ct) -{ - ct.file_input(is); - return is ; -} - -// Constraint Hierarchy Queries - -template -inline -typename -Constrained_triangulation_plus_2::Constraint_iterator -Constrained_triangulation_plus_2:: -constraints_begin() const -{ - return hierarchy.c_begin(); -} - -template -inline -typename -Constrained_triangulation_plus_2::Constraint_iterator -Constrained_triangulation_plus_2:: -constraints_end() const -{ - return hierarchy.c_end(); -} - -template -inline -typename -Constrained_triangulation_plus_2::Subconstraint_iterator -Constrained_triangulation_plus_2:: -subconstraints_begin() const -{ - return hierarchy.subconstraint_begin(); -} - -template -inline -typename -Constrained_triangulation_plus_2::Subconstraint_iterator -Constrained_triangulation_plus_2:: -subconstraints_end() const -{ - return hierarchy.subconstraint_end(); -} - - -template -inline -typename Constrained_triangulation_plus_2::Context -Constrained_triangulation_plus_2:: -context(Vertex_handle va, Vertex_handle vb) // AF: const -{ - return hierarchy.context(va,vb); -} - - -template -inline -typename Constrained_triangulation_plus_2::size_type -Constrained_triangulation_plus_2:: -number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const -{ - return static_cast - (hierarchy.number_of_enclosing_constraints(va,vb)); -} - -template -inline bool -Constrained_triangulation_plus_2:: -is_subconstraint(Vertex_handle va, Vertex_handle vb) -{ - return hierarchy.is_subconstrained_edge(va,vb); -} - - -template -inline -typename Constrained_triangulation_plus_2::Context_iterator -Constrained_triangulation_plus_2:: -contexts_begin(Vertex_handle va, Vertex_handle vb) const -{ - return hierarchy.contexts_begin(va,vb); -} - -template -inline -typename Constrained_triangulation_plus_2::Context_iterator -Constrained_triangulation_plus_2:: -contexts_end(Vertex_handle va, Vertex_handle vb) const -{ - return hierarchy.contexts_end(va,vb); -} - -template -inline -typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator -Constrained_triangulation_plus_2:: -vertices_in_constraint_begin(Constraint_id cid) const -{ - return hierarchy.vertices_in_constraint_begin(cid); -} - -template -inline -typename Constrained_triangulation_plus_2::Vertices_in_constraint_iterator -Constrained_triangulation_plus_2:: -vertices_in_constraint_end(Constraint_id cid) const -{ - return hierarchy.vertices_in_constraint_end(cid); -} - -template -inline -typename Constrained_triangulation_plus_2::Points_in_constraint_iterator -Constrained_triangulation_plus_2:: -points_in_constraint_begin(Constraint_id cid) const -{ - return hierarchy.points_in_constraint_begin(cid); -} - -template -inline -typename Constrained_triangulation_plus_2::Points_in_constraint_iterator -Constrained_triangulation_plus_2:: -points_in_constraint_end(Constraint_id cid) const -{ - return hierarchy.points_in_constraint_end(cid); -} - } //namespace CGAL #include diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h index 5eab13d4c1e..e1dbe61c614 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/CTP2_subconstraint_graph.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020 GeometryFactory (France). All rights reserved. +// Copyright (c) 2020,2025 GeometryFactory (France). All rights reserved. // // This file is part of CGAL (www.cgal.org) // @@ -17,8 +17,6 @@ #include #include -#include - namespace CGAL { @@ -30,90 +28,71 @@ class CTP2_subconstraint_graph { CTP2& ctp2; public: + using vertex_descriptor = typename CTP2::Vertex_handle; + using edge_descriptor = typename CTP2::Subconstraint; + using directed_category = boost::undirected_tag; + using edge_parallel_category = boost::disallow_parallel_edge_tag; + struct CTP2_graph_traversal_category : public virtual boost::bidirectional_graph_tag, + public virtual boost::adjacency_graph_tag, + public virtual boost::edge_list_graph_tag, + public virtual boost::vertex_list_graph_tag + {}; + using traversal_category = CTP2_graph_traversal_category; + using vertex_iterator = + internal::Dereference_to_handle_enforcer; - typedef typename CTP2::Vertex_handle vertex_descriptor; - typedef typename CTP2::Subconstraint edge_descriptor; - typedef boost::undirected_tag directed_category; - typedef boost::disallow_parallel_edge_tag edge_parallel_category; - struct CTP2_graph_traversal_category : - public virtual boost::bidirectional_graph_tag, - public virtual boost::adjacency_graph_tag, - public virtual boost::edge_list_graph_tag, - public virtual boost::vertex_list_graph_tag - { }; - typedef CTP2_graph_traversal_category traversal_category; - typedef internal::Dereference_to_handle_enforcer< - CTP2, - typename CTP2::Finite_vertices_iterator, - vertex_descriptor> vertex_iterator; + using edge_iterator = typename CTP2::Subconstraint_iterator; - typedef typename CTP2::Subconstraint_iterator::value_type Subconstr_it_v_t; - typedef First_of_pair_property_map Subconstr_map; - typedef Property_map_to_unary_function Subconstr_uf; - typedef boost::transform_iterator edge_iterator; + CTP2_subconstraint_graph(CTP2& ctp2) + : ctp2(ctp2) {} - CTP2_subconstraint_graph (CTP2& ctp2) : ctp2(ctp2) { } - - friend Iterator_range vertices (const CTP2_subconstraint_graph& g) - { - return make_range (vertex_iterator(g.ctp2.finite_vertices_begin()), - vertex_iterator(g.ctp2.finite_vertices_end())); + friend Iterator_range vertices(const CTP2_subconstraint_graph& g) { + return make_range(vertex_iterator(g.ctp2.finite_vertices_begin()), vertex_iterator(g.ctp2.finite_vertices_end())); } - friend Iterator_range edges (const CTP2_subconstraint_graph& g) - { - return make_range (boost::make_transform_iterator(g.ctp2.subconstraints_begin(), Subconstr_uf(Subconstr_map())), - boost::make_transform_iterator(g.ctp2.subconstraints_end(), Subconstr_uf(Subconstr_map()))); + friend Iterator_range edges(const CTP2_subconstraint_graph& g) { + return g.ctp2.subconstraints(); } - friend vertex_descriptor source (edge_descriptor ed, const CTP2_subconstraint_graph&) - { - return ed.first; - } + friend vertex_descriptor source(edge_descriptor ed, const CTP2_subconstraint_graph&) { return ed.first; } - friend vertex_descriptor target (edge_descriptor ed, const CTP2_subconstraint_graph&) - { - return ed.second; - } + friend vertex_descriptor target(edge_descriptor ed, const CTP2_subconstraint_graph&) { return ed.second; } }; - template class CTP2_graph_visitor { private: + using Constraint_id = typename CTP2::Constraint_id; + using Vertex_handle = typename CTP2::Vertex_handle; CTP2& ctp2; - std::vector to_remove; - typename CTP2::Constraint_id current; - typename CTP2::Vertex_handle latest_vertex; + std::vector to_remove; + Constraint_id current{}; + Vertex_handle latest_vertex{}; public: + CTP2_graph_visitor(CTP2& ctp2) + : ctp2(ctp2) {} - CTP2_graph_visitor (CTP2& ctp2) : ctp2 (ctp2) { } - - void start_new_polyline() - { - latest_vertex = typename CTP2::Vertex_handle(); - current = typename CTP2::Constraint_id(); + void start_new_polyline() { + latest_vertex = Vertex_handle(); + current = Constraint_id(); } - void add_node (typename CTP2::Vertex_handle vh) - { - if (latest_vertex != typename CTP2::Vertex_handle()) - { - to_remove.push_back (ctp2.context(latest_vertex, vh).id()); - typename CTP2::Constraint_id cid = ctp2.insert_constraint(latest_vertex, vh); - if (current == typename CTP2::Constraint_id()) + void add_node(Vertex_handle vh) { + if(latest_vertex != Vertex_handle()) { + to_remove.push_back(ctp2.context(latest_vertex, vh).id()); + Constraint_id cid = ctp2.insert_constraint(latest_vertex, vh); + if(current == Constraint_id()) current = cid; else - current = ctp2.concatenate (current, cid); + current = ctp2.concatenate(current, std::move(cid)); } latest_vertex = vh; } - void end_polyline() - { - for (typename CTP2::Constraint_id id : to_remove) + void end_polyline() { + for(Constraint_id id : to_remove) ctp2.remove_constraint(id); to_remove.clear(); } diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h index 73a7db231ac..8fbc040d9bd 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h @@ -21,10 +21,23 @@ #include #include #include +#include +#include +#include + +#include + +#include #include +#include #include +#include +#include #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +# define CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 # include # include # include @@ -38,101 +51,226 @@ namespace CGAL { template class Polyline_constraint_hierarchy_2 { + using T_point_ref = decltype(std::declval()->point()); + static_assert(std::is_same_v, + "The point type of the vertex handle must be the same as the point type of the hierarchy."); public: - typedef T Vertex_handle; - typedef std::pair Edge; - typedef std::pair Constraint; - typedef std::pair Subconstraint; + using Vertex_handle = T; + using Vertex_handle_compare = Compare; + using Subconstraint = std::pair; + + using size_type = typename Vertex_handle::size_type; private: class Node { public: explicit Node(Vertex_handle vh, bool input = false) - : vertex_(vh), point_(vertex_->point()), input(input) + : vertex_(vh), point_(vertex_->point()), input_(input) {} const Point& point() const { return point_; } - Vertex_handle vertex() const { return vertex_; } + const Vertex_handle& vertex() const { return vertex_; } + bool& input() { return input_; } + const bool& input() const { return input_; } private: Vertex_handle vertex_; Point point_; - public: - bool input; + bool input_; }; - typedef CGAL::Skiplist Vertex_list; - typedef std::list Constraint_list; + using Vertex_list = CGAL::Skiplist; + using Vertex_list_ptr = Vertex_list*; public: // the base line is always - class Point_it - : public boost::iterator_adaptor< - Point_it - , typename Vertex_list::all_iterator - , const Point& - > + class Point_it : public boost::stl_interfaces::iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Point_it, +#endif + std::bidirectional_iterator_tag, + const Point> { - public: - Point_it() : Point_it::iterator_adaptor_() {} - Point_it(typename Vertex_list::all_iterator it) : Point_it::iterator_adaptor_(it) {} +public: + using Self = Point_it; + using Base = boost::stl_interfaces::iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Point_it, +#endif + std::bidirectional_iterator_tag, + const Point>; + using Base_it = typename Vertex_list::all_iterator; + + Base_it base() const { return it; } + Base_it& base_reference() { return it; } + const Base_it& base_reference() const { return it; } + + Point_it() = default; + Point_it(Base_it it) : it(it) {} + + const Point& operator*() const { return base()->point(); } + + Self& operator++() { ++it; return *this; } + Self operator++(int i) { return static_cast(Base::operator++(i)); } + + Self& operator--() { --it; return *this; } + Self operator--(int i) { return static_cast(Base::operator--(i)); } + private: - friend class boost::iterator_core_access; - const Point& dereference() const { return this->base()->point(); } + friend bool operator==(const Self& lhs, const Self& rhs) { + return lhs.base() == rhs.base(); + } + friend bool operator==(const Self& lhs, const Base_it& rhs) { + return lhs.base() == rhs; + } + friend bool operator==(const Base_it& lhs, const Self& rhs) { + return lhs == rhs.base(); + } + Base_it it; }; + BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(Point_it, std::bidirectional_iterator); +#if BOOST_VERSION >= 108300 + BOOST_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS(Point_it, std::bidirectional_iterator_tag, + std::bidirectional_iterator, Point, const Point&, const Point*, std::ptrdiff_t); +#endif + // only nodes with a vertex_handle that is still in the triangulation - class Vertex_it - : public boost::iterator_adaptor< - Vertex_it - , typename Vertex_list::skip_iterator - , Vertex_handle - , std::bidirectional_iterator_tag - , Vertex_handle> + class Vertex_it : public boost::stl_interfaces::iterator_interface< + #if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Vertex_it, + #endif + std::bidirectional_iterator_tag, + const Vertex_handle> { public: - Vertex_it() : Vertex_it::iterator_adaptor_() {} - Vertex_it(typename Vertex_list::skip_iterator it) : Vertex_it::iterator_adaptor_(it) {} + using Self = Vertex_it; + using Base = boost::stl_interfaces::iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Vertex_it, +#endif + std::bidirectional_iterator_tag, + const Vertex_handle>; + using Base_it = typename Vertex_list::skip_iterator; + + Base_it base() const { return it; } + + Base_it& base_reference() { return it; } + const Base_it& base_reference() const { return it; } + + Vertex_it() = default; + Vertex_it(Base_it it) : it(it) { + [[maybe_unused]] Vertex_it itt; + static_assert(std::is_same_v); + } + + const Vertex_handle& operator*() const { return this->base()->vertex(); } + + Self& operator++() { ++it; return *this; } + Self operator++(int i) { return static_cast(Base::operator++(i)); } + + Self& operator--() { --it; return *this; } + Self operator--(int i) { return static_cast(Base::operator--(i)); } + operator Point_it() const { return Point_it(this->base()); } - bool& input() { return this->base()->input; } + + bool& input() { return this->base()->input(); } + const bool& input() const { return this->base()->input(); } private: - friend class boost::iterator_core_access; - Vertex_handle dereference() const { return this->base()->vertex(); } + friend bool operator==(const Self& lhs, const Self& rhs) { + return lhs.base() == rhs.base(); + } + friend bool operator==(const Self& lhs, const Base_it& rhs) { + return lhs.base() == rhs; + } + friend bool operator==(const Base_it& lhs, const Self& rhs) { + return lhs == rhs.base(); + } + Base_it it; + }; + BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(Vertex_it, std::bidirectional_iterator); +#if BOOST_VERSION >= 108300 + BOOST_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS(Vertex_it, std::bidirectional_iterator_tag, + std::bidirectional_iterator, Vertex_handle, const Vertex_handle&, const Vertex_handle*, std::ptrdiff_t); +#endif + struct Vertex_list_with_info { + const Polyline_constraint_hierarchy_2* hierarchy_ptr = nullptr; + Vertex_list vl{}; + bool may_share_subconstraint_with_others = false; }; - typedef typename Constraint_list::iterator Constraint_it; + class Constraint_id + { + Vertex_list_with_info* vl_with_info_ptr = nullptr; + size_type id = (std::numeric_limits::max)(); + public: + Constraint_id(std::nullptr_t = nullptr) {} + Constraint_id(Vertex_list_with_info* ptr, size_type id) : vl_with_info_ptr(ptr), id(id) {} - struct Constraint_id { - Vertex_list* second; - - Constraint_id(): second(nullptr) {} - - Constraint_id(Vertex_list* vl) - : second(vl) - {} - - Vertex_list* vl_ptr() const {return second;} - - operator std::pair,Vertex_list*>() - { - if (second!=nullptr){ - return std::make_pair(std::make_pair(second->front().vertex(), - second->back().vertex()),second); + void destroy() { + if(vl_with_info_ptr != nullptr) { + delete vl_with_info_ptr; + (*this) = nullptr; } - return std::make_pair(std::make_pair(Vertex_handle(),Vertex_handle()),second); } - bool operator == (const Constraint_id& other) const - { - return second == other.second; - } - bool operator != (const Constraint_id& other) const - { - return second != other.second; + auto index() const { return id; } + + Vertex_list_ptr vl_ptr() const { + return vl_with_info_ptr == nullptr ? nullptr : std::addressof(vl_with_info_ptr->vl); } - bool operator<(const Constraint_id& other) const{ - return second < other.second; + bool may_share() const { return vl_with_info_ptr->may_share_subconstraint_with_others; } + bool& may_share() { return vl_with_info_ptr->may_share_subconstraint_with_others; } + + operator std::pair() const { + Subconstraint subconstraint = vl_with_info_ptr == nullptr + ? Subconstraint() + : Subconstraint(vl_ptr()->front().vertex(), vl_ptr()->back().vertex()); + return {subconstraint, vl_ptr()}; } - }; + + bool same_hierarchy(const Constraint_id& other) const { + return vl_with_info_ptr == nullptr || other.vl_with_info_ptr == nullptr || + vl_with_info_ptr->hierarchy_ptr == other.vl_with_info_ptr->hierarchy_ptr; + } + + Constraint_id& operator=(std::nullptr_t) { + *this = Constraint_id{}; + return *this; + } + bool operator==(std::nullptr_t n) const { return vl_with_info_ptr == n; } + bool operator!=(std::nullptr_t n) const { return vl_with_info_ptr != n; } + + bool operator==(const Constraint_id& other) const + { + CGAL_assertion(same_hierarchy(other)); + CGAL_assertion((vl_ptr() == other.vl_ptr()) == (index() == other.index())); + return vl_ptr() == other.vl_ptr(); + } + + bool operator!=(const Constraint_id& other) const + { + CGAL_assertion(same_hierarchy(other)); + CGAL_assertion((vl_ptr() == other.vl_ptr()) == (index() == other.index())); + return vl_ptr() != other.vl_ptr(); + } + + bool operator<(const Constraint_id& other) const + { + CGAL_assertion(same_hierarchy(other)); + CGAL_assertion((vl_ptr() == other.vl_ptr()) == (index() == other.index())); + return index() < other.index(); + } + + // forward a new Vertex_list operations + decltype(auto) begin() const { return vl_ptr()->skip_begin(); } + decltype(auto) end() const { return vl_ptr()->skip_end(); } + decltype(auto) elements() const { return vl_ptr()->skip_elements(); } + decltype(auto) clear() const { return vl_ptr()->clear(); } + decltype(auto) size() const { return vl_ptr()->skip_size(); } + decltype(auto) front() const { return vl_ptr()->front(); } + decltype(auto) back() const { return vl_ptr()->back(); } + + }; // end Constraint_id class Pair_compare { Compare comp; @@ -140,11 +278,11 @@ public: public: Pair_compare(const Compare& comp) : comp(comp) {} - bool operator()(const Edge& e1, const Edge& e2) const { - if(comp(e1.first, e2.first)) { + bool operator()(const Subconstraint& sc1, const Subconstraint& sc2) const { + if(comp(sc1.first, sc2.first)) { return true; - } else if((! comp(e2.first, e1.first)) && // !less(e1,e2) && !less(e2,e1) == equal - comp(e1.second, e2.second)) { + } else if((! comp(sc2.first, sc1.first)) && // !less(sc1,sc2) && !less(sc2,sc1) == equal + comp(sc1.second, sc2.second)) { return true; } else { return false; @@ -155,55 +293,262 @@ public: class Context { friend class Polyline_constraint_hierarchy_2; private: - Vertex_list* enclosing; - Vertex_it pos; + Constraint_id enclosing = nullptr; + Vertex_it pos{}; public: - Context() : enclosing(nullptr) {} + Context() = default; + Context(Constraint_id enclosing, Vertex_it pos) : enclosing(enclosing), pos(pos) {} + Context(Constraint_id enclosing, typename Vertex_list::skip_iterator pos) : enclosing(enclosing), pos(pos) {} - Vertex_it vertices_begin()const { return enclosing->skip_begin();} + Vertex_it vertices_begin()const { return enclosing.begin();} Vertex_it current()const {return pos;} - Vertex_it vertices_end()const {return enclosing->skip_end();} + Vertex_it vertices_end()const {return enclosing.end();} Constraint_id id()const { return enclosing; } - std::size_t number_of_vertices() const {return enclosing->skip_size(); } + size_type number_of_vertices() const {return enclosing.size(); } }; - typedef std::list Context_list; - typedef typename Context_list::iterator Context_iterator; + using Context_list = std::list; + using Context_iterator = typename Context_list::iterator; - typedef std::set Constraint_set; - typedef std::map Sc_to_c_map; - typedef typename Constraint_set::iterator C_iterator; - typedef typename Sc_to_c_map::const_iterator Sc_iterator; - typedef Sc_iterator Subconstraint_iterator; + static void fix_may_share_in_contexts_constraints(Context_list& context_list) { + const auto cl_size = context_list.size(); + switch(cl_size) { + case 0: + CGAL_unreachable(); + case 1: + return; + default: + for(auto& context : context_list) { + CGAL_assertion(context.enclosing != nullptr); + context.enclosing.may_share() = true; + } + } + } + + using Constraints_set = std::set; +#if CGAL_USE_BARE_STD_MAP + using Sc_to_c_map = std::map; +#else + using Sc_to_c_map = CGAL::unordered_flat_map>; +#endif + using Constraint_iterator = typename Constraints_set::iterator; + using Constraints = const Constraints_set&; + using Sc_iterator = typename Sc_to_c_map::const_iterator; + using Sc_it = typename Sc_to_c_map::iterator; + using Subconstraint_and_contexts_iterator = Sc_iterator; + using Subconstraints_and_contexts = const Sc_to_c_map&; + + class Subconstraint_iterator : public boost::stl_interfaces::proxy_iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Subconstraint_iterator, +#endif + std::bidirectional_iterator_tag, + Subconstraint> + { + using base_type = boost::stl_interfaces::proxy_iterator_interface< +#if !BOOST_STL_INTERFACES_USE_DEDUCED_THIS + Subconstraint_iterator, +#endif + std::bidirectional_iterator_tag, + Subconstraint>; + + const Polyline_constraint_hierarchy_2* hierarchy = nullptr; + Constraint_iterator constraint_it{}; + Vertex_it vertex_it{}; + + public: + // - The object is singular if and only if `hierarchy==nullptr`. + // + // - The end value is when `constraint_it` is the end iterator of `constraints_set`. + // In that case `vertex_it` must be singular. + // + // - Otherwise all members must be valid pointers or dereferenceable iterators. + + bool is_singular() const { + return hierarchy == nullptr; + } + + bool is_valid() const { + return (hierarchy != nullptr); + } + + bool is_end() const { + return constraint_it == hierarchy->constraints_end(); + } + + bool is_begin() const { + return constraint_it == hierarchy->constraints_begin() && + vertex_it == begin_or_null(constraint_it); + } + + bool is_dereferenceable() const { + return is_valid() && + constraint_it != hierarchy->constraints_end() && + vertex_it != constraint_it->end() && + std::next(vertex_it) != constraint_it->end(); + } + + bool equal(const Subconstraint_iterator& other) const { + if(hierarchy != other.hierarchy) return false; + if(is_singular()) return true; + + return (constraint_it == other.constraint_it) && (this->is_end() == other.is_end()); + } + + Vertex_it begin_or_null(Constraint_iterator constraint_it) const { + if(constraint_it == hierarchy->constraints_end()) { + return Vertex_it(); + } + return constraint_it->begin(); + } + + bool already_seen() const { + if(is_end()) { + return false; + } + if(false == constraint_it->may_share()) { + return false; + } + auto [va, vb] = this->operator*(); + auto it = hierarchy->find_contexts(va, vb); + CGAL_assertion(it != hierarchy->contexts_not_found()); + + const Context_list& ctx_list = *it->second; + + const Context& ctx = ctx_list.front(); + // if this context does not correspond to *this, return true + + if(ctx.enclosing != *constraint_it) { + return true; + } + + return (ctx.pos != vertex_it && ctx.pos != std::next(vertex_it)); + } + + static auto non_null(const Polyline_constraint_hierarchy_2* hierarchy) { + CGAL_precondition(hierarchy != nullptr); + return hierarchy; + } + + public: + Subconstraint_iterator() = default; + + // Constructors for begin and end. The constructors are public, but only the + // hierarchy can create an iterator of this class, through its friendship of + // the nested class `Construction_access`: Construction_access::begin_tag() and + // Construction_access::end_tag(). + class Construction_access + { + private: + friend class Subconstraint_iterator; + friend class Polyline_constraint_hierarchy_2; + + static auto begin_tag() { return Begin_tag(); } + static auto end_tag() { return End_tag(); } + + struct Begin_tag + {}; + struct End_tag + {}; + }; + // + // constructor for the begin iterator + explicit Subconstraint_iterator(typename Construction_access::Begin_tag, + const Polyline_constraint_hierarchy_2* hierarchy) + : hierarchy(non_null(hierarchy)) + , constraint_it(hierarchy->constraints_begin()) + , vertex_it(begin_or_null(hierarchy->constraints_begin())) + { + if(already_seen()) { + ++(*this); + } + } + // + // constructor for the end iterator + explicit Subconstraint_iterator(typename Construction_access::End_tag, + const Polyline_constraint_hierarchy_2* hierarchy) + : hierarchy(non_null(hierarchy)) + , constraint_it(hierarchy->constraints_end()) + , vertex_it() {} + + Subconstraint operator*() const { + CGAL_precondition(is_dereferenceable()); + return Subconstraint(*vertex_it, *std::next(vertex_it)); + } + + friend bool operator==(const Subconstraint_iterator& lhs, const Subconstraint_iterator& rhs) { + return lhs.equal(rhs); + } + + using base_type::operator++; + Subconstraint_iterator& operator++() { + CGAL_precondition(is_valid() && false == is_end()); + + do { + ++vertex_it; + CGAL_assertion(vertex_it != constraint_it->end()); + + if(std::next(vertex_it) == constraint_it->end()) { + ++constraint_it; + vertex_it = begin_or_null(constraint_it); + } + } while(already_seen()); + return *this; + } + + using base_type::operator--; + Subconstraint_iterator& operator--() { + CGAL_precondition(is_valid() && false == is_begin()); + + do { + if(constraint_it == hierarchy->constraints_end() || vertex_it == constraint_it->begin()) { + --constraint_it; + vertex_it = std::prev(constraint_it->end(), 2); + } else { + --vertex_it; + } + } while(already_seen()); + return *this; + } + }; // end class Subconstraint_iterator + using Subconstraints = Iterator_range; private: - // data for the 1d hierarchy - Compare comp; - Constraint_set constraint_set; - Sc_to_c_map sc_to_c_map; - -public: - Polyline_constraint_hierarchy_2(const Compare& comp) + struct Priv { // encapsulate the private members in a struct, to detect direct access to them + Priv(Compare comp) : comp(comp) + #if CGAL_USE_BARE_STD_MAP , sc_to_c_map(Pair_compare(comp)) - { } - Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); +#else + , sc_to_c_map() +#endif + {} + + Compare comp; + Sc_to_c_map sc_to_c_map; + std::queue free_ids; + Constraints_set constraints_set; + } priv; +public: + Polyline_constraint_hierarchy_2(const Compare& comp) : priv(comp) {} + Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch) : priv(ch.priv.comp) {} Polyline_constraint_hierarchy_2(Polyline_constraint_hierarchy_2&&) = default; + ~Polyline_constraint_hierarchy_2(){ clear();} void clear(); - Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch); + + Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch) { return copy(ch); } Polyline_constraint_hierarchy_2& operator=(Polyline_constraint_hierarchy_2&& ch) = default; // Query - bool is_subconstrained_edge(T va, T vb) const; - bool is_constrained_edge(T va, T vb) const; - bool is_constrained_vertex(T v) const; + bool is_subconstraint(T va, T vb) const; Vertex_it vertices_in_constraint_begin(Constraint_id cid) const - { return cid.vl_ptr()->skip_begin(); } + { return cid.begin(); } Vertex_it vertices_in_constraint_end(Constraint_id cid) const - { return cid.vl_ptr()->skip_end(); } + { return cid.end(); } + auto vertices_in_constraint(Constraint_id cid) const + { return Iterator_range(cid.begin(), cid.end()); } Point_it points_in_constraint_begin(Constraint_id cid) const @@ -211,211 +556,260 @@ public: Point_it points_in_constraint_end(Constraint_id cid) const { return cid.vl_ptr()->all_end(); } - bool enclosing_constraint(Edge he, Constraint& hc) const; - bool enclosing_constraint(T vaa, T vbb, T& va, T& vb) const; - bool enclosing_constraints(T vaa, T vbb, Constraint_list& hcl) const; - bool next_along_sc(T va, T vb, T& w) const; - void oriented_end(T va, T vb, T& vc) const; + std::array enclosing_constraint(T vaa, T vbb) const; Context context(T va, T vb); - std::size_t number_of_enclosing_constraints(T va, T vb) const; + size_type number_of_enclosing_constraints(T va, T vb) const; Context_iterator contexts_begin(T va, T vb) const; Context_iterator contexts_end(T va, T vb) const; - Iterator_range contexts_range(T va, T vb) const; - std::size_t number_of_constraints() const { return constraint_set.size();} - std::size_t number_of_subconstraints()const {return sc_to_c_map.size();} + using Contexts = Iterator_range; + Contexts contexts(T va, T vb) const; + Context_list* get_context_list(T va, T vb) const; + size_type number_of_constraints() const { return priv.constraints_set.size(); } + size_type number_of_subconstraints() const { return priv.sc_to_c_map.size(); } // insert/remove - void add_Steiner(T va, T vb, T vx); - Vertex_list* insert_constraint_old_API(T va, T vb); - Vertex_list* insert_constraint(T va, T vb); + void add_Steiner(const T va, const T vb, const T vx); + Constraint_id insert_constraint_old_API(T va, T vb); + Constraint_id insert_constraint(T va, T vb); void append_constraint(Constraint_id cid, T va, T vb); void swap(Constraint_id first, Constraint_id second); void remove_constraint(Constraint_id cid); void split_constraint(T va, T vb, T vc); - void simplify(Vertex_it u, - Vertex_it v, - Vertex_it w); + void simplify(Vertex_it u, Vertex_it v, Vertex_it w); - std::size_t remove_points_without_corresponding_vertex(Constraint_id); - std::size_t remove_points_without_corresponding_vertex(); + size_type remove_points_without_corresponding_vertex(Constraint_id); + size_type remove_points_without_corresponding_vertex(); - Constraint_id concatenate(Constraint_id first, Constraint_id second); - Constraint_id concatenate2(Constraint_id first, Constraint_id second); - Constraint_id split(Constraint_id first, Vertex_it vcit); - Constraint_id split2(Constraint_id first, Vertex_it vcit); - - void remove_Steiner(T v, T va, T vb); + Constraint_id concatenate(Constraint_id first, Constraint_id&& second); + Constraint_id prepend(Constraint_id&& first, Constraint_id second); + Constraint_id split_tail(Constraint_id first, Vertex_it vcit); + Constraint_id split_head(Constraint_id first, Vertex_it vcit); // iterators - Subconstraint_iterator subconstraint_begin() const + Subconstraint_and_contexts_iterator subconstraints_and_contexts_begin() const { - return sc_to_c_map.begin(); + return priv.sc_to_c_map.begin(); } - Subconstraint_iterator subconstraint_end() const + Subconstraint_and_contexts_iterator subconstraints_and_contexts_end() const { - return sc_to_c_map.end(); + return priv.sc_to_c_map.end(); } - Sc_iterator sc_begin() const{ return sc_to_c_map.begin(); } - Sc_iterator sc_end() const{ return sc_to_c_map.end(); } - C_iterator c_begin() const{ return constraint_set.begin(); } - C_iterator c_end() const{ return constraint_set.end(); } + Subconstraint_iterator subconstraints_begin() const { + BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(Subconstraint_iterator, std::bidirectional_iterator); +#if BOOST_VERSION >= 108300 + BOOST_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS( + Subconstraint_iterator, std::bidirectional_iterator_tag, std::bidirectional_iterator, + Subconstraint, Subconstraint, typename Subconstraint_iterator::pointer, std::ptrdiff_t); +#endif + return Subconstraint_iterator(Subconstraint_iterator::Construction_access::begin_tag(), + this); + } + + Subconstraint_iterator subconstraints_end() const { + return Subconstraint_iterator(Subconstraint_iterator::Construction_access::end_tag(), + this); + } + + Constraint_iterator constraints_begin() const{ return priv.constraints_set.begin(); } + Constraint_iterator constraints_end() const{ return priv.constraints_set.end(); } + + // Ranges + const auto& constraints() const { return priv.constraints_set; } + const auto& subconstraints_and_contexts() const { return priv.sc_to_c_map; } + auto subconstraints() const { + return Iterator_range(subconstraints_begin(), subconstraints_end()); + } // Helper functions - void copy(const Polyline_constraint_hierarchy_2& ch); - void copy(const Polyline_constraint_hierarchy_2& ch, std::map& vmap); + Polyline_constraint_hierarchy_2& copy(const Polyline_constraint_hierarchy_2& ch); + Polyline_constraint_hierarchy_2& copy(const Polyline_constraint_hierarchy_2& ch, + std::map& vmap); void swap(Polyline_constraint_hierarchy_2& ch); private: - Edge make_edge(T va, T vb) const; - Vertex_it get_pos(T va, T vb) const; - bool get_contexts(T va, T vb, - Context_iterator& ctxt, - Context_iterator& past) const; + // a few member functions to encapsulate more of the uses of `sc_to_c_map` + auto find_contexts(Vertex_handle va, Vertex_handle vb) { return priv.sc_to_c_map.find(sorted_pair(va, vb)); } + auto find_contexts(Vertex_handle va, Vertex_handle vb) const { return priv.sc_to_c_map.find(sorted_pair(va, vb)); } + auto contexts_not_found() { return priv.sc_to_c_map.end(); } + auto contexts_not_found() const { return priv.sc_to_c_map.end(); } + void erase_context(Sc_iterator it) { priv.sc_to_c_map.erase(it); } + auto& contexts_of(Vertex_handle va, Vertex_handle vb) { return priv.sc_to_c_map[sorted_pair(va, vb)]; } + // + // then the uses of `constraints_set` + Constraint_id create_new_constraint() { + size_type id; // uninitialized + if(priv.free_ids.empty()) { + id = priv.constraints_set.size(); + } else { + id = priv.free_ids.front(); + priv.free_ids.pop(); + } + Constraint_id cid{new Vertex_list_with_info{this}, id}; + priv.constraints_set.insert(cid); + return cid; + } - bool get_contexts(T va, T vb, Context_list*&) const; + void erase_constraint(Constraint_id cid) { + priv.free_ids.push(cid.index()); + priv.constraints_set.erase(cid); + cid.destroy(); + } + + // + // functions to traverse and act on the context lists + // + template + void for_context_lists_of_all_subconstraints(Constraint_id cid, const F& f) + { + auto vl = cid.vl_ptr(); + for(Vertex_it it = vl->skip_begin(), succ = it, end = vl->skip_end(); ++succ != end; ++it) { + auto scit = find_contexts(*it, *succ); + CGAL_assertion(scit != contexts_not_found()); + Context_list* hcl = scit->second; + f(hcl, it, scit); + } + } + // + static void replace_first_in_context_list(Context_list* hcl, Constraint_id old_id, Constraint_id new_id) + { + // std::find_if is a sort of std::for_each with a break when the lambda returns true + [[maybe_unused]] auto it = std::find_if(hcl->begin(), hcl->end(), [&](Context& ctxt) { + if(ctxt.enclosing == old_id) { + ctxt.enclosing = new_id; + return true; + } + return false; + }); + } + // + static void update_first_context_position(Context_list* hcl, Constraint_id id, Vertex_it new_pos) + { + [[maybe_unused]] auto it = std::find_if(hcl->begin(), hcl->end(), [&](Context& ctxt) { + if(ctxt.enclosing == id) { + ctxt.pos = new_pos; + return true; + } + return false; + }); + } + // + static void remove_first_in_context_list(Context_list* hcl, Constraint_id id) + { + auto it = std::find_if(hcl->begin(), hcl->end(), [&](Context& ctxt) { + return ctxt.enclosing == id; + }); + if(it != hcl->end()) { + hcl->erase(it); + } + } + + // + // other utilities as private member functions + // + Subconstraint sorted_pair(T va, T vb) const { + return priv.comp(va, vb) ? Subconstraint(va,vb) : Subconstraint(vb,va); + } + Subconstraint sorted_pair(Subconstraint sc) { + const auto& [va, vb] = sc; return sorted_pair(va, vb); + } - //to_debug public: - void print() const; + //to_debug + void print(std::ostream& os = std::cout) const; }; template -Polyline_constraint_hierarchy_2:: -Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch) - : comp(ch.comp) - , sc_to_c_map(Pair_compare(comp)) +auto Polyline_constraint_hierarchy_2:: +copy(const Polyline_constraint_hierarchy_2& other) -> Polyline_constraint_hierarchy_2& { - copy(ch); + // create a identity transfer vertex map + std::map vmap; + for(const auto& cid : other.constraints()) { + for(const auto& node : cid.elements()) { + auto v = node.vertex(); + vmap[v] = v; + } + } + return copy(other, vmap); } template -Polyline_constraint_hierarchy_2& -Polyline_constraint_hierarchy_2:: -operator=(const Polyline_constraint_hierarchy_2& ch){ - copy(ch); +auto Polyline_constraint_hierarchy_2:: +copy(const Polyline_constraint_hierarchy_2& other, std::map& vmap) + -> Polyline_constraint_hierarchy_2& +// copy with a transfer vertex map +{ + std::map cstr_map; + clear(); + // copy constraints_set + for(const auto& cid1: other.constraints()) { + Constraint_id cid2 = create_new_constraint(); + cstr_map[cid1] = cid2; + for(const auto& node : cid1.elements()) { + cid2.vl_ptr()->push_back(Node(vmap[node.vertex()], node.input())); + } + cid2.may_share() = cid1.may_share(); + } + // copy sc_to_c_map + for(const auto& [sc1, hcl1] : other.subconstraints_and_contexts()) { + Vertex_handle uu2 = vmap[sc1.first]; + Vertex_handle vv2 = vmap[sc1.second]; + Context_list* hcl2 = new Context_list; + contexts_of(uu2, vv2) = hcl2; + for(const auto& ctxt : *hcl1) { + const auto cid1 = ctxt.id(); + const auto pos1 = ctxt.current(); + // vertices of the enclosing constraints + Constraint_id cid2 = cstr_map[cid1]; + auto pos2 = std::next(Vertex_it(cid2.begin()), + std::distance(Vertex_it(cid1.begin()), pos1)); + hcl2->emplace_back(cid2, pos2); + } + } + + priv.comp = other.priv.comp; return *this; } -template -void -Polyline_constraint_hierarchy_2:: -copy(const Polyline_constraint_hierarchy_2& ch1) -{ - // create a identity transfer vertex map - std::map vmap; - C_iterator cit1 = ch1.c_begin(); - for( ; cit1 != ch1.c_end(); ++cit1) { - Vertex_it vit = cit1->second->begin(); - for( ; vit != cit1->second->end(); ++vit) { - vmap[*vit] = *vit; - } - } - copy(ch1, vmap); -} - -template -void -Polyline_constraint_hierarchy_2:: -copy(const Polyline_constraint_hierarchy_2& ch1, std::map& vmap) - // copy with a transfer vertex map -{ - std::map vlmap; - clear(); - // copy constraint_set - C_iterator cit1 = ch1.c_begin(); - for( ; cit1 != ch1.c_end(); ++cit1) { - Vertex_list* hvl1 = cit1->vl_ptr(); - Vertex_list* hvl2 = new Vertex_list; - vlmap[hvl1] = hvl2; - Vertex_it vit = hvl1->skip_begin(), end = hvl1->skip_end(); - for( ; vit != end; ++vit) hvl2->push_back(Node(vmap[*vit], vit.input())); - constraint_set.insert(hvl2); - } - // copy sc_to_c_map - Sc_iterator scit1 = ch1.sc_begin(); - for( ; scit1 != ch1.sc_end(); ++scit1) { - //vertices of the subconstraints - Vertex_handle uu2 = vmap[scit1->first.first]; - Vertex_handle vv2 = vmap[scit1->first.second]; - Context_list* hcl1 = scit1->second; - Context_list* hcl2 = new Context_list; - Context_iterator cit1 = hcl1->begin(); - for( ; cit1 != hcl1->end(); ++cit1){ - // vertices of the enclosing constraints - Context ctxt2; - ctxt2.enclosing = vlmap[cit1->enclosing]; - ctxt2.pos = ctxt2.enclosing->skip_begin(); - Vertex_it aux = cit1->enclosing->skip_begin(); - while( aux != cit1->pos) { - ++aux; - ++ctxt2.pos; - } - hcl2->push_back(ctxt2); - } - sc_to_c_map[make_edge(uu2,vv2)] = hcl2; - } - - comp = ch1.comp; - return; -} - - template void Polyline_constraint_hierarchy_2:: swap(Polyline_constraint_hierarchy_2& ch) { - constraint_set.swap(ch.constraint_set); - sc_to_c_map.swap(ch.sc_to_c_map); + using std::swap; + swap(priv.comp, ch.priv.comp); + priv.free_ids.swap(ch.priv.free_ids); + priv.constraints_set.swap(ch.priv.constraints_set); + priv.sc_to_c_map.swap(ch.priv.sc_to_c_map); } -/* template bool Polyline_constraint_hierarchy_2:: -is_constrained_edge(T va, T vb) const +is_subconstraint(T va, T vb) const { - return( c_to_sc_map.find(make_edge(va, vb)) != c_to_sc_map.end() ); -} -*/ - -template -bool Polyline_constraint_hierarchy_2:: -is_subconstrained_edge(T va, T vb) const -{ - return( sc_to_c_map.find(make_edge(va, vb)) != sc_to_c_map.end() ); -} - - -// af: obsolete -template -bool Polyline_constraint_hierarchy_2:: -enclosing_constraint(Edge he, Constraint& hc) const -{ - Context_iterator hcit, past; - if ( !get_contexts(he.first,he.second, hcit ,past)) return false; - hc = make_edge(hcit->enclosing->front(), hcit->enclosing->back()); - return true; + return( find_contexts(va, vb) != contexts_not_found() ); } // used by Constrained_triangulation_plus_2::intersect with Exact_intersection_tag template -bool Polyline_constraint_hierarchy_2:: -enclosing_constraint(T vaa, T vbb, T& va, T& vb) const +auto Polyline_constraint_hierarchy_2:: +enclosing_constraint(T vaa, T vbb) const -> std::array { - Context_iterator hcit, past; - if ( !get_contexts(vaa,vbb, hcit ,past)) return false; - // va = hcit->enclosing->front().vertex(); - // vb = hcit->enclosing->back().vertex(); - // Vertex_list* vl = hcit->enclosing; + std::array result; + auto [hcit, past] = contexts(vaa, vbb); + if (hcit == past) return result; + // va = hcit->enclosing.front().vertex(); + // vb = hcit->enclosing.back().vertex(); + // Vertex_list_ptr vl = hcit->enclosing; Vertex_it pos = hcit->pos; if(vaa != *pos){ std::swap(vaa,vbb); @@ -423,168 +817,85 @@ enclosing_constraint(T vaa, T vbb, T& va, T& vb) const while(!pos.input()){ --pos; } - va = *pos; - pos = hcit->pos; - ++pos; + result[0] = *pos; + pos = std::next(hcit->pos); CGAL_assertion(vbb == *pos); while(!pos.input()){ ++pos; } - vb = *pos; - return true; -} - -// af: obsolete -template -bool Polyline_constraint_hierarchy_2:: -enclosing_constraints(T vaa, T vbb , Constraint_list& hcl) const -{ - Context_iterator hcit, past; - if ( !get_contexts(vaa,vbb, hcit ,past)) return false; - for (; hcit!=past; hcit++) { - hcl.push_back(make_edge(hcit->enclosing->front(), - hcit->enclosing->back())); - } - return true; + result[1] = *pos; + return result; } template -typename Polyline_constraint_hierarchy_2::Context -Polyline_constraint_hierarchy_2:: -context(T va, T vb) +auto Polyline_constraint_hierarchy_2:: +context(T va, T vb) -> Context { - Context_iterator hcit, past; - if(!get_contexts(va,vb, hcit ,past)) CGAL_assertion(false); + auto [hcit, past] = contexts(va, vb); + CGAL_assertion(hcit != past); CGAL_USE(past); return *hcit; } template -std::size_t -Polyline_constraint_hierarchy_2:: -number_of_enclosing_constraints(T va, T vb) const +auto Polyline_constraint_hierarchy_2:: +number_of_enclosing_constraints(T va, T vb) const -> size_type { - Context_list* hcl = nullptr; - CGAL_assertion_code( bool found = ) get_contexts(va,vb,hcl); - CGAL_assertion(found); + Context_list* hcl = get_context_list(va,vb); + CGAL_assertion(nullptr != hcl); return hcl->size(); } template -typename Polyline_constraint_hierarchy_2::Context_iterator -Polyline_constraint_hierarchy_2:: -contexts_begin(T va, T vb) const +auto Polyline_constraint_hierarchy_2:: +contexts_begin(T va, T vb) const -> Context_iterator { - Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); - return first; + return contexts(va, vb).begin(); } template -typename Polyline_constraint_hierarchy_2::Context_iterator -Polyline_constraint_hierarchy_2:: -contexts_end(T va, T vb) const +auto Polyline_constraint_hierarchy_2:: +contexts_end(T va, T vb) const -> Context_iterator { - Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); - return last; -} - -template -auto -Polyline_constraint_hierarchy_2:: -contexts_range(T va, T vb) const -> Iterator_range { - Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) return { first, first }; - else return { first, last }; + return contexts(va, vb).end(); } template void Polyline_constraint_hierarchy_2:: -swap(Constraint_id first, Constraint_id second){ - // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; +swap(Constraint_id constr_a, Constraint_id constr_b) { + auto substitute_enclosing_in_vertex_list = [this](Constraint_id cid, Constraint_id old_id, Constraint_id new_id) { + for_context_lists_of_all_subconstraints(cid, [&](Context_list* hcl, Vertex_it, Sc_it) { + replace_first_in_context_list(hcl, old_id, new_id); + }); + }; - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = nullptr; - break; - } - } - } - // We have to look at all subconstraints - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + substitute_enclosing_in_vertex_list(constr_a, constr_a, nullptr); + substitute_enclosing_in_vertex_list(constr_b, constr_b, constr_a); + substitute_enclosing_in_vertex_list(constr_a, nullptr, constr_b); - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == second.vl_ptr()){ - ctit->enclosing = first.vl_ptr(); - break; - } - } - } - // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; - - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == nullptr){ - ctit->enclosing = second.vl_ptr(); - break; - } - } - } - first.vl_ptr()->swap(*second.vl_ptr()); + constr_a.vl_ptr()->swap(*constr_b.vl_ptr()); + std::swap(constr_a.may_share(), constr_b.may_share()); } - template void Polyline_constraint_hierarchy_2:: -remove_constraint(Constraint_id cid){ - constraint_set.erase(cid); +remove_constraint(Constraint_id cid) +{ + for_context_lists_of_all_subconstraints(cid, [&](Context_list* hcl, Vertex_it, Sc_it scit) { + remove_first_in_context_list(hcl, cid); - // We have to look at all subconstraints - for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; - - // and remove the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == cid.vl_ptr()){ - hcl->erase(ctit); - break; - } - } // If the constraint passes several times through the same subconstraint, - // the above loop maybe removes them in the wrong order + // the above call to `remove_first_in_context_list` may remove them in the wrong order. // If this was the only context in the list, delete the context list - if(hcl->empty()){ - sc_to_c_map.erase(scit); + if(hcl->empty()) { + erase_context(scit); delete hcl; } - } - delete cid.vl_ptr(); + }); + + erase_constraint(cid); } @@ -593,14 +904,13 @@ remove_constraint(Constraint_id cid){ // and for the case that the constrained edge u,w has no intersections template void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, - Vertex_it vc, - Vertex_it wc) - + Vertex_it vc, + Vertex_it wc) { // TODO: How do we (want to) deal with u == w ??? Vertex_handle u = *uc, v = *vc, w = *wc; - typename Sc_to_c_map::iterator uv_sc_iter = sc_to_c_map.find(make_edge(u, v)); - typename Sc_to_c_map::iterator vw_sc_iter = sc_to_c_map.find(make_edge(v, w)); + typename Sc_to_c_map::iterator uv_sc_iter = find_contexts(u, v); + typename Sc_to_c_map::iterator vw_sc_iter = find_contexts(v, w); Context_list* uv_hcl = uv_sc_iter->second; Context_list* vw_hcl = vw_sc_iter->second; // AF: what is input() about??? @@ -620,7 +930,7 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, it = uv_hcl->erase(it); }else{ // Remove the list item which points to v - Vertex_list* vertex_list = it->id().vl_ptr(); + Vertex_list_ptr vertex_list = it->id().vl_ptr(); Vertex_it vc_in_context = it->current(); vc_in_context = std::next(vc_in_context); vertex_list->skip(vc_in_context.base()); @@ -633,7 +943,7 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, it = vw_hcl->erase(it); }else{ // Remove the list item which points to v - Vertex_list* vertex_list = it->id().vl_ptr(); + Vertex_list_ptr vertex_list = it->id().vl_ptr(); Vertex_it vc_in_context = it->current(); vc_in_context = std::next(vc_in_context); vertex_list->skip(vc_in_context.base()); @@ -644,19 +954,19 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, uv_hcl->splice(uv_hcl->end(),*vw_hcl); delete vw_hcl; - sc_to_c_map.erase(uv_sc_iter); - sc_to_c_map.erase(vw_sc_iter); + erase_context(uv_sc_iter); + erase_context(vw_sc_iter); // reuse other context list - sc_to_c_map[make_edge(u,w)] = uv_hcl; + contexts_of(u,w) = uv_hcl; } template -std::size_t +typename Polyline_constraint_hierarchy_2::size_type Polyline_constraint_hierarchy_2::remove_points_without_corresponding_vertex(Constraint_id cid) { - std::size_t n = 0; + size_type n = 0; for(Point_it it = points_in_constraint_begin(cid); it != points_in_constraint_end(cid);) { if(cid.vl_ptr()->is_skipped(it.base())) { @@ -670,12 +980,12 @@ Polyline_constraint_hierarchy_2::remove_points_without_correspo } template -std::size_t +typename Polyline_constraint_hierarchy_2::size_type Polyline_constraint_hierarchy_2::remove_points_without_corresponding_vertex() { - std::size_t n = 0; - for(C_iterator it = constraint_set.begin(); it!= constraint_set.end(); ++it){ - n+= remove_points_without_corresponding_vertex(*it); + size_type n = 0; + for(const auto& cid : constraints()){ + n+= remove_points_without_corresponding_vertex(cid); } return n; } @@ -683,107 +993,82 @@ Polyline_constraint_hierarchy_2::remove_points_without_correspo template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::concatenate(Constraint_id first, Constraint_id second) +Polyline_constraint_hierarchy_2::concatenate(Constraint_id constr_a, Constraint_id&& constr_b) { - constraint_set.erase(first); - constraint_set.erase(second); - // We have to look at all subconstraints - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + if(constr_a == nullptr) { + swap(constr_a, constr_b); + }; + if(constr_b == nullptr) return constr_a; + + // constr_a is [A, ..., M] + // constr_b is [M, ..., B] + // we want: + // constr_a = [A, ..., M, ..., B] + // constr_b = [] + + // std::cerr << std::format("concatenate({}, {}) ", constr_a.id, constr_b.id) << std::endl; + Vertex_list_ptr constr_a_vl = constr_a.vl_ptr(); + Vertex_list_ptr constr_b_vl = constr_b.vl_ptr(); + + for_context_lists_of_all_subconstraints(constr_b, [&](Context_list* hcl, Vertex_it, Sc_it) { + replace_first_in_context_list(hcl, constr_b, constr_a); + }); - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == second.vl_ptr()){ - ctit->enclosing = first.vl_ptr(); - break; - } - } - } // now we really concatenate the vertex lists - // Note that all iterators pointing into second remain valid. + // Note that all iterators pointing into constr_a remain valid. // This concerns user code, as well as the data member "pos" of the Context class - first.vl_ptr()->pop_back(); // because it is the same as second.front() - Vertex_it back_it = first.vl_ptr()->skip_end(); - --back_it; - first.vl_ptr()->splice(first.vl_ptr()->skip_end(), *(second.vl_ptr()), second.vl_ptr()->skip_begin(), second.vl_ptr()->skip_end()); + CGAL_assertion(constr_a_vl->back().vertex() == constr_b_vl->front().vertex()); + constr_a_vl->pop_back(); // because it is the same as constr_b_vl.front() + constr_a_vl->splice(constr_a_vl->skip_end(), *constr_b_vl, constr_b_vl->skip_begin(), constr_b_vl->skip_end()); - // Note that for VC8 with iterator debugging the iterators pointing into second - // are NOT valid So we have to update them - for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + for_context_lists_of_all_subconstraints(constr_a, [&](Context_list* hcl, Vertex_it it, Sc_it) { + update_first_context_position(hcl, constr_a, it); + }); - // and update pos in the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->pos = it; - break; - } - } - } - constraint_set.insert(first); - - delete second.vl_ptr(); - return first; + if(constr_b.may_share()) { + constr_a.may_share() = true; + } + erase_constraint(constr_b); + return constr_a; } template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::concatenate2(Constraint_id first, Constraint_id second) +Polyline_constraint_hierarchy_2::prepend(Constraint_id&& constr_a, Constraint_id constr_b) { - constraint_set.erase(first); - constraint_set.erase(second); - // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + if(constr_b == nullptr) { + swap(constr_a, constr_b); + }; + if(constr_a == nullptr) return constr_b; + + // constr_a is [A, ..., M] + // constr_b is [M, ..., B] + // we want: + // constr_a = + // constr_b = [A, ..., M, ..., B] + + Vertex_list_ptr constr_a_vl = constr_a.vl_ptr(); + Vertex_list_ptr constr_b_vl = constr_b.vl_ptr(); + + for_context_lists_of_all_subconstraints(constr_a, [&](Context_list* hcl, Vertex_it, Sc_it) { // DIFF + replace_first_in_context_list(hcl, constr_a, constr_b); // DIFF + }); - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second.vl_ptr(); - break; - } - } - } // now we really concatenate the vertex lists - // Note that all iterators pointing into second remain valid. - first.vl_ptr()->pop_back(); // because it is the same as second.front() - Vertex_it back_it = second.vl_ptr()->skip_begin(); + // Note that all iterators pointing into constr_b remain valid. + CGAL_assertion(constr_a_vl->back().vertex() == constr_b_vl->front().vertex()); + constr_a_vl->pop_back(); // because it is the same as constr_b_vl.front() + constr_b_vl->splice(constr_b_vl->skip_begin(), *constr_a_vl, constr_a_vl->skip_begin(), constr_a_vl->skip_end()); // DIFF - second.vl_ptr()->splice(second.vl_ptr()->skip_begin(), *(first.vl_ptr()), first.vl_ptr()->skip_begin(), first.vl_ptr()->skip_end()); + for_context_lists_of_all_subconstraints(constr_b /*DIFF*/, [&](Context_list* hcl, Vertex_it it, Sc_it) { + update_first_context_position(hcl, constr_b, it); // DIFF + }); - // Note that for VC8 with iterator debugging the iterators pointing into second - // are NOT valid So we have to update them - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = back_it; - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; - - // and update pos in the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == second.vl_ptr()){ - ctit->pos = it; - break; - } - } + if(constr_a.may_share()) { + constr_b.may_share() = true; } - constraint_set.insert(second); - - delete first.vl_ptr(); - return second.vl_ptr(); + erase_constraint(constr_a); // DIFF + return constr_b; // DIFF } @@ -792,70 +1077,82 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir // returns the new constraint template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::split(Constraint_id first, Vertex_it vcit) +Polyline_constraint_hierarchy_2::split_tail(Constraint_id constr, Vertex_it vcit) { - constraint_set.erase(first); - Vertex_list* second = new Vertex_list; - second->splice(second->skip_end(), *(first.vl_ptr()), vcit.base(), first.vl_ptr()->skip_end()); - first.vl_ptr()->push_back(second->front()); // Duplicate the common vertex - Vertex_it vit = second->skip_begin(); - vit.input() = true; - vit = first.vl_ptr()->skip_end(); - --vit; - vit.input() = true; - constraint_set.insert(first); - constraint_set.insert(second); - // We have to look at all subconstraints - for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + // constr is [A, ..., B], vcit points to M in [A, ..., B] - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second; - break; - } + Constraint_id new_constr = create_new_constraint(); + + Vertex_list_ptr constr_vl = constr.vl_ptr(); + Vertex_list_ptr new_vl = new_constr.vl_ptr(); + + vcit.input() = true; + auto middle_node = Node(*vcit, true); + + // Let's split, that way: + // constr = [A, ..., M] + // new_constr = [M, ..., B] + + // The splice does: + // constr = [A, ..., M[ (without M) + // new_constr = [M, ..., B] + new_vl->splice(new_vl->skip_end(), *constr_vl, vcit.base(), constr_vl->skip_end()); + constr_vl->push_back(middle_node); // add M to the end of constr + + CGAL_assertion(vcit.base() == new_vl->skip_begin()); + CGAL_assertion(new_vl->front().input() == true); + CGAL_assertion(constr_vl->back().input() == true); + + bool new_constr_share = false; + for_context_lists_of_all_subconstraints(new_constr, [&](Context_list* hcl, Vertex_it, Sc_it) { + if(constr.may_share() && hcl->size() > 1) { + new_constr_share = true; } - } - return second; + replace_first_in_context_list(hcl, constr, new_constr); + }); + + new_constr.may_share() = new_constr_share; + return new_constr; } template typename Polyline_constraint_hierarchy_2::Constraint_id -Polyline_constraint_hierarchy_2::split2(Constraint_id first, Vertex_it vcit) +Polyline_constraint_hierarchy_2::split_head(Constraint_id constr, Vertex_it vcit) { - constraint_set.erase(first); - Vertex_list* second = new Vertex_list; - second->splice(second->skip_end(), *first.vl_ptr(), first.vl_ptr()->skip_begin(), vcit.base()); - second->push_back(first.vl_ptr()->front()); // Duplicate the common vertex - Vertex_it vit = second->skip_end(); - --vit; - vit.input() = true; - vit = first.vl_ptr()->skip_begin(); - vit.input() = true; - constraint_set.insert(first); - constraint_set.insert(second); - // We have to look at all subconstraints - for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); - ++succ != end; - ++it){ - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_assertion(scit != sc_to_c_map.end()); - Context_list* hcl = scit->second; + // constr is [A, ..., B], vcit points to M in [A, ..., B] - // and replace the context of the constraint - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second; - break; - } + Constraint_id new_constr = create_new_constraint(); + + Vertex_list_ptr constr_vl = constr.vl_ptr(); + Vertex_list_ptr new_vl = new_constr.vl_ptr(); + + vcit.input() = true; + auto middle_node = Node(*vcit, true); + + // Let's split, that way: + // constr = [M, ..., B] + // new_constr = [A, ..., M] + + // The splice does: + // constr = [M, ..., B] + // new_constr = [A, ..., M[ (without M) + new_vl->splice(new_vl->skip_end(), *constr_vl, constr_vl->skip_begin(), vcit.base()); + new_vl->push_back(middle_node); // add M to the end of new_constr + + CGAL_assertion(vcit.base() == constr_vl->skip_begin()); + CGAL_assertion(constr_vl->front().input() == true); + CGAL_assertion(new_vl->back().input() == true); + + bool new_constr_share = false; + for_context_lists_of_all_subconstraints(new_constr, [&](Context_list* hcl, Vertex_it, Sc_it) { + if(constr.may_share() && hcl->size() > 1) { + new_constr_share = true; } - } - return second; + replace_first_in_context_list(hcl, constr, new_constr); + }); + + new_constr.may_share() = new_constr_share; + return new_constr; } @@ -864,71 +1161,36 @@ when a constraint is inserted, it is, at first, both a constraint and a subconstraint */ template -typename Polyline_constraint_hierarchy_2::Vertex_list* +typename Polyline_constraint_hierarchy_2::Constraint_id Polyline_constraint_hierarchy_2:: insert_constraint(T va, T vb){ - Edge he = make_edge(va, vb); - Vertex_list* children = new Vertex_list; - Context_list* fathers; - -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 using CGAL::IO::oformat; std::cerr << CGAL::internal::cdt_2_indent_level << "C_hierachy.insert_constraint( " << IO::oformat(va) << ", " << IO::oformat(vb) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); - if(scit == sc_to_c_map.end()){ - fathers = new Context_list; - sc_to_c_map.insert(std::make_pair(he,fathers)); - } else { - fathers = scit->second; +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 + Constraint_id cid = create_new_constraint(); + auto& context_list_ptr = contexts_of(va, vb); + if(context_list_ptr == nullptr){ + context_list_ptr = new Context_list; } - children->push_front(Node(va, true)); // was he.first - children->push_back(Node(vb, true)); // was he.second - constraint_set.insert(children); - Context ctxt; - ctxt.enclosing = children; - ctxt.pos = children->skip_begin(); - fathers->push_front(ctxt); + auto children = cid.vl_ptr(); + children->push_front(Node(va, true)); + children->push_back(Node(vb, true)); + context_list_ptr->emplace_front(cid, cid.begin()); + fix_may_share_in_contexts_constraints(*context_list_ptr); - return children; + return cid; } template -typename Polyline_constraint_hierarchy_2::Vertex_list* +typename Polyline_constraint_hierarchy_2::Constraint_id Polyline_constraint_hierarchy_2:: insert_constraint_old_API(T va, T vb){ - Edge he = make_edge(va, vb); - - Vertex_list* children = new Vertex_list; - Context_list* fathers; - -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS - using CGAL::IO::oformat; - std::cerr << CGAL::internal::cdt_2_indent_level - << "C_hierachy.insert_constraint_old_API( " - << IO::oformat(va) << ", " << IO::oformat(vb) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); - if(scit == sc_to_c_map.end()){ - fathers = new Context_list; - sc_to_c_map.insert(std::make_pair(he,fathers)); - } else { - fathers = scit->second; - } - - children->push_front(Node(va, true)); // was he.first - children->push_back(Node(vb, true)); // was he.second - constraint_set.insert(children); - Context ctxt; - ctxt.enclosing = children; - ctxt.pos = children->skip_begin(); - fathers->push_front(ctxt); - - return children; + return insert_constraint(va, vb); } @@ -936,30 +1198,22 @@ template void Polyline_constraint_hierarchy_2:: append_constraint(Constraint_id cid, T va, T vb){ - Edge he = make_edge(va, vb); - Context_list* fathers; - -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 using CGAL::IO::oformat; std::cerr << CGAL::internal::cdt_2_indent_level << "C_hierachy.append_constraint( ..., " << IO::oformat(va) << ", " << IO::oformat(vb) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); - if(scit == sc_to_c_map.end()){ - fathers = new Context_list; - sc_to_c_map.insert(std::make_pair(he,fathers)); - } else { - fathers = scit->second; +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 + auto& context_list_ptr = contexts_of(va, vb); + if(context_list_ptr == nullptr){ + context_list_ptr = new Context_list; } - typename Vertex_list::skip_iterator bit = cid.vl_ptr()->skip_end(); - --bit; + auto pos_va = std::prev(cid.end()); + CGAL_assertion(pos_va->vertex() == va); cid.vl_ptr()->push_back(Node(vb, true)); - Context ctxt; - ctxt.enclosing = cid.vl_ptr(); - ctxt.pos = bit; - fathers->push_front(ctxt); + context_list_ptr->emplace_front(cid, pos_va); + fix_may_share_in_contexts_constraints(*context_list_ptr); } @@ -967,80 +1221,20 @@ template void Polyline_constraint_hierarchy_2:: clear() { - C_iterator cit; - Sc_iterator scit; // clean and delete vertices lists - for(cit=constraint_set.begin(); cit != constraint_set.end(); cit++){ - cit->vl_ptr()->clear(); - delete cit->vl_ptr(); + for(auto cid : constraints()) { + cid.clear(); + cid.destroy(); } // clean and delete context lists - for(scit=sc_to_c_map.begin(); scit != sc_to_c_map.end(); scit++){ - (*scit).second->clear(); - delete (*scit).second; + for(auto& [_, cl_ptr] : priv.sc_to_c_map) { + cl_ptr->clear(); + delete cl_ptr; } - sc_to_c_map.clear(); - constraint_set.clear(); + priv = Priv(priv.comp); } -template -bool Polyline_constraint_hierarchy_2:: -next_along_sc(T va, T vb, T& w) const -{ - // find the next vertex after vb along any enclosing constrained - // return false if there is no .... - Context_iterator ctxtit, past; - if(!get_contexts(va, vb, ctxtit, past)) CGAL_assertion(false); - - Vertex_it pos; - for( ; ctxtit != past; ctxtit++){ - pos = ctxtit->pos; - if((*pos)==va) { - ++pos; ++pos; - if (pos != ctxtit->enclosing->end()) { w=(*pos); return true;} - } - else { - if (pos != ctxtit->enclosing->begin()) {--pos; w=(*pos); return true;} - } - } - return false; -} - - - -/* - Attention, le point v DOIT etre un point de Steiner, - et les segments va,v et v,vb sont des sous contraintes. -*/ -template -void Polyline_constraint_hierarchy_2:: -remove_Steiner(T v, T va, T vb) -{ - // remove a Steiner point - CGAL_precondition(!is_constrained_vertex(v)); - - Context_list* hcl1; - Context_list* hcl2; - if(!get_contexts(va,v,hcl1)) CGAL_assertion(false); - if(!get_contexts(v,vb,hcl2)) CGAL_assertion(false); - - Vertex_it pos; - for(Context_iterator ctit=hcl1->begin(); ctit != hcl1->end(); ctit++){ - pos = ctit->pos; - if((*pos)==va) pos++; - pos = ctit->enclosing->erase(pos); - ctit->pos = --pos; - } - - sc_to_c_map.erase(make_edge(va,v)); - sc_to_c_map.erase(make_edge(v,vb)); - delete hcl2; - sc_to_c_map.insert(std::make_pair(make_edge(va,vb),hcl1)); -} - - - /* same as add_Steiner precondition : va,vb est une souscontrainte. @@ -1055,189 +1249,159 @@ split_constraint(T va, T vb, T vc){ template void Polyline_constraint_hierarchy_2:: -add_Steiner(T va, T vb, T vc){ -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +add_Steiner(const T va, const T vb, const T vc){ +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 using CGAL::IO::oformat; std::cerr << CGAL::internal::cdt_2_indent_level << "C_hierachy.add_Steinter( " << IO::oformat(va) << ", " << IO::oformat(vb) << ", " << IO::oformat(vc) << ")\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - Context_list* hcl=nullptr; - if(!get_contexts(va,vb,hcl)) { -#ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 + Sc_iterator sc_iter_va_vb = find_contexts(va, vb); + if(sc_iter_va_vb == contexts_not_found()) { +#ifdef CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 std::cerr << CGAL::internal::cdt_2_indent_level << " -> the constraint is already split\n"; -#endif // CGAL_CDT_2_DEBUG_INTERSECTIONS +#endif // CGAL_DEBUG_POLYLINE_CONSTRAINT_HIERARCHY_2 return; } - Context_list* hcl2 = new Context_list; + Context_list* va_vb_cl = sc_iter_va_vb->second; + erase_context(sc_iter_va_vb); + Context_list*& vc_vb_cl_ref = contexts_of(vc,vb); - Vertex_it pos; - Context ctxt; - for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { - // insert vc in enclosing constraint - pos = ctit->current(); - ++pos; - pos = ctit->enclosing->insert(pos.base(), Node(vc)); - --pos; + if(vc_vb_cl_ref == nullptr) { + vc_vb_cl_ref = new Context_list; + } - // set ctxt to the context of (vc,vb) - // change *ctit in hcl to the context of (va,vc) - // add ctxt to hcl2 list - ctxt.enclosing = ctit->enclosing; - if(*pos == va) { - ctit->pos = pos; - ctxt.pos = ++pos; + Context_list* vc_vb_cl = vc_vb_cl_ref; + + for(Context& ctxt : *va_vb_cl) { + Vertex_it pos = ctxt.current(); + Vertex_it next_pos = std::next(pos); + + // [pos, next_pos] is the subconstraint (va,vb) or (vb,va) + CGAL_assertion( (va == *pos && vb == *next_pos) || (vb == *pos && va == *next_pos) ); + // insert vc in enclosing constraint, just before `next_pos` + Vertex_it pos_vc = ctxt.enclosing.vl_ptr()->insert(next_pos.base(), Node(vc)); + pos = std::prev(pos_vc); + + // now (pos, pos_vc, next_pos) is (va,vc,vb) or (vb,vc,va) + + // change ctxt in va_vb_cl to the context of (va,vc) + Context& va_vc_ctxt = ctxt; + Context vc_vb_ctxt{ctxt}; + if(*pos == va) { // (pos, pos_vc, next_pos) is (va,vc,vb) + va_vc_ctxt.pos = pos; + vc_vb_ctxt.pos = pos_vc; } - else { //(*pos)==vb - ctxt.pos = pos; - ctit->pos = ++pos; + else { // (pos, pos_vc, next_pos) is (vb,vc,va) + vc_vb_ctxt.pos = pos; + va_vc_ctxt.pos = pos_vc; } - hcl2->push_back(ctxt); + vc_vb_cl->push_back(vc_vb_ctxt); } - Context_list* hcl3; - if (get_contexts(va,vc,hcl3)) { // (va,vc) is already a subconstraint - hcl3->splice(hcl3->end(), *hcl); - delete hcl; + Context_list*& va_vc_cl = contexts_of(va,vc); + if (va_vc_cl != nullptr) { // (va,vc) was already a subconstraint + va_vc_cl->splice(va_vc_cl->end(), *va_vb_cl); + delete va_vb_cl; + } else { + va_vc_cl = va_vb_cl; } - else sc_to_c_map.insert(std::make_pair(make_edge(va,vc), hcl)); - if (get_contexts(vc,vb,hcl3)) {// (vc,vb) is already a subconstraint - hcl3->splice(hcl3->end(),*hcl2); - - delete hcl2; - } - else sc_to_c_map.insert(std::make_pair(make_edge(vc,vb), hcl2)); - - - sc_to_c_map.erase(make_edge(va,vb)); - return; + fix_may_share_in_contexts_constraints(*va_vc_cl); + fix_may_share_in_contexts_constraints(*vc_vb_cl); } template inline -typename Polyline_constraint_hierarchy_2::Edge +typename Polyline_constraint_hierarchy_2::Context_list* Polyline_constraint_hierarchy_2:: -make_edge(T va, T vb) const +get_context_list(T va, T vb) const { - return comp(va, vb) ? Edge(va,vb) : Edge(vb,va); -} - -template -inline -bool -Polyline_constraint_hierarchy_2:: -get_contexts(T va, T vb, Context_list* & hcl) const -{ - Sc_iterator sc_iter = sc_to_c_map.find(make_edge(va,vb)); - if( sc_iter == sc_to_c_map.end() ) return(false); - hcl = (*sc_iter).second; - return true; -} - -template -inline -bool -Polyline_constraint_hierarchy_2:: -get_contexts(T va, T vb, - Context_iterator& ctxt, - Context_iterator& past) const -{ - Context_list* hcl; - if (!get_contexts(va,vb,hcl)) return false; - ctxt = hcl->begin(); - past = hcl->end(); - return true; -} - - - -template -inline -typename Polyline_constraint_hierarchy_2::Vertex_it -Polyline_constraint_hierarchy_2:: -get_pos(T va, T vb) const - //return pos in the first context -{ - return (*sc_to_c_map.find(make_edge(va,vb))).second->begin().pos; -} - -template -void -Polyline_constraint_hierarchy_2:: -oriented_end(T va, T vb, T& vc) const -{ - Context_iterator ctxt, past; - if(!get_contexts(va,vb, ctxt, past) ) CGAL_assertion(false); - if(*(ctxt->pos) == va) - vc = ctxt->enclosing->back(); + Sc_iterator sc_iter = find_contexts(va, vb); + if(sc_iter == contexts_not_found()) + return nullptr; else - vc = ctxt->enclosing->front(); + return sc_iter->second; +} + +template +inline +auto Polyline_constraint_hierarchy_2:: +contexts(T va, T vb) const -> Iterator_range +{ + Context_list* hcl = get_context_list(va,vb); + if (nullptr == hcl) return {}; + else return {hcl->begin(), hcl->end()}; } template void Polyline_constraint_hierarchy_2:: -print() const +print(std::ostream& os) const { - C_iterator hcit; - std::map vertex_num; + std::map vertex_num_map; int num = 0; - for(hcit = c_begin(); hcit != c_end(); hcit++) { - Constraint_id cid = (*hcit); - Vertex_it vit =cid.vl_ptr()->skip_begin(), end = cid.vl_ptr()->skip_end(); - for (;vit != end; vit++){ - num ++; - vertex_num.insert(std::make_pair((*vit), num)); + for(const auto& cid : constraints()) { + for (const auto& node : cid.elements()){ + vertex_num_map.emplace(node.vertex(), ++num); } } -// typename std::map::iterator vnit = vertex_num.begin(); -// for(; vnit != vertex_num.end(); vnit++) { -// vnit->second = ++num; -// std::cerr << "vertex num " << num << " " << vnit->first->point() -// << std::endl; -// } - C_iterator cit=c_begin(); - Sc_iterator scit=sc_begin(); + auto disp_vertex = [&vertex_num_map](Vertex_handle v) { + return CGAL::IO::oformat( + [v, &vertex_num_map](auto& os) -> decltype(os)& { + constexpr bool star_v_has_timestamp = + internal::has_timestamp_v>; + if constexpr(star_v_has_timestamp) { + CGAL_USE(vertex_num_map); + return os << '#' << v->time_stamp(); + } else { + auto it = vertex_num_map.find(v); + auto n = (it == vertex_num_map.end()) ? -1 : it->second; + return os << n; + } + }, + IO_manip_tag{}); + }; - for(; cit != c_end(); cit++){ - std::cout << std::endl ; - std::cout << "constraint " ; - std::cout << cit->vl_ptr(); - std::cout << " subconstraints " ; - Vertex_it vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end(); - for(; vit != end; vit++){ - std::cout << vertex_num[*vit] <<" "; + os << "# number of constraints: " << number_of_constraints() << std::endl; + for(const auto& cid : constraints()) { + os << "constraint(" << cid.index() << ") "; + os << cid.vl_ptr(); + os << "\n vertex list "; + for(const auto& node : cid.elements()) { + os << disp_vertex(node.vertex()) << " "; } - vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end(); - for(; vit != end; vit++){ - std::cout << (*vit)->point() <<" "; + os << "\n corresponding points: "; + for(const auto& node : cid.elements()) { + os << node.point() << " "; } + if(cid.may_share()) { + os << "\n (may have non-simple context lists)"; + } + os << std::endl; } - std::cout << std::endl ; - for(;scit != sc_end(); scit++){ - std::cout << "subconstraint " ; - std::cout << vertex_num[scit->first.first] << " " - << vertex_num[scit->first.second]; - Context_iterator cb, ce; - get_contexts(scit->first.first, scit->first.second, cb, ce); + os << std::endl; + os << "# number of subconstraints: " << number_of_subconstraints() << std::endl; + for(const auto& subconstraint : subconstraints()) { + os << "subconstraint ("; + os << disp_vertex(subconstraint.first) << ", " + << disp_vertex(subconstraint.second) << ")"; - std::cout << " enclosing " ; - for(; cb != ce; cb++) { - std::cout << cb->id().vl_ptr(); - std::cout << " " ; + os << " enclosing: "; + for(const auto& ctxt : contexts(subconstraint.first, subconstraint.second)) { + os << "(cid " << ctxt.id().index() << ") " << ctxt.id().vl_ptr(); + os << ", pos: " << std::distance(ctxt.vertices_begin(), ctxt.pos) << " "; } - std::cout << std::endl ; + os << std::endl; } return; } - } //namespace CGAL #endif // CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H diff --git a/Triangulation_2/test/Triangulation_2/CMakeLists.txt b/Triangulation_2/test/Triangulation_2/CMakeLists.txt index 341976b159f..9f78f053245 100644 --- a/Triangulation_2/test/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/test/Triangulation_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_2_Tests) find_package(CGAL REQUIRED) diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h index e2cc92ba8b7..a571a364395 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_triang_plus_2.h @@ -81,6 +81,9 @@ _test_cls_const_triang_plus_2( const TrP & ) assert( (*currentin2 == va && *++currentin2 == vb) || (*currentin2 == vb && *++currentin2 == va)); + //test copy of the hierarchy + auto hierarchy = trp.hierarchy_ref(); + //test copy and swap std::cout << "test copy and swap" << std::endl; TrP trp2(trp); @@ -151,7 +154,7 @@ _test_cls_const_triang_plus_2( const TrP & ) std::size_t n = 0; for(Constraint_iterator cit = trp.constraints_begin(); cit != trp.constraints_end(); ++cit){ Constraint_id cid = *cit; - n += cid.second->all_size(); + n += cid.vl_ptr()->all_size(); } assert( n == 9); } diff --git a/Triangulation_2/test/Triangulation_2/issue_4025.cpp b/Triangulation_2/test/Triangulation_2/issue_4025.cpp index b56894bd16c..784d4570860 100644 --- a/Triangulation_2/test/Triangulation_2/issue_4025.cpp +++ b/Triangulation_2/test/Triangulation_2/issue_4025.cpp @@ -1,89 +1,193 @@ -#include -#include +// This code was first submitted in an issue: +// https://github.com/CGAL/cgal/issues/4025 +// and then rewrote a lot, keeping the observed behavior. + +#include #include #include +#include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Exact_intersections_tag Itag_; -typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; -typedef CGAL::Constrained_triangulation_plus_2 CDTP; +#include +#include +#include -typedef CDTP::Point Point; -typedef CDTP::Constraint_id Cid; -typedef CDTP::Vertex_handle Vertex_handle; -typedef CDTP::Constraint_id Constraint_id; -typedef CDTP::Vertices_in_constraint_iterator Vertices_in_constraint_iterator; +using K = CGAL::Exact_predicates_inexact_constructions_kernel; +using Polygon_2 = CGAL::Polygon_2; +using Itag_ = CGAL::Exact_intersections_tag; +using Vb = CGAL::Base_with_time_stamp>; +using Cb = CGAL::Base_with_time_stamp>; +using Tds = CGAL::Triangulation_data_structure_2; +using CDT = CGAL::Constrained_Delaunay_triangulation_2; +using CDTP = CGAL::Constrained_triangulation_plus_2; -int countVertex(CDTP &cdtp, CDTP::Constraint_id id) +using Point = CDTP::Point; +using Vertex_handle = CDTP::Vertex_handle; +using Constraint_id = CDTP::Constraint_id; +using Vertices_in_constraint_iterator = CDTP::Vertices_in_constraint_iterator; + +auto nb_of_vertices(CDTP &cdtp, Constraint_id id) { - Vertices_in_constraint_iterator v=cdtp.vertices_in_constraint_begin(id); - - int count=0; - while(v!=cdtp.vertices_in_constraint_end(id)) - { - count++; - v++; - } - - return count; + return static_cast(std::distance(cdtp.vertices_in_constraint_begin(id), + cdtp.vertices_in_constraint_end(id))); } +template +decltype(auto) value_check_expected(V&& value, [[maybe_unused]] const E& expected) +{ + assert(value == expected); + return std::forward(value); +}; + +auto oformat(Vertex_handle vh) +{ + return CGAL::IO::oformat(vh, CGAL::With_point_tag{}); +}; int main() { CDTP cdtp; - std::list pointsListCollinear; + auto print_cdtp = [&cdtp](std::string_view msg) + { + std::cout << msg << std::endl; + cdtp.print_hierarchy(std::cout); + }; - pointsListCollinear.push_back(Point(0,0)); - pointsListCollinear.push_back(Point(0,1)); - pointsListCollinear.push_back(Point(0,2)); - pointsListCollinear.push_back(Point(0,3)); - pointsListCollinear.push_back(Point(0,4)); - pointsListCollinear.push_back(Point(0,5)); + const std::array collinear_points = { + Point(0,0), Point(0,1), Point(0,2), Point(0,3), Point(0,4), Point(0,5) + }; - std::list pointsListNoCollinear; + const std::array non_collinear_points = { + Point(1,0), Point(2,1), Point(4,2), Point(2,3), Point(4,4), Point(1,5) + }; - pointsListNoCollinear.push_back(Point(1,0)); - pointsListNoCollinear.push_back(Point(2,1)); - pointsListNoCollinear.push_back(Point(4,2)); - pointsListNoCollinear.push_back(Point(2,3)); - pointsListNoCollinear.push_back(Point(4,4)); - pointsListNoCollinear.push_back(Point(1,5)); + Constraint_id collinear_cid = cdtp.insert_constraint(collinear_points.begin(), collinear_points.end()); + Constraint_id non_collinear_cid = cdtp.insert_constraint(non_collinear_points.begin(), non_collinear_points.end()); + + print_cdtp("Initial state"); + + Vertices_in_constraint_iterator vertex_it = std::next(cdtp.vertices_in_constraint_begin(collinear_cid), 2); + Vertex_handle v = *vertex_it; + [[maybe_unused]] auto next_it = std::next(vertex_it); + std::cout << "\n-> attempt to remove vertex " << oformat(*vertex_it) << std::endl; + vertex_it = cdtp.remove_vertex_from_constraint(collinear_cid, vertex_it); + std::cout << " cdtp.remove_vertex_from_constraint(collinear_cid, vertex_it) returned the vertex " + << oformat(*vertex_it) << std::endl; + assert(vertex_it == next_it); + assert(cdtp.tds().is_vertex(v)); // v (0, 2) is still in the triangulation + + print_cdtp("\nAfter removing third vertex from the collinear constraint"); + + // The first constraint (ID `collinear_cid`) is collinear. `cdtp.remove_vertex_from_constraint` + // cannot remove the third vertex from it, because it is collinear with the triangulation vertex + // with the point (0, 2). + + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 10U) << std::endl; + std::cout << "number of constraints: " + << value_check_expected(cdtp.number_of_constraints(), 2U) << std::endl; + std::cout << "number of vertex in collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, collinear_cid), 6U) << std::endl; + + vertex_it = std::next(cdtp.vertices_in_constraint_begin(non_collinear_cid), 2); + Vertex_handle v2 = *vertex_it; + next_it = std::next(vertex_it); + std::cout << "\n-> attempt to remove vertex " << oformat(*vertex_it) << std::endl; + vertex_it = cdtp.remove_vertex_from_constraint(non_collinear_cid, vertex_it); + std::cout << " cdtp.remove_vertex_from_constraint(non_collinear_cid, vertex_it) returned the vertex " + << oformat(*vertex_it) << std::endl; + assert(vertex_it == next_it); + assert(cdtp.tds().is_vertex(v2)); // v2 (4, 2) is still in the triangulation + + print_cdtp("\nAfter removing third vertex from the non-collinear constraint"); + + std::cout << "number of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 9U) << std::endl; + std::cout << "number of constraints: " + << value_check_expected(cdtp.number_of_constraints(), 2U) << std::endl; + std::cout << "number of vertex in non-collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, non_collinear_cid), 5U) << std::endl; + + // re-insert v and v2 in the their constraints + vertex_it = cdtp.insert_vertex_in_constraint(collinear_cid, + std::next(cdtp.vertices_in_constraint_begin(collinear_cid), 2), + v); + assert(*vertex_it == v); + assert(std::distance(cdtp.vertices_in_constraint_begin(collinear_cid), vertex_it) == 2); + vertex_it = cdtp.insert_vertex_in_constraint(non_collinear_cid, + std::next(cdtp.vertices_in_constraint_begin(non_collinear_cid), 2), + v2); + assert(*vertex_it == v2); + assert(std::distance(cdtp.vertices_in_constraint_begin(non_collinear_cid), vertex_it) == 2); + + print_cdtp("\nAfter re-inserting the two vertices in their constraint"); + + std::cout << "number of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 10U) << std::endl; + std::cout << "number of constraints: " + << value_check_expected(cdtp.number_of_constraints(), 2U) << std::endl; + std::cout << "number of vertex in collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, collinear_cid), 6U) << std::endl; + std::cout << "number of vertex in non-collinear constraint: " + << value_check_expected(nb_of_vertices(cdtp, non_collinear_cid), 6U) << std::endl; + + // NOW test another scenario, that has nothing to do with the issue #4025 + cdtp.clear(); + print_cdtp("\nAfter clearing the constrained triangulation"); - Constraint_id ctIdCollinear=cdtp.insert_constraint(pointsListCollinear.begin(),pointsListCollinear.end()); - Constraint_id ctIdNoCollinear=cdtp.insert_constraint(pointsListNoCollinear.begin(),pointsListNoCollinear.end()); + // Let's insert a constraint with a loop + // (1,1) + // / | + // / | + // start-->(0,0) X-->(1,0) + // / + // / + // (-1,-1) + const std::array looping_cid = { + Point(0,0), Point(1,0), Point(1,1), Point(-1,-1) + }; + cdtp.insert_constraint(looping_cid.begin(), looping_cid.end()); + print_cdtp("\nAfter inserting a looping constraint"); + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 4U) << std::endl; - //******************************* attempt with the collinear constraint - Vertices_in_constraint_iterator vertexToRemoveCollinear=cdtp.vertices_in_constraint_begin(ctIdCollinear); - vertexToRemoveCollinear++; - vertexToRemoveCollinear++; + // NOW test another scenario + cdtp.clear(); + print_cdtp("\nAfter clearing the constrained triangulation"); + // Let's insert a constraint with identical sub-constraints + // (1,1) + // / | + // / | + // start-->(0,0)-->(1,0)--->(3,0) + const std::array overlaping_cid = {Point(0, 0), Point(1, 0), Point(1, 1), + Point(0, 0), Point(3, 0)}; + cdtp.insert_constraint(overlaping_cid.begin(), overlaping_cid.end()); + print_cdtp("\nAfter inserting a constraint with overlapping subconstraints"); + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 4U) + << "\ncdtp.subconstraints.size(): " + << value_check_expected(cdtp.subconstraints().size(), 4U) << std::endl; - - std::cout<<"attempt to remove vertex "<<(*vertexToRemoveCollinear)->point().x()<<" , "<<(*vertexToRemoveCollinear)->point().y() < 5, expected 4 - std::cout<<"number of constraints "< 1 - std::cout<<"number of vertex in constraint "< 6, expected 5 - - - //******************************* attempt with the collinear constraint - Vertices_in_constraint_iterator vertexToRemoveNoCollinear=cdtp.vertices_in_constraint_begin(ctIdNoCollinear); - vertexToRemoveNoCollinear++; - vertexToRemoveNoCollinear++; - - std::cout<<"attempt to remove vertex "<<(*vertexToRemoveNoCollinear)->point().x()<<" , "<<(*vertexToRemoveNoCollinear)->point().y() << std::endl; - cdtp.remove_vertex_from_constraint(ctIdNoCollinear,vertexToRemoveNoCollinear); - - std::cout<<"number of subconstraints "< 4, ok - std::cout<<"number of constraints "< 1 - std::cout<<"number of vertex in constraint "< 5, ok + // NOW test another scenario + cdtp.clear(); + print_cdtp("\nAfter clearing the constrained triangulation"); + // Let's insert two constraints with four points each and one common segment in the middle + // start-->(0,1) (3,1) + // \ / + // \ / + // start-->(0,0)--->(1,0)===>(2,0)--->(3,0) + const std::array first_cid = {Point(0, 0), Point(1, 0), Point(2, 0), Point(3, 0)}; + const std::array second_cid = {Point(0, 1), Point(1, 0), Point(2, 0), Point(3, 1)}; + cdtp.insert_constraint(first_cid.begin(), first_cid.end()); + cdtp.insert_constraint(second_cid.begin(), second_cid.end()); + print_cdtp("\nAfter inserting two constraints with a common segment in the middle"); + std::cout << "\nnumber of subconstraints: " + << value_check_expected(cdtp.number_of_subconstraints(), 5U) + << "\ncdtp.subconstraints.size(): " + << value_check_expected(cdtp.subconstraints().size(), 5U) << std::endl; return 0; - } diff --git a/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt b/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt index 5a6b5b4474c..419938ed36e 100644 --- a/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt @@ -1,29 +1,13 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3) # CGAL and its components find_package(CGAL REQUIRED) -# Boost and its components -find_package(Boost REQUIRED) - -if(NOT Boost_FOUND) - - message( - STATUS "This project requires the Boost library, and will not be compiled.") - - return() - -endif() - -# include for local directory - -# include for local package - # Creating entries for all C++ files with "main" routine # ########################################################## diff --git a/Triangulation_3/benchmark/Triangulation_3/segment_traverser_benchmark.cpp b/Triangulation_3/benchmark/Triangulation_3/segment_traverser_benchmark.cpp index 2839ea5e00b..2039138e058 100644 --- a/Triangulation_3/benchmark/Triangulation_3/segment_traverser_benchmark.cpp +++ b/Triangulation_3/benchmark/Triangulation_3/segment_traverser_benchmark.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -30,8 +30,8 @@ #include // Define the kernel. -typedef CGAL::Exact_predicates_exact_constructions_kernel Epeck; -typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick; +using Epeck = CGAL::Exact_predicates_exact_constructions_kernel; +using Epick = CGAL::Exact_predicates_inexact_constructions_kernel; template @@ -40,11 +40,11 @@ void bench_segment_traverser(const int nb_queries, const double rad, CGAL::Random& rng) { - typedef CGAL::Delaunay_triangulation_3 DT; - typedef CGAL::Triangulation_segment_simplex_iterator_3
    Simplex_traverser; - typedef CGAL::Triangulation_segment_cell_iterator_3
    Cell_traverser; - typedef typename DT::Point_3 Point_3; - typedef typename DT::Cell Cell; + using DT = CGAL::Delaunay_triangulation_3; + using Tds = typename DT::Triangulation_data_structure; + using Point_3 = typename DT::Point_3; + using Cell_handle = typename DT::Cell_handle; + using Simplex_3 = CGAL::Triangulation_simplex_3; std::cout << "\nBench :\t " << nb_queries << " queries," << std::endl << "\t in triangulation of size " << nbv << std::endl @@ -83,29 +83,26 @@ void bench_segment_traverser(const int nb_queries, { //Simplex traverser timer_st.start(); - Simplex_traverser st(dt, segments[2*i], segments[2*i + 1]); // Count the number of finite cells traversed. unsigned int inf = 0, fin = 0; - for (; st != st.end(); ++st) + for (Simplex_3 st : dt.segment_traverser_simplices(segments[2 * i], segments[2 * i + 1])) { - Cell c = st.cell(); -// if (dt.is_infinite(c)) ++inf; -// else ++fin; + Cell_handle c = st.incident_cell(); + if (dt.is_infinite(c)) ++inf; + else ++fin; } timer_st.stop(); //Cell traverser timer_ct.start(); - Cell_traverser ct(dt, segments[2*i], segments[2*i + 1]); // Count the number of finite cells traversed. inf = 0, fin = 0; - for (; ct != ct.end(); ++ct) + for (Cell_handle c : dt.segment_traverser_cell_handles(segments[2 * i], segments[2 * i + 1])) { - Cell c = ct.cell(); -// if (dt.is_infinite(c)) ++inf; -// else ++fin; + if (dt.is_infinite(c)) ++inf; + else ++fin; } timer_ct.stop(); } @@ -128,4 +125,6 @@ int main(int argc, char* argv[]) // bench_segment_traverser(nb_queries, nbv, rad, rng); bench_segment_traverser(nb_queries, nbv, rad, rng); + + return EXIT_SUCCESS; } diff --git a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt index df83176883d..a46df3c2e84 100644 --- a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3_Demo) # Find includes in corresponding build directories diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_simplex_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_simplex_3.h index af3a03801b5..17beea514f1 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_simplex_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_simplex_3.h @@ -5,7 +5,7 @@ namespace CGAL { \ingroup PkgTriangulation3VertexCellClasses The class `Triangulation_simplex_3` stores a simplex of any dimension -defined by the `Triangulation_3` class. It also defines the +defined by the `TriangulationDataStructure_3` class. It also defines the operator less such that simplices can be stored in a `map` or a `set` of simplices. The simplex is invalidated by any change in the triangulation. @@ -18,7 +18,7 @@ from. \sa `CGAL::Triangulation_3` */ -template< typename Triangulation_3 > +template< typename TriangulationDataStructure_3 > class Triangulation_simplex_3 { public: @@ -29,67 +29,67 @@ public: The simplex class itself. */ -typedef Triangulation_simplex_3 Simplex; +typedef Triangulation_simplex_3 Simplex; /*! */ -typedef Triangulation_3::Vertex_handle Vertex_handle; +typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; /*! */ -typedef Triangulation_3::Edge Edge; +typedef TriangulationDataStructure_3::Edge Edge; /*! */ -typedef Triangulation_3::Facet Facet; +typedef TriangulationDataStructure_3::Facet Facet; /*! */ -typedef Triangulation_3::Cell_handle Cell_handle; +typedef TriangulationDataStructure_3::Cell_handle Cell_handle; /*! */ -typedef Triangulation_3::Cell_circulator Cell_circulator; +typedef TriangulationDataStructure_3::Cell_circulator Cell_circulator; /*! */ -typedef Triangulation_3::Facet_circulator Facet_circulator; +typedef TriangulationDataStructure_3::Facet_circulator Facet_circulator; /*! */ -typedef Triangulation_3::Edge_iterator Edge_iterator; +typedef TriangulationDataStructure_3::Edge_iterator Edge_iterator; /*! */ -typedef Triangulation_3::Facet_iterator Facet_iterator; +typedef TriangulationDataStructure_3::Facet_iterator Facet_iterator; /*! */ -typedef Triangulation_3::Finite_vertices_iterator Finite_vertices_iterator; +typedef TriangulationDataStructure_3::Finite_vertices_iterator Finite_vertices_iterator; /*! */ -typedef Triangulation_3::Finite_edges_iterator Finite_edges_iterator; +typedef TriangulationDataStructure_3::Finite_edges_iterator Finite_edges_iterator; /*! */ -typedef Triangulation_3::Finite_facets_iterator Finite_facets_iterator; +typedef TriangulationDataStructure_3::Finite_facets_iterator Finite_facets_iterator; /*! */ -typedef Triangulation_3::Finite_cells_iterator Finite_cells_iterator; +typedef TriangulationDataStructure_3::Finite_cells_iterator Finite_cells_iterator; /// @} @@ -188,7 +188,7 @@ Test whether two simplices are equal. */ bool operator==(const -Triangulation_simplex_3 &s1); +Triangulation_simplex_3 &s1); /*! Defines a ordering @@ -196,7 +196,7 @@ on the simplices. This ordering depends on the memory layout and is independent of the geometry. Therefore, the ordering is not intrinsic */ bool operator< (const -Triangulation_simplex_3 &s1); +Triangulation_simplex_3 &s1); /// @} diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index 1c8eb7b1584..2a9989ce852 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3_Examples) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) diff --git a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h index 6f25e793fda..d52f68c5646 100644 --- a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h @@ -26,7 +26,7 @@ #include #include -#include +#include // If defined, type casting is done statically, // reducing type-safety overhead. @@ -789,8 +789,8 @@ public: } } else { auto facet_opt = shared_facet(get_edge(), e_prev); - if(static_cast(facet_opt)) { - _curr_simplex = *facet_opt; + if(facet_opt.has_value()) { + _curr_simplex = facet_opt.value(); } else { _curr_simplex = shared_cell(get_edge(), e_prev); @@ -1002,7 +1002,7 @@ private: return f1 == f2 || triangulation().mirror_facet(f1) == f2; } - boost::optional shared_vertex(const Edge& e1, const Edge& e2) const + std::optional shared_vertex(const Edge& e1, const Edge& e2) const { Vertex_handle v1a = e1.first->vertex(e1.second); Vertex_handle v1b = e1.first->vertex(e1.third); @@ -1017,14 +1017,15 @@ private: return {}; } - boost::optional shared_facet(const Edge& e1, const Edge& e2) const + std::optional shared_facet(const Edge& e1, const Edge& e2) const { Vertex_handle v2a = e2.first->vertex(e2.second); Vertex_handle v2b = e2.first->vertex(e2.third); auto sv_opt = shared_vertex(e1, e2); - if(!sv_opt) return {}; - Vertex_handle sv = *sv_opt; + if(!sv_opt.has_value()) + return {}; + Vertex_handle sv = sv_opt.value(); Vertex_handle nsv2 = (sv == v2a) ? v2b : v2a; typename Tr::Facet_circulator circ @@ -1091,7 +1092,7 @@ private: } Cell_handle shared_cell(const Edge e1, const Edge e2) const { - auto facet = shared_facet(e1, e2.first->vertex(e2.second)); + Facet facet = shared_facet(e1, e2.first->vertex(e2.second)); return shared_cell(facet, e2.first->vertex(e2.third)); } diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index b90ecd55af3..70cc966fc1f 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Triangulation_3_Tests) find_package(CGAL REQUIRED) diff --git a/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt index 7b4e8858a12..b69f26cca91 100644 --- a/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/benchmark/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Triangulation_on_sphere_2_Benchmarks ) diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt index 076adb04ea7..380d8b0ad72 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project (Triangulation_on_sphere_2_Demo) diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp index 71cae05953d..1579f45389a 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp @@ -69,7 +69,7 @@ public slots: if (list.size()!=4){ QMessageBox *msgBox = new QMessageBox; msgBox->setWindowTitle("Error"); - msgBox->setText("ERROR : Input should consists of 4 doubles: The radius first, then the coordinates of the center."); + msgBox->setText("ERROR : Input should consist of 4 doubles: The radius first, then the coordinates of the center."); msgBox->exec(); return; } diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt index 80173de13c7..da864c07bb8 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Triangulation_on_sphere_2_Examples ) diff --git a/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt b/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt index 6120e72d373..f41b7819920 100644 --- a/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt +++ b/Triangulation_on_sphere_2/test/Triangulation_on_sphere_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project( Triangulation_on_sphere_2_Tests ) diff --git a/Union_find/test/Union_find/CMakeLists.txt b/Union_find/test/Union_find/CMakeLists.txt index 1fa61d78d72..5026bd87ee7 100644 --- a/Union_find/test/Union_find/CMakeLists.txt +++ b/Union_find/test/Union_find/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Union_find_Tests) find_package(CGAL REQUIRED) diff --git a/Visibility_2/examples/Visibility_2/CMakeLists.txt b/Visibility_2/examples/Visibility_2/CMakeLists.txt index 6a95ae841ca..545c4e885e0 100644 --- a/Visibility_2/examples/Visibility_2/CMakeLists.txt +++ b/Visibility_2/examples/Visibility_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Visibility_2_Examples) find_package(CGAL REQUIRED) diff --git a/Visibility_2/test/Visibility_2/CMakeLists.txt b/Visibility_2/test/Visibility_2/CMakeLists.txt index 8cb1638680b..10500645465 100644 --- a/Visibility_2/test/Visibility_2/CMakeLists.txt +++ b/Visibility_2/test/Visibility_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Visibility_2_Tests) find_package(CGAL REQUIRED) diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt index 58edde2ec5a..898f2932d71 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt @@ -20,7 +20,6 @@ /*! \addtogroup PkgVoronoiDiagram2Ref -\todo check generated documentation \cgalPkgDescriptionBegin{2D Voronoi Diagram Adaptor,PkgVoronoiDiagram2} \cgalPkgPicture{voronoi.png} \cgalPkgSummaryBegin diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt index a0c18e3d250..f7e5cdd4475 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Voronoi_diagram_2_Examples) find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Qt6) diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt index de9e0f7256e..e08fd207164 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Voronoi_diagram_2_Tests) diff --git a/Weights/examples/Weights/CMakeLists.txt b/Weights/examples/Weights/CMakeLists.txt index 629ba82340d..6679efdee36 100644 --- a/Weights/examples/Weights/CMakeLists.txt +++ b/Weights/examples/Weights/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Weights_Examples) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 4f389e3b06b..34a6d79f178 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -344,7 +344,6 @@ public: return cotangent_weight_calculator(he); } -private: FT voronoi(const vertex_descriptor v0) const { auto squared_length_3 = m_traits.compute_squared_length_3_object(); @@ -354,11 +353,12 @@ private: for (const halfedge_descriptor he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) { CGAL_assertion(v0 == target(he, m_pmesh)); - CGAL_assertion(CGAL::is_triangle(he, m_pmesh)); if (is_border(he, m_pmesh)) continue; + CGAL_assertion(CGAL::is_triangle(he, m_pmesh)); + const vertex_descriptor v1 = source(he, m_pmesh); const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 850fccff1e8..80822b68c84 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -44,7 +44,7 @@ private: public: FT operator()(const FT value) const { - return static_cast(CGAL::sqrt(CGAL::to_double(CGAL::abs(value)))); + return CGAL::approximate_sqrt(CGAL::abs(value)); } }; diff --git a/Weights/test/Weights/CMakeLists.txt b/Weights/test/Weights/CMakeLists.txt index 02aef6a76c5..36e7ba70117 100644 --- a/Weights/test/Weights/CMakeLists.txt +++ b/Weights/test/Weights/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.12...3.31) project(Weights_Tests)