diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/mathutils_Matrix.c | 3 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils_Quaternion.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index 936c761bf90..41d9626db16 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -226,8 +226,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) } } - /* clamp angle between -360 and 360 in radians */ - angle= fmod(angle + M_PI*2, M_PI*4) - M_PI*2; + angle= angle_wrap_rad(angle); if(matSize != 2 && matSize != 3 && matSize != 4) { PyErr_SetString(PyExc_AttributeError, "mathutils.RotationMatrix(): can only return a 2x2 3x3 or 4x4 matrix"); diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/generic/mathutils_Quaternion.c index 43d3cbc62b0..be1fa6db035 100644 --- a/source/blender/python/generic/mathutils_Quaternion.c +++ b/source/blender/python/generic/mathutils_Quaternion.c @@ -861,7 +861,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN return -1; } - angle= fmod(angle + M_PI*2, M_PI*4) - M_PI*2; + angle= angle_wrap_rad(angle); /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */ if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && @@ -955,7 +955,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw case 2: if (mathutils_array_parse(quat, 3, 3, seq, "mathutils.Quaternion()") == -1) return NULL; - angle= fmod(angle + M_PI*2, M_PI*4) - M_PI*2; /* clamp because of precision issues */ + angle= angle_wrap_rad(angle); /* clamp because of precision issues */ axis_angle_to_quat(quat, quat, angle); break; /* PyArg_ParseTuple assures no more then 2 */ |