본문 바로가기

Fundamental

회전 행렬 (Rotation Matrix) 개념 정리

내용을 보강하여 3D Rigid Body Transformation 개념 정리 포스트에 업로드하였습니다.

Introduction

회전행렬은 n차원 공간 상 존재하는 물체를 회전시킬 때 사용하는 행렬이다. 일반적으로 2차원 또는 3차원 공간 상의 강체(rigid body)를 회전시킬 때 사용한다. 본 포스트에서는 3차원 공간 상의 강체를 회전시킨다고 가정한다.

 

 

다음과 같이 공간 상의 고정좌표계 $\{S\}$와 강체의 무게중심점에 존재하는 이동좌표계 $\{B\}$가 존재한다고 가정하자. $\{B\}$ 의 원점을 $P$, 축을 $(\hat{x},\hat{y},\hat{z})$ 하고 space frame $\{S\}$ 의 축을 $(\hat{X},\hat{Y},\hat{Z})$ 라고 하자. 이 때 space frame $\{S\}$ 를 기준으로 base frame $\{B\}$ 를 표현해보면 다음과 같다. 

   \begin{equation}
   \begin{aligned}
   \vec{P}=P_1\hat{X}+P_2\hat{Y}+P_3\hat{Z}
   \end{aligned}
   \end{equation}

   그리고 $\{B\}$ 의 축 $(\hat{x},\hat{y},\hat{z})$ 를 $(\hat{X},\hat{Y},\hat{Z})$ 의 선형결합으로 표현하면 다음과 같다.
   \begin{equation}
   \begin{aligned}
       \hat{x}=r_{11}\hat{X}+r_{21}\hat{Y}+r_{31}\hat{Z}
       \\ \hat{y}=r_{12}\hat{X}+r_{22}\hat{Y}+r_{32}\hat{Z}
       \\ \hat{z}=r_{13}\hat{X}+r_{23}\hat{Y}+r_{33}\hat{Z}
   \end{aligned}
   \end{equation}

 

위 수식의 표현을 간략하게 하기 위해 아래와 같은 기호를 사용한다.
\begin{equation}
\begin{aligned}
{\color{red}{P}} =\left[\begin{array}{c}P1\\P2\\P3\end{array}\right], {\color{red}{R}} =\left[\begin{array}{ccc}r_{11}&r_{12}&r_{13}\\r_{21}&r_{22}&r_{23}\\r_{31}&r_{32}&r_{33}\end{array}\right]
\end{aligned}
\end{equation}


위 기호를 사용하면 아래와 같은 복잡한 수식을 
\begin{equation}
\begin{aligned}
  \vec{P}=P_1\hat{X}+P_2\hat{Y}+P_3\hat{Z}
  \\ \hat{x}=r_{11}\hat{X}+r_{21}\hat{Y}+r_{31}\hat{Z}
  \\ \hat{y}=r_{12}\hat{X}+r_{22}\hat{Y}+r_{32}\hat{Z}
  \\ \hat{z}=r_{13}\hat{X}+r_{23}\hat{Y}+r_{33}\hat{Z}
\end{aligned}
\end{equation}

아래와 같이 간단하게 나타낼 수 있다.
\begin{equation}
\begin{aligned}
  \vec{P}=\left[\begin{array}{ccc}\hat{X} & \hat{Y} & \hat{Z} \end{array}\right]\color{red}{P}
  \\ \left[\begin{array}{ccc}\hat{x} & \hat{y} & \hat{z} \end{array}\right]=\left[\begin{array}{ccc}\hat{X} & \hat{Y} & \hat{Z} \end{array}\right]\color{red}{R}
\end{aligned}
\end{equation}

이 때, $(\hat{X},\hat{Y},\hat{Z}) \rightarrow (\hat{x},\hat{y},\hat{z})$ 변환은 크기는 변하지 않고 오직 회전에만 관여하므로 이 변환에 사용하는 행렬 $R$ 을 회전행렬 (Rotation Matrix) 이라고 한다.
그리고 $R$ 은 보통 $^{S}_{B}R$ 또는 $R_{SB}$ 로 표기한다. 이 표현의 의미는 $\{S\}$ frame에서 바라본 $\{B\}$ frame의 회전(량)을 의미한다.

