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-01-09 10:46:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-09 10:46:26 +0300
commitca89269c227607923bcfd8c137c552bdb0c37c16 (patch)
tree1cfd9ea8d396610aea404158af7e4363771cff03 /source/blender/python
parente32bbef017df64a99acedd4f3f4ba32713c50a3b (diff)
Remove py mathutils Euler.unique() method
- this just toggled between different rotations, I can't find any references to this as a common operation to have with eulers. - wasn't working at all nobody noticed, not used by any blender scripts/addons either.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/mathutils.c1
-rw-r--r--source/blender/python/generic/mathutils_euler.c60
2 files changed, 1 insertions, 60 deletions
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index 2e01dbe4cde..f0eca793028 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -46,6 +46,7 @@
* - Vector.toTrackQuat --> Vector.to_track_quat
* - Quaternion * Quaternion --> cross product (not dot product)
* - Euler.rotate(angle, axis) --> Euler.rotate_axis(axis, angle)
+ * - Euler.unique() *removed*, not a standard function only toggled different rotations.
*
* moved into class functions.
* - Mathutils.RotationMatrix -> mathutils.Matrix.Rotation
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index 69237922666..5f1a6f44d84 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -157,65 +157,6 @@ static PyObject *Euler_ToMatrix(EulerObject * self)
return newMatrixObject(mat, 3, 3 , Py_NEW, NULL);
}
-//sets the x,y,z values to a unique euler rotation
-// TODO, check if this works with rotation order!!!
-static char Euler_Unique_doc[] =
-".. method:: unique()\n"
-"\n"
-" Calculate a unique rotation for this euler. Avoids gimble lock.\n"
-"\n"
-" :return: an instance of itself\n"
-" :rtype: :class:`Euler`\n";
-
-static PyObject *Euler_Unique(EulerObject * self)
-{
-#define PI_2 (Py_PI * 2.0)
-#define PI_HALF (Py_PI / 2.0)
-#define PI_INV (1.0 / Py_PI)
-
- double heading, pitch, bank;
-
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- heading = self->eul[0];
- pitch = self->eul[1];
- bank = self->eul[2];
-
- //wrap heading in +180 / -180
- pitch += Py_PI;
- pitch -= floor(pitch * PI_INV) * PI_2;
- pitch -= Py_PI;
-
-
- if(pitch < -PI_HALF) {
- pitch = -Py_PI - pitch;
- heading += Py_PI;
- bank += Py_PI;
- } else if(pitch > PI_HALF) {
- pitch = Py_PI - pitch;
- heading += Py_PI;
- bank += Py_PI;
- }
- //gimbal lock test
- if(fabs(pitch) > PI_HALF - 1e-4) {
- heading += bank;
- bank = 0.0f;
- } else {
- bank += Py_PI;
- bank -= (floor(bank * PI_INV)) * PI_2;
- bank -= Py_PI;
- }
-
- heading += Py_PI;
- heading -= (floor(heading * PI_INV)) * PI_2;
- heading -= Py_PI;
-
- (void)BaseMath_WriteCallback(self);
- Py_INCREF(self);
- return (PyObject *)self;
-}
-
//sets the euler to 0,0,0
static char Euler_Zero_doc[] =
".. method:: zero()\n"
@@ -631,7 +572,6 @@ static PyGetSetDef Euler_getseters[] = {
//-----------------------METHOD DEFINITIONS ----------------------
static struct PyMethodDef Euler_methods[] = {
{"zero", (PyCFunction) Euler_Zero, METH_NOARGS, Euler_Zero_doc},
- {"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_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc},