NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.quaternions.angle_axis2mat

Next topic

nibabel.quaternions.conjugate

This Page

Reggie -- the one

nibabel.quaternions.angle_axis2quat

nibabel.quaternions.angle_axis2quat(theta, vector, is_normalized=False)

Quaternion for rotation of angle theta around vector

Parameters :

theta : scalar

angle of rotation

vector : 3 element sequence

vector specifying axis for rotation.

is_normalized : bool, optional

True if vector is already normalized (has norm of 1). Default False

Returns :

quat : 4 element sequence of symbols

quaternion giving specified rotation

Notes

Formula from http://mathworld.wolfram.com/EulerParameters.html

Examples

>>> q = angle_axis2quat(np.pi, [1, 0, 0])
>>> np.allclose(q, [0, 1, 0,  0])
True