使用 QQuaternion 类旋转对象
我一直在尝试使用 QQuaternion 类的函数来旋转对象。
我定义了我的四元数然后将其标准化。现在我正在努力使用这个特定的函数使其旋转:
void QMatrix4x4::rotate(const QQuaternion &quaternion)
所以这个函数将当前矩阵(这个矩阵)与对应于我定义的四元数的旋转矩阵相乘。在我的代码中,当前矩阵是模型视图矩阵。
所以从逻辑上讲,我应该输入 m.rotate(quaternion) 但如何指定 m 实际上是模型视图矩阵?
这就是我试图做的:
GLfloat matrix[16];
glGetFloatv (GL_MODELVIEW_MATRIX, matrix);
matrix.rotate(quaternion);
我想现在函数知道矩阵实际上是模型视图矩阵。 但是,我收到一个错误:成员引用基类型 GLfloat [16]
不是结构或联合。所以我认为这不是正确的做法。
I've been trying to rotate an object using the functions of the class QQuaternion
.
I defined my quaternion then normalize it. Now I'm struggling to make it rotate using this specific function :
void QMatrix4x4::rotate(const QQuaternion &quaternion)
So this function multiplies a current matrix (this matrix) with the rotation matrix that corresponds to the quaternion I defined. In my code, the current matrix is the modelview matrix.
So logically, I should type m.rotate(quaternion) but how can I specify that m is actually the modelview matrix ?
here is what I tried to do:
GLfloat matrix[16];
glGetFloatv (GL_MODELVIEW_MATRIX, matrix);
matrix.rotate(quaternion);
I think now the function knows that matrix is actually the modelview matrix.
But, I got an error: member reference base type GLfloat [16]
is not a structure or union. So I don't think it's the right way to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论