float Quaternion::Angle(Quaternion& a, Quaternion& b) {
Quaternion inv = Quaternion::Inverse(a);
Quaternion res = b * inv;
return acosf(res.w) * 2.0f;// * 57.2957795f; // To degrees!;
}
Now, i run my test code
Quaternion q1 = Quaternion::Euler(10.0f, 5.0f, 90.0f);
Quaternion q2 = Quaternion::Euler(7.0f, -80.0f, 360.0f);
cout << Quaternion::Angle(q1, q2) << '\n';
And the result is 4.40809 radians
Not bad, i multiply it by 57.2957795f to convert it to degrees and the angle is 252.565 degrees
I compare this to Unity's implementation of the .Angle function
Quaternion q1 = Quaternion.Euler(10.0f, 5.0f, 90.0f);
Quaternion q2 = Quaternion.Euler(7.0f, -80.0f, 360.0f);
Debug.Log(Quaternion.Angle(q1, q2));
And the result is 107.4352 degrees
Odd... Multiply that by Unity's Mathf.Deg2Rad constant and the result is 1.875097 radians
So my question would be something along the lines of: "What on earth am i doing wrong?"