[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32644] trunk/blender/source/blender/ blenlib/intern/math_rotation.c: eulO_to_quat wasn't functional for XZY, YXZ , ZYX rotation orders.

Campbell Barton ideasman42 at gmail.com
Fri Oct 22 05:27:03 CEST 2010


Revision: 32644
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32644
Author:   campbellbarton
Date:     2010-10-22 05:27:01 +0200 (Fri, 22 Oct 2010)

Log Message:
-----------
eulO_to_quat wasn't functional for XZY, YXZ, ZYX rotation orders.
it also modified the input rotation value which isn't expected for these functions.

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-10-22 01:06:21 UTC (rev 32643)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-10-22 03:27:01 UTC (rev 32644)
@@ -1083,10 +1083,10 @@
 	double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
 	double a[3];
 	
-	ti = e[i]/2; tj = e[j]/2; th = e[k]/2;
-	
-	if (R->parity) e[j] = -e[j];
-	
+	ti = e[i] * 0.5f;
+	tj = e[j] * (R->parity ? -0.5f : 0.5f);
+	th = e[k] * 0.5f;
+
 	ci = cos(ti);  cj = cos(tj);  ch = cos(th);
 	si = sin(ti);  sj = sin(tj);  sh = sin(th);
 	
@@ -1102,7 +1102,7 @@
 	q[2] = a[1];
 	q[3] = a[2];
 	
-	if (R->parity) q[j] = -q[j];
+	if (R->parity) q[j+1] *= -1.0f;
 }
 
 /* Convert quaternion to Euler angles (in radians). */





More information about the Bf-blender-cvs mailing list