jaxtransform3d.rotations.matrix_from_compact_axis_angle#

jaxtransform3d.rotations.matrix_from_compact_axis_angle(axis_angle: Array | ndarray | bool_ | number | bool | int | float | complex | None = None) Array[source]#

Compute rotation matrices from compact axis-angle representations.

This is called exponential map or Rodrigues’ formula.

Given a compact axis-angle representation (rotation vector) \(\hat{\boldsymbol{\omega}} \theta \in \mathbb{R}^3\), we compute the rotation matrix \(\boldsymbol{R} \in SO(3)\) as

\begin{eqnarray} \boldsymbol{R}(\hat{\boldsymbol{\omega}} \theta) &=& Exp(\hat{\boldsymbol{\omega}} \theta)\\ &=& \cos{\theta} \boldsymbol{I} + \sin{\theta} \left[\hat{\boldsymbol{\omega}}\right] + (1 - \cos{\theta}) \hat{\boldsymbol{\omega}}\hat{\boldsymbol{\omega}}^T\\ &=& \boldsymbol{I} + \sin{\theta} \left[\hat{\boldsymbol{\omega}}\right] + (1 - \cos{\theta}) \left[\hat{\boldsymbol{\omega}}\right]^2. \end{eqnarray}

For small angles we use a Taylor series approximation.

Parameters:
axis_anglearray-like, shape (…, 3)

Axis of rotation and rotation angle in compact form (also known as rotation vector): angle * (x, y, z) or \(\hat{\boldsymbol{\omega}} \theta\).

Returns:
Rarray, shape (…, 3, 3)

Rotation matrices

See also

compact_axis_angle_from_matrix

Logarithmic map.

quaternion_from_compact_axis_angle

Exponential map for quaternions.

References

[1]

Williams, A. (n.d.). Computing the exponential map on SO(3). https://arwilliams.github.io/so3-exp.pdf

Examples

>>> import jax.numpy as jnp
>>> from jaxtransform3d.rotations import matrix_from_compact_axis_angle
>>> matrix_from_compact_axis_angle(jnp.zeros(3))
Array([[1., 0., 0.],
       [0., 1., 0.],
       [0., 0., 1.]], dtype=...)
>>> import jax
>>> a = jax.random.normal(jax.random.PRNGKey(42), shape=(2, 3))
>>> a
Array([[-0.02830462,  0.46713185,  0.29570296],
       [ 0.15354592, -0.12403282,  0.21692315]], dtype=...)
>>> matrix_from_compact_axis_angle(a)
Array([[[ 0.85103..., -0.28727...,  0.43955...],
        [ 0.27438...,  0.95699...,  0.09420...],
        [-0.44771...,  0.04043...,  0.89326...]],
       [[ 0.96900..., -0.22328..., -0.10572...],
        [ 0.20437...,  0.96493..., -0.16471...],
        [ 0.13879...,  0.13799...,  0.98065...]]], dtype=...)