Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12.

Similar presentations


Presentation on theme: "1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12."— Presentation transcript:

1 1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12

2 2 Notation: Scalars, Vectors, Matrices Scalar  (lower case, italic) Vector  (lower case, bold) Matrix  (upper case, bold)

3 3 Vectors Arrow: Length and Direction Oriented segment in 2D or 3D space

4 4 Column vs. Row Vectors Row vectors Column vectors Switch back and forth with transpose

5 5 Vector-Vector Addition Add: vector + vector = vector Parallelogram rule tail to head, complete the triangle geometricalgebraic examples:

6 6 Vector-Vector Subtraction Subtract: vector - vector = vector

7 7 Vector-Vector Subtraction Subtract: vector - vector = vector argument reversal

8 8 Scalar-Vector Multiplication Multiply: scalar * vector = vector vector is scaled

9 9 Vector-Vector Multiplication Multiply: vector * vector = scalar Dot product or Inner product

10 10 Vector-Vector Multiplication Multiply: vector * vector = scalar dot product, aka inner product

11 11 Vector-Vector Multiplication Multiply: vector * vector = scalar dot product or inner product geometric interpretation lengths, angles can find angle between two vectors

12 12 Dot Product Geometry Can find length of projection of u onto v as lines become perpendicular,

13 13 Dot Product Example

14 14 Vector-Vector Multiplication Multiply: vector * vector = vector cross product

15 15 Vector-Vector Multiplication multiply: vector * vector = vector cross product algebraic geometric parallelogram area perpendicular to parallelogram

16 16 RHS vs. LHS Coordinate Systems Right-handed coordinate system Left-handed coordinate system right hand rule: index finger x, second finger y; right thumb points up left hand rule: index finger x, second finger y; left thumb points down

17 17 Basis Vectors Take any two vectors that are linearly independent (nonzero and nonparallel) can use linear combination of these to define any other vector:

18 18 Orthonormal Basis Vectors If basis vectors are orthonormal (orthogonal (mutually perpendicular) and unit length) o we have Cartesian coordinate system o familiar Pythagorean definition of distance Orthonormal algebraic properties

19 19 Basis Vectors and Origins Coordinate system: just basis vectors can only specify offset: vectors Coordinate frame (or Frame of Reference): basis vectors and origin can specify location as well as offset: points It helps in analyzing the vectors and solving the kinematics.

20 20 Working with Frames F1F1F1F1 F1F1F1F1

21 21 Working with Frames F1F1F1F1 F1F1F1F1 p = (3,-1)

22 22 Working with Frames F1F1F1F1 F1F1F1F1 p = (3,-1) F2F2F2F2 F2F2F2F2

23 23 Working with Frames F1F1F1F1 F1F1F1F1 p = (3,-1) F2F2F2F2 p = (-1.5,2) F2F2F2F2

24 24 Working with Frames F1F1F1F1 F1F1F1F1 p = (3,-1) F2F2F2F2 p = (-1.5,2) F3F3F3F3 F2F2F2F2 F3F3F3F3

25 25 Working with Frames F1F1F1F1 F1F1F1F1 p = (3,-1) F2F2F2F2 p = (-1.5,2) F3F3F3F3 p = (1,2) F2F2F2F2 F3F3F3F3

26 26 Named Coordinate Frames Origin and basis vectors Pick canonical frame of reference  then don’t have to store origin, basis vectors  just  convention: Cartesian orthonormal one on previous slide Handy to specify others as needed  airplane nose, looking over your shoulder,...  really common ones given names in CG  object, world, camera, screen,...

27 27 Lines Slope-intercept form y = mx + b Implicit form y – mx – b = 0 Ax + By + C = 0 f(x,y) = 0

28 28 Implicit Functions An implicit function f(x,y) = 0 can be thought of as a height field where f is the height (top). A path where the height is zero is the implicit curve (bottom). Find where function is 0 plug in (x,y), check if = 0 on line < 0 inside > 0 outside

29 29 Implicit Circles circle is points (x,y) where f(x,y) = 0 points p on circle have property that vector from c to p dotted with itself has value r 2 points p on the circle have property that squared distance from c to p is r 2 points p on circle are those a distance r from center point c

30 30 Parametric Curves Parameter: index that changes continuously (x,y): point on curve t: parameter Vector form

31 31 2D Parametric Lines start at point p 0, go towards p 1, according to parameter t p(0) = p 0, p(1) = p 1

32 32 Linear Interpolation Parametric line is example of general concept Interpolation p goes through a at t = 0 p goes through b at t = 1 Linear weights t, (1-t) are linear polynomials in t

33 33 Matrix-Matrix Addition Add: matrix + matrix = matrix Example

34 34 Scalar-Matrix Multiplication Multiply: scalar * matrix = matrix Example

35 35 Matrix-Matrix Multiplication Can only multiply (n, k) by (k, m): number of left cols = number of right rows legal undefined

36 36 Matrix-Matrix Multiplication row by column

37 37 Matrix-Matrix Multiplication row by column

38 38 Matrix-Matrix Multiplication row by column

39 39 Matrix-Matrix Multiplication row by column

40 40 Matrix-Matrix Multiplication row by column Non commutative: AB != BA

41 41 Matrix-Vector Multiplication points as column vectors: post-multiply

42 42 Matrices Transpose Identity Inverse

43 43 Matrices and Linear Systems Linear system of n equations, n unknowns Matrix form Ax=b

44 44 Exercise 1 Q 1: If the vectors, u and v in figure are coplanar with the sheet of paper, does the cross product v x u extend towards the reader or away assuming right-handed coordinate system? For u = [1, 0, 0] & v = [2, 2, 1]. Find Q 2: The length of v Q 3: length of projection of u onto v Q 4: v x u Q 5: Cos t, if t is the angle between u & v

45 45 Exercise 2 F1F1F1F1 F1F1F1F1 p = (?, ?) F2F2F2F2 F3F3F3F3 F2F2F2F2 F3F3F3F3

46 46 Exercise 3 Given P1(3,6,9) and P2(5,5,5). Find a point on the line with end points P1 & P2 at t = 2/3 using parametric equation of line, where t is the parameter.

47 47 Reading for OpenGL practice: HB 2.9 Ready for the Quiz Things to do

48 48 References 1.http://faculty.cs.tamu.edu/schaefer/teaching/441_Spring2012/index.htmlhttp://faculty.cs.tamu.edu/schaefer/teaching/441_Spring2012/index.html 2.http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007/http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007/ 1.http://faculty.cs.tamu.edu/schaefer/teaching/441_Spring2012/index.htmlhttp://faculty.cs.tamu.edu/schaefer/teaching/441_Spring2012/index.html 2.http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007/http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007/


Download ppt "1 Linear Algebra (Mathematics for CG) Reading: HB Appendix A Computer Graphics Last Updated: 13-Jan-12."

Similar presentations


Ads by Google