From b83751d8c2a3fd85e6e8e301ee1f986d684b03d5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 28 Nov 2009 13:11:41 +0000 Subject: Math Lib: merging over some changes from the sculpt branch: * swap v2/v3 * multiply-and-add (madd) v3 * inline v3 short/float conversion * mul_v3_m3v3 --- source/blender/blenlib/intern/math_matrix.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'source/blender/blenlib/intern/math_matrix.c') diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index edab1cc2440..47b99bce8ab 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -338,15 +338,19 @@ void mul_m4_v4(float mat[][4], float *vec) vec[3]=x*mat[0][3] + y*mat[1][3] + z*mat[2][3] + mat[3][3]*vec[3]; } -void mul_m3_v3(float mat[][3], float *vec) +void mul_v3_m3v3(float r[3], float M[3][3], float a[3]) { - float x,y; + r[0]= M[0][0]*a[0] + M[1][0]*a[1] + M[2][0]*a[2]; + r[1]= M[0][1]*a[0] + M[1][1]*a[1] + M[2][1]*a[2]; + r[2]= M[0][2]*a[0] + M[1][2]*a[1] + M[2][2]*a[2]; +} - x=vec[0]; - y=vec[1]; - vec[0]= x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2]; - vec[1]= x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2]; - vec[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2]; +void mul_m3_v3(float M[3][3], float r[3]) +{ + float tmp[3]; + + mul_v3_m3v3(tmp, M, r); + copy_v3_v3(r, tmp); } void mul_transposed_m3_v3(float mat[][3], float *vec) -- cgit v1.2.3