Skip to main content

A pure-numpy Python library for 3D rotation representations

Project description

rotations-py

A pure-numpy Python library for 3D rotation representations. Convert freely between four representations, compose rotations, and apply them to vectors.

Representations

Class Stores Use when
SO3 3×3 rotation matrix applying rotations, interfacing with linear algebra
Quaternion (w, x, y, z) unit quaternion interpolation, game engines, aerospace
AxisAngle unit axis + angle (radians) human-readable construction
Screw rotation vector w = axis · θ optimization, robotics, Lie group math

Installation

uv add rotations-py

Usage

import numpy as np
from rotations import SO3, Quaternion, AxisAngle, Screw

# construct
r = AxisAngle([0, 0, 1], np.pi/2)   # 90° around z

# convert between representations
r.to_so3()
r.to_quaternion()
r.to_screw()

# apply to a vector
r @ [1, 0, 0]           # → [0, 1, 0]

# compose two rotations
r1 = AxisAngle([0, 0, 1], np.pi/2)
r2 = AxisAngle([1, 0, 0], np.pi/2)
r3 = r1 @ r2            # result is same type as r1

# inverse
~r                       # AxisAngle for 90° around -z
r @ ~r                   # → identity

Conversion graph

SO3  ←→  Quaternion  ←→  AxisAngle  ←→  Screw

See description.md for the full math behind each conversion.

Development

To run tests

uv run pytest

To run the linter and formatter

uv run ruff check           # check lint
uv run ruff format --check  # check format
uv run ruff check --fix     # lint and auto-fix
uv run ruff format          # format and fix

To run the static type checker

uv run mypy rotations/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rotations_py-0.1.1.tar.gz (55.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rotations_py-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file rotations_py-0.1.1.tar.gz.

File metadata

  • Download URL: rotations_py-0.1.1.tar.gz
  • Upload date:
  • Size: 55.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rotations_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 38ef6c16ae6e1e03516bf107bdd1ad5d3fc328753b2215cd25e140d761905471
MD5 5b01e218d833be2fc5db5b759d171c46
BLAKE2b-256 bfcc93fc396a465256af8451799643a056a9bfded42e067b307ad9dce58f38d0

See more details on using hashes here.

File details

Details for the file rotations_py-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rotations_py-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rotations_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ade70cf53ad3d856770d3e97ae0c1bb63f3bf77f44c7b563a56710293752a1fa
MD5 c2d3ec314ffa32b1360b6c8db37d21e0
BLAKE2b-256 d1a4a3abcc74f27db5d27f8ae9ff138f39ce4ce5ec48d3fb8c5af4ac1aae1ba0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page