[Bf-blender-cvs] [13c9cc9a4cc] temp-sybren-alembic: FIXUP abc_matrix_test.cc

Sybren A. Stüvel noreply at git.blender.org
Thu Apr 6 15:21:17 CEST 2017


Commit: 13c9cc9a4cc8324eec547430fe2f60c4b2de288d
Author: Sybren A. Stüvel
Date:   Thu Apr 6 14:18:40 2017 +0200
Branches: temp-sybren-alembic
https://developer.blender.org/rB13c9cc9a4cc8324eec547430fe2f60c4b2de288d

FIXUP abc_matrix_test.cc

===================================================================

M	tests/gtests/alembic/abc_matrix_test.cc

===================================================================

diff --git a/tests/gtests/alembic/abc_matrix_test.cc b/tests/gtests/alembic/abc_matrix_test.cc
index b17ef098ba9..08bce1ed50f 100644
--- a/tests/gtests/alembic/abc_matrix_test.cc
+++ b/tests/gtests/alembic/abc_matrix_test.cc
@@ -69,7 +69,7 @@ TEST(abc_matrix, CreateRotationMatrixXYZ_YfromZ) {
 	float rot_y_mat[3][3];
 	float rot_z_mat[3][3];
 	// in degrees: X=10, Y=20, Z=30
-	float euler[3] = {0.1745329201221466f, 0.3490658104419708f, 0.5235987901687622f};
+	float euler[3] = {0.17453292012214f, 0.34906581044197f, 0.52359879016876f};
 
 	// Construct expected matrices
 	float rot_x_p10[3][3];  // rotation of +10 degrees over x-axis
@@ -150,10 +150,10 @@ TEST(abc_matrix, CopyM44AxisSwap_YfromZ) {
 	 * above. This matrix was created by rotating a cube in Blender over
 	 * (X=10, Y=20, Z=30 degrees in XYZ order) and translating over (1, 2, 3) */
 	float input[4][4] = {
-	    {0.813797652721405, 0.46984633803367615, -0.3420201241970062, 0.0},
-	    {-0.4409696161746979, 0.882564127445221, 0.16317591071128845, 0.0},
-	    {0.3785223066806793, 0.018028317019343376, 0.9254165887832642, 0.0},
-	    {1.0, 2.0, 3.0, 1.0},
+	    { 0.81379765272f, 0.4698463380336f, -0.342020124197f, 0.f},
+	    {-0.44096961617f, 0.8825641274452f,  0.163175910711f, 0.f},
+	    { 0.37852230668f, 0.0180283170193f,  0.925416588783f, 0.f},
+	    {1.f, 2.f, 3.f, 1.f},
 	};
 
 	copy_m44_axis_swap(result, input, ABC_YUP_FROM_ZUP);
@@ -165,10 +165,10 @@ TEST(abc_matrix, CopyM44AxisSwap_YfromZ) {
 	/* This matrix was created by rotating a cube in Blender over
 	 * (X=10, Y=30, Z=-20 degrees in XZY order) and translating over (1, 3, -2) */
 	float expect[4][4] = {
-	    {0.813797652721405, -0.3420201241970062, -0.46984633803367615, 0.0},
-	    {0.3785223066806793, 0.9254165887832642, -0.018028317019343376, 0.0},
-	    {0.4409696161746979, -0.16317591071128845, 0.882564127445221, 0.0},
-	    {1.0, 3.0, -2.0, 1.0},
+	    {0.813797652721f, -0.342020124197f, -0.469846338033f, 0.f},
+	    {0.378522306680f,  0.925416588783f, -0.018028317019f, 0.f},
+	    {0.440969616174f, -0.163175910711f,  0.882564127445f, 0.f},
+	    {1.f, 3.f, -2.f, 1.f},
 	};
 	EXPECT_M4_NEAR(expect, result, 1e-5f);
 }
@@ -181,10 +181,10 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_YfromZ) {
 	 * (X=10, Y=20, Z=30 degrees in XYZ order), translating over (1, 2, 3),
 	 * and scaling by (4, 5, 6). */
 	float input[4][4] = {
-	            {3.25519061088562, 1.8793853521347046, -1.368080496788025, 0.0},
-		        {-2.204848051071167, 4.412820816040039, 0.8158795833587646, 0.0},
-		        {2.2711338996887207, 0.10816989839076996, 5.552499771118164, 0.0},
-		        {1.0, 2.0, 3.0, 1.0},
+	    { 3.25519061088f, 1.8793853521347f, -1.368080496788f, 0.f},
+	    {-2.20484805107f, 4.4128208160400f,  0.815879583358f, 0.f},
+	    { 2.27113389968f, 0.1081698983907f,  5.552499771118f, 0.f},
+	    {1.f, 2.f, 3.f, 1.f},
 	};
 
 	copy_m44_axis_swap(result, input, ABC_YUP_FROM_ZUP);
@@ -193,10 +193,10 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_YfromZ) {
 	 * (X=10, Y=30, Z=-20 degrees in XZY order), translating over (1, 3, -2)
 	 * and scaling over (4, 6, 5). */
 	float expect[4][4] = {
-	    {3.25519061088562, -1.368080496788025, -1.8793853521347046, 0.0},
-		{2.2711338996887207, 5.552499771118164, -0.10816989839076996, 0.0},
-		{2.204848051071167, -0.8158795833587646, 4.412820816040039, 0.0},
-		{1.0, 3.0, -2.0, 1.0},
+	    {3.255190610885f, -1.368080496788f, -1.879385352134f, 0.f},
+	    {2.271133899688f,  5.552499771118f, -0.108169898390f, 0.f},
+	    {2.204848051071f, -0.815879583358f,  4.412820816040f, 0.f},
+	    {1.f, 3.f, -2.f, 1.f},
 	};
 	EXPECT_M4_NEAR(expect, result, 1e-5f);
 }
@@ -207,10 +207,10 @@ TEST(abc_matrix, CopyM44AxisSwap_ZfromY) {
 	/* This matrix was created by rotating a cube in Blender over
 	 * (X=10, Y=30, Z=-20 degrees in XZY order) and translating over (1, 3, -2) */
 	float input[4][4] = {
-	    {0.813797652721405, -0.3420201241970062, -0.46984633803367615, 0.0},
-	    {0.3785223066806793, 0.9254165887832642, -0.018028317019343376, 0.0},
-	    {0.4409696161746979, -0.16317591071128845, 0.882564127445221, 0.0},
-	    {1.0, 3.0, -2.0, 1.0},
+	    {0.813797652721f, -0.342020124197f, -0.469846338033f, 0.f},
+	    {0.378522306680f,  0.925416588783f, -0.018028317019f, 0.f},
+	    {0.440969616174f, -0.163175910711f,  0.882564127445f, 0.f},
+	    {1.f, 3.f, -2.f, 1.f},
 	};
 
 	copy_m44_axis_swap(result, input, ABC_ZUP_FROM_YUP);
@@ -218,10 +218,10 @@ TEST(abc_matrix, CopyM44AxisSwap_ZfromY) {
 	/* This matrix was created by rotating a cube in Blender over
 	 * (X=10, Y=20, Z=30 degrees in XYZ order) and translating over (1, 2, 3) */
 	float expect[4][4] = {
-	    {0.813797652721405, 0.46984633803367615, -0.3420201241970062, 0.0},
-	    {-0.4409696161746979, 0.882564127445221, 0.16317591071128845, 0.0},
-	    {0.3785223066806793, 0.018028317019343376, 0.9254165887832642, 0.0},
-	    {1.0, 2.0, 3.0, 1.0},
+	    {0.813797652721f, 0.469846338033f, -0.342020124197f, 0.f},
+	    {-0.44096961617f, 0.882564127445f,  0.163175910711f, 0.f},
+	    {0.378522306680f, 0.018028317019f,  0.925416588783f, 0.f},
+	    {1.f, 2.f, 3.f, 1.f},
 	};
 
 	EXPECT_M4_NEAR(expect, result, 1e-5f);
@@ -234,10 +234,10 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_ZfromY) {
 	 * (X=10, Y=30, Z=-20 degrees in XZY order), translating over (1, 3, -2)
 	 * and scaling over (4, 6, 5). */
 	float input[4][4] = {
-	    {3.25519061088562, -1.368080496788025, -1.8793853521347046, 0.0},
-		{2.2711338996887207, 5.552499771118164, -0.10816989839076996, 0.0},
-		{2.204848051071167, -0.8158795833587646, 4.412820816040039, 0.0},
-		{1.0, 3.0, -2.0, 1.0},
+	    {3.2551906108f, -1.36808049678f, -1.879385352134f, 0.f},
+	    {2.2711338996f,  5.55249977111f, -0.108169898390f, 0.f},
+	    {2.2048480510f, -0.81587958335f,  4.412820816040f, 0.f},
+	    {1.f, 3.f, -2.f, 1.f},
 	};
 
 	copy_m44_axis_swap(result, input, ABC_ZUP_FROM_YUP);
@@ -246,10 +246,36 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_ZfromY) {
 	 * (X=10, Y=20, Z=30 degrees in XYZ order), translating over (1, 2, 3),
 	 * and scaling by (4, 5, 6). */
 	float expect[4][4] = {
-	            {3.25519061088562, 1.8793853521347046, -1.368080496788025, 0.0},
-		        {-2.204848051071167, 4.412820816040039, 0.8158795833587646, 0.0},
-		        {2.2711338996887207, 0.10816989839076996, 5.552499771118164, 0.0},
-		        {1.0, 2.0, 3.0, 1.0},
+	    {3.25519061088f, 1.879385352134f, -1.36808049678f, 0.f},
+	    {-2.2048480510f, 4.412820816040f,  0.81587958335f, 0.f},
+	    {2.27113389968f, 0.108169898390f,  5.55249977111f, 0.f},
+	    {1.f, 2.f, 3.f, 1.f},
+	};
+
+	EXPECT_M4_NEAR(expect, result, 1e-5f);
+}
+
+TEST(abc_matrix, CopyM44AxisSwapWithScale_gimbal_ZfromY) {
+	float result[4][4];
+
+	/* This matrix represents a rotation over (-90, -0, -0) degrees,
+	 * and a translation over (-0, -0.1, -0). It is in Y=up. */
+	float input[4][4] = {
+	    { 1.000f, 0.000f, 0.000f, 0.000f},
+	    { 0.000f, 0.000f,-1.000f, 0.000f},
+	    { 0.000f, 1.000f, 0.000f, 0.000f},
+	    {-0.000f,-0.100f,-0.000f, 1.000f},
+	};
+
+	copy_m44_axis_swap(result, input, ABC_ZUP_FROM_YUP);
+
+	/* Since the rotation is only over the X-axis, it should not change.
+	 * The translation does change. */
+	float expect[4][4] = {
+	    { 1.000f, 0.000f, 0.000f, 0.000f},
+	    { 0.000f, 0.000f,-1.000f, 0.000f},
+	    { 0.000f, 1.000f, 0.000f, 0.000f},
+	    {-0.000f, 0.000f,-0.100f, 1.000f},
 	};
 
 	EXPECT_M4_NEAR(expect, result, 1e-5f);




More information about the Bf-blender-cvs mailing list