坐标的含义

坐标基

一组向量V = {v_1, v_2, v_3, \cdots, v_n},如果存在至少一个c_i \ne 0, i = 0, 1, 2, \cdots, n使得下列等式满足:
v_1 c_1 + v_2 c_2 + \cdots + v_n c_n = 0
我们称{v_1, v_2, v_3, \cdots, v_n}是线性相关的,否则称这一组向量是线性无关的。

一组线性无关的向量成为这组向量张成的子空间的一组基

坐标

对于向量空间的某一个向量\overrightarrow{C},它可以表示为这个向量空间的坐标基的线性组合:
\overrightarrow{C} = v_1 c_1 + v_2 c_2 + \cdots + v_n c_n
那么(c_1, c_2, \cdots, c_n)成为该向量在该坐标基下的坐标值。

这里很重要的一点就是:没有坐标基谈坐标值是没有意义的

我们最熟悉的是三维空间坐标,经常说某个点的坐标为P = (p_x, p_y, p_z),这里已经有一个假设就是我们使用的是三维空间的标准基:
\begin{aligned} i &= [1,0,0]^T \\ j &= [0, 1, 0]^T \\ k &= [0, 0, 1]^T \end{aligned}

坐标的唯一性

express_in_dif_coord.png

如上图的二维坐标中,在标准坐标系([1, 0]^T, [0, 1]^T)下,点P的坐标为(1, 1)。我们现在使用另外一组坐标基([\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}]^T, [-\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}]^T),那么该点在这组基下的坐标就是(\sqrt{2}, 0)

上面的图也说明一个问题:一个点在某一组基下的坐标是确定的,但是随着基的不同坐标值是不同的

不同坐标系的坐标转换

coordinate-transform.png

我们看在标准坐标系的点P = (p_x, p_y),它跟着坐标系一起围绕原点逆时针旋转了\beta角度。旋转后的点我们表示为P'。现在我们想知道P'在标准坐标系的坐标。

P'在旋转之后的坐标系的坐标依然为(p_x, p_y),因为它投影到两个轴上的距离是没有变的。x'也很容易知道是[\cos\theta, \sin\theta]^Ty'[-\sin\theta, \cos\theta]^T,所以P'在标准坐标系的坐标表示为:
\label{ocoord-to-trans-coord} P' = \begin{bmatrix}p_x'\\p_y'\end{bmatrix} = \begin{bmatrix} p_x \cos\theta - p_y \sin\theta \\ p_x \sin\theta + p_y \cos\theta \\ \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix}p_x \\p_y\end{bmatrix}

那么反过来,点P在旋转之后的坐标系下的坐标(c_x, c_y)是多少呢?

从公式上面公式我们可以知道:
\begin{bmatrix}p_x\\p_y\end{bmatrix} =\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix}c_x \\c_y\end{bmatrix}
我们可以得到
\begin{bmatrix}c_x \\c_y\end{bmatrix} = \begin{bmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix}p_x \\p_y\end{bmatrix}

其实我们还可以得到另外一个结论:

  • x', y'是用的局部坐标基的时候,该点和坐标基础的组合表达的是坐标原点和该点之间的局部向量,也就是在局部坐标基下的向量;
  • x', y'是用的在某个坐标系W下的向量表示的时候,该点和坐标基础的组合表达的是坐标原点和该点之间的向量在W坐标系下的向量。

坐标架(Coordinate Frame)

coordinate-frame2.png

考虑上面的坐标变换,坐标基不但进行了旋转,还进行了平移。这种情况下,只用上面的坐标基变换明显是不够的。

coordinate-frame3.png

但是从这幅图我们可以看出o'px'y'使用的是在标准坐标基下的向量的时候表达的是o'p在标准坐标基上的表达,而要求p在标准坐标基下的坐标,本质上就是要求向量op在标准坐标基下的表达。从向量的三角关系很容易得知:
\begin{aligned} \overrightarrow{op} &= \overrightarrow{o'p} + \overrightarrow{oo'} \\ &= \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix}c_x \\c_y\end{bmatrix} + \overrightarrow{oo'} \end{aligned}
其中(c_x, c_y)是点p在平移后的坐标系的坐标,[\cos\theta, \sin\theta]^Tx'在标准坐标系中的表达,[-\sin\theta, \cos\theta]^Ty'在标准坐标系中的表达。

假设o'的在标准坐标系中的坐标为t = (t_x, t_y),并且记
R = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}
那么我们有
\begin{bmatrix}p_x\\p_y\end{bmatrix} = R \begin{bmatrix}c_x\\c_y\end{bmatrix} + \begin{bmatrix}t_x\\t_y\end{bmatrix}

也就是说,要完整表达两个坐标之间的关系,不仅仅需要知道坐标基之间的旋转关系,还需要知道坐标原点之间的关系。

我们把坐标基以及坐标原点一起叫做坐标架(Coordinate Frame)

三维空间坐标架

三维空间是二维空间直接拓展,我们有如下公式:
\begin{bmatrix}p_x\\p_y\\p_z\end{bmatrix} = R \begin{bmatrix}c_x\\c_y\\c_z\end{bmatrix} + \begin{bmatrix}t_x\\t_y\\t_z\end{bmatrix}

我们可以把坐标扩展成齐次坐标,这样旋转和平移矩阵就可以合并到一起了。
\begin{bmatrix}p_x\\p_y\\p_z\\1\end{bmatrix} = \begin{bmatrix} r_{00} & r_{01} & r_{02} & t_x \\ r_{10} & r_{11} & r_{12} & t_y \\ r_{20} & r_{21} & r_{22} & t_z \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix}c_x\\c_y\\c_z\\1\end{bmatrix}
物理意义:

  • [r_{00}, r_{10}, r_{20}]^T是变换后的坐标系的x轴在标准坐标系中的表达;
  • [r_{01}, r_{11}, r_{21}]^T是变换后的坐标系的y轴在标准坐标系中的表达;
  • [r_{02}, r_{12}, r_{22}]^T是变换后的坐标系的z轴在标准坐标系中的表达;
  • [t_x, t_y, t_z]^T是变换后的坐标系的原点在标准坐标系的表达。

篇外话

文章同步在公众号“探知轩”发表,欢迎关注并讨论。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容