Quaternion's values...

jcrada
Posts: 11
Joined: Thu Oct 09, 2008 10:59 pm

Quaternion's values...

Post by jcrada »

Hi,
I need to know the maximum and minimum values of w,x,y,z of each rigid body's quaternion.
I believe that they are in [0,1), but I am not sure. Is there a way to find that out?
For example, what is the max and min expected output for "some_body" at any position from the following code:

Code: Select all

btTransform transform;
transform.setIdentity();
some_body->getMotionState()->getWorldTransform(transform);
std::cout << "w=" << transform.getRotation().getW() << std::endl;
std::cout << "x=" << transform.getRotation().getX() << std::endl;
std::cout << "y=" << transform.getRotation().getY() << std::endl;
std::cout << "z=" << transform.getRotation().getZ() << std::endl;
Thanks a lot!!!
Nacho
Posts: 31
Joined: Tue Mar 04, 2008 1:41 pm

Re: Quaternion's values...

Post by Nacho »

The limits for the quaternion's values are [0,1] when it represent a rotation. The quaternion must be unitary to represent rotation:
sqrt(Qx*Qx+Qy*Qy+Qz*Qz+Qw*Qw)=1

If the rotation axis (unitary) for quaternion is ax, ay, az and rotation angle around axis is angle, then, the quaternion's components are:

Qx=ax*sin(angle/2)
Qy=ay*sin(angle/2)
Qz=az*sin(angle/2)
Qw=cos(angle/2)


Nacho