summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-06-25 14:52:55 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-21 16:40:31 +0200
commit26f33dc6bd848160577eb9308e3bc77c09dc0aed (patch)
tree4a4ccc0ba14aaf224157839d2203e454736107d6
parent0330717ab2880367a40c612f7396d517fb2b369a (diff)
eina: add eina_matrix4_transpose.
-rw-r--r--src/lib/eina/eina_matrix.c21
-rw-r--r--src/lib/eina/eina_matrix.h12
2 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c
index 62190041cf..96a0971f11 100644
--- a/src/lib/eina/eina_matrix.c
+++ b/src/lib/eina/eina_matrix.c
@@ -915,3 +915,24 @@ eina_matrix4_inverse(Eina_Matrix4 *out, const Eina_Matrix4 *in)
915 915
916 return EINA_TRUE; 916 return EINA_TRUE;
917} 917}
918
919EAPI void
920eina_matrix4_transpose(Eina_Matrix4 *out, const Eina_Matrix4 *in)
921{
922 MATRIX_XX(out) = MATRIX_XX(in);
923 MATRIX_XY(out) = MATRIX_YX(in);
924 MATRIX_XZ(out) = MATRIX_ZX(in);
925 MATRIX_XW(out) = MATRIX_WX(in);
926 MATRIX_YX(out) = MATRIX_XY(in);
927 MATRIX_YY(out) = MATRIX_YY(in);
928 MATRIX_YZ(out) = MATRIX_ZY(in);
929 MATRIX_YW(out) = MATRIX_WY(in);
930 MATRIX_ZX(out) = MATRIX_XZ(in);
931 MATRIX_ZY(out) = MATRIX_YZ(in);
932 MATRIX_ZZ(out) = MATRIX_ZZ(in);
933 MATRIX_ZW(out) = MATRIX_WZ(in);
934 MATRIX_WX(out) = MATRIX_XW(in);
935 MATRIX_WY(out) = MATRIX_YW(in);
936 MATRIX_WZ(out) = MATRIX_ZW(in);
937 MATRIX_WW(out) = MATRIX_WW(in);
938}
diff --git a/src/lib/eina/eina_matrix.h b/src/lib/eina/eina_matrix.h
index 1f11be35ce..ab6be4cf79 100644
--- a/src/lib/eina/eina_matrix.h
+++ b/src/lib/eina/eina_matrix.h
@@ -550,6 +550,18 @@ EAPI Eina_Bool eina_matrix4_normalized(Eina_Matrix4 *out,
550EAPI Eina_Bool eina_matrix4_inverse(Eina_Matrix4 *out, const Eina_Matrix4 *in); 550EAPI Eina_Bool eina_matrix4_inverse(Eina_Matrix4 *out, const Eina_Matrix4 *in);
551 551
552/** 552/**
553 * @brief Return the transpose of the given matrix.
554 *
555 * @param out The transpose matrix
556 * @param in The matrix.
557 *
558 * Just going to swap row and column.
559 *
560 * @since 1.15
561 */
562EAPI void eina_matrix4_transpose(Eina_Matrix4 *out, const Eina_Matrix4 *in);
563
564/**
553 * @brief Convert an Eina_Matrix4 into an Eina_Matrix3. 565 * @brief Convert an Eina_Matrix4 into an Eina_Matrix3.
554 * 566 *
555 * @param m3 The destination Eina_Matrix3. 567 * @param m3 The destination Eina_Matrix3.