Blender  V3.3
Macros
mathutils_Euler.c File Reference
#include <Python.h>
#include "mathutils.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_dynstr.h"

Go to the source code of this file.

Macros

#define EULER_SIZE   3
 
#define MAKE_ID3(a, b, c)   (((a) << 24) | ((b) << 16) | ((c) << 8))
 

Functions

Utilities
static const char * euler_order_str (EulerObject *self)
 
short euler_order_from_string (const char *str, const char *error_prefix)
 
static PyObject * Euler_to_tuple_ex (EulerObject *self, int ndigits)
 
Euler Type: <tt>__new__</tt> / <tt>mathutils.Euler()</tt>
static PyObject * Euler_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 
Euler Methods
 PyDoc_STRVAR (Euler_to_quaternion_doc, ".. method:: to_quaternion()\n" "\n" " Return a quaternion representation of the euler.\n" "\n" " :return: Quaternion representation of the euler.\n" " :rtype: :class:`Quaternion`\n")
 
static PyObject * Euler_to_quaternion (EulerObject *self)
 
 PyDoc_STRVAR (Euler_to_matrix_doc, ".. method:: to_matrix()\n" "\n" " Return a matrix representation of the euler.\n" "\n" " :return: A 3x3 rotation matrix representation of the euler.\n" " :rtype: :class:`Matrix`\n")
 
static PyObject * Euler_to_matrix (EulerObject *self)
 
 PyDoc_STRVAR (Euler_zero_doc, ".. method:: zero()\n" "\n" " Set all values to zero.\n")
 
static PyObject * Euler_zero (EulerObject *self)
 
 PyDoc_STRVAR (Euler_rotate_axis_doc, ".. method:: rotate_axis(axis, angle)\n" "\n" " Rotates the euler a certain amount and returning a unique euler rotation\n" " (no 720 degree pitches).\n" "\n" " :arg axis: single character in ['X, 'Y', 'Z'].\n" " :type axis: string\n" " :arg angle: angle in radians.\n" " :type angle: float\n")
 
static PyObject * Euler_rotate_axis (EulerObject *self, PyObject *args)
 
 PyDoc_STRVAR (Euler_rotate_doc, ".. method:: rotate(other)\n" "\n" " Rotates the euler by another mathutils value.\n" "\n" " :arg other: rotation component of mathutils value\n" " :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n")
 
static PyObject * Euler_rotate (EulerObject *self, PyObject *value)
 
 PyDoc_STRVAR (Euler_make_compatible_doc, ".. method:: make_compatible(other)\n" "\n" " Make this euler compatible with another,\n" " so interpolating between them works as intended.\n" "\n" " .. note:: the rotation order is not taken into account for this function.\n")
 
static PyObject * Euler_make_compatible (EulerObject *self, PyObject *value)
 
 PyDoc_STRVAR (Euler_copy_doc, ".. function:: copy()\n" "\n" " Returns a copy of this euler.\n" "\n" " :return: A copy of the euler.\n" " :rtype: :class:`Euler`\n" "\n" " .. note:: use this to get a copy of a wrapped euler with\n" " no reference to the original data.\n")
 
static PyObject * Euler_copy (EulerObject *self)
 
static PyObject * Euler_deepcopy (EulerObject *self, PyObject *args)
 
Euler Type: <tt>__repr__</tt> & <tt>__str__</tt>
static PyObject * Euler_repr (EulerObject *self)
 
static PyObject * Euler_str (EulerObject *self)
 
Euler Type: Rich Compare
static PyObject * Euler_richcmpr (PyObject *a, PyObject *b, int op)
 
Euler Type: Hash (<tt>__hash__</tt>)
static Py_hash_t Euler_hash (EulerObject *self)
 
Euler Type: Sequence Protocol
static int Euler_len (EulerObject *UNUSED(self))
 
static PyObject * Euler_item (EulerObject *self, int i)
 
static int Euler_ass_item (EulerObject *self, int i, PyObject *value)
 
static PyObject * Euler_slice (EulerObject *self, int begin, int end)
 
static int Euler_ass_slice (EulerObject *self, int begin, int end, PyObject *seq)
 
static PyObject * Euler_subscript (EulerObject *self, PyObject *item)
 
static int Euler_ass_subscript (EulerObject *self, PyObject *item, PyObject *value)
 
