11
Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Embed Size (px)

Citation preview

Page 1: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrices, Transformations and the 3D Pipeline

Matthew Rusch

Paul Keet

Page 2: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrices

What is a MATRIX“A concise and useful way of uniquely

representing and working with linear transformations.”

Notation

Column or row major?Above is row major

Page 3: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrix Operations - Scalar

Scalar - MatrixAdditionSubtractionMultiplicationDivision

Page 4: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrix Operations - Matrix

Matrix – MatrixTransposeDeterminantMatrix AdditionMatrix MultiplicationMatrix Inverse

Page 5: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Transpose

The object obtained by replacing all elements aij with aji

Optimization note: Matrix elements down the diagonal can be left alone

Properties of the transpose:

Page 6: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Determinant

The determinant of a matrix A is usually denoted det(A) or |A| For a 2x2 matrix, the determinant is defined as:

An NxN matrix can be expanded by minors to obtain:

Sign is given by (-1)i+j

Matrices with a determinant of zero are called singular matrices

Page 7: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrix Multiplication

Einstein summation

Associative

Not generally commutative [A][B] != [B][A]

Identity matrices and matrices that are diagonal and of the same dimension are exceptions

Page 8: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrix Inverse

A matrix times its inverse yields an identity matrix

Same as the transpose for orthogonal matrices

Gauss-Jordan elimination Gaussian elimination LU Decomposition

Page 9: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrix Inverse

2x2 matrix

3x3 matrix

Page 10: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Matrix Transforms

Scale Rotation

Around isolated axis Around arbitrary axis

Translation Can be a vector addition Homogenous coordinates can be used

Shearing Affine

Preserves colinearity and relations of distances Projection matrices are NOT affine

Page 11: Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet

Transformations in the 3D Pipeline

Model to World, or World Transform World to View, or View Transform

OpenGL combines this with the world transform and calls it the modelview matrix

Lighting is done in world space in this case

View to Projection, or Projection Transform How do we get from projection space to screen space?

Screen Transform Homogenezation, or divide by w

Concatination, or combining transforms