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 :)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user