一、平移矩阵
坐标平移 ( d x , d y , d z ) (dx,dy,dz) (dx,dy,dz):
[ 1 0 0 d x 0 1 0 d y 0 0 1 d z 0 0 0 1 ] \begin{bmatrix} 1 & 0 & 0 & d_x\\ 0 & 1 & 0 & d_y\\ 0 & 0 & 1 & d_z\\ 0 & 0 & 0 & 1 \end{bmatrix} ⎣⎢⎢⎡100001000010dxdydz1⎦⎥⎥⎤
例:
[ 1 0 0 d x 0 1 0 d y 0 0 1 d z 0 0 0 1 ] ⋅ [ x y z 1 ] = [ ( 1 ⋅ x ) + ( 0 ⋅ y ) + ( 0 ⋅ z ) + ( d x ⋅ 1 ) ( 0 ⋅ x ) + ( 1 ⋅ y ) + ( 0 ⋅ z ) + ( d y ⋅ 1 ) ( 0 ⋅ x ) + ( 0 ⋅ y ) + ( 1 ⋅ z ) + ( d z ⋅ 1 ) ( 0 ⋅ x ) + ( 0 ⋅ y ) + ( 0 ⋅ z ) + ( 1 ⋅ 1 ) ] = [ x + d x y + d y z + d z 1 ] \begin{bmatrix} 1 & 0 & 0 & d_x\\ 0 & 1 & 0 & d_y\\ 0 & 0 & 1 & d_z\\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \\ \end{bmatrix} = \begin{bmatrix} (1 \cdot x) + (0\cdot y) + (0\cdot z) + ( d_x\cdot 1) \\ (0 \cdot x ) + (1\cdot y) + (0\cdot z ) + (d_y\cdot 1) \\ (0 \cdot x) + (0 \cdot y ) + (1\cdot z ) + (d_z\cdot 1) \\ (0\cdot x) + (0\cdot y) + (0\cdot z) + (1\cdot 1) \end{bmatrix} = \begin{bmatrix} x + d_x\\ y + d_y\\ z +d_z\\ 1 \\ \end{bmatrix} ⎣⎢⎢⎡100001000010dxdydz1⎦⎥⎥⎤⋅⎣⎢⎢⎡xyz1⎦⎥⎥⎤=⎣⎢⎢⎡(1⋅x)+(0⋅y)+(0⋅z)+(dx⋅1)(0⋅x)+(1⋅y)+(0⋅z)+(dy⋅1)(0⋅x)+(0⋅y)+(1⋅z)+(dz⋅1)(0⋅x)+(0⋅y)+(0⋅z)+(1⋅1)⎦⎥⎥⎤=⎣⎢⎢⎡x+dxy+dyz+dz1⎦⎥⎥⎤
二、缩放矩阵
缩放 ( s x , s y , s z ) (s_x,s_y,s_z) (sx,sy,sz) :
[ s x 0 0 0 0 s y 0 0 0 0 s z 0 0 0 0 1 ] \begin{bmatrix} s_x & 0 & 0 & 0 \\ 0 & s_y & 0 & 0 \\ 0& 0 & s_z & 0 \\ 0&0&0&1 \end{bmatrix} ⎣⎢⎢⎡sx0000sy0000sz00001⎦⎥⎥⎤
例:
[ s x 0 0 0 0 s y 0 0 0 0 s z 0 0 0 0 1 ] ⋅ [ x y z 1 ] = [ ( s x ⋅ x ) + ( 0 ⋅ y ) + ( 0 ⋅ z ) + ( 0 ⋅ 1 ) ( 0 ⋅ x ) + ( s y ⋅ y ) + ( 0 ⋅ z ) + ( 0 ⋅ 1 ) ( 0 ⋅ x ) + ( 0 ⋅ y ) + ( s z ⋅ z ) + ( 0 ⋅ 1 ) ( 0 ⋅ x ) + ( 0 ⋅ y ) + ( 0 ⋅ z ) + ( 1 ⋅ 1 ) ] = [ x ⋅ s x y ⋅ s y z ⋅ s z 1 ] \begin{bmatrix} s_x & 0 & 0 & 0 \\ 0 & s_y & 0 & 0 \\ 0& 0 & s_z & 0 \\ 0&0&0&1 \end{bmatrix} \cdot \begin{bmatrix} x\\y\\z\\1 \end{bmatrix} = \begin{bmatrix} (s_x \cdot x )+( 0\cdot y)+ (0\cdot z )+ (0\cdot 1) \\ ( 0 \cdot x )+ (s_y\cdot y )+ (0\cdot z )+ (0\cdot 1 )\\ ( 0 \cdot x)+( 0 \cdot y )+ (s_z\cdot z )+ (0\cdot 1) \\ ( 0 \cdot x)+(0\cdot y)+(0\cdot z)+(1\cdot 1) \end{bmatrix} = \begin{bmatrix} x \cdot s_x\\ y \cdot s_y \\ z \cdot s_z\\ 1 \\ \end{bmatrix} ⎣⎢⎢⎡sx0000sy0000sz00001⎦⎥⎥⎤⋅⎣⎢⎢⎡xyz1⎦⎥⎥⎤=⎣⎢⎢