jaxtransform3d.rotations.norm_matrix#
- jaxtransform3d.rotations.norm_matrix(R: Array | ndarray | bool_ | number | bool | int | float | complex) Array [source]#
Orthonormalize rotation matrix.
A rotation matrix is defined as
\[\begin{split}\boldsymbol R = \left( \begin{array}{ccc} r_{11} & r_{12} & r_{13}\\ r_{21} & r_{22} & r_{23}\\ r_{31} & r_{32} & r_{33}\\ \end{array} \right) \in SO(3)\end{split}\]and must be orthonormal, which results in 6 constraints:
column vectors must have unit norm (3 constraints)
and must be orthogonal to each other (3 constraints)
A more compact representation of these constraints is \(\boldsymbol R^T \boldsymbol R = \boldsymbol I\). In addition, to ensure right-handedness of the basis \(det(R) = 1\).
Because of numerical problems, a rotation matrix might not satisfy the constraints anymore. This function will enforce them with Gram-Schmidt orthonormalization optimized for 3 dimensions.
- Parameters:
- Rarray-like, shape (3, 3)
Rotation matrix with small numerical errors.
- Returns:
- Rarray, shape (3, 3)
Orthonormalized rotation matrix.
See also
robust_polar_decomposition
A more expensive orthonormalization method that spreads the error more evenly between the basis vectors.
norm_quaternion
Normalizes a quaternion.
Examples
>>> import jax.numpy as jnp >>> from jaxtransform3d.rotations import norm_matrix >>> norm_matrix(jnp.array([[0.5, 0., 0.], [0., 0.5, 0.], [0., 0., 0.5]])) Array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]], dtype=float32)