a a a a vector offset displacement 1 2 n lower case bold
play

[ ] a a a ... a vector = offset / displacement 1 2 n - PowerPoint PPT Presentation

University of British Columbia News CPSC 314 Computer Graphics usual lecture order switched Jan-Apr 2013 math review today (Jan 2) Tamara Munzner James Gregson, TA usually second lecture Math Review course intro and overview


  1. University of British Columbia News CPSC 314 Computer Graphics • usual lecture order switched Jan-Apr 2013 • math review today (Jan 2) Tamara Munzner • James Gregson, TA • usually second lecture Math Review • course intro and overview Friday (Jan 4) guest lecture: James Gregson • Tamara Munzner, instructor • usually first lecture Week 1, Wed Jan 2 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2013 2 Notation: Scalars, Vectors, Matrices Vectors a • scalar • arrow: length and direction • (lower case, italic) • oriented segment in nD space [ ] a a a ... a • vector = • offset / displacement 1 2 n • (lower case, bold) • location if given origin • matrix a a a & # • (upper case, bold) 11 12 13 $ ! A a a a = $ ! 21 22 23 $ a a a ! % " 31 32 33 3 4

  2. Column vs. Row Vectors Vector-Vector Addition • row vectors [ ] • add: vector + vector = vector a a a ... a = row 1 2 n • parallelogram rule a & # • tail to head, complete the triangle 1 • column vectors $ ! a 2 geometric algebraic $ ! a = col ... u + v $ ! u v + & # v 1 1 $ ! $ ! a u v u v + = + % " n $ 2 2 ! u • switch back and forth with transpose u v $ ! + % " 3 3 T ( 3 , 2 ) ( 6 , 4 ) ( 9 , 6 ) a a + = = examples: col row ( 2 , 5 , 1 ) ( 3 , 1 , 1 ) ( 5 , 6 , 0 ) + − = 5 6 Vector-Vector Subtraction Vector-Vector Subtraction • subtract: vector - vector = vector • subtract: vector - vector = vector u v u v − − & # & # 1 1 1 1 $ ! $ ! u v u v u v u v − = − − = − 2 2 2 2 $ ! $ ! v v u v u v $ − ! $ − ! % " % " 3 3 3 3 u u v v − − ( 3 , 2 ) ( 6 , 4 ) ( 3 , 2 ) ( 3 , 2 ) ( 6 , 4 ) ( 3 , 2 ) − = − − − = − − ( 2 , 5 , 1 ) ( 3 , 1 , 1 ) ( 1 , 4 , 2 ) ( 2 , 5 , 1 ) ( 3 , 1 , 1 ) ( 1 , 4 , 2 ) u − v − − = − u − v − − = − = = u ( v ) u ( v ) + − + − v u + v u argument reversal v v − u u 7 8

  3. Scalar-Vector Multiplication Vector-Vector Multiplication • multiply: scalar * vector = vector • multiply: vector * vector = scalar u • v • vector is scaled • dot product, aka inner product u v ' $ ' $ 1 1 % " % " a * u ( ) ( ) ( ) u v u v u v u v • = ∗ + ∗ + ∗ a * u ( a * u , a * u , a * u ) = 2 2 1 1 2 2 3 3 % " % " 1 2 3 u v % " % " & # & # 3 3 u 2 * ( 3 , 2 ) ( 6 , 4 ) = . 5 * ( 2 , 5 , 1 ) ( 1 , 2 . 5 ,. 5 ) = 9 10 Vector-Vector Multiplication Vector-Vector Multiplication • multiply: vector * vector = scalar • multiply: vector * vector = scalar u • v u • v • dot product, aka inner product • dot product, aka inner product u u v v " % " % u 1 v 1 ' ' $ $ ' ' $ $ 1 1 1 1 $ ' $ ' % % " " % % " " ( ( ) ( ) ( ) ( ) ( ) ) u u v v u u v v u u v v u u v v ( ) + u 2 ∗ v 2 ( ) + u 3 ∗ v 3 ( ) u 2 v 2 = u 1 ∗ v 1 • • = = ∗ ∗ + + ∗ ∗ + + ∗ ∗ • 2 2 2 2 1 1 1 1 2 2 2 2 3 3 3 3 $ ' $ ' % % " " % % " " u u v v $ ' $ ' % % " " % % " " u 3 v 3 # & # & & & # # & & # # 3 3 3 3 u v u v cos • = θ • geometric interpretation u • lengths, angles • can find angle between two θ vectors v 11 12

  4. Dot Product Geometry Dot Product Example • can find length of projection of u onto v " % " % u 1 v 1 $ ' $ ' u u v u v cos ( ) + u 2 ∗ v 2 ( ) + u 3 ∗ v 3 ( ) u 2 v 2 = u 1 ∗ v 1 • • = θ $ ' $ ' $ ' $ ' u 3 v 3 # & # & θ u v • v u cos θ = v u cos 6 1 θ & # & # u • v 0 → $ ! $ ! • as lines become perpendicular, 1 7 ( 6 * 1 ) ( 1 * 7 ) ( 2 * 3 ) 6 7 6 19 • = + + = + + = $ ! $ ! 2 3 $ ! $ ! % " % " 13 14 Vector-Vector Multiplication, The Sequel Vector-Vector Multiplication, The Sequel • multiply: vector * vector = vector • multiply: vector * vector = vector • cross product u v • cross product u v u v u v u v u v & # & # − & # & # − & # & # 1 1 2 3 3 2 1 1 2 3 3 2 • algebraic $ ! $ ! $ ! • algebraic $ ! $ ! $ ! u v u v u v u v u v u v × = − × = − 2 2 3 1 1 3 2 2 3 1 1 3 $ ! $ ! $ ! $ ! $ ! $ ! u v u v u v u v u v u v $ ! $ ! $ ! $ ! $ ! $ ! − − % " % " % " % " % " % " 1 2 2 1 1 2 2 1 3 3 3 3 15 16

  5. Vector-Vector Multiplication, The Sequel Vector-Vector Multiplication, The Sequel • multiply: vector * vector = vector • multiply: vector * vector = vector • cross product u v • cross product u v u v u v u v u v − − & # & # & # & # 3 & # & # 1 1 2 3 3 2 1 1 2 3 3 2 • algebraic $ ! $ ! $ ! • algebraic $ ! $ ! $ ! u v u v u v u v u v u v × = − × = − 1 2 2 3 1 1 3 2 2 3 1 1 3 $ ! $ ! $ ! $ ! $ ! $ ! u v u v u v u v u v u v $ ! $ ! $ ! $ ! $ ! $ ! − − 2 % " % " % " % " % " % " 3 3 1 2 2 1 3 3 1 2 2 1 • geometric a × b a × b = a b sin θ • parallelogram a × b b area θ � • perpendicular a × b to parallelogram a blah blah 17 18 RHS vs. LHS Coordinate Systems Basis Vectors • right-handed coordinate system convention • take any two vectors that are linearly independent (nonzero and nonparallel) z right hand rule: index finger x, second finger y; • can use linear combination of these to define right thumb points up y x any other vector: z x y = × • left-handed coordinate system c w a w b b = + 1 2 c left hand rule: index finger x, second finger y; c = 2 a + 0.5 b a left thumb points down x y z x y 0.5 b = × z 2 a 19 20

  6. Orthonormal Basis Vectors Basis Vectors and Origins • if basis vectors are orthonormal (orthogonal • coordinate system: just basis vectors (mutually perpendicular) and unit length) • can only specify offset: vectors • we have Cartesian coordinate system • coordinate frame: basis vectors and origin • familiar Pythagorean definition of distance • can specify location as well as offset: points orthonormal algebraic properties y p p o x + i y j = + x x y 1 , = = j o x y 0 y • = 5 . 0 i + x 2 = c 0.5 y 2 x 21 22 Working with Frames Working with Frames p o x + i y j p o x + i y j = + = + j j F 1 F 1 o o p p i i F 1 F 1 p = (3,-1) 23 24

  7. Working with Frames Working with Frames F 1 p o x + i y j p o x + i y j = + = + j j F 1 F 1 o o p p i i F 1 p = (3,-1) F 1 p = (3,-1) F 2 j o i F 2 25 26 Working with Frames Working with Frames p o x + i y j p o x + i y j F 2 = + = + j j F 1 F 1 o o p p i i F 1 p = (3,-1) F 1 p = (3,-1) F 2 F 2 j j o o i i F 2 F 2 p = (-1.5,2) p = (-1.5,2) 27 28

  8. Working with Frames Working with Frames p o x + i y j p o x + i y j = + = + j j F 1 F 1 o o p p i i F 1 p = (3,-1) F 1 p = (3,-1) F 2 F 2 j j o o i i F 2 F 2 p = (-1.5,2) p = (-1.5,2) j j i i o o F 3 F 3 F 3 F 3 p = (1,2) 29 30 Working with Frames Named Coordinate Frames p o a x b y c z • origin and basis vectors = + + + F 3 • pick canonical frame of reference p o x + i y j = + • then don’t have to store origin, basis vectors j F 1 p ( a , b , c ) • just = o p i • convention: Cartesian orthonormal one on F 1 p = (3,-1) F 2 previous slide j o i • handy to specify others as needed F 2 p = (-1.5,2) j i • airplane nose, looking over your shoulder, ... o F 3 F 3 p = (1,2) • really common ones given names in CG • object, world, camera, screen, ... 31 32

  9. Lines Implicit Functions • slope-intercept form • find where function is 0 f y f(x,y)=0 • y = mx + b • plug in (x,y), check if • implicit form • 0: on line f(x,y)=0 y=b • < 0: inside • y – mx – b = 0 y x x=a x • > 0: outside • Ax + By + C = 0 f(x,y) = y - mx - b • analogy: terrain y • f(x,y) = 0 m = -b/a • sea level: f=0 f(x,y)=0 • altitude: function value x • topo map: equal-value contours (level sets) 33 34 Implicit Circles Parametric Curves 2 2 2 f ( x , y ) ( x x ) ( y y ) r • = − + − − c c • parameter: index that changes continuously • circle is points (x,y) where f(x,y) = 0 • (x,y): point on curve x g ( t ) & # & # 2 = • p ( x , y ), c ( x , y ) : ( p c ) ( p c ) r 0 = = − • − − = • t: parameter $ ! $ ! c c y h ( t ) % " % " • points p on circle have property that vector • vector form from c to p dotted with itself has value r 2 p f ( t ) • = 2 2 • p c r 0 − − = • points points p on the circle have property that squared distance from c to p is r 2 p c r 0 • − − = • points p on circle are those a distance r from center point c 35 36

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend