From fd41b99393902aa8f3cc071df19871a4cbd02e9f Mon Sep 17 00:00:00 2001 From: BenPinet Date: Thu, 28 Nov 2024 12:09:39 +0100 Subject: [PATCH] feat(NnSearch): add temporary possibility to find mapping in nn_search --- include/geode/geometry/nn_search.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/geode/geometry/nn_search.hpp b/include/geode/geometry/nn_search.hpp index b785f5980..6f390e1e1 100644 --- a/include/geode/geometry/nn_search.hpp +++ b/include/geode/geometry/nn_search.hpp @@ -23,6 +23,7 @@ #pragma once +#include #include #include @@ -53,6 +54,17 @@ namespace geode return colocated_mapping.size() - nb_unique_points(); } + [[nodiscard]] geode::GenericMapping< geode::index_t > + points_mapping() const + { + geode::GenericMapping< geode::index_t > mapping; + for( const auto& p : geode::Indices{ colocated_mapping } ) + { + mapping.map( p, colocated_mapping[p] ); + } + return mapping; + } + std::vector< Point< dimension > > unique_points; /*! * This list has the size of the number of points in the tree.