diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-05-05 23:00:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-05-05 23:14:36 +0300 |
commit | cc650c3d075566c760088e59a316c7efee14fd4a (patch) | |
tree | 86fa7276fdc5b0eef0e95a7b863bb05f79b9c971 /source/blender/blenlib | |
parent | 7efdee75177eb43909e825499330c554d91853f1 (diff) |
Add asserts to check bvhutils args are correct
Would have prevented previous error going unnoticed.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_kdopbvh.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index be792669ef1..4813e7b40ca 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -132,6 +132,8 @@ BVHTreeOverlap *BLI_bvhtree_overlap( const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot, BVHTree_OverlapCallback callback, void *userdata); +int BLI_bvhtree_get_size(const BVHTree *tree); + float BLI_bvhtree_getepsilon(const BVHTree *tree); /* find nearest node to the given coordinates diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index bba3fdb37bc..f0fc2c70708 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1114,6 +1114,14 @@ void BLI_bvhtree_update_tree(BVHTree *tree) for (; index >= root; index--) node_join(tree, *index); } +/** + * Number of times #BLI_bvhtree_insert has been called. + * mainly useful for asserts functions to check we added the correct number. + */ +int BLI_bvhtree_get_size(const BVHTree *tree) +{ + return tree->totleaf; +} float BLI_bvhtree_getepsilon(const BVHTree *tree) { |