[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43101] trunk/blender/source/blender/ python/mathutils/mathutils_Vector.c: fixes to mathutils from Andew Hale
Campbell Barton
ideasman42 at gmail.com
Tue Jan 3 15:34:50 CET 2012
Revision: 43101
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43101
Author: campbellbarton
Date: 2012-01-03 14:34:41 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
fixes to mathutils from Andew Hale
- docstring edits
- normalize ignores W axis as its supposed to.
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 2012-01-03 14:02:51 UTC (rev 43100)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c 2012-01-03 14:34:41 UTC (rev 43101)
@@ -334,18 +334,18 @@
"\n"
" Normalize the vector, making the length of the vector always 1.0.\n"
"\n"
-" .. warning:: Normalizing a vector where all values are zero results\n"
-" in all axis having a nan value (not a number).\n"
+" .. warning:: Normalizing a vector where all values are zero has no effect.\n"
"\n"
" .. note:: Normalize works for vectors of all sizes,\n"
" however 4D Vectors w axis is left untouched.\n"
);
static PyObject *Vector_normalize(VectorObject *self)
{
+ int size = (self->size == 4 ? 3 : self->size);
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- normalize_vn(self->vec, self->size);
+ normalize_vn(self->vec, size);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
@@ -1480,10 +1480,10 @@
mulplication*/
-/* COLUMN VECTOR Multiplication (Vector X Matrix)
- * [a] * [1][4][7]
- * [b] * [2][5][8]
- * [c] * [3][6][9]
+/* COLUMN VECTOR Multiplication (Matrix X Vector)
+ * [1][4][7] [a]
+ * [2][5][8] * [b]
+ * [3][6][9] [c]
*
* note: vector/matrix multiplication IS NOT COMMUTATIVE!!!!
* note: assume read callbacks have been done first.
@@ -1500,8 +1500,8 @@
else {
PyErr_SetString(PyExc_TypeError,
"matrix * vector: "
- "matrix.row_size and len(vector) must be the same, "
- "except for 3D vector * 4x4 matrix.");
+ "len(matrix.col) and len(vector) must be the same, "
+ "except for 4x4 matrix * 3D vector.");
return -1;
}
}
More information about the Bf-blender-cvs
mailing list