rot_x

giant.rotations:

giant.rotations.rot_x(theta)[source]

This function performs a right handed rotation about the x axis by angle theta.

Mathematically this rotation is defined as:

\[\begin{split}\mathbf{R}_x(\theta)=\left[\begin{array}{ccc} 1 & 0 & 0 \\ 0 & \text{cos}(\theta) & -\text{sin}(\theta) \\ 0 & \text{sin}(\theta) & \text{cos}(\theta) \end{array}\right]\end{split}\]

Theta should be in units of radians and can be a scalar or a vector. If theta is a vector then each theta value will have a corresponding rotation vector down the first axis of the output. For example:

>>> from giant.rotations import rot_x
>>> rot_x([2, 0.5])
array([[[ 1.        ,  0.        ,  0.        ],
        [ 0.        , -0.41614684, -0.90929743],
        [ 0.        ,  0.90929743, -0.41614684]],
       [[ 1.        ,  0.        ,  0.        ],
        [ 0.        ,  0.87758256, -0.47942554],
        [ 0.        ,  0.47942554,  0.87758256]]])
Parameters:

theta (Sequence | ndarray | Real) – The angles to form the rotation matrix(ces) for

Returns:

The rotation matrix(ces) corresponding to the rotation angle(s)

Return type:

ndarray