Quaternion Order Conventions
Quaternions are expressions of the form w + x i + y j + z k
, with x i + y j + z k
being the vector/imaginary part and w
the scalar/real part. Math libraries differ in the way they order the vector and real part of a quaternion. This can lead to bothersome debugging sessions.
The following table shows quaternion implementations and their chosen order:
X-Y-Z-W (scalar-last format) vs. W-X-Y-Z
Library / Framework | Quaternion Format |
---|---|
Blender.mathutils | W-X-Y-Z |
Boost | W-X-Y-Z |
Bullet / PyBullet | X-Y-Z-W |
DART (uses Eigen::Quaternion) | W-X-Y-Z |
Drake (uses Eigen::Quaternion) | W-X-Y-Z |
differentiable-robot-model | X-Y-Z-W |
dm_robotics.transformations | W-X-Y-Z |
Eigen | W-X-Y-Z |
FleX | X-Y-Z-W |
Isaac Gym | X-Y-Z-W |
Klampt | W-X-Y-Z |
MuJoCo | W-X-Y-Z |
Nuklei | W-X-Y-Z |
numpy-quaternions | W-X-Y-Z |
OpenRAVE 0.9.0 | X-Y-Z-W |
Orocos KDL | X-Y-Z-W |
PhysX | X-Y-Z-W |
PyMesh | W-X-Y-Z |
pyquaternion | W-X-Y-Z |
pyrr | X-Y-Z-W |
pytorch3d | W-X-Y-Z |
pytransform3d | W-X-Y-Z |
quaternions | W-X-Y-Z |
RoMa | X-Y-Z-W |
ROS | X-Y-Z-W |
scipy.spatial.transforms | X-Y-Z-W |
spatialmath-python | W-X-Y-Z |
squaternion | W-X-Y-Z |
The Library for Uniform Deterministic Sequences and Sets of Samples over 2-sphere and SO(3) | X-Y-Z-W |
transformations.py (<=2009.04.18) | X-Y-Z-W |
transformations.py (>=2010.05.10, includes trimesh.transformations) | W-X-Y-Z |
Transforms3d | W-X-Y-Z |
tinyquaternion | W-X-Y-Z |
USD (Pixar) | W-X-Y-Z |
ViSII - A VIrtual Scene Imaging Interface | W-X-Y-Z |
NVIDIA Warp | X-Y-Z-W |