random#

Quaternion.random() ndarray#

Generate a random quaternion

A mapping in SO(3) is first created and then transformed as explained originally by [Shoemake]. It calls the function random_attitudes() with n=1.

Returns:

q – Random array corresponding to a valid quaternion

Return type:

numpy.ndarray

Examples

>>> q = Quaternion()
>>> q.random()
array([ 0.18257419, -0.36514837,  0.54772256, -0.73029674])

It can be called when the Quaternion object is created:

>>> Quaternion(random=True)
Quaternion([-0.51862103, -0.23740681,  0.32023593,  0.75638561])

See also

random_attitudes

Generate random attitudes