Linear Algebra and Matrix Transformations, Slides of Computer Graphics

The concepts of linear algebra, including vectors and points in 3d space, dot and cross products, matrix notation, homogeneous coordinates, associativity and transpose of matrices. It also explains how to use matrix notation to solve shopping examples and perform matrix multiplication. The document also touches upon the concept of identity and scaling matrices.

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarasvan
sarasvan ๐Ÿ‡ฎ๐Ÿ‡ณ

4.4

(20)

118 documents

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 08:
Transform 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22

Partial preview of the text

Download Linear Algebra and Matrix Transformations and more Slides Computer Graphics in PDF only on Docsity!

Lecture 08:

Transform 1

Geometric Transform

โ€ข Apply transforms to a hierarchy of objects /

verticesโ€ฆ

  • Specifically, translate (T), rotate (R), scale (S)

Vector and Matrix Notation

โ€ข Letโ€™s say I need:

  • 6 apples, 5 cans of soup, 1 box of tissues, 2 bags

of chips

โ€ข 4 Stores, A, B, C, and D (Stop and Shop,

Shawโ€™s, Trader Joeโ€™s, and Whole Foods)

1 apple 1 can of soup 1 box of tissue 1 bag of chips

Stop and Shop $0.20 $0.93 $0.64 $1. Shawโ€™s $0.65 $0.82 $0.75 $1. Trader Joeโ€™s $0.95 $1.10 $0.52 $3. Whole Foods $1.15 $0.20 $1.25 $2.

Shopping Example

  • Which store do you go to?
    • Find the total cost from each store
    • Find the minimum of the four stores
  • More formally, let ๐‘ž๐‘– denote the quantity of item ๐‘–.
  • Let ๐ด๐‘– be the unit price of item ๐‘– at store ๐ด.
  • Then:
    • ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ด = (^4) ๐‘–=1๐ด๐‘–๐‘ž๐‘–

q1 q2 q3 q A $0.20 $0.93 $0.64 $1. B $0.65 $0.82 $0.75 $1. C $0.95 $1.10 $0.52 $3. D $1.15 $0.20 $1.25 $2.

๐‘ž 1 = ๐Ÿ” ๐‘ž 2 = ๐Ÿ“ ๐‘ž 3 = ๐Ÿ ๐‘ž 4 = ๐Ÿ

Total_A = (0.2 * 6) + (0.93 * 5) + (0.64 * 1) + (1.20 * 2) = 8.

Using the Matrix Notation

  • ๐‘ƒ๐‘Ž๐‘™๐‘™ =

๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ด ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ต ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ถ ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ท

=

0.20 0.93 (^) 0.64 1. 0.65 0.82 (^) 0.75 1. 0.95 1.10 (^) 0.52 3. 1.15 0.20 (^) 1.25 2.

6 5 1 2

  • Determine totalCost vector using row-column multiplication
    • Dot product is the sum of the pairwise multiplications
    • Apply this operation to rows of prices and column of quantitities

Reminder: Matrix Multiplication

  • Each entry in the resulting matrix L is the dot product of a row of M with a column of N:

๐ฟ = ๐‘€๐‘

๐‘™๐‘ฅ๐‘ฅ ๐‘™๐‘ฅ๐‘ฆ ๐‘™๐‘ฅ๐‘ง ๐‘™๐‘ฅ๐‘ค ๐‘™๐‘ฆ๐‘ฅ ๐‘™๐‘ฆ๐‘ฆ ๐‘™๐‘ฆ๐‘ง ๐‘™๐‘ฆ๐‘ค ๐‘™๐‘ง๐‘ฅ ๐‘™๐‘ง๐‘ฆ ๐‘™๐‘ง๐‘ง ๐‘™๐‘ง๐‘ค ๐‘™๐‘ค๐‘ฅ ๐‘™๐‘ค๐‘ฆ ๐‘™๐‘ค๐‘ง ๐‘™๐‘ค๐‘ค

=

๐‘š๐‘ฅ๐‘ฅ ๐‘š๐‘ฅ๐‘ฆ ๐‘š๐‘ฅ๐‘ง ๐‘š๐‘ฅ๐‘ค ๐‘š๐‘ฆ๐‘ฅ ๐‘š๐‘ฆ๐‘ฆ ๐‘š๐‘ฆ๐‘ง^ ๐‘š๐‘ฆ๐‘ค ๐‘š๐‘ง๐‘ฅ ๐‘š๐‘ง๐‘ฆ ๐‘š๐‘ง๐‘ง ๐‘š๐‘ง๐‘ค ๐‘š๐‘ค๐‘ฅ ๐‘š๐‘ค๐‘ฆ ๐‘š๐‘ค๐‘ง ๐‘š๐‘ค๐‘ค

