diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-18 01:01:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-18 02:51:54 +0300 |
commit | d6f9ba76a5cee06aa9ec795b4611216434a1a9cf (patch) | |
tree | cbfd2c54b5d20e7bce0eed25421a65ce78b21acc /source/blender/blenlib/BLI_kdtree.h | |
parent | 1dc1e9e4aeb1eea6116d56eda1dd6c5daede63ff (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/BLI_kdtree.h')
-rw-r--r-- | source/blender/blenlib/BLI_kdtree.h | 4 |
1 files changed, 4 insertions, 0 deletions
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( |