for quaternion multiplication the defination is:
(a + i b + j c + k d)*(e + i f + j g + k h) =
a*e - b*f -c* g- d*h +
i (b*e + a*f + c*h- d*g) +
j (a*g - b*h+ c*e + d*f) +
k (a*h + b*g - c*f + d*e)
however in the Cal3D's "quaternion.c" the quaternion
multiplication is implemented as:
q the first one, r the second one
then
return CalQuaternion(
r.w * q.x + r.x * q.w + r.y * q.z - r.z * q.y,
r.w * q.y - r.x * q.z + r.y * q.w + r.z * q.x,
r.w * q.z + r.x * q.y - r.y * q.x + r.z * q.w,
r.w * q.w - r.x * q.x - r.y * q.y - r.z * q.z
);
The order of the two quaternion q , r on the two sides of
the operator * is swaped.
suggestion:
change r to be the first quaternion and q to be the
second quaternion
Best Regards
Song Hu
s.hu@cs.ucl.ac.uk
Logged In: YES
user_id=888075
I was also running into issues with quaternions in cal3d.
Justin says that the quaternions are left handed rotations
in cal3d, not right handed rotations. With that premise,
the operation is correct. The design is just counter-intuitive.