Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
mathutils_Matrix.h File Reference

Go to the source code of this file.

Classes

struct  MatrixObject
 

Macros

#define MatrixObject_Check(v)   PyObject_TypeCheck((v), &matrix_Type)
 
#define MatrixObject_CheckExact(v)   (Py_TYPE(v) == &matrix_Type)
 
#define MATRIX_MAX_DIM   4
 
#define MATRIX_ITEM_ASSERT(_mat, _row, _col)   (void)0
 
#define MATRIX_ITEM_INDEX_NUMROW(_totrow, _row, _col)   (((_totrow) * (_col)) + (_row))
 
#define MATRIX_ITEM_INDEX(_mat, _row, _col)    (MATRIX_ITEM_ASSERT(_mat, _row, _col), (((_mat)->row_num * (_col)) + (_row)))
 
#define MATRIX_ITEM_PTR(_mat, _row, _col)   ((_mat)->matrix + MATRIX_ITEM_INDEX(_mat, _row, _col))
 
#define MATRIX_ITEM(_mat, _row, _col)   ((_mat)->matrix[MATRIX_ITEM_INDEX(_mat, _row, _col)])
 
#define MATRIX_COL_INDEX(_mat, _col)   (MATRIX_ITEM_INDEX(_mat, 0, _col))
 
#define MATRIX_COL_PTR(_mat, _col)   ((_mat)->matrix + MATRIX_COL_INDEX(_mat, _col))
 

Typedefs

typedef unsigned short ushort
 

Functions

PyObject * Matrix_CreatePyObject (const float *mat, ushort col_num, ushort row_num, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
 
PyObject * Matrix_CreatePyObject_wrap (float *mat, ushort col_num, ushort row_num, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
PyObject * Matrix_CreatePyObject_cb (PyObject *user, unsigned short col_num, unsigned short row_num, unsigned char cb_type, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT
 
PyObject * Matrix_CreatePyObject_alloc (float *mat, ushort col_num, ushort row_num, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
 
int Matrix_ParseAny (PyObject *o, void *p)
 
int Matrix_Parse2x2 (PyObject *o, void *p)
 
int Matrix_Parse3x3 (PyObject *o, void *p)
 
int Matrix_Parse4x4 (PyObject *o, void *p)
 
void matrix_as_3x3 (float mat[3][3], MatrixObject *self)
 

Variables

PyTypeObject matrix_Type
 
PyTypeObject matrix_access_Type
 
unsigned char mathutils_matrix_row_cb_index
 
unsigned char mathutils_matrix_col_cb_index
 
unsigned char mathutils_matrix_translation_cb_index
 
struct Mathutils_Callback mathutils_matrix_row_cb
 
struct Mathutils_Callback mathutils_matrix_col_cb
 
struct Mathutils_Callback mathutils_matrix_translation_cb
 

Macro Definition Documentation

◆ MATRIX_COL_INDEX

#define MATRIX_COL_INDEX (   _mat,
  _col 
)    (MATRIX_ITEM_INDEX(_mat, 0, _col))

Definition at line 34 of file mathutils_Matrix.h.

◆ MATRIX_COL_PTR

#define MATRIX_COL_PTR (   _mat,
  _col 
)    ((_mat)->matrix + MATRIX_COL_INDEX(_mat, _col))

Definition at line 35 of file mathutils_Matrix.h.

◆ MATRIX_ITEM

#define MATRIX_ITEM (   _mat,
  _row,
  _col 
)    ((_mat)->matrix[MATRIX_ITEM_INDEX(_mat, _row, _col)])

Definition at line 32 of file mathutils_Matrix.h.

◆ MATRIX_ITEM_ASSERT

#define MATRIX_ITEM_ASSERT (   _mat,
  _row,
  _col 
)    (void)0

Definition at line 25 of file mathutils_Matrix.h.

◆ MATRIX_ITEM_INDEX

#define MATRIX_ITEM_INDEX (   _mat,
  _row,
  _col 
)     (MATRIX_ITEM_ASSERT(_mat, _row, _col), (((_mat)->row_num * (_col)) + (_row)))

Definition at line 29 of file mathutils_Matrix.h.

◆ MATRIX_ITEM_INDEX_NUMROW

#define MATRIX_ITEM_INDEX_NUMROW (   _totrow,
  _row,
  _col 
)    (((_totrow) * (_col)) + (_row))

Definition at line 28 of file mathutils_Matrix.h.

◆ MATRIX_ITEM_PTR

#define MATRIX_ITEM_PTR (   _mat,
  _row,
  _col 
)    ((_mat)->matrix + MATRIX_ITEM_INDEX(_mat, _row, _col))

