## Converting rotation matrices of left-handed coordinate system

In left-handed coordinate system, positive angle is clockwise direction. In right-handed coordinate system, positive angle is anti-clockwise direction.

I spent many hours to find out how to convert rotation matrices of left-handed coordinate system. The solution is to replace the angle $\theta$ with $-\theta$

The rotation matrices about three axis in left-handed coordinate system.

$Rx(\theta) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos\theta & sin\theta \\ 0 & -sin\theta & cos\theta \end{bmatrix}$

$Ry(\theta) = \begin{bmatrix} cos\theta & 0 & -sin\theta \\ 0 & 1 & 0 \\ sin\theta & 0 & cos\theta \end{bmatrix}$

$Rz(\theta) = \begin{bmatrix} cos\theta & sin\theta & 0 \\ -sin\theta & cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix}$

The rotation matrix about arbitrary axis

${\bf R}({\bf \hat{n}}, \theta) = \begin{bmatrix} n_{x}^{2}(1 - cos\theta) + cos\theta & n_{x}n_{y}(1 - cos\theta) + n_{z}sin\theta & n_{x}n_{z}(1 - cos\theta) - n_{y}sin\theta \\ n_{x}n_{y}(1 - cos\theta) - n_{z}sin\theta & n_{y}^{2}(1 - cos\theta) + cos\theta & n_{y}n_{z}(1 - cos\theta) + n_{x}sin\theta \\ n_{x}n_{z}(1 - cos\theta) + n_{y}sin\theta & n_{y}n_{z}(1 - cos\theta) - n_{x}sin\theta & n_{z}^{2}(1 - cos\theta) + cos\theta \end{bmatrix}$

To get $Rx(\theta)$ in right-handed coordinate system, replace the angle $\theta$ with negative $\theta$. Then apply the following rules.

$cos(-\theta) = cos\theta$
$sin(-\theta) = -sin\theta$

$Rx(\theta) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(-\theta) & sin(-\theta) \\ 0 & -sin(-\theta) & cos(-\theta) \end{bmatrix}$

$Rx(\theta) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos\theta & -sin\theta \\ 0 & sin\theta & cos\theta \end{bmatrix}$

$Ry(\theta) = \begin{bmatrix} cos\theta & 0 & sin\theta \\ 0 & 1 & 0 \\ -sin\theta & 0 & cos\theta \end{bmatrix}$

$Rz(\theta) = \begin{bmatrix} cos\theta & -sin\theta & 0 \\ sin\theta & cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix}$

${\bf R}({\bf \hat{n}}, \theta) = \begin{bmatrix} n_{x}^{2}(1 - cos\theta) + cos\theta & n_{x}n_{y}(1 - cos\theta) - n_{z}sin\theta & n_{x}n_{z}(1 - cos\theta) + n_{y}sin\theta \\ n_{x}n_{y}(1 - cos\theta) + n_{z}sin\theta & n_{y}^{2}(1 - cos\theta) + cos\theta & n_{y}n_{z}(1 - cos\theta) - n_{x}sin\theta \\ n_{x}n_{z}(1 - cos\theta) - n_{y}sin\theta & n_{y}n_{z}(1 - cos\theta) + n_{x}sin\theta & n_{z}^{2}(1 - cos\theta) + cos\theta \end{bmatrix}$

Reference

3D Math Primer for Graphics and Game Development 2ed, Fletcher Dunn, Ian Parberry
Mathematics for 3D Game Programming and Computer Graphics 3ed, Eric Lengyel