Advertisement

Angular speed (direction) to go from one quarternion to other ?

Started by January 14, 2003 08:39 AM
4 comments, last by minorlogic 22 years, 1 month ago
I have 2 Quarternions , and i want to know the angular speed (represented in a vector3 ) to get from one to other. quaternion VelDir = Q1 - Q2; it works but not in all cases . What is wrong and how to solve ? Please !
The quaternion to get from Q1 to Q2 is...

Q3 = Q2 * conj(Q1)

Use Q3 to get the info you require.
Advertisement
Thanks ! I use it , and it works !

But in some cases it point not in the shortest way ? (when the qurternions lay on the diffrent octants).

Can i guess shortest way ?
You don''t need to guess. Work out the 4D inner product of the two quaternions: if this is negative they are seperated by more than 90 degrees in 4D space, and you need to negate one of them before proceeding. q and -q represent the same rotation so this does not change the problem but it results in a ''shorter'' solution when moving betwen the quaternions.
John BlackburneProgrammer, The Pitbull Syndicate
float cosa = innerproduct( DesiredOrientation, Orientation );
quaternion ToTargetDir = Orientation;
if(cosa < 0){
ToTargetDir.x = -ToTargetDir.x;
ToTargetDir.y = -ToTargetDir.y;
ToTargetDir.z = -ToTargetDir.z;
ToTargetDir.w = -ToTargetDir.w;
// is this correct ?
}

ToTargetDir.conjugate();
ToTargetDir *= DesiredOrientation;

Where to change quaternion ? i''m trying but it don''t work ? what i doing wrong ?





johnb ! Thanks very much ! I have done it .

I just forget to invert cosinus of angle, when i did it all works !

This topic is closed to new replies.

Advertisement