pyg4ometry.transformation¶
Functions¶
|
Convert rad in radians into degrees |
|
Convert deg in degrees into radians |
|
Convert rad in gradians into radians |
|
Tait-Bryan x-y-z rotation to axis-angle representation |
|
Convert 3x3 transformation matrix to axis angle representation |
|
Convert axis angle to transformation matrix |
|
Convert rotation matrix to Tait-Bryan angles. |
|
Convert axis and angle to tait bryan angles |
|
Convert tait bryan angles to a single passive rotation matrix. |
|
Convert Tait-Bryan angles to a single passive rotation matrix. |
|
Returns the rotation matrix that rotates v_from to parallel to |
|
v_from = vector FROM |
|
Check if vector vector_1 is parallel to vector vector_2 down to |
|
Check if vector vector_1 is parallel to vector vector_2 down to |
|
Invert the rotation represented by these angles. |
|
matrix_from will align one vector with another, but there are |
Module Contents¶
- pyg4ometry.transformation.rad2deg(rad)¶
Convert rad in radians into degrees
- pyg4ometry.transformation.deg2rad(deg)¶
Convert deg in degrees into radians
- pyg4ometry.transformation.grad2rad(gradians)¶
Convert rad in gradians into radians
- pyg4ometry.transformation.tbxyz2axisangle(rv)¶
Tait-Bryan x-y-z rotation to axis-angle representation Algorithm from http://www.sedris.org/wg8home/Documents/WG80485.pdf
For converting rotation angles to an active axis/angle pair for use in pycsg. Order of rotation: x->y->z.
- pyg4ometry.transformation.matrix2axisangle(matrix)¶
Convert 3x3 transformation matrix to axis angle representation
- pyg4ometry.transformation.axisangle2matrix(axis, angle)¶
Convert axis angle to transformation matrix
- Parameters:
axis (list/array(3)) – axis for rotation
angle (float) – rotation angle
- Returns:
transformation matrix
- Return type:
array(3,3)
- pyg4ometry.transformation.matrix2tbxyz(matrix)¶
Convert rotation matrix to Tait-Bryan angles. Order of rotation is x -> y -> z.
- Parameters:
matrix – active (positive angle = anti-clockwise rotation about that axis when looking at the axis) matrix.
- Returns:
[x, y, z] Tait-Bryan angles in a list.
- Return type:
list(3)
- pyg4ometry.transformation.axisangle2tbxyz(axis, angle)¶
Convert axis and angle to tait bryan angles
- Parameters:
axis (list/array(3)) – axis for rotation
angle (float) – rotation angle
- Returns:
tait bryan angles (x-y-z)
- Return type:
array(3)
- pyg4ometry.transformation.tbxyz2matrix(angles)¶
Convert tait bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.
- Parameters:
angles – list of angles: x, y, z
- Returns:
rotation matrix
- Return type:
array(3,3)
- pyg4ometry.transformation.tbzyx2matrix(angles)¶
Convert Tait-Bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.
- Parameters:
angles – list of angles: x, y, z
- Returns:
rotation matrix
- Return type:
array(3,3)
- pyg4ometry.transformation.matrix_from(v_from, v_to)¶
Returns the rotation matrix that rotates v_from to parallel to v_to.
Useful for ensuring a given face points in a certain direction.
v_from and v_to should be array-like three-vectors.
- pyg4ometry.transformation._rodrigues_anti_parallel(v_from, v_to)¶
v_from = vector FROM v_to = vector TO
- pyg4ometry.transformation.are_parallel(vector_1, vector_2, tolerance=1e-10)¶
Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.
- pyg4ometry.transformation.are_anti_parallel(vector_1, vector_2, tolerance=1e-10)¶
Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.
- pyg4ometry.transformation.reverse(angles)¶
Invert the rotation represented by these angles.
- pyg4ometry.transformation.two_fold_orientation(v1, v2, e1, e2)¶
matrix_from will align one vector with another, but there are an infinite number of such matrices that align two vectors. This further contrains the rotation by introducing a second pair of vectors.
v1 start v v2 end v e1 start e e2 end v