summaryrefslogtreecommitdiff
path: root/src/Spatial_searching/test
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-08-05 14:22:57 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-08-05 14:22:57 +0000
commit5bc90cf2f92f07a45a7104bd771d52bd0985fb9a (patch)
tree1a501a20c3370e9b54dc32c72304e812b2412e67 /src/Spatial_searching/test
parent6cdf1246015e1ce8c87a938f7fb2ccde787e5d4c (diff)
Added farthest/nearest neighbor division in the functions
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1424 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b42ad020d144ea4c0b4d726764fc0d4234f5b0b3
Diffstat (limited to 'src/Spatial_searching/test')
-rw-r--r--src/Spatial_searching/test/test_Spatial_tree_data_structure.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Spatial_searching/test/test_Spatial_tree_data_structure.cpp b/src/Spatial_searching/test/test_Spatial_tree_data_structure.cpp
index 916710ef..0ca35bc6 100644
--- a/src/Spatial_searching/test/test_Spatial_tree_data_structure.cpp
+++ b/src/Spatial_searching/test/test_Spatial_tree_data_structure.cpp
@@ -51,10 +51,10 @@ BOOST_AUTO_TEST_CASE(test_Spatial_tree_data_structure)
Points_ds points_ds(points);
std::size_t closest_pt_index =
- points_ds.query_ANN(points[10], 1, false).begin()->first;
+ points_ds.query_k_nearest_neighbors(points[10], 1, false).begin()->first;
BOOST_CHECK(closest_pt_index == 10);
- auto kns_range = points_ds.query_ANN(points[20], 10, true);
+ auto kns_range = points_ds.query_k_nearest_neighbors(points[20], 10, true);
FT last_dist = -1.;
for (auto const& nghb : kns_range)
@@ -62,4 +62,13 @@ BOOST_AUTO_TEST_CASE(test_Spatial_tree_data_structure)
BOOST_CHECK(nghb.second > last_dist);
last_dist = nghb.second;
}
+
+ auto kfs_range = points_ds.query_k_farthest_neighbors(points[20], 10, true);
+
+ last_dist = kfs_range.begin()->second;
+ for (auto const& nghb : kfs_range)
+ {
+ BOOST_CHECK(nghb.second <= last_dist);
+ last_dist = nghb.second;
+ }
}