My linear algebra is a little rusty. Given an arbitrary point P(x,y,z), how do I determine the theta needed to apply a rotation matrix that will rotate the point onto the X-Y plane, with respect to Y? More specifically, how do I determine the theta when the vector is outside of the XZ plane? I know how to solve for the direction cosine gamma, the angle between the vector terminating at the point P, and the +Z axis.
It must be a fundamental misunderstanding of the rotation, but when trying to apply the rotation matrix Ry(theta) to the point (2,4,4), I keep ending up with a non-zero z' value. I have looked at many references and videos, and there is just something I am not getting about this particular rotation.
For the point (2,4,4), I found the direction angle gamma, measured from the +z axis, to be 35.26, and my initial thought was that the theta to rotate through, about the y-axis, should be 90-gamma, or 54.74. After applying the rotation matrix, the z-component of the rotated point should be z'= -xsin(theta)+zcos(theta), but this yields a non-zero z'. If the vector was truly rotated down onto the XY plane, this value should be zero.
Where am I going wrong?