coordframe
3D coordinate-frame transforms with numpy arrays bound to frames.
Overview
Two headline abstractions for scripted 3D visualization and motion-capture analysis:
CoordFrame— a coordinate frame defined by an origin and three unit vectors (or a 4×4 transformation matrix). Frames are first-class objects with named axes; transforms can be applied to a frame or within a frame.PointCloud— a numpy array of 3D points bound to aCoordFrame. Lets you reason about "joint positions in the femur frame" or "marker positions in the camera frame" directly, without manually tracking which transform applies to which point set.
The package also exports a Quat quaternion class and a small
collection of helpers (transform, m4, v4, apply_matrix,
normal2tfmat, twisttf, scaletf, norm_vec).
Why coordframe?
Existing 3D-transform libraries (transforms3d, pytransform3d,
scipy.spatial.transform, pyquaternion) operate primarily on
rotations and translations as standalone objects. coordframe's
distinguishing move is to make the frame a first-class object
with named axes, and to bind numpy point arrays to frames so you
can express transform operations in the language of the application
("transform these markers in the camera frame") rather than the
language of the math ("multiply this rotation matrix by these
vectors").
This is the abstraction that powers bpn (the parent project, which
uses it for Blender-scripted scientific visualization) and the
motion-capture analysis pipelines built on top.
Install
pip install coordframe
Quick start
import numpy as np
import coordframe as cf
# World frame
world = cf.CoordFrame()
# A custom frame
femur = cf.CoordFrame(
i=[1, 0, 0], j=[0, 1, 0], k=[0, 0, 1], origin=[0.1, 0.2, 0.3]
)
# Bind 3 marker positions to the femur frame
markers = cf.PointCloud(
[[0, 0, 0], [0.05, 0, 0], [0, 0.05, 0]], frame=femur
)
# Express the markers in world coordinates
world_markers = markers.in_world()
# Rotate the femur frame 30 degrees around its k axis using a quaternion
q = cf.Quat([0, 0, 1], np.pi / 6, frame=femur)
femur_rotated = q * femur
History
Originally developed inside bpn
(https://github.com/praneethnamburi/blender-ScriptViz) as
bpn.trf. Graduated to a standalone package so consumers (motion-
capture analysis pipelines, robotics tooling, generic scientific-
Python users) can use it without installing Blender.
License
Distributed under the MIT License. See LICENSE for details.
Acknowledgments
This package was developed as part of the ImmersionToolbox initiative at the MIT.nano Immersion Lab. Thanks to NCSOFT for supporting this initiative.
Metadata
Release files for coordframe 1.0.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 |
|---|---|---|---|---|
| coordframe-1.0.1.tar.gz | 25.2 kB | Without provenance | Details for coordframe-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coordframe-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for coordframe-1.0.1-py3-none-any.whl |
Total release size: 39.7 kB
Release files / coordframe-1.0.1.tar.gz
| Download URL | coordframe-1.0.1.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4740af75ceec69c8081b9b07a8483584b9d803ac27d7ea9b04d1b2b9161fceb
|
|
BLAKE2b-256 checksum How to use checksums |
d744c3af34d775282a6933865ed250d67c53fed0c3af6855e268dd6c0b906bf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / coordframe-1.0.1-py3-none-any.whl
| Download URL | coordframe-1.0.1-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccab3148a70fdb3a80002b787592bc74843127e0cd24d9d5b3ac0b94a2621402
|
|
BLAKE2b-256 checksum How to use checksums |
d63612a86063724390a68fc6d20033162f2f53c1025ab90ab7672937c05bcec4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for coordframe 1.0.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.