[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42763] trunk/blender/source/blender/ python/mathutils/mathutils_Vector.c: recent commit missed swapping args for MATRIX_ITEM in mathutils_Vector.c, breaking matrix*vector.

Campbell Barton ideasman42 at gmail.com
Tue Dec 20 12:38:04 CET 2011


Revision: 42763
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42763
Author:   campbellbarton
Date:     2011-12-20 11:37:55 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
recent commit missed swapping args for MATRIX_ITEM in mathutils_Vector.c, breaking matrix*vector.

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

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2011-12-20 10:59:56 UTC (rev 42762)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2011-12-20 11:37:55 UTC (rev 42763)
@@ -1486,11 +1486,11 @@
  * note: vector/matrix multiplication IS NOT COMMUTATIVE!!!!
  * note: assume read callbacks have been done first.
  */
-int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec, MatrixObject * mat)
+int column_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject* vec, MatrixObject * mat)
 {
 	float vec_cpy[MAX_DIMENSIONS];
 	double dot = 0.0f;
-	int x, y, z = 0;
+	int row, col, z = 0;
 
 	if (mat->num_col != vec->size) {
 		if (mat->num_col == 4 && vec->size == 3) {
@@ -1507,13 +1507,13 @@
 
 	memcpy(vec_cpy, vec->vec, vec->size * sizeof(float));
 
-	rvec[3] = 1.0f;
+	r_vec[3] = 1.0f;
 
-	for (x = 0; x < mat->num_row; x++) {
-		for (y = 0; y < mat->num_col; y++) {
-			dot += (double)(MATRIX_ITEM(mat, y, x) * vec_cpy[y]);
+	for (row = 0; row < mat->num_row; row++) {
+		for (col = 0; col < mat->num_col; col++) {
+			dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[col]);
 		}
-		rvec[z++] = (float)dot;
+		r_vec[z++] = (float)dot;
 		dot = 0.0f;
 	}
 
@@ -2634,7 +2634,7 @@
 	//muliplication
 	for (x = 0; x < mat->num_col; x++) {
 		for (y = 0; y < mat->num_row; y++) {
-			dot += MATRIX_ITEM(mat, x, y) * vec_cpy[y];
+			dot += MATRIX_ITEM(mat, y, x) * vec_cpy[y];
 		}
 		rvec[z++] = (float)dot;
 		dot = 0.0f;




More information about the Bf-blender-cvs mailing list