Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.Matrix3x3 class

3x3 float matrix

Static methods

def from_diagonal(diagonal: Vector3) -> Matrix3x3
Construct a diagonal matrix
def identity_init(value: float = 1.0) -> Matrix3x3
Construct an identity matrix
def zero_init() -> Matrix3x3
Construct a zero-filled matrix

Methods

def adjugate(self, /) -> Matrix3x3
Adjugate matrix
def cofactor(self, col: int, row: int) -> float
Cofactor
def comatrix(self, /) -> Matrix3x3
Matrix of cofactors
def determinant(self, /) -> float
Determinant
def diagonal(self, /) -> Vector3
Values on diagonal
def flipped_cols(self, /) -> Matrix3x3
Matrix with flipped cols
def flipped_rows(self, /) -> Matrix3x3
Matrix with flipped rows
def inverted(self, /) -> Matrix3x3
Inverted matrix
def inverted_orthogonal(self, /) -> Matrix3x3
Inverted orthogonal matrix
def is_orthogonal(self, /) -> bool
Whether the matrix is orthogonal
def trace(self, /) -> float
Trace of the matrix
def transposed(self, /) -> Matrix3x3
Transposed matrix

Special methods

def __add__(self, arg0: Matrix3x3, /) -> Matrix3x3
Add a matrix
def __buffer__(self, flags, /)
Return a buffer object that exposes the underlying memory of the object.
def __eq__(self, arg0: Matrix3x3, /) -> bool
Equality comparison
def __getitem__(self, arg0: int, /) -> Vector3
Column at given position
def __getitem__(self, arg0: tuple[int, int], /) -> float
Value at given col/row
def __getstate__(self, /) -> bytes
Dumps the in-memory representation of matrix components
def __iadd__(self, arg0: Matrix3x3, /) -> Matrix3x3
Add and assign a matrix
def __imul__(self, arg0: float, /) -> Matrix3x3
Multiply with a scalar and assign
def __init__(self, arg0: Matrix3x3d, /) -> None
Construct from different underlying type
def __init__(self, arg0: Buffer, /) -> None
Construct from a buffer
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: float, /) -> None
Construct a matrix with one value for all components
def __init__(self, arg0: Vector3, arg1: Vector3, arg2: Vector3, /) -> None
Construct from column vectors
def __init__(self, arg0: tuple[Vector3, Vector3, Vector3], /) -> None
Construct from a column vector tuple
def __init__(self, arg0: tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]], /) -> None
Construct from a column tuple
def __isub__(self, arg0: Matrix3x3, /) -> Matrix3x3
Subtract and assign a matrix
def __itruediv__(self, arg0: float, /) -> Matrix3x3
Divide with a scalar and assign
def __len__() -> int
Matrix column count. Returns 3.
def __matmul__(self, arg0: Matrix3x3, /) -> Matrix3x3
Multiply a matrix
def __matmul__(self, arg0: Matrix2x3, /) -> Matrix2x3
Multiply a matrix
def __matmul__(self, arg0: Matrix4x3, /) -> Matrix4x3
Multiply a matrix
def __mul__(self, arg0: float, /) -> Matrix3x3
Multiply with a scalar
def __mul__(self, arg0: Vector3, /) -> Vector3
Multiply a vector
def __ne__(self, arg0: Matrix3x3, /) -> bool
Non-equality comparison
def __neg__(self, /) -> Matrix3x3
Negated matrix
def __release_buffer__(self, buffer, /)
Release the buffer object that exposes the underlying memory of the object.
def __repr__(self, /) -> str
Object representation
def __rmul__(self, arg0: float, /) -> Matrix3x3
Multiply a scalar with a matrix
def __rtruediv__(self, arg0: float, /) -> Matrix3x3
Divide a matrix with a scalar and invert
def __setitem__(self, arg0: int, arg1: Vector3, /) -> None
Set a column at given position
def __setitem__(self, arg0: tuple[int, int], arg1: float, /) -> None
Set a value at given col/row
def __setstate__(self, arg0: bytes, /) -> None
Treats the data as the in-memory representation of matrix components
def __sub__(self, arg0: Matrix3x3, /) -> Matrix3x3
Subtract a matrix
def __truediv__(self, arg0: float, /) -> Matrix3x3
Divide with a scalar

Method documentation

def magnum.Matrix3x3.inverted_orthogonal(self, /) -> Matrix3x3

Inverted orthogonal matrix

Exceptions
ValueError If the matrix is not orthogonal

def magnum.Matrix3x3.__setstate__(self, arg0: bytes, /) -> None

Treats the data as the in-memory representation of matrix components

Exceptions
ValueError If the data size doesn’t match type size