skrobot.coordinates.math.rotate_vector¶
- skrobot.coordinates.math.rotate_vector(vec, theta, axis)[source]¶
Rotate vector.
Rotate vec with respect to axis.
- Parameters:
vec (list or numpy.ndarray) – target vector
theta (float) – rotation angle
axis (list or numpy.ndarray or str) – axis of rotation.
- Returns:
rotated_vec – rotated vector.
- Return type:
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. ])