diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-26 16:09:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-26 16:11:23 +0300 |
commit | 34c7dbdd7d598949d54b73a40828c951e209b8a6 (patch) | |
tree | 5976e3460991f6a6cbad055e01833080eb527650 /source/blender/blenlib/intern/math_rotation.c | |
parent | 15edae617fa4e77095953932b0e3120e91d5beb5 (diff) |
BLI_math: quat_to_axis_angle was zeroing the axis
When there was no rotation the axis was zerod,
while not exactly a bug, it means changing the angle does nothing
and all axis-angle values are initialized with Y=1,
use this convention when resetting the axis too.
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index a8629e93483..53c7d5e6576 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -938,6 +938,9 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4]) axis[0] = q[1] / si; axis[1] = q[2] / si; axis[2] = q[3] / si; + if (is_zero_v3(axis)) { + axis[1] = 1.0f; + } } /* Axis Angle to Euler Rotation */ |