Vector4D
A vector in 4D space (e.g. quaternions for rotation). Used wherever a 4D value is required in the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
xyzw | ArrayLike | 4D vector; shape (4,). |
Optional
None.
Methods
| Method | Description |
|---|---|
to_list() | Returns a Python list of 4 floats: [x, y, z, w]. |
to_numpy() | Returns a NumPy array of shape (4,), dtype float32, with elements [x, y, z, w]. |
Example
From the datatypes examples:
python
import numpy as np
from datatypes import datatypes
from loguru import logger
# ------------------------------------------------
# 1. Create Vector4D instance
# ------------------------------------------------
xyzw = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32)
vec_4d = datatypes.Vector4D(xyzw)
# ------------------------------------------------
# 2. Access data via to_list and to_numpy
# ------------------------------------------------
data_list = vec_4d.to_list()
logger.info("Vector4D to_list x={}", data_list[0])
logger.info("Vector4D to_list y={}", data_list[1])
logger.info("Vector4D to_list z={}", data_list[2])
logger.info("Vector4D to_list w={}", data_list[3])
logger.info("Vector4D to_numpy shape={}", vec_4d.to_numpy().shape)
