From 17af06507404b5c6216b5bffd94b5e7aaf21dc37 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 6 Nov 2024 18:13:11 +0000 Subject: [PATCH] Document functions --- .../demo/Polygon_repair/CMakeLists.txt | 2 +- .../demo/Triangulation_2/CMakeLists.txt | 14 +---------- .../repair_union_intersect_2.cpp | 2 +- .../include/CGAL/Polygon_repair/Boolean.h | 24 +++++++++++++++++++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/GraphicsView/demo/Polygon_repair/CMakeLists.txt b/GraphicsView/demo/Polygon_repair/CMakeLists.txt index afdc5237e1c2..82f4b3797de9 100644 --- a/GraphicsView/demo/Polygon_repair/CMakeLists.txt +++ b/GraphicsView/demo/Polygon_repair/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. cmake_minimum_required(VERSION 3.12...3.29) -project(Triangulation_2_Demo) +project(Polygon_repair_Demo) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) diff --git a/GraphicsView/demo/Triangulation_2/CMakeLists.txt b/GraphicsView/demo/Triangulation_2/CMakeLists.txt index 187ce6476ddd..515dfca67812 100644 --- a/GraphicsView/demo/Triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Triangulation_2/CMakeLists.txt @@ -58,20 +58,8 @@ target_link_libraries(Regular_triangulation_2 PRIVATE CGAL::CGAL CGAL::CGAL_Qt6 add_to_cached_list(CGAL_EXECUTABLE_TARGETS Regular_triangulation_2) -#-------------------------------- -# The "Boolean" demo: Boolean_2 -#-------------------------------- - -qt_add_executable( - Boolean_2 Boolean_2.cpp - Boolean_2.ui Boolean_2.qrc) -target_link_libraries(Boolean_2 PRIVATE CGAL::CGAL CGAL::CGAL_Qt6 - Qt6::Widgets) - -add_to_cached_list(CGAL_EXECUTABLE_TARGETS Boolean_2) - include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) foreach(target Constrained_Delaunay_triangulation_2 Delaunay_triangulation_2 - Regular_triangulation_2 Boolean_2) + Regular_triangulation_2) cgal_add_compilation_test(${target}) endforeach() diff --git a/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp index c9a16441d7ca..4587d7d6fdd1 100644 --- a/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp +++ b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp @@ -60,7 +60,7 @@ main(int argc, char* argv[]) 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(pA,pB); + mpwh = CGAL::Polygon_repair::join(mpwh, pB); CGAL::draw(mpwh); } return 0; diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h b/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h index d6d8729b540a..f006dc3d8c8b 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/Boolean.h @@ -387,6 +387,12 @@ access to the underlying constrained triangulation. }; + + +/// \ingroup PkgPolygonRepairFunctions +/// omputes the union of all polygons with holes in `p` +/// \tparam K parameter of the input and output polygons +/// \pre Each polygon with hole must be non-self-intersecting template Multipolygon_with_holes_2 join(const Multipolygon_with_holes_2& pA) @@ -405,6 +411,12 @@ join(const Multipolygon_with_holes_2& pA) return bops(ltz); } +/// \ingroup PkgPolygonRepairFunctions +/// computes the union of two polygons +/// \tparam K parameter of the 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 non-self-intersecting template decltype(auto) // Multipolygon_with_holes_2 join(const PA& pA, const PB& pB, const K& = Default()) @@ -426,6 +438,11 @@ join(const PA& pA, const PB& pB, const K& = Default()) return bops(ltz); } + +/// \ingroup PkgPolygonRepairFunctions +/// computes the intersection of all polygons with holes in `p` +/// \tparam K parameter of the input and output polygons +/// \pre Each polygon with hole must be non-self-intersecting template Multipolygon_with_holes_2 intersect(const Multipolygon_with_holes_2& pA) @@ -449,6 +466,13 @@ intersect(const Multipolygon_with_holes_2& pA) return bops(equal); } + +/// \ingroup PkgPolygonRepairFunctions +/// Computes the intersection of two polygons +/// \tparam K parameter of the output polygon +/// \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 non-self-intersecting template decltype(auto) // Multipolygon_with_holes_2 intersect(const PA& pA, const PB& pB, const K& = Default())