深刻理解坐标变换

本文详细探讨了二维/三维笛卡尔坐标系下的旋转和平移原理,强调了坐标变换的相对性。内容包括:1) 明确坐标系在变换中的重要性,区分内旋和外旋;2) 平移与旋转的顺序对最终结果的影响,先平移后旋转与先旋转后平移的不同;3) 深入解析坐标系旋转和向量旋转的矩阵表示,指出两者旋转矩阵的转置关系。通过实例和矩阵运算,阐述了旋转和平移的数学表达式及其应用。
摘要由CSDN通过智能技术生成

此次讨论的是二维/三维/笛卡尔坐标系下的旋转和平移。且以下分析均是右手坐标系下。

1 要明确坐标系

只提旋转,而不提在哪个坐标系下都是耍流氓。旋转和平移都是相对某个坐标系而言,不能抛开坐标系谈数值,这也是为什么会存在内旋(静态坐标系),外旋(动态坐标系)矩阵相乘顺序不同,

Example:

在这里插入图片描述

如上图所示, C 0 C_0 C0​-> C 1 C_1 C1​和 C 0 C_0 C0​-> C 2 C_2 C2的变换矩阵分别为 R 1 , R 2 R_1,R_2 R1,R2(这里先不考虑平移),这两个旋转矩阵均是相对于 C 0 C_0 C0坐标系而言的,那么如果要求 C 1 C_1 C1 C 2 C_2 C2坐标系的旋转 △ R \triangle R R,

如果上述 △ R \triangle R R是对于 C 1 C_1 C1坐标系而言的:
△ R ∗ R 1 = R 2 ⇔ △ R = R 2 ∗ R 1 − 1 \triangle R*R_1=R_2 \Leftrightarrow \triangle R=R_2*R_1^{-1} RR1=R2R=R2R11
如果是在 C 0 C_0 C0坐标系的变换:
R 1 ∗ △ R = R 2 ⇔ △ R = R 1 − 1 ∗ R 2 R_1*\triangle R=R_2 \Leftrightarrow \triangle R=R_1^{-1}*R_2 R1R=R2R=R11R2

2 先平移还是先旋转

先后顺序对应转换矩阵是有影响的,后一步操作都是在前一步操作产生的新坐标系下进行的;

  1. 先平移再旋转:
    X ⃗ n e w = R ( X ⃗ o l d − t ) \vec{X}_{new}=R(\vec{X}_{old}-t) X new=R(X oldt)
    那么新坐标系原点在旧坐标系下的坐标即为 t t t

  2. 先旋转再平移:
    X ⃗ n e w = R X ⃗ o l d + t \vec{X}_{new}=R\vec{X}_{old}+t X new=RX old+t
    那么旧坐标系原点在新坐标系下的坐标为 − t -t t​.

3 旋转坐标系还是旋转坐标系中的向量

坐标系的旋转和向量的旋转转过的角度大小和旋转方向相同的情况下,坐标系绕原点旋转的旋转矩阵与向量(坐标)绕原点旋转的旋转矩阵互为转置。

3.1旋转坐标系

在这里插入图片描述

如上图所示是坐标系旋转( X O Y XOY XOY坐标系绕 Z Z Z轴转动了 θ \theta θ 角度变成了 X ′ O Y ′ X'OY' XOY​),那么 P P P点在新坐标系下的坐标为:
x 2 = x 1 ∗ c o s ( θ ) + y 1 ∗ s i n ( θ ) y 2 = y 1 ∗ c o s ( θ ) − x 1 ∗ s i n ( θ ) x_2=x_1*cos(\theta)+y_1*sin(\theta) \\y_2=y_1*cos(\theta)-x_1*sin(\theta) x2=x1cos(θ)+y1sin(θ)y2=y1cos(θ)x1sin(θ)

[ x 2 y 2 ] = [ c o s ( θ ) s i n ( θ ) − s i n ( θ ) c o s ( θ ) ] ∗ [ x 1 y 1 ] \left[ \begin{matrix} x_2\\y_2 \end{matrix} \right]= \left[ \begin{matrix} cos(\theta)&sin(\theta)\\-sin(\theta)&cos(\theta) \end{matrix} \right]* \left[ \begin{matrix} x_1\\y_1 \end{matrix} \right] [x2y2]=[cos(θ)sin(θ)sin(θ)cos(θ)][x1y1]
那么旋转矩阵即为
R = [ c o s ( θ ) s i n ( θ ) − s i n ( θ ) c o s ( θ ) ] R=\left[ \begin{matrix} cos(\theta)&sin(\theta)\\-sin(\theta)&cos(\theta) \end{matrix} \right] R=[cos(θ)sin(θ)sin(θ)cos(θ)]

3.2 旋转的是向量

可以从上图中直观的看出旋转矩阵和坐标系旋转互为转置(正交矩阵也是互逆),不信的话,一种推导方式如下:

在这里插入图片描述

假设 P ⃗ 1 \vec{P}_1 P 1角度为 α \alpha α, 转角为 θ \theta θ ,那么 P ⃗ 2 \vec{P}_2 P 2​的夹角为 ( α + θ ) (\alpha+\theta) (α+θ), 在复数域下的坐标分别为:
P ⃗ 1 = [ c o s ( α ) s i n ( α ) ] , P ⃗ 2 = [ c o s ( α + θ ) s i n ( α + θ ) ] \vec{P}_1=\left[ \begin{matrix} cos(\alpha)\\sin(\alpha) \end{matrix} \right], \vec{P}_2=\left[ \begin{matrix} cos(\alpha+\theta)\\sin(\alpha+\theta) \end{matrix} \right] P 1=[cos(α)sin(α)],P 2=[cos(α+θ)sin(α+θ)]
由三角函数和差公式可得:
P ⃗ 2 = [ c o s ( α + θ ) s i n ( α + θ ) ] = [ c o s ( θ ) − s i n ( θ ) s i n ( θ ) c o s ( θ ) ] ∗ P ⃗ 1 \vec{P}_2=\left[ \begin{matrix} cos(\alpha+\theta)\\sin(\alpha+\theta) \end{matrix} \right]= \left[ \begin{matrix} cos(\theta)&-sin(\theta)\\sin(\theta)&cos(\theta) \end{matrix} \right]*\vec{P}_1 P 2=[cos(α+θ)sin(α+θ)]=[cos(θ)sin(θ)sin(θ)cos(θ)]P 1
那么旋转矩阵为
R = [ c o s ( θ ) − s i n ( θ ) s i n ( θ ) c o s ( θ ) ] R=\left[\begin{matrix}cos(\theta)&-sin(\theta)\\sin(\theta)&cos(\theta)\end{matrix}\right] R=[cos(θ)sin(θ)sin(θ)cos(θ)]
得证。

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值