API Reference

transform-graph v0.1.2 — 17 classes, 7 functions

transform-graph provides strict-typed SE(3) rigid body transformations, camera and orthographic projections, and a frame graph with automatic path composition for Spatial AI and robotics applications.

Install

pip install transform-graph

API Sections

Transform Graph

A transform graph connects coordinate frames with rigid body transforms and camera projections. Every path is composable — query any pair of frames and the library finds the shortest path and chains the transforms automatically.

import numpy as np
import tgraph as tf

graph = tf.TransformGraph()

# Robot in global frame
robot_pose = tf.Transform(
    translation=[2.0, 0.5, 0.0],
    rotation=np.array([0.9998, 0.0, 0.0, -0.0175]),
)
graph.add_transform("robot", "global", robot_pose)

# Front camera link: RPY (-90°, 0°, -90°)
front_camera = tf.Transform(
    translation=[1.5, 0.0, 1.5],
    rotation=np.array([0.5, -0.5, 0.5, -0.5]),
)
graph.add_transform("front_camera_link", "robot", front_camera)

# Camera projection (3D link → 2D image)
K = np.array([[1800, 0, 900], [0, 1800, 900], [0, 0, 1.0]])
projection = tf.CameraProjection(intrinsic_matrix=K)
graph.add_transform("front_camera_link", "front_camera", projection)

# LiDAR on roof: RPY (0°, 0°, -1°)
lidar = tf.Transform(
    translation=[1.5, 0.0, 1.5],
    rotation=np.array([1.0, 0.0, 0.0, -0.0087]),
)
graph.add_transform("lidar", "robot", lidar)

# Query any path — composition is automatic
world_to_camera = graph.get_transform("global", "front_camera")