Mat4X4
Represents a 4×4 matrix of single-precision floating-point values. This datatype is used for 3D affine or rigid transforms (rotation, translation, scaling) across the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
matrix | ArrayLike | 4×4 matrix; shape (4, 4), dtype float32. |
Optional
None.
Methods
| Method | Description |
|---|---|
to_list() | Returns a nested Python list of 4 rows × 4 columns (e.g. [[m00,...,m03], ..., [m30,...,m33]]). |
to_numpy() | Returns a NumPy array of shape (4, 4), dtype float32. |
Example
From the datatypes examples:
python
import numpy as np
from datatypes import datatypes
from loguru import logger
# ------------------------------------------------
# 1. Create Mat4X4 instance
# ------------------------------------------------
matrix = np.array([
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
], dtype=np.float32)
mat_4x4 = datatypes.Mat4X4(matrix)
# ------------------------------------------------
# 2. Access matrix via to_list and to_numpy
# ------------------------------------------------
matrix_list = mat_4x4.to_list()
logger.info("Mat4X4 to_list row0={}", matrix_list[0])
logger.info("Mat4X4 to_list row1={}", matrix_list[1])
logger.info("Mat4X4 to_list row2={}", matrix_list[2])
logger.info("Mat4X4 to_list row3={}", matrix_list[3])
logger.info("Mat4X4 to_numpy shape={}", mat_4x4.to_numpy().shape)
