二维旋转变换推导

上图将向量(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*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} \]

posted @ 2018-02-26 15:22  Weyne  阅读(1695)  评论(0编辑  收藏  举报