c4dynamics.rotmat.rotmat.rotz

Contents

c4dynamics.rotmat.rotmat.rotz#

c4dynamics.rotmat.rotmat.rotz(psi)[source]#

Generate a 3x3 Direction Cosine Matrix for a positive rotation about the z-axis by an angle \(\psi\) in radians.

A right-hand rotation matrix about y is given by:

\[\begin{split}R = \begin{bmatrix} cos(\psi) & sin(\psi) & 0 \\ -sin(\psi) & cos(\psi) & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
Parameters:

psi (float or int) – The angle of rotation in radians.

Returns:

out (numpy.array) – A 3x3 rotation matrix representing the rotation about the z-axis.

Examples

>>> rotz(0)  
[[1  0  0]
 [0  1  0]
 [0  0  1]]
>>> rotz(c4d.pi / 2)  
[[0   1  0]
 [-1  0  0]
 [0   0  1]]
>>> v1 = [0.707, 0.707, 0]
>>> phi = 90 * c4d.d2r
>>> rotz(phi) @ v1 
[0.707  -0.707  0]
>>> phi = 45 * c4d.d2r
>>> rotz(phi) @ v1 
[1  0  0]