Rz

sknano.core.math.Rz(angle, degrees=False)[source] [edit on github][source]

Generate the \(3\times3\) rotation matrix \(R_z(\theta)\) for a rotation about the \(z\) axis by an angle \(\theta\).

\[\begin{split}R_z = \begin{pmatrix} \cos\theta & -\sin\theta & 0\\ \sin\theta & \cos\theta & 0\\ 0 & 0 & 1 \end{pmatrix}\end{split}\]
Parameters:
  • angle (float) – The rotation angle \(\theta\) in radians. If the angle is given in degrees, then you must set degrees=True to correctly calculate the rotation matrix.
  • degrees (bool, optional) – if True, then angle is converted from degrees to radians.
Returns:

\(3\times3\) rotation matrix \(R_z(\theta)\) for a rotation about the \(z\) axis by an angle \(\theta\).

Return type:

ndarray

Examples

>>> import numpy as np
>>> from sknano.core.math import Rz
>>> Rz(np.pi/4)
array([[ 0.70710678, -0.70710678,  0.        ],
       [ 0.70710678,  0.70710678,  0.        ],
       [ 0.        ,  0.        ,  1.        ]])
>>> np.alltrue(Rz(np.pi/4) == Rz(45, degrees=True))
True