旋轉矩陣

旋轉矩陣

在三維空間中,旋轉矩陣有一個等於單位1的實特徵值。旋轉矩陣指定關於對應的特徵向量的旋轉(歐拉旋轉定理)。如果旋轉角是 θ,則旋轉矩陣的另外兩個(複數)特徵值是 exp(iθ) 和 exp(-iθ)。從而得出 3 維旋轉的跡數等於 1 + 2 cos(θ),這可用來快速的計算任何 3 維旋轉的旋轉角。

3 維旋轉矩陣的生成元是三維斜對稱矩陣。因為只需要三個實數來指定 3 維斜對稱矩陣,得出只用三個實數就可以指定一個 3 維旋轉矩陣。

旋轉

編輯

主條目:Tait-Bryan角

生成旋轉矩陣的一種簡單方式是把它作為三個基本旋轉的序列複合。關於右手笛卡爾坐標系的 x-, y- 和 z-軸的旋轉分別叫做 roll, pitch 和 yaw 旋轉。因為這些旋轉被表達為關於一個軸的旋轉,它們的生成元很容易表達。

繞 x-軸的主動旋轉定義為:

R

x

(

θ

x

)

=

[

1

0

0

0

cos

θ

x

sin

θ

x

0

sin

θ

x

cos

θ

x

]

=

exp

(

θ

x

[

1

0

0

0

0

1

0

1

0

]

)

{\displaystyle {\mathcal {R}}_{x}(\theta _{x})={\begin{bmatrix}1&0&0\\0&\cos {\theta _{x}}&-\sin {\theta _{x}}\\0&\sin {\theta _{x}}&\cos {\theta _{x}}\end{bmatrix}}=\exp \left(\theta _{x}{\begin{bmatrix}1&0&0\\0&0&-1\\0&1&0\end{bmatrix}}\right)}

這裡的

θ

x

{\displaystyle \theta _{x}}

是 roll 角,和右手螺旋的方向相反(在yz平面順時針)。

繞 y-軸的主動旋轉定義為:

R

y

(

θ

y

)

=

[

cos

θ

y

0

sin

θ

y

0

1

0

sin

θ

y

0

cos

θ

y

]

=

exp

(

θ

y

[

0

0

1

0

1

0

1

0

0

]

)

{\displaystyle {\mathcal {R}}_{y}(\theta _{y})={\begin{bmatrix}\cos {\theta _{y}}&0&\sin {\theta _{y}}\\0&1&0\\-\sin {\theta _{y}}&0&\cos {\theta _{y}}\end{bmatrix}}=\exp \left(\theta _{y}{\begin{bmatrix}0&0&1\\0&1&0\\-1&0&0\end{bmatrix}}\right)}

這裡的

θ

y

{\displaystyle \theta _{y}}

是 pitch 角,和右手螺旋的方向相反(在zx平面順時針)。

繞 z-軸的主動旋轉定義為:

R

z

(

θ

z

)

=

[

cos

θ

z

sin

θ

z

0

sin

θ

z

cos

θ

z

0

0

0

1

]

=

exp

(

θ

z

[

0

1

0

1

0

0

0

0

1

]

)

{\displaystyle {\mathcal {R}}_{z}(\theta _{z})={\begin{bmatrix}\cos {\theta _{z}}&-\sin {\theta _{z}}&0\\\sin {\theta _{z}}&\cos {\theta _{z}}&0\\0&0&1\end{bmatrix}}=\exp \left(\theta _{z}{\begin{bmatrix}0&-1&0\\1&0&0\\0&0&1\end{bmatrix}}\right)}

這裡的

θ

z

{\displaystyle \theta _{z}}

是 yaw 角,和右手螺旋的方向相反(在xy平面順時針)。

在飛行動力學中,roll, pitch 和 yaw 角通常分別採用符號

γ

{\displaystyle \gamma }

,

α

{\displaystyle \alpha }

, 和

β

{\displaystyle \beta }

;但是為了避免混淆於歐拉角這裡使用符號

θ

x

{\displaystyle \theta _{x}}

,

θ

y

{\displaystyle \theta _{y}}

θ

z

{\displaystyle \theta _{z}}

任何 3 維旋轉矩陣

M

R

3

×

3

{\displaystyle {\mathcal {M}}\in \mathbb {R} ^{3\times 3}}

都可以用這三個角

θ

x

{\displaystyle \theta _{x}}

