From b4422374a05d01964f953639e730f9e75d2acce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 28 Mar 2025 12:51:07 +0100 Subject: [PATCH 1/4] Fix Compare_xy_2 for the generic 3D projection traits The previous implementation defined Compare_xy_2 as simply Compare_xyz_3. This does define an order over the projected points, but it has a strong downside: it ignores the direction of the normal, so its order can be the opposite of the lexicographical order would give. This new order is in conflict with the existing Compare_x_2 and Compare_y_2, which take the normal's direction into account. (Also with the Less_x_2, Less_y_2, and Less_xy_2 family, which also exist for the projection traits). --- .../internal/Projection_traits_base_3.h | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h index e179fecc677..24ba8b3637c 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h @@ -372,6 +372,35 @@ public: } }; // end class Less_xy_along_axis +template +class Compare_xy_along_axis +{ + // private members + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::Point_2 Point; + Vector_3 base1, base2; + +public: + Compare_xy_along_axis(const Vector_3& base1, const Vector_3& base2) : base1(base1), base2(base2) + { + CGAL_PROFILER("Construct Compare_xy_along_axis") + CGAL_TIME_PROFILER("Construct Compare_xy_along_axis") + } + + typedef Comparison_result result_type; + + Comparison_result operator()(const Point& p, const Point& q) const + { + Compare_along_axis cx(base1); + Comparison_result crx = cx(p, q); + if (crx != EQUAL) { + return crx; + } + Compare_along_axis cy(base2); + return cy(p, q); + } +}; // end class Compare_xy_along_axis + } // end namespace TriangulationProjectionTraitsCartesianFunctors @@ -426,12 +455,13 @@ public: typedef typename K::Line_3 Line_2; typedef typename K::Angle_3 Angle_2; - typedef typename K::Compare_xyz_3 Compare_xy_2; typedef TriangulationProjectionTraitsCartesianFunctors:: Compare_along_axis Compare_x_2; typedef TriangulationProjectionTraitsCartesianFunctors:: Compare_along_axis Compare_y_2; + typedef TriangulationProjectionTraitsCartesianFunctors:: + Compare_xy_along_axis Compare_xy_2; typedef TriangulationProjectionTraitsCartesianFunctors:: Less_along_axis Less_x_2; @@ -498,6 +528,12 @@ public: return Compare_y_2(this->base2()); } + Compare_xy_2 + compare_xy_2_object() const + { + return Compare_xy_2(this->base1(), this->base2()); + } + Orientation_2 orientation_2_object() const { @@ -525,9 +561,6 @@ public: Angle_2 angle_2_object() const {return Angle_2();} - Compare_xy_2 compare_xy_2_object() const - {return Compare_xy_2();} - Construct_point_2 construct_point_2_object() const {return Construct_point_2();} From 32ac9f22a78b96e86cf2f7bf77308649adcc9fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 1 Apr 2025 15:43:43 +0200 Subject: [PATCH 2/4] work around overload resolution with recent gcc --- Convex_hull_3/include/CGAL/convex_hull_3.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 18a11329308..ef7721388ac 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -70,6 +70,8 @@ template class Extreme_points_traits_ada namespace Convex_hull_3 { namespace internal { +BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Collinear_3, Collinear_3, false) + // wrapper used as a MutableFaceGraph to extract extreme points template struct Output_iterator_wrapper @@ -994,7 +996,8 @@ void convex_hull_3(InputIterator first, InputIterator beyond, template void convex_hull_3(InputIterator first, InputIterator beyond, PolygonMesh& polyhedron, - const Traits& traits) + const Traits& traits, + std::enable_if_t::value>* = 0) { typedef typename Traits::Point_3 Point_3; typedef std::list Point_3_list; From 2ccb0f732020d5f4c9929e01cb813452692bf3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Apr 2025 09:06:49 +0200 Subject: [PATCH 3/4] add missing include directive --- Convex_hull_3/include/CGAL/convex_hull_3.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index ef7721388ac..a463f7aabd8 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -46,6 +46,7 @@ #include #include #include +#include #include From 60b4b19ba4aecc15f0e361592b16b008ada24d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Apr 2025 09:10:51 +0200 Subject: [PATCH 4/4] add more potentially missing include directives --- .../include/CGAL/Optimal_bounding_box/oriented_bounding_box.h | 1 + .../include/CGAL/Polygon_mesh_processing/intersection.h | 1 + 2 files changed, 2 insertions(+) diff --git a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h index 61cabd171f8..b4c79172810 100644 --- a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h +++ b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h @@ -35,6 +35,7 @@ #include #endif +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index 7d1b1b6e6bf..b4c6d2e822d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -28,6 +28,7 @@ #include #include +#include #include #include