summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-06-24 15:31:32 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-21 16:40:31 +0200
commitc82015d0625448160b4e0320babdacdbbd80765d (patch)
treea5d1c3032fc60294d695a98eb3ccceb572683ae3
parent05fdfcc76a7eb57d00ae52d3ab2b9a1eb3ee0db9 (diff)
eina: our 3x3 matrix are 2D matrix, not 3D rotation matrix.
-rw-r--r--src/lib/eina/eina_matrix.c30
-rw-r--r--src/tests/eina/eina_test_matrix.c19
2 files changed, 24 insertions, 25 deletions
diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c
index 8e2d0beb98..6c96893927 100644
--- a/src/lib/eina/eina_matrix.c
+++ b/src/lib/eina/eina_matrix.c
@@ -664,13 +664,13 @@ eina_matrix4_matrix3_to(Eina_Matrix3 *m3, const Eina_Matrix4 *m4)
664{ 664{
665 MATRIX_XX(m3) = MATRIX_XX(m4); 665 MATRIX_XX(m3) = MATRIX_XX(m4);
666 MATRIX_XY(m3) = MATRIX_XY(m4); 666 MATRIX_XY(m3) = MATRIX_XY(m4);
667 MATRIX_XZ(m3) = MATRIX_XZ(m4); 667 MATRIX_XZ(m3) = MATRIX_XW(m4);
668 MATRIX_YX(m3) = MATRIX_YX(m4); 668 MATRIX_YX(m3) = MATRIX_YX(m4);
669 MATRIX_YY(m3) = MATRIX_YY(m4); 669 MATRIX_YY(m3) = MATRIX_YY(m4);
670 MATRIX_YZ(m3) = MATRIX_YZ(m4); 670 MATRIX_YZ(m3) = MATRIX_YW(m4);
671 MATRIX_ZX(m3) = MATRIX_ZX(m4); 671 MATRIX_ZX(m3) = MATRIX_WX(m4);
672 MATRIX_ZY(m3) = MATRIX_ZY(m4); 672 MATRIX_ZY(m3) = MATRIX_WY(m4);
673 MATRIX_ZZ(m3) = MATRIX_ZZ(m4); 673 MATRIX_ZZ(m3) = MATRIX_WW(m4);
674} 674}
675 675
676EAPI void 676EAPI void
@@ -678,18 +678,18 @@ eina_matrix3_matrix4_to(Eina_Matrix4 *m4, const Eina_Matrix3 *m3)
678{ 678{
679 MATRIX_XX(m4) = MATRIX_XX(m3); 679 MATRIX_XX(m4) = MATRIX_XX(m3);
680 MATRIX_XY(m4) = MATRIX_XY(m3); 680 MATRIX_XY(m4) = MATRIX_XY(m3);
681 MATRIX_XZ(m4) = MATRIX_XZ(m3); 681 MATRIX_XZ(m4) = 0;
682 MATRIX_XW(m4) = 0; 682 MATRIX_XW(m4) = MATRIX_XZ(m3);
683 MATRIX_YX(m4) = MATRIX_YX(m3); 683 MATRIX_YX(m4) = MATRIX_YX(m3);
684 MATRIX_YY(m4) = MATRIX_YY(m3); 684 MATRIX_YY(m4) = MATRIX_YY(m3);
685 MATRIX_YZ(m4) = MATRIX_YZ(m3); 685 MATRIX_YZ(m4) = 0;
686 MATRIX_YW(m4) = 0; 686 MATRIX_YW(m4) = MATRIX_YZ(m3);
687 MATRIX_ZX(m4) = MATRIX_ZX(m3); 687 MATRIX_ZX(m4) = 0;
688 MATRIX_ZY(m4) = MATRIX_ZY(m3); 688 MATRIX_ZY(m4) = 0;
689 MATRIX_ZZ(m4) = MATRIX_ZZ(m3); 689 MATRIX_ZZ(m4) = 1;
690 MATRIX_ZW(m4) = 0; 690 MATRIX_ZW(m4) = 0;
691 MATRIX_WX(m4) = 0; 691 MATRIX_WX(m4) = MATRIX_ZX(m3);
692 MATRIX_WY(m4) = 0; 692 MATRIX_WY(m4) = MATRIX_ZY(m3);
693 MATRIX_WZ(m4) = 0; 693 MATRIX_WZ(m4) = 0;
694 MATRIX_WW(m4) = 1; 694 MATRIX_WW(m4) = MATRIX_ZZ(m3);
695} 695}
diff --git a/src/tests/eina/eina_test_matrix.c b/src/tests/eina/eina_test_matrix.c
index af1e005c78..51cf9d8205 100644
--- a/src/tests/eina/eina_test_matrix.c
+++ b/src/tests/eina/eina_test_matrix.c
@@ -72,21 +72,20 @@ END_TEST
72 72
73START_TEST(eina_matrix4_2_3) 73START_TEST(eina_matrix4_2_3)
74{ 74{
75 Eina_Matrix4 m4, m4b; 75 Eina_Matrix4 m4;
76 Eina_Matrix3 m3; 76 Eina_Matrix3 m3, m3b;
77 77
78 eina_init(); 78 eina_init();
79 79
80 eina_matrix4_values_set(&m4, 80 eina_matrix3_values_set(&m3,
81 1, 3, 2, 0, 81 1, 3, 2,
82 3, 1, 4, 0, 82 3, 1, 4,
83 2, 4, 1, 0, 83 2, 4, 1);
84 0, 0, 0, 1);
85 84
86 eina_matrix4_matrix3_to(&m3, &m4); 85 eina_matrix3_matrix4_to(&m4, &m3);
87 eina_matrix3_matrix4_to(&m4b, &m3); 86 eina_matrix4_matrix3_to(&m3b, &m4);
88 87
89 fail_if(memcmp(&m4, &m4b, sizeof (Eina_Matrix4)) != 0); 88 fail_if(memcmp(&m3, &m3b, sizeof (Eina_Matrix3)) != 0);
90 89
91 eina_shutdown(); 90 eina_shutdown();
92} 91}