# BAI CM20144 Applications I: Mathematics for Applications Mark Wood

## Presentation on theme: "BAI CM20144 Applications I: Mathematics for Applications Mark Wood"— Presentation transcript:

BAI CM20144 Applications I: Mathematics for Applications Mark Wood cspmaw@cs.bath.ac.uk http://www.cs.bath.ac.uk/~cspmaw

BAI Matrix Transformations Affine Transformations Homogeneous Coordinates Fractals Test 7 Todays Tutorial

BAI Every matrix A defines a transformation T(u) = Au, where u is a column vector This is a linear transformation (why?) Matrix dimensions relate to domain / codomain Composing matrix transformations Suppose want to do A 1, then A 2, then A 3 … Multiplication order is reversed: A 3 A 2 A 1 u Also written T 3 o T 2 o T 1 (u), if T i (u) = A i u Example 1 Matrix Transformations 1

BAI Every linear transformation T defines a matrix How do you find the matrix A s.t. T(u) = Au? Use the standard basis of the domain See what happens to the basis vectors under T These image vectors are the columns of A A is called the standard matrix Example 2 Matrix Transformations 2

BAI Rotation (about origin) General form for 2D using parameter θ Otherwise, could work it out using standard basis Contraction / Dilation (from origin) General form for 2D using parameter r 0 1 gives a dilation Reflection (in x-axis) Again, work it out using standard basis Q. What about reflection in y = x? All linear and nonsingular Important Transformations

BAI T(u) = u + v for fixed v Not linear (why?) Affine transformation Matrix transformation followed by a translation T(u) = Au + v Also not linear Problem: harder to compose (why?) Translation

BAI Represent the vector (u 1, u 2 ) in R 2 as the vector (u 1, u 2, 1) in R 3 Translation goes in the right-hand column Insert original 2D matrix in top left Bottom row ensures z = 1 persists Any affine transformation can in this way be represented by a matrix (linear and nonsingular in R 3 ) Any sequence of (affine) transformations can be represented by a matrix through composition Example 3 Homogeneous Coordinates

BAI To generate a fractal: 1.Choose some affine transformations 2.Assign each a probability (must sum to 1) 3.Start at origin 4.Apply transformation T i with probability p i 5.IF iterations < somenumber THEN GOTO 4 Look at book, pp 198 – 201 Can use their equations Fractals