Tadalafil for saleDrugstore hydrating eye creamOrder hydrochlorothiazide over the counter purchase Matrix to Euler ZYX

Using OpenGL compatible column vectors.

$ X = \left( \begin{array}{ccc}
1 & 0 & 0 \\
0 & cos \phi & -sin \phi \\
0 & sin \phi & cos \phi \\
\end{array} \right) $

$ Y = \left( \begin{array}{ccc}
cos \theta & 0 & sin \theta \\
0 & 1 & 0 \\
-sin \theta & 0 & cos \theta \\
\end{array} \right) $

$ Z = \left( \begin{array}{ccc}
cos \psi & -sin \psi & 0 \\
sin \psi & cos \psi & 0 \\
0 & 0 & 1 \\
\end{array} \right) $

General Case

$ M = Z * Y * Z $

M=\left( \begin{array}{ccc}
1 & 0 & 0 \\
0 & cos \phi & -sin \phi \\
0 & sin \phi & cos \phi \\
\end{array} \right)\left( \begin{array}{ccc}
cos \theta & 0 & sin \theta \\
0 & 1 & 0 \\
-sin \theta & 0 & cos \theta \\
\end{array} \right) \left( \begin{array}{ccc}
cos \psi & -sin \psi & 0 \\
sin \psi & cos \psi & 0 \\
0 & 0 & 1 \\
\end{array} \right)$

M=\left( \begin{array}{ccc}
1 & 0 & 0 \\
0 & cos \phi & -sin \phi \\
0 & sin \phi & cos \phi \\
\end{array} \right)\left( \begin{array}{ccc}
cos \theta cos \psi & -cos \theta sin \psi & sin \theta \\
sin \psi & cos \psi & 0 \\
-sin \theta cos \psi & sin \theta sin \psi & cos \theta \\
\end{array} \right) $

M=\left( \begin{array}{ccc}
cos \theta cos \psi &
-cos \theta sin \psi &
sin \theta \\
cos \phi sin \psi + sin \phi sin \theta cos \psi &
cos \phi cos \psi - sin \phi sin \theta sin \psi &
-sin \phi cos \theta \\
sin \phi sin \psi - cos \phi sin \theta cos \psi &
sin \phi cos \psi + cos \phi sin \theta sin \psi &
cos \phi cos \theta \\
\end{array} \right)$

\begin{alignat*}{3}
\phi &= atan(\frac{sin \phi}{cos \phi}) &&= atan(\frac{-M_{c2,r1}}{M_{c2,r2}}) \\
\theta &= asin(sin \theta) &&= asin(M_{c2,r0}) \\
\psi &= atan(\frac{sin \psi}{cos \psi}) &&= atan(\frac{-M_{c1,r0}}{M_{c0,r0}}) \\
\end{alignat*}

North Pole

\begin{flalign*}
sin \theta &= 1 \\
cos \theta &= 0 \\
\end{flalign*}

M=\left( \begin{array}{ccc}
0 &
0 &
1 \\
cos \phi sin \psi + sin \phi cos \psi &
cos \phi cos \psi - sin \phi sin \psi &
0 \\
sin \phi sin \psi - cos \phi cos \psi &
sin \phi cos \psi + cos \phi sin \psi &
0 \\
\end{array} \right)$

\begin{flalign*}
sin (\psi + \phi) &= cos \phi sin \psi + sin \phi cos \psi \\
cos (\psi + \phi) &= cos \phi cos \psi - sin \phi sin \psi \\
\end{flalign*}

M=\left( \begin{array}{ccc}
0 & 0 & 1 \\
sin(\psi + \phi) & cos(\psi + \phi) & 0 \\
-cos(\psi + \phi) & sin(\psi + \phi) & 0 \\
\end{array} \right)$

\begin{alignat*}{3}
\phi &= 0 &&= 0 \\
\theta &= asin(1) &&= \frac{\pi}{2} \\
\psi &= atan(\frac{sin \psi}{cos \psi}) &&= atan(\frac{M_{c0,r1}}{M_{c1,r1}}) \\
\end{alignat*}

South Pole

\begin{flalign*}
sin \theta &= -1 \\
cos \theta &= 0 \\
\end{flalign*}

M=\left( \begin{array}{ccc}
0 &
0 &
-1 \\
cos \phi sin \psi - sin \phi cos \psi &
cos \phi cos \psi + sin \phi sin \psi &
0 \\
sin \phi sin \psi + cos \phi cos \psi &
sin \phi cos \psi - cos \phi sin \psi &
0 \\
\end{array} \right)$

\begin{flalign*}
sin (\psi - \phi) &= cos \phi sin \psi - sin \phi cos \psi \\
cos (\psi - \phi) &= cos \phi cos \psi + sin \phi sin \psi \\
\end{flalign*}

M=\left( \begin{array}{ccc}
0 & 0 & -1 \\
sin(\psi - \phi) &  cos(\psi - \phi) & 0 \\
cos(\psi - \phi) & -sin(\psi - \phi) & 0 \\
\end{array} \right)$

\begin{alignat*}{3}
\phi &= 0 &&= 0 \\
\theta &= asin(1) &&= \frac{\pi}{2} \\
\psi &= atan(\frac{sin \psi}{cos \psi}) &&= atan(\frac{M_{c0,r1}}{M_{c1,r1}}) \\
\end{alignat*}

C Code

// given 4 row column vector matrix
static void mat_to_euler_zyx(
    const float m[][4],
    float* x_out,
    float* y_out,
    float* z_out)
{
    static const float pi = 3.141592653589793f;
    const float siny = m[2][0];
    if(siny >= (1.0f - FLT_EPSILON))
    {
        // north pole
        *x_out = 0.0f;
        *y_out = pi*0.5f;
        *z_out = atan2f(m[0][1], m[1][1]);
    }
    else if(siny < = -(1.0f - FLT_EPSILON))
    {
        // south pole
        *x_out = 0.0f;
        *y_out = -pi*0.5f;
        *z_out = atan2f(m[0][1], m[1][1]);
    }
    else
    {
        // general case
        *x_out = atan2f(-m[2][1], m[2][2]);
        *y_out = asinf (siny);
        *z_out = atan2f(-m[1][0], m[0][0]);
    }
}