scipp.spatial.rotation#

scipp.spatial.rotation(*, value)#

Creates a rotation-type variable from the provided quaternion coefficients.

The quaternion coefficients are provided in scalar-last order (x, y, z, w), where x, y, z and w form the quaternion

\[q = w + xi + yj + zk.\]

Attention

The quaternion must be normalized in order to represent a rotation. You can use, e.g.

>>> q = np.array([1, 2, 3, 4])
>>> rot = sc.spatial.rotation(value=q / np.linalg.norm(q))
Parameters:

value (ndarray[Any, dtype[TypeVar(_Float, bound= float64 | float32, covariant=True)]] | Sequence[TypeVar(_Float, bound= float64 | float32, covariant=True)]) – A NumPy array or list with length 4, corresponding to the quaternion coefficients (x*i, y*j, z*k, w)

Returns:

Variable – A scalar variable of dtype rotation3.