mail  mail@stemandmusic.in
    
call  +91-9818088802
Donate

Factoring a 3D Roto-Reflection Matrix into a Rotation and Reflection Matrix

  1. 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.
  2. The formula for General 3D Roto-Reflection Matrix \(R\) is given as

    \(R=\begin{bmatrix} R[0][0] & R[0][1] & R[0][2] \\R[2][0] & R[1][1] & R[1][2]\\R[2][0]& R[2][1]& R[2][2]\end{bmatrix}= \begin{bmatrix} -kX^2 + c & -kXY - sZ & -kXZ + sY\\-kXY + sZ & -kY^2 + c & -kYZ - sX\\-kXZ - sY & -kYZ + sX & -kZ^2 + c\end{bmatrix}\)   ...(1)

    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.
  3. The following gives the steps / pseudocode for Finding Axes and Angles from Roto-Reflection Matrix as given in equation (1) above
    1. Find the value of \(\cos \phi\) as follows

      \(\cos \phi = {\Large \frac{R[0][0] + R[1][1] + R[2][2] + 1}{2}}\)

      \(\Rightarrow \cos \phi = {\Large \frac{-kX^2 + c - kY^2 + c - kZ^2 + c + 1}{2}}\)

      \(\Rightarrow \cos \phi = {\Large \frac{-k(X^2 + Y^2 + Z^2) + 3c + 1}{2}}\)

      Since \(X^2 + Y^2 + Z^2=1\) therefore,

      \(\cos \phi = {\Large \frac{-k + 3c - 1}{2}}\)

      Since \(k=1+c\) therefore,

      \(\cos \phi = {\Large \frac{-1-c + 3c + 1}{2}}\)

      \(\Rightarrow \cos \phi = {\Large \frac{2c}{2}}=c\)
    2. 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

      \(R = \begin{bmatrix} 1-2X^2 & -2XY & -2XZ \\-2XY & 1-2Y^2 & -2YZ\\-2XZ & -2YZ & 1-2Z^2\end{bmatrix}\)
    3. 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

      \(R = \begin{bmatrix} -1 & 0 & 0 \\0 & -1 & 0\\0 & 0 & -1\end{bmatrix}\)

      Also, under such circumstances Any Arbitraty Vector can be given as the Axis.
    4. 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

      \(X^2 = {\Large \frac{R[0][0] - c}{-k}}= {\Large \frac{-kX^2 + c -c}{-k}}={\Large \frac{-kX^2}{-k}}\)

      \(Y^2 = {\Large \frac{R[1][1] - c}{-k}}= {\Large \frac{-kY^2 + c -c}{-k}}={\Large \frac{-kY^2}{-k}}\)

      \(Z^2 = {\Large \frac{R[2][2] - c}{-k}}= {\Large \frac{-kZ^2 + c -c}{-k}}={\Large \frac{-kZ^2}{-k}}\)

      If \(X^2 \neq 0\) then find the 2 values of \(X\). For each value of \(X\) find the values of \(\sin \phi\), \(\phi\), \(Y\) and \(Z\) as follows

      \(s=\sin \phi= {\Large \frac{R[2][1] - R[1][2]}{2X}}\)

      \(\phi=m\_arctan2(\cos \phi,\sin \phi)\)

      \(Y= {\Large \frac{R[0][2] - R[2][0]}{2s}}\)

      \(Z= {\Large \frac{R[1][0] - R[0][1]}{2s}}\)

      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

      \(s=\sin \phi= {\Large \frac{R[0][2] - R[2][0]}{2Y}}\)

      \(\phi=m\_arctan2(\cos \phi,\sin \phi)\)

      \(X= {\Large \frac{R[2][1] - R[1][2]}{2s}}\)

      \(Z= {\Large \frac{R[1][0] - R[0][1]}{2s}}\)

      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

      \(s=\sin \phi= {\Large \frac{R[1][0] - R[0][1]}{2Z}}\)

      \(\phi=m\_arctan2(\cos \phi,\sin \phi)\)

      \(X= {\Large \frac{R[2][1] - R[1][2]}{2s}}\)

      \(Y= {\Large \frac{R[0][2] - R[2][0]}{2s}}\)

      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\).
  4. 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

    Rotation Matrix \(R_{rot} = \begin{bmatrix} tX^2 + c & tXY - sZ & tXZ + sY\\tXY + sZ & tY^2 + c & tYZ - sX\\tXZ - sY & tYZ + sX & tZ^2 + c\end{bmatrix}\)

    where \(c = \cos \phi, s = \sin \phi, t = 1-\cos \phi\)

    Reflection Matrix \(R_{ref} = \begin{bmatrix} 1-2X^2 & -2XY & -2XZ \\-2XY & 1-2Y^2 & -2YZ\\-2XZ & -2YZ & 1-2Z^2\end{bmatrix}\)
Related Calculators
Roto-Reflection Matrix to Rotation and Reflection Matrix Calculator
Related Topics
Improper Rotations and Roto-Reflection Matrices in 3 Dimensions,    Finding Axes and Angles of Rotation from 3D Rotation Matrix
© Invincible IDeAS. All Rights Reserved