moved mathutils Euler.rotate(angle, axis) --> Euler.rotate_axis(axis, angle)

since it can only rotate about a single axis dont confuse with vector.rotate() which takes an axis vector.
This commit is contained in:
Campbell Barton 2010-09-29 08:07:58 +00:00
parent 0fa4ba175f
commit 96aa1f9cd5
2 changed files with 8 additions and 7 deletions

@ -45,6 +45,7 @@
* - toQuat --> to_quat
* - Vector.toTrackQuat --> Vector.to_track_quat
* - Quaternion * Quaternion --> cross product (not dot product)
* - Euler.rotate(angle, axis) --> Euler.rotate_axis(axis, angle)
*
* moved into class functions.
* - Mathutils.RotationMatrix -> mathutils.Matrix.Rotation

@ -229,24 +229,24 @@ static PyObject *Euler_Zero(EulerObject * self)
return (PyObject *)self;
}
static char Euler_Rotate_doc[] =
".. method:: rotate(angle, axis)\n"
static char Euler_rotate_axis_doc[] =
".. method:: rotate_axis(axis, angle)\n"
"\n"
" Rotates the euler a certain amount and returning a unique euler rotation (no 720 degree pitches).\n"
"\n"
" :arg angle: angle in radians.\n"
" :type angle: float\n"
" :arg axis: single character in ['X, 'Y', 'Z'].\n"
" :type axis: string\n"
" :arg angle: angle in radians.\n"
" :type angle: float\n"
" :return: an instance of itself\n"
" :rtype: :class:`Euler`";
static PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
{
float angle = 0.0f;
char *axis;
if(!PyArg_ParseTuple(args, "fs:rotate", &angle, &axis)){
if(!PyArg_ParseTuple(args, "sf:rotate", &axis, &angle)){
PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x,y,z)");
return NULL;
}
@ -632,7 +632,7 @@ static struct PyMethodDef Euler_methods[] = {
{"unique", (PyCFunction) Euler_Unique, METH_NOARGS, Euler_Unique_doc},
{"to_matrix", (PyCFunction) Euler_ToMatrix, METH_NOARGS, Euler_ToMatrix_doc},
{"to_quat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc},
{"rotate", (PyCFunction) Euler_Rotate, METH_VARARGS, Euler_Rotate_doc},
{"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc},
{"make_compatible", (PyCFunction) Euler_MakeCompatible, METH_O, Euler_MakeCompatible_doc},
{"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
{"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},