3d geometry for computer graphics
play

3d Geometry for Computer Graphics Lesson 1: Basics & PCA 3d - PowerPoint PPT Presentation

3d Geometry for Computer Graphics Lesson 1: Basics & PCA 3d geometry 3d geometry 3d geometry Why?? We represent objects using mainly linear primitives: points lines, segments planes, polygons Need to know how to


  1. 3d Geometry for Computer Graphics Lesson 1: Basics & PCA

  2. 3d geometry

  3. 3d geometry

  4. 3d geometry

  5. Why?? � We represent objects using mainly linear primitives: � points � lines, segments � planes, polygons � Need to know how to compute distances, transformations, projections…

  6. How to approach geometric problems We have two ways: � Employ our geometric intuition 1. Formalize everything and employ our algebra skills 2. Often we first do No.1 and then solve with No.2 � For complex problems No.1 is not always � easy…

  7. Motivation – Shape Matching There are tagged feature points in both sets that are matched by the user What is the best transformation that aligns the unicorn with the lion?

  8. Motivation – Shape Matching Regard the shapes as sets of points and try to “match” these sets using a linear transformation The above is not a good alignment….

  9. Motivation – Shape Matching Regard the shapes as sets of points and try to “match” these sets using a linear transformation To find the best rotation we need to know SVD…

  10. Applications for Shape Matching � Mesh Comparison � Deformation Transfer � Morphing

  11. Principal Component Analysis y x Given a set of points, find the best line that approximates it

  12. Principal Component Analysis y’ y x’ x Given a set of points, find the best line that approximates it

  13. Principal Component Analysis y’ y x’ x When we learn PCA (Principal Component Analysis), we’ll know how to find these axes that minimize the sum of distances 2

  14. PCA and SVD � PCA and SVD are important tools not only in graphics but also in statistics, computer vision and more. T SVD: A = U Λ V Λ is diagonal contains the singular values of A � To learn about them, we first need to get familiar with eigenvalue decomposition. � So, today we’ll start with linear algebra basics reminder.

  15. Vector space � Informal definition: � V ≠ ∅ (a non-empty set of vectors) � v , w ∈ V ⇒ v + w ∈ V (closed under addition) � v ∈ V , α is scalar ⇒ α v ∈ V (closed under multiplication by scalar) � Formal definition includes axioms about associativity and distributivity of the + and ⋅ operators. � 0 ∈ V always!

  16. Subspace - example � Let l be a 2D line though the origin � L = { p – O | p ∈ l } is a linear subspace of R 2 y x O

  17. Subspace - example � Let π be a plane through the origin in 3D � V = { p – O | p ∈ π } is a linear subspace of R 3 z y O x

  18. Linear independence � The vectors { v 1 , v 2 , …, v k } are a linearly independent set if: α 1 v 1 + α 2 v 2 + … + α k v k = 0 ⇔ α i = 0 ∀ i � It means that none of the vectors can be obtained as a linear combination of the others.

  19. Linear independence - example � Parallel vectors are always dependent: v = 2.4 w ⇒ v + ( − 2.4) w = 0 v w � Orthogonal vectors are always independent.

  20. Basis of V � { v 1 , v 2 , …, v n } are linearly independent � { v 1 , v 2 , …, v n } span the whole vector space V : V = { α 1 v 1 + α 2 v 2 + … + α n v n | α i is scalar } � Any vector in V is a unique linear combination of the basis. � The number of basis vectors is called the dimension of V .

  21. Basis - example � The standard basis of R 3 – three unit orthogonal vectors x , y , z : (sometimes called i, j, k or e 1 , e 2 , e 3 ) z y x

  22. Matrix representation � Let { v 1 , v 2 , …, v n } be a basis of V � Every v ∈ V has a unique representation v = α 1 v 1 + α 2 v 2 + … + α n v n � Denote v by the column-vector: α ⎛ ⎞ 1 ⎜ ⎟ = ⎜ v � ⎟ ⎜ ⎟ α ⎝ ⎠ n � The basis vectors are therefore denoted: ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ 1 0 0 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ 0 1 0 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ , , � ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ � � � ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ 0 0 1 ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

  23. Linear operators � A : V → W is called linear operator if: � A ( v + w ) = A ( v ) + A ( w ) � A ( α v ) = α A ( v ) � In particular, A ( 0 ) = 0 � Linear operators we know: � Scaling � Rotation, reflection � Translation is not linear – moves the origin

  24. Linear operators - illustration � Rotation is a linear operator: R ( v + w ) v + w w w v v

  25. Linear operators - illustration � Rotation is a linear operator: R ( v + w ) v + w R ( w ) w w v v

  26. Linear operators - illustration � Rotation is a linear operator: R ( v + w ) v + w R ( v ) R ( w ) w w v v

  27. Linear operators - illustration � Rotation is a linear operator: R ( v ) +R ( w ) R ( v + w ) v + w R ( v ) R ( w ) w w v v R ( v + w ) = R ( v ) + R ( w )

  28. Matrix representation of linear operators � Look at A ( v 1 ) , …, A ( v n ) where { v 1 , v 2 , …, v n } is a basis. � For all other vectors: v = α 1 v 1 + α 2 v 2 + … + α n v n A ( v ) = α 1 A ( v 1 ) + α 2 A ( v 2 ) + … + α n A ( v n ) � So, knowing what A does to the basis is enough � The matrix representing A is: ⎛ ⎞ | | | ⎜ ⎟ =⎜ M A ( ) v A ( ) v � A ( ) v ⎟ A 1 2 n ⎜ ⎟ | | | ⎝ ⎠

  29. Matrix representation of linear operators ⎛ ⎞ 1 ⎛ ⎞ ⎛ ⎞ | | | | ⎜ ⎟ 0 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ = � A ( ) v A ( ) v A ( ) v A ( ) v ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ 1 2 n 1 � ⎜ ⎟ ⎜ ⎟ | | | | ⎜ ⎟ ⎝ ⎠ ⎝ ⎠ ⎜ ⎟ 0 ⎝ ⎠ ⎛ ⎞ 0 ⎛ ⎞ ⎛ ⎞ | | | | ⎜ ⎟ 1 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ = A ( ) v A ( ) v � A ( ) v A ( ) v ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ 1 2 n 2 � ⎜ ⎟ ⎜ ⎟ | | | | ⎜ ⎟ ⎝ ⎠ ⎝ ⎠ ⎜ ⎟ 0 ⎝ ⎠

  30. Matrix operations � Addition, subtraction, scalar multiplication – simple… � Multiplication of matrix by column vector: ∑ ⎛ ⎞ a b < > 1 i i ⎛ ⎞⎛ ⎞ ⎛ ⎞ a � a b row , b ⎜ ⎟ i 11 1 n 1 1 ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ = = � � � � � ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟ ∑ < > ⎜ ⎟ a � a b a b row , b ⎝ ⎠⎝ ⎠ ⎝ ⎠ ⎜ ⎟ m 1 mn n mi i m ⎝ ⎠ i A b

  31. Matrix by vector multiplication � Sometimes a better way to look at it: � A b is a linear combination of A ’s columns ! ⎛ ⎞⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ | | | b | | | 1 ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ = + + + � � … a a a b a b a b a ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ 1 2 n 1 1 2 2 n n ⎜ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ | | | b | | | ⎝ ⎠⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ n

  32. Matrix operations � Transposition: make the rows to be the columns T ⎛ ⎞ ⎛ ⎞ a � a a � a ⎜ ⎟ 11 1 n ⎜ 11 m 1 ⎟ = � � � � � � ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ a � a a � a ⎝ ⎠ ⎝ ⎠ m 1 mn 1 n mn � (AB) T = B T A T

  33. Matrix operations � Inner product can in matrix form: < >= = T T v w , v w w v

  34. Matrix properties � Matrix A ( n × n ) is non-singular if ∃ B, AB = BA = I � B = A − 1 is called the inverse of A � A is non-singular ⇔ det A ≠ 0 � If A is non-singular then the equation A x = b has one unique solution for each b . � A is non-singular ⇔ the rows of A are linearly independent (and so are the columns).

  35. Orthogonal matrices � Matrix A ( n × n ) is orthogonal if A − 1 = A T � Follows: AA T = A T A = I � The rows of A are orthonormal vectors! Proof: v 1 v 2 = δ ij I = A T A = v 1 v 2 v n = v i T v j v n ⇒ < v i , v i > = 1 ⇒ || v i || = 1 ; < v i , v j > = 0

  36. Orthogonal operators � A is orthogonal matrix ⇒ A represents a linear operator that preserves inner product (i.e., preserves lengths and angles): < > = = = T T T A v , A w ( A v ) ( A w ) v A A w = = =< > T T v I w v w v w , . � Therefore, || A v || = || v || and ∠ ( A v ,A w ) = ∠ ( v , w )

  37. Orthogonal operators - example � Rotation by α around the z -axis in R 3 : α α ⎛ ⎞ cos sin 0 ⎜ ⎟ = − α α R sin cos 0 ⎜ ⎟ ⎜ ⎟ 0 0 1 ⎝ ⎠ � In fact, any orthogonal 3 × 3 matrix represents a rotation around some axis and/or a reflection � det A = +1 rotation only � det A = − 1 with reflection

  38. Eigenvectors and eigenvalues � Let A be a square n × n matrix � v is eigenvector of A if: � A v = λ v ( λ is a scalar) � v ≠ 0 � The scalar λ is called eigenvalue � A v = λ v ⇒ A ( α v ) = λ ( α v ) ⇒ α v is also eigenvector � A v = λ v , A w = λ w ⇒ A ( v + w ) = λ ( v + w ) � Therefore, eigenvectors of the same λ form a linear subspace.

  39. Eigenvectors and eigenvalues � An eigenvector spans an axis (subspace of dimension 1) that is invariant to A – it remains the same under the transformation. � Example – the axis of rotation: Eigenvector of the rotation transformation O

Recommend


More recommend