Skip to content

Welcome to Quatham

Quatham is a lightweight, high-performance quaternion mathematics package for 3D rotations. Built with NumPy and Numba acceleration, it provides efficient quaternion operations for both single quaternions and batched arrays.

Quick Navigation

Getting Started

New to Quatham or quaternions? Start here. - Installation - Quick Start - Basic Concepts

Tutorials

Step-by-step guides for common tasks. - Creating Quaternions - Quaternion Arithmetic - Conversions - Batch Operations

API Reference

Complete API documentation. - Quaternion Class - Utilities

Key Features

  • Numba-accelerated — JIT-compiled low-level operations for maximum performance
  • Batch processing — Efficient handling of quaternion arrays
  • Comprehensive conversions — Euler angles, Tait-Bryan, rotation matrices, axis-angle
  • Intuitive API — Pythonic interface with operator overloading
  • Scalar-first convention — Consistent [w, x, y, z] ordering

Example

from quatham import Quaternion
import numpy as np

# Create a quaternion from axis-angle
q = Quaternion.from_axisangle([0, 0, 1], np.pi/2)

# Rotate a vector
v = np.array([1.0, 0.0, 0.0])
v_rotated = q * v  # [0.0, 1.0, 0.0]

# Convert to rotation matrix
R = q.to_rotation_matrix()

Installation

pip install quatham

See the Installation Guide for detailed instructions.