Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-11-11 04:14:48 +0300
committerHans Goudey <h.goudey@me.com>2022-11-11 04:41:13 +0300
commit9465b109af0b70244a36f9e68493e316d9f8b56f (patch)
treec4d933bf09f8313071556063156538ec3356b24c /source/blender/blenlib/tests/BLI_math_rotation_test.cc
parent026d21a225521670c6b5083da9da61227da69e65 (diff)
parentca1642cd0c5cdf634fe2022c955d93983de95934 (diff)
Merge branch 'master' into refactor-mesh-position-genericrefactor-mesh-position-generic
Diffstat (limited to 'source/blender/blenlib/tests/BLI_math_rotation_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_math_rotation_test.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_math_rotation_test.cc b/source/blender/blenlib/tests/BLI_math_rotation_test.cc
index e37b212e1df..0c8ae38c386 100644
--- a/source/blender/blenlib/tests/BLI_math_rotation_test.cc
+++ b/source/blender/blenlib/tests/BLI_math_rotation_test.cc
@@ -3,6 +3,7 @@
#include "testing/testing.h"
#include "BLI_math_base.h"
+#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_rotation.hh"
#include "BLI_math_vector.hh"
@@ -138,6 +139,21 @@ TEST(math_rotation, quat_to_mat_to_quat_near_0001)
test_quat_to_mat_to_quat(0.30f, -0.030f, -0.30f, 0.95f);
}
+/* A zeroed matrix converted to a quaternion and back should not add rotation, see: T101848 */
+TEST(math_rotation, quat_to_mat_to_quat_zeroed_matrix)
+{
+ float matrix_zeroed[3][3] = {{0.0f}};
+ float matrix_result[3][3];
+ float matrix_unit[3][3];
+ float out_quat[4];
+
+ unit_m3(matrix_unit);
+ mat3_normalized_to_quat(out_quat, matrix_zeroed);
+ quat_to_mat3(matrix_result, out_quat);
+
+ EXPECT_M3_NEAR(matrix_unit, matrix_result, FLT_EPSILON);
+}
+
TEST(math_rotation, quat_split_swing_and_twist_negative)
{
const float input[4] = {-0.5f, 0, sqrtf(3) / 2, 0};