Euler Type: Get/Set Item Implementation
 PyDoc_STRVAR (Euler_axis_doc, "Euler axis angle in radians.\n\n:type: float")
 
static PyObject * Euler_axis_get (EulerObject *self, void *type)
 
static int Euler_axis_set (EulerObject *self, PyObject *value, void *type)
 
 PyDoc_STRVAR (Euler_order_doc, "Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']")
 
static PyObject * Euler_order_get (EulerObject *self, void *UNUSED(closure))
 
static int Euler_order_set (EulerObject *self, PyObject *value, void *UNUSED(closure))
 
Euler Type: C/API Constructors
PyObject * Euler_CreatePyObject (const float eul[3], const short order, PyTypeObject *base_type)
 
PyObject * Euler_CreatePyObject_wrap (float eul[3], const short order, PyTypeObject *base_type)
 
PyObject * Euler_CreatePyObject_cb (PyObject *cb_user, const short order, uchar cb_type, uchar cb_subtype)
 

Variables

Euler Type: Sequence & Mapping Protocol Declarations
static PySequenceMethods Euler_SeqMethods
 
static PyMappingMethods Euler_AsMapping
 
Euler Type: Get/Set Item Definitions
static PyGetSetDef Euler_getseters []
 
Euler Type: Method Definitions
static struct PyMethodDef Euler_methods []
 

Euler Type: Python Object Definition

PyTypeObject euler_Type
 
 PyDoc_STRVAR (euler_doc, ".. class:: Euler(angles, order='XYZ')\n" "\n" " This object gives access to Eulers in Blender.\n" "\n" " .. seealso:: `Euler angles <https://en.wikipedia.org/wiki/Euler_angles>`__ on Wikipedia.\n" "\n" " :param angles: Three angles, in radians.\n" " :type angles: 3d vector\n" " :param order: Optional order of the angles, a permutation of ``XYZ``.\n" " :type order: str\n")
 

Macro Definition Documentation

◆ EULER_SIZE

#define EULER_SIZE   3

Definition at line 20 of file mathutils_Euler.c.

◆ MAKE_ID3

#define MAKE_ID3 (   a,
  b,
 
)    (((a) << 24) | ((b) << 16) | ((c) << 8))

Function Documentation

◆ Euler_ass_item()

static int Euler_ass_item ( EulerObject self,
int  i,
PyObject *  value 
)
static

Sequence accessor (set): object[i] = x.

Definition at line 464 of file mathutils_Euler.c.

References BaseMath_Prepare_ForWrite, BaseMath_WriteIndexCallback, and EULER_SIZE.

Referenced by Euler_ass_subscript(), and Euler_axis_set().

◆ Euler_ass_slice()

static int Euler_ass_slice ( EulerObject self,
int  begin,
int  end,
PyObject *  seq 
)
static

Sequence slice accessor (set): object[i:j] = x.

Definition at line 526 of file mathutils_Euler.c.

References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, CLAMP, EULER_SIZE, mathutils_array_parse(), MIN2, size(), and void.

Referenced by Euler_ass_subscript().

◆ Euler_ass_subscript()

static int Euler_ass_subscript ( EulerObject self,
PyObject *  item,
PyObject *  value 
)
static

Sequence generic subscript (set): object[...] = x.

Definition at line 600 of file mathutils_Euler.c.

References Euler_ass_item(), Euler_ass_slice(), and EULER_SIZE.

◆ Euler_axis_get()

static PyObject* Euler_axis_get ( EulerObject self,
void type 
)
static

Definition at line 666 of file mathutils_Euler.c.

References Euler_item(), POINTER_AS_INT, and type.

◆ Euler_axis_set()

static int Euler_axis_set ( EulerObject self,
PyObject *  value,
void type 
)
static

Definition at line 671 of file mathutils_Euler.c.

References Euler_ass_item(), POINTER_AS_INT, and type.

◆ Euler_copy()

static PyObject* Euler_copy ( EulerObject self)
static

Definition at line 304 of file mathutils_Euler.c.

References BaseMath_ReadCallback, Euler_CreatePyObject(), NULL, and self.

Referenced by Euler_deepcopy().

◆ Euler_CreatePyObject()

PyObject* Euler_CreatePyObject ( const float  eul[3],
const short  order,
PyTypeObject *  base_type 
)