Properties of Rotation Matrix


다음과 같이 총 12개의 변수를 사용하여 $\{B\}$ frame을 $\{S\}$ frame 기준으로 표현할 수 있다.
\begin{equation}
\begin{aligned}
(\hat{x},\hat{y},\hat{z}), (r_{11},r_{12},r_{13},r_{21},r_{22},r_{23},r_{31},r_{32},r_{33})
\end{aligned}
\end{equation}

하지만 3차원 공간에서 물체는 회전 3자유도와 이동 3자유도를 합한 6자유도(=6DOF, 6 Degree of Freedom)를 갖는다. 회전은 3자유도를 가지므로 이에 따라 12개의 변수는 모두 독립이 아니고 종속적이라는 것을 알 수 있다. 즉, 독립적으로 3개를 정하면 제약조건에 의해 나머지 9개의 변수는 결정된다는 것을 알 수 있다.

제약조건 및 회전행렬의 특징은 다음과 같다.
1) $\{B\}$ frame의 축들은 단위벡터라는 조건
   \begin{equation}
   \begin{aligned}
   \begin{array}{ll} \text{(i) } & \left | \hat{x} \right |^2 = 1: r_{11}^2+r_{21}^2+r_{31}^2=1 \\   \text{(ii) } & \left | \hat{y} \right |^2 = 1: r_{12}^2+r_{22}^2+r_{32}^2=1 \\   \text{(iii) } & \left | \hat{z} \right |^2 = 1: r_{13}^2+r_{23}^2+r_{33}^2=1 \end{array}
   \end{aligned}
   \end{equation}

2) $\{B\}$ frame의 축들은 서로 수직하다는 조건
   \begin{equation}
   \begin{aligned}
   \begin{array}{ll} \text{(iv) } & \hat{x} \perp \hat{y} : r_{11}r_{12}+r_{21}r_{22}+r_{31}r_{32}=0 \\   \text{(v) } & \hat{x} \perp \hat{z} : r_{11}r_{13}+r_{21}r_{23}+r_{31}r_{33}=0  \\   \text{(vi) } & \hat{y} \perp \hat{z} : r_{12}r_{13}+r_{22}r_{23}+r_{32}r_{33}=0  \end{array}
   \end{aligned}
   \end{equation}

   위 조건들을 합쳐서 보통 다음과 같이 표현한다. $\color{red}{(\text{i}\sim\text{vi}) \quad R^\text{T}R=\mathbf{I}}$. 이를 Orthogonal property라고 한다.

 

3) (일반적으로) 오른손 좌표계를 사용한다는 조건
   \begin{equation}
   \begin{aligned}
   \text{(vii) det}R=1 \Leftrightarrow \hat{x} \times \hat{y} = \hat{z}
   \end{aligned}
   \end{equation}

4) 다음과 같은 연속적인 회전을 나타낼 때는 회전 행렬의 곱셈을 통해 표현할 수 있다.

 

   \begin{equation}
   \begin{aligned}
   ^{a}_{b}R^{b}_{c}R \ =\ ^{a}_{c}R
   \end{aligned}
   \end{equation}

   \begin{equation}
   \begin{aligned}
      \color{red}{[\hat{x}_{b},\hat{y}_{b},\hat{z}_{b}] = [\hat{x}_{a},\hat{y}_{a},\hat{z}_{a}]^{a}_{b}R}
      \\ \color{red}{[\hat{x}_{c},\hat{y}_{c},\hat{z}_{c}] = [\hat{x}_{b},\hat{y}_{b},\hat{z}_{b}]^{b}_{c}R}
      \\ \color{blue}{\therefore [\hat{x}_{c},\hat{y}_{c},\hat{z}_{c}] = [\hat{x}_{a},\hat{y}_{a},\hat{z}_{a}]^{a}_{c}R^{b}_{c}R}
   \end{aligned}
   \end{equation}
