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.
This commit is contained in:
Campbell Barton 2019-02-27 00:09:38 +11:00
parent 15edae617f
commit 34c7dbdd7d
1 changed files with 3 additions and 0 deletions

View File

@ -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 */