본문 바로가기

Graphics Note

[Mathematics] rotation quaternion details

모델의 회전변환에 쿼터니언을 사용하는 방법에 대해 설명한 지난 글에서 회전사원수를 당연하게 사용했다.

이번글에서는 이 부분에 대해서 조금 더 상세하게 정리해보려고 한다.

 

회전을 위해서는 정규화된 임의의 축을 필요로하는데 이를 [math]\mathbf{u}[/math]로 나타내자.

임의의 점 [math]\mathbf{P}[/math]를 [math]\mathbf{u}[/math]을 축으로 [math]\theta[/math]만큼의 회전은 [math]\mathbf{P'}[/math]을 결과로 가지며, 아래 그림과 같은 형태로 표현될 수 있다.

 

 

여기서 점의 회전이 이루는 평면을 고려해보자. 이는 [math]\mathbf{P} - \left( \mathbf{P} \cdot \mathbf{u} \right) \mathbf{u}[/math]벡터와 [math]\mathbf{u}\times\mathbf{P}[/math]벡터를 기저로삼고  [math]\left(\mathbf{P}\cdot\mathbf{u}\right)\mathbf{u}[/math]를 원점으로 하는 좌표계로 생각할 수 있다. 이로부터  [math]\mathbf{P'}[/math]를 극좌표 표현으로 나타내면

[math!]\mathbf{P'}=\left( \cos\theta\left(\mathbf{P}-\left(\mathbf{P}\cdot\mathbf{u}\right)\mathbf{u}\right),\  \sin\theta\left(\mathbf{u}\times\mathbf{P}\right) \right)[/math!]

가 된다. 이는 본래의 좌표계에서 다음과 같이 표현된다.

[math!]\mathbf{P'} = \left(\mathbf{P}\cdot\mathbf{u}\right)\mathbf{u} + \cos\theta\left(\mathbf{P}-\left(\mathbf{P}\cdot\mathbf{u}\right)\mathbf{u}\right) + \sin\theta\left( \mathbf{u} \times \mathbf{P} \right)[/math!]

 

이제 사원수를 적용해보자. 회전축의 사원수표현은 극형식(polar form)으로 나타내게 되는데, 정규화된 크기가 1인 벡터이므로

[math!]\mathbf{q}=\left(  \sin\frac{\theta}{2}\mathbf{u}, \cos\frac{\theta}{2}\right)[/math!]

와 같이 표현된다(고 한다. 어떻게 이런 형태를 생각하게 되었는지는 알 수 없었다).

 

저번 글에서 사원수를 이용한 회전공식은 [math]\mathbf{q}\mathbf{P}\mathbf{q}^{-1}[/math]라고 했었다. 그런데 [math]\mathbf{q}[/math]는 크기가 1이므로 이의 inverse는 conjugate와 동일하다. 즉 다음과 같은 식으로 표현될 수 있다.

[math!]\mathbf{q}\mathbf{P}\mathbf{q}^{*}[/math!]

조금 전에 구했던 회전축의 사원수 표현 [math]\mathbf{q}[/math]로부터 위 식을 풀어 정리하면 처음에 의도했던 [math]\mathbf{P'}[/math]의 식을 얻을 수 있다. (수식의 정리는 너무 복잡해서 여기에 쓰지는 않겠다)

 

풀어보니 맞구나 알수있지만, 이걸 처음 생각한 사람은 어떤 사고의 흐름으로 처음의 식을 사원수의 곱의 표현으로 바꾸어 놓았는지는 도통 모르겠다.

'Graphics Note' 카테고리의 다른 글

automatic linking the first out variable of fragment shader  (4) 2014.04.02
[Mathematics] quaternion interpolation  (0) 2014.03.28
device context and rendering context  (0) 2014.02.24
Bezier curve  (0) 2014.02.04
cube map upside-down  (0) 2014.01.22