random¶
Overview
rowan.random.rand |
Generate random rotations uniformly |
rowan.random.random_sample |
Generate random rotations unifo |
Details
Various functions for generating random sets of rotation quaternions. Note
that if you simply want random quaternions not restricted to \(SO(3)\) you
can just generate these directly using np.random.rand(... 4)
. This
subpackage is entirely focused on generating rotation quaternions.
-
rowan.random.
rand
(*args)¶ Generate random rotations uniformly
This is a convenience function a la
np.random.rand
. If you want a function that takes a tuple as input, userandom_sample()
instead.Parameters: shape (tuple) – The shape of the array to generate. Returns: Random quaternions of the shape provided with an additional axis of length 4.
-
rowan.random.
random_sample
(size=None)¶ Generate random rotations unifo
In general, sampling from the space of all quaternions will not generate uniform rotations. What we want is a distribution that accounts for the density of rotations, i.e., a distribution that is uniform with respect to the appropriate measure. The algorithm used here is detailed in [Shoe92].
[Shoe92] Shoemake, K.: Uniform random rotations. In: D. Kirk, editor, Graphics Gems III, pages 124-132. Academic, New York, 1992. Parameters: size (tuple) – The shape of the array to generate Returns: Random quaternions of the shape provided with an additional axis of length 4