From 766040a0a859fe315a86736507ed13d6eee8e1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 00:09:26 +0100 Subject: [PATCH 01/26] Fix wrong tparam name How was there no doxygen warning?... --- .../doc/Straight_skeleton_2/CGAL/Straight_skeleton_builder_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9b69d3cc9f7..f1976687e3c 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. From 2805eec7bf5bae1addc6d3e736e688d7a1458140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 00:12:39 +0100 Subject: [PATCH 02/26] Add missing backticks --- .../doc/Straight_skeleton_2/CGAL/create_offset_polygons_2.h | 4 ++-- .../CGAL/create_weighted_offset_polygons_2.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 18362fb362a..abd35bb9b53 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 @@ -97,7 +97,7 @@ the skeleton only once, and then call `create_offset_polygons_2()` for each dist \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()` @@ -138,7 +138,7 @@ therefore, to construct offsets at more than one single distance, use the separa \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_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/create_weighted_offset_polygons_2.h index 5627709d22b..33d893eec1a 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 @@ -123,7 +123,7 @@ therefore, to construct offsets at more than one single distance, use the separa \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()` From dd86cd1f60ce38e7ab9a2bdacbde90d5d530dd8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 00:13:59 +0100 Subject: [PATCH 03/26] Fix doc group --- ...reate_weighted_offset_polygons_from_polygon_with_holes_2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3f68ff59b7e..db63f594a76 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,7 +1,7 @@ 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`. @@ -35,7 +35,7 @@ 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 From aac8c49956d4f8f6096fc5d5e170abbd98b09d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 00:14:53 +0100 Subject: [PATCH 04/26] Remove extra parentheses --- .../CGAL/create_offset_polygons_from_polygon_with_holes_2.h | 2 +- .../create_weighted_offset_polygons_from_polygon_with_holes_2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 cdba6f53874..bb0a918b5a0 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 @@ -42,7 +42,7 @@ 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. 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 db63f594a76..9e1fd1cf0b9 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 @@ -42,7 +42,7 @@ 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. From b76596a450d0d369d1447004f10516ca8bb57115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 00:15:08 +0100 Subject: [PATCH 05/26] Fix wrong parameter order in documentation --- .../CGAL/create_weighted_offset_polygons_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 33d893eec1a..5612c69c6b9 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 @@ -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, From 0ed7e3041b11f54d776e9dbe0b18624a1f8e644f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:02:00 +0100 Subject: [PATCH 06/26] Various fixes in the documentation of template parameters --- .../CGAL/create_offset_polygons_2.h | 38 ++++++++--------- ...ffset_polygons_from_polygon_with_holes_2.h | 21 +++++----- .../CGAL/create_weighted_offset_polygons_2.h | 42 +++++++++---------- ...ffset_polygons_from_polygon_with_holes_2.h | 26 +++++++----- .../create_weighted_straight_skeleton_2.h | 6 +-- 5 files changed, 69 insertions(+), 64 deletions(-) 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 abd35bb9b53..5d540adc617 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,15 +84,15 @@ 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`. @@ -125,15 +125,15 @@ 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`. 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 bb0a918b5a0..76ee56c2bf4 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`. @@ -46,15 +47,15 @@ output of \link CGAL::create_exterior_skeleton_and_offset_polygons_2() `create_e 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 5612c69c6b9..0514b380322 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`. @@ -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,16 +109,16 @@ 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`. 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 9e1fd1cf0b9..57aaf455e4a 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 @@ -8,15 +8,16 @@ 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`. @@ -46,15 +47,16 @@ output of \link CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2() 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 ca9c472deeb..736f07ae8fd 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. From 59e1ca53ac00142767cc207a90074b065e216754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:02:28 +0100 Subject: [PATCH 07/26] Clarify comment --- .../CGAL/Straight_skeleton_2/Straight_skeleton_aux.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 8e5bdfdd6d2..d1bb004700e 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 @@ -197,8 +197,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 @@ -207,8 +207,8 @@ 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; }; // The return type of create_interior/exterior_skeleton_and_offset_polygons_with_holes_2: From 56c0696476d36b28b8012c052ca58ef1ba8a0d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:03:18 +0100 Subject: [PATCH 08/26] Add an alias for deduced (or not) return types --- .../CGAL/Straight_skeleton_2/Straight_skeleton_aux.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 d1bb004700e..606f8f27d0d 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 @@ -211,6 +213,10 @@ struct Default_return_polygon_type // Polygon type does NOT 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 @@ -238,6 +244,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 From 60e5e1570c2a44efb49c0e41784b0e2d5b01ea0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:04:01 +0100 Subject: [PATCH 09/26] Fix compilation --- .../include/CGAL/Straight_skeleton_builder_2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 d6177f02e4c..bcc7d2b65f4 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h @@ -1457,10 +1457,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; From 06e970d8866ec73e4b4a969546b57bced4c4a948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:07:02 +0100 Subject: [PATCH 10/26] Move towards honoring the concepts --- .../include/CGAL/arrange_offset_polygons_2.h | 15 ++++++++++----- ...te_offset_polygons_from_polygon_with_holes_2.h | 9 +++++++-- ...ed_offset_polygons_from_polygon_with_holes_2.h | 9 +++++++-- 3 files changed, 24 insertions(+), 9 deletions(-) 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 da2b6560fea..12a8b1e27eb 100644 --- a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -48,7 +49,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 boost::shared_ptr PolygonWithHolesPtr ; difference_type lSize = std::distance(aBegin,aEnd); @@ -61,14 +64,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 = boost::make_shared( + Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), + CGAL_SS_i::vertices_end(lPoly))); *rOut ++ = lOuter ; lTable[lIdx] = lOuter ; } @@ -100,7 +105,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_begin(lPoly))); } } 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 09e77e732d5..d2c81e4ceed 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 @@ -117,8 +117,13 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset, std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for (boost::shared_ptr ptr : raw_output) - ptr->reverse_orientation(); + for (boost::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); } 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 24420366e9b..e8addd76ef3 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 @@ -124,8 +124,13 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf std::swap(raw_output[0], raw_output.back()); raw_output.pop_back(); - for(boost::shared_ptr ptr : raw_output) - ptr->reverse_orientation(); + for (boost::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); } From 2f7db1db7453b7eac94e0967e53afae4b653f38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:10:23 +0100 Subject: [PATCH 11/26] Consistency between doc & code, use OutPolygon if provided, factorize code --- .../include/CGAL/create_offset_polygons_2.h | 139 +++++------------ ...ffset_polygons_from_polygon_with_holes_2.h | 132 ++++++---------- .../include/CGAL/create_straight_skeleton_2.h | 96 +++--------- .../CGAL/create_weighted_offset_polygons_2.h | 132 +++++----------- ...ffset_polygons_from_polygon_with_holes_2.h | 146 +++++++----------- .../create_weighted_straight_skeleton_2.h | 111 ++----------- ...aight_skeleton_from_polygon_with_holes_2.h | 4 +- 7 files changed, 216 insertions(+), 544 deletions(-) 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 5e1401c12c8..fd6f6570b0a 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 @@ -142,6 +141,8 @@ template std::vector< boost::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false ) { + static_assert(!std::is_same_v); + typedef boost::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; @@ -166,6 +167,8 @@ template std::vector< boost::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true ) { + static_assert(!std::is_same_v); + typedef boost::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; @@ -190,43 +193,39 @@ Skeleton const& dereference ( boost::shared_ptr const& ss ) } // namespace CGAL_SS_i -template +template std::vector< boost::shared_ptr > 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< boost::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< boost::shared_ptr > +template +std::vector< boost::shared_ptr > > 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< boost::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< boost::shared_ptr > +// Overload where APolygon is a simple polygon (no holes) +template +std::vector< boost::shared_ptr > > 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< boost::shared_ptr > +template +std::vector< boost::shared_ptr > > 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< boost::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< boost::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 d2c81e4ceed..2037a42fa80 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,18 +84,22 @@ 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()); @@ -131,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 8ef95ed7564..611cb7117e2 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 boost::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 -boost::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 boost::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 -boost::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 boost::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 -boost::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 boost::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 -boost::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 boost::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 -boost::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_weighted_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_offset_polygons_2.h index 19852c88904..97d4d68b561 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 @@ -202,10 +200,11 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset, //////////////////////////////////////////////////////////////////////////////////////////////////// /// INTERIOR -template::type> -std::vector< boost::shared_ptr > +template +std::vector< boost::shared_ptr > > inline create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, const APolygon& aOuterBoundary, @@ -214,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( @@ -254,69 +255,33 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, } } -template::type> -std::vector< boost::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< boost::shared_ptr > +template +std::vector< boost::shared_ptr > > 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); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -327,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< boost::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( @@ -346,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< boost::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< boost::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 e8addd76ef3..71ee51dc612 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 @@ -36,67 +35,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)); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -104,21 +86,25 @@ 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()); @@ -138,22 +124,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) @@ -161,42 +151,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, + {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 660cb8cb317..4181cf19741 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 @@ -33,7 +33,7 @@ namespace CGAL { template + typename K = Exact_predicates_inexact_constructions_kernel> boost::shared_ptr > create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin, PointIterator outer_contour_vertices_end, @@ -43,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; @@ -77,37 +77,16 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice return ssb.construct_skeleton(); } -template -boost::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> boost::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; @@ -127,51 +106,23 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice k); } -template -boost::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> boost::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 -boost::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()); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -180,14 +131,14 @@ create_interior_weighted_straight_skeleton_2(const Polygon& out_contour, template + typename K = Exact_predicates_inexact_constructions_kernel> boost::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)); @@ -259,59 +210,25 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, return skeleton; } -template -boost::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> boost::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 -boost::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 e6a2fea13b1..f9496b31de3 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 @@ -28,12 +28,12 @@ namespace CGAL { template + typename K = Exact_predicates_inexact_constructions_kernel> boost::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) { From 595ad9f883fa2322ff189bed5733de317bd6d113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:11:32 +0100 Subject: [PATCH 12/26] Fix using wrong types when converting the offset value --- .../include/CGAL/create_offset_polygons_2.h | 8 +++++--- .../include/CGAL/create_weighted_offset_polygons_2.h | 8 +++++--- .../include/CGAL/create_weighted_straight_skeleton_2.h | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) 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 fd6f6570b0a..cd63eec71b7 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -175,10 +175,12 @@ create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k* 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 ; } 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 97d4d68b561..bfc112a5e5f 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 @@ -127,6 +127,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_v::value_type, IFT>); + boost::shared_ptr > rSkeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) @@ -169,11 +171,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} 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 4181cf19741..b4eec6b8c21 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 @@ -147,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_v::value_type, IFT>); + boost::shared_ptr > skeleton; // That's because we might not have FT == IK::FT (e.g. `double` and `Core`) @@ -188,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} From 4d62746395268e7d7b1e02ae5373ac0ef1cbacc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:12:50 +0100 Subject: [PATCH 13/26] Fix typo --- Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 12a8b1e27eb..540406ef239 100644 --- a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h @@ -105,7 +105,7 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin if (lParent == nullptr) return false; - lParent->add_hole(Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), CGAL_SS_i::vertices_begin(lPoly))); + lParent->add_hole(Inner_polygon(CGAL_SS_i::vertices_begin(lPoly), CGAL_SS_i::vertices_end(lPoly))); } } From 97bde2a8b324073c86f3b81cbee60f3327b9cfe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:31:38 +0100 Subject: [PATCH 14/26] Clarify type --- .../create_weighted_offset_polygons_from_polygon_with_holes_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 71ee51dc612..ae1c57f2ab5 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 @@ -153,7 +153,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset, std::vector > hole_polygons = create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, hole, - {aWeights[weight_pos]}, + Weights{aWeights[weight_pos]}, ofk, ssk); polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end()); } From 13e8428caeeb5e4f2e162d7a38626d2a1ec367e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 14 Jan 2025 15:32:04 +0100 Subject: [PATCH 15/26] Add a lot of API tests for non-weighted skeletons --- .../Straight_skeleton_2/test_sls_offset.cpp | 231 +++++++++++++++--- 1 file changed, 193 insertions(+), 38 deletions(-) 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 48f92c02c14..4eb0dfa6bdc 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 @@ -32,90 +32,247 @@ 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< boost::shared_ptr > res; std::vector< boost::shared_ptr > res_EPICK; - std::vector< boost::shared_ptr > res_w; - std::vector< boost::shared_ptr > res_w_EPICK; + std::vector< boost::shared_ptr > res_wh; + std::vector< boost::shared_ptr > res_wh_EPICK; + + std::vector< boost::shared_ptr > res_test; + std::vector< boost::shared_ptr > res_test_EPICK; + std::vector< boost::shared_ptr > res_wh_test; + std::vector< boost::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 @@ -207,7 +364,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)); @@ -964,9 +1121,7 @@ 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; // Artificial data test_offset_square(); From 46ab7efe83b0ff59440771b15b79191d504ddbe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 15 Jan 2025 01:02:25 +0100 Subject: [PATCH 16/26] Add missing default --- .../create_straight_skeleton_from_polygon_with_holes_2.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 490ca07788a..21e3dfe7cbb 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 boost::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) { From 56a6053b94f118989921bade1bdd7d4cbec49c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 15 Jan 2025 01:02:37 +0100 Subject: [PATCH 17/26] Don't use C++17 yet --- .../include/CGAL/create_weighted_offset_polygons_2.h | 2 +- .../include/CGAL/create_weighted_straight_skeleton_2.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 bfc112a5e5f..96783aaa244 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 @@ -127,7 +127,7 @@ 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_v::value_type, IFT>); + static_assert((std::is_same::value_type, IFT>::value)); boost::shared_ptr > rSkeleton; 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 b4eec6b8c21..5dfe7354467 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 @@ -27,6 +27,7 @@ #include #include +#include #include namespace CGAL { @@ -147,7 +148,7 @@ 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_v::value_type, IFT>); + static_assert((std::is_same::value_type, IFT>::value)); boost::shared_ptr > skeleton; From baeed4a77f30d59c59f0890480c9dc797be0d103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 15 Jan 2025 11:55:07 +0100 Subject: [PATCH 18/26] Add more tests --- .../test/Straight_skeleton_2/CMakeLists.txt | 2 + .../Straight_skeleton_2/test_sls_simple.cpp | 4 +- .../test_sls_weighted_offset.cpp | 288 ++++++++++++++++++ .../test_sls_weighted_polygons.cpp | 145 +++++++++ .../test_sls_weighted_polygons_with_holes.cpp | 89 +++--- 5 files changed, 485 insertions(+), 43 deletions(-) create mode 100644 Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp create mode 100644 Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt index 44aab260541..893695a495c 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt +++ b/Straight_skeleton_2/test/Straight_skeleton_2/CMakeLists.txt @@ -23,5 +23,7 @@ if(CGAL_Qt5_FOUND) target_link_libraries(issue7284 PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_previous_issues PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_offset PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(test_sls_weighted_offset PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(test_sls_weighted_polygons PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(test_sls_weighted_polygons_with_holes PUBLIC CGAL::CGAL_Basic_viewer) endif() 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 c6ed9f99dc2..47071dc36a9 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 @@ -221,9 +221,7 @@ 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; 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..d8d99a7f3df --- /dev/null +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_offset.cpp @@ -0,0 +1,288 @@ +#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 + +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< boost::shared_ptr > res; + std::vector< boost::shared_ptr > res_EPICK; + std::vector< boost::shared_ptr > res_wh; + std::vector< boost::shared_ptr > res_wh_EPICK; + + std::vector< boost::shared_ptr > res_test; + std::vector< boost::shared_ptr > res_test_EPICK; + std::vector< boost::shared_ptr > res_wh_test; + std::vector< boost::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_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; +} + +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..c9b33805b1b --- /dev/null +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_weighted_polygons.cpp @@ -0,0 +1,145 @@ +#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 boost::shared_ptr Straight_skeleton_Ptr_EPICK; + + typedef CGAL::Straight_skeleton_2 Straight_skeleton; + typedef boost::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 Vector_2 = typename K::Vector_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 = boost::shared_ptr; + + using Mesh = CGAL::Surface_mesh; + + void (*dummy_ptr)() = &test_API; + + 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); + + auto ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pol, weights); + 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); + 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 30fda42afd3..2bd4df182e1 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 @@ -24,44 +25,34 @@ 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 = boost::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 Vector_2 = typename K::Vector_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 = boost::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]) : std::time(nullptr); + 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(10, 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), @@ -73,6 +64,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)); @@ -120,33 +113,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); + auto ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights); + 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; } From 92e31b78597cc2ef3b637ddc493f9ae1b0b6fa28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 15 Jan 2025 11:55:50 +0100 Subject: [PATCH 19/26] Misc tiny fixes --- Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 cd63eec71b7..0283ced78aa 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -128,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 ; @@ -177,8 +177,6 @@ create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k* OffsetBuilder ob(aSs); typename K::FT lOffset = aOffset; - - OutPolygonPtrVector rR ; ob.construct_offset_contours(lOffset, std::back_inserter(rR) ) ; From 22dd382e26bc7f98f80e9c465836a9eaa06c4b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 15 Jan 2025 12:31:25 +0100 Subject: [PATCH 20/26] Do not use c++17 in 5.6.x --- Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0283ced78aa..2a2a481dab0 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -141,7 +141,7 @@ template std::vector< boost::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false ) { - static_assert(!std::is_same_v); + static_assert(!(std::is_same::value)); typedef boost::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; @@ -167,7 +167,7 @@ template std::vector< boost::shared_ptr > create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true ) { - static_assert(!std::is_same_v); + static_assert(!(std::is_same::value)); typedef boost::shared_ptr OutPolygonPtr ; typedef std::vector OutPolygonPtrVector ; From 79d6f4c4d4a2214c82d51f8e9bc1d9799e7c9b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 20 Jan 2025 10:43:45 +0100 Subject: [PATCH 21/26] Fix warnings --- .../test/Straight_skeleton_2/test_sls_offset.cpp | 3 +++ .../test/Straight_skeleton_2/test_sls_simple.cpp | 3 +++ .../test/Straight_skeleton_2/test_sls_weighted_offset.cpp | 3 +++ .../Straight_skeleton_2/test_sls_weighted_polygons.cpp | 8 +++++--- .../test_sls_weighted_polygons_with_holes.cpp | 4 ++-- 5 files changed, 16 insertions(+), 5 deletions(-) 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 4eb0dfa6bdc..bc024d9c8d3 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 @@ -21,6 +21,8 @@ #include #include +#include + #include #include @@ -1122,6 +1124,7 @@ void test_kernel() std::cerr.precision(17); 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 47071dc36a9..889f2968e64 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,6 +34,8 @@ void Straight_skeleton_traits_external_trace(std::string m) #include #include +#include + #include #include @@ -222,6 +224,7 @@ void test_kernel() // CGAL_STSKEL_TRAITS_ENABLE_TRACE 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 index d8d99a7f3df..40fd4aede6f 100644 --- 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 @@ -12,6 +12,8 @@ #include #include +#include + #include #include @@ -271,6 +273,7 @@ template void test_kernel() { void (*dummy_ptr)() = &test_API; + CGAL_USE(dummy_ptr); } int main(int, char**) 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 index c9b33805b1b..eff1304512a 100644 --- 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 @@ -18,6 +18,8 @@ #include #include +#include + #include #include @@ -62,7 +64,6 @@ void test_kernel(const int polygon_nv, CGAL::Random& rnd) { using FT = typename K::FT; using Point_2 = typename K::Point_2; - using Vector_2 = typename K::Vector_2; using Point_3 = typename K::Point_3; using Polygon_2 = CGAL::Polygon_2; @@ -73,6 +74,7 @@ void test_kernel(const int polygon_nv, CGAL::Random& rnd) 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; @@ -92,7 +94,7 @@ void test_kernel(const int polygon_nv, CGAL::Random& rnd) CGAL::draw(pol); - auto ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pol, weights); + Straight_skeleton_2_ptr ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pol, weights, K()); assert(ss_ptr); if(!ss_ptr) { @@ -102,7 +104,7 @@ void test_kernel(const int polygon_nv, CGAL::Random& rnd) CGAL::draw(*ss_ptr); - ss_ptr = CGAL::create_exterior_weighted_straight_skeleton_2(0.1, pol, weights); + ss_ptr = CGAL::create_exterior_weighted_straight_skeleton_2(0.1, pol, weights, K()); assert(ss_ptr); if(!ss_ptr) { 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 2bd4df182e1..c924877abc1 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 @@ -50,7 +50,7 @@ void test_kernel(const int hole_n, const int hole_nv, CGAL::Random& rnd) typedef CGAL::Random_points_in_square_2 Point_generator; Polygon_2 poly; - CGAL::random_polygon_2(10, std::back_inserter(poly), Point_generator(0.25, rnd)); + CGAL::random_polygon_2(hole_nv, std::back_inserter(poly), Point_generator(0.25, rnd)); return poly; }; @@ -115,7 +115,7 @@ void test_kernel(const int hole_n, const int hole_nv, CGAL::Random& rnd) // CGAL::draw(pwh); - auto ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights); + Straight_skeleton_2_ptr ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2(pwh, weights, K()); assert(ss_ptr); if(!ss_ptr) { From 74cab200c11c7fb7b7b0865b4658b7419ee99bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 21 Jan 2025 08:59:26 +0100 Subject: [PATCH 22/26] Fix warning --- .../test_sls_weighted_polygons_with_holes.cpp | 1 - 1 file changed, 1 deletion(-) 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 c924877abc1..ffa31c47d5b 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 @@ -34,7 +34,6 @@ void test_kernel(const int hole_n, const int hole_nv, CGAL::Random& rnd) { using FT = typename K::FT; using Point_2 = typename K::Point_2; - using Vector_2 = typename K::Vector_2; using Point_3 = typename K::Point_3; using Polygon_2 = CGAL::Polygon_2; From f7a57a6c41a289e4905c29761304b8b38dbaf946 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 17 Jan 2025 10:16:08 +0000 Subject: [PATCH 23/26] Add smaller failing issue --- Nef_3/test/Nef_3/issue8644bis.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Nef_3/test/Nef_3/issue8644bis.cpp diff --git a/Nef_3/test/Nef_3/issue8644bis.cpp b/Nef_3/test/Nef_3/issue8644bis.cpp new file mode 100644 index 00000000000..f419094bfc6 --- /dev/null +++ b/Nef_3/test/Nef_3/issue8644bis.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using Kernel = CGAL::Extended_cartesian; +using Nef = CGAL::Nef_polyhedron_3; + +int main(int argc, char ** argv) +{ + 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; // Line 14. Works fine. + Nef intersection_2 = hspace_2*hspace_3; // Line 15. Assertion failure. + + return 0; +} From f20af1a946ca9255963b965e54178b66f302df93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 30 Jan 2025 18:17:12 +0100 Subject: [PATCH 24/26] fix the value used creating the infimax box used for pairing halfedges without the abs the intersection line of x=-1 and z=-1 would be on the box leading to invalid behavior (and degenerate halfedges) --- Nef_3/include/CGAL/Nef_3/Infimaximal_box.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; From ca17f813b6102230ec6c4c73d4740e2a86349153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 30 Jan 2025 18:24:06 +0100 Subject: [PATCH 25/26] fix debug --- .../CGAL/Nef_2/Segment_overlay_traits.h | 1 + Nef_3/include/CGAL/Nef_3/K3_tree.h | 2 +- .../CGAL/Nef_3/SNC_external_structure.h | 22 ++++++++++++------- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 4 ++-- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 4 ++-- Nef_3/test/Nef_3/issue8644bis.cpp | 8 +++---- 6 files changed, 24 insertions(+), 17 deletions(-) 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_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 "<; using Nef = CGAL::Nef_polyhedron_3; -int main(int argc, char ** argv) +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; // Line 14. Works fine. - Nef intersection_2 = hspace_2*hspace_3; // Line 15. Assertion failure. - + Nef intersection_1 = hspace_1*hspace_2; + Nef intersection_2 = hspace_2*hspace_3; + return 0; } From 3abe02075b92dcc03354a21315c8ab5da25e29cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 1 Feb 2025 23:11:25 +0100 Subject: [PATCH 26/26] GMP is not always available --- Nef_3/test/Nef_3/issue8644bis.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_3/test/Nef_3/issue8644bis.cpp b/Nef_3/test/Nef_3/issue8644bis.cpp index 6968f704c4e..1424419e6cf 100644 --- a/Nef_3/test/Nef_3/issue8644bis.cpp +++ b/Nef_3/test/Nef_3/issue8644bis.cpp @@ -1,8 +1,8 @@ #include -#include +#include #include -using Kernel = CGAL::Extended_cartesian; +using Kernel = CGAL::Extended_cartesian; using Nef = CGAL::Nef_polyhedron_3; int main()