5) $\{a\} \rightarrow \{b\}$ 만큼 회전한 다음 다시 $\{b\} \rightarrow \{a\}$ 만큼 회전하면 원래 $\{a\}$ frame이 된다. 즉, 회전하지 않은 것과 동일하다.
   \begin{equation}
   \begin{aligned}
   ^{a}_{b}R^{b}_{a}R = \mathbf{I}
   \end{aligned}
   \end{equation}

6) 또한 다음과 조건들로부터 아래와 같은 식을 유도할 수 있다.


   \begin{equation}
   \begin{aligned}
   ^{a}_{b}R\ ^{a}_{b}R^\text{T}=\mathbf{I} \quad \text{and} \quad ^{a}_{b}R\ ^{b}_{a}R = \mathbf{I}
   \end{aligned}
   \end{equation}

   로부터
   \begin{equation}
   \begin{aligned}
   & R^\text{T}R=\mathbf{I} \quad \leftrightarrow \quad R^{\text{T}} = R^{-1} \\
   & \therefore \  ^{a}_{b}R^{-1} = \ ^{a}_{b}R^{T} = \ ^{b}_{a}R
   \end{aligned}
   \end{equation}

   따라서 회전행렬은 역행렬과 전치행렬이 동일 하며 이는 반대방향으로 회전을 나타냄을 알 수 있다.

 

7) 회전행렬을 통해 특정 vector의 기준 좌표계 또한 변환할 수 있다.


   \begin{equation}
   \begin{aligned}
   & \vec{v}_a \ = \ ^{a}_{b}R\vec{v}_b
   \end{aligned}
   \end{equation}

   $\vec{v}$ 벡터를 $\{a\}$ frame과 $\{b\}$ frame에서 각각 표현하면 다음과 같다.
 


   이 때 $\{b\}$ frame은 $\{a\}$ frame과 회전행렬을 통해 표현이 가능하므로
 


   따라서 아래와 같이 특정 vector의 기준좌표계를 회전행렬을 통해 변환할 수 있다.


   \begin{equation}
   \begin{aligned}
   \therefore \vec{v}_a \ = \ ^{a}_{b}R\vec{v}_b
   \end{aligned}
   \end{equation}

8) 회전행렬을 사용하여 특정 vector를 회전시킬 수도 있다.
   \begin{equation}
   \begin{aligned}
   v' \ = \ ^{a}_{b}Rv
   \end{aligned}
   \end{equation}

   frame이 회전할 때 frame 위에 있는 사람이 보면 vector가 회전하는 것처럼 보인다.
 

 

Special Orthogonal Group (SO3)

회전행렬과 같이 순수한 회전에만 관여하는 행렬을 따로 Group으로 묶을 수 있다. 회전행렬의 성질을 만족하는 모든 집합은 Special Orthogonal Group (SO)에 속하며 본 자료에서 다루는 3차원 공간 상의 회전행렬은 SO(3)에 속한다. SO(3) 그룹은 Lie Group에 속한다. 


SO(3) 그룹(또는 집합)의 정의는 다음과 같다.
\begin{equation}
\begin{aligned}
\text{SO}(3) = \{ R \in \mathbb{R}^{3 \times 3} \ | \ RR^{T} = \mathbf{I}, \text{det}(R)=1 \}
\end{aligned}
\end{equation}


SO(3) 성질 중 $\det(R)=1$ 이 없는 Group을 Orthogonal Group (O) 라고 한다.
\begin{equation}
\begin{aligned}
\text{O}(3) = \{ R \in \mathbb{R}^{3 \times 3} \ | \ RR^{T} = \mathbf{I}, \}
\end{aligned}
\end{equation}

따라서 SO(3) 그룹은 O(3) 그룹의 특징에 Special한 특징 ($\det(R)=1$)이 추가된 형태로 볼 수 있다.

임의의 회전행렬 $R_{1}, R_{2}$ 가 존재할 때 이들은 덧셈에 닫혀있지 않지만 곱셈에 닫혀있다.
\begin{equation}
\begin{aligned}
R_{1} + R_{2} \notin SO(3) \quad \text{and} \quad R_{1}R_{2} \in SO(3)
\end{aligned}
\end{equation}

 

 

References