點旋轉和坐標系旋轉


同一坐標系下的點旋轉變換(如圖1所示)和不同坐標系之間的旋轉變換(如圖2所示),一直困擾着我,它們是兩個不同的概念,但形式上有很相似,以二維空間為例做了下推導,加深理解。

同一坐標系下的點旋轉變換,比較好理解,是在相同的坐標系下做的旋轉變換。如圖3所示,已知逆時針的旋轉角度為θ,我們引入中間變量向量的長度r和水平夾角α,顯而易見地,推導公式如下:

\(x=r cos(\theta+\alpha)=rcos(\theta)cos(\alpha)-rsin(\theta)sin(\alpha)=x^{'}cos(\theta)-x^{'}sin(\theta)\)
\(y=r sin(\theta+\alpha)=rsin(\theta)cos(\alpha)+rcos(\theta)sin(\alpha)=x^{'}sin(\theta)+x^{'}cos(\theta)\) 

\(\begin{bmatrix}
x\\
y
\end{bmatrix}=\begin{bmatrix}
cos(\theta) & -sin(\theta) \\
sin(\theta) &cos(\theta) &
\end{bmatrix}\begin{bmatrix}
x^{'}\\
y^{'}
\end{bmatrix}\)

齊次坐標系的表達為:

\(\begin{bmatrix}
x\\
y\\
1
\end{bmatrix}=\begin{bmatrix}
cos(\theta) & -sin(\theta) &0\\
sin(\theta) &cos(\theta) & 0 \\
0&0&1
\end{bmatrix}\begin{bmatrix}
x^{'}\\
y^{'}\\
1
\end{bmatrix}\)

 

不同坐標系之間的旋轉變換,這是透視變換中常用到的,它的作用是將一個點從一個坐標系統映射到另一個坐標系統下,這在將世界坐標系統映射到相機坐標系統中是很有用的。如圖4所示,已知坐標系O'X'Y'相對於OXY坐標系逆時針的旋轉角度為θ,O'X'Y'的坐標原點O'相對於OXY的坐標為(x0,y0),我們引入中間變量向量的長度r和水平夾角α。變換的思路是,先對O'X'Y'坐標系旋轉θ,然后在平移(x0,y0)。推導過程如下:

\(x=rcos(\theta+\alpha)+x_{0}=rcos(\theta)cos(\alpha)-rsin(\theta)sin(\alpha)=x^{'}cos(\theta)-x^{'}sin(\theta)+x_{0}\)
\(y=r sin(\theta+\alpha)+y_{0}=rsin(\theta)cos(\alpha)+rcos(\theta)sin(\alpha)=x^{'}sin(\theta)+x^{'}cos(\theta)+y_{0}\)

\(\begin{bmatrix}
x\\
y
\end{bmatrix}=\begin{bmatrix}
cos(\theta) & -sin(\theta) \\
sin(\theta) &cos(\theta) &
\end{bmatrix}\begin{bmatrix}
x^{'}\\
y^{'}
\end{bmatrix}+\begin{bmatrix}
x^{0}\\
y^{0}
\end{bmatrix}\)

 齊次坐標系的表達為: 

\(\begin{bmatrix}
x\\
y
\end{bmatrix}=\begin{bmatrix}
cos(\theta) & -sin(\theta) &x^{0}\\
sin(\theta) &cos(\theta) &y^{0}\\
0&0 &1
\end{bmatrix}\begin{bmatrix}
x^{'}\\
y^{'}\\
1
\end{bmatrix}\)

 注意齊次坐標的作用是把旋轉縮放和平移結合起來,在傳統的歐幾里得空間中是做不到的,需要在投影空間中的齊次坐標系統下完成。

同理可以擴展到三維空間。OXYZ坐標系統可以看作是相機坐標系統,O'X'Y'Z'可以看做世界坐標系統,

 

參考資料:

[1].矩陣的坐標變換(轉)(里面介紹了矩陣的旋轉縮放,還有推導過程,強烈推薦★★★★★)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM