c4dynamics.rotmat.rotmat.roty

Contents

c4dynamics.rotmat.rotmat.roty#

c4dynamics.rotmat.rotmat.roty(theta)[source]#

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

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

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

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

Returns:

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

Examples

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