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:
authorCampbell Barton <ideasman42@gmail.com>2014-09-06 05:19:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-09-06 05:29:27 +0400
commit671f75a12a1d9e57d9f609148538bcb9cf8b3a46 (patch)
treeb410028251edc29477105515f122d0aa1ffacbb1 /source/blender/blenlib/intern/math_matrix.c
parent7971e441c15b5740ac2e09f898e24011b88f51a5 (diff)
Math Lib: Add copy_m2_m2, unit_m2, zero_m2
Diffstat (limited to 'source/blender/blenlib/intern/math_matrix.c')
-rw-r--r--source/blender/blenlib/intern/math_matrix.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 09c581a589b..888587e055c 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -35,14 +35,26 @@
/********************************* Init **************************************/
+void zero_m2(float m[2][2])
+{
+ memset(m, 0, sizeof(float[2][2]));
+}
+
void zero_m3(float m[3][3])
{
- memset(m, 0, 3 * 3 * sizeof(float));
+ memset(m, 0, sizeof(float[3][3]));
}
void zero_m4(float m[4][4])
{
- memset(m, 0, 4 * 4 * sizeof(float));
+ memset(m, 0, sizeof(float[4][4]));
+}
+
+void unit_m2(float m[2][2])
+{
+ m[0][0] = m[1][1] = 1.0f;
+ m[0][1] = 0.0f;
+ m[1][0] = 0.0f;
}
void unit_m3(float m[3][3])
@@ -62,15 +74,20 @@ void unit_m4(float m[4][4])
m[3][0] = m[3][1] = m[3][2] = 0.0f;
}
+void copy_m2_m2(float m1[2][2], float m2[2][2])
+{
+ memcpy(m1, m2, sizeof(float[2][2]));
+}
+
void copy_m3_m3(float m1[3][3], float m2[3][3])
{
/* destination comes first: */
- memcpy(&m1[0], &m2[0], 9 * sizeof(float));
+ memcpy(m1, m2, sizeof(float[3][3]));
}
void copy_m4_m4(float m1[4][4], float m2[4][4])
{
- memcpy(m1, m2, 4 * 4 * sizeof(float));
+ memcpy(m1, m2, sizeof(float[4][4]));
}
void copy_m3_m4(float m1[3][3], float m2[4][4])