๐‘›๐‘ฅ๐‘ฅ ๐‘›๐‘ฅ๐‘ฆ ๐‘›๐‘ฅ๐‘ง ๐‘›๐‘ฅ๐‘ค ๐‘›๐‘ฆ๐‘ฅ ๐‘›๐‘ฆ๐‘ฆ ๐‘›๐‘ฆ๐‘ง^ ๐‘›๐‘ฆ๐‘ค ๐‘›๐‘ง๐‘ฅ ๐‘›๐‘ง๐‘ฆ ๐‘›๐‘ง๐‘ง ๐‘›๐‘ง๐‘ค ๐‘›๐‘ค๐‘ฅ ๐‘›๐‘ค๐‘ฆ ๐‘›๐‘ค๐‘ง ๐‘›๐‘ค๐‘ค

๐‘™๐‘ฅ๐‘ฆ = ๐‘š๐‘ฅ๐‘ฅ๐‘›๐‘ฅ๐‘ฆ + ๐‘š๐‘ฅ๐‘ฆ๐‘›๐‘ฆ๐‘ฆ + ๐‘š๐‘ฅ๐‘ง๐‘›๐‘ง๐‘ฆ + ๐‘š๐‘ฅ๐‘ค๐‘›๐‘ค๐‘ฆ

  • Does ๐ฟ = ๐‘€๐‘ and ๐ฟ = ๐‘๐‘€ the same?

Identity Matrix

  • What if our price matrix is of the following?

(^1 0 0 ) (^0 1 0 ) (^0 0 1 ) (^0 0 0 )

Identity Matrix

  • What if our price matrix is of the following? (^1 0 0 ) (^0 1 0 ) (^0 0 1 ) (^0 0 0 )
  • ๐‘ƒ๐‘Ž๐‘™๐‘™ =

๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ด ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ต ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ถ ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ท

=

(^1 0 0 ) (^0 1 0 ) (^0 0 1 ) (^0 0 0 )

6 5 1 2

=

6 5 1 2

  • We call this matrix the โ€œidentity matrixโ€

Identity Matrix

  • What if our price matrix is of the following? (^2 0 0 ) (^0 2 0 ) (^0 0 2 ) (^0 0 0 )
  • ๐‘ƒ๐‘Ž๐‘™๐‘™ =

๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ด ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ต ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ถ ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™๐ถ๐‘œ๐‘ ๐‘ก๐ท

=

(^2 0 0 ) (^0 2 0 ) (^0 0 2 ) (^0 0 0 )

6 5 1 2

=

12 10 2 4

  • So this is a โ€œscaling matrixโ€

Note!

  • In this example, notice the first column of the matrix is

only affecting the first value of the result

  • Why is this important??

Matrix Multiplication Explained

(Visually)

  • Suppose we have some matrix, like

1 1 1 2

, and we want to know what itโ€™ll do to a 2D point.

  • First, we multiply this matrix by two unit basis

vectors, the x-axis and the y-axis: 1 1 1 2

1 0

=

1 1

1 1 1 2

0 1

=

1 2

  • Notice the results are the two columns of the matrixโ€ฆ
  • So letโ€™s visualize how the x and y axes have been

transformed using our matrix

Matrix Multiplication Explained

(Visually)

  • Original Coordinate

System

  • After we apply the

transform

Transformations in Computer Graphics

  • Elemental Transformations:
    • Translation
    • Rotation
    • Scaling
    • Shearing
  • Of the four, three of them are affine and linear:
    • Rotation, Scaling, and Shearing
  • One is affine but non-linear
    • Translation

Definitions of Transformations

  • Projective โŠƒ Affine โŠƒ Linear
    • Meaning that all linear transforms are also affine transforms, which are also projective transforms.
    • However, not all affine transforms are linear transforms, and not all projective transforms are affine.
  • Definitions:
    • Linear Transform:
      • Preserves all parallel lines
      • Acts on a line to yield either a line or a point
      • The vector [0, 0] is always transformed to [0, 0]
      • Examples: scale and rotate