Convert rotation matrix into representation used in virtual world

Simulink^{®}
3D Animation™

Takes an input of a rotation matrix and outputs the axis/angle rotation representation used for defining rotations in a virtual world. The rotation matrix can be either a 9-element column vector or a 3-by-3 matrix defined columnwise.

To open the Block Parameters dialog box, double-click the block.

**Maximum value to treat input value as zero** — The input is considered to be zero if it is equal to, or lower than, this value.

A representation of a three-dimensional spherical rotation as a 3-by-3 real, orthogonal matrix *R*: *R*^{T}*R* = *RR*^{T} = *I*, where *I* is the 3-by-3 identity and *R*^{T} is the transpose of *R*. This matrix is also known as the direction cosine matrix (DCM). The DCM is the orientation of the object in space, relative to its parent node.

$$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)=\left(\begin{array}{ccc}{R}_{xx}& {R}_{xy}& {R}_{xz}\\ {R}_{yx}& {R}_{yy}& {R}_{yz}\\ {R}_{zx}& {R}_{zy}& {R}_{zz}\end{array}\right)$$

In general, *R* requires three independent angles to specify the rotation fully. There are many ways to represent the three independent angles. Here are two:

You can form three independent rotation matrices

*R*_{1},*R*_{2},*R*_{3}, each representing a single independent rotation. Then compose the full rotation matrix*R*with respect to fixed coordinate axes as a product of these three:*R = R*_{3}**R*_{2}**R*_{1}. The three angles are Euler angles.You can represent

*R*in terms of an axis-angle rotation*n*= (*n*_{x},*n*_{y},*n*_{z}) and θ with*n*n*= 1. The three independent angles are θ and the two needed to orient*n*. Form the antisymmetric matrix:$$\widehat{J}=\left(\begin{array}{ccc}0& -{n}_{z}& {n}_{y}\\ {n}_{z}& 0& -{n}_{x}\\ -{n}_{y}& {n}_{x}& 0\end{array}\right)$$

Then Rodrigues' formula simplifies

*R*:$$R=\mathrm{exp}(\theta \widehat{J})=I+\widehat{J}\mathrm{sin}\theta +{\widehat{J}}^{2}(1-\mathrm{cos}\theta )$$