310 likes | 543 Views
Week 3 - Friday. CS361. Last time. What did we talk about last time? Vertex shaders Geometry shaders Pixel shaders. Questions?. Project 1. Using BasicEffect in XNA. Student Lecture: Vectors. Yeah… just what do you know about vectors?. Vectors. Euclidean space.
E N D
Week 3 - Friday CS361
Last time • What did we talk about last time? • Vertex shaders • Geometry shaders • Pixel shaders
Student Lecture: Vectors Yeah… just what do you know about vectors?
Euclidean space • We refer to n-dimensional real Euclidean space as Rn • A vector v in this space is an n-tuple, an ordered list of n real numbers • To match the book (and because we are computer scientists), we'll index these from 0 to n – 1 • We will generally write our vectors as column vectors rather than row vectors
Operations • We will be interested in a number of operations on vectors, including: • Addition • Scalar multiplication • Dot product • Norm
Addition • Addition of two vectors is just element-by-element addition
Associativity and commutativity • Vector addition is associative: • Vector addition is commutative:
Identity and inverse • There is a unique vector for Rn which is 0 = (0,0,…,0) with a total of n zeroes • o is additive identity: • For vector v, there is a unique inverse –v = (-v0, -v1, … -vn-1) • -v is the additive inverse:
Scalar multiplication • Multiplication by a scalar is just element-by-element multiplication of that scalar
Scalar rules • Rules for scalar multiplication can easily be inferred from the normal properties of reals under addition and multiplication:
Dot product • The dot product is a form of multiplication between two vectors that produces a scalar
Dot product rules • Dot product rules are slightly less obvious than scalar product
Norm! • A norm is a way of measuring the magnitude of a vector • We are actually only interested in the L2 norm, but there are many (infinite) norms for any given vector space • We'll denote the norm of u as ||u||
Geometry • Mathematical rules are one thing • Understanding how they are interpreted in geometry is something else • Unfortunately, this means getting more math to link up the existing math with geometry
Linear independence • A set of vectors u0, u1, … un-1 is linearly independent if the only scalars that satisfy the following identity are v0 = v1 = … = vn-1 = 0 • In other words, you can't make any one vector out of any of the others
Spanning and basis • A set of vectors u0, u1, … un-1spansRn if any vector vRn can be written: • In addition, if v0, v1, … , vn-1 are uniquely determined for all v Rn, then u0, u1, … un-1 form a basis of Rn
Describing geometry • To properly describe Rn, the vectors we give are actually scalar multiplied by each of the basis vectors ui • By convention, we leave off the basis vectors ui, because it would be cumbersome to show them • Also, they are often boring: (1,0,0), (0,1,0), and (0,0,1)
Interpretations • A vector can either be a point in space or an arrow (direction and distance) • The norm of a vector is its distance from the origin (or the length of the arrow) • In R2 and R3, the dot product is: where is the smallest angle between u and v
Bases • A basis is orthogonal if every vector in the basis is orthogonal to every other (has dot product 0) • An orthogonal basis is orthonormal if every vector in it has length 1 • The standard basis is orthonormal and made up of vectors ei which are all 0's except a 1 at location i
Projections • We can find the orthogonal projection w of vector u onto vector v • Essentially, this means the part of u that's in v
Cross product • 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:
Cross product rules • In addition • wu and wv • u, v,and w form a right-handed system
Next time… • More linear algebra • Matrices • Homogeneous notation • Geometric techniques
Reminders • Keep reading Appendix A • Assignment 1 due tonight by midnight! • Keep working on Project 1, due next Friday, February 8 by 11:59