[Bf-python] quat multiplication

Willian Padovani Germano wgermano at ig.com.br
Fri Nov 28 01:00:15 CET 2003


Hi,

>  t0=   q1[0]*q2[0]-q1[1]*q2[1]-q1[2]*q2[2]-q1[3]*q2[3];
>  t1=   q1[0]*q2[1]+q1[1]*q2[0]+q1[2]*q2[3]-q1[3]*q2[2];
>  t2=   q1[0]*q2[2]+q1[2]*q2[0]+q1[3]*q2[1]-q1[1]*q2[3];
>  q[3]= q1[0]*q2[3]+q1[3]*q2[0]+q1[1]*q2[2]-q1[2]*q2[1];
>  q[0]=t0;
>  q[1]=t1;
>  q[2]=t2;

>   x = qw * q.x + qx * q.w + qy * q.z - qz * q.y;
>   y = qw * q.y - qx * q.z + qy * q.w + qz * q.x;
>   z = qw * q.z + qx * q.y - qy * q.x + qz * q.w;
>   w = qw * q.w - qx * q.x - qy * q.y - qz * q.z;

> when you multiply the quats, blender gives:
> q3 = [-4,4,4,4] (w,z,y,x)
> and cal3d gives:
> q3 = [4,4,4,-4] (x,y,z,w)

No, look again at the two sets of multiplications, comparing for example
t1 in the first with x in the second.  Blender stores quats as
(w,x,y,z) -- the real part is at index 0, that's the only difference.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list