skrobot.coordinates.geo.orient_coords_to_axis

skrobot.coordinates.geo.orient_coords_to_axis(target_coords, v, axis='z', eps=0.005)[source]

Orient axis to the direction

Orient axis in target_coords to the direction specified by v.

Parameters:
Returns:

target_coords

Return type:

skrobot.coordinates.Coordinates

Examples

>>> import numpy as np
>>> from skrobot.coordinates import Coordinates
>>> from skrobot.coordinates.geo import orient_coords_to_axis
>>> c = Coordinates()
>>> oriented_coords = orient_coords_to_axis(c, [1, 0, 0])
>>> oriented_coords.translation
array([0., 0., 0.])
>>> oriented_coords.rpy_angle()
(array([0.        , 1.57079633, 0.        ]),
 array([3.14159265, 1.57079633, 3.14159265]))
>>> c = Coordinates(pos=[0, 1, 0])
>>> oriented_coords = orient_coords_to_axis(c, [0, 1, 0])
>>> oriented_coords.translation
array([0., 1., 0.])
>>> oriented_coords.rpy_angle()
(array([ 0.        , -0.        , -1.57079633]),
 array([ 3.14159265, -3.14159265,  1.57079633]))
>>> c = Coordinates(pos=[0, 1, 0]).rotate(np.pi / 3, 'y')
>>> oriented_coords = orient_coords_to_axis(c, [0, 1, 0])
>>> oriented_coords.translation
array([0., 1., 0.])
>>> oriented_coords.rpy_angle()
(array([-5.15256299e-17,  1.04719755e+00, -1.57079633e+00]),
 array([3.14159265, 2.0943951 , 1.57079633]))