e3x.so3.rotations.rotation

e3x.so3.rotations.rotation(axis, angle)[source]

\(3\times3\) rotation matrix specified by an axis and an angle.

Calculates the \(3\times3\) rotation matrix associated with the counterclockwise rotation about the given axis by angle using the Euler-Rodrigues formula.

Example

>>> import jax.numpy as jnp
>>> import e3x
>>> r = jnp.asarray([1., 0., 0.])  # Unit vector in x-direction.
>>> axis = jnp.asarray([0., 1., 0.])  # Rotate around y-axis.
>>> angle = jnp.pi  # Rotate by 180°.
>>> jnp.round(r @ e3x.so3.rotation(axis, angle), decimals=3)
Array([-1.,  0.,  0.], dtype=float32)
Parameters:
Return type:

<class 'Float[Array, '... 3 3']'>

Returns:

The \(3\times3\) rotation matrix.