From 0311b1c6f29e1d5c5b9a3502493b7a8353f5a12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Mon, 16 Dec 2024 16:07:52 +0100 Subject: [PATCH] Add some comments after talking to AF. --- .../internal/Frechet_distance_near_neighbors_ds.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_distance_near_neighbors_ds.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_distance_near_neighbors_ds.h index 331c2aeeef8..0238f60f324 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_distance_near_neighbors_ds.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/Frechet_distance_near_neighbors_ds.h @@ -100,12 +100,14 @@ class FrechetKdTree // AF: In case Point stays the input point type we have // to robustify with interval arithmetic // here: certainly + // AN: yes, here we need certainly! if (compare_squared_distance(a, b, distance_sqr) == LARGER) { return false; } } for (size_t i = 4; i < 8; ++i) { // AF: certainly + // AN: yes, here we need certainly! if (CGAL::abs(p[i] - q[i]) > distance) { return false; } @@ -118,12 +120,16 @@ class FrechetKdTree for (int d = 0; d < D::value; ++d) { if (rect.min_coord(d) > p[d] + distance && rect.max_coord(d) + distance < p[d]) { - // AF: certainly + // AF: certainly + // AN: yes, here is really certainly! return false; } } return true; } + + // AN: here we cannot really do anything wrong; if we return false, we continue searching; + // if we return true, we return all points inside which is also fine as we check them later. bool outer_range_contains(const Kd_tree_rectangle& rect) const { // check if rect[0:2] is contained in circle of start point AND @@ -138,7 +144,6 @@ class FrechetKdTree {rect.min_coord(i + 1), rect.max_coord(i + 1)}) { if (compare_squared_distance(Point(x, y), point, distance_sqr) == LARGER) { - // AF: certainly return false; } } @@ -151,11 +156,11 @@ class FrechetKdTree for (std::size_t i = 4; i < 8; ++i) { if (p[i] - distance > rect.min_coord(i) || p[i] + distance < rect.max_coord(i)) { - // AF: certainly return false; } } + // AN: This has to be certainly!! return true; } };