rotate
- m3sh.linalg.rotate(x, a, phi, sinphi=None)[source]
Rotate vector about axis.
Rotation is performed via Rodrigues’ rotation formula,
\[\mathbf{x}_{\text{rot}} = \mathbf{x} \cos(\varphi) + (1-\cos(\varphi)) \mathbf{a} \mathbf{a}^T \mathbf{x} + (\mathbf{a} \times \mathbf{x}) \sin(\varphi)\]which results in a positive (counter-clockwise) rotation for \(\varphi > 0\) when looking on the normal plane of the axis vector pointing towards the viewer (right-hand rule).
- Parameters:
- Returns:
The rotated vector.
- Return type:
Note
Computation of \(\sin(\varphi)\) can be avoid by providing this value as the optional argument sinphi. In this case phi is taken to be \(\cos(\varphi)\) and no trigonometric functions are evaluated.