class
Matrix3d2D double transformation matrix
Static methods
- def translation(vector: Vector2d) -> Matrix3d
- 2D translation matrix
- def from_(rotation_scaling: Matrix2x2d, translation: Vector2d) -> Matrix3d
- Create a matrix from a rotation/scaling part and a translation part
- def from_diagonal(diagonal: Vector3d) -> Matrix3d
- Construct a diagonal matrix
- def identity_init(value: float = 1.0) -> Matrix3d
- Construct an identity matrix
- def projection(size: Vector2d) -> Matrix3d
- 2D projection matrix
- def projection(bottom_left: Vector2d, top_right: Vector2d) -> Matrix3d
- 2D off-center projection matrix
- def reflection(normal: Vector2d) -> Matrix3d
- 2D reflection matrix
- def rotation(angle: Rad) -> Matrix3d
- 2D rotation matrix
- def scaling(vector: Vector2d) -> Matrix3d
- 2D scaling matrix
- def shearing_x(amount: float) -> Matrix3d
- 2D shearing matrix along the X axis
- def shearing_y(amount: float) -> Matrix3d
- 2D shearning matrix along the Y axis
- def zero_init() -> Matrix3d
- Construct a zero-filled matrix
Methods
- def adjugate(self, /) -> Matrix3d
- Adjugate matrix
- def cofactor(self, col: int, row: int) -> float
- Cofactor
- def comatrix(self, /) -> Matrix3d
- Matrix of cofactors
- def determinant(self, /) -> float
- Determinant
- def diagonal(self, /) -> Vector3d
- Values on diagonal
- def flipped_cols(self, /) -> Matrix3d
- Matrix with flipped cols
- def flipped_rows(self, /) -> Matrix3d
- Matrix with flipped rows
- def inverted(self, /) -> Matrix3d
- Inverted matrix
- def inverted_orthogonal(self, /) -> Matrix3d
- Inverted orthogonal matrix
- def inverted_rigid(self, /) -> Matrix3d
- Inverted rigid transformation matrix
- def is_orthogonal(self, /) -> bool
- Whether the matrix is orthogonal
- def is_rigid_transformation(self, /) -> bool
- Check whether the matrix represents a rigid transformation
- def rotation(self, /) -> Matrix2x2d
- 2D rotation part of the matrix
- def rotation_normalized(self, /) -> Matrix2x2d
- 2D rotation part of the matrix assuming there is no scaling
- def rotation_scaling(self, /) -> Matrix2x2d
- 2D rotation and scaling part of the matrix
- def rotation_shear(self, /) -> Matrix2x2d
- 2D rotation and shear part of the matrix
- def scaling(self, /) -> Vector2d
- Non-uniform scaling part of the matrix
- def scaling_squared(self, /) -> Vector2d
- Non-uniform scaling part of the matrix, squared
- def trace(self, /) -> float
- Trace of the matrix
- def transform_point(self, vector: Vector2d) -> Vector2d
- Transform a 2D point with the matrix
- def transform_vector(self, vector: Vector2d) -> Vector2d
- Transform a 2D vector with the matrix
- def transposed(self, /) -> Matrix3d
- Transposed matrix
- def uniform_scaling(self, /) -> float
- Uniform scaling part of the matrix
- def uniform_scaling_squared(self, /) -> float
- Uniform scaling part of the matrix, squared
Special methods
- def __add__(self, arg0: Matrix3d, /) -> Matrix3d
- Add a matrix
- def __buffer__(self, flags, /)
- Return a buffer object that exposes the underlying memory of the object.
- def __eq__(self, arg0: Matrix3x3d, /) -> bool
- Equality comparison
- def __getitem__(self, arg0: int, /) -> Vector3d
- 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: Matrix3d, /) -> Matrix3d
- Add and assign a matrix
- def __imul__(self, arg0: float, /) -> Matrix3d
- Multiply with a scalar and assign
- def __init__(self, arg0: Matrix3, /) -> 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: Vector3d, arg1: Vector3d, arg2: Vector3d, /) -> None
- Construct from column vectors
- def __init__(self, arg0: tuple[Vector3d, Vector3d, Vector3d], /) -> 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: Matrix3d, /) -> Matrix3d
- Subtract and assign a matrix
- def __itruediv__(self, arg0: float, /) -> Matrix3d
- Divide with a scalar and assign
- def __len__() -> int
- Matrix column count. Returns 3.
- def __matmul__(self, arg0: Matrix3d, /) -> Matrix3d
- Multiply a matrix
- def __mul__(self, arg0: float, /) -> Matrix3d
- Multiply with a scalar
- def __mul__(self, arg0: Vector3d, /) -> Vector3d
- Multiply a vector
- def __ne__(self, arg0: Matrix3x3d, /) -> bool
- Non-equality comparison
- def __neg__(self, /) -> Matrix3d
- 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, /) -> Matrix3d
- Multiply a scalar with a matrix
- def __rtruediv__(self, arg0: float, /) -> Matrix3d
- Divide a matrix with a scalar and invert
- def __setitem__(self, arg0: int, arg1: Vector3d, /) -> 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: Matrix3d, /) -> Matrix3d
- Subtract a matrix
- def __truediv__(self, arg0: float, /) -> Matrix3d
- Divide with a scalar
Properties
Method documentation
def magnum. Matrix3d. reflection(normal: Vector2d) -> Matrix3d staticmethod
2D reflection matrix
Exceptions | |
---|---|
ValueError | If normal is not normalized |
def magnum. Matrix3d. inverted_orthogonal(self, /) -> Matrix3d
Inverted orthogonal matrix
Exceptions | |
---|---|
ValueError | If the matrix is not orthogonal |
def magnum. Matrix3d. inverted_rigid(self, /) -> Matrix3d
Inverted rigid transformation matrix
Exceptions | |
---|---|
ValueError | If the matrix doesn’t represent a rigid transformation |
def magnum. Matrix3d. rotation(self, /) -> Matrix2x2d
2D rotation part of the matrix
Exceptions | |
---|---|
ValueError | If the normalized rotation part is not orthogonal |
def magnum. Matrix3d. rotation_normalized(self, /) -> Matrix2x2d
2D rotation part of the matrix assuming there is no scaling
Exceptions | |
---|---|
ValueError | If the rotation part is not orthogonal |
def magnum. Matrix3d. uniform_scaling(self, /) -> float
Uniform scaling part of the matrix
Exceptions | |
---|---|
ValueError | If the matrix doesn’t have uniform scaling |
def magnum. Matrix3d. uniform_scaling_squared(self, /) -> float
Uniform scaling part of the matrix, squared
Exceptions | |
---|---|
ValueError | If the matrix doesn’t have uniform scaling |
def magnum. Matrix3d. __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 |