[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32055] trunk/blender/source/blender/ blenkernel/intern/shrinkwrap.c: Fix for [#21718] Shrinkwrap's "Project" mode with offset gives wrong results.

Janne Karhu jhkarh at gmail.com
Wed Sep 22 11:38:11 CEST 2010


Revision: 32055
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32055
Author:   jhk
Date:     2010-09-22 11:38:11 +0200 (Wed, 22 Sep 2010)

Log Message:
-----------
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 :)

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c

Modified: trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c	2010-09-22 08:51:18 UTC (rev 32054)
+++ trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c	2010-09-22 09:38:11 UTC (rev 32055)
@@ -337,7 +337,7 @@
 	}
 
 	//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 @@
 					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 @@
 					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);
 			}
 
 





More information about the Bf-blender-cvs mailing list