[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38522] trunk/blender/source/blender/ python/mathutils/mathutils_Matrix.c: patch [#28032] Python Mathutils: Matrix Multiplication Error

Campbell Barton ideasman42 at gmail.com
Wed Jul 20 07:57:39 CEST 2011


Revision: 38522
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38522
Author:   campbellbarton
Date:     2011-07-20 05:57:38 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
patch [#28032] Python Mathutils: Matrix Multiplication Error
from Scott Giese (sgiese)

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2011-07-20 01:12:57 UTC (rev 38521)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2011-07-20 05:57:38 UTC (rev 38522)
@@ -1594,20 +1594,14 @@
 			return NULL;
 		}
 		else {
-			float mat[16]= {0.0f, 0.0f, 0.0f, 0.0f,
-							0.0f, 0.0f, 0.0f, 0.0f,
-							0.0f, 0.0f, 0.0f, 0.0f,
-							0.0f, 0.0f, 0.0f, 1.0f};
-			double dot = 0.0f;
+			float mat[16]= {0.0f};
 			int x, y, z;
 
-			for(x = 0; x < mat2->row_size; x++) {
-				for(y = 0; y < mat1->col_size; y++) {
-					for(z = 0; z < mat1->row_size; z++) {
-						dot += (mat1->matrix[z][y] * mat2->matrix[x][z]);
+			for(x = 0; x < mat1->row_size; x++) {
+				for(y = 0; y < mat2->col_size; y++) {
+					for(z = 0; z < mat2->row_size; z++) {
+						mat[x * mat1->col_size + y] += (mat1->matrix[x][z] * mat2->matrix[z][y]);
 					}
-					mat[((x * mat1->col_size) + y)] = (float)dot;
-					dot = 0.0f;
 				}
 			}
 




More information about the Bf-blender-cvs mailing list