# Finding the Euler angle/axis from a 2 axes rotation but that lies on the original 2 axes' plane

If I rotate the XY plane about the y-axis by an angle ψ and then intrinsically rotate it about the new plane's x-axis by an angle φ, the axis created by the intersection of the original XY plane and the final plane will be a Euler axis/angle. What are the formulae to obtain the axis angle (relative to the x or y axis) and the angle of rotation?

This question has it's roots in a machining problem I have where the parts can only be rotated on a single axis and the design has 2 rotations.

I have tried several different solutions given both here and on Wikipedia using Euler and Rodrigues rotation formulae but they all place the rotation axis in 3D space. I need it to lie on the XY plane but I can't work out how to zero out the z-axis component.

Okay I have worked it out intuitively but it may well be a long way round of arriving at the solution.

If you use the rotation formulae found in Wikipedia at https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Rotation_matrix_↔_Euler_axis/angle, the Euler axis/angle in 3D space can be derived entirely from trig functions using the 3x3 matrix A. To project the axis of rotation onto the XY plane is simply a case of projecting the new plane's z-axis (the axis normal to the plane) onto XY rotated by 90. The angle of rotation will be the angle the new z-axis has with the original XY plane.

This allows for a part requiring machining around 3 axis to be performed on 2 axis. I've verified that by drawing the planes in Inventor. Works perfectly.

SOLUTION FORMULAE

For rotations about the x-, y- and z-axes with angles $\phi$, $\theta$ and $\psi$ respectively, the Euler axis of rotation that lies on the XY plane and it's associated rotation angle can be derived from the following formulae using trig functions only.

The Euler axis of rotation is offset from the y-axis by an angle $\alpha$ about the z-axis where: $$\alpha = \tan^{-1} \biggl[(- \sin \phi \times \cos \psi + \cos \phi \times \sin \theta \times \sin \psi )\\ \div ( \sin \phi \times \sin \psi + \cos \phi \times \sin \theta \times \cos \psi) \biggr]\\$$ and the rotation angle $\beta$ about the Euler axis of rotation and offset from the XY plane is given by $$\\ \beta = \pi /2 - \sin^{-1} \left[ \sqrt{ ( \sin \phi \times \sin \psi + \cos \phi \times \sin \theta \times \cos \psi )^{2}\\ + (-\sin \phi \times \cos \psi + \cos \phi \times \sin \theta \times \sin \psi)^{2} } \right] \\$$ In the case where only 2 rotations exist with $\psi = 0$ we substitute for $\cos \psi = 1$ and $\sin \psi = 0$. The Euler angles $\alpha$ and $\beta$ then simplify to: \begin{align*} \alpha & = tan^{-1} \biggl[ - \sin \phi / ( \cos \phi \times \sin \theta ) \biggr] \\ \\ \beta & = \pi /2 - \sin^{-1} \biggl[ \sqrt{(\cos \phi \times \sin \theta )^{2} + (-\sin \phi)^{2} } \biggr] \\ \end{align*} All formulae are derived from the $A_{31}$ and $A_{32}$ elements of the rotation matrix expressed in terms of the sine and cosine of the rotation angles (i.e. the x and y components of the new z-axis).

In the above case this is the "new" z-axis relative to the original XY plane and is coincident with the origin which serves as the centre point for all rotations, but it may be any point on any plane.