问题
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