2D二維旋轉變換,坐標旋轉變換矩陣是如何推導而來?三維旋轉變換矩陣與二維旋轉變換有什么聯系?


推薦開源項目:簡單的SLAM與機器人教程與編程實踐-github

我們在做幾何變換的時候經常需要把某個坐標系上的所有點都進行一個旋轉,這個操作就叫做剛體旋轉(所有的點相對位置不變的發生旋轉)。下圖是一個典型的二維坐標系下剛體旋轉。我們把藍色的坐標系旋轉了 θ \theta 度,新坐標系就是紅色的坐標系。我們現在已知一個點相對紅色那個坐標系的坐標 ( x r e d , y r e d ) (x_{red},y_{red}) ,和已知旋轉角度 θ \theta ,然后我們想求得該點相對於藍色那個坐標系的坐標 ( x b l u e , y b l u e ) (x_{blue},y_{blue})
在這里插入圖片描述

這個其實很簡單我們利用高中學的三角幾何就可以輕松解決。從上圖可以發現不變量是黑色的那個線段的長度。而這個長度我們是可以根據黑色點相對紅色坐標系下的坐標 ( x r e d , y r e d ) (x_{red},y_{red}) 算出來的。黑色線段長度為 r = x r e d 2 + y r e d 2 r=\sqrt {x_{red}^2+y_{red}^2} .
然后我們可以根據紫色那個三角形計算出黑色點相對藍色坐標系下的坐標 ( x b l u e , y b l u e ) (x_{blue},y_{blue})
根據高中學的三角幾何我們可以知道:
x b l u e = r c o s ( α + θ ) y b l u e = r s i n ( α + θ ) x_{blue}=r*cos(\alpha+\theta)\\ y_{blue}=r*sin(\alpha+\theta)
現在這個 α \alpha 我們是不知道的。但是我們能找到一個關於它的線索。
x r e d = r c o s ( α ) y r e d = r s i n ( α ) x_{red}=r*cos(\alpha)\\ y_{red}=r*sin(\alpha)

為了用上這個線索我們需要對下面這個式子進行展開。
x b l u e = r c o s ( α + θ ) = r ( c o s ( α ) c o s ( θ ) s i n ( α ) s i n ( θ ) ) = x r e d c o s ( θ ) y r e d s i n ( θ ) y b l u e = r s i n ( α + θ ) = r ( s i n ( α ) c o s ( θ ) + c o s ( α ) s i n ( θ ) ) = y r e d c o s ( θ ) + x r e d s i n ( θ ) x_{blue}=r*cos(\alpha+\theta)=r*(cos(\alpha)*cos(\theta)-sin(\alpha)*sin(\theta))=x_{red}*cos(\theta)-y_{red}*sin(\theta)\\ y_{blue}=r*sin(\alpha+\theta)=r*(sin(\alpha)*cos(\theta)+cos(\alpha)*sin(\theta))=y_{red}*cos(\theta)+x_{red}*sin(\theta)

所以我們把上面那個式子總結成向量相乘的方式那就是:
x b l u e = [ c o s ( θ ) , s i n ( θ ) ] [ x r e d , y r e d ] T x_{blue}=[cos(\theta), -sin(\theta)][x_{red},y_{red}]^T
y b l u e = [ s i n ( θ ) , c o s ( θ ) ] [ x r e d , y r e d ] T y_{blue}=[sin(\theta), cos(\theta)][x_{red},y_{red}]^T
然后可以進一步整理成矩陣相乘的形式:
[ c o s ( θ ) s i n ( θ ) s i n ( θ ) c o s ( θ ) ] \begin{bmatrix} cos(\theta)& -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix}


免責聲明!

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



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