promptbind.utils.utils.uniform_random_rotation

promptbind.utils.utils.uniform_random_rotation(x)[source]

Apply a random rotation in 3D, with a distribution uniform over the sphere. :param x: vector or set of vectors with dimension (n, 3), where n is the

number of vectors

Returns:

Array of shape (n, 3) containing the randomly rotated vectors of x, about the mean coordinate of x.

Algorithm taken from “Fast Random Rotation Matrices” (James Avro, 1992): https://doi.org/10.1016/B978-0-08-050755-2.50034-8