Revision: 16443 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16443 Author: blendix Date: 2008-09-09 22:00:57 +0200 (Tue, 09 Sep 2008)
Log Message: ----------- Fix for bug #17443: make bone heat weighting solve a bit less sensitive to poorly shaped geometry, should succeed solving in more cases now. Modified Paths: -------------- trunk/blender/source/blender/src/meshlaplacian.c Modified: trunk/blender/source/blender/src/meshlaplacian.c =================================================================== --- trunk/blender/source/blender/src/meshlaplacian.c 2008-09-09 19:00:16 UTC (rev 16442) +++ trunk/blender/source/blender/src/meshlaplacian.c 2008-09-09 20:00:57 UTC (rev 16443) @@ -178,6 +178,7 @@ varea[i1] += (obtuse == 1)? area: area*0.5; varea[i2] += (obtuse == 2)? area: area*0.5; varea[i3] += (obtuse == 3)? area: area*0.5; + //printf("area %f\n", area); } else { len1= VecLenf(v2, v3); @@ -191,7 +192,10 @@ varea[i1] += (t2 + t3)*0.25f; varea[i2] += (t1 + t3)*0.25f; varea[i3] += (t1 + t2)*0.25f; + //printf("varea %f %f %f\n", t1, t2, t3); } + + //printf("triangle area %f %f %f\n", t1, t2, t3); } static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int i2, int i3) @@ -204,7 +208,7 @@ v3= sys->verts[i3]; /* instead of *0.5 we divided by the number of faces of the edge, it still - needs to be varified that this is indeed the correct thing to do! */ + needs to be verified that this is indeed the correct thing to do! */ t1= cotan_weight(v1, v2, v3)/laplacian_edge_count(sys->edgehash, i2, i3); t2= cotan_weight(v2, v3, v1)/laplacian_edge_count(sys->edgehash, i3, i1); t3= cotan_weight(v3, v1, v2)/laplacian_edge_count(sys->edgehash, i1, i2); @@ -229,7 +233,7 @@ } } -LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface) +LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface, int lsq) { LaplacianSystem *sys; @@ -248,6 +252,8 @@ /* create opennl context */ nlNewContext(); nlSolverParameteri(NL_NB_VARIABLES, totvert); + if(lsq) + nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE); sys->context= nlGetCurrent(); @@ -292,7 +298,7 @@ for(a=0; a<totvert; a++) { if(sys->areaweights) { if(sys->varea[a] != 0.0f) - sys->varea[a]= 0.5f/sys->varea[a]; + sys->varea[a]= 0.5f/sys->varea[a]; //MAX2(sys->varea[a], 0.001f); } else sys->varea[a]= 1.0f; @@ -631,7 +637,7 @@ } /* create laplacian */ - sys = laplacian_system_construct_begin(me->totvert, totface); + sys = laplacian_system_construct_begin(me->totvert, totface, 1); sys->heat.mesh= me; sys->heat.verts= verts; @@ -933,7 +939,7 @@ } /* create laplacian */ - sys = laplacian_system_construct_begin(totvert, totface); + sys = laplacian_system_construct_begin(totvert, totface, 0); sys->rigid.mesh= em; sys->rigid.R = MEM_callocN(sizeof(float)*3*3*totvert, "RigidDeformR"); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs