Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Susano Pinto <andresusanopinto@gmail.com>2008-08-04 15:50:36 +0400
committerAndre Susano Pinto <andresusanopinto@gmail.com>2008-08-04 15:50:36 +0400
commitd786fead104fc4ce1a42286631fb74a3b0dfd620 (patch)
tree9810b792d5030097cd1eb82483e8c97c21018b75 /source/blender/blenlib
parentc2cd6bebe609db6b8079b30ee90b3d9f9abb0e2d (diff)
Fixed double inflation in case of co_moving points
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c23
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;
}