Skip to content

Points2D

Represents a 2D point set comprising positions and optional per-point colors. This datatype is used for keypoints, feature points, and 2D visualizations within the Telekinesis ecosystem.

Field

Required

FieldTypeDescription
positionsArrayLike2D positions; shape (N, 2), dtype float32.

Optional

FieldTypeDescription
colorsRgba32ArrayLikeColors; length 1 or N, dtype uint8, shape (N, 4) or (1, 4).

Example

From the datatypes examples:

python
import numpy as np
from datatypes import datatypes
from loguru import logger

# ------------------------------------------------
# 1. Create Points2D instance
# ------------------------------------------------
positions = np.array([[0.0, 0.0], [1.0, 1.0]], dtype=np.float32)
colors = np.array([[255, 0, 0, 255], [0, 255, 0, 255]], dtype=np.uint8)
points_2d = datatypes.Points2D(positions, colors=colors)

# ------------------------------------------------
# 2. Access positions and colors
# ------------------------------------------------
logger.info("Points2D positions shape={}", points_2d.positions.shape)
logger.info("Points2D colors shape={}", points_2d.colors.shape if points_2d.colors is not None else None)