From 78296d3b172fc40b90f95feac13239e0b42ad9b2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 14 Jan 2025 17:26:01 +0000 Subject: [PATCH] Fix the Cartesian const iterator --- .../Frechet_distance/internal/Neighbor_search.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/Neighbor_search.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/Neighbor_search.h index 4a59c481129..67c48373c55 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/Neighbor_search.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/Neighbor_search.h @@ -55,22 +55,24 @@ class FrechetKdTree struct Point_d { using BB = Bbox_d>; Point ends[2]; + BB endsbbox; BB bbox; - using PP = Concatenate_iterator; - using Cartesian_const_iterator_d = Concatenate_iterator; + // using PP = Concatenate_iterator; + using Bbcci = typename BB::Cartesian_const_iterator; + using Cartesian_const_iterator_d = Concatenate_iterator; Cartesian_const_iterator_d cartesian_begin() const { Construct_cartesian_const_iterator ccc; - PP ppb(ccc(ends[0],0), ccc(ends[1]), ccc(ends[0])); - PP ppe(ccc(ends[0],0), ccc(ends[1]), ccc(ends[1],0),0); + Bbcci ppb = endsbbox.cartesian_begin(); + Bbcci ppe = endsbbox.cartesian_end(); return Cartesian_const_iterator_d(ppe, bbox.cartesian_begin(), ppb); } Cartesian_const_iterator_d cartesian_end() const { Construct_cartesian_const_iterator ccc; - PP ppe(ccc(ends[0],0), ccc(ends[1]), ccc(ends[1],0),0); + Bbcci ppe = endsbbox.cartesian_end(); return Cartesian_const_iterator_d(ppe, bbox.cartesian_begin(), bbox.cartesian_end(), 0); } @@ -231,6 +233,7 @@ auto FrechetKdTree::to_kd_tree_point(const Polyline& curve) -> Point_d res.ends[0] = curve.front(); res.ends[1] = curve.back(); + res.endsbbox = bbox(res.ends[0]) + bbox(res.ends[1]); for (auto const& point : curve) { Bbox_d> bb = bbox(point); res.bbox += bb;