@feistykittykat I have encountered the same issue regarding the convention today, and I was able to verify that the actual order in which the rotation is applied is indeed in the 2-1-3 (Y-X-Z) sequence, irrespective of the confusing yaw/pitch/roll nomenclature. I think at least specifying that the yaw/pitch/roll are specified in the camera coordinates would make it clearer, as X,Y,Z axes in robotics convention becomes -Z,-Y,X in (OpenGL) camera coordinates which results in the mixed terminology/axes specifications.
Snippet for testing:
bool IsQuaternionClose(const QQuaternion& lhs, const QQuaternion& rhs,
const float tol = 1e-6) {
QVector3D axis{};
float angle{0};
(lhs * rhs.inverted()).getAxisAndAngle(&axis, &angle);
return angle < tol;
}
void TestQuaternion(const float ax, const float ay, const float az) {
const QQuaternion rx = QQuaternion::fromEulerAngles(ax, 0, 0);
const QQuaternion rx2 = QQuaternion::fromAxisAndAngle(1.0f, 0.0f, 0.0f, ax);
assert(IsQuaternionClose(rx, rx2));
const QQuaternion ry = QQuaternion::fromEulerAngles(0, ay, 0);
const QQuaternion ry2 = QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, ay);
assert(IsQuaternionClose(ry, ry2));
const QQuaternion rz = QQuaternion::fromEulerAngles(0, 0, az);
const QQuaternion rz2 = QQuaternion::fromAxisAndAngle(0.0f, 0.0f, 1.0f, az);
assert(IsQuaternionClose(rz, rz2));
const QQuaternion ryxz = QQuaternion::fromEulerAngles(ax, ay, az);
assert(IsQuaternionClose(ry * rx * rz, ryxz));
}
Found the bug report (that loops back to this thread):
https://bugreports.qt.io/browse/QTBUG-78548?jql=text ~ "qquaternion euler"
Hopefully this will be addressed soon, as it is quite a confusing behavior.