◆ Euler_CreatePyObject_cb()

PyObject* Euler_CreatePyObject_cb ( PyObject *  cb_user,
const short  order,
uchar  cb_type,
uchar  cb_subtype 
)

Definition at line 896 of file mathutils_Euler.c.

References Euler_CreatePyObject(), NULL, and order.

Referenced by pyrna_math_object_from_array().

◆ Euler_CreatePyObject_wrap()

PyObject* Euler_CreatePyObject_wrap ( float  eul[3],
const short  order,
PyTypeObject *  base_type 
)

◆ Euler_deepcopy()

static PyObject* Euler_deepcopy ( EulerObject self,
PyObject *  args 
)
static

Definition at line 312 of file mathutils_Euler.c.

References Euler_copy(), NULL, and PyC_CheckArgs_DeepCopy().

◆ Euler_hash()

static Py_hash_t Euler_hash ( EulerObject self)
static

◆ Euler_item()

static PyObject* Euler_item ( EulerObject self,
int  i 
)
static

Sequence accessor (get): x = object[i].

Definition at line 443 of file mathutils_Euler.c.

References BaseMath_ReadIndexCallback, EULER_SIZE, NULL, and self.

Referenced by Euler_axis_get(), and Euler_subscript().

◆ Euler_len()

static int Euler_len ( EulerObject UNUSEDself)
static

Sequence length: len(object).

Definition at line 437 of file mathutils_Euler.c.

References EULER_SIZE.

◆ Euler_make_compatible()

static PyObject* Euler_make_compatible ( EulerObject self,
PyObject *  value 
)
static

◆ Euler_new()

static PyObject* Euler_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwds 
)
static

◆ euler_order_from_string()

short euler_order_from_string ( const char *  str,
const char *  error_prefix 
)

◆ Euler_order_get()

static PyObject* Euler_order_get ( EulerObject self,
void UNUSEDclosure 
)
static

Definition at line 681 of file mathutils_Euler.c.

References BaseMath_ReadCallback, euler_order_str(), and NULL.

◆ Euler_order_set()

static int Euler_order_set ( EulerObject self,
PyObject *  value,
void UNUSEDclosure 
)
static

◆ euler_order_str()

static const char* euler_order_str ( EulerObject self)
static

Internal use, assume read callback is done.

Definition at line 27 of file mathutils_Euler.c.

References EULER_ORDER_XYZ, and order.

Referenced by Euler_order_get(), Euler_repr(), and Euler_str().

◆ Euler_repr()

static PyObject* Euler_repr ( EulerObject self)
static

Definition at line 326 of file mathutils_Euler.c.

References BaseMath_ReadCallback, euler_order_str(), Euler_to_tuple_ex(), NULL, and ret.

◆ Euler_richcmpr()

static PyObject* Euler_richcmpr ( PyObject *  a,
PyObject *  b,
int  op 
)
static

◆ Euler_rotate()

static PyObject* Euler_rotate ( EulerObject self,
PyObject *  value 
)
static

◆ Euler_rotate_axis()

static PyObject* Euler_rotate_axis ( EulerObject self,
PyObject *  args 
)
static

◆ Euler_slice()

static PyObject* Euler_slice ( EulerObject self,
int  begin,
int  end 
)
static

Sequence slice accessor (get): x = object[i:j].

Definition at line 501 of file mathutils_Euler.c.

References BaseMath_ReadCallback, CLAMP, count, EULER_SIZE, MIN2, NULL, and self.

Referenced by Euler_subscript().

◆ Euler_str()

static PyObject* Euler_str ( EulerObject self)
static

◆ Euler_subscript()

static PyObject* Euler_subscript ( EulerObject self,
PyObject *  item 
)
static

Sequence generic subscript (get): x = object[...].

Definition at line 563 of file mathutils_Euler.c.

References Euler_item(), EULER_SIZE, Euler_slice(), and NULL.

◆ Euler_to_matrix()

static PyObject* Euler_to_matrix ( EulerObject self)
static

◆ Euler_to_quaternion()

static PyObject* Euler_to_quaternion ( EulerObject self)
static

◆ Euler_to_tuple_ex()

static PyObject* Euler_to_tuple_ex ( EulerObject self,
int  ndigits 
)
static
Note
BaseMath_ReadCallback must be called beforehand.

