Skip to content

坐标变换 ​

平移 ​

[x′y′]=[xy]+[ab]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} x \\ y \end{bmatrix} + \begin{bmatrix} a \\ b \end{bmatrix}

用矩阵乘法也表示为:

[x′y′1]=[10a01b001][xy1]\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 & a \\ 0 & 1 & b \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}

旋转 ​

绕原点的旋转,通过几何或复数(eiθze^{i\theta}z)来推导:

[x′y′1]=[cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001][xy1]\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}

一般变换 ​

先

[x′y′1]=[10a01b001][cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001][xy1]=[cos⁡θ−sin⁡θasin⁡θcos⁡θb001][xy1]\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix}= \begin{bmatrix} 1 & 0 & a \\ 0 & 1 & b \\ 0 & 0 & 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} = \begin{bmatrix} \cos\theta & -\sin\theta & a \\ \sin\theta & \cos\theta & b \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}

求变换矩阵 ​

只需要两个点的坐标就能知道变换矩阵。

设坐标系 AA 中两点 (x1,y1),(x2,y2)(x_1, y_1), (x_2, y_2), BB 中两点 (x1′,y1′),(x2′,y2′)(x_1', y_1'), (x_2', y_2') ,则

[x2−x1y2−y1]=[cos⁡θ−sin⁡θsin⁡θcos⁡θ][x2′−x1′y2′−y1′]\begin{bmatrix} x_2 - x_1 \\ y_2 - y_1 \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} x_2' - x_1' \\ y_2' - y_1' \end{bmatrix}

可解得 θ\theta 。则变换矩阵为:

[cos⁡θ−sin⁡θx1−x1′sin⁡θcos⁡θy1−y1′001]\begin{bmatrix} \cos\theta & -\sin\theta & x_1 - x_1' \\ \sin\theta & \cos\theta & y_1 - y_1' \\ 0 & 0 & 1 \end{bmatrix}