坐标变换矩阵
x=0;
y=r*cosθ;
z=r*sinθ;
当将坐标轴以X轴为中心旋转α角后,得到新的坐标系X'Y'Z'。如图二所示:
x' =0;
y' =r*cos(θ-α)
=r*(cosθ*cosα+sinθ*sinα)
=(r*cosθ)*cosα+(r*sinθ)*sinα
=y*cosα+z*sinα
z' =r*sin(θ-α)
=r*(sinθ*cosα-cosθ*sinα)
=(r*sinθ)*cosα-(r*cosθ)*sinα
=-y*sinα+z*cosα
综上:以矩阵的形式表示上面的变换即为:
[
x
′
y
′
z
′
]
=
[
1
0
0
0
c
o
s
α
s
i
n
α
0
−
s
i
n
α
c
o
s
α
]
[
x
y
z
]
\begin{gathered} \begin{bmatrix} x' \\ y' \\ z' \end{bmatrix}= \begin{bmatrix} 1 & 0&0 \\0 & cosα&sinα \\0 & -sinα&cosα\end{bmatrix} \begin{bmatrix} x \\ y\\ z\end{bmatrix} \end{gathered}
⎣⎡x′y′z′⎦⎤=⎣⎡1000cosα−sinα0sinαcosα⎦⎤⎣⎡xyz⎦⎤
即绕X轴旋转坐标轴α角后,变换矩阵为:
[
1
0
0
0
c
o
s
α
s
i
n
α
0
−
s
i
n
α
c
o
s
α
]
\begin{gathered} \begin{bmatrix} 1 & 0&0 \\0 & cosα&sinα \\0 & -sinα&cosα\end{bmatrix} \end{gathered}
⎣⎡1000cosα−sinα0sinαcosα⎦⎤
对于绕其他轴旋转后的变换矩阵同理:
沿Z轴旋转β后的变换矩阵为:
[ c o s β s i n β 0 − s i n β c o s β 0 0 0 1 ] \begin{gathered} \begin{bmatrix} cosβ&sinβ&0 \\-sinβ&cosβ&0 \\0 & 0&1\end{bmatrix} \end{gathered} ⎣⎡cosβ−sinβ0sinβcosβ0001⎦⎤
沿Y轴旋转φ后的变换矩阵为:
[ c o s φ 0 − s i n φ 0 1 0 s i n φ 0 c o s φ ] \begin{gathered} \begin{bmatrix} cosφ&0&-sinφ \\0 &1& 0\\sinφ&0&cosφ \end{bmatrix} \end{gathered} ⎣⎡cosφ0sinφ010−sinφ0cosφ⎦⎤