,

θ

y

{\displaystyle \theta _{y}}

, 和

θ

z

{\displaystyle \theta _{z}}

來刻畫,並且可以表示為 roll, pitch 和 yaw 矩陣的乘積。

M

{\displaystyle {\mathcal {M}}}

是在

R

3

×

3

{\displaystyle \mathbb {R} ^{3\times 3}\,}

中的旋轉矩陣

θ

x

,

θ

y

,

θ

z

[

0

π

)

:

M

=

R

z

(

θ

z

)

R

y

(

θ

y

)

R

x

(

θ

x

)

{\displaystyle \Leftrightarrow \,\exists \,\theta _{x},\theta _{y},\theta _{z}\in [0\ldots \pi ):\,{\mathcal {M}}={\mathcal {R}}_{z}(\theta _{z})\,{\mathcal {R}}_{y}(\theta _{y})\,{\mathcal {R}}_{x}(\theta _{x})}

R

3

{\displaystyle \mathbb {R} ^{3}}

中所有旋轉的集合,加上複合運算形成了旋轉群 SO(3)。這裡討論的矩陣接着提供了這個群的群表示。更高維的情況可參見 Givens旋轉。

角-軸表示和四元數表示

編輯

主條目:軸角和四元數和空間旋轉

在三維中,旋轉可以通過單一的旋轉角

θ

{\displaystyle \theta }

和所圍繞的單位向量方向

v

^

=

(

x

,

y

,

z

)

{\displaystyle {\hat {\mathbf {v} }}=(x,y,z)}

來定義。

M

(

v

^

,

θ

)

=

[

cos

θ

+

(

1

cos

θ

)

x

2

(

1

cos

θ

)

x

y

(

sin

θ

)

z

(

1

cos

θ

)

x

z

+

(

sin

θ

)

y

(

1

cos

θ

)

y

x

+

(

sin

θ

)

z

cos

θ

+

(

1

cos

θ

)

y

2

(

1

cos

θ

)

y

z

(

sin

θ

)

x

(

1

cos

θ

)

z

x

(

sin

θ

)

y

(

1

cos

θ

)

z

y

+

(

sin

θ

)

x

cos

θ

+

(

1

cos

θ

)

z

2

]

{\displaystyle {\mathcal {M}}({\hat {\mathbf {v} }},\theta )={\begin{bmatrix}\cos \theta +(1-\cos \theta )x^{2}&(1-\cos \theta )xy-(\sin \theta )z&(1-\cos \theta )xz+(\sin \theta )y\\(1-\cos \theta )yx+(\sin \theta )z&\cos \theta +(1-\cos \theta )y^{2}&(1-\cos \theta )yz-(\sin \theta )x\\(1-\cos \theta )zx-(\sin \theta )y&(1-\cos \theta )zy+(\sin \theta )x&\cos \theta +(1-\cos \theta )z^{2}\end{bmatrix}}}

這個旋轉可以簡單的以生成元來表達:

M

(

v

^

,

θ

)

=

exp

(

θ

[

0

z

y

z

0

x

y

x

0

]

)

{\displaystyle {\mathcal {M}}({\hat {\mathbf {v} }},\theta )=\exp \left(\theta {\begin{bmatrix}0&-z&y\\z&0&-x\\-y&x&0\\\end{bmatrix}}\right)}

在運算於向量 r 上的時候,這等價於Rodrigues旋轉公式:

M

r

=

r

cos

(

θ

)

+

v

^

×

r

sin

(

θ

)

+

(

v

^

r

)

v

^

(

1

cos

(

θ

)

)

{\displaystyle {\mathcal {M}}\cdot \mathbf {r} =\mathbf {r} \,\cos(\theta )+{\hat {\mathbf {v} }}\times \mathbf {r} \,\sin(\theta )+({\hat {\mathbf {v} }}\cdot \mathbf {r} ){\hat {\mathbf {v} }}(1-\cos(\theta ))}

角-軸表示密切關聯於四元數表示。依據軸和角,四元數可以給出為正規化四元數 Q:

Q

=

(

x

i

+

y

j

+

z

k

)

sin

(

θ

/

2

)

+

cos

(

θ

/

2

)

{\displaystyle Q=(xi+yj+zk)\sin(\theta /2)+\cos(\theta /2)\,}

這裡的 i, j 和 k 是 Q 的三個虛部。

歐拉角表示

