From d6f9ba76a5cee06aa9ec795b4611216434a1a9cf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 18 Nov 2015 09:01:55 +1100 Subject: KDTree: add BLI_kdtree_range_search_cb This performs a range search on the kdtree, running a callback instead of allocating an array. Allows the caller to perform extra checks in the case of overlap, avoids redundant array allocations, since caller can handle matches. --- source/blender/blenlib/BLI_kdtree.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenlib/BLI_kdtree.h') diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h index a3ecfb898c3..d488dbce1fd 100644 --- a/source/blender/blenlib/BLI_kdtree.h +++ b/source/blender/blenlib/BLI_kdtree.h @@ -58,6 +58,10 @@ int BLI_kdtree_find_nearest( #define BLI_kdtree_range_search(tree, co, r_nearest, range) \ BLI_kdtree_range_search__normal(tree, co, NULL, r_nearest, range) +void BLI_kdtree_range_search_cb( + const KDTree *tree, const float co[3], float range, + bool (*search_cb)(void *user_data, int index, const float co[3], float dist_sq), void *user_data); + /* Normal use is deprecated */ /* remove __normal functions when last users drop */ int BLI_kdtree_find_nearest_n__normal( -- cgit v1.2.3