University of British Columbia Review: Computer Graphics Defined Review: Rendering Capabilities Readings CPSC 314 Computer Graphics • CG uses • Mon (last time) Jan-Apr 2008 • movies, games, art/design, ads, VR, • FCG Chap 1 Tamara Munzner visualization • Wed (this time) • CG state of the art • FCG Chap 2 Math Review • photorealism achievable (in some cases) • except 2.5.1, 2.5.3, 2.7.1, 2.7.3, 2.8, 2.9, 2.11. Guest Lecturer: Michiel van de Panne • FCG Chap 5.1-5.2.5 • except 5.2.3, 5.2.4 Week 1, Wed Jan 9 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2008 www.siggraph.org/education/materials/HyperGraph/shutbug.htm http://www.alias.com/eng/etc/fakeorfoto/quiz.html 2 3 4 Today’s Readings Notation: Scalars, Vectors, Matrices Vectors Column vs. Row Vectors a • FCG Chapter 2: Miscellaneous Math • scalar • arrow: length and direction • row vectors [ ] a a a ... a = row 1 2 n • (lower case, italic) • skim 2.2 (sets and maps), 2.3 (quadratic eqns) • oriented segment in nD space a [ ] � � • vector a a a ... a = • column vectors 1 • important: 2.3 (trig), 2.4 (vectors), 2.5-6 (lines) • offset / displacement 1 2 n � � a • (lower case, bold) 2.10 (linear interpolation) • location if given origin � 2 � a = • matrix col ... • skip 2.5.1, 2.5.3, 2.7.1, 2.7.3, 2.8, 2.9 � � a a a � � • (upper case, bold) � � • skip 2.11 now (covered later) 11 12 13 a � � � � n A a a a • FCG Chapter 5.1-5.25: Linear Algebra = � � • switch back and forth with transpose 21 22 23 • skim 5.1 (determinants) � a a a � � 31 32 33 � T a a = • important: 5.2.1-5.2.2, 5.2.5 (matrices) col row • skip 5.2.3-4, 5.2.6-7 (matrix numerical analysis) 5 6 7 8 Vector-Vector Addition Vector-Vector Subtraction Vector-Vector Subtraction Scalar-Vector Multiplication • add: vector + vector = vector • subtract: vector - vector = vector • subtract: vector - vector = vector • multiply: scalar * vector = vector u v u v � � � � � � 1 1 1 1 • parallelogram rule • vector is scaled � � � � u v u v u v u v � = � � = � � 2 2 � � 2 2 � • tail to head, complete the triangle v v u v u v � � � � � � � � � � 3 3 3 3 a * u geometric algebraic u u a * u ( a * u , a * u , a * u ) v v = � � ( 3 , 2 ) ( 6 , 4 ) ( 3 , 2 ) ( 3 , 2 ) ( 6 , 4 ) ( 3 , 2 ) u + v � = � � � = � � 1 2 3 u v + v � � 1 1 ( 2 , 5 , 1 ) ( 3 , 1 , 1 ) ( 1 , 4 , 2 ) ( 2 , 5 , 1 ) ( 3 , 1 , 1 ) ( 1 , 4 , 2 ) � � u � v � � = � u � v � � = � u u v u v = = + = + � 2 2 � u ( v ) u ( v ) + � + � u 2 * ( 3 , 2 ) ( 6 , 4 ) u v � + � = � � 3 3 v u + v . 5 * ( 2 , 5 , 1 ) ( 1 , 2 . 5 ,. 5 ) = u ( 3 , 2 ) ( 6 , 4 ) ( 9 , 6 ) + = argument reversal v examples: ( 2 , 5 , 1 ) ( 3 , 1 , 1 ) ( 5 , 6 , 0 ) + � = v � u u 9 10 11 12 Vector-Vector Multiplication Vector-Vector Multiplication Vector-Vector Multiplication Dot Product Geometry • multiply: vector * vector = scalar • multiply: vector * vector = scalar • multiply: vector * vector = scalar • can find length of projection of u onto v u • v u • v u • v • dot product, aka inner product • dot product, aka inner product • dot product, aka inner product u u v u v cos • = � u v u u v v � � � � u 1 v 1 � � � � � � � � � � � � 1 1 1 1 1 1 � � � � � � � � � � � � � � � � � u v u v ( u v ) ( u v ) ( u v ) u u v v ( ( u u v v ) ( ) ( u u v v ) ( ) ( u u v v ) ) • u 2 v 2 = u 1 � v 1 ( ) + u 2 � v 2 ( ) + u 3 � v 3 ( ) v • = � + � + � • • = = � � + + � � + + � � • u cos � 2 � � 2 � 1 1 2 2 3 3 � � 2 2 � � � � 2 2 � � 1 1 1 1 2 2 2 2 3 3 3 3 � � � � � = v u v u u v v � � � � u cos � � � � � � � � � � � � u 3 v 3 � � � � � � � � � � � � � � � � � 3 3 3 3 3 3 u v u v cos • = � u • v 0 • as lines become perpendicular, � • geometric interpretation u • lengths, angles • can find angle between two � vectors v 13 14 15 16
Dot Product Example Vector-Vector Multiplication, The Sequel Vector-Vector Multiplication, The Sequel Vector-Vector Multiplication, The Sequel • multiply: vector * vector = vector • multiply: vector * vector = vector • multiply: vector * vector = vector � u 1 � � v 1 � • cross product • cross product • cross product � � � � u v u v u v u v u v u v u v u v u v � � � � � � � � � � � � � � 3 � � � � � � � ( ) + u 2 � v 2 ( ) + u 3 � v 3 ( ) u 2 • v 2 = u 1 � v 1 1 1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 3 2 � � � � • algebraic � � � � • algebraic � � � � • algebraic � � � � � � � � � � u v u v u v u v u v u v u v u v u v � = � � = � � = � 1 � u 3 � � v 3 � 2 2 3 1 1 3 2 2 3 1 1 3 2 2 3 1 1 3 � � � � � � � � � � � � � � � � � � � � � � u v u v u v 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 3 3 1 2 2 1 6 1 � � � � � � � � 1 7 ( 6 * 1 ) ( 1 * 7 ) ( 2 * 3 ) 6 7 6 19 • = + + = + + = � � � � 2 3 � � � � � � � � blah blah 17 18 19 20 Vector-Vector Multiplication, The Sequel RHS vs. LHS Coordinate Systems Basis Vectors Orthonormal Basis Vectors • multiply: vector * vector = vector • right-handed coordinate system convention • take any two vectors that are linearly • if basis vectors are orthonormal (orthogonal • cross product independent (nonzero and nonparallel) (mutually perpendicular) and unit length) u v u v u v � � � � � � � right hand rule: 1 1 2 3 3 2 z • algebraic � � � � � � index finger x, second finger y; • can use linear combination of these to define • we have Cartesian coordinate system u v u v u v � = � 2 2 3 1 1 3 right thumb points up � � � � � � y x any other vector: • familiar Pythagorean definition of distance z x y u v u v u v � � � � � � = � � � � � � � � • geometric 3 3 1 2 2 1 • left-handed coordinate system c w a w b = + 1 2 a b u v sin � = � orthonormal algebraic properties left hand rule: • parallelogram a � b index finger x, second finger y; x y 1 , = = area left thumb points down x � y z x y • perpendicular a � b = � x y 0 • = z to parallelogram 21 22 23 24 Basis Vectors and Origins Working with Frames Working with Frames Working with Frames • coordinate system: just basis vectors • can only specify offset: vectors p o x + i y j p o x + i y j p o x + i y j = + = + = + • coordinate frame: basis vectors and origin j j j F 1 F F 1 F F 1 F 1 1 1 • can specify location as well as offset: points o o o p p p i i i F F 1 F 1 F p = (3,-1) p = (3,-1) F 1 F p = (3,-1) p = (3,-1) F F 2 j 1 1 1 2 p o i F F 2 p o x + i y j = + 2 j o i 25 26 27 28 Working with Frames Working with Frames Working with Frames Named Coordinate Frames p o a x b y c z • origin and basis vectors = + + + • pick canonical frame of reference p o x + i y j p o x + i y j p o x + i y j = + = + = + • then don’t have to store origin, basis vectors j j j F F 1 F 1 F F F 1 1 1 1 • just p ( a , b , c ) = o o o p p p i i i • convention: Cartesian orthonormal one on F 1 F p = (3,-1) p = (3,-1) F 1 F p = (3,-1) p = (3,-1) F F 1 p = (3,-1) p = (3,-1) F 2 F F F 2 F F 2 previous slide j j j 1 1 1 2 2 2 o o o i i i F 2 F F F 2 F F 2 • handy to specify others as needed p = (-1.5,2) p = (-1.5,2) p = (-1.5,2) p = (-1.5,2) p = (-1.5,2) p = (-1.5,2) 2 2 2 j j i i • airplane nose, looking over your shoulder, ... o o F 3 F F F 3 F F 3 F 3 F p = (1,2) p = (1,2) 3 3 3 3 • really common ones given names in CG • object, world, camera, screen, ... 29 30 31 32
Recommend
More recommend