Definition at line 68 of file mathutils_Euler.c.

References double_round(), EULER_SIZE, ret, and self.

Referenced by Euler_repr().

◆ Euler_zero()

static PyObject* Euler_zero ( EulerObject self)
static

Definition at line 181 of file mathutils_Euler.c.

References BaseMath_Prepare_ForWrite, BaseMath_WriteCallback, NULL, self, and zero_v3().

◆ PyDoc_STRVAR() [1/10]

PyDoc_STRVAR ( Euler_axis_doc  ,
"Euler axis angle in radians.\n\n:type: float  
)

◆ PyDoc_STRVAR() [2/10]

PyDoc_STRVAR ( Euler_copy_doc  ,
".. function:: copy()\n" "\n" " Returns a copy of this euler.\n" "\n" " :return: A copy of the euler.\n" " :rtype: :class:`Euler`\n" "\n" " .. note:: use this to get a copy of a wrapped euler with\n" " no reference to the original data.\n"   
)

◆ PyDoc_STRVAR() [3/10]

PyDoc_STRVAR ( euler_doc  ,
".. class:: Euler(angles, order='XYZ')\n" "\n" " This object gives access to Eulers in Blender.\n" "\n" " .. seealso:: `Euler angles <https://en.wikipedia.org/wiki/Euler_angles>`__ on Wikipedia.\n" "\n" " :param angles: Three  angles,
in radians.\n" " :type angles:3d vector\n" " :param order:Optional order of the  angles,
a permutation of ``XYZ``.\n" " :type order:str\n"   
)

◆ PyDoc_STRVAR() [4/10]

PyDoc_STRVAR ( Euler_make_compatible_doc  ,
".. method:: make_compatible(other)\n" "\n" " Make this euler compatible with  another,
\n" " so interpolating between them works as intended.\n" "\n" " .. note::the rotation order is not taken into account for this function.\n"   
)

◆ PyDoc_STRVAR() [5/10]

PyDoc_STRVAR ( Euler_order_doc  ,
"Euler rotation order.\n\n:type: string in "  [ 'XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'] 
)

◆ PyDoc_STRVAR() [6/10]

PyDoc_STRVAR ( Euler_rotate_axis_doc  ,
".. method:: rotate_axis(axis, angle)\n" "\n" " Rotates the euler a certain amount and returning a unique euler rotation\n" " (no 720 degree pitches).\n" "\n" " :arg axis: single character in .\n" " :type axis: string\n" " :arg angle: angle in radians.\n" " :type angle: float\n"  [ 'X, 'Y', 'Z'] 
)

◆ PyDoc_STRVAR() [7/10]

PyDoc_STRVAR ( Euler_rotate_doc  ,
".. method:: rotate(other)\n" "\n" " Rotates the euler by another mathutils value.\n" "\n" " :arg other: rotation component of mathutils value\n" " :type other: :class:`Euler`  ,
:class:`Quaternion` or :class:`Matrix`\n"   
)

◆ PyDoc_STRVAR() [8/10]

PyDoc_STRVAR ( Euler_to_matrix_doc  ,
".. method:: to_matrix()\n" "\n" " Return a matrix representation of the euler.\n" "\n" " :return: A 3x3 rotation matrix representation of the euler.\n" " :rtype: :class:`Matrix`\n"   
)

◆ PyDoc_STRVAR() [9/10]

PyDoc_STRVAR ( Euler_to_quaternion_doc  ,
".. method:: to_quaternion()\n" "\n" " Return a quaternion representation of the euler.\n" "\n" " :return: Quaternion representation of the euler.\n" " :rtype: :class:`Quaternion`\n"   
)

◆ PyDoc_STRVAR() [10/10]

PyDoc_STRVAR ( Euler_zero_doc  ,
".. method:: zero()\n" "\n" " Set all values to zero.\n"   
)

Variable Documentation

◆ Euler_AsMapping

PyMappingMethods Euler_AsMapping
static
Initial value:
= {
(lenfunc)Euler_len,
(binaryfunc)Euler_subscript,
(objobjargproc)Euler_ass_subscript,
}
static int Euler_len(EulerObject *UNUSED(self))
static PyObject * Euler_subscript(EulerObject *self, PyObject *item)
static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *value)

Definition at line 651 of file mathutils_Euler.c.

