Commit: 9dadc8f599da94c3120f24f198c606d011a5dda2
Author: Campbell Barton
Date:   Mon Apr 27 21:50:38 2015 +1000
Branches: master
https://developer.blender.org/rB9dadc8f599da94c3120f24f198c606d011a5dda2

Math Lib: add mul_v3_mat3_m4v3

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

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 45972d0..f7eeb1e 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -106,6 +106,7 @@ void mul_v2_m4v3(float r[2], float M[4][4], const float 
v[3]);
 void mul_v2_m2v2(float r[2], float M[2][2], const float v[2]);
 void mul_m2v2(float M[2][2], float v[2]);
 void mul_mat3_m4_v3(float M[4][4], float r[3]);
+void mul_v3_mat3_m4v3(float r[3], float M[4][4], const float v[3]);
 void mul_m4_v4(float M[4][4], float r[4]);
 void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);
 void mul_project_m4_v3(float M[4][4], float vec[3]);
diff --git a/source/blender/blenlib/intern/math_matrix.c 
b/source/blender/blenlib/intern/math_matrix.c
index 1b4bbaf..773bb41 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -504,6 +504,16 @@ void mul_mat3_m4_v3(float mat[4][4], float vec[3])
        vec[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2];
 }
 
+void mul_v3_mat3_m4v3(float r[3], float mat[4][4], const float vec[3])
+{
+       const float x = vec[0];
+       const float y = vec[1];
+
+       r[0] = x * mat[0][0] + y * mat[1][0] + mat[2][0] * vec[2];
+       r[1] = x * mat[0][1] + y * mat[1][1] + mat[2][1] * vec[2];
+       r[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2];
+}
+
 void mul_project_m4_v3(float mat[4][4], float vec[3])
 {
        const float w = mul_project_m4_v3_zfac(mat, vec);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to