Fundamental of Computer Graphics (third edition) Chapter 5 Exercises

Exercises

  1. Write an implicit equation for the 2D line through points(\(x_0,y_0\)) and (\(x_1,y_1\)) using a 2D determinant.

有一点\(P(x,y)\),在\(P_0,P_1\)构成的直线上,则三点构成的平行四边形面积一定为0.即\(P_1P_0 \times PP_0 = 0\),写成行列式为

\[\begin{vmatrix} x-x_0 & x_1-x_0 \\ y-y_0 & y_1-y_0 \end{vmatrix} = 0\]

  1. Show that if the columns of a matrix are orthonormal, then so are the rows.

根据正交矩阵的性质\(R^TR = I = RR^T\)

如果一个矩阵是正交的,那么他的转置矩阵也是正交的

  1. Prove the properties of matrix determinants state in Equations (5.5)-(5.7).

(5.5): \(|\mathbf{AB}| = |\mathbf{A}||\mathbf{B}|\)

根据\(\begin{vmatrix}A && O \\ C && B\end{vmatrix} = |\mathbf{A}||\mathbf{B}|,\begin{vmatrix}C && A \\ B && O\end{vmatrix} = (-1)^{n^2}|\mathbf{A}||\mathbf{B}|\)

构造矩阵
\(\begin{pmatrix}A && O\\ -E && B \end{pmatrix}\begin{pmatrix}E && B\\ O && E \end{pmatrix} = \begin{pmatrix}A && AB\\ -E && O \end{pmatrix}\)

对右边取行列式

\[(-1)^{n^2}|-E||AB|=(-1)^{n^2+n}|AB| = |AB| \]

左边两个矩阵的行列式乘积为\(|A||B|\),于是(5.5)得证

(5.6) \(|A^{-1}| = \frac{1}{|A|}\)

\(AA^{-1} = E\) 根据(5.5) \(|A||A^{-1}|=1\)
\because $A^{-1}存在,|A|\ne 0 \therefore |A^{-1}| = \frac{1}{|A|} (5.6)得证 $

(5.7) \(|A^T| = |A|\)

考虑一下数学归纳,对于\(n=1\),显然成立
对于\(n=k\)时,对\(A\)\(i\)行进行展开
\(|A| = \sum_{j=1}^{k} a_{ij}A_{ij}\)
\(A^T\)\(i\)列进行展开
\(|A^T| = \sum_{j=1}^{k} b_{ji}A^T_{ji}\)

其中\(a_{ij} = b_{ji}, A^T_{ji} = (A_{ij})^T, A_{ij}\)是n=k-1的情况,我们假设他成立,则n=k也成立

  1. Show that the eigenvalues of a diagonal matrix are its diagonal elements.

\(0 = |A-\lambda E|\) 解得 \(\lambda\)
对于对角阵,显然多项式的零点就是A对角线上的元素

  1. Show that for a square matrix \(A\), \(AA^T\) is a symmetric matrix.

\(AA^T=B, [a_i]\)\(A\)的行向量组,则也是\(A^T\)的列向量组
\(\because B_{ij} = a_i\cdot a_j = B_{ji}\)
\(\therefore B = B^T\)

  1. Show that for three 3D vector \(a,b,c\), the following identity holds: \(|abc| = (a \times b) \cdot c\).

\(M = |abc| = \begin{vmatrix}a_x&&b_x&& c_x\\a_y&&b_y&&c_y\\a_z&&b_z&&c_z\end{vmatrix} = c_x*M_{13} + c_y*M_{23} + c_z * M_{33} = M_{i3} \cdot c\)

\(\because M_{13} = \begin{vmatrix}a_y && b_y\\a_z && b_z\end{vmatrix}, M_{23} = -\begin{vmatrix}a_x && b_x\\a_y && b_y\end{vmatrix}, M_{33} = \begin{vmatrix}a_x && b_x\\a_z && b_z\end{vmatrix}\)
\(\therefore M_{i3} = (a \times b), |abc| = (a \times b) \cdot c\)

  1. Explain why the volume of the tetrahedron with side vectors \(a,b,c\)(see Figure 5.2) is given by \(|abc|/6\).

