# 四元数与空间旋转

## 基本方法

### 单位四元数表示一个三维空间旋转

q 为一个单位四元数，而 p 是一个纯四元数，定义

${\displaystyle R_{q}(p)=qpq^{-1}}$

Rq(p) 也是一个纯四元数，可以证明 Rq 确实表示一个旋转，这个旋转将空间的点 p 旋转为空间的另一个点 Rq(p)[1]

## 与正交矩阵表示的关系

${\displaystyle e^{{\frac {\theta }{2}}(xi+yj+zk)}=\cos {\frac {\theta }{2}}+(xi+yj+zk)\sin {\frac {\theta }{2}},\quad {\text{for }}x,y,z\in \mathbb {R} {\text{ s.t. }}x^{2}+y^{2}+z^{2}=1}$

${\displaystyle q=e^{{\frac {\theta }{2}}(u_{x}i+u_{y}j+u_{z}k)}=\cos {\frac {\theta }{2}}+(u_{x}i+u_{y}j+u_{z}k)\sin {\frac {\theta }{2}}}$
${\displaystyle p=xi+yj+zk}$
${\displaystyle p'=q^{-1}pq=w+x'i+y'j+z'k}$

（通过下面的计算可以知道，w=0，即计算结果是纯四元数）

${\displaystyle q^{-1}=e^{-{\frac {\theta }{2}}(u_{x}i+u_{y}j+u_{z}k)}=\cos {\frac {\theta }{2}}-(u_{x}i+u_{y}j+u_{z}k)\sin {\frac {\theta }{2}}}$

${\displaystyle c=\cos {\frac {\theta }{2}},s=\sin {\frac {\theta }{2}}}$

${\displaystyle {\begin{array}{rcl}q^{-1}pq&=&[c-(u_{x}i+u_{y}j+u_{z}k)s](xi+yj+zk)[c+(u_{x}i+u_{y}j+u_{z}k)s]\\&=&[c-(u_{x}i+u_{y}j+u_{z}k)s]\{-(u_{x}x+u_{y}y+u_{z}z)s+i[xc+(u_{z}y-u_{y}z)s]+j[yc+(u_{x}z-u_{z}x)s]+k[zc+(u_{y}x-u_{x}y)s]\}\\&=&i\{xc^{2}+2(u_{z}y-u_{y}z)sc+[u_{x}(u_{x}x+u_{y}y+u_{z}z)-u_{y}(u_{y}x-u_{x}y)+u_{z}(u_{x}z-u_{z}x)]s^{2}\}+\ldots \end{array}}}$

${\displaystyle {\begin{bmatrix}x'\\y'\\z'\end{bmatrix}}=M(q){\begin{bmatrix}x\\y\\z\end{bmatrix}}={\begin{bmatrix}c^{2}-(1-2u_{x}^{2})s^{2}&2u_{x}u_{y}s^{2}+2u_{z}sc&2u_{x}u_{z}s^{2}-2u_{y}sc\\2u_{x}u_{y}s^{2}-2u_{z}sc&c^{2}-(1-2u_{y}^{2})s^{2}&2u_{y}u_{z}s^{2}+2u_{x}sc\\2u_{x}u_{z}s^{2}+2u_{y}sc&2u_{y}u_{z}s^{2}-2u_{x}sc&c^{2}-(1-2u_{z}^{2})s^{2}\\\end{bmatrix}}{\begin{bmatrix}x\\y\\z\end{bmatrix}}}$

${\displaystyle C=\cos \theta ,S=\sin \theta }$

${\displaystyle M(q)={\begin{bmatrix}C+u_{x}^{2}(1-C)&u_{x}u_{y}(1-C)+u_{z}S&u_{x}u_{z}(1-C)-u_{y}S\\u_{x}u_{y}(1-C)-u_{z}S&C+u_{y}^{2}(1-C)&u_{y}u_{z}(1-C)+u_{x}S\\u_{x}u_{z}(1-C)+u_{y}S&u_{y}u_{z}(1-C)-u_{x}S&C+u_{z}^{2}(1-C)\\\end{bmatrix}}}$

## 旋转轴与旋转角

${\displaystyle R_{e^{i\lambda r}}(kr)=e^{-i\lambda r}kre^{i\lambda r}=kr,\ \forall \lambda ,k\in \mathbb {R} }$

## 旋转操作的复合

${\displaystyle R_{q_{1}q_{2}}(p)=(q_{1}q_{2})p(q_{1}q_{2})^{-1}=q_{1}q_{2}pq_{2}^{-1}q_{1}^{-1}=R_{q_{1}}[R_{q_{2}}(p)]}$

## 参考

1. Treisman, Zachary. A young person's guide to the Hopf fibration. .
• Simon L. Altman (1986) Rotations, Quaternions, and Double Groups, Dover Publications.
• Du Val, Patrick (1964), "Homographies, quaternions, and rotations". Oxford, Clarendon Press (Oxford mathematical monographs). LCCN 64056979