[Bf-blender-cvs] [ba6519f] master: BLI_math: add 'equals_m4m4' (and 'm3' variant) helpers.

Bastien Montagne noreply at git.blender.org
Fri May 13 12:07:39 CEST 2016


Commit: ba6519f0a780bc32dadaa1be5b7bf53324de2cc8
Author: Bastien Montagne
Date:   Thu May 12 12:07:31 2016 +0200
Branches: master
https://developer.blender.org/rBba6519f0a780bc32dadaa1be5b7bf53324de2cc8

BLI_math: add 'equals_m4m4' (and 'm3' variant) helpers.

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

M	source/blender/blenlib/BLI_math_matrix.h
M	source/blender/blenlib/intern/math_matrix.c

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

diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 6fb983a..6d6fbe4 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -246,6 +246,9 @@ bool is_negative_m4(float mat[4][4]);
 bool is_zero_m3(float mat[3][3]);
 bool is_zero_m4(float mat[4][4]);
 
+bool equals_m3m3(float mat1[3][3], float mat2[3][3]);
+bool equals_m4m4(float mat1[4][4], float mat2[4][4]);
+
 /* SpaceTransform helper */
 typedef struct SpaceTransform {
 	float local2target[4][4];
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 52ff6fd..0e3f905 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1828,6 +1828,21 @@ bool is_zero_m4(float mat[4][4])
 	        is_zero_v4(mat[3]));
 }
 
+bool equals_m3m3(float mat1[3][3], float mat2[3][3])
+{
+	return (equals_v3v3(mat1[0], mat2[0]) &&
+	        equals_v3v3(mat1[1], mat2[1]) &&
+	        equals_v3v3(mat1[2], mat2[2]));
+}
+
+bool equals_m4m4(float mat1[4][4], float mat2[4][4])
+{
+	return (equals_v4v4(mat1[0], mat2[0]) &&
+	        equals_v4v4(mat1[1], mat2[1]) &&
+	        equals_v4v4(mat1[2], mat2[2]) &&
+	        equals_v4v4(mat1[3], mat2[3]));
+}
+
 /* make a 4x4 matrix out of 3 transform components */
 /* matrices are made in the order: scale * rot * loc */
 /* TODO: need to have a version that allows for rotation order... */




More information about the Bf-blender-cvs mailing list