Calculate the absolute position of the point having the position before rotation and rotation angles

无人久伴 提交于 2019-12-13 17:16:03

问题


How can I rotate the point (x, y, z) by angles (rx, ry, rz) about their respective axes?

That is, how do I determine the point (x1, y1, z1) resulting from the rotation of (x, y, z) by rotation angles (rx, ry, rz)?

Are there any DirectX routines which accomplish this?


回答1:


What you are asking about is how to use Euler Angles for performing rotations. There are several conventions you can choose from, but it looks to me like you are interested in applying rotation about the Z axis, followed by rotation about Y and then rotation about X. For this you would post multiply by the matrix

where

c1 = cos(rx)    s1 = sin(rx)
c2 = cos(ry)    s2 = sin(ry)
cs = cos(rz)    s3 = sin(rz)

There are several problems with this approach, one of the more common being gimbal lock. The preferred approach is to use one of the angle-axis formulations. The two most common of those are Unit Quaternion Rotations and Euler-Rodreigues Rotation Matrices. These can be composed to generate any of the 12 Euler Rotation matrices by explicitly defining three rotation axes and their associated rotation angles and then multiplying the resulting rotation representation in the reverse order they are to be applied to the vectors to be rotated.

DirectX uses Quaternions for performing rotations.




回答2:


During my electronics(EM) classes I learnt converting cartesian to polar cordinates using the formula

x = r sinq cosf, y = r sinq sinf, z = r cosq

More Info Here

q is theta, f is phi.



来源:https://stackoverflow.com/questions/11952967/calculate-the-absolute-position-of-the-point-having-the-position-before-rotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!