pele.utils.rotations#
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]
-
def q_multiply(q0, q1):multiply 2 quaternions q1, q2
- pele.utils.rotations.q2aa()[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.mx2q()[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]
-
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]
-
def random_aa():return a uniformly distributed random angle axis vector
- pele.utils.rotations.takestep_aa()[source]
-
def takestep_aa(p, maxtheta):change an angle axis vector by a small rotation
- pele.utils.rotations.small_random_aa()[source]
-
def small_random_aa(maxtheta):generate a small random rotation
- pele.utils.rotations.vec_random_ndim()[source]
-
def vec_random_ndim(n):n-dimensional uniform random unit vector