Angular speed (direction) to go from one quarternion to other ?
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 !
January 14, 2003 10:20 AM
The quaternion to get from Q1 to Q2 is...
Q3 = Q2 * conj(Q1)
Use Q3 to get the info you require.
Q3 = Q2 * conj(Q1)
Use Q3 to get the info you require.
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 ?
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 ?
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 ?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement