码迷,mamicode.com
首页 > 其他好文 > 详细

旋转变换的理解

时间:2018-02-26 16:21:27      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:markdown   pos   http   .com   bubuko   post   分享   blog   class   

只讲二维的情况,其他维度类似。

技术分享图片

上图将向量(x,y)旋转到\((x_1,y_1)\),求旋转矩阵。即已知角度\(\theta\),问题表述为矩阵方程:
\[ \begin{bmatrix} x_1 \y_1 \end{bmatrix} = A* \begin{bmatrix} x \y \end{bmatrix} \]
求变换矩阵\(A\)

方法一

利用平面几何的方法。
\[ \begin{split} x_1 = {}&cos(\theta+\alpha)*r\ = {}&cos(\theta)*cos(\alpha)*r - sin(\theta)*sin(\alpha)*r\ = {}& cos(\theta)*x-sin(\theta)*y \end{split} \]

\[ \begin{split} y_1 = {}&sin(\theta+\alpha)*r\ = {}&sin(\theta)*cos(\alpha)*r+cos(\theta)*sin(\alpha)*r\ = {}&sin(\theta)*x + cos(\theta)*y \end{split} \]
这个线性方程组写成矩阵形式,可得
\[ A = \begin{bmatrix} cos(\theta) & -sin(\theta)\sin(\theta) & cos(\theta) \end{bmatrix} \]

方法二

利用线性变换的方法

\(R^2\)中的任意一点(x,y)经过旋转\(\theta\)后变为(x1,y1),求旋转矩阵。

这是一个线性变换,设变换为

\[ T(X) = AX \]
\(X\)为一个\(R^2\)的向量,按题意即是求变换矩阵\(A\)

\(I\)\(R^2\)的单位矩阵,\(e\)为单位列向量。即:

\[ I = \begin{bmatrix} 1&0\ 0&1 \end{bmatrix} =(e1,e2) \]

按照直角坐标系理解,e1就是x轴上的(1,0)点,e2就是y轴上的(0,1)点。

\[ X = X*I = X*(e1,e2) = x*e1 + y*e2 \]

由于是线性变换,所以

\[ T(X) = T(x*e1 + y*e2) = x*T(e1) + y*T(e2) =\begin{bmatrix} T(e1)&T(e2) \end{bmatrix}* \begin{bmatrix} x\\y \end{bmatrix} \]

所以

\[ A =\begin{bmatrix} T(e1)&T(e2) \end{bmatrix} \]

技术分享图片
\(T(e)\)通过平面几何可以很容易求出来。三角形的斜边长度是1,角度是\(\theta\),那么对边是\(sin(\theta)\),即x坐标,邻边是\(cos(\theta)\),即y坐标。

\[ T(e1) = \begin{bmatrix} cos(\theta)\ sin(\theta) \end{bmatrix} \]

同理求得:

\[ T(e2) = \begin{bmatrix} -sin(\theta)\ cos(\theta) \end{bmatrix} \]
因为旋转到x轴的负方向,所以取负值。

所以

\[ A = \begin{bmatrix} cos(\theta)&-sin(\theta)\ sin(\theta)&cos(\theta) \end{bmatrix} \]

旋转变换的理解

标签:markdown   pos   http   .com   bubuko   post   分享   blog   class   

原文地址:https://www.cnblogs.com/WeyneChen/p/8471884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!