1. 旋转矩阵的概述
旋转矩阵是一个用于描述空间中旋转变换的矩阵。在二维平面中,旋转矩阵用于将一个点围绕原点旋转一个特定角度。旋转矩阵的主要特点是,它是一个正交矩阵,且其行列式为 1,这意味着旋转是一个不改变点距离原点的等距变换(即不发生缩放或扭曲)。
旋转矩阵的形式(二维平面)
对于二维平面上的旋转,旋转矩阵 R(θ)R(\theta)R(θ) 的形式如下:
R(θ)=[cos(θ)−sin(θ)sin(θ)cos(θ)] R(\theta) = \begin{bmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{bmatrix} R(θ)=[cos(θ)sin(θ)−sin(θ)cos(θ)]
其中:
- θ\thetaθ 是旋转的角度。
- cos(θ)\cos(\theta)cos(θ) 和 sin(θ)\sin(\theta)sin(θ) 分别是旋转角度的余弦和正弦值。
这个矩阵描述了一个点绕原点逆时针旋转 θ\thetaθ 角度后的新坐标。
旋转的效果
当旋转矩阵作用于一个点 v=[xy]\mathbf{v} = \begin{bmatrix} x \\ y \end{bmatrix}v=[xy] 时,它会将点 v\mathbf{v}v 映射到旋转后的新点 v′=[x′y′]\mathbf{v}' = \begin{bmatrix} x' \\ y' \end{bmatrix}v′=[x′y′],计算公式为:
v′=R(θ)v \mathbf{v}' = R(\theta) \mathbf{v} v′=R(θ)v
其中:
x′=xcos(θ)−ysin(θ) x' = x \cos(\theta) - y \sin(\theta) x′=xcos(θ)−ysin(θ)
y′=xsin(θ)+ycos(θ) y' = x \sin(\theta) + y \cos(\theta) y′=xsin(θ)+ycos(θ)
2. 旋转矩阵的计算方法
旋转矩阵的计算其实基于三角函数的加法公式。我们可以通过几何理解来推导它。
2.1 几何推导
设一个点 v=[xy]\mathbf{v} = \begin{bmatrix} x \\ y \end{bmatrix}v=[xy] 在二维平面上,我们希望将其绕原点旋转角度 θ\thetaθ 后得到新的坐标。
-
原点和极坐标:在旋转前,点 v\mathbf{v}v 的坐标可以通过极坐标表示:
- 半径 r=x2+y2r = \sqrt{x^2 + y^2}r=x2+y2
- 角度 α=arctan(yx)\alpha = \arctan\left(\frac{y}{x}\right)α=arctan(xy)
-
旋转后的坐标:旋转 θ\thetaθ 后,新的坐标变成:
- x′=rcos(α+θ)x' = r \cos(\alpha + \theta)x′=rcos(α+θ)
- y′=rsin(α+θ)y' = r \sin(\alpha + \theta)y′=rsin(α+θ)
-
三角加法公式:利用三角函数的加法公式:
cos(α+θ)=cos(α)cos(θ)−sin(α)sin(θ) \cos(\alpha + \theta) = \cos(\alpha) \cos(\theta) - \sin(\alpha) \sin(\theta) cos(α+θ)=cos(α)cos(θ)−sin(α)sin(θ)
sin(α+θ)=sin(α)cos(θ)+cos(α)sin(θ) \sin(\alpha + \theta) = \sin(\alpha) \cos(\theta) + \cos(\alpha) \sin(\theta) sin(α+θ)=sin(α)cos(θ)+cos(α)sin(θ)
通过这个公式,我们可以展开 x′x'x′ 和 y′y'y′,最终得到:
x′=xcos(θ)−ysin(θ) x' = x \cos(\theta) - y \sin(\theta) x′=xcos(θ)−ysin(θ)
y′=xsin(θ)+ycos(θ) y' = x \sin(\theta) + y \cos(\theta) y′=xsin(θ)+ycos(θ)
这就给出了旋转矩阵的计算公式。
2.2 矩阵形式
这个变换过程可以通过矩阵乘法简洁地表示出来。原始点的坐标 v\mathbf{v}v 和旋转矩阵 R(θ)R(\theta)R(θ) 相乘,得到旋转后的坐标 v′\mathbf{v}'v′:
R(θ)[xy]=[xcos(θ)−ysin(θ)xsin(θ)+ycos(θ)] R(\theta) \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} x \cos(\theta) - y \sin(\theta) \\ x \sin(\theta) + y \cos(\theta) \end{bmatrix} R(θ)[xy]=[xcos(θ)−ysin(θ)xsin(θ)+ycos(θ)]
这就是旋转矩阵的实际计算过程,旋转矩阵通过基于三角函数的公式,构造了一个能描述旋转变换的矩阵。
3. 从基向量的角度理解旋转矩阵
3.1 基向量的定义
在二维坐标系中,通常我们选择两个基向量:
- e1=[10]\mathbf{e}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}e1=[10],表示x轴方向的单位向量。
- e2=[01]\mathbf{e}_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}e2=[01],表示y轴方向的单位向量。
这两个向量构成了我们坐标系的基础,任何二维点 v=[xy]\mathbf{v} = \begin{bmatrix} x \\ y \end{bmatrix}v=[xy] 都可以表示为基向量的线性组合:
v=xe1+ye2 \mathbf{v} = x \mathbf{e}_1 + y \mathbf{e}_2 v=xe1+ye2
3.2 旋转对基向量的作用
旋转矩阵通过旋转基向量 e1\mathbf{e}_1e1 和 e2\mathbf{e}_2e2 来实现整体的旋转变换。
-
旋转矩阵作用于 e1\mathbf{e}_1e1 后,得到新的基向量:
R(θ)e1=[cos(θ)sin(θ)] R(\theta) \mathbf{e}_1 = \begin{bmatrix} \cos(\theta) \\ \sin(\theta) \end{bmatrix} R(θ)e1=[cos(θ)sin(θ)]
这说明,旋转后的 e1′\mathbf{e}_1'e1′ 向量是沿着角度 θ\thetaθ 旋转的方向。
-
同样,旋转矩阵作用于 e2\mathbf{e}_2e2 后,得到新的基向量:
R(θ)e2=[−sin(θ)cos(θ)] R(\theta) \mathbf{e}_2 = \begin{bmatrix} -\sin(\theta) \\ \cos(\theta) \end{bmatrix} R(θ)e2=[−sin(θ)cos(θ)]
这说明,旋转后的 e2′\mathbf{e}_2'e2′ 向量也沿着旋转角度 θ\thetaθ 旋转的方向。
3.3 基向量与坐标点的关系
旋转矩阵通过改变基向量的方向来影响整个坐标系的方向。通过基向量的旋转,我们可以看到旋转矩阵如何改变整个空间中的坐标点。
假设我们有一个点 v=[xy]\mathbf{v} = \begin{bmatrix} x \\ y \end{bmatrix}v=[xy],可以将其表示为:
v=xe1+ye2 \mathbf{v} = x \mathbf{e}_1 + y \mathbf{e}_2 v=xe1+ye2
旋转矩阵作用于点 v\mathbf{v}v 时,实际上是将原始坐标系的基向量 e1\mathbf{e}_1e1 和 e2\mathbf{e}_2e2 旋转了 θ\thetaθ 角度,进而改变了 v\mathbf{v}v 的坐标。通过旋转矩阵的作用,原基向量 e1\mathbf{e}_1e1 和 e2\mathbf{e}_2e2 被映射到旋转后的新位置,进而影响整个空间中所有点的坐标变换。
总结
-
旋转矩阵概述:旋转矩阵用于描述平面上绕原点旋转的变换。它的形式是:
R(θ)=[cos(θ)−sin(θ)sin(θ)cos(θ)] R(\theta) = \begin{bmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{bmatrix} R(θ)=[cos(θ)sin(θ)−sin(θ)cos(θ)]
-
旋转矩阵的计算方法:通过三角函数的加法公式,我们可以得到旋转矩阵的具体计算方法,并利用矩阵乘法将原始点坐标旋转到新的坐标。
-
基向量的角度理解:旋转矩阵通过旋转基向量 e1\mathbf{e}_1e1 和 e2\mathbf{e}_2e2 来影响整个坐标系,从而改变任意点的坐标。