diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 7c79381c5cd..a65d2ca6ea0 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -444,13 +444,6 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, float *co, int numpoi bv[(2 * i) + 1] = newminmax; } } - - // inflate the bv with some epsilon - for (i = tree->start_axis; i < tree->stop_axis; i++) - { - bv[(2 * i)] -= tree->epsilon; // minimum - bv[(2 * i) + 1] += tree->epsilon; // maximum - } } // depends on the fact that the BVH's for each face is already build @@ -486,6 +479,7 @@ static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end) int BLI_bvhtree_insert(BVHTree *tree, int index, float *co, int numpoints) { + int i; BVHNode *node = NULL; // insert should only possible as long as tree->totbranch is 0 @@ -503,6 +497,13 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, float *co, int numpoints) create_kdop_hull(tree, node, co, numpoints, 0); node->index= index; + // inflate the bv with some epsilon + for (i = tree->start_axis; i < tree->stop_axis; i++) + { + node->bv[(2 * i)] -= tree->epsilon; // minimum + node->bv[(2 * i) + 1] += tree->epsilon; // maximum + } + return 1; } @@ -877,6 +878,7 @@ static void node_join(BVHTree *tree, BVHNode *node) // call before BLI_bvhtree_update_tree() int BLI_bvhtree_update_node(BVHTree *tree, int index, float *co, float *co_moving, int numpoints) { + int i; BVHNode *node= NULL; // check if index exists @@ -890,6 +892,13 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, float *co, float *co_movin if(co_moving) create_kdop_hull(tree, node, co_moving, numpoints, 1); + // inflate the bv with some epsilon + for (i = tree->start_axis; i < tree->stop_axis; i++) + { + node->bv[(2 * i)] -= tree->epsilon; // minimum + node->bv[(2 * i) + 1] += tree->epsilon; // maximum + } + return 1; } |