我有两个给定的向量,我必须计算它们之间的旋转量。
这是正确的方法吗:
QVector3D vec1 = QVector3D(0.0,0.0,1.0);
QVector3D vec2 = QVector3D(1.0,0.0,0.0);
QQuaternion quatRot, quat1, quat2;
quat1.setVector(vec1);
quat1.setScalar(0.0);
quat2.setVector(vec2);
quat2.setScalar(0.0);
quatRot = QQuaternion::nlerp(quat1, quat2, 0.5); //is 0.5 for t correct?
quat2 = quat2.normalized();
QMatrix4x4 rotMat;
rotMat.setToIdentity();
rotMat.rotate(quatRot);
rotMat 现在是我可以用来旋转 OpenGL 对象的旋转矩阵。那是对的吗?