Mat2X2
Represents a 2×2 matrix of single-precision floating-point values. This datatype is used for 2D linear transforms (e.g. rotation or scaling) within the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
matrix | ArrayLike | 2×2 matrix; shape (2, 2), dtype float32. |
Optional
None.
Methods
| Method | Description |
|---|---|
to_list() | Returns a nested Python list of 2 rows × 2 columns (e.g. [[m00, m01], [m10, m11]]). |
to_numpy() | Returns a NumPy array of shape (2, 2), dtype float32. |
Example
python
import numpy as np
from datatypes import datatypes
from loguru import logger
# ------------------------------------------------
# 1. Create Mat2X2 instance
# ------------------------------------------------
matrix = np.array([
[1.0, 0.0],
[0.0, 1.0],
], dtype=np.float32)
mat_2x2 = datatypes.Mat2X2(matrix)
# ------------------------------------------------
# 2. Access matrix via to_list and to_numpy
# ------------------------------------------------
matrix_list = mat_2x2.to_list()
logger.info("Mat2X2 to_list row0={}", matrix_list[0])
logger.info("Mat2X2 to_list row1={}", matrix_list[1])
logger.info("Mat2X2 to_numpy shape={}", mat_2x2.to_numpy().shape)
