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>2006-10-03 09:11:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-10-03 09:11:33 +0400
commit6b7c4e09e8e1051e89b7a93d998810657b8a93e9 (patch)
treedae832f5f8be22117878b2060fbc2ce1b6bd0e02 /source/blender/python/api2_2x/matrix.c
parent815f115338aa960b3bf9451abb20b238d3308dd0 (diff)
Mathutils.Vector speedup
removed the need for casting python objects to Vectors pyobjects when performing vec/float arithmatic. a PyObject for coercing has also been removed from the vector struct so a little less memory will be used also. Benchmarked before and after this change ___________________________________ import Blender v= Blender.Mathutils.Vector m= Blender.Mathutils.Matrix a= v(1,2,3) b= v(3,2,1) c= m() t= Blender.sys.time() for i in xrange(20000000): a*b a*10 a/10 a+b b-a a*c print Blender.sys.time()-t _______________________________________ Before 63.5sec after 49.5 about 3 sec of that is looping
Diffstat (limited to 'source/blender/python/api2_2x/matrix.c')
-rw-r--r--source/blender/python/api2_2x/matrix.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c
index 55e8dbb4faa..5394ae14f81 100644
--- a/source/blender/python/api2_2x/matrix.c
+++ b/source/blender/python/api2_2x/matrix.c
@@ -721,10 +721,12 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
}
}else{
if(mat2->coerced_object){
- if(VectorObject_Check(mat2->coerced_object)){ /*MATRIX * VECTOR*/
+ /* MATRIX * VECTOR operation is now being done by vector */
+ /*if(VectorObject_Check(mat2->coerced_object)){
vec = (VectorObject*)mat2->coerced_object;
return column_vector_multiplication(mat1, vec);
- }else if(PointObject_Check(mat2->coerced_object)){ /*MATRIX * POINT*/
+ }else */
+ if(PointObject_Check(mat2->coerced_object)){ /*MATRIX * POINT*/
pt = (PointObject*)mat2->coerced_object;
return column_point_multiplication(mat1, pt);
}else if (PyFloat_Check(mat2->coerced_object) ||