24#ifndef MATH_STANDALONE
33 QuaternionObject *self);
60 if (
is_zero_v3(axis) || !isfinite(axis[0]) || !isfinite(axis[1]) || !isfinite(axis[2])) {
73 if (!isfinite(*
angle)) {
91 PyTuple_SET_ITEM(
ret, i, PyFloat_FromDouble(
double_round(
double(self->quat[i]), ndigits)));
96 PyTuple_SET_ITEM(
ret, i, PyFloat_FromDouble(self->quat[i]));
110 PyObject *
const *args,
114 if (kwnames && PyTuple_GET_SIZE(kwnames)) [[unlikely]] {
115 PyErr_SetString(PyExc_TypeError,
116 "mathutils.Quaternion(): "
117 "takes no keyword args");
125 const size_t nargs = PyVectorcall_NARGS(nargsf);
132 quat, 3,
QUAT_SIZE, args[0],
"mathutils.Quaternion()");
134 if (size == -1) [[unlikely]] {
154 angle = PyFloat_AsDouble(args[1]);
155 if (
angle == -1.0 && PyErr_Occurred()) [[unlikely]] {
156 PyErr_Format(PyExc_TypeError,
157 "mathutils.Quaternion(): "
158 "angle must be a real number, not '%.200s'",
159 Py_TYPE(args[1])->tp_name);
167 PyErr_Format(PyExc_TypeError,
168 "mathutils.Quaternion() "
169 "takes at most 2 arguments (%zd given)",
177static PyObject *
Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
180 if (kwds && PyDict_GET_SIZE(kwds)) [[unlikely]] {
181 PyErr_SetString(PyExc_TypeError,
182 "mathutils.Quaternion(): "
183 "takes no keyword args");
186 PyObject *
const *args_array = &PyTuple_GET_ITEM(args, 0);
187 const size_t args_array_num = PyTuple_GET_SIZE(args);
189 reinterpret_cast<PyObject *
>(type), args_array, args_array_num,
nullptr);
200 Quaternion_to_euler_doc,
201 ".. method:: to_euler(order='XYZ', euler_compat=None, /)\n"
203 " Return Euler representation of the quaternion.\n"
205 " :param order: Rotation order.\n"
206 " :type order: Literal['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']\n"
207 " :param euler_compat: Optional euler argument the new euler will be made\n"
208 " compatible with (no axis flipping between them).\n"
209 " Useful for converting a series of quaternions to animation curves.\n"
210 " :type euler_compat: :class:`Euler` | None\n"
211 " :return: Euler representation of the quaternion.\n"
212 " :rtype: :class:`Euler`\n");
217 const char *order_str =
nullptr;
222 static const char *_keywords[] = {
"",
"",
nullptr};
223 static _PyArg_Parser _parser = {
231 if (!_PyArg_ParseTupleAndKeywordsFast(
283 Quaternion_to_matrix_doc,
284 ".. method:: to_matrix()\n"
286 " Return a matrix representation of the quaternion.\n"
288 " :return: A 3x3 rotation matrix representation of the quaternion.\n"
289 " :rtype: :class:`Matrix`\n");
298 quat_to_mat3(
reinterpret_cast<float (*)[3]
>(mat), self->quat);
310 Quaternion_to_axis_angle_doc,
311 ".. method:: to_axis_angle()\n"
313 " Return the axis, angle representation of the quaternion.\n"
315 " :return: Axis, angle.\n"
316 " :rtype: tuple[:class:`Vector`, float]\n");
335 ret = PyTuple_New(2);
348 Quaternion_to_swing_twist_doc,
349 ".. method:: to_swing_twist(axis, /)\n"
351 " Split the rotation into a swing quaternion with the specified\n"
352 " axis fixed at zero, and the remaining twist rotation angle.\n"
354 " :param axis: Twist axis as a string.\n"
355 " :type axis: Literal['X', 'Y', 'Z']\n"
356 " :return: Swing, twist angle.\n"
357 " :rtype: tuple[:class:`Quaternion`, float]\n");
362 const char *axis_str =
nullptr;
363 float swing[4], twist;
366 if (axis_arg && PyUnicode_Check(axis_arg)) {
367 axis_str = PyUnicode_AsUTF8(axis_arg);
370 if (axis_str && axis_str[0] >=
'X' && axis_str[0] <=
'Z' && axis_str[1] == 0) {
371 axis = axis_str[0] -
'X';
374 PyErr_SetString(PyExc_ValueError,
375 "Quaternion.to_swing_twist(): "
376 "the axis argument must be "
377 "a string in 'X', 'Y', 'Z'");
387 ret = PyTuple_New(2);
401 Quaternion_to_exponential_map_doc,
402 ".. method:: to_exponential_map()\n"
404 " Return the exponential map representation of the quaternion.\n"
406 " This representation consists of the rotation axis multiplied by the rotation angle.\n"
407 " Such a representation is useful for interpolation between multiple orientations.\n"
409 " :return: 3D exponential map.\n"
410 " :rtype: :class:`Vector`\n"
412 " To convert back to a quaternion, pass it to the :class:`Quaternion` constructor.\n");
433 Quaternion_cross_doc,
434 ".. method:: cross(other, /)\n"
436 " Return the cross product of this quaternion and another.\n"
438 " :param other: The other quaternion to perform the cross product with.\n"
439 " :type other: :class:`Quaternion`\n"
440 " :return: The cross product.\n"
441 " :rtype: :class:`Quaternion`\n");
451 tquat,
QUAT_SIZE,
QUAT_SIZE, value,
"Quaternion.cross(other), invalid 'other' arg") ==
470 ".. method:: dot(other, /)\n"
472 " Return the dot product of this quaternion and another.\n"
474 " :param other: The other quaternion to perform the dot product with.\n"
475 " :type other: :class:`Quaternion`\n"
476 " :return: The dot product.\n"
487 tquat,
QUAT_SIZE,
QUAT_SIZE, value,
"Quaternion.dot(other), invalid 'other' arg") == -1)
492 return PyFloat_FromDouble(
dot_qtqt(self->quat, tquat));
503 Quaternion_rotation_difference_doc,
504 ".. method:: rotation_difference(other, /)\n"
506 " Returns a quaternion representing the rotational difference.\n"
508 " :param other: second quaternion.\n"
509 " :type other: :class:`Quaternion`\n"
510 " :return: the rotational difference between the two quat rotations.\n"
511 " :rtype: :class:`Quaternion`\n");
524 "Quaternion.rotation_difference(other), invalid 'other' arg") == -1)
542 Quaternion_slerp_doc,
543 ".. method:: slerp(other, factor, /)\n"
545 " Returns the interpolation of two quaternions.\n"
547 " :param other: value to interpolate with.\n"
548 " :type other: :class:`Quaternion`\n"
549 " :param factor: The interpolation value in [0.0, 1.0].\n"
550 " :type factor: float\n"
551 " :return: The interpolated rotation.\n"
552 " :rtype: :class:`Quaternion`\n");
558 if (!PyArg_ParseTuple(args,
565 PyErr_SetString(PyExc_TypeError,
567 "expected Quaternion types and float");
576 tquat,
QUAT_SIZE,
QUAT_SIZE, value,
"Quaternion.slerp(other), invalid 'other' arg") ==
582 if (fac > 1.0f || fac < 0.0f) {
583 PyErr_SetString(PyExc_ValueError,
585 "interpolation factor must be between 0.0 and 1.0");
602 Quaternion_rotate_doc,
603 ".. method:: rotate(other, /)\n"
605 " Rotates the quaternion by another mathutils value.\n"
607 " :param other: rotation component of mathutils value\n"
608 " :type other: :class:`Euler` | :class:`Quaternion` | :class:`Matrix`\n");
611 float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
634 Quaternion_make_compatible_doc,
635 ".. method:: make_compatible(other, /)\n"
637 " Make this quaternion compatible with another,\n"
638 " so interpolating between them works as intended.\n"
640 " :param other: The reference quaternion to make this one compatible with.\n"
641 " :type other: :class:`Quaternion`\n");
655 "Quaternion.make_compatible(other), invalid 'other' arg") == -1)
681 Quaternion_normalize_doc,
682 ".. method:: normalize()\n"
684 " Normalize the quaternion.\n");
698 Quaternion_normalized_doc,
699 ".. method:: normalized()\n"
701 " Return a new normalized quaternion.\n"
703 " :return: a normalized copy.\n"
704 " :rtype: :class:`Quaternion`\n");
720 Quaternion_invert_doc,
721 ".. method:: invert()\n"
723 " Set the quaternion to its inverse.\n");
737 Quaternion_inverted_doc,
738 ".. method:: inverted()\n"
740 " Return a new, inverted quaternion.\n"
742 " :return: the inverted value.\n"
743 " :rtype: :class:`Quaternion`\n");
757 Quaternion_identity_doc,
758 ".. method:: identity()\n"
760 " Set the quaternion to an identity quaternion.\n");
781 Quaternion_negate_doc,
782 ".. method:: negate()\n"
784 " Set the quaternion to its negative.\n");
805 Quaternion_conjugate_doc,
806 ".. method:: conjugate()\n"
808 " Set the quaternion to its conjugate (negate x, y, z).\n");
822 Quaternion_conjugated_doc,
823 ".. method:: conjugated()\n"
825 " Return a new conjugated quaternion.\n"
827 " :return: a new quaternion.\n"
828 " :rtype: :class:`Quaternion`\n");
843 ".. method:: copy()\n"
845 " Returns a copy of this quaternion.\n"
847 " :return: A copy of the quaternion.\n"
848 " :rtype: :class:`Quaternion`\n"
850 " .. note:: use this to get a copy of a wrapped quaternion with\n"
851 " no reference to the original data.\n");
876 PyObject *
ret, *tuple;
884 ret = PyUnicode_FromFormat(
"Quaternion(%R)", tuple);
890#ifndef MATH_STANDALONE
902 "<Quaternion (w=%.4f, x=%.4f, y=%.4f, z=%.4f)>",
928 memset(view, 0,
sizeof(*view));
930 view->obj =
reinterpret_cast<PyObject *
>(self);
931 view->buf =
static_cast<void *
>(self->quat);
932 view->len = Py_ssize_t(
QUAT_SIZE *
sizeof(
float));
933 view->itemsize =
sizeof(
float);
935 if ((flags & PyBUF_WRITABLE) == 0) {
938 if (flags & PyBUF_FORMAT) {
939 view->format =
const_cast<char *
>(
"f");
953 if (view->readonly == 0) {
993 res = ok ? Py_False : Py_True;
1000 res = Py_NotImplemented;
1004 PyErr_BadArgument();
1009 return Py_NewRef(res);
1047 PyErr_SetString(PyExc_IndexError,
1048 "quaternion[attribute]: "
1049 "array index out of range");
1057 return PyFloat_FromDouble(self->quat[i]);
1069 f =
float(PyFloat_AsDouble(ob));
1071 if (f == -1.0f && PyErr_Occurred()) {
1072 PyErr_SetString(PyExc_TypeError,
1073 "quaternion[index] = x: "
1074 "assigned value not a number");
1079 PyErr_SetString(PyExc_IndexError,
1080 "quaternion[attribute] = x: "
1081 "array assignment index out of range");
1097 Py_ssize_t slice_length)
1103 PyObject *tuple = PyTuple_New(slice_length);
1104 Py_ssize_t
index = start;
1105 for (Py_ssize_t i = 0; i < slice_length; i++,
index +=
step) {
1107 PyTuple_SET_ITEM(tuple, i, PyFloat_FromDouble(self->quat[
index]));
1120 Py_ssize_t slice_length,
1138 quat, slice_length, slice_length,
seq,
"mathutils.Quaternion[slice] = seq") == -1)
1143 Py_ssize_t
index = start;
1144 for (Py_ssize_t i = 0; i < slice_length; i++,
index +=
step) {
1146 self->quat[
index] = quat[i];
1156 if (PyIndex_Check(item)) {
1158 i = PyNumber_AsSsize_t(item, PyExc_IndexError);
1159 if (i == -1 && PyErr_Occurred()) {
1167 if (PySlice_Check(item)) {
1168 Py_ssize_t start, stop,
step, slice_length;
1170 if (PySlice_GetIndicesEx(item,
QUAT_SIZE, &start, &stop, &
step, &slice_length) < 0) {
1178 PyExc_TypeError,
"quaternion indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
1185 if (PyIndex_Check(item)) {
1186 Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
1187 if (i == -1 && PyErr_Occurred()) {
1195 if (PySlice_Check(item)) {
1196 Py_ssize_t start, stop,
step, slice_length;
1198 if (PySlice_GetIndicesEx(item,
QUAT_SIZE, &start, &stop, &
step, &slice_length) < 0) {
1206 PyExc_TypeError,
"quaternion indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
1223 PyErr_Format(PyExc_TypeError,
1224 "Quaternion addition: (%s + %s) "
1225 "invalid type for this operation",
1226 Py_TYPE(q1)->tp_name,
1227 Py_TYPE(q2)->tp_name);
1237 add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f);
1249 PyErr_Format(PyExc_TypeError,
1250 "Quaternion subtraction: (%s - %s) "
1251 "invalid type for this operation",
1252 Py_TYPE(q1)->tp_name,
1253 Py_TYPE(q2)->tp_name);
1265 quat[
x] = quat1->quat[
x] - quat2->quat[
x];
1298 if (quat1 && quat2) {
1305 if (((scalar = PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred()) == 0) {
1310 if (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0) {
1315 PyErr_Format(PyExc_TypeError,
1316 "Element-wise multiplication: "
1317 "not supported between '%.200s' and '%.200s' types",
1318 Py_TYPE(q1)->tp_name,
1319 Py_TYPE(q2)->tp_name);
1342 if (quat1 && quat2) {
1345 else if (quat1 && (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) {
1350 PyErr_Format(PyExc_TypeError,
1351 "Element-wise multiplication: "
1352 "not supported between '%.200s' and '%.200s' types",
1353 Py_TYPE(q1)->tp_name,
1354 Py_TYPE(q2)->tp_name);
1382 if (quat1 && quat2) {
1393 PyErr_SetString(PyExc_ValueError,
1394 "Vector multiplication: "
1395 "only 3D vector rotations (with quats) "
1396 "currently supported");
1410 PyErr_Format(PyExc_TypeError,
1411 "Quaternion multiplication: "
1412 "not supported between '%.200s' and '%.200s' types",
1413 Py_TYPE(q1)->tp_name,
1414 Py_TYPE(q2)->tp_name);
1437 if (quat1 && quat2) {
1442 PyErr_Format(PyExc_TypeError,
1443 "In place quaternion multiplication: "
1444 "not supported between '%.200s' and '%.200s' types",
1445 Py_TYPE(q1)->tp_name,
1446 Py_TYPE(q2)->tp_name);
1540 Quaternion_axis_doc,
1541 "Quaternion component value.\n"
1556 Quaternion_magnitude_doc,
1557 "Size of the quaternion (read-only).\n"
1566 return PyFloat_FromDouble(
sqrtf(
dot_qtqt(self->quat, self->quat)));
1571 Quaternion_angle_doc,
1572 "Angle of the quaternion.\n"
1590 return PyFloat_FromDouble(
angle);
1598 float axis[3], angle_dummy;
1608 angle = PyFloat_AsDouble(value);
1610 if (
angle == -1.0f && PyErr_Occurred()) {
1611 PyErr_SetString(PyExc_TypeError,
"Quaternion.angle = value: float expected");
1631 Quaternion_axis_vector_doc,
1632 "Quaternion axis as a vector.\n"
1634 ":type: :class:`Vector`\n");
1695 Quaternion_axis_doc,
1700 Quaternion_axis_doc,
1705 Quaternion_axis_doc,
1710 Quaternion_axis_doc,
1714 static_cast<setter
>(
nullptr),
1715 Quaternion_magnitude_doc,
1720 Quaternion_angle_doc,
1725 Quaternion_axis_vector_doc,
1729 static_cast<setter
>(
nullptr),
1734 static_cast<setter
>(
nullptr),
1739 static_cast<setter
>(
nullptr),
1744 static_cast<setter
>(
nullptr),
1747 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1758# pragma clang diagnostic push
1759# pragma clang diagnostic ignored "-Wcast-function-type"
1761# pragma GCC diagnostic push
1762# pragma GCC diagnostic ignored "-Wcast-function-type"
1771 Quaternion_identity_doc},
1775 Quaternion_negate_doc},
1781 Quaternion_conjugate_doc},
1785 Quaternion_conjugated_doc},
1790 Quaternion_invert_doc},
1794 Quaternion_inverted_doc},
1799 Quaternion_normalize_doc},
1803 Quaternion_normalized_doc},
1809 Quaternion_to_euler_doc},
1813 Quaternion_to_matrix_doc},
1817 Quaternion_to_axis_angle_doc},
1821 Quaternion_to_swing_twist_doc},
1822 {
"to_exponential_map",
1825 Quaternion_to_exponential_map_doc},
1828 {
"cross",
reinterpret_cast<PyCFunction
>(
Quaternion_cross), METH_O, Quaternion_cross_doc},
1829 {
"dot",
reinterpret_cast<PyCFunction
>(
Quaternion_dot), METH_O, Quaternion_dot_doc},
1830 {
"rotation_difference",
1833 Quaternion_rotation_difference_doc},
1834 {
"slerp",
reinterpret_cast<PyCFunction
>(
Quaternion_slerp), METH_VARARGS, Quaternion_slerp_doc},
1835 {
"rotate",
reinterpret_cast<PyCFunction
>(
Quaternion_rotate), METH_O, Quaternion_rotate_doc},
1839 Quaternion_make_compatible_doc},
1847 {
"copy",
reinterpret_cast<PyCFunction
>(
Quaternion_copy), METH_NOARGS, Quaternion_copy_doc},
1848 {
"__copy__",
reinterpret_cast<PyCFunction
>(
Quaternion_copy), METH_NOARGS, Quaternion_copy_doc},
1852 Quaternion_copy_doc},
1853 {
nullptr,
nullptr, 0,
nullptr},
1858# pragma clang diagnostic pop
1860# pragma GCC diagnostic pop
1870#ifdef MATH_STANDALONE
1871# define Quaternion_str nullptr
1877 ".. class:: Quaternion(seq=(1.0, 0.0, 0.0, 0.0), angle=0.0, /)\n"
1879 " This object gives access to Quaternions in Blender.\n"
1881 " :param seq: A (w, x, y, z) quaternion, a 3D exponential map vector,\n"
1882 " or a 3D axis vector (when *angle* is also provided).\n"
1883 " :type seq: Sequence[float]\n"
1884 " :param angle: rotation angle, in radians\n"
1885 " :type angle: float\n"
1887 " The constructor takes arguments in various forms:\n"
1890 " Create an identity quaternion\n"
1892 " Create a quaternion from a ``(w, x, y, z)`` vector.\n"
1893 " (*exponential_map*)\n"
1894 " Create a quaternion from a 3d exponential map vector.\n"
1896 " .. seealso:: :meth:`to_exponential_map`\n"
1897 " (*axis, angle*)\n"
1898 " Create a quaternion representing a rotation of *angle* radians over *axis*.\n"
1900 " .. seealso:: :meth:`to_axis_angle`\n");
1902 PyVarObject_HEAD_INIT(
nullptr, 0)
1921 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
1953#ifdef MATH_STANDALONE
1954# undef Quaternion_str
1968 quat_alloc =
static_cast<float *
>(PyMem_Malloc(
QUAT_SIZE *
sizeof(
float)));
1969 if (quat_alloc ==
nullptr) [[unlikely]] {
1970 PyErr_SetString(PyExc_MemoryError,
1972 "problem allocating data");
1978 self->quat = quat_alloc;
1980 self->cb_user =
nullptr;
1981 self->cb_type = self->cb_subtype = 0;
1993 PyMem_Free(quat_alloc);
1996 return reinterpret_cast<PyObject *
>(self);
2006 self->cb_user =
nullptr;
2007 self->cb_type = self->cb_subtype = 0;
2013 return reinterpret_cast<PyObject *
>(self);
2022 self->cb_user = cb_user;
2023 self->cb_type = cb_type;
2024 self->cb_subtype = cb_subtype;
2025 BLI_assert(!PyObject_GC_IsTracked((PyObject *)self));
2026 PyObject_GC_Track(self);
2029 return reinterpret_cast<PyObject *
>(self);
A dynamically sized string ADT.
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float length(VecOp< float, D >) RET
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
#define BaseMath_ReadCallback_ForWrite(_self)
#define BaseMath_Prepare_ForBufferAccess(_self, _view, _flags)
#define BaseMath_ReadIndexCallback(_self, _index)
#define BaseMath_WriteCallback(_self)
#define BASE_MATH_NEW(struct_name, root_type, base_type)
#define BaseMathObject_Prepare_ForHash(_self)
#define BASE_MATH_FLAG_DEFAULT
#define BaseMath_Prepare_ForWrite(_self)
#define BaseMath_ReadCallback(_self)
#define BaseMath_WriteIndexCallback(_self, _index)
#define QuaternionObject_Check(v)
#define VectorObject_Check(v)
char BaseMathObject_owner_doc[]
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
char BaseMathObject_freeze_doc[]
static PyObject * Quaternion_conjugated(QuaternionObject *self)
int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps)
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4])
static PyObject * Quaternion_deepcopy(QuaternionObject *self, PyObject *args)
static PyObject * Quaternion_normalized(QuaternionObject *self)
static PyObject * Quaternion_imul(PyObject *q1, PyObject *q2)
bool mathutils_slice_is_subset(Py_ssize_t start, Py_ssize_t step, Py_ssize_t slice_length, Py_ssize_t array_num)
static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *type)
static PyObject * Quaternion_to_axis_angle(QuaternionObject *self)
void BaseMathObject_dealloc(BaseMathObject *self)
static PyObject * Quaternion_dot(QuaternionObject *self, PyObject *value)
MINLINE void copy_v3_v3(float r[3], const float a[3])
static PyObject * Quaternion_to_swing_twist(QuaternionObject *self, PyObject *axis_arg)
int PyC_CheckArgs_DeepCopy(PyObject *args)
void conjugate_qt(float q[4])
float quat_split_swing_and_twist(const float q_in[4], int axis, float r_swing[4], float r_twist[4])
static PyObject * Quaternion_axis_get(QuaternionObject *self, void *type)
static PyNumberMethods Quaternion_NumMethods
Py_hash_t mathutils_array_hash(const float *array, size_t array_len)
void invert_qt(float q[4])
PyObject * mathutils_dynstr_to_py(DynStr *ds)
static PyObject * Quaternion_angle_get(QuaternionObject *self, void *)
static void Quaternion_releasebuffer(PyObject *, Py_buffer *view)
PyObject * Quaternion_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
static PyObject * Quaternion_conjugate(QuaternionObject *self)
static PyObject * quat_mul_float(QuaternionObject *quat, const float scalar)
static PyObject * Quaternion_identity(QuaternionObject *self)
static int Quaternion_ass_item(QuaternionObject *self, Py_ssize_t i, PyObject *ob)
static PyObject * Quaternion_str(QuaternionObject *self)
float normalize_qt(float q[4])
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
PyObject * BaseMathObject_owner_get(BaseMathObject *self, void *)
PyTypeObject quaternion_Type
static PyObject * Quaternion_to_euler(QuaternionObject *self, PyObject *args)
float dot_qtqt(const float a[4], const float b[4])
static PyObject * Quaternion_normalize(QuaternionObject *self)
static PyObject * Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
MINLINE float safe_acosf(float a)
PyObject * Euler_CreatePyObject(const float eul[3], const short order, PyTypeObject *base_type)
void quat_to_eul(float eul[3], const float quat[4])
static PyObject * Quaternion_cross(QuaternionObject *self, PyObject *value)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void expmap_to_quat(float r[4], const float expmap[3])
double double_round(double x, int ndigits)
PyObject * Quaternion_CreatePyObject_wrap(float quat[4], PyTypeObject *base_type)
int BaseMathObject_clear(BaseMathObject *self)
static PyObject * Quaternion_add(PyObject *q1, PyObject *q2)
static PyObject * Quaternion_make_compatible(QuaternionObject *self, PyObject *value)
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
PyObject * BaseMathObject_freeze(BaseMathObject *self)
static PyObject * Quaternion_inverted(QuaternionObject *self)
static PyObject * quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *), QuaternionObject *self)
static int Quaternion_angle_set(QuaternionObject *self, PyObject *value, void *)
int BaseMathObject_is_gc(BaseMathObject *self)
void quat_to_compatible_eulO(float eul[3], const float oldrot[3], short order, const float quat[4])
static PyGetSetDef Quaternion_getseters[]
void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
static int Quaternion_getbuffer(PyObject *obj, Py_buffer *view, int flags)
static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyObject *value)
static PySequenceMethods Quaternion_SeqMethods
void mul_qt_v3(const float q[4], float r[3])
static PyObject * Quaternion_rotate(QuaternionObject *self, PyObject *value)
void quat_to_mat3(float m[3][3], const float q[4])
PyObject * BaseMathObject_is_frozen_get(BaseMathObject *self, void *)
void quat_to_compatible_eul(float eul[3], const float oldrot[3], const float quat[4])
static PyObject * Quaternion_to_exponential_map(QuaternionObject *self)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
PyObject * BaseMathObject_is_valid_get(BaseMathObject *self, void *)
static PyObject * Quaternion_magnitude_get(QuaternionObject *self, void *)
static Py_hash_t Quaternion_hash(QuaternionObject *self)
static PyObject * Quaternion_slice(QuaternionObject *self, Py_ssize_t start, Py_ssize_t step, Py_ssize_t slice_length)
PyObject * Matrix_CreatePyObject(const float *mat, const ushort col_num, const ushort row_num, PyTypeObject *base_type)
PyObject * Quaternion_CreatePyObject(const float quat[4], PyTypeObject *base_type)
void copy_qt_qt(float q[4], const float a[4])
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
void quat_to_eulO(float e[3], short order, const float q[4])
static int Quaternion_ass_slice(QuaternionObject *self, Py_ssize_t start, Py_ssize_t step, Py_ssize_t slice_length, PyObject *seq)
@ BASE_MATH_FLAG_HAS_BUFFER_VIEW
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
static PyObject * Quaternion_negate(QuaternionObject *self)
static PyObject * Quaternion_subscript(QuaternionObject *self, PyObject *item)
void mul_vn_vn(float *array_tar, const float *array_src, int size)
static PyObject * Quaternion_imatmul(PyObject *q1, PyObject *q2)
static PyObject * Quaternion_invert(QuaternionObject *self)
static PyObject * Quaternion_sub(PyObject *q1, PyObject *q2)
static PyObject * Quaternion_item(QuaternionObject *self, Py_ssize_t i)
short euler_order_from_string(const char *str, const char *error_prefix)
static PyMethodDef Quaternion_methods[]
static PyBufferProcs Quaternion_as_buffer
static PyObject * Quaternion_rotation_difference(QuaternionObject *self, PyObject *value)
static PyObject * Quaternion_axis_vector_get(QuaternionObject *self, void *)
static PyObject * Quaternion_matmul(PyObject *q1, PyObject *q2)
static PyObject * Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject * BaseMathObject_is_wrapped_get(BaseMathObject *self, void *)
char BaseMathObject_is_valid_doc[]
static PyObject * Quaternion_repr(QuaternionObject *self)
int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg)
void add_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix)
void quat_to_expmap(float expmap[3], const float q[4])
static PyObject * Quaternion_slerp(QuaternionObject *self, PyObject *args)
char BaseMathObject_is_frozen_doc[]
static PyObject * Quaternion_to_matrix(QuaternionObject *self)
static PyObject * Quaternion_vectorcall(PyObject *type, PyObject *const *args, const size_t nargsf, PyObject *kwnames)
void mul_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size)
static PyObject * Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
static PyObject * Quaternion_copy(QuaternionObject *self)
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
static void quat__axis_angle_sanitize(float axis[3], float *angle)
MINLINE void negate_v4_v4(float r[4], const float a[4])
static PyObject * Quaternion_mul(PyObject *q1, PyObject *q2)
static int Quaternion_axis_vector_set(QuaternionObject *self, PyObject *value, void *)
DynStr * BLI_dynstr_new() ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
static PyObject * Quaternion_neg(QuaternionObject *self)
int PyC_ParseTypeOrNone(PyObject *o, void *p)
static Py_ssize_t Quaternion_len(QuaternionObject *)
void mul_qt_fl(float q[4], float f)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void mat3_to_quat(float q[4], const float mat[3][3])
static PyMappingMethods Quaternion_AsMapping
char BaseMathObject_is_wrapped_doc[]
float normalize_qt_qt(float r[4], const float q[4])
float angle_wrap_rad(float angle)
#define PyC_TYPE_OR_NONE_INIT(py_type, value_p)
#define PyTuple_SET_ITEMS(op_arg,...)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float