Exercises
- Write down the \(4 \times 4\) 3D matrix to move by (\(x_m,y_m,z_m\)).
\[\begin{bmatrix}1&&0&&0&&x_m\\ 0&&1&&0&&y_m\\0&&0&&1&&z_m\\ 0&&0&&0&&1\end{bmatrix}\]
- Write down the \(4 \times 4\) 3D matrix to rotate by an angle \(\theta\) about the \(y\)-axis.
\[\begin{bmatrix}cos\theta&&0&&sin\theta&&0\\ 0&&1&&0&&0\\-sin\theta&&0&&cos\theta&&0\\ 0&&0&&0&&1\end{bmatrix}\]
- Write down the \(4 \times 4\) 3D matrix to scale an object by 50% in all directions.
\[\begin{bmatrix}0.5&&0&&0&&0\\ 0&&0.5&&0&&0\\0&&0&&0.5&&0\\ 0&&0&&0&&1\end{bmatrix}\]
- Write the 2D rotation matrix that rotates by 90 degrees clockwise.
顺时针90度为逆时针270度
\[\begin{bmatrix}0&&1&&0\\-1&&0&&0\\0&&0&&1\end{bmatrix} \]
- Write the matrix from Exercise 4 as a product of three shear matrices.
根据
\[\begin{bmatrix}cos\phi&&-sin\phi \\ sin\phi&&cos\phi\end{bmatrix} = \begin{bmatrix}1&&\frac{cos\phi-1}{sin\phi} \\ 0&&1\end{bmatrix} \begin{bmatrix} 1&&0 \\ sin\phi&&1 \end{bmatrix} \begin{bmatrix} 1&&\frac{cos\phi-1}{sin\phi} \\ 0&&1 \end{bmatrix}\]
\[\begin{bmatrix}0&&1&&0\\-1&&0&&0\\0&&0&&1\end{bmatrix}= \begin{bmatrix}1&&1&&0\\0&&1&&0\\0&&0&&1\end{bmatrix} \begin{bmatrix}1&&0&&0\\-1&&1&&0\\0&&0&&1\end{bmatrix} \begin{bmatrix}1&&1&&0\\0&&1&&0\\0&&0&&1\end{bmatrix}\]
- Find the inverse of the rigid body transformation:
\[A = \begin{bmatrix} R&&t\\0\: 0\: 0 && 1\end{bmatrix} \]
where \(\mathbf{R}\) is a \(3 \times 3\) rotation matrix and \(\mathbf{t}\) is a 3-vector
首先行列式不等于0,所以逆矩阵肯定存在,设其为\(B =\begin{bmatrix} X&&Y\\Z && W\end{bmatrix}\),根据\(AB=E\)有
\[\left\{\begin{matrix}RX+tZ=E\\RY+tW=0\\Z=0\\W=E\end{matrix}\right. \rightarrow \left\{\begin{matrix}Y=-R^{-1}t\\X=R^{-1}\end{matrix}\right. \]
\(\therefore B = \begin{bmatrix}R^{-1} &&-R^{-1}t\\0\:0\:0&&1\end{bmatrix}\)
- Show that the inverse of the matix for an affine transformation(one that has all zeros in the bottom row except for a one in the lower right entry) also has the same form.
证明同6. 若仿射矩阵最后一项的代数余子式不为零则逆矩阵存在且仍然为仿射矩阵
- Describe in words what this 2D transform matrix does:
\[\begin{bmatrix} 0&&-1&&1\\1&&0&&1\\0&&0&&1\end{bmatrix} \]
绕原点旋转\(\frac{1}{2}\pi\),再平移\(\begin{bmatrix}1,1 \end{bmatrix}^T\)
- Write down the \(3 \times 3\) matrix that rotates a 2D point by angle \(\theta\) about a point p \(= (x_p,y_p)\).
先把点平移到p上,旋转,再平移回来
\[\begin{bmatrix}1&&0&&-x_p\\0&&1&&-y_p\\0&&0&&1\end{bmatrix} \begin{bmatrix}cos\theta&&-sin\theta&&0\\sin\theta&&cos\theta&&0\\0&&0&&1\end{bmatrix} \begin{bmatrix}1&&0&&x_p\\0&&1&&y_p\\0&&0&&1\end{bmatrix}\]
\[= \begin{bmatrix}cos\theta&&-sin\theta&&x_p(cos\theta-1)-y_p sin\theta\\sin\theta&&cos\theta&&x_p sin\theta +y_p(cos\theta-1)\\0&&0&&1\end{bmatrix}\]
- Write down the \(4 \times 4\) rotation matrix that that takes the orthonormal 3D vectors \(u = (x_u,y_u,z_u)\), \(v = (x_v,y_v,z_v),\) and \(w = (x_w,y_w,z_w),\) to orthonormal 3D vectors \(a = (x_a, y_a, z_a), b = (x_b,y_b,z_b),\) and \(c = (x_c,y_c,z_c),\) So \(Mu = a, Mv = b,\) and \(Mw = c\).
根据欧拉角来转换
\[cos(roll) = dot(u,a) ,cos(pitch) = dot(v,b), cos(yaw) = dot(w,c) \]
对x轴旋转\(roll\),对y轴旋转\(pitch\),对z轴旋转\(yaw\)
- What is the inverse matrix for the answer to the previous problem?
将\(roll,pitch,yaw\)都变为\(2\pi-\theta\)