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