Solutions Geometrical Transformations CS1BA1 Exercise on Rotation: 1. Compute the determinant of a rotation matrix. Solution: " det cos θ − sin θ sin θ cos θ #! = cos2 θ + sin2 θ = 1 2. Compute the eigenvalues of a rotation matrix. For which value of θ do we have eigenvalues? Solution: the characteristic equation is " det cos θ − sin θ sin θ cos θ " # −λ 1 0 0 1 #! = λ2 − 2λ cos θ + 1 = 0 The characteristic equation has roots if ∆ = (2 cos θ)2 − 4 ≥ 0. This is equivalent to writting cos2 θ ≥ 1 (or cos2 θ = 1 since | cos θ| ≤ 1). The only possibility for the characteristic equation to have roots is that: ( cos θ = 1 or θ = 0 cos θ = −1 or θ = π So we have roots for the characteristic equation only in two cases: when θ = 0 and θ = π. (a) Case θ = 0. In this case the rotation matrix becomes: " cos θ − sin θ sin θ cos θ # " = 1 0 0 1 # The rotation matrix is simply the identity matrix I and the eigenvalue is λ = 1 (this is a repeated eigenvalue). The eigenvectors are any vector in the plane since ∀x ∈ R2 , Ix = x. (b) Case θ = π. In this case the rotation matrix becomes: " cos θ − sin θ sin θ cos θ # " = −1 0 0 −1 # The rotation matrix is simply the matrix −I . The eigenvalue is λ = −1 (this is a repeated eigenvalue). The eigenvectors are any vector in the plane since ∀x ∈ R2 , −Ix = −x. If θ 6= 0, π then there is no eigenvalues and eigenvectors for the rotation matrix. 3. In the case when eigenvalues exist, compute the eigenvectors. Solution: If θ = 0 or π, the eigenvectors are any vectors v in the plane R2 : 1 v=x ! 0 +y 0 ! , with x ∈ R and y ∈ R 1 Exercise on Reection: 1. Compute the determinant of a reection matrix. Solution: " det cos θ sin θ sin θ − cos θ #! = − cos2 θ − sin2 θ = −1 2 2. Draw the house when it has been transformed by a reection matrix with θ = π4 . Solution: see graph. 3. Compute the eigenvalues and the eigenvectors. Solution: the characteristic equation is " det " # cos θ sin θ sin θ − cos θ −λ 1 0 0 1 #! = λ2 − 1 = (λ − 1)(λ + 1) = 0 So we have two eigenvalues: λ = 1 and λ = −1. (a) Case λ = 1. The augmented matrix is: " It is reduced by R2 → R2 sin θ − cos θ − 1 sin θ 0 sin θ − cos θ − 1 0 R1 cos θ−1 # : " cos θ − 1 sin θ 0 0 0 0 # so for an eigenvector v = (x, y), we have the following relation: (cos θ − 1)x + sin θ · y = 0 or so v =x· (1 − cos θ) x sin θ y= ! 1 ∀x ∈ R∗ (1−cos θ) sin θ θ) You can draw the line y = (1−cos sin θ x (using trigonometry, this equation is equivalent to y = tan θ2 · x ) and check that this is the axis of symmetry for the reection. (b) Case λ = 1. The augmented matrix is: " It is reduced by R2 → R2 sin θ − cos θ + 1 sin θ 0 sin θ − cos θ + 1 0 R1 cos θ−1 # : " cos θ + 1 sin θ 0 0 0 0 # so for an eigenvector v = (x, y), we have the following relation: (cos θ + 1)x + sin θ · y = 0 so v =x· 1 −(1+cos θ) sin θ or y= −(1 + cos θ) x sin θ ! ∀x ∈ R∗ 4. Draw the line or the eigenspace corresponding to the eigenvalue λ = 1. Solution: see graph. 5. Check that you have a good reection by folding the graph on this eigen-line. Solution: see graph. 3 Exercise on Afne Transformations: 1. Consider a transformation combining a translation and a linear transformation such that (1) x0 = Ax + t a xed point (or vector) is a vector x such that it remains at the same place after afne transformation (i.e. we have x = Ax + t) Fixed point: (a) what is the xed point of equation (1)? Solution: The xed point is the vector x such that x = Ax + t or (I − A)x = t so if (I − A) is an invertible matrix then you have the xed point dened as: x = (I − A)−1 t (b) on what condition this xed point exists? Solution: We need (I − A) to be invertible so we need det(I − A) 6= 0 (or det(A − I) 6= 0). It means that A should not have 1 as an eigenvalue so that (I − A) is invertible. (c) does a pure translation (i.e. if A = I ) have a xed point? Solution: For A = I , there is no xed point. 2. Combination of transformations. (1) applied to a vector x. Consider two successive transformations as in equation (a) is the resulting transformation linear? afne ? Solution: The rst transformation is x1 = A1 x + t1 , and then the second is applied to x1 such that x2 = A2 x1 + t2 . We want the output x2 w.r.t. the rst input x: x2 = A2 (A1 x + t1 ) + t2 = A2 A1 x + A2 t1 + t2 | {z } | {z } t A So the resulting transformation of x in x2 is afne. (b) Check that the combination of those two transformations can be expressed simply by a multiplication of matrices using homogeneous coordinates. and we have then: x2 x1 b1 tx1 y1 = c1 1 0 d1 y ty1 1 1 a2 b2 tx2 y2 = c2 0 1 d2 ty2 y1 1 1 x2 0 0 x a1 x1 b2 tx2 a1 b1 tx1 y2 = c2 1 0 d2 ty2 c1 1 0 d1 ty1 y 1 1 0 0 x a2 4 you should check that the relation in between the same! as in the ! x and x2 is exactly ! previous question, assuming A1 = tx2 ty2 3. a1 b1 c1 d1 , A2 = a2 b2 c2 d2 , t1 = tx1 ty1 and t2 = ! . The projection of the 3D space (world) to a 2D plane (an image) by a camera can also be expressed via a transformation of the form: Camera calibration. x y =P 1 X Y Z 1 (2) (a) what is the size of the matrix P ? Solution: P is a matrix of order (3 × 4) (b) How would you nd the coefcients of the matrix P ? Solution: you nd corresponding points in between the 3D world and its projection in the image plane. Once you have several corresponding pairs (xi , Xi ), you can solve the unknown coefcients in P . Figure 1: Graph for the exercise on reection.