diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-09-22 13:38:11 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-09-22 13:38:11 +0400 |
commit | b6d28b585001bcee99e60660454313ca63d104c4 (patch) | |
tree | fd783a5e089211822946f2f17cd560948198ca56 /source/blender/blenkernel/intern/shrinkwrap.c | |
parent | 764a760c66608a396daa0dfe398d665bee8ce7f3 (diff) |
Fix for [#21718] Shrinkwrap's "Project" mode with offset gives wrong results.
* normal offset not taken properly into account
* wrong usage of BVHTree (epsilon != radius) caused massive slowdowns in calculations, for example just opening test file took about 30 s on my machine, after fix about 0.5 s :)
Diffstat (limited to 'source/blender/blenkernel/intern/shrinkwrap.c')
-rw-r--r-- | source/blender/blenkernel/intern/shrinkwrap.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 01652aaa713..f64854f90de 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -337,7 +337,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, struct S } //After sucessufuly build the trees, start projection vertexs - if( bvhtree_from_mesh_faces(&treeData, calc->target, calc->keepDist, 4, 6) + if( bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) && (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6))) { @@ -383,6 +383,9 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, struct S normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData); normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData); + + if(hit.index != -1) + madd_v3_v3v3fl(hit.co, hit.co, tmp_no, -calc->keepDist); } //Project over negative direction of axis @@ -395,6 +398,9 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, struct S normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData); normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData); + + if(hit.index != -1) + madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist); } |