pele.utils.rotations#

Module source

Functions related to rotations

Most of these were adapted from victor’s rotations.f90. Not all functions from the file have been implemented. Warning, they have not all been tested in this format.

pele.utils.rotations.q_multiply()[source]

Source

def q_multiply(q0, q1):

multiply 2 quaternions q1, q2

pele.utils.rotations.q2aa()[source]

Source

def q2aa(qin):

quaternion to angle axis

Parameters:
Q: quaternion of length 4
Returns:
output V: angle axis vector of lenth 3
pele.utils.rotations.q2mx()[source]

Source

def q2mx(qin):

quaternion to rotation matrix

pele.utils.rotations.mx2q()[source]

Source

def mx2q(mi):

convert a rotation matrix to a quaternion

see discussion at http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/

pele.utils.rotations.random_q()[source]

Source

def random_q():

uniform random rotation in angle axis formulation

Notes

input: 3 uniformly distributed random numbers uses the algorithm given in K. Shoemake, Uniform random rotations, Graphics Gems III, pages 124-132. Academic, New York, 1992. This first generates a random rotation in quaternion representation. We should substitute this by a direct angle axis generation, but be careful: the angle of rotation in angle axis representation is NOT uniformly distributed

pele.utils.rotations.random_aa()[source]

Source

def random_aa():

return a uniformly distributed random angle axis vector

pele.utils.rotations.takestep_aa()[source]

Source

def takestep_aa(p, maxtheta):

change an angle axis vector by a small rotation

pele.utils.rotations.small_random_aa()[source]

Source

def small_random_aa(maxtheta):

generate a small random rotation

pele.utils.rotations.vec_random()[source]

Source

def vec_random():

uniform random unit vector

pele.utils.rotations.vec_random_ndim()[source]

Source

def vec_random_ndim(n):

n-dimensional uniform random unit vector

pele.utils.rotations.vector_random_uniform_hypersphere()[source]

Source

def vector_random_uniform_hypersphere(k):

return a vector sampled uniformly in a hypersphere of dimension k