开发者

How would I create a rotation matrix that rotates X by a, Y by b, and Z by c?

开发者 https://www.devze.com 2023-01-29 07:30 出处:网络
How would I create a rotation matrix that rotates X by a, Y by b, and Z by c? I need to formulas, unless you\'re using the ardor3d api\'s functions/methods.

How would I create a rotation matrix that rotates X by a, Y by b, and Z by c?

I need to formulas, unless you're using the ardor3d api's functions/methods.

Matrix is set up like this

xx, xy, x开发者_如何学Pythonz,
yx, yy, yz,
zx, zy, zz

A Quaternion is fine too.


See Wikipedia. It gives separate matrices for each axis of rotation. But X*(Y*(Z*v))) is of course equal to (X*Y*Z)*v, so you can get a single rotation matrix R as R=X*Y*Z.


Does this work for you?

glrotate(c, 0, 0, 1); // with respect to Z axis
glrotate(b, 0, 1, 0); // with respect to Y axis
glrotate(a, 1, 0, 0); // with respect to X axis
0

精彩评论

暂无评论...
验证码 换一张
取 消