◆ Euler_getseters

PyGetSetDef Euler_getseters[]
static
Initial value:
= {
{"x", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)0},
{"y", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)1},
{"z", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)2},
{"order", (getter)Euler_order_get, (setter)Euler_order_set, Euler_order_doc, (void *)NULL},
{"is_wrapped",
(setter)NULL,
NULL},
{"is_frozen",
(setter)NULL,
NULL},
{"is_valid",
(setter)NULL,
NULL},
}
PyObject * BaseMathObject_is_frozen_get(BaseMathObject *self, void *UNUSED(closure))
Definition: mathutils.c:661
PyObject * BaseMathObject_is_wrapped_get(BaseMathObject *self, void *UNUSED(closure))
Definition: mathutils.c:654
char BaseMathObject_is_valid_doc[]
Definition: mathutils.c:666
PyObject * BaseMathObject_owner_get(BaseMathObject *self, void *UNUSED(closure))
Definition: mathutils.c:646
char BaseMathObject_is_wrapped_doc[]
Definition: mathutils.c:652
char BaseMathObject_is_frozen_doc[]
Definition: mathutils.c:659
PyObject * BaseMathObject_is_valid_get(BaseMathObject *self, void *UNUSED(closure))
Definition: mathutils.c:668
char BaseMathObject_owner_doc[]
Definition: mathutils.c:645
static PyObject * Euler_axis_get(EulerObject *self, void *type)
static int Euler_axis_set(EulerObject *self, PyObject *value, void *type)
static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(closure))
static PyObject * Euler_order_get(EulerObject *self, void *UNUSED(closure))

Definition at line 716 of file mathutils_Euler.c.

◆ Euler_methods

struct PyMethodDef Euler_methods[]
static
Initial value:
= {
{"zero", (PyCFunction)Euler_zero, METH_NOARGS, Euler_zero_doc},
{"to_matrix", (PyCFunction)Euler_to_matrix, METH_NOARGS, Euler_to_matrix_doc},
{"to_quaternion", (PyCFunction)Euler_to_quaternion, METH_NOARGS, Euler_to_quaternion_doc},
{"rotate_axis", (PyCFunction)Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc},
{"rotate", (PyCFunction)Euler_rotate, METH_O, Euler_rotate_doc},
{"make_compatible", (PyCFunction)Euler_make_compatible, METH_O, Euler_make_compatible_doc},
{"copy", (PyCFunction)Euler_copy, METH_NOARGS, Euler_copy_doc},
{"__copy__", (PyCFunction)Euler_copy, METH_NOARGS, Euler_copy_doc},
{"__deepcopy__", (PyCFunction)Euler_deepcopy, METH_VARARGS, Euler_copy_doc},
{"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc},
{NULL, NULL, 0, NULL},
}
PyObject * BaseMathObject_freeze(BaseMathObject *self)
Definition: mathutils.c:681
char BaseMathObject_freeze_doc[]
Definition: mathutils.c:673
static PyObject * Euler_zero(EulerObject *self)
static PyObject * Euler_rotate_axis(EulerObject *self, PyObject *args)
static PyObject * Euler_to_quaternion(EulerObject *self)
static PyObject * Euler_to_matrix(EulerObject *self)
static PyObject * Euler_copy(EulerObject *self)
static PyObject * Euler_rotate(EulerObject *self, PyObject *value)
static PyObject * Euler_make_compatible(EulerObject *self, PyObject *value)
static PyObject * Euler_deepcopy(EulerObject *self, PyObject *args)

Definition at line 716 of file mathutils_Euler.c.

◆ Euler_SeqMethods

PySequenceMethods Euler_SeqMethods
static
Initial value:
= {
(lenfunc)Euler_len,
(binaryfunc)NULL,
(ssizeargfunc)NULL,
(ssizeargfunc)Euler_item,
(ssizessizeargfunc)NULL,
(ssizeobjargproc)Euler_ass_item,
(ssizessizeobjargproc)NULL,
(objobjproc)NULL,
(binaryfunc)NULL,
(ssizeargfunc)NULL,
}
static PyObject * Euler_item(EulerObject *self, int i)
static int Euler_ass_item(EulerObject *self, int i, PyObject *value)

Definition at line 638 of file mathutils_Euler.c.

◆ euler_Type

PyTypeObject euler_Type