[Bf-blender-cvs] [34c7dbdd7d5] master: BLI_math: quat_to_axis_angle was zeroing the axis
Campbell Barton
noreply at git.blender.org
Tue Feb 26 14:14:08 CET 2019
Commit: 34c7dbdd7d598949d54b73a40828c951e209b8a6
Author: Campbell Barton
Date: Wed Feb 27 00:09:38 2019 +1100
Branches: master
https://developer.blender.org/rB34c7dbdd7d598949d54b73a40828c951e209b8a6
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.
===================================================================
M source/blender/blenlib/intern/math_rotation.c
===================================================================
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 */
More information about the Bf-blender-cvs
mailing list