skrobot.coordinates.math.rodrigues

skrobot.coordinates.math.rodrigues(axis, theta=None, skip_normalization=False)[source]

Rodrigues formula.

See: Rodrigues’ rotation formula - Wikipedia.

See: Axis-angle representation - Wikipedia.

Parameters:
  • axis (numpy.ndarray or list) – If single axis, it should be [x, y, z] vector. If multiple axes, it should be an Nx3 matrix where each row is an axis. You can give axis-angle representation to axis if theta is None.

  • theta (float, numpy.ndarray, or None (optional)) – If single theta, it is a float. For multiple rotations, it should be an Nx1 vector. If None is given, calculate theta from the norm of each axis.

Returns:

mat – Rotation matrix or matrices. 3x3 if single axis, Nx3x3 if multiple axes.

Return type:

numpy.ndarray

Examples

>>> import numpy
>>> from skrobot.coordinates.math import rodrigues
>>> rodrigues([1, 0, 0], 0)
array([[1., 0., 0.],
       [0., 1., 0.],
       [0., 0., 1.]])
>>> rodrigues([[1, 1, 1], [0, 1, 0]], [np.pi, np.pi/2])
array([[[ -0.33333333,  0.66666667,  0.66666667],
        [  0.66666667, -0.33333333,  0.66666667],
        [  0.66666667,  0.66666667, -0.33333333]],
       [[  0. ,  0. ,  1. ],
        [  0. ,  1. ,  0. ],
        [ -1. ,  0. ,  0. ]]])