sknano.core.math.Rx¶
-
sknano.core.math.Rx(angle, deg2rad=False)[source][source]¶ Generate the \(3\times3\) rotation matrix \(R_x(\theta)\) for a rotation about the \(x\) axis by an angle \(\theta\).
Parameters: angle : float
The rotation angle \(\theta\) in radians. If the angle is given in degrees, then you must set deg2rad=True to correctly calculate the rotation matrix.
deg2rad : bool, optional
if True, then
angleis converted from degrees to radians.Returns: numpy.ndarray\(3\times3\) rotation matrix \(R_x(\theta)\) for a rotation about the \(x\) axis by an angle \(\theta\).
\[\begin{split}R_x = \begin{pmatrix} 1 & 0 & 0\\ 0 & \cos\theta & -\sin\theta\\ 0 & \sin\theta & \cos\theta \end{pmatrix}\end{split}\]Examples
>>> import numpy as np >>> from sknano.core.math import Rx >>> Rx(np.pi/4) array([[ 1. , 0. , 0. ], [ 0. , 0.70710678, -0.70710678], [ 0. , 0.70710678, 0.70710678]]) >>> np.alltrue(Rx(np.pi/4) == Rx(45, deg2rad=True)) True