A library for Euler angle computation and conversion.
Project description
euler
A library for Euler angle computation and conversion.
Installation
You can install the library from PyPI as follows:
pip install -U euler
Usage
The library is designed to be imported directly, analogously to NumPy:
>>> from numpy import pi
>>> import euler
The 12 possible axis triples available for Euler angles can be accessed as follows:
>>> euler.AXIS_TRIPLES
('xzx', 'xyx', 'yxy', 'yzy', 'zyz', 'zxz', 'xzy', 'xyz', 'yxz', 'yzx', 'zyx', 'zxy')
For static typing purposes, the corresponding literal type alias is euler.AxisTriple
.
The euler.matrix_<pqr>
functions, where <pqr>
is an axis triple,
can be used to compute a rotation matrix from Euler angles:
>>> h = euler.matrix_zxz(pi/2, pi/2, pi/2)
>>> h.round(3)
array([[-0., -0., 1.],
[ 0., -1., -0.],
[ 1., 0., 0.]])
The euler.angles_<pqr>
functions, where <pqr>
is an axis triple,
can be used to compute Euler angles from a rotation matrix:
>>> a, b, c = euler.angles_xyz(h)
>>> a, b, c
(3.141592653589793, 1.5707963267948966, 0.0)
The euler.convert_<pqr>_<uvw>
functions, finally,
can be used to convert Euler angles from axis triple <pqr>
to axis triple <uvw>
:
>>> euler.convert_zxz_xyz(pi/2, pi/2, pi/2)
(3.141592653589793, 1.5707963267948966, 0.0)
The functions euler.matrix
, euler.angles
and euler.convert
serve an analogous purpose,
but take the axis triple(s) as string parameter(s):
>>> h = euler.matrix("zxz", pi/2, pi/2, pi/2)
>>> h.round(3)
array([[-0., -0., 1.],
[ 0., -1., -0.],
[ 1., 0., 0.]])
>>> a, b, c = euler.angles("xyz", h)
>>> a, b, c
(3.141592653589793, 1.5707963267948966, 0.0)
>>> euler.convert("zxz", "xyz", pi/2, pi/2, pi/2)
(3.141592653589793, 1.5707963267948966, 0.0)
Matrix calculations are originally taken from https://ntrs.nasa.gov/citations/19770019231,
and have been independently verified (see the test
folder).
License
LGPLv3 © NeverLocal Ltd
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file euler-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: euler-1.0.3-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
69475f9ce4062189782ac863a41b4ec54dc3f00f6e8de10e7d7f957cd57ebf09
|
|
MD5 |
db8d7a89c573f5bcbde28b573ff75dcc
|
|
BLAKE2b-256 |
d82d101a1bcb1060fb4917b830a304310e3ae6b8455779aab508492d8e775e00
|