jaxtransform3d.rotations.compact_axis_angle_from_matrix#

jaxtransform3d.rotations.compact_axis_angle_from_matrix(R: Array | ndarray | bool_ | number | bool | int | float | complex) Array[source]#

Compute axis-angle from rotation matrix.

This operation is called logarithmic map. Note that there are two possible solutions for the rotation axis when the angle is 180 degrees (pi).

Warning

This function is not precise at angles close to \(\pi\) because it clips the arccos of the angle to make it differentiable.

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

Rotation matrix.

Returns:
aarray, shape (…, 3)

Axis of rotation and rotation angle: angle * (x, y, z). The angle is constrained to [0, pi].

See also

matrix_from_compact_axis_angle

Exponential map.

compact_axis_angle_from_quaternion

Logarithmic 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 compact_axis_angle_from_matrix
>>> compact_axis_angle_from_matrix(jnp.eye(3))
Array([0., 0., 0.], dtype=...)
>>> compact_axis_angle_from_matrix(
...     jnp.array([[0., 0., -1.], [0., 1., 0.], [1., 0., 0.]]))
Array([ 0..., -1.57...,  0...], dtype=...)