Factoring a 3D Roto-Reflection Matrix into a Rotation and Reflection Matrix
Any given 3D Roto-Relection Matrix can be factored into A Rotation Matrix corresponding to Rotation around an Axis and A Reflection Matrix corresponding to Reflection across a Plane whose Normal is given by the same Axis.
The formula for General 3D Roto-Reflection Matrix \(R\) is given as
where \(c = \cos \phi, s = \sin \phi, k = 1+\cos \phi\), \(\phi\) is the Angle of Rotation and \(X\), \(Y\) and \(Z\) are the Components of Unit Vector representing the Axis Vector of Rotation and Axis Vector Normal to the Plane of Reflection.
The following gives the steps / pseudocode for Finding Axes and Angles from Roto-Reflection Matrix as given in equation (1) above
If \(\cos \phi=1\) then \(\phi=0\). This makes \(k=2\) and \(\sin\phi=0\). Under such circumstances the Roto-Reflection Matrix is Reflection Matrix Across a Plane given as follows
If \(\cos \phi=-1\) then \(\phi=\pi=180^\circ\). This makes \(k=0\) and \(\sin\phi=0\). Under such circumstances the Roto-Reflection Matrix is also a Reflection Matrix Across the Point of Origin given as follows
Also, under such circumstances Any Arbitraty Vector can be given as the Axis.
If \(\cos \phi\neq 1\) and \(\cos \phi\neq -1\) then calculate the value of \(k=1+\cos\phi\). To find the Angles of Rotation and Axes or Rotation and Normal to the Plane of Reflection find \(X^2\),
\(Y^2\), \(Z^2\) as follows
If \(X^2 = 0\) but \(Y^2 \neq 0\) then find the 2 values of \(Y\). For each value of \(Y\) find the values of \(\sin \phi\), \(\phi\), \(X\) and \(Z\) as follows
If \(X^2 = 0\) and \(Y^2 = 0\) but \(Z^2 \neq 0\) then find the 2 values of \(Z\). For each value of \(Z\) find the values of \(\sin \phi\), \(\phi\), \(X\) and \(Y\) as follows
The 2 Sets of \(X\), \(Y\) \(Z\) and \(\phi\), values thus obtained give the Components of the 2 Unit Vectors for the 2 Axes of Rotation/Reflection and the Corresponding Angles of Rotation. Both the Unit Vectors are
in Opposite Direction to each other. If one of the Angles Values obtained is \(\theta\) the other is \(2\pi - \theta\).
The \(m\_arctan2\) is the Modified Arctangent Function, which calculates the angle \(\phi\) such that \(0 \leq \phi < 2\pi\).
Once the values of \(X\), \(Y\) \(Z\) and \(\phi\) get calculated, the 3D Rotation and 3D Reflection Matrix that are Factors of the given Roto-Reflection Matrix can be calculated as follows