diff --git a/source/blender/blenlib/BLI_math_matrix.hh b/source/blender/blenlib/BLI_math_matrix.hh index 4ebdd487be3..9b33fb38440 100644 --- a/source/blender/blenlib/BLI_math_matrix.hh +++ b/source/blender/blenlib/BLI_math_matrix.hh @@ -924,6 +924,21 @@ template QuaternionBase normalized_to_quat_fast(const MatBase= threshold) { + const T q_len_inv = 1.0 / math::sqrt(q_len_squared); + q.x *= q_len_inv; + q.y *= q_len_inv; + q.z *= q_len_inv; + q.w *= q_len_inv; + } + BLI_assert(math::is_unit_scale(VecBase(q))); return q; }