diff options
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 2cf0e1b41ae..7ecc271fa2a 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -272,6 +272,10 @@ void quat_to_mat4(float m[4][4], const float q[4]) void mat3_normalized_to_quat(float q[4], const float mat[3][3]) { BLI_ASSERT_UNIT_M3(mat); + /* Callers must ensure matrices have a positive determinant for valid results, see: T94231. */ + BLI_assert_msg(!is_negative_m3(mat), + "Matrix 'mat' must not be negative, the resulting quaternion will be invalid. " + "The caller should call negate_m3(mat) if is_negative_m3(mat) returns true."); /* Check the trace of the matrix - bad precision if close to -1. */ const float trace = mat[0][0] + mat[1][1] + mat[2][2]; |