cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=26f33dc6bd848160577eb9308e3bc77c09dc0aed

commit 26f33dc6bd848160577eb9308e3bc77c09dc0aed
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Thu Jun 25 14:52:55 2015 +0200

    eina: add eina_matrix4_transpose.
---
 src/lib/eina/eina_matrix.c | 21 +++++++++++++++++++++
 src/lib/eina/eina_matrix.h | 12 ++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c
index 6219004..96a0971 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)
 
    return EINA_TRUE;
 }
+
+EAPI void
+eina_matrix4_transpose(Eina_Matrix4 *out, const Eina_Matrix4 *in)
+{
+   MATRIX_XX(out) = MATRIX_XX(in);
+   MATRIX_XY(out) = MATRIX_YX(in);
+   MATRIX_XZ(out) = MATRIX_ZX(in);
+   MATRIX_XW(out) = MATRIX_WX(in);
+   MATRIX_YX(out) = MATRIX_XY(in);
+   MATRIX_YY(out) = MATRIX_YY(in);
+   MATRIX_YZ(out) = MATRIX_ZY(in);
+   MATRIX_YW(out) = MATRIX_WY(in);
+   MATRIX_ZX(out) = MATRIX_XZ(in);
+   MATRIX_ZY(out) = MATRIX_YZ(in);
+   MATRIX_ZZ(out) = MATRIX_ZZ(in);
+   MATRIX_ZW(out) = MATRIX_WZ(in);
+   MATRIX_WX(out) = MATRIX_XW(in);
+   MATRIX_WY(out) = MATRIX_YW(in);
+   MATRIX_WZ(out) = MATRIX_ZW(in);
+   MATRIX_WW(out) = MATRIX_WW(in);
+}
diff --git a/src/lib/eina/eina_matrix.h b/src/lib/eina/eina_matrix.h
index 1f11be3..ab6be4c 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,
 EAPI Eina_Bool eina_matrix4_inverse(Eina_Matrix4 *out, const Eina_Matrix4 *in);
 
 /**
+ * @brief Return the transpose of the given matrix.
+ *
+ * @param out The transpose matrix
+ * @param in The matrix.
+ *
+ * Just going to swap row and column.
+ *
+ * @since 1.15
+ */
+EAPI void eina_matrix4_transpose(Eina_Matrix4 *out, const Eina_Matrix4 *in);
+
+/**
  * @brief Convert an Eina_Matrix4 into an Eina_Matrix3.
  *
  * @param m3 The destination Eina_Matrix3.

-- 


Reply via email to