|
Blender V5.0
|
#include <Python.h>#include "mathutils.hh"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_utildefines.h"#include "../generic/py_capi_utils.hh"#include "BLI_dynstr.h"#include "mathutils_geometry.hh"#include "mathutils_interpolate.hh"#include "mathutils_bvhtree.hh"#include "mathutils_kdtree.hh"#include "mathutils_noise.hh"Go to the source code of this file.
Macros | |
| #define | SIGNMASK(i) |
| #define | MATHUTILS_TOT_CB 17 |
Functions | |
| PyDoc_STRVAR (M_Mathutils_doc, "This module provides access to math operations.\n" "\n" ".. note::\n" "\n" " Classes, methods and attributes that accept vectors also accept other numeric sequences,\n" " such as tuples, lists.\n" "\n" "The :mod:`mathutils` module provides the following classes:\n" "\n" "- :class:`Color`,\n" "- :class:`Euler`,\n" "- :class:`Matrix`,\n" "- :class:`Quaternion`,\n" "- :class:`Vector`,\n") | |
| static int | mathutils_array_parse_fast (float *array, int size, PyObject *value_fast, const char *error_prefix) |
| Py_hash_t | mathutils_array_hash (const float *array, size_t array_len) |
| int | mathutils_array_parse (float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix) |
| int | mathutils_array_parse_alloc (float **array, int array_num_min, PyObject *value, const char *error_prefix) |
| int | mathutils_array_parse_alloc_v (float **array, int array_dim, PyObject *value, const char *error_prefix) |
| int | mathutils_int_array_parse (int *array, int array_dim, PyObject *value, const char *error_prefix) |
| int | mathutils_array_parse_alloc_vi (int **array, int array_dim, PyObject *value, const char *error_prefix) |
| bool | mathutils_array_parse_alloc_viseq (PyObject *value, const char *error_prefix, blender::Array< blender::Vector< int > > &r_data) |
| int | mathutils_any_to_rotmat (float rmat[3][3], PyObject *value, const char *error_prefix) |
| int | EXPP_FloatsAreEqual (float af, float bf, int maxDiff) |
| int | EXPP_VectorsAreEqual (const float *vecA, const float *vecB, int size, int floatSteps) |
| PyObject * | mathutils_dynstr_to_py (DynStr *ds) |
| uchar | Mathutils_RegisterCallback (Mathutils_Callback *cb) |
| int | _BaseMathObject_CheckCallback (BaseMathObject *self) |
| int | _BaseMathObject_ReadCallback (BaseMathObject *self) |
| int | _BaseMathObject_WriteCallback (BaseMathObject *self) |
| int | _BaseMathObject_ReadIndexCallback (BaseMathObject *self, int index) |
| int | _BaseMathObject_WriteIndexCallback (BaseMathObject *self, int index) |
| void | _BaseMathObject_RaiseFrozenExc (const BaseMathObject *self) |
| void | _BaseMathObject_RaiseNotFrozenExc (const BaseMathObject *self) |
| int | _BaseMathObject_ResizeOkOrRaiseExc (BaseMathObject *self, const char *error_prefix) |
| int | _BaseMathObject_RaiseBufferViewExc (BaseMathObject *self, Py_buffer *view, int flags) |
| PyObject * | BaseMathObject_owner_get (BaseMathObject *self, void *) |
| PyObject * | BaseMathObject_is_wrapped_get (BaseMathObject *self, void *) |
| PyObject * | BaseMathObject_is_frozen_get (BaseMathObject *self, void *) |
| PyObject * | BaseMathObject_is_valid_get (BaseMathObject *self, void *) |
| PyObject * | BaseMathObject_freeze (BaseMathObject *self) |
| int | BaseMathObject_traverse (BaseMathObject *self, visitproc visit, void *arg) |
| int | BaseMathObject_clear (BaseMathObject *self) |
| static bool | BaseMathObject_is_tracked (BaseMathObject *self) |
| void | BaseMathObject_dealloc (BaseMathObject *self) |
| int | BaseMathObject_is_gc (BaseMathObject *self) |
| PyObject * | _BaseMathObject_new_impl (PyTypeObject *root_type, PyTypeObject *base_type) |
| PyMODINIT_FUNC | PyInit_mathutils () |
Variables | |
| static Mathutils_Callback * | mathutils_callbacks [MATHUTILS_TOT_CB] = {nullptr} |
| char | BaseMathObject_owner_doc [] = "The item this is wrapping or None (read-only)." |
| char | BaseMathObject_is_wrapped_doc [] |
| char | BaseMathObject_is_frozen_doc [] |
| char | BaseMathObject_is_valid_doc [] = "True when the owner of this data is valid.\n\n:type: bool" |
| char | BaseMathObject_freeze_doc [] |
| static PyMethodDef | M_Mathutils_methods [] |
| static PyModuleDef | M_Mathutils_module_def |
| #define MATHUTILS_TOT_CB 17 |
Definition at line 518 of file mathutils.cc.
Referenced by Mathutils_RegisterCallback().
| #define SIGNMASK | ( | i | ) |
|
nodiscard |
Definition at line 539 of file mathutils.cc.
References Mathutils_Callback::check, LIKELY, mathutils_callbacks, and self.
|
nodiscard |
Definition at line 767 of file mathutils.cc.
References BaseMathObject_is_tracked(), BLI_assert, and ELEM.
|
nodiscard |
Definition at line 638 of file mathutils.cc.
References BASE_MATH_FLAG_HAS_BUFFER_VIEW, BASE_MATH_FLAG_IS_FROZEN, BaseMath_WriteCallback, self, UNLIKELY, and view.
| void _BaseMathObject_RaiseFrozenExc | ( | const BaseMathObject * | self | ) |
Definition at line 604 of file mathutils.cc.
References self.
| void _BaseMathObject_RaiseNotFrozenExc | ( | const BaseMathObject * | self | ) |
Definition at line 609 of file mathutils.cc.
References self.
|
nodiscard |
Definition at line 548 of file mathutils.cc.
References Mathutils_Callback::get, LIKELY, mathutils_callbacks, and self.
|
nodiscard |
Definition at line 576 of file mathutils.cc.
References Mathutils_Callback::get_index, LIKELY, mathutils_callbacks, and self.
|
nodiscard |
To implement #BaseMath_Prepare_ForResize.
Definition at line 615 of file mathutils.cc.
References BASE_MATH_FLAG_HAS_BUFFER_VIEW, BASE_MATH_FLAG_IS_FROZEN, BASE_MATH_FLAG_IS_WRAP, self, and UNLIKELY.
|
nodiscard |
Definition at line 563 of file mathutils.cc.
References LIKELY, mathutils_callbacks, self, and Mathutils_Callback::set.
|
nodiscard |
Definition at line 590 of file mathutils.cc.
References LIKELY, mathutils_callbacks, self, and Mathutils_Callback::set_index.
| int BaseMathObject_clear | ( | BaseMathObject * | self | ) |
Definition at line 722 of file mathutils.cc.
References self.
Referenced by BaseMathObject_dealloc().
| void BaseMathObject_dealloc | ( | BaseMathObject * | self | ) |
Definition at line 740 of file mathutils.cc.
References BASE_MATH_FLAG_IS_WRAP, BaseMathObject_CheckExact, BaseMathObject_clear(), BaseMathObject_is_tracked(), BLI_assert, and self.
|
nodiscard |
Definition at line 699 of file mathutils.cc.
References BASE_MATH_FLAG_HAS_BUFFER_VIEW, BASE_MATH_FLAG_IS_FROZEN, BASE_MATH_FLAG_IS_WRAP, and self.
|
nodiscard |
Definition at line 680 of file mathutils.cc.
References BASE_MATH_FLAG_IS_FROZEN, and self.
| int BaseMathObject_is_gc | ( | BaseMathObject * | self | ) |
Definition at line 762 of file mathutils.cc.
References self.
|
static |
Only to validate assumptions when debugging.
Definition at line 730 of file mathutils.cc.
References self.
Referenced by _BaseMathObject_new_impl(), and BaseMathObject_dealloc().
|
nodiscard |
Definition at line 686 of file mathutils.cc.
References BaseMath_CheckCallback, and self.
|
nodiscard |
Definition at line 673 of file mathutils.cc.
References BASE_MATH_FLAG_IS_WRAP, and self.
|
nodiscard |
Definition at line 665 of file mathutils.cc.
| int BaseMathObject_traverse | ( | BaseMathObject * | self, |
| visitproc | visit, | ||
| void * | arg ) |
Definition at line 716 of file mathutils.cc.
References self.
Definition at line 470 of file mathutils.cc.
References BLI_assert, diff(), SIGNMASK, and v2.
Referenced by EXPP_VectorsAreEqual(), and quat__axis_angle_sanitize().
|
nodiscard |
Definition at line 489 of file mathutils.cc.
References EXPP_FloatsAreEqual(), size(), and x.
Referenced by Color_richcmpr(), Euler_richcmpr(), Matrix_richcmpr(), Quaternion_richcmpr(), and Vector_richcmpr().
|
nodiscard |
Definition at line 408 of file mathutils.cc.
References BaseMath_ReadCallback, EulerObject_Check, eulO_to_mat3(), matrix_as_3x3(), MatrixObject_Check, normalize_m3(), normalize_qt_qt(), quat_to_mat3(), and QuaternionObject_Check.
Referenced by Euler_rotate(), Matrix_rotate(), Quaternion_rotate(), and Vector_rotate().
|
nodiscard |
helper function that returns a Python __hash__.
Definition at line 68 of file mathutils.cc.
References i, len, mult(), x, and y.
Referenced by Color_hash(), Euler_hash(), Matrix_hash(), Quaternion_hash(), and Vector_hash().
|
nodiscard |
Helper function.
Definition at line 96 of file mathutils.cc.
References BaseMath_ReadCallback, CLAMP_MAX, ColorObject_Check, data, EulerObject_Check, flag, mathutils_array_parse_fast(), MU_ARRAY_FLAGS, MU_ARRAY_SPILL, MU_ARRAY_ZERO, num, Py_DECREF(), QuaternionObject_Check, and VectorObject_Check.
Referenced by bpy_bm_geometry_intersect_face_point(), bpy_bmface_normal_set(), BPy_BMLayerItem_SetItem(), BPy_BMLoopColor_AssignPyObject(), bpy_bmloopuv_uv_set(), bpy_bmvert_co_set(), bpy_bmvert_normal_set(), bpy_bmvertseq_new(), bpy_bmvertskin_radius_set(), bpy_slot_from_py(), C_BVHTree_FromPolygons(), C_Matrix_Diagonal(), C_Matrix_LocRotScale(), C_Matrix_OrthoProjection(), C_Matrix_Rotation(), C_Matrix_Scale(), C_Matrix_Shear(), C_Matrix_Translation(), Color_ass_slice(), Color_hsv_set(), Color_vectorcall(), convert_v2(), convert_v3(), convert_v4(), Euler_ass_slice(), Euler_make_compatible(), Euler_vectorcall(), FEdgeSharp_normal_left_set(), FEdgeSharp_normal_right_set(), FEdgeSmooth_normal_set(), Freestyle_blendRamp(), FrsMaterial_ambient_set(), FrsMaterial_diffuse_set(), FrsMaterial_emission_set(), FrsMaterial_line_set(), FrsMaterial_specular_set(), M_Geometry_area_tri(), M_Geometry_barycentric_transform(), M_Geometry_closest_point_on_tri(), M_Geometry_distance_point_to_plane(), M_Geometry_interpolate_bezier(), M_Geometry_intersect_line_line(), M_Geometry_intersect_line_line_2d(), M_Geometry_intersect_line_plane(), M_Geometry_intersect_line_sphere(), M_Geometry_intersect_line_sphere_2d(), M_Geometry_intersect_plane_plane(), M_Geometry_intersect_point_line(), M_Geometry_intersect_point_line_segment(), M_Geometry_intersect_point_quad_2d(), M_Geometry_intersect_point_tri(), M_Geometry_intersect_point_tri_2d(), M_Geometry_intersect_ray_tri(), M_Geometry_intersect_sphere_sphere_2d(), M_Geometry_intersect_tri_tri_2d(), M_Geometry_tessellate_polygon(), M_Geometry_volume_tetrahedron(), M_Interpolate_poly_3d_calc(), M_Noise_cell(), M_Noise_cell_vector(), M_Noise_fractal(), M_Noise_hetero_terrain(), M_Noise_hybrid_multi_fractal(), M_Noise_multi_fractal(), M_Noise_noise(), M_Noise_noise_vector(), M_Noise_ridged_multi_fractal(), M_Noise_turbulence(), M_Noise_turbulence_vector(), M_Noise_variable_lacunarity(), M_Noise_voronoi(), mathutils_array_parse_alloc_v(), Matrix_ass_item_col(), Matrix_ass_item_row(), Matrix_ass_slice(), Matrix_translation_set(), py_bvhtree_find_nearest(), py_bvhtree_find_nearest_range(), py_bvhtree_ray_cast(), py_kdtree_find(), py_kdtree_find_n(), py_kdtree_find_range(), py_kdtree_insert(), pygpu_framebuffer_clear(), pygpu_matrix_scale(), pygpu_matrix_translate(), pygpu_shader_uniform_float(), Quaternion_ass_slice(), Quaternion_axis_vector_set(), Quaternion_cross(), Quaternion_dot(), Quaternion_make_compatible(), Quaternion_rotation_difference(), Quaternion_slerp(), Quaternion_vectorcall(), StrokeAttribute_color_set(), StrokeAttribute_thickness_set(), StrokeVertex_point_set(), SVertex_point_2d_set(), SVertex_point_3d_set(), Vector_angle(), Vector_angle_signed(), Vector_cross(), Vector_reflect(), Vector_rotation_difference(), Vector_slerp(), and Vector_swizzle_set().
|
nodiscard |
Definition at line 192 of file mathutils.cc.
References BaseMath_ReadCallback, ColorObject_Check, data, EulerObject_Check, mathutils_array_parse_fast(), num, Py_DECREF(), QuaternionObject_Check, ret, and VectorObject_Check.
Referenced by C_Vector_Repeat(), Vector_ass_slice(), Vector_dot(), Vector_lerp(), Vector_project(), and Vector_vectorcall().
|
nodiscard |
Parse an array of vectors.
Definition at line 259 of file mathutils.cc.
References i, mathutils_array_parse(), MU_ARRAY_FLAGS, num, and Py_DECREF().
Referenced by bpy_bm_utils_face_split(), M_Geometry_box_fit_2d(), M_Geometry_convex_hull_2d(), M_Geometry_delaunay_2d_cdt(), M_Geometry_normal(), M_Geometry_points_in_planes(), and M_Interpolate_poly_3d_calc().
|
nodiscard |
Parse sequence of array_dim sequences of integers and return allocated result.
Definition at line 335 of file mathutils.cc.
References i, mathutils_int_array_parse(), Py_DECREF(), and size().
Referenced by M_Geometry_delaunay_2d_cdt().
|
nodiscard |
Parse sequence of variable-length sequences of integers and fill r_data with their values.
Definition at line 372 of file mathutils.cc.
References blender::MutableSpan< T >::data(), i, mathutils_int_array_parse(), Py_DECREF(), blender::MutableSpan< T >::size(), and size().
Referenced by M_Geometry_delaunay_2d_cdt().
|
static |
Definition at line 40 of file mathutils.cc.
Referenced by mathutils_array_parse(), and mathutils_array_parse_alloc().
|
nodiscard |
Definition at line 501 of file mathutils.cc.
References BLI_dynstr_free(), BLI_dynstr_get_cstring_ex(), BLI_dynstr_get_len(), and ret.
Referenced by Color_str(), Euler_str(), Matrix_str(), Quaternion_str(), and Vector_str().
|
nodiscard |
Parse an sequence array_dim integers into array.
Definition at line 300 of file mathutils.cc.
References i, Py_DECREF(), and size().
Referenced by mathutils_array_parse_alloc_vi(), and mathutils_array_parse_alloc_viseq().
|
nodiscard |
Definition at line 521 of file mathutils.cc.
References BLI_assert, i, mathutils_callbacks, and MATHUTILS_TOT_CB.
Referenced by bm_init_types_bmloopcol(), BPY_rna_init(), FEdgeSharp_mathutils_register_callback(), FEdgeSmooth_mathutils_register_callback(), FrsMaterial_mathutils_register_callback(), PyInit_mathutils(), StrokeAttribute_mathutils_register_callback(), StrokeVertex_mathutils_register_callback(), and SVertex_mathutils_register_callback().
| PyDoc_STRVAR | ( | M_Mathutils_doc | , |
| "This module provides access to math operations.\n" "\n" ".. note::\n" "\n" " | Classes, | ||
| methods and attributes that accept vectors also accept other numeric | sequences, | ||
| \n" " such as | tuples, | ||
| lists.\n" "\n" "The :mod:`mathutils` module provides the following classes:\n" "\n" "- :class:`Color` | , | ||
| \n" "- :class:`Euler` | , | ||
| \n" "- :class:`Matrix` | , | ||
| \n" "- :class:`Quaternion` | , | ||
| \n" "- :class:`Vector` | , | ||
| \n" | ) |
| PyMODINIT_FUNC PyInit_mathutils | ( | ) |
Definition at line 816 of file mathutils.cc.
References color_Type, euler_Type, M_Mathutils_module_def, mathutils_matrix_col_cb, mathutils_matrix_col_cb_index, mathutils_matrix_row_cb, mathutils_matrix_row_cb_index, mathutils_matrix_translation_cb, mathutils_matrix_translation_cb_index, Mathutils_RegisterCallback(), matrix_access_Type, matrix_Type, mod, PyInit_mathutils_bvhtree(), PyInit_mathutils_geometry(), PyInit_mathutils_interpolate(), PyInit_mathutils_kdtree(), PyInit_mathutils_noise(), quaternion_Type, and vector_Type.
| char BaseMathObject_freeze_doc[] |
Definition at line 691 of file mathutils.cc.
| char BaseMathObject_is_frozen_doc[] |
Definition at line 678 of file mathutils.cc.
| char BaseMathObject_is_valid_doc[] = "True when the owner of this data is valid.\n\n:type: bool" |
Definition at line 685 of file mathutils.cc.
| char BaseMathObject_is_wrapped_doc[] |
Definition at line 671 of file mathutils.cc.
| char BaseMathObject_owner_doc[] = "The item this is wrapping or None (read-only)." |
Definition at line 664 of file mathutils.cc.
|
static |
Definition at line 791 of file mathutils.cc.
|
static |
Definition at line 795 of file mathutils.cc.
Referenced by PyInit_mathutils().
|
static |
Definition at line 519 of file mathutils.cc.
Referenced by _BaseMathObject_CheckCallback(), _BaseMathObject_ReadCallback(), _BaseMathObject_ReadIndexCallback(), _BaseMathObject_WriteCallback(), _BaseMathObject_WriteIndexCallback(), and Mathutils_RegisterCallback().