Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-07-20 09:57:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-20 09:57:38 +0400
commit0ed523a8dd66189bbef192ad37d90c9c462d5dc1 (patch)
treecc070fee1d82e78bd8dfb178dad6298d61ddd93d /source/blender/python/mathutils
parentfd7825e7dce2803c7864303d5346027d60d212ee (diff)
patch [#28032] Python Mathutils: Matrix Multiplication Error
from Scott Giese (sgiese)
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index b0187c1ef25..39d0784b287 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -1594,20 +1594,14 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
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;
}
}