1. 从四元数到旋转矩阵
推导过程利用以下矩阵(该矩阵的推导过程链接),它能计算绕任意轴的旋转:
R ( n , θ ) = [ ( 1 − c o s θ ) n x 2 + c o s θ ( 1 − c o s θ ) n x n y − n z s i n θ ( 1 − c o s θ ) n x n z + n y s i n θ ( 1 − c o s θ ) n x n y + n z s i n θ ( 1 − c o s θ ) n y 2 + c o s θ ( 1 − c o s θ ) n y n z − n x s i n θ ( 1 − c o s θ ) n x n z − n y s i n θ ( 1 − c o s θ ) n y n z + n x s i n θ ( 1 − c o s θ ) n z 2 + c o s θ ] \textbf{R}(\textbf{n},\theta)=\begin{bmatrix} (1-cos\theta)n_x^2+cos\theta & (1-cos\theta)n_xn_y-n_zsin\theta & (1-cos\theta)n_xn_z+n_ysin\theta\\ (1-cos\theta)n_xn_y+n_zsin\theta & (1-cos\theta)n_y^2+cos\theta & (1-cos\theta)n_yn_z-n_xsin\theta\\ (1-cos\theta)n_xn_z-n_ysin\theta & (1-cos\theta)n_yn_z+n_xsin\theta & (1-cos\theta)n_z^2+cos\theta\\ \end{bmatrix} R(n,θ)=⎣⎡(1−cosθ)nx2+cosθ(1−cosθ)nxny+nzsinθ(1−cosθ)nxnz−nysinθ(1−cosθ)nxny−nzsinθ(1−cosθ)ny2+cosθ(1−cosθ)nynz+nxsinθ(1−cosθ)nxnz+nysinθ(1−cosθ)nynz−nxsinθ(1−cosθ)nz2+cosθ⎦⎤
该矩阵用 n \textbf{n} n 和 θ \theta θ 表示,但其中四元数的分量是:
w = c o s ( θ / 2 ) x = n x s i n ( θ / 2 ) y = n y s i n ( θ / 2 ) z = n z s i n ( θ / 2 ) \begin{aligned} w&=cos(\theta/2)\\ x&=\textbf{n}_xsin(\theta/2)\\ y&=\textbf{n}_ysin(\theta/2)\\ z&=\textbf{n}_zsin(\theta/2)\\ \end{aligned} wxyz=cos(θ/2)=nxsin(θ/2)=nysin(θ/2)=nzsin(θ/2)
将矩阵变形以带入 w , x , y , z w,x,y,z w,x,y,z。首先考虑矩阵对角线上的元素:
m 11 = n x 2 ( 1 − c o s θ ) + c o s θ = n x 2 − n x 2 c o s θ + c o s θ = 1 − 1 + n x 2 − n x 2 c o s θ + c o s θ = 1 − ( 1 − n x 2 + n x 2 c o s θ − c o s θ ) = 1 − ( 1 − c o s θ − n x 2 + n x 2 c o s θ ) = 1 − ( 1 − n x 2 ) ( 1 − c o s θ ) \begin{aligned} m_{11}&= \textbf{n}_x^2(1-cos\theta)+cos\theta\\ &=\textbf{n}_x^2-\textbf{n}_x^2cos\theta+cos\theta\\ &=1-1+\textbf{n}_x^2-\textbf{n}_x^2cos\theta+cos\theta\\ &=1-(1-\textbf{n}_x^2+\textbf{n}_x^2cos\theta-cos\theta)\\ &=1-(1-cos\theta-\textbf{n}_x^2+\textbf{n}_x^2cos\theta)\\ &=1-(1-\textbf{n}_x^2)(1-cos\theta)\\ \end{aligned} m11=nx2(1−cosθ)+cosθ=nx2−nx2cosθ+cosθ=1−1
1530



被折叠的 条评论
为什么被折叠?



