旋转矩阵(英語:Rotation matrix)是在乘以一个向量的时候有改变向量的方向但不改变大小的效果并保持了手性的矩阵。旋转矩阵不包括点反演,点反演可以改变手性,也就是把右手坐标系改变成左手坐标系或反之。所有旋转加上反演形成了正交矩阵的集合。旋转可分为主动旋转与被动旋转。主动旋转是指将向量逆时针围绕旋转轴所做出的旋转。被动旋转是对坐标轴本身进行的逆时针旋转,它相当于主动旋转的逆操作。
设
是任何维的一般旋转矩阵:
- 两个向量的点积(內積)在它们都被一个旋转矩阵操作之后保持不变:
![{\displaystyle \mathbf {a} ^{\top }\cdot \mathbf {b} =\mathbf {(Ma)} ^{\top }\cdot \mathbf {M} \mathbf {b} }](https://wikimedia.org/api/rest_v1/media/math/render/svg/ae8ee148339dfea4de5a4724b1e71938d9e99ea4)
这里的
是单位矩阵。
- 一个矩阵是旋转矩阵,当且仅当它是正交矩阵并且它的行列式是1。正交矩阵的行列式是 ±1;如果行列式是 −1,则它包含了一个反射而不是真旋转矩阵。
- 旋转矩阵是正交矩阵,如果它的列向量形成
的一个正交基,就是说在任何两个列向量之间的标量积是零(正交性)而每个列向量的大小是单位一(单位向量)。
![{\displaystyle \mathbf {M} =\exp(\mathbf {A} )=\sum _{k=0}^{\infty }{\frac {\mathbf {A} ^{k}}{k!}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/af2c2ef52386d839e15117e188ffcc34ca49c186)
- 这里的指数是以泰勒级数定义的而
是以矩阵乘法定义的。矩阵A叫做旋转的“生成元”。旋转矩阵的李代数是它的生成元的代数,它就是斜对称矩阵的代数。生成元可以通过 M 的矩阵对数来找到。
在二维空间中,旋转可以用一个单一的角
定义。作为约定,正角表示逆时针旋转。把笛卡尔坐标的列向量关于原点逆时针旋转
的矩阵是:
![{\displaystyle M(\theta )={\begin{bmatrix}\cos {\theta }&-\sin {\theta }\\\sin {\theta }&\cos {\theta }\end{bmatrix}}=\cos {\theta }{\begin{bmatrix}1&0\\0&1\end{bmatrix}}+\sin {\theta }{\begin{bmatrix}0&-1\\1&0\end{bmatrix}}=\exp \left(\theta {\begin{bmatrix}0&-1\\1&0\end{bmatrix}}\right)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/60b587aaa73b23111bd835223f32a4b71a1b3f8b)
在三维空间中,旋转矩阵有一个等于单位1的实特征值。旋转矩阵指定关于对应的特征向量的旋转(欧拉旋转定理)。如果旋转角是 θ,则旋转矩阵的另外两个(复数)特征值是 exp(iθ) 和 exp(-iθ)。从而得出 3 维旋转的迹数等于 1 + 2 cos(θ),这可用来快速的计算任何 3 维旋转的旋转角。
3 维旋转矩阵的生成元是三维斜对称矩阵。因为只需要三个实数来指定 3 维斜对称矩阵,得出只用三个实数就可以指定一个 3 维旋转矩阵。
生成旋转矩阵的一种简单方式是把它作为三个基本旋转的序列复合。关于右手笛卡尔坐标系的 x-, y- 和 z-轴的旋转分别叫做 roll, pitch 和 yaw 旋转。因为这些旋转被表达为关于一个轴的旋转,它们的生成元很容易表达。
这里的
是 roll 角,和右手螺旋的方向相反(在yz平面顺时针)。
这里的
是 pitch 角,和右手螺旋的方向相反(在zx平面顺时针)。
这里的
是 yaw 角,和右手螺旋的方向相反(在xy平面顺时针)。
在飞行动力学中,roll, pitch 和 yaw 角通常分别采用符号
,
, 和
;但是为了避免混淆于欧拉角这里使用符号
,
和
。
任何 3 维旋转矩阵
都可以用这三个角
,
, 和
来刻画,并且可以表示为 roll, pitch 和 yaw 矩阵的乘积。
是在
中的旋转矩阵 ![{\displaystyle \Leftrightarrow \,\exists \,\theta _{x},\theta _{y},\theta _{z}\in [0\ldots \pi ):\,{\mathcal {M}}={\mathcal {R}}_{z}(\theta _{z})\,{\mathcal {R}}_{y}(\theta _{y})\,{\mathcal {R}}_{x}(\theta _{x})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/038bf15824cf6abb4c4ea91b082c0ffadbfbf175)
在
中所有旋转的集合,加上复合运算形成了旋转群 SO(3)。这里讨论的矩阵接着提供了这个群的群表示。更高维的情况可参见 Givens旋转。
在三维中,旋转可以通过单一的旋转角
和所围绕的单位向量方向
来定义。
![{\displaystyle {\mathcal {M}}({\hat {\mathbf {v} }},\theta )={\begin{bmatrix}\cos \theta +(1-\cos \theta )x^{2}&(1-\cos \theta )xy-(\sin \theta )z&(1-\cos \theta )xz+(\sin \theta )y\\(1-\cos \theta )yx+(\sin \theta )z&\cos \theta +(1-\cos \theta )y^{2}&(1-\cos \theta )yz-(\sin \theta )x\\(1-\cos \theta )zx-(\sin \theta )y&(1-\cos \theta )zy+(\sin \theta )x&\cos \theta +(1-\cos \theta )z^{2}\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/82ae91c80b3a29d990f46fb016519e510517aa3e)
这个旋转可以简单的以生成元来表达:
![{\displaystyle {\mathcal {M}}({\hat {\mathbf {v} }},\theta )=\exp \left(\theta {\begin{bmatrix}0&-z&y\\z&0&-x\\-y&x&0\\\end{bmatrix}}\right)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c9f6bd325bc7cec775cacff74215e11c2542061f)
在运算于向量 r 上的时候,这等价于Rodrigues旋转公式:
![{\displaystyle {\mathcal {M}}\cdot \mathbf {r} =\mathbf {r} \,\cos(\theta )+{\hat {\mathbf {v} }}\times \mathbf {r} \,\sin(\theta )+({\hat {\mathbf {v} }}\cdot \mathbf {r} ){\hat {\mathbf {v} }}(1-\cos(\theta ))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/339fb1dea0c0b807b28a8d2e203c63d9056b5412)
角-轴表示密切关联于四元数表示。依据轴和角,四元数可以给出为正规化四元数 Q:
![{\displaystyle Q=(xi+yj+zk)\sin(\theta /2)+\cos(\theta /2)\,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/39fe2a13bb3dd5cc134da2bbafb769ae80d89aa1)
这里的 i, j 和 k 是 Q 的三个虚部。
在三维空间中,旋转可以通过三个欧拉角
来定义。有一些可能的欧拉角定义,每个都可以依据 roll, pitch 和 yaw 的复合来表达。依据 "x-y-z" 欧拉角,在右手笛卡尔坐标中的旋转矩阵可表达为:
![{\displaystyle {\mathcal {M}}(\alpha ,\beta ,\gamma )={\mathcal {R}}_{z}(\gamma ){\mathcal {R}}_{y}(\beta ){\mathcal {R}}_{x}(\alpha )}](https://wikimedia.org/api/rest_v1/media/math/render/svg/7e18df6025a1721a9177048403249360ab088665)
进行乘法运算生成:
![{\displaystyle {\begin{aligned}{\mathcal {M}}(\alpha ,\beta ,\gamma )&={\begin{bmatrix}\cos \gamma &-\sin \gamma &0\\\sin \gamma &\cos \gamma &0\\0&0&1\end{bmatrix}}{\begin{bmatrix}\cos \beta &0&\sin \beta \\0&1&0\\-\sin \beta &0&\cos \beta \end{bmatrix}}{\begin{bmatrix}1&0&0\\0&\cos \alpha &-\sin \alpha \\0&\sin \alpha &\cos \alpha \end{bmatrix}}\\&={\begin{bmatrix}\cos \gamma \cos \beta &-\sin \gamma &\cos \gamma \sin \beta \\\sin \gamma \cos \beta &\cos \gamma &\sin \gamma \sin \beta \\-\sin \beta &0&\cos \beta \end{bmatrix}}{\begin{bmatrix}1&0&0\\0&\cos \alpha &-\sin \alpha \\0&\sin \alpha &\cos \alpha \end{bmatrix}}\\&={\begin{bmatrix}\cos \gamma \cos \beta &-\sin \gamma \cos \alpha +\cos \gamma \sin \beta \sin \alpha &\sin \gamma \sin \alpha +\cos \gamma \sin \beta \cos \alpha \\\sin \gamma \cos \beta &\cos \gamma \cos \alpha +\sin \gamma \sin \beta \sin \alpha &-\cos \gamma \sin \alpha +\sin \gamma \sin \beta \cos \alpha \\-\sin \beta &\cos \beta \sin \alpha &\cos \beta \cos \alpha \end{bmatrix}}\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9b06bc8fb70bb25db1fb9f09ae74d23b6066cd5a)
对旋转轴
和旋转角
,旋转矩阵
![{\displaystyle {\mathcal {M}}=qq^{T}+QGQ^{T}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1266c59627a57d05c1b03f970a678f46370224a1)
这里的
的纵列张开正交于
的空间而
是
度 Givens 旋转,就是说
![{\displaystyle G={\begin{bmatrix}\cos \theta &\sin \theta \\-\sin \theta &\cos \theta \end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a530167c90fcf11c7c6da3b3c43cd105a224ce7f)