Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.

Similar presentations


Presentation on theme: "CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE."— Presentation transcript:

1 CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE

2 INTRODUCTION TO MATRICES

3 ENTER THE MATRIX Matrix = (p X q) 2D array of numbers (scalars) p = number of rows, q = number of columns Used here to manipulate vectors and points  used to transform vectors/points Given matrix M, another notation for a matrix is [m ij ] In computer graphics, most matrices will be 2x2, 3x3, or 4x4 In the slides that follow (for the most part): Capital letters  matrices Lowercase letters  scalar numbers http://www.papeldeparede.et c.br/wallpapers/codigo- matrix_2283_1280x1024.jpg

4 IDENTITY MATRIX Identity matrix = square matrix with 1’s on the diagonal and 0’s everywhere else Effectively the matrix equivalent of the number one  multiplying by the identity matrix gives you the same matrix back M = I*M

5 MATRIX ADDITION To add two matrices, just add the corresponding components Same rules as with vectors Both matrices must have the same dimensions! Resulting matrix  same dimensions as original matrices

6 RULES OF MATRIX ADDITION Note: 0 = matrix filled with zeros

7 MULTIPLY A MATRIX BY A SCALAR To multiple a matrix M by a scalar (single number) a, just multiply a by the individual components Again, same as with vectors Not surprisingly, resulting matrix same size as original

8 RULES OF SCALAR-MATRIX MULTIPLICATION

9 TRANSPOSE OF A MATRIX Transpose of matrix M = rows become columns and columns become rows Notation: M T If M is (p X q)  M T is (q x p)

10 RULES OF THE TRANSPOSE MATRIX

11 TRACE OF A MATRIX Trace of matrix = just the sum of the diagonal elements of a square matrix Notation: tr(M)

12 MATRIX-MATRIX MULTIPLICATION When multiplying two matrix M and N like this  T = MN  Size of M must be (p X q) Size of N must be (q x r) Result T will be (p x r) ORDER MATTERS!!! 2 x 3 3 x2 x22

13 MATRIX-MATRIX MULTIPLICATION T = MN For each value in T  t ij  get the dot product of the row i of M and the column j of N

14 MATRIX-MATRIX MULTIPLICATION

15

16

17 EXAMPLE: MATRIX-MATRIX MULTIPLICATION

18 RULES OF MATRIX-MATRIX MULTIPLICATION  We will use this for combining transformations  I = identity matrix  This is true in general, even if dimensions are the same!

19 MULTIPLYING A MATRIX BY A VECTOR We will be using column vectors here Column vector = (q x 1) matrix Multiplying a (q x 1) vector by a matrix (p x q) will give us a new vector (p x 1) For our transformations later, usually p = q so that w has the same size as v w i = dot product of v with row i of M


Download ppt "CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE."

Similar presentations


Ads by Google