編輯

主條目:歐拉角

在三維空間中,旋轉可以通過三個歐拉角

(

α

,

β

,

γ

)

{\displaystyle (\alpha ,\beta ,\gamma )}

來定義。有一些可能的歐拉角定義,每個都可以依據 roll, pitch 和 yaw 的複合來表達。依據 "x-y-z" 歐拉角,在右手笛卡爾坐標中的旋轉矩陣可表達為:

M

(

α

,

β

,

γ

)

=

R

z

(

γ

)

R

y

(

β

)

R

x

(

α

)

{\displaystyle {\mathcal {M}}(\alpha ,\beta ,\gamma )={\mathcal {R}}_{z}(\gamma ){\mathcal {R}}_{y}(\beta ){\mathcal {R}}_{x}(\alpha )}

進行乘法運算生成:

M

(

α

,

β

,

γ

)

=

[

cos

γ

sin

γ

0

sin

γ

cos

γ

0

0

0

1

]

[

cos

β

0

sin

β

0

1

0

sin

β

0

cos

β

]

[

1

0

0

0

cos

α

sin

α

0

sin

α

cos

α

]

=

[

cos

γ

cos

β

sin

γ

cos

γ

sin

β

sin

γ

cos

β

cos

γ

sin

γ

sin

β

sin

β

0

cos

β

]

[

1

0

0

0

cos

α

sin

α

0

sin

α

cos

α

]

=

[

cos

γ

cos

β

sin

γ

cos

α

+

cos

γ

sin

β

sin

α

sin

γ

sin

α

+

cos

γ

sin

β

cos

α

sin

γ

cos

β

cos

γ

cos

α

+

sin

γ

sin

β

sin

α

cos

γ

sin

α

+

sin

γ

sin

β

cos

α

sin

β

cos

β

sin

α

cos

β

cos

α

]

{\displaystyle {\begin{aligned}{\mathcal {M}}(\alpha ,\beta ,\gamma )&={\begin{bmatrix}\cos \gamma &-\sin \gamma &0\\\sin \gamma &\cos \gamma &0\\0&0&1\end{bmatrix}}{\begin{bmatrix}\cos \beta &0&\sin \beta \\0&1&0\\-\sin \beta &0&\cos \beta \end{bmatrix}}{\begin{bmatrix}1&0&0\\0&\cos \alpha &-\sin \alpha \\0&\sin \alpha &\cos \alpha \end{bmatrix}}\\&={\begin{bmatrix}\cos \gamma \cos \beta &-\sin \gamma &\cos \gamma \sin \beta \\\sin \gamma \cos \beta &\cos \gamma &\sin \gamma \sin \beta \\-\sin \beta &0&\cos \beta \end{bmatrix}}{\begin{bmatrix}1&0&0\\0&\cos \alpha &-\sin \alpha \\0&\sin \alpha &\cos \alpha \end{bmatrix}}\\&={\begin{bmatrix}\cos \gamma \cos \beta &-\sin \gamma \cos \alpha +\cos \gamma \sin \beta \sin \alpha &\sin \gamma \sin \alpha +\cos \gamma \sin \beta \cos \alpha \\\sin \gamma \cos \beta &\cos \gamma \cos \alpha +\sin \gamma \sin \beta \sin \alpha &-\cos \gamma \sin \alpha +\sin \gamma \sin \beta \cos \alpha \\-\sin \beta &\cos \beta \sin \alpha &\cos \beta \cos \alpha \end{bmatrix}}\end{aligned}}}

對稱保持 SVD 表示

編輯

對旋轉軸

q

{\displaystyle q}

和旋轉角

θ

{\displaystyle \theta }

,旋轉矩陣

M

=

q

q

T

+

Q

G

Q

T

{\displaystyle {\mathcal {M}}=qq^{T}+QGQ^{T}}

這裡的

Q

=

[

q

1

,

q

2

]

{\displaystyle Q={\begin{bmatrix}q_{1},&q_{2}\end{bmatrix}}}

的縱列張開正交於

q

{\displaystyle q}

的空間而

G

{\displaystyle G}

θ

{\displaystyle \theta }

度 Givens 旋轉,就是說

G

=

[

cos

θ

sin

θ

sin

θ

cos

θ

]

{\displaystyle G={\begin{bmatrix}\cos \theta &\sin \theta \\-\sin \theta &\cos \theta \end{bmatrix}}}