rigid_body_motion.rotate_vectors

rigid_body_motion.rotate_vectors(q, v, axis=- 1, qaxis=- 1, one_to_one=True)[source]

Rotate an array of vectors by an array of quaternions.

Parameters
q: array_like

Array of quaternions. Its dtype can be quaternion, otherwise q_axis specifies the axis representing the quaternions.

v: array_like

The array of vectors to be rotated.

axis: int, default -1

The axis of the v array representing the coordinates of the vectors. Must have length 3.

qaxis: int, default -1

If q is not quaternion dtype, axis of the quaternion array representing the coordinates of the quaternions.

one_to_one: bool, default True

If True, rotate each vector by a single quaternion. In this case, non-singleton dimensions of q and v must match. Otherwise, perform rotations for all combinations of q and v.

Returns
vr: array_like

The array of rotated vectors. If one_to_one=True this array has the shape of all non-singleton dimensions in q and v. Otherwise, this array has shape q.shape + v.shape.