1 / 38

The Math Lecture

The Math Lecture. ( Part I - Matrices). Introduction. For 2D games, we use a lot of trigonometry For 3D games, we use a lot of linear algebra Most of the tim e, we don’t have to use calculus A matrix can: Translate (move) a vertex Rotate a vertex Scale a vertex

mala
Download Presentation

The Math Lecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Math Lecture (Part I - Matrices)

  2. Introduction • For 2D games, we use a lot of trigonometry • For 3D games, we use a lot of linear algebra • Most of the time, we don’t have to usecalculus • A matrix can: • Translate (move) a vertex • Rotate a vertex • Scale a vertex • Math libraries cover up these details • Learn it anyway!

  3. Introduction • For 2D games, we use a lot of trigonometry • For 3D games, we use a lot of linear algebra • Most of the time, we don’t have to usecalculus • A matrix can: • Translate (move) a vertex • Rotate a vertex • Scale a vertex • Math libraries cover up these details • Learn it anyway!

  4. MAtrices • The foundation of all geometric operations (translation, rotation, scaling, skewing…) • Have multiple rows and columns (usually 3x3 or 4x4) • Below is an identity matrix • We can multiply a matrix • with another matrix, and get a matrix • with a vector of “appropriate” dimension (later)

  5. Transposing a Matrix • Have a transpose (denoted ) where • In other words, make the rows columns! Transpose

  6. Transposing a Matrix • Have a transpose (denoted ) where • In other words, make the rows columns! • Mirror image along the diagonal Transpose The Matrix has you…

  7. Matrices • There’s also an inverse matrix (denoted ) where • Not all matrices are invertible • Can check by getting the determinant of the matrix (looking for non-zero)

  8. Matrices • There’s also an inverse matrix (denoted ) where • Not all matrices are invertible • Can check by getting the determinant of the matrix (looking for non-zero)

  9. Matrices • There’s also an inverse matrix (denoted ) where • Not all matrices are invertible • Can check by getting the determinant of the matrix (looking for non-zero)

  10. Matrices • There’s also an inverse matrix (denoted ) where • Not all matrices are invertible • Can check by getting the determinant of the matrix (looking for non-zero)

  11. Matrices • There’s also an inverse matrix (denoted ) where • Not all matrices are invertible • Can check by getting the determinant of the matrix (looking for non-zero) Follow the white rabbit…

  12. A few Special Matrices(Used for Rotation)

  13. Matrix Multiplication • Multiplying a point by a matrix gives us a new point! • Let’s say that we want to rotate the point around the z axis by 90 degrees • Points are always stored with a 1 for the 4th element = Oldpoint Newpoint

  14. Matrix Multiplication • Multiplying a point by a matrix gives us a new point! • Let’s say that we want to rotate the point around the z axis by 90 degrees • Points are always stored with a 1 for the 4th element = -1 0

  15. Matrix Multiplication • Multiplying a point by a matrix gives us a new point! • Let’s say that we want to rotate the point around the z axis by 90 degrees • Points are always stored with a 1 for the 4th element =

  16. Matrix Multiplication • Multiplying a point by a matrix gives us a new point! • Let’s say that we want to rotate the point around the z axis by 90 degrees • Points are always stored with a 1 for the 4th element =

  17. Matrix Multiplication • Multiplying a point by a matrix gives us a new point! • Let’s say that we want to rotate the point around the z axis by 90 degrees • Points are always stored with a 1 for the 4th element = What IS real?

  18. Translation • It’s a piece of cake, because the 4th column is the translation!

  19. Translation • It’s a piece of cake, because the 4th column is the translation! • Imagine we want to move the point by (2, 1, -3). Then: =

  20. Translation • It’s a piece of cake, because the 4th column is the translation! • Imagine we want to move the point by (2, 1, -3). Then: =

  21. Translation • It’s a piece of cake, because the 4th column is the translation! • Imagine we want to move the point by (2, 1, -3). Then: =

  22. Translation • It’s a piece of cake, because the 4th column is the translation! • Imagine we want to move the point by (2, 1, -3). Then: =

  23. Translation • It’s a piece of cake, because the 4th column is the translation! • Imagine we want to move the point by (2, 1, -3). Then: = Why, oh why, didn’t I take the blue pill?

  24. Translation • It’s a piece of cake, because the 4th column is the translation! • Imagine we want to move the point by (2, 1, -3). Then: =

  25. SCALING • It’s a piece of cake too, because it’s the diagonal! • We can scale along just one axis, or more than one! • Imagine we want to scale the point by the values x, y and z. Then: = Trace program: running

  26. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  27. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  28. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  29. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  30. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  31. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  32. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  33. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix

  34. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix There is no spoon…

  35. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix ?

  36. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix =

  37. Matrix Multiplication • What if you want to rotate a point and then translate it? • Need a rotation matrix • Need a translation matrix • Returns a 4x4 matrix = Oldpoint Newpoint

  38. JEFF WAS HERE

More Related