jaxtransform3d.rotations.compose_matrices#

jaxtransform3d.rotations.compose_matrices(R1: Array | ndarray | bool_ | number | bool | int | float | complex, R2: Array | ndarray | bool_ | number | bool | int | float | complex) Array[source]#

Compose rotation matrices.

Computes the matrix-matrix product

\[\boldsymbol{R}_1 \cdot \boldsymbol{R}_2.\]
Parameters:
R1array-like, shape (…, 3, 3) or (3, 3)

Rotation matrix.

R2array-like, shape (…, 3, 3) or (3, 3)

Rotation matrix.

Returns:
R1_R2array, shape (…, 3, 3) or (3, 3)

Composed rotation matrix.

See also

compose_quaternions

Compose two quaternions.

Examples

>>> import jax.numpy as jnp
>>> from jaxtransform3d.rotations import (
...    compose_matrices, matrix_from_compact_axis_angle)
>>> a1 = jnp.array([0.5 * jnp.pi, 0.0, 0.0])
>>> R1 = matrix_from_compact_axis_angle(a1)
>>> a2 = jnp.array([0.0, 0.5 * jnp.pi, 0.0])
>>> R2 = matrix_from_compact_axis_angle(a2)
>>> compose_matrices(R1, R2).round(6)
Array([[...0., ...0., ...1.],
       [...1., ...0., ...0.],
       [...0., ...1., ...0.]], ...)