skrobot.coordinates.math.rotation_matrix_from_axis¶
- skrobot.coordinates.math.rotation_matrix_from_axis(first_axis=(1, 0, 0), second_axis=(0, 1, 0), axes='xy')[source]¶
Return rotation matrix orienting first_axis
- Parameters:
first_axis (list or tuple or numpy.ndarray) – direction of first axis
second_axis (list or tuple or numpy.ndarray) – direction of second axis. This input axis is normalized using Gram-Schmidt.
axes (str) – valid inputs are ‘xy’, ‘yx’, ‘xz’, ‘zx’, ‘yz’, ‘zy’. first index indicates first_axis’s axis.
- Returns:
rotation_matrix – Rotation matrix
- Return type:
Examples
>>> from skrobot.coordinates.math import rotation_matrix_from_axis >>> rotation_matrix_from_axis((1, 0, 0), (0, 1, 0)) array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) >>> rotation_matrix_from_axis((1, 1, 1), (0, 1, 0)) array([[ 0.57735027, -0.40824829, -0.70710678], [ 0.57735027, 0.81649658, 0. ], [ 0.57735027, -0.40824829, 0.70710678]])