Processing math: 100%

Previous topic

sknano.core.math.Rx

Next topic

sknano.core.math.Rz

sknano.core.math.Ry

sknano.core.math.Ry(angle, degrees=False)[source][source]

Generate the 3×3 rotation matrix Ry(θ) for a rotation about the y axis by an angle θ.

Parameters:

angle : float

The rotation angle θ 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:

ndarray

3×3 rotation matrix Ry(θ) for a rotation about the y axis by an angle θ:

Ry=(cosθ0sinθ010sinθ0cosθ)

Examples

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