Python coordinate frame transform library
Project description
Transforms: Python coordinate frame transform library
Library to ease work with 3D coordinate frame transformations, by two means:
- Easy-to-operate-with symbolic/numerical linear transformation classes
- LaTeX export and enhanced console printing of transformation matrices
Nice experiment to learn about operator overloading.
Antonio Lopez Rivera, 2020
1. Install
- Place
transforms.py
andutilities.py
in your root directory (or another, but mind the import) from transforms import Tx, Ty, Tz
2. Usage and Syntax
All code available in demo.py
.
2.1 Creating a Linear Transformation
Transformation describing the position of a rotated object (by angle a
) from its original frame of reference:
Ta = Tx(a)
The linear transformation class may be initialized with a Sympy.Symbol
, or regular values for the rotation angle
2.2 Lambdifying a symbolic linear transformation
Turning a symbolic linear transformation to a numerical one can be done by calling the transformation itself.
T_num = Ta(<VALUE>)
2.3 Operating with Linear Transformations
Transform concatenation is defined with the multiplication sign, as well as the addition sign. The multiplication notation is recommended.
Tt = Ta*Tb*Tc
TT = Ta+Tb+Tc
Tt == TT
Transform multiplication with NumPy or SymPy arrays is defined with the multiplication sign alone.
r = np.array([1, 1, 1])
r_tr = Tt*r
2.4 Inspecting matrices
LaTeX
Transformations, symbolic and numerical, can be outputed to LaTeX with the function call below. The latex equation will be visible in the terminal in light blue.
r_tr.to_latex()
Printing
Printing a transformation will output an ASCII representation in the terminal
print(r_tr)
3. To-do
- n-dimensional transform matrix generation
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 Distribution
Built Distribution
File details
Details for the file linear_transforms-0.0.0.tar.gz
.
File metadata
- Download URL: linear_transforms-0.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57990ae1d9df964959428f1bd804d550649c6d2e8de1708670f1cfcfe02b0531 |
|
MD5 | 2d02718db6ebcad89d180d6f4f3b09fc |
|
BLAKE2b-256 | 0413f6f2dd130c72a115ae2776428ea0c1386c0fedfc436678c356c33c882c11 |
File details
Details for the file linear_transforms-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: linear_transforms-0.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abba0932847463cd54c8ae41fe6dc1d737a64ed85baf413f325494881996f9c |
|
MD5 | 3f589385f376ffc73f508dc6d28eb10d |
|
BLAKE2b-256 | 9f4a636ce78a3708402ba78d0c6d00e1f3cac10f392eff7931485d3ebdf9ea2f |