Contents
How to find the component of a quaternion rotation?
Basically I want to find the component of a quaternion rotation, that is around a given axis (not necessarily X, Y or Z – any arbitrary unit vector). Sort of like projecting a quaternion onto a vector. So if I was to ask for the rotation around some axis parallel to the quaternion’s axis, I’d get the same quaternion back out.
What are the four values of a quaternion?
The four values in a quaternion consist of one scalar and a 3-element unit vector. Instead of a, b, c, and d, you will commonly see: q 1, q 2, and q 3 correspond to an axis of rotation about which the angle of rotation is performed. Other ways you can write a quaternion are as follows:
How are quaternions used to represent orientations in robotics?
Quaternions are the default method of representing orientations and rotations in ROS, the most popular platform for robotics software development. In robotics, we are always trying to rotate stuff.
Why are quaternions used instead of Euler angle matrices?
Quaternions are often used instead of Euler angle rotation matrices because “compared to rotation matrices they are more compact, more numerically stable, and more efficient” (Source: Wikipedia ).
Which is the correct order to rotate the camera quaternion?
Given those vectors, we can correctly rotate the camera quaternion around them. Which you start with, Z, Y or Z, depends on the Euler angle sequence which is, again, a convention varying from application to application. Since I want to rotations to be applied in Y X Z order, I do the following.
How to project the magnitude of a quaternion?
// Transform quaternion to angle-axis form rotation.ToAngleAxis (out float angle, out Vector3 rotationAxis); // Projection magnitude is what we found – a component of a quaternion rotation around an axis to some direction axis float proj = Vector3.Project (rotationAxis.normalized, directionAxis.normalized).magnitude;
How are quaternions used in a physics simulation?
To apply those rotations, we need to multiply the quaternions create by axis and angle with the current camera rotation. Lastly we apply the resulted quaternion to the body in the physics simulation. Matrices and pitch/yaw/roll both having their limitations, I do not use them anymore but use instead quaternions.