Skip to content

Some quaternion sampling functions and a wrapper for Christoph Gohlke's rotation functions

Notifications You must be signed in to change notification settings

r-pad/quat_math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

quat_math

Math utilites for quaternions. A wrapper to Christoph Gohlke's quaternion library (tf.transformations.py in ros) as well as some quaternion distribution and difference functions.

Difference Between Two Quaternions

Quaternion difference between two quaternions

q_diff = quatDiff(q1, q2)

Angular difference between two orientation quaternions

theta = quatAngularDiff(q1, q2)

Quaternion to Axis Angle

Converts orientation quaternion to axis angle form

axis, angle = quat2AxisAngle(q)

Quaternion Difference Distribution

The pdf of two uniformly sampled orientation quaternions having an angular difference of theta

pdf = angularPDF(theta)

Quaternion Difference Rejection Sampling

To use rejection sampling to resample two uniformly sampled orientation quaternions so the difference between them is uniformly distributed, up theta_ref. Angle differences below theta_ref are not uniformly sampled but are boosted.

ref_pdf = angularPDF(theta_ref)
reject = invAngularPDF(theta, ref_pdf) > np.random.rand())

Random Quaternion's Near a Quaternion

Samples a orientation quaternion from a uniform random distribution within theta of the q

q_near, q_delta = randomQuatNear(q, theta)

About

Some quaternion sampling functions and a wrapper for Christoph Gohlke's rotation functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published