rotation
- m3sh.linalg.rotation(v, w, a)[source]
Rotation parameters.
Computes the values \(\cos(\varphi)\) and \(\sin(\varphi)\) of the rotation about the axis \(\mathbf{a}\) that aligns two vectors \(\mathbf{v}\) and \(\mathbf{w}\) of equal norm, i.e., using Rodrigues’ rotation formula we get
\[\mathbf{w} = \mathbf{v} \cos(\varphi) + (1-\cos(\varphi)) \mathbf{a} \mathbf{a}^T \mathbf{v} + (\mathbf{a} \times \mathbf{v}) \sin(\varphi).\]- Parameters:
- Returns:
cosphi (float) – Cosine of rotation angle.
sinphi (float) – Sine of rotation angle.
Note
The length preconditions on \(\mathbf{v}\) and \(\mathbf{w}\) are not checked. If \(\| \mathbf{v} \| \neq \| \mathbf{w} \|\) the formula
\[\lambda \mathbf{w} = \mathbf{v} \cos(\varphi) + (1-\cos(\varphi)) \mathbf{a} \mathbf{a}^T \mathbf{v} + (\mathbf{a} \times \mathbf{v}) \sin(\varphi)\]holds with \(\lambda = \| \mathbf{v} \| / \| \mathbf{w} \|\).