Revision: 27090
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27090
Author: blendix
Date: 2010-02-22 19:53:46 +0100 (Mon, 22 Feb 2010)
Log Message:
-----------
Fix dual quaternions flipping in case of stretched (not scaled) bones.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/math_rotation.c
Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c 2010-02-22
18:07:16 UTC (rev 27089)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c 2010-02-22
18:53:46 UTC (rev 27090)
@@ -1333,8 +1333,14 @@
if((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4) {
/* extract R and S */
- mat4_to_quat(basequat,baseRS);
- quat_to_mat4(baseR,basequat);
+ float tmp[4][4];
+
+ /* extra orthogonalize, to avoid flipping with stretched bones
*/
+ copy_m4_m4(tmp, baseRS);
+ orthogonalize_m4(tmp, 1);
+ mat4_to_quat(basequat, tmp);
+
+ quat_to_mat4(baseR, basequat);
copy_v3_v3(baseR[3], baseRS[3]);
invert_m4_m4(baseinv, basemat);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs