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/
Metadata
Release files for rotations-py 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rotations_py-0.1.1.tar.gz | 55.0 kB | Without provenance | Details for rotations_py-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rotations_py-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for rotations_py-0.1.1-py3-none-any.whl |
Total release size: 62.1 kB
Release files / rotations_py-0.1.1.tar.gz
| Download URL | rotations_py-0.1.1.tar.gz |
|---|---|
| Size | 55.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38ef6c16ae6e1e03516bf107bdd1ad5d3fc328753b2215cd25e140d761905471
|
|
BLAKE2b-256 checksum How to use checksums |
bfcc93fc396a465256af8451799643a056a9bfded42e067b307ad9dce58f38d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / rotations_py-0.1.1-py3-none-any.whl
| Download URL | rotations_py-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ade70cf53ad3d856770d3e97ae0c1bb63f3bf77f44c7b563a56710293752a1fa
|
|
BLAKE2b-256 checksum How to use checksums |
d1a4a3abcc74f27db5d27f8ae9ff138f39ce4ce5ec48d3fb8c5af4ac1aae1ba0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Security for rotations-py 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.