scipp.spatial.rotations_from_rotvecs#

scipp.spatial.rotations_from_rotvecs(rotation_vectors)#

Creates rotation transformations from rotation vectors.

This requires scipy to be installed, as is wraps scipy.spatial.transform.Rotation.from_rotvec().

A rotation vector is a 3 dimensional vector which is co-directional to the axis of rotation and whose norm gives the angle of rotation.

Parameters:

rotation_vectors (Variable) – A Variable with vector dtype

Returns:

Variable – An array variable of dtype rotation3.

See also

scipp.spatial.rotation

Create a single rotation from quaternion coefficients.

scipp.spatial.rotations

Create multiple rotations from quaternion coefficients.

Examples

Create rotations from rotation vectors (90 degrees around z and x axes):

>>> import numpy as np
>>> import scipp as sc
>>> rotvecs = sc.vectors(
...     dims=['rot'],
...     values=[[0, 0, np.pi/2], [np.pi/2, 0, 0]],
...     unit='rad'
... )
>>> rots = sc.spatial.rotations_from_rotvecs(rotvecs)
>>> rots
<scipp.Variable> (rot: 2)  rotation3  [dimensionless]
[(0.707107+0i+0j+0.707107k), (0.707107+0.707107i+0j+0k)]