Definition at line 31 of file mathutils_Matrix.h.

◆ MATRIX_MAX_DIM

#define MATRIX_MAX_DIM   4

Definition at line 17 of file mathutils_Matrix.h.

◆ MatrixObject_Check

#define MatrixObject_Check (   v)    PyObject_TypeCheck((v), &matrix_Type)

Definition at line 14 of file mathutils_Matrix.h.

◆ MatrixObject_CheckExact

#define MatrixObject_CheckExact (   v)    (Py_TYPE(v) == &matrix_Type)

Definition at line 15 of file mathutils_Matrix.h.

Typedef Documentation

◆ ushort

typedef unsigned short ushort

Definition at line 12 of file mathutils_Matrix.h.

Function Documentation

◆ matrix_as_3x3()

void matrix_as_3x3 ( float  mat[3][3],
MatrixObject self 
)

◆ Matrix_CreatePyObject()

PyObject* Matrix_CreatePyObject ( const float mat,
ushort  col_num,
ushort  row_num,
PyTypeObject *  base_type 
)

◆ Matrix_CreatePyObject_alloc()

PyObject* Matrix_CreatePyObject_alloc ( float mat,
ushort  col_num,
ushort  row_num,
PyTypeObject *  base_type 
)
Parameters
matInitialized matrix value to use in-place, allocated with #PyMem_Malloc

Definition at line 3490 of file mathutils_Matrix.c.

References BASE_MATH_FLAG_IS_WRAP, and Matrix_CreatePyObject_wrap().

Referenced by Matrix_to_NxN().

◆ Matrix_CreatePyObject_cb()

PyObject* Matrix_CreatePyObject_cb ( PyObject *  user,
unsigned short  col_num,
unsigned short  row_num,
unsigned char  cb_type,
unsigned char  cb_subtype 
)

Definition at line 3476 of file mathutils_Matrix.c.

References Matrix_CreatePyObject(), and NULL.

Referenced by pyrna_math_object_from_array().

◆ Matrix_CreatePyObject_wrap()

PyObject* Matrix_CreatePyObject_wrap ( float mat,
ushort  col_num,
ushort  row_num,
PyTypeObject *  base_type 
)

◆ Matrix_Parse2x2()

int Matrix_Parse2x2 ( PyObject *  o,
void p 
)

Definition at line 3539 of file mathutils_Matrix.c.

References MatrixObject::col_num, Matrix_ParseCheck(), and MatrixObject::row_num.

Referenced by Vector_rotate().

◆ Matrix_Parse3x3()

int Matrix_Parse3x3 ( PyObject *  o,
void p 
)

◆ Matrix_Parse4x4()

int Matrix_Parse4x4 ( PyObject *  o,
void p 
)

◆ Matrix_ParseAny()

int Matrix_ParseAny ( PyObject *  o,
void p 
)

Definition at line 3527 of file mathutils_Matrix.c.

References Matrix_ParseCheck().

Referenced by bpy_slot_from_py().

Variable Documentation

◆ mathutils_matrix_col_cb

struct Mathutils_Callback mathutils_matrix_col_cb
extern

Definition at line 493 of file mathutils_Matrix.c.

Referenced by PyInit_mathutils().

◆ mathutils_matrix_col_cb_index

unsigned char mathutils_matrix_col_cb_index
extern

Definition at line 406 of file mathutils_Matrix.c.

Referenced by Matrix_item_col(), and PyInit_mathutils().

◆ mathutils_matrix_row_cb

struct Mathutils_Callback mathutils_matrix_row_cb
extern

Definition at line 391 of file mathutils_Matrix.c.

Referenced by PyInit_mathutils().

◆ mathutils_matrix_row_cb_index

unsigned char mathutils_matrix_row_cb_index
extern

Definition at line 312 of file mathutils_Matrix.c.

Referenced by Matrix_item_row(), Matrix_slice(), and PyInit_mathutils().

◆ mathutils_matrix_translation_cb

struct Mathutils_Callback mathutils_matrix_translation_cb
extern

Definition at line 577 of file mathutils_Matrix.c.

Referenced by PyInit_mathutils().

◆ mathutils_matrix_translation_cb_index

unsigned char mathutils_matrix_translation_cb_index
extern

Definition at line 510 of file mathutils_Matrix.c.

Referenced by Matrix_translation_get(), and PyInit_mathutils().

◆ matrix_access_Type

PyTypeObject matrix_access_Type
extern

Definition at line 3773 of file mathutils_Matrix.c.

Referenced by MatrixAccess_CreatePyObject(), and PyInit_mathutils().

◆ matrix_Type

PyTypeObject matrix_Type
extern