skrobot.coordinates.math.rotate_vector

skrobot.coordinates.math.rotate_vector(vec, theta, axis)[source]

Rotate vector.

Rotate vec with respect to axis.

Parameters:
Returns:

rotated_vec – rotated vector.

Return type:

numpy.ndarray

Examples

>>> from numpy import pi
>>> from skrobot.coordinates.math import rotate_vector
>>> rotate_vector([1, 0, 0], pi / 6.0, [1, 0, 0])
array([1., 0., 0.])
>>> rotate_vector([1, 0, 0], pi / 6.0, [0, 1, 0])
array([ 0.8660254,  0.       , -0.5      ])
>>> rotate_vector([1, 0, 0], pi / 6.0, [0, 0, 1])
array([0.8660254, 0.5      , 0.       ])