Rotational Matrix3 and Quaternion

   1162   2   1
User Avatar
Member
37 posts
Joined: 4月 2022
Offline
The pig head has some rotational movement from position A to B as shown in my attached pic.

(Pivot point remains at {0,0,0} with no translation or rotation)




In order to the get the degrees for such rotation, I have the following:



// Method 1. Matrix only:
matrix3 offset = invert(A) * B;
vector Rot = cracktransform(0, 0, 1, 0, offset);


// Method 2. Convert to quaternions for calculation:
vector4 A = quaternion(A);
vector4 B = quaternion(B);
vector4 offsetQ = qmultiply(A, qinvert(B));
vector Rot = qconvert(offsetQ);



I was expecting the same result for Rot, unfortunately not.

There must be something somewhere I misunderstood. Someone explain to this noob, please?
Edited by sda502 - 2022年10月17日 05:13:10

Attachments:
Screen Shot 2022-10-17 at 14.39.04.png (969.4 KB)

User Avatar
スタッフ
727 posts
Joined: 10月 2012
Offline
qconvert() returns an angle/axis vector, where the vector's direction is the axis and the magnitude is the rotation around that axis

You might be looking for quaterniontoeuler() instead?
User Avatar
Member
37 posts
Joined: 4月 2022
Offline
I am perplexed.
  • Quick Links