rotvec_to_rotmat

giant.rotations:

giant.rotations.rotvec_to_rotmat(vector)[source]

This function converts a rotation vector to a rotation matrix according to the form specified in Rotation Representations.

The resulting rotation matrix is returned as a numpy array and is computed according to:

\[\begin{split}\theta=\left\|\mathbf{v}\right\| \\ \hat{\mathbf{x}} = \frac{\mathbf{v}}{\theta}\\ \mathbf{T} = \text{cos}(\theta)\mathbf{I}_{3\times 3}+\text{sin}(\theta)\left[\hat{\mathbf{x}}\times\right]+ (1-\text{cos}(\theta))\hat{\mathbf{x}}\hat{\mathbf{x}}^T\end{split}\]

where \(\mathbf{v}\) is the rotation vector, \(\theta\) is the rotation angle, \(\hat{\mathbf{x}}\) is the rotation axis, \(\left[\bullet\times\right]\) is the skew symmetric cross product matrix (see skew()), and \(\mathbf{I}_{3\times 3}\) is a \(3\times 3\) identity matrix.

This function is also vectorized, meaning that you can specify multiple rotation vectors to be converted to rotation matrices by specifying each vector as a column. Regardless of whether you are converting 1 or many vectors the first axis must have a length of 3.

Parameters:

vector (Sequence | ndarray) – The rotation vector(s) to convert to a rotation matrix

Returns:

The rotation matrix(ces) corresponding to the rotation vector(s)

Return type:

ndarray