Define, sequence, and apply transformations in 3D. Taken from merlict_c89_link and wrapped in python with a numpy friendly interface.
Define
t_civil = {
"pos": [1.0, 0.0, 0.0],
"rot": {
"repr": "axis_angle",
"axis":[0.0, 0.0, 1.0],
"angle_deg": 0.3,
},
}
Transformations can be defined with a civil representation in a dict. The rotation can be represented by either ‘axis_angle’, ‘tait_bryan’, or ‘quaternion’. To apply the transformation we compile it.
import homogeneous_transformation as ht
t = ht.compile(t_civil)
The civil representation can be compiled into a compact numpy array t of shape (7, ).
In : t
Out: array([1. , 0. , 0. , 0.99999657, 0. , 0. , 0.00261799])
The first 3 fields are the translation vector and the remaining 4 fields are the rotation quaternion. One can also export this with to_matrix into a homogenous transformation matrix of shape (4, 4).
In : ht.to_matrix(t)
Out:
array([[ 0.99998629, -0.00523596, 0. , 1. ],
[ 0.00523596, 0.99998629, 0. , 0. ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]])
Sequence
Transformations in compact representation can be concatenated to compute the sequence.
t_ab = ht.sequence(t_a, t_b)
Apply
Apply transformations to positions, orientations, or rays.
import numpy as np
vec = np.array([0, 0, 1])
t_vec = ht.transform_position(t, vec)
Here vec can either be a single vector of shape (3, ) or an array of N vectors with shape (N, 3). The loop over the individual vectors is in the C backend and thus very efficient.
Release files for homogeneous-transformation 0.0.1.1.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| homogeneous_transformation-0.0.1.1.7.2.tar.gz | 114.3 kB | Details |
Release files / homogeneous_transformation-0.0.1.1.7.2.tar.gz
| Download URL | homogeneous_transformation-0.0.1.1.7.2.tar.gz |
|---|---|
| Size | 114.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c46bab5e96bf360f9384e7ca7e550ce15ca7a69718d2d012cca0355251e5feb8
|
|
BLAKE2b-256 checksum How to use checksums |
f44e54f45f88d331fde0c25e7e81f4f30fdf4176e5e40e78d5ad89b14fbaa17d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.4
|