week 4 friday what did we talk about last time
play

Week 4 - Friday What did we talk about last time? Homogeneous - PowerPoint PPT Presentation

Week 4 - Friday What did we talk about last time? Homogeneous notation Vector equations for lines and planes Once we are in 3D, we have to talk about planes as well The explicit form of a plane is similar to a line: p ( u , v


  1. Week 4 - Friday

  2.  What did we talk about last time?  Homogeneous notation  Vector equations for lines and planes

  3.  Once we are in 3D, we have to talk about planes as well  The explicit form of a plane is similar to a line:  p ( u , v ) = o + u s + v t  o is a point on the plane  s and t are vectors that span the plane  s x t is the normal of the plane

  4.  The implicit equation for a plane is just like the implicit for a line, except with an extra dimension  Let n be a vector ( a , b , c )  Let p be a point ( x , y , z )  p is on plane π if and only if  n • p + d = 0  Since n is the normal of the plane we can compute it in a couple of ways:  n = s x t where s and t span the plane  n = ( u – w ) x ( v – w ) where u , v , and w are noncollinear points in the plane

  5.  Again, it works just like a line  If we write f ( p ) = n • p + d  Assuming q ∈ plane π  f ( p ) = 0 iff p ∈ π  f( p ) > 0 iff p lies on the same side as the point q + n  f ( p ) < 0 iff p lies on the same side as the point q - n  f ( p ) again gives a (scaled) measure of the perpendicular distance from p to π  Distance( p ) = f ( p )/|| n ||  This implies that Distance( 0 ) = d , making d the shortest distance from the origin to the plane

  6.  The cross product of two vectors finds a vector that is orthogonal to both  For 3D vectors u and v in an orthonormal basis, the cross product w is:   −   w u v u v     x y z z y = = × = −     w w u v u v u v y z x x z     −  w  u v u v   z x y y x

  7.  Plane defined by:  (1, 3, 2)  (2, 5, 2)  (3, 8, 2)  Where is (3, 3, 2)?  What about (3, 4, 5)?

  8.  Let p = ( p x , p y ) be a unit vector  Let ϕ be the angle the vector makes with the x -axis  sin ϕ = p y  cos ϕ = p x  tan ϕ = sin ϕ /cos ϕ = p y / p x

  9.  For a right triangle with sides a and b and hypotenuse c :  sin α = a / c  cos α = b / c  tan α = sin α /cos α = a / b  c 2 = a 2 + b 2

  10.  For any triangle: sin α sin β sin γ = =  Law of sines: a b c c 2 = a 2 + b 2 – 2 ab cosγ  Law of cosines: + α β tan +  Law of tangents: a b 2 = − − α β a b tan 2

  11.  Trigonometric identity: cos 2 ϕ + sin 2 ϕ = 1  Double angle:  sin2 ϕ = 2sin ϕ cos ϕ = 2tan ϕ /(1 + tan 2 ϕ )  cos2 ϕ =cos 2 ϕ - sin 2 ϕ =1 – sin 2 ϕ  tan2 ϕ = 2tan ϕ /(1-tan 2 ϕ )  There are a host of other useful ones listed in the book

  12.  The computer science behind texture mapping uses a lot of techniques to make it look better  For now, we're only worried about mapping a vertex to a location in a rectangular texture  MonoGame will take care of the rest

  13.  Texture coordinates are usually u (0,0) (1,0) given in ( u , v ) form  u is the horizontal direction and v is the vertical  These coordinates are each v almost always in the range [0, 1]  In MonoGame, u grows from left to right and v grows from top to bottom (0,1)

  14.  Load images into Texture2D objects as before  Use a vertex format that allows a texture to be specified (such as VertexPositionNormalTexture )  Set appropriate texture coordinates on each vertex  When drawing, set the Texture property on the BasicEffect object to the texture you want to use  Apply the change on the pass

  15.  A transform is an operation that changes points, vectors, or colors  We can use them to position and animate objects, lights, and cameras  A linear transform is one that holds over vector addition and scalar multiplication  Rotation  Scaling  Can be represented by a 3 x 3 matrix

  16.  Adding a vector after a linear transform makes an affine transform  Affine transforms can be stored in a 4 x 4 matrix using homogeneous notation  Affine transforms:  Translation  Rotation  Scaling  Reflection  Shearing

  17. Notation Name Characteristics T ( t ) Translation matrix Moves a point (affine) R Rotation matrix Rotates points (orthogonal and affine) S ( s ) Scaling matrix Scales along x , y , an z axes according to s (affine) H ij ( s ) Shear matrix Shears component i by factor s with respect to component j E ( h , p , r ) Euler transform Orients by Euler angles head (yaw), pitch, and roll (orthogonal and affine) P o ( s ) Orthographic Parallel projects onto a plane or volume (affine) projection P p ( s ) Perspective projection Project with perspective onto a plane or a volume slerp( q , r , t ) Slerp transform Interpolates quaternions q and r with parameter t

  18.  More on standard transforms  Normal transforms  Inverses  Euler transform  Matrix decomposition  Rotation around an arbitrary axis  Quaternions

  19.  Keep reading Chapter 4  Work on Project 1, due next Friday

Recommend


More recommend