四面体的体积\(V = \frac{1}{3}S*h\)

我们让\(b,c\)构成的平面做底面 \(S = \frac{1}{2}b \times c\)
\(a\)与底面单位法向量\(n\)的夹角为\(\theta\)\(h = a*cos\theta = a \cdot n\)
于是 \(V = \frac{1}{6} a \cdot (b \times c) = \frac{1}{6}|abc|\)

  1. Demonstrate the four interpretations of matrix-matrix multiplication by taking the following matrix-matrix multiplication code, rearranging the nested loops, and interpreting the resulting code in terms of matrix and vector operations
function mat-mult(in a[m][p], in b[p][n], out c[m][n]){
    // the array c is initialized to zero
    for i = 1 to m
        for j = 1 to n
            for k = 1 to p
                c[i][j] += a[i][k] * b[k][j]
}

三重循环是相互无关的,调节循环的位置可以得到对矩阵乘法不同的解释

  • \(c_{ij} = \vec{a_i} \cdot \vec{b_j}\)
  • $c^{col}_{j} = A \cdot \vec{b_j} $
  • \(c^{row}_{i} = \vec{a_i} \cdot B\)
  • \(C = A \cdot B\)
  1. Prove that if A,Q, and D satisfy Equation(5.14), v is the \(i\)th row of Q, and \(\lambda\) is the \(i\)th entry on the diagonal of D, then v is an eigenvector of A with eigenvalue \(\lambda\).

感性理解一下 \(\mathbf{A} = \mathbf{QDQ}^T \rightarrow \mathbf{A}v = \mathbf{QDQ}^Tv\)
\(\mathbf{Q}\)是正交矩阵\(Q^Tv\)只有在第\(i\)行为1其他全为0,再右乘对角阵,得到\(D'_{i} = \lambda\) 其余全为0 的向量
所以 \(\mathbf{A}v = \mathbf{QDQ}^Tv = QD'\),\(QD'\)就相当于在\(Q\)\(i\)列的向量乘上\(\lambda\)\(\lambda v\)

  1. Prove that if A,Q, and D satisfy Equation(5.14), the eigenvalues of A are all distince, and v is an eigenvector of A with eigenvalue \(\lambda\), then for some \(i\), v is the row of Q and \(\lambda\) is the \(i\)th entry on the diagonal of D

\(\lambda_1,\lambda_2\)\(A\)的不同特征值,\(a_1,a_2\)是他们对应的特征向量
则有$Aa_1 = \lambda_1a_1,Aa_2 = \lambda_2a_2 \( 对第一个式子左乘\)aT_2$得$a_2TAa_1 = \lambda_1a_2^Ta_1$
继续化简 \(a_2^TAa_1 = (A^Ta_2)^Ta_1=(Aa_2)^Ta_1=(\lambda_2a_2)^Ta_1=\lambda_2a^T_2a_1\)
于是 \(\lambda_2a^T_2a_1 = \lambda_1a_2^Ta_1 \rightarrow (\lambda_1 - \lambda_2)a^T_2a_1 = 0\)
\(\lambda_1 \ne \lambda_2 \therefore a_2 a_1\) 正交

  1. Given the (\(x,y\)) corordinates of the three vertices of a 2D triangle, explain why the area is given by

\[\frac{1}{2}\begin{vmatrix}x_0 && x_1 && x_2 \\ y_0 && y_1 && y_2 \\ 1 && 1 && 1\end{vmatrix} \]

对原式进行化简,\(c_1-c_3,c_2-c_3\)

\[\frac{1}{2}\begin{vmatrix}x_0-x_2 && x_1-x_2 && x_2 \\ y_0-y_2 && y_1-y_2 && y_2 \\ 0 && 0 && 1\end{vmatrix} \]

\(r3\)展开

\[\frac{1}{2}\begin{vmatrix}x_0-x_2 && x_1-x_2 \\ y_0-y_2 && y_1-y_2 \end{vmatrix} \]

即为\(x_0x_2,x_1x_2\)两个向量点乘乘二分之一的形式,即为组成的三角形的面积

posted @ 2020-04-17 17:55  新新人類  阅读(254)  评论(0编辑  收藏  举报