旋转矩阵证明

余弦定理公式

cos(α-β) = cosαcosβ+sinαsinβ
cos(α+β) = cosαcosβ-sinαsinβ
sin(α-β) = sinαcosβ-cosαsinβ
cos(α+β) = sinαcosβ+cosαsinβ

Z轴旋转矩阵证明

因为绕z轴的旋转并不会改变点的z坐标的变化,所以可以把所有绕z轴旋转的点直接放到x-y平面旋转。
假设x-y平面一点p(x,y)绕z轴旋转到p*(x*,y*),如下图所示:
P点与x轴夹角为α度,逆时针旋转β度到P*
在这里插入图片描述
设原点O到点P的距离为r
因为是绕Z轴旋转并不会改变点到原点的距离
所以:OP=OP*=r
根据三角形定则可得:
x=rcosα,y=rsinα
x*=rcos(α+β), y*=rsin(α+β)
又由余弦定理可得:
x*=rcosαcosβ-rsinαsinβ
y*=rsinαcosβ+rcosαsinβ
将x,y代入可得:
x*=xcosβ-ysinβ
y*=xsinβ+ycosβ
转换为矩阵可得:
行向量:
[ x ∗ , y ∗ , 0 ] = [ x , y , 0 ] ⋅ [ c o s β s i n β 0 − s i n β c o s β 0 0 0 1 ] [x^*, y^*, 0] = [x, y, 0]·\begin{bmatrix} cosβ & sinβ & 0 \\ -sinβ & cosβ & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} [x,y,0]=[x,y,0]cosβsinβ0sinβcosβ0001
列向量:
[ x ∗ y ∗ 0 ] = [ c o s β s i n β 0 − s i n β c o s β 0 0 0 1 ] ⋅ [ x y 0 ] \begin{bmatrix} x^*\\ y^*\\ 0\\ \end{bmatrix} = \begin{bmatrix} cosβ & sinβ & 0 \\ -sinβ & cosβ & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}·\begin{bmatrix} x\\ y\\ 0\\ \end{bmatrix} xy0=cosβsinβ0sinβcosβ0001xy0

X轴旋转矩阵证明

通过上面绕Z轴的证明,我们证明一下X轴的旋转矩阵
假设有一点P(X,Y,Z,1)绕X轴旋转β度到点P*(X*,Y*,Z*,1)
第一步将P点平移到Y-Z平面
P y − z = ( x , y , z , 1 ) ⋅ [ 1 0 0 0 0 1 0 0 0 0 1 0 − X 0 0 1 ] P_y-z=(x,y,z,1)·\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ -X & 0 & 0 & 1\\ \end{bmatrix} Pyz=(x,y,z,1)100X010000100001
由Z轴旋转证明过程同理可得:
Y ∗ = Z s i n β + Y c o s β Y^*=Zsinβ+Ycosβ Y=Zsinβ+Ycosβ
Z ∗ = Z c o s β − Y s i n β Z^*=Zcosβ-Ysinβ Z=ZcosβYsinβ
转换为矩阵如下:
[ 0 , Y ∗ , Z ∗ , 1 ] = [ 0 , Y , Z , 1 ] ⋅ [ 1 0 0 0 0 c o s β s i n β 0 0 − s i n β c o s β 0 0 0 0 1 ] [0,Y^*,Z^*,1]=[0,Y,Z,1]·\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & cosβ & sinβ & 0\\ 0 & -sinβ & cosβ & 0\\ 0 & 0 & 0 & 1\\ \end{bmatrix} [0,Y,Z,1]=[0,Y,Z,1]10000cosβsinβ00sinβcosβ00001
还原X坐标:
[ X ∗ , Y ∗ , Z ∗ , 1 ] = [ 0 , Y ∗ , Z ∗ , 1 ] ⋅ [ 1 0 0 0 0 1 0 0 0 0 1 0 X 0 0 1 ] [X^*,Y^*,Z^*,1]=[0,Y^*,Z^*,1]· \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ X & 0 & 0 & 1\\ \end{bmatrix} [X,Y,Z,1]=[0,Y,Z,1]100X010000100001
所以:
[ X ∗ , Y ∗ , Z ∗ , 1 ] = [ X , Y , Z , 1 ] ⋅ [ 1 0 0 0 0 1 0 0 0 0 1 0 − X 0 0 1 ] ⋅ [ 1 0 0 0 0 c o s β s i n β 0 0 − s i n β c o s β 0 0 0 0 1 ] ⋅ [ 1 0 0 0 0 1 0 0 0 0 1 0 X 0 0 1 ] [X^*,Y^*,Z^*,1]=[X, Y, Z,1]· \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ -X & 0 & 0 & 1\\ \end{bmatrix}· \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & cosβ & sinβ & 0\\ 0 & -sinβ & cosβ & 0\\ 0 & 0 & 0 & 1\\ \end{bmatrix}· \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ X & 0 & 0 & 1\\ \end{bmatrix} [X,Y,Z,1]=[X,Y,Z,1]100X01000010000110000cosβsinβ00sinβcosβ00001100X010000100001
[ X ∗ , Y ∗ , Z ∗ , 1 ] = [ X , Y , Z , 1 ] ⋅ [ 1 0 0 0 0 c o s β s i n β 0 0 − s i n β c o s β 0 0 0 0 1 ] [X^*,Y^*,Z^*,1]= [X, Y, Z,1]·\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & cosβ & sinβ & 0\\ 0 & -sinβ & cosβ & 0\\ 0 & 0 & 0 & 1\\ \end{bmatrix} [X,Y,Z,1]=[X,Y,Z,1]10000cosβsinβ00sinβcosβ00001

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值