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
Release files for euler 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| euler-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / euler-1.0.3-py3-none-any.whl
| Download URL | euler-1.0.3-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69475f9ce4062189782ac863a41b4ec54dc3f00f6e8de10e7d7f957cd57ebf09
|
|
BLAKE2b-256 checksum How to use checksums |
d82d101a1bcb1060fb4917b830a304310e3ae6b8455779aab508492d8e775e00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|