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
Hashes for linear_transforms-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abba0932847463cd54c8ae41fe6dc1d737a64ed85baf413f325494881996f9c |
|
MD5 | 3f589385f376ffc73f508dc6d28eb10d |
|
BLAKE2b-256 | 9f4a636ce78a3708402ba78d0c6d00e1f3cac10f392eff7931485d3ebdf9ea2f |