skrobot.coordinates.base.transform_coords

skrobot.coordinates.base.transform_coords(c1, c2, out=None)[source]

Return Coordinates by applying c1 to c2 from the left

Parameters:
Returns:

Coordinates(pos=translation, rot=q) – new coordinates

Return type:

skrobot.coordinates.Coordinates

Examples

>>> from skrobot.coordinates import Coordinates
>>> from skrobot.coordinates import transform_coords
>>> from numpy import pi
>>> c1 = Coordinates()
>>> c2 = Coordinates()
>>> c3 = transform_coords(c1, c2)
>>> c3.translation
array([0., 0., 0.])
>>> c3.rotation
array([[1., 0., 0.],
       [0., 1., 0.],
       [0., 0., 1.]])
>>> c1 = Coordinates().translate([0.1, 0.2, 0.3]).rotate(pi / 3.0, 'x')
>>> c2 = Coordinates().translate([0.3, -0.3, 0.1]).rotate(pi / 2.0, 'y')
>>> c3 = transform_coords(c1, c2)
>>> c3.translation
array([ 0.4       , -0.03660254,  0.09019238])
>>> c3.rotation
>>> c3.rotation
array([[ 1.94289029e-16,  0.00000000e+00,  1.00000000e+00],
       [ 8.66025404e-01,  5.00000000e-01, -1.66533454e-16],
       [-5.00000000e-01,  8.66025404e-01,  2.77555756e-17]])