How to rotate an orientation (Euler angles) If I have an orientation defined by Euler angles and I want to simulate a rotation of the coordinate system about the origin (doesn't matter to me how the rotation is specified), how would I get the new Euler angles? I understand how to transform a point via a rotation matrix, but I'm not sure how to approach this in terms of Euler angles.

For example, I'm thinking of an airplane's orientation in terms of pitch, yaw, and roll, and say I want to simulate a random rotation of the airplane about its center.
Let us assume that the rotation is known by a $3\times3$ matrix, and let us focus on the one specified as $X_1Z_2X_3$ in the Wikipedia article.

You get $\alpha$ from $\tan\alpha=\dfrac{s_1s_2}{c_1s_2}$.

You get $\beta$ from $\tan\beta=\dfrac{\sqrt{(s_2c_3)^2+(s_2s_3)^2}}{c_2}$.

You get $\gamma$ from $\tan\gamma=\dfrac{s_3s_2}{c_3s_2}$.

As expected, $\beta=0$ creates an indeterminacy, but this case is easy to deal with (it reduces to a single rotation $\alpha+\gamma$).

You can probably improve the accuracy by a least-squares fitting of the matrix derived from the angles to the given matrix, but this will require the Levenberg-Marquardt algorithm as this is a non-linear problem.

I guess that you can also address the computation of the angles by using three well-chosen Givens rotations that will transform the input matrix to a unit one (backwards, $X_1Z_2X_3\to X_1Z_2\to X_1\to I$, corresponding to angles $(\alpha,\beta,\gamma)\to(\alpha,\beta,0)\to(\alpha,0,0)\to(0,0,0)$).
Let us assume that the rotation is known by a $3\times3$ matrix, and let us focus on the one specified as $X_1Z_2X_3$ in the Wikipedia article.

You get $\alpha$ from $\tan\alpha=\dfrac{s_1s_2}{c_1s_2}$.

You get $\beta$ from $\tan\beta=\dfrac{\sqrt{(s_2c_3)^2+(s_2s_3)^2}}{c_2}$.

You get $\gamma$ from $\tan\gamma=\dfrac{s_3s_2}{c_3s_2}$.

As expected, $\beta=0$ creates an indeterminacy, but this case is easy to deal with (it reduces to a single rotation $\alpha+\gamma$).

You can probably improve the accuracy by a least-squares fitting of the matrix derived from the angles to the given matrix, but this will require the Levenberg-Marquardt algorithm as this is a non-linear problem.

I guess that you can also address the computation of the angles by using three well-chosen Givens rotations that will transform the input matrix to a unit one (backwards, $X_1Z_2X_3\to X_1Z_2\to X_1\to I$, corresponding to angles $(\alpha,\beta,\gamma)\to(\alpha,\beta,0)\to(\alpha,0,0)\to(0,0,0)$).