[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42793] trunk/blender/source/blender/ python/mathutils/mathutils_Vector.c: fix for mathutils mat*vec for non sqyare matrices by Andrew Hale
Campbell Barton
ideasman42 at gmail.com
Wed Dec 21 12:36:29 CET 2011
Revision: 42793
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42793
Author: campbellbarton
Date: 2011-12-21 11:36:28 +0000 (Wed, 21 Dec 2011)
Log Message:
-----------
fix for mathutils mat*vec for non sqyare matrices by Andrew Hale
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-21 11:27:02 UTC (rev 42792)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c 2011-12-21 11:36:28 UTC (rev 42793)
@@ -1576,7 +1576,7 @@
return NULL;
}
- return Vector_CreatePyObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1));
+ return Vector_CreatePyObject(tvec, ((MatrixObject *)v2)->num_col, Py_NEW, Py_TYPE(vec1));
}
else if (QuaternionObject_Check(v2)) {
/* VEC * QUAT */
@@ -2603,7 +2603,7 @@
*/
/* ROW VECTOR Multiplication - Vector X Matrix
- * [x][y][z] * [1][4][7]
+ * [x][y][z] * [1][4][7]
* [2][5][8]
* [3][6][9]
* vector/matrix multiplication IS NOT COMMUTATIVE!!!! */
@@ -2611,7 +2611,7 @@
{
float vec_cpy[MAX_DIMENSIONS];
double dot = 0.0f;
- int x, y, z= 0, vec_size= vec->size;
+ int row, col, z= 0, vec_size= vec->size;
if (mat->num_row != vec_size) {
if (mat->num_row == 4 && vec_size != 3) {
@@ -2632,9 +2632,9 @@
rvec[3] = 1.0f;
//muliplication
- for (x = 0; x < mat->num_col; x++) {
- for (y = 0; y < mat->num_row; y++) {
- dot += MATRIX_ITEM(mat, y, x) * vec_cpy[y];
+ for (col = 0; col < mat->num_col; col++) {
+ for (row = 0; row < mat->num_row; row++) {
+ dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
}
rvec[z++] = (float)dot;
dot = 0.0f;
More information about the Bf-blender-cvs
mailing list