Rotation Utilities¶
Conversion Functions¶
- py123d.geometry.utils.rotation_utils.get_rotation_matrices_from_euler_array(euler_angles_array)[source]¶
Convert Euler angles to rotation matrices using Tait-Bryan ZYX convention (yaw-pitch-roll).
- py123d.geometry.utils.rotation_utils.get_rotation_matrix_from_euler_array(euler_angles)[source]¶
Convert Euler angles to rotation matrix using Tait-Bryan ZYX convention (yaw-pitch-roll).
- py123d.geometry.utils.rotation_utils.get_euler_array_from_rotation_matrices(rotation_matrices)[source]¶
Convert rotation matrices to Euler angles using Tait-Bryan ZYX convention (yaw-pitch-roll).
- py123d.geometry.utils.rotation_utils.get_euler_array_from_rotation_matrix(rotation_matrix)[source]¶
Convert a rotation matrix to Euler angles using Tait-Bryan ZYX convention (yaw-pitch-roll).
- py123d.geometry.utils.rotation_utils.get_quaternion_array_from_rotation_matrices(rotation_matrices)[source]¶
Convert rotation matrices to quaternions.
- py123d.geometry.utils.rotation_utils.get_quaternion_array_from_rotation_matrix(rotation_matrix)[source]¶
Convert a rotation matrix to a quaternion.
- py123d.geometry.utils.rotation_utils.get_quaternion_array_from_euler_array(euler_angles)[source]¶
Converts array of euler angles to array of quaternions.
- py123d.geometry.utils.rotation_utils.get_rotation_matrices_from_quaternion_array(quaternion_array)[source]¶
Convert array of quaternions to array of rotation matrices.
- py123d.geometry.utils.rotation_utils.get_rotation_matrix_from_quaternion_array(quaternion_array)[source]¶
Convert a quaternion to a rotation matrix.
Quaternion Operations¶
- py123d.geometry.utils.rotation_utils.normalize_quaternion_array(quaternion_array)[source]¶
Normalizes an array of quaternions to unit length.
- py123d.geometry.utils.rotation_utils.conjugate_quaternion_array(quaternion_array)[source]¶
Computes the conjugate of an array of quaternions, i.e. negating the vector part.
- py123d.geometry.utils.rotation_utils.invert_quaternion_array(quaternion_array)[source]¶
Computes the inverse of an array of quaternions, i.e. conjugate divided by norm squared.
- py123d.geometry.utils.rotation_utils.multiply_quaternion_arrays(q1, q2)[source]¶
Multiplies two arrays of quaternions.
- Parameters:
- Return type:
- Returns:
Array of resulting quaternions after multiplication, indexed by
QuaternionIndexin the last dim.
- py123d.geometry.utils.rotation_utils.slerp_quaternion_arrays(q1, q2, t)[source]¶
Spherical linear interpolation (SLERP) between two arrays of quaternions.
Interpolates along the shortest path on the unit quaternion hypersphere with constant angular velocity.
- Parameters:
q1 (
ndarray[tuple[Any,...],dtype[float64]]) – Start quaternions of shape (…, 4), indexed byQuaternionIndex.q2 (
ndarray[tuple[Any,...],dtype[float64]]) – End quaternions of shape (…, 4), indexed byQuaternionIndex.t (
ndarray[tuple[Any,...],dtype[float64]]) – Interpolation parameter(s) in [0, 1], shape (…).
- Return type:
- Returns:
Interpolated quaternions of shape (…, 4), indexed by
QuaternionIndex.
- py123d.geometry.utils.rotation_utils.nlerp_quaternion_arrays(q1, q2, t)[source]¶
Normalized linear interpolation (NLERP) between two arrays of quaternions.
Faster than SLERP but does not maintain constant angular velocity.
- Parameters:
q1 (
ndarray[tuple[Any,...],dtype[float64]]) – Start quaternions of shape (…, 4), indexed byQuaternionIndex.q2 (
ndarray[tuple[Any,...],dtype[float64]]) – End quaternions of shape (…, 4), indexed byQuaternionIndex.t (
ndarray[tuple[Any,...],dtype[float64]]) – Interpolation parameter(s) in [0, 1], shape (…).
- Return type:
- Returns:
Interpolated quaternions of shape (…, 4), indexed by
QuaternionIndex.
- py123d.geometry.utils.rotation_utils.get_q_matrices(quaternion_array)[source]¶
Computes the Q matrices for an array of quaternions.
General¶
- py123d.geometry.utils.rotation_utils.batch_matmul(A, B)[source]¶
Batch matrix multiplication for arrays of matrices. # TODO: move somewhere else