Fixed double inflation in case of co_moving points
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user