Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-22 07:27:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-22 07:27:01 +0400
commitbcac1def4c1b459e116ae1957e8ac4e20a7d9192 (patch)
treee7275a1a002a1852f57aaab8daef9d049559b242 /source/blender/blenlib/intern/math_rotation.c
parent97784a7186f00e5eea1b241e528ea105ddcdef64 (diff)
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.
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r--source/blender/blenlib/intern/math_rotation.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 3b58fe88bf5..09cb02ce56a 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1083,10 +1083,10 @@ void eulO_to_quat(float q[4],float e[3], short order)
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 @@ void eulO_to_quat(float q[4],float e